Пример #1
0
 /// <summary>
 ///   Initializes a new instance of the <see cref = "ProjectionInfo" /> class.
 /// </summary>
 public ProjectionInfo()
 {
     GeographicInfo = new GeographicInfo();
     Unit = new LinearUnit();
     _scaleFactor = 1; // if not specified, default to 1
     AuxiliarySphereType = AuxiliarySphereType.NotSpecified;
     NoDefs = true;
 }
Пример #2
0
 public Proj4LinearUnit(LinearUnit core)
 {
     if (core == null) throw new ArgumentNullException("core");
     Contract.EndContractBlock();
     Core = core;
 }
Пример #3
0
        public static LinearUnit ConvertToProj4(IUnit unit)
        {
            if (unit == null) throw new ArgumentNullException("unit");
            Contract.EndContractBlock();

            var conversion = SimpleUnitConversionGenerator.FindConversion(unit, MetersUnitWrapped);
            if(conversion != null){
                if(conversion is UnitUnityConversion)
                    return MetersUnit;
                var scalarConversion = conversion as IUnitScalarConversion<double>;
                if (scalarConversion != null) {
                    var knownMatch = KnownUnits.FirstOrDefault(x => x.Meters == scalarConversion.Factor);
                    if (knownMatch != null)
                        return knownMatch;

                    var customResult = new LinearUnit();
                    customResult.Meters = scalarConversion.Factor;
                    customResult.Name = unit.Name;
                    return customResult;
                }
            }
            return new LinearUnit {
                Meters = 1,
                Name = unit.Name
            };
        }
Пример #4
0
 static Proj4LinearUnit()
 {
     KnownUnits = Array.ConvertAll(KnownUnitCodes, uomCode => {
         var result = new LinearUnit();
         result.ReadCode(uomCode);
         return result;
     });
     MetersUnit = KnownUnits.Single(x => x.Meters == 1.0);
     MetersUnitWrapped = new Proj4LinearUnit(MetersUnit);
 }