コード例 #1
0
        public static Meridian Create(IPrimeMeridianInfo primeMeridian)
        {
            if(primeMeridian == null) throw new ArgumentNullException("primeMeridian");
            Contract.Ensures(Contract.Result<Meridian>() != null);

            var lon = primeMeridian.Longitude;
            if (primeMeridian.Unit.Name != "degrees") {
                var conversion = SimpleUnitConversionGenerator.FindConversion(primeMeridian.Unit, OgcAngularUnit.DefaultDegrees);
                if (conversion != null) {
                    lon = conversion.TransformValue(lon);
                }
                else {
                    throw new InvalidOperationException("Could not convert meridian unit.");
                }
            }

            var result = new Meridian(lon, primeMeridian.Name);

            if (primeMeridian.Authority != null) {
                int epsgCode;
                if (primeMeridian.Authority.Name == "EPSG" && Int32.TryParse(primeMeridian.Authority.Code, out epsgCode))
                    result.Code = epsgCode;
            }

            return result;
        }
コード例 #2
0
 /// <summary>
 /// Creates a new instance of GeographicInfo
 /// </summary>
 public GeographicInfo()
 {
     _datum = new Datum();
     _meridian = new Meridian();
     _unit = new AngularUnit();
 }
コード例 #3
0
 /// <summary>
 /// Creates a new instance of GeographicInfo
 /// </summary>
 public GeographicInfo()
 {
     _datum    = new Datum();
     _meridian = new Meridian();
     _unit     = new AngularUnit();
 }
コード例 #4
0
 /// <summary>
 /// Returns a representaion of this object as a Proj4 string.
 /// </summary>
 /// <returns></returns>
 public string ToProj4String()
 {
     return(Meridian.ToProj4String() + Datum.ToProj4String());
 }
コード例 #5
0
 /// <summary>
 /// Generates an esri string from the information in this geographic info class, including the name, datum, meridian, and unit.
 /// </summary>
 /// <returns></returns>
 public string ToEsriString()
 {
     return(@"GEOGCS[""" + _name + @"""," + Datum.ToEsriString() + "," + Meridian.ToEsriString() + "," + Unit.ToEsriString() + "]");
 }
コード例 #6
0
 public Proj4MeridianWrapper(Meridian meridian)
     : base(meridian.Name ?? "Unknown", new AuthorityTag("PROJ4", meridian.Code.ToString(CultureInfo.InvariantCulture)))
 {
     Contract.Requires(meridian != null);
     Core = meridian;
 }