コード例 #1
0
        public AlbersEqualArea(
            GeographicCoordinate geographicOrigin,
            double latitude1stStandardParallel,
            double latitude2ndStandardParallel,
            Vector2 falseProjectedOffset,
            ISpheroid <double> spheroid
            ) : base(falseProjectedOffset, spheroid)
        {
            Contract.Requires(spheroid != null);
            GeographicOrigin            = geographicOrigin;
            Latitude1stStandardParallel = latitude1stStandardParallel;
            var sinLatParallel1 = Math.Sin(latitude1stStandardParallel);

            Latitude2ndStandardParallel = latitude2ndStandardParallel;
            var sinLatParallel2 = Math.Sin(latitude2ndStandardParallel);

            M1          = Math.Cos(latitude1stStandardParallel) / Math.Sqrt(1.0 - (ESq * sinLatParallel1 * sinLatParallel1));
            M2          = Math.Cos(latitude2ndStandardParallel) / Math.Sqrt(1.0 - (ESq * sinLatParallel2 * sinLatParallel2));
            InvTwoE     = 1.0 / (2.0 * E);
            OneMinusESq = (1.0 - ESq);
            AlphaOrigin = CalculateAlpha(Math.Sin(geographicOrigin.Latitude));
            Alpha1      = CalculateAlpha(sinLatParallel1);
            Alpha2      = CalculateAlpha(sinLatParallel2);
            var m1Sq = M1 * M1;
            var m2Sq = M2 * M2;

            N       = (m1Sq - m2Sq) / (Alpha2 - Alpha1);
            C       = m1Sq + (N * Alpha1);
            POrigin = (MajorAxis * Math.Sqrt(C - (N * AlphaOrigin))) / N;
        }
コード例 #2
0
 public GeographicGeocentricTranslation(ISpheroid<double> spheroidFrom, Vector3 delta, ISpheroid<double> spheroidTo)
     : base(new GeographicGeocentricTransformation(spheroidFrom), new GeocentricGeographicTransformation(spheroidTo))
 {
     Contract.Requires(spheroidFrom != null);
     Contract.Requires(spheroidTo != null);
     Delta = delta;
 }
コード例 #3
0
ファイル: Mercator.cs プロジェクト: GISwilson/pigeoid
        public static Mercator ConstructVariantC(
            GeographicCoordinate falseOrigin,
            Vector2 offsetAtFalseOrigin,
            ISpheroid <double> spheroid
            )
        {
            Contract.Requires(spheroid != null);
            var sinLat      = Math.Sin(falseOrigin.Latitude);
            var eSinLat     = spheroid.E * sinLat;
            var eHalf       = spheroid.E / 2.0;
            var scaleFactor = CalculateScaleFactor(falseOrigin.Latitude, spheroid.ESquared);
            var m           = spheroid.A
                              * scaleFactor
                              * Math.Log(
                Math.Tan((falseOrigin.Latitude / 2.0) + QuarterPi)
                * Math.Pow((1.0 - eSinLat) / (1.0 + eSinLat), eHalf)
                );
            var falseProjectedOffset = new Vector2(
                offsetAtFalseOrigin.X,
                offsetAtFalseOrigin.Y - m);

            return(new Mercator(
                       falseOrigin.Longitude,
                       scaleFactor,
                       falseProjectedOffset,
                       spheroid));
        }
コード例 #4
0
        public LambertAzimuthalEqualAreaSpherical(
            GeographicCoordinate geogOrigin,
            Vector2 falseOffset,
            ISpheroid <double> spheroid
            ) : base(falseOffset, spheroid)
        {
            Contract.Requires(spheroid != null);
            GeographicOrigin = geogOrigin;

            var oneMinusESq = 1 - ESq;

            if (E == 0)
            {
                R = MajorAxis;
            }
            else
            {
                R = MajorAxis * Math.Sqrt(
                    (
                        1.0
                        - (
                            (oneMinusESq / (2.0 * E))
                            * Math.Log((1 - E) / (1 + E))
                            )
                    ) / 2.0
                    );
            }

            _sinLatOrg = Math.Sin(geogOrigin.Latitude);
            _cosLatOrg = Math.Cos(geogOrigin.Latitude);
        }
