using System; using System.Collections.Generic; using System.IO; namespace Kingo.Mobile.Shape2KOTool { public class SpatialRefrenceStruct { public int WKID { get; set; } public string Description { get; set; } public string WKT { get; set; } public double FalseX { get; set; } public double FalseY { get; set; } public double FalseZ { get; set; } public double FalseM { get; set; } public double XYUnits { get; set; } public double ZUnits { get; set; } public double MUnits { get; set; } public double XYCluster_Tol { get; set; } public double ZCluster_Tol { get; set; } public double MCluster_Tol { get; set; } public SpatialRefrenceStruct() { this.FalseY = -10002100.0; this.FalseZ = 0.0; this.FalseM = 0.0; this.XYUnits = 9999.80408481684; this.ZUnits = 1.0; this.MUnits = 1.0; this.XYCluster_Tol = 0.00100000202655792; this.MCluster_Tol = 0.001; this.ZCluster_Tol = 0.001; } static SpatialRefrenceStruct() { SpatialRefrenceStruct.data.Add(new SpatialRefrenceStruct { WKID = -1, Description = "NingboCartesian", WKT = "PROJCS[\"NingboCartesian\",GEOGCS[\"GCS_Beijing_1954\",DATUM[\"D_Beijing_1954\",SPHEROID[\"Krasovsky_1940\",6378245.0,298.3]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Orthographic\"],PARAMETER[\"False_Easting\",600000.0],PARAMETER[\"False_Northing\",3200000.0],PARAMETER[\"Longitude_Of_Center\",0.0],PARAMETER[\"Latitude_Of_Center\",121.5],UNIT[\"Meter\",1.0]]" }); SpatialRefrenceStruct.data.Add(new SpatialRefrenceStruct { WKID = 4326, Description = "GCS WGS 1984", WKT = "GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137,298.257223563]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]]" }); SpatialRefrenceStruct.data.Add(new SpatialRefrenceStruct { WKID = 4490, Description = "GCS China Geodetic Coordinate System 2000", WKT = "GEOGCS[\"GCS_China_Geodetic_Coordinate_System_2000\",DATUM[\"D_China_2000\",SPHEROID[\"CGCS2000\",6378137.0,298.257222101]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]]" }); for (int i = 0; i <= 20; i++) { SpatialRefrenceStruct.data.Add(new SpatialRefrenceStruct { WKID = 2370 + i, Description = string.Format("Xian 1980 3 Degree GK CM {0}E", 75 + i * 3), WKT = string.Format("PROJCS[\"Xian_1980_3_Degree_GK_CM_{0}E\",GEOGCS[\"GCS_Xian_1980\",DATUM[\"D_Xian_1980\",SPHEROID[\"Xian_1980\",6378140.0,298.257]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Gauss_Kruger\"],PARAMETER[\"False_Easting\",500000.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",{0}.0],PARAMETER[\"Scale_Factor\",1.0],PARAMETER[\"Latitude_Of_Origin\",0.0],UNIT[\"Meter\",1.0]]", 75 + i * 3), FalseX = -5123200.0 }); } for (int i = 0; i <= 20; i++) { SpatialRefrenceStruct.data.Add(new SpatialRefrenceStruct { WKID = 2349 + i, Description = string.Format("Xian 1980 3 Degree GK Zone {0}", 25 + i), WKT = string.Format("PROJCS[\"Xian_1980_3_Degree_GK_Zone_{0}\",GEOGCS[\"GCS_Xian_1980\",DATUM[\"D_Xian_1980\",SPHEROID[\"Xian_1980\",6378140.0,298.257]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Gauss_Kruger\"],PARAMETER[\"False_Easting\",{0}500000.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",{1}.0],PARAMETER[\"Scale_Factor\",1.0],PARAMETER[\"Latitude_Of_Origin\",0.0],UNIT[\"Meter\",1.0]]", 25 + i, 75 + i * 3), FalseX = (double)((25 + i - 6) * 1000000) + 876800.0 }); } //加载2000 var basedir = System.AppDomain.CurrentDomain.BaseDirectory; string[] files = Directory.GetFiles(System.IO.Path.Combine(basedir,"CGCS2000")); foreach (string path in files) { string text = File.ReadAllText(path); string[] array2 = text.Split(new char[] { ',' }); int wkid = int.Parse(array2[array2.Length - 1].Replace("]", "")); SpatialRefrenceStruct.data.Add(new SpatialRefrenceStruct { WKID = wkid, Description = Path.GetFileNameWithoutExtension(path), WKT = text }); } } public static List GetAllData() { return SpatialRefrenceStruct.data; } private static List data = new List(); } }