Пример #1
0
 public Proj4CrsGeographic(GeographicInfo geographicInfo)
     : base(geographicInfo.Name ?? geographicInfo.Datum.Name ?? "Unknown", new AuthorityTag("PROJ4", String.Empty))
 {
     Contract.Requires(geographicInfo != null);
     Contract.Requires(geographicInfo.Meridian != null);
     Contract.Requires(geographicInfo.Datum != null);
     Contract.Requires(geographicInfo.Datum.Spheroid != null);
     Core  = geographicInfo;
     Datum = Proj4DatumWrapper.CreateWrapper(geographicInfo);
 }
Пример #2
0
 public static Proj4DatumWrapper CreateWrapper(GeographicInfo geographicInfo)
 {
     if (geographicInfo == null)
     {
         throw new ArgumentNullException("geographicInfo");
     }
     if (geographicInfo.Meridian == null)
     {
         throw new ArgumentException("Must have a meridian.", "geographicInfo");
     }
     Contract.Requires(geographicInfo.Datum != null);
     Contract.Requires(geographicInfo.Datum.Spheroid != null);
     Contract.Ensures(Contract.Result <Proj4DatumWrapper>() != null);
     return(new Proj4DatumWrapper(
                geographicInfo.Datum,
                new Proj4MeridianWrapper(geographicInfo.Meridian)));
 }
Пример #3
0
        public static GeographicInfo CreateGeographic(ICrsGeodetic crsGeodetic)
        {
            if (crsGeodetic == null)
            {
                throw new ArgumentNullException("crsGeodetic");
            }
            Contract.Requires(crsGeodetic.Datum.PrimeMeridian != null);
            Contract.Ensures(Contract.Result <GeographicInfo>() != null);

            var result = new GeographicInfo {
                Name = crsGeodetic.Name
            };

            result.Datum = Proj4DatumWrapper.Create(crsGeodetic.Datum);

            Contract.Assume(crsGeodetic.Datum.PrimeMeridian != null);
            result.Meridian = Proj4MeridianWrapper.Create(crsGeodetic.Datum.PrimeMeridian);

            // TODO: set the unit

            return(result);
        }