コード例 #5
0
        /// <summary>
        /// Constructs a new Lambert Conic Conformal projection from 1 standard parallel.
        /// </summary>
        /// <param name="geographicOrigin">The geographic origin.</param>
        /// <param name="originScaleFactor">The scale factor at the origin.</param>
        /// <param name="falseProjectedOffset">The false projected offset.</param>
        /// <param name="spheroid">The spheroid.</param>
        /// <exception cref="System.ArgumentException">An invalid N value was generated from the <paramref name="geographicOrigin">geographic origin</paramref> latitude.</exception>
        public LambertConicConformal1Sp(
            GeographicCoordinate geographicOrigin,
            double originScaleFactor,
            Vector2 falseProjectedOffset,
            ISpheroid <double> spheroid
            ) : base(geographicOrigin, falseProjectedOffset, spheroid)
        {
            Contract.Requires(spheroid != null);
            OriginScaleFactor = originScaleFactor;
            var originParallelSin = Math.Sin(geographicOrigin.Latitude);
            var eParallelSin      = E * originParallelSin;
            var tOrigin           = Math.Tan(QuarterPi - (geographicOrigin.Latitude / 2.0))
                                    / Math.Pow((1.0 - eParallelSin) / (1.0 + eParallelSin), EHalf);

            N = Math.Sin(geographicOrigin.Latitude);

            // ReSharper disable CompareOfFloatsByEqualityOperator
            if (0 == N || Double.IsNaN(N))
            {
                throw new ArgumentException("Invalid N value.", "geographicOrigin");
            }
            // ReSharper restore CompareOfFloatsByEqualityOperator

            F = (Math.Cos(geographicOrigin.Latitude) / Math.Sqrt(1.0 - (ESq * originParallelSin * originParallelSin)))
                / (N * Math.Pow(tOrigin, N));
            Af             = MajorAxis * F * originScaleFactor;
            ROrigin        = Af * Math.Pow(tOrigin, N);
            InvN           = 1.0 / N;
            NorthingOffset = falseProjectedOffset.Y + ROrigin;
        }
コード例 #6
0
        /// <summary>
        /// create a crazy coordinate system
        /// </summary>
        /// <returns></returns>
        private ISpatialReference CreateGeographicSpatialReference()
        {
            ISpatialReferenceFactory    spatialRefFatcory = new SpatialReferenceEnvironmentClass();
            IGeographicCoordinateSystem geoCoordSys;

            geoCoordSys = spatialRefFatcory.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_WGS1984);

            //assign a user defined datum to the SR (just for the test)
            IDatum     datum     = new DatumClass();
            IDatumEdit datumEdit = (IDatumEdit)datum;
            ISpheroid  spheroid  = spatialRefFatcory.CreateSpheroid((int)esriSRSpheroidType.esriSRSpheroid_Clarke1880);

            datumEdit.DefineEx("MyDatum", "My Datum", "MDTM", "", spheroid);

            IPrimeMeridian primeMeridian = spatialRefFatcory.CreatePrimeMeridian((int)esriSRPrimeMType.esriSRPrimeM_Greenwich);
            IAngularUnit   angularUnits  = spatialRefFatcory.CreateUnit((int)esriSRUnitType.esriSRUnit_Degree) as IAngularUnit;
            IGeographicCoordinateSystemEdit geoCoordSysEdit = (IGeographicCoordinateSystemEdit)geoCoordSys;

            geoCoordSysEdit.DefineEx("MyGeoCoordSys", "MyGeoCoordSys", "MGCS", "", "", datum, primeMeridian, angularUnits);

            geoCoordSys.SetFalseOriginAndUnits(-180.0, -180.0, 5000000.0);
            geoCoordSys.SetZFalseOriginAndUnits(0.0, 100000.0);
            geoCoordSys.SetMFalseOriginAndUnits(0.0, 100000.0);

            return(geoCoordSys as ISpatialReference);
        }
