00001 using System; 00002 using System.Collections.Generic; 00003 using System.Linq; 00004 using System.Text; 00005 00006 namespace UtmConvert { 00007 static class Datums { 00008 00009 00010 00011 public static readonly List<Datum> datumList; 00012 static string datumString = "NAD83/WGS84,6378137,6356752.3142,1/298.257223563,Global;GRS 80,6378137,6356752.3141,1/298.257222101,US;WGS72,6378135,6356750.5,1/298.26,NASA DOD;Australian 1965,6378160,6356774.7,1/298.25,Australia;Krasovsky 1940,6378245,6356863.0,1/298.3,Soviet Union;International (1924) -Hayford (1909),6378388,6356911.9,1/297,Global except as listed;Clake 1880,6378249.1,6356514.9,1/293.46,France Africa;Clarke 1866,6378206.4,6356583.8,1/294.98,North America;Airy 1830,6377563.4,6356256.9,1/299.32,Great Britain;Bessel 1841,6377397.2,6356079.0,1/299.15,Central Europe Chile Indonesia;Everest 1830,6377276.3,6356075.4,1/300.80,South Asia"; 00013 static Datums() { 00014 datumList = new List<Datum>(); 00015 while (datumString.Contains(";")) { 00016 Datum d = new Datum(); 00017 d.Name = datumString.Substring(0, datumString.IndexOf(",")); 00018 datumString = datumString.Remove(0, datumString.IndexOf(",") + 1); 00019 d.EquatorialRadius = double.Parse(datumString.Substring(0, datumString.IndexOf(","))); 00020 datumString = datumString.Remove(0, datumString.IndexOf(",") + 1); 00021 d.PolarRadius = double.Parse(datumString.Substring(0, datumString.IndexOf(","))); 00022 datumString = datumString.Remove(0, datumString.IndexOf(",") + 1); 00023 d.Flattening = (d.EquatorialRadius - d.PolarRadius) / d.EquatorialRadius; 00024 datumString = datumString.Remove(0, datumString.IndexOf(",") + 1); 00025 d.Use = datumString.Substring(0, datumString.IndexOf(";")); 00026 datumString = datumString.Remove(0, datumString.IndexOf(";") + 1); 00027 datumList.Add(d); 00028 } 00029 } 00030 } 00031 }