コード例 #7
0
        public ObliqueStereographic(
            GeographicCoordinate geographicOrigin,
            double scaleFactor,
            Vector2 falseProjectedOffset,
            ISpheroid <double> spheroid
            ) : base(falseProjectedOffset, spheroid)
        {
            Contract.Requires(spheroid != null);
            GeographicOrigin = geographicOrigin;
            ScaleFactor      = scaleFactor;
            var sinLat = Math.Sin(GeographicOrigin.Latitude);
            var cosLat = Math.Cos(GeographicOrigin.Latitude);
            var oneMinusESquareSinLatSquare = 1 - (ESq * sinLat * sinLat);
            var po = (MajorAxis * (1 - ESq)) / Math.Pow(oneMinusESquareSinLatSquare, 1.5);
            var vo = MajorAxis / Math.Sqrt(oneMinusESquareSinLatSquare);

            R = Math.Sqrt(po * vo);
            N = Math.Sqrt(1 + ((ESq * cosLat * cosLat * cosLat * cosLat) / (1 - ESq)));
            var s1 = (1 + sinLat) / (1 - sinLat);
            var s2 = (1 - (E * sinLat)) / (1 + (E * sinLat));
            var w1 = Math.Pow(s1 * Math.Pow(s2, E), N);

            SinChiOrigin = (w1 - 1) / (w1 + 1);
            C            = (N + sinLat) * (1 - SinChiOrigin) / ((N - sinLat) * (1 + SinChiOrigin));
            var w2 = C * w1;

            ChiOrigin    = Math.Asin((w2 - 1) / (w2 + 1));
            SinChiOrigin = Math.Sin(ChiOrigin);
            CosChiOrigin = Math.Cos(ChiOrigin);
            Rk2          = R * scaleFactor * 2.0;
        }
コード例 #8
0
            private static ISpheroid <double> ConvertSpheroidUnit(ISpheroid <double> spheroid, IUnit toUnit)
            {
                Contract.Requires(spheroid != null);
                Contract.Ensures(Contract.Result <ISpheroid <double> >() != null);
                if (null == toUnit)
                {
                    return(spheroid);
                }

                var spheroidInfo = spheroid as ISpheroidInfo;

                if (null == spheroidInfo)
                {
                    return(spheroid);
                }

                var fromUnit = spheroidInfo.AxisUnit;

                if (null != fromUnit && !UnitEqualityComparer.Default.Equals(fromUnit, toUnit) && UnitEqualityComparer.Default.AreSameType(fromUnit, toUnit))
                {
                    var conversion = SimpleUnitConversionGenerator.FindConversion(spheroidInfo.AxisUnit, toUnit);
                    if (null != conversion && !(conversion is UnitUnityConversion))
                    {
                        return(new SpheroidLinearUnitConversionWrapper(spheroidInfo, conversion));
                    }
                }
                return(spheroid);
            }
コード例 #9
0
 public GeographicGeocentricTranslation(ISpheroid <double> spheroidFrom, Vector3 delta, ISpheroid <double> spheroidTo)
     : base(new GeographicGeocentricTransformation(spheroidFrom), new GeocentricGeographicTransformation(spheroidTo))
 {
     Contract.Requires(spheroidFrom != null);
     Contract.Requires(spheroidTo != null);
     Delta = delta;
 }
コード例 #10
0
 public KrovakModifiedNorth(
     GeographicCoordinate geographicOrigin,
     double latitudeOfPseudoStandardParallel,
     double azimuthOfInitialLine,
     double scaleFactor,
     Vector2 falseProjectedOffset,
     ISpheroid<double> spheroid,
     Point2 evaluationPoint,
     double[] constants
 )
     : this(new KrovakModified(
     geographicOrigin,
     latitudeOfPseudoStandardParallel,
     azimuthOfInitialLine,
     scaleFactor,
     falseProjectedOffset,
     spheroid,
     evaluationPoint,
     constants
 ))
 {
     Contract.Requires(spheroid != null);
     Contract.Requires(constants != null);
     Contract.Requires(constants.Length == 10);
 }
コード例 #11
0
 private Proj4Spheroid(string code, string name, ISpheroid <double> spheroid)
 {
     Contract.Requires(!String.IsNullOrEmpty(name));
     Contract.Requires(spheroid != null);
     _code     = code;
     Name      = name;
     _spheroid = spheroid;
 }
コード例 #12
0
 protected LambertConicConformal(
     GeographicCoordinate geographicOrigin,
     Vector2 falseProjectedOffset,
     ISpheroid <double> spheroid
     ) : base(geographicOrigin, falseProjectedOffset, spheroid)
 {
     Contract.Requires(spheroid != null);
 }
コード例 #13
0
 public GeocentricTransformationGeographicWrapper(ISpheroid<double> fromSpheroid, ISpheroid<double> toSpheroid, ITransformation<Point3> core)
     : base(fromSpheroid, toSpheroid)
 {
     if (null == core) throw new ArgumentNullException("core");
     Contract.Requires(fromSpheroid != null);
     Contract.Requires(toSpheroid != null);
     _core = core;
 }
コード例 #14
0
 public LambertAzimuthalEqualAreaPolar(
     GeographicCoordinate geogOrigin,
     Vector2 falseOffset,
     ISpheroid <double> spheroid
     ) : base(geogOrigin, falseOffset, spheroid)
 {
     IsNorth = geogOrigin.Latitude >= 0;
 }
コード例 #15
0
ファイル: Sphere.cs プロジェクト: aarondandy/vertesaur
 /// <inheritdoc/>
 public bool Equals(ISpheroid <double> other)
 {
     return(
         !ReferenceEquals(null, other) &&
         Radius == other.A &&
         (Radius == other.B || other.F == 0)
         );
 }
コード例 #16
0
 public MolodenskyBadekasGeographicTransformation(ISpheroid<double> spheroidFrom, MolodenskyBadekasTransformation molodenskyBadekas, ISpheroid<double> spheroidTo)
     : base(spheroidFrom, spheroidTo)
 {
     if (null == molodenskyBadekas) throw new ArgumentNullException("molodenskyBadekas");
     Contract.Requires(spheroidFrom != null);
     Contract.Requires(spheroidTo != null);
     MolodenskyBadekas = molodenskyBadekas;
 }
コード例 #17
0
        public LabordeObliqueMercator(
            GeographicCoordinate projectionCenter,
            double azimuthOfInitialLine,
            double scaleFactor,
            ISpheroid <double> spheroid,
            Vector2 falseProjectedOffset,
            bool isGeogCenterDefinedOnParis,
            bool geogCoordinatesAreRelativeToGreenwich
            ) : base(falseProjectedOffset, spheroid)
        {
            Contract.Requires(spheroid != null);

            IsGeogCenterDefinedOnParis            = isGeogCenterDefinedOnParis;
            GeogCoordinatesAreRelativeToGreenwich = geogCoordinatesAreRelativeToGreenwich;

            Azimuth = azimuthOfInitialLine;

            if (IsGeogCenterDefinedOnParis)
            {
                ParisCenterLongitude     = projectionCenter.Longitude;
                GreenwichCenterLongitude = projectionCenter.Longitude + ParisLongitudeOffset;
            }
            else
            {
                GreenwichCenterLongitude = projectionCenter.Longitude;
                ParisCenterLongitude     = projectionCenter.Longitude - ParisLongitudeOffset;
            }

            var cosLatCenter  = Math.Cos(projectionCenter.Latitude);
            var sinLatCenter  = Math.Sin(projectionCenter.Latitude);
            var oneMinusESq   = 1 - ESq;
            var eSinLatCenter = E * sinLatCenter;

            Beta = Math.Sqrt(
                (
                    (ESq * cosLatCenter * cosLatCenter * cosLatCenter * cosLatCenter)
                    / oneMinusESq
                )
                + 1);
            SLatitude = Math.Asin(sinLatCenter / Beta);
            R         = MajorAxis * scaleFactor * (
                Math.Sqrt(oneMinusESq)
                / (1 - (ESq * sinLatCenter * sinLatCenter))
                );
            C = Math.Log(Math.Tan(QuarterPi + (SLatitude / 2.0)))
                - (
                Beta
                * Math.Log(
                    Math.Tan(QuarterPi + (projectionCenter.Latitude / 2.0))
                    * Math.Pow(
                        (1 - eSinLatCenter) / (1 + eSinLatCenter),
                        EHalf
                        )
                    )
                );
            ;
        }
コード例 #18
0
 /// <summary>
 /// Constructs a new hyperbolic cassini soldner projection.
 /// </summary>
 /// <param name="naturalOrigin">The natural origin.</param>
 /// <param name="falseProjectedOffset">The false projected offset.</param>
 /// <param name="spheroid">The spheroid.</param>
 public HyperbolicCassiniSoldner(
     GeographicCoordinate naturalOrigin,
     Vector2 falseProjectedOffset,
     ISpheroid <double> spheroid
     )
     : base(naturalOrigin, falseProjectedOffset, spheroid)
 {
     Contract.Requires(spheroid != null);
     OneMinusESqMajorAxisSq6 = OneMinusESq * MajorAxis * MajorAxis * 6.0;
 }
コード例 #19
0
 protected LambertConicBase(
     GeographicCoordinate geographicOrigin,
     Vector2 falseProjectedOffset,
     ISpheroid<double> spheroid
 )
     : base(falseProjectedOffset, spheroid)
 {
     Contract.Requires(spheroid != null);
     GeographicOrigin = geographicOrigin;
 }
コード例 #20
0
 public PopularVisualizationPseudoMercator(
     GeographicCoordinate geographicOrigin,
     Vector2 falseProjectedOffset,
     ISpheroid <double> spheroid
     ) : base(falseProjectedOffset, spheroid)
 {
     Contract.Requires(spheroid != null);
     GeographicOrigin = geographicOrigin;
     R = spheroid.A;
 }
コード例 #21
0
ファイル: EpsgEllipsoid.cs プロジェクト: aarondandy/pigeoid
 internal EpsgEllipsoid(ushort code, string name, EpsgUnit unit, ISpheroid<double> core)
 {
     Contract.Requires(!String.IsNullOrEmpty(name));
     Contract.Requires(unit != null);
     Contract.Requires(core != null);
     _code = code;
     Name = name;
     Core = core;
     AxisUnit = unit;
 }
コード例 #22
0
 /// <summary>
 /// Constructs a new Lambert Conic Conformal Belgium projection.
 /// </summary>
 /// <param name="geographicOrigin">The geographic origin.</param>
 /// <param name="firstParallel">The first parallel.</param>
 /// <param name="secondParallel">The second parallel.</param>
 /// <param name="falseProjectedOffset">The false projected offset.</param>
 /// <param name="spheroid">The spheroid.</param>
 public LambertConicConformalBelgium(
     GeographicCoordinate geographicOrigin,
     double firstParallel,
     double secondParallel,
     Vector2 falseProjectedOffset,
     ISpheroid <double> spheroid
     ) : base(geographicOrigin, firstParallel, secondParallel, falseProjectedOffset, spheroid)
 {
     Contract.Requires(spheroid != null);
 }
コード例 #23
0
 internal EpsgEllipsoid(ushort code, string name, EpsgUnit unit, ISpheroid <double> core)
 {
     Contract.Requires(!String.IsNullOrEmpty(name));
     Contract.Requires(unit != null);
     Contract.Requires(core != null);
     _code    = code;
     Name     = name;
     Core     = core;
     AxisUnit = unit;
 }
コード例 #24
0
ファイル: Guam.cs プロジェクト: GISwilson/pigeoid
 public Guam(GeographicCoordinate origin, Vector2 offset, ISpheroid <double> spheroid) : base(offset, spheroid)
 {
     Contract.Requires(spheroid != null);
     GeographicOrigin = origin;
     E4                  = ESq * ESq;
     E6                  = E4 * ESq;
     MConstant1          = (1 - (ESq / 4.0) - (E4 * 3.0 / 64.0) - (E6 * 5.0 / 256.0));
     SinLatOrigin        = Math.Sin(origin.Latitude);
     SinLatOriginSquared = SinLatOrigin * SinLatOrigin;
     MOrigin             = CalculateM(origin.Latitude);
 }
コード例 #25
0
 public MolodenskyBadekasGeographicTransformation(ISpheroid <double> spheroidFrom, MolodenskyBadekasTransformation molodenskyBadekas, ISpheroid <double> spheroidTo)
     : base(spheroidFrom, spheroidTo)
 {
     if (null == molodenskyBadekas)
     {
         throw new ArgumentNullException("molodenskyBadekas");
     }
     Contract.Requires(spheroidFrom != null);
     Contract.Requires(spheroidTo != null);
     MolodenskyBadekas = molodenskyBadekas;
 }
コード例 #26
0
 public GeocentricTransformationGeographicWrapper(ISpheroid <double> fromSpheroid, ISpheroid <double> toSpheroid, ITransformation <Point3> core)
     : base(fromSpheroid, toSpheroid)
 {
     if (null == core)
     {
         throw new ArgumentNullException("core");
     }
     Contract.Requires(fromSpheroid != null);
     Contract.Requires(toSpheroid != null);
     _core = core;
 }
コード例 #27
0
 public SpheroidLinearUnitConversionWrapper(string name, IUnit unit, ISpheroid<double> shapeData, double a, double b)
 {
     if(unit == null) throw new ArgumentNullException("unit");
     if(shapeData == null) throw new ArgumentNullException("shapeData");
     Contract.EndContractBlock();
     _name = name;
     _shapeData = shapeData;
     AxisUnit = unit;
     A = a;
     B = b;
 }
コード例 #28
0
 public Bonne(GeographicCoordinate geographicOrigin, Vector2 offset, ISpheroid <double> spheroid) : base(offset, spheroid)
 {
     Contract.Requires(spheroid != null);
     GeographicOrigin = geographicOrigin;
     E4 = ESq * ESq;
     E6 = E4 * ESq;
     MCalculationConstant1 = (1 - (ESq / 4.0) - (E4 * 3.0 / 64.0) - (E6 * 5.0 / 256.0));
     MOrigin       = CalculateM(geographicOrigin.Latitude);
     SinLatOrigin  = Math.Sin(GeographicOrigin.Latitude);
     MScalarOrigin = Math.Cos(geographicOrigin.Latitude) / Math.Sqrt(ESq * SinLatOrigin * SinLatOrigin);
 }
コード例 #29
0
ファイル: OgcSpheroid.cs プロジェクト: GISwilson/pigeoid
 /// <summary>
 /// Constructs a new spheroid.
 /// </summary>
 /// <param name="spheroid">The spheroid this spheroid is based on.</param>
 /// <param name="name">The name of this spheroid.</param>
 /// <param name="axisUnit">The unit the axis is measured in.</param>
 /// <param name="authority">The authority.</param>
 public OgcSpheroid(ISpheroid <double> spheroid, string name, IUnit axisUnit, IAuthorityTag authority = null)
     : base(name, authority)
 {
     if (spheroid == null)
     {
         throw new ArgumentNullException("spheroid");
     }
     Contract.Requires(name != null);
     Spheroid = spheroid;
     AxisUnit = axisUnit;
 }
コード例 #30
0
 public AmericanPolyconic(
     GeographicCoordinate geographicOrigin,
     Vector2 falseProjectedOffset,
     ISpheroid <double> spheroid
     ) : base(falseProjectedOffset, spheroid)
 {
     Contract.Requires(spheroid != null);
     E4 = ESq * ESq;
     E6 = E4 * ESq;
     GeographicOrigin = geographicOrigin;
     MOrigin          = CalculateMValue(geographicOrigin.Latitude);
 }
コード例 #31
0
ファイル: Mercator.cs プロジェクト: GISwilson/pigeoid
 /// <summary>
 /// Constructs a Mercator projection from 2 standard parallels.
 /// </summary>
 /// <param name="geographicOrigin">The geographic origin.</param>
 /// <param name="falseProjectedOffset">The false projected offset.</param>
 /// <param name="spheroid">The spheroid.</param>
 public Mercator(
     GeographicCoordinate geographicOrigin,
     Vector2 falseProjectedOffset,
     ISpheroid <double> spheroid
     ) : this(
         geographicOrigin.Longitude,
         CalculateScaleFactor(geographicOrigin.Latitude, spheroid.ESquared),
         falseProjectedOffset,
         spheroid
         )
 {
     Contract.Requires(spheroid != null);
 }
コード例 #32
0
 /// <summary>
 /// Creates a new geocentric to topocentric transformation.
 /// </summary>
 /// <param name="topocentricOrigin">The topocentric origin.</param>
 /// <param name="spheroid">The spheroid.</param>
 public GeocentricTopocentricTransformation(
     Point3 topocentricOrigin,
     ISpheroid <double> spheroid
     )
 {
     if (spheroid == null)
     {
         throw new ArgumentNullException("spheroid");
     }
     Contract.EndContractBlock();
     GeographicTransform = new GeographicGeocentricTransformation(spheroid);
     SetTopocentricOrigin(topocentricOrigin);
 }
コード例 #33
0
        public GeographicGeocentricTransformation(ISpheroid <double> spheroid)
        {
            if (null == spheroid)
            {
                throw new ArgumentNullException("spheroid");
            }
            Contract.EndContractBlock();

            MajorAxis   = spheroid.A;
            MinorAxis   = spheroid.B;
            ESq         = spheroid.ESquared;
            OneMinusESq = 1.0 - ESq;
            Spheroid    = spheroid;
        }
コード例 #34
0
 public LambertConicConformal1SpWest(
     GeographicCoordinate geographicOrigin,
     double originScaleFactor,
     Vector2 falseProjectedOffset,
     ISpheroid <double> spheroid
     ) : base(
         geographicOrigin,
         originScaleFactor,
         new Vector2(-falseProjectedOffset.X, falseProjectedOffset.Y),
         spheroid
         )
 {
     Contract.Requires(spheroid != null);
 }
コード例 #35
0
 public TransverseMercatorSouth(
     GeographicCoordinate naturalOrigin,
     Vector2 falseProjectedOffset,
     double scaleFactor,
     ISpheroid <double> spheroid
     ) : base(
         naturalOrigin,
         new Vector2(-falseProjectedOffset.X, -falseProjectedOffset.Y),
         scaleFactor,
         spheroid
         )
 {
     Contract.Requires(spheroid != null);
 }
コード例 #36
0
 public VerticalPerspective(GeographicHeightCoordinate origin, double viewPointHeight, ISpheroid <double> spheroid)
 {
     if (spheroid == null)
     {
         throw new ArgumentNullException("spheroid");
     }
     Contract.EndContractBlock();
     Origin                  = origin;
     ViewPointHeight         = viewPointHeight;
     Spheroid                = spheroid;
     SinLatOrigin            = Math.Sin(origin.Latitude);
     CosLatOrigin            = Math.Cos(origin.Latitude);
     ESq                     = spheroid.ESquared;
     OriginRadiusOfCurvature = spheroid.A / Math.Sqrt(1 - (ESq * SinLatOrigin * SinLatOrigin));
 }
コード例 #37
0
 protected LambertAzimuthalEqualArea(
     GeographicCoordinate geogOrigin,
     Vector2 falseOffset,
     ISpheroid <double> spheroid
     ) : base(falseOffset, spheroid)
 {
     GeographicOrigin = geogOrigin;
     OneMinusESq      = 1.0 - ESq;
     OneMinusE        = 1.0 - E;
     OnePlusE         = 1.0 + E;
     OneOverTwoE      = 1.0 / (2.0 * E);
     SinLatOrigin     = Math.Sin(GeographicOrigin.Latitude);
     CosLatOrigin     = Math.Cos(GeographicOrigin.Latitude);
     ESinLatOrigin    = E * SinLatOrigin;
     QParallel        = OneMinusESq * ((1.0 / OneMinusESq) - (OneOverTwoE * Math.Log(OneMinusE / OnePlusE)));
 }
コード例 #38
0
ファイル: NeysProjection.cs プロジェクト: aarondandy/pigeoid
 public NeysProjection(
     GeographicCoordinate geographicOrigin,
     double standardParallel,
     Vector2 falseProjectedOffset,
     ISpheroid<double> spheroid
 )
     : base(new GeographicCoordinate(
         geographicOrigin.Latitude,
         geographicOrigin.Longitude > Math.PI ? (geographicOrigin.Longitude - TwoPi) : geographicOrigin.Longitude
         ),
     geographicOrigin.Latitude >= 0 ? standardParallel : -standardParallel,
     geographicOrigin.Latitude >= 0 ? MaximumLatitude : -MaximumLatitude,
     falseProjectedOffset,
     spheroid)
 {
     Contract.Requires(spheroid != null);
 }
コード例 #39
0
ファイル: KrovakNorth.cs プロジェクト: aarondandy/pigeoid
 public KrovakNorth(
     GeographicCoordinate geographicOrigin,
     double latitudeOfPseudoStandardParallel,
     double azimuthOfInitialLine,
     double scaleFactor,
     Vector2 falseProjectedOffset,
     ISpheroid<double> spheroid
 )
     : this(new Krovak(
     geographicOrigin,
     latitudeOfPseudoStandardParallel,
     azimuthOfInitialLine,
     scaleFactor,
     falseProjectedOffset,
     spheroid
 ))
 {
     Contract.Requires(spheroid != null);
 }
コード例 #40
0
            private static ISpheroid<double> ConvertSpheroidUnit(ISpheroid<double> spheroid, IUnit toUnit)
            {
                Contract.Requires(spheroid != null);
                Contract.Ensures(Contract.Result<ISpheroid<double>>() != null);
                if (null == toUnit)
                    return spheroid;

                var spheroidInfo = spheroid as ISpheroidInfo;
                if (null == spheroidInfo)
                    return spheroid;

                var fromUnit = spheroidInfo.AxisUnit;
                if (null != fromUnit && !UnitEqualityComparer.Default.Equals(fromUnit, toUnit) && UnitEqualityComparer.Default.AreSameType(fromUnit, toUnit)) {
                    var conversion = SimpleUnitConversionGenerator.FindConversion(spheroidInfo.AxisUnit, toUnit);
                    if (null != conversion && !(conversion is UnitUnityConversion))
                        return new SpheroidLinearUnitConversionWrapper(spheroidInfo, conversion);
                }
                return spheroid;
            }