public MapProjectionCoordinates(CoordinateType.Enum coordinateType, string warningMessage, double easting, double northing)
 {
     this.coordinateType = coordinateType;
     this.easting        = easting;
     this.northing       = northing;
     this.warningMessage = warningMessage;
 }
예제 #2
0
 public GeodeticCoordinates(CoordinateType.Enum coordinateType)
 {
     this.coordinateType = coordinateType;
     this.longitude      = 0.0;
     this.latitude       = 0.0;
     this.height         = 0.0;
 }
예제 #3
0
 public UPSCoordinates(CoordinateType.Enum coordinateType)
 {
     this.coordinateType = coordinateType;
     this.hemisphere     = 'N';
     this.easting        = 0;
     this.northing       = 0;
 }
예제 #4
0
 public UPSCoordinates(CoordinateType.Enum coordinateType, char hemisphere, double easting, double northing)
 {
     this.coordinateType = coordinateType;
     this.hemisphere     = hemisphere;
     this.easting        = easting;
     this.northing       = northing;
 }
예제 #5
0
 public MGRSorUSNGCoordinates(CoordinateType.Enum coordinateType, string warningMessage, string MGRSString, Precision.Enum precision)
 {
     this.coordinateType = coordinateType;
     this.precision      = precision;
     this.MGRSString     = MGRSString;
     this.warningMessage = warningMessage;
 }
예제 #6
0
 public GeodeticCoordinates(CoordinateType.Enum coordinateType, double longitude, double latitude, double height)
 {
     this.coordinateType = coordinateType;
     this.longitude      = longitude;
     this.latitude       = latitude;
     this.height         = height;
 }
예제 #7
0
 public PolarStereographicStandardParallelParameters(CoordinateType.Enum coordinateType, double centralMeridian, double standardParallel, double falseEasting, double falseNorthing)
 {
     this.coordinateType   = coordinateType;
     this.centralMeridian  = centralMeridian;
     this.standardParallel = standardParallel;
     this.falseEasting     = falseEasting;
     this.falseNorthing    = falseNorthing;
 }
예제 #8
0
 public PolarStereographicStandardParallelParameters(CoordinateType.Enum coordinateType)
 {
     this.coordinateType   = coordinateType;
     this.centralMeridian  = 0;
     this.standardParallel = 0;
     this.falseEasting     = 0;
     this.falseNorthing    = 0;
 }
예제 #9
0
 public GeodeticCoordinates(CoordinateType.Enum coordinateType, string warningMessage, double longitude, double latitude, double height)
 {
     this.coordinateType = coordinateType;
     this.longitude      = longitude;
     this.latitude       = latitude;
     this.height         = height;
     this.warningMessage = warningMessage;
 }
예제 #10
0
 public UPSCoordinates(CoordinateType.Enum coordinateType, string warningMessage, char hemisphere, double easting, double northing)
 {
     this.coordinateType = coordinateType;
     this.hemisphere     = hemisphere;
     this.easting        = easting;
     this.northing       = northing;
     this.warningMessage = warningMessage;
 }
예제 #11
0
 public MapProjection5Parameters(CoordinateType.Enum coordinateType)
 {
     this.coordinateType  = coordinateType;
     this.centralMeridian = 0;
     this.originLatitude  = 0;
     this.scaleFactor     = 1.0;
     this.falseEasting    = 0;
     this.falseNorthing   = 0;
 }
예제 #12
0
 public PolarStereographicScaleFactorParameters(CoordinateType.Enum coordinateType, double centralMeridian, double scaleFactor, char hemisphere, double falseEasting, double falseNorthing)
 {
     this.coordinateType  = coordinateType;
     this.centralMeridian = centralMeridian;
     this.scaleFactor     = scaleFactor;
     this.hemisphere      = hemisphere;
     this.falseEasting    = falseEasting;
     this.falseNorthing   = falseNorthing;
 }
예제 #13
0
 public MapProjection5Parameters(CoordinateType.Enum coordinateType, double centralMeridian, double originLatitude, double scaleFactor, double falseEasting, double falseNorthing)
 {
     this.coordinateType  = coordinateType;
     this.centralMeridian = centralMeridian;
     this.originLatitude  = originLatitude;
     this.scaleFactor     = scaleFactor;
     this.falseEasting    = falseEasting;
     this.falseNorthing   = falseNorthing;
 }
예제 #14
0
 public PolarStereographicScaleFactorParameters(CoordinateType.Enum coordinateType)
 {
     this.coordinateType  = coordinateType;
     this.centralMeridian = 0;
     this.scaleFactor     = 0;
     this.hemisphere      = 'N';
     this.falseEasting    = 0;
     this.falseNorthing   = 0;
 }
예제 #15
0
 public CoordinateTuple()
 {
     this.coordinateType = CoordinateType.Enum.geodetic;
     this.errorMessage   = "";
     this.warningMessage = "";
 }
예제 #16
0
 /// <summary>
 /// Constructs a new set of UTM Parameters.
 /// </summary>
 /// <param name="coordinateType">Coordinate Type</param>
 /// <param name="zone">Zone</param>
 /// <param name="zoneOverride">Zone Override</param>
 public UTMParameters(CoordinateType.Enum coordinateType, long zone, long zoneOverride)
 {
     this.coordinateType = coordinateType;
     this.zone           = zone;
     this.zoneOverride   = zoneOverride;
 }
예제 #17
0
 public MGRSorUSNGCoordinates(CoordinateType.Enum coordinateType)
 {
     this.coordinateType = coordinateType;
     this.precision      = Precision.Enum.tenthOfSecond;
     this.MGRSString     = "31NEA0000000000";
 }
예제 #18
0
        /// <summary>
        /// The constructor receives the ellipsoid
        /// parameters and Polar Stereograpic (Scale Factor) projection parameters as inputs, and
        /// sets the corresponding state variables.  If any errors occur, an
        /// exception is thrown with a description of the error.
        /// </summary>
        /// <param name="ellipsoidSemiMajorAxis">Semi-major axis of ellipsoid, in meters</param>
        /// <param name="ellipsoidFlattening">Flattening of ellipsoid</param>
        /// <param name="centralMeridian">Longitude down from pole, in radians</param>
        /// <param name="scaleFactor">Scale Factor</param>
        /// <param name="hemisphere">Hemisphere</param>
        /// <param name="falseEasting">Easting (X) at center of projection, in meters</param>
        /// <param name="falseNorthing">Northing (Y) at center of projection, in meters</param>
        public PolarStereographic(double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double centralMeridian, double scaleFactor, char hemisphere, double falseEasting, double falseNorthing)
        {
            this.coordinateType          = CoordinateType.Enum.polarStereographicScaleFactor;
            this.es                      = 0.08181919084262188000;
            this.es_OVER_2               = .040909595421311;
            this.Southern_Hemisphere     = 0;
            this.Polar_tc                = 1.0;
            this.Polar_k90               = 1.0033565552493;
            this.Polar_a_mc              = 6378137.0;
            this.two_Polar_a             = 12756274.0;
            this.Polar_Central_Meridian  = 0.0;
            this.Polar_Standard_Parallel = PI_OVER_2;
            this.Polar_False_Easting     = 0.0;
            this.Polar_False_Northing    = 0.0;
            this.Polar_Scale_Factor      = 1.0;
            this.Polar_Delta_Easting     = 12713601.0;
            this.Polar_Delta_Northing    = 12713601.0;

            double es2;
            double sinolat, cosolat;
            double essin;
            double pow_es;
            double mc;
            double one_PLUS_es, one_MINUS_es;
            double one_PLUS_es_sk, one_MINUS_es_sk;
            double sk, sk_PLUS_1;
            double tolerance   = 1.0e-15;
            int    count       = 30;
            double inv_f       = 1 / ellipsoidFlattening;
            string errorStatus = "";

            if (ellipsoidSemiMajorAxis <= 0.0)
            { /* Semi-major axis must be greater than zero */
                errorStatus += ErrorMessages.semiMajorAxis;
            }
            if ((inv_f < 250) || (inv_f > 350))
            { /* Inverse flattening must be between 250 and 350 */
                errorStatus += ErrorMessages.ellipsoidFlattening;
            }
            if ((scaleFactor < MIN_SCALE_FACTOR) || (scaleFactor > MAX_SCALE_FACTOR))
            {
                errorStatus += ErrorMessages.scaleFactor;
            }
            if ((centralMeridian < -Math.PI) || (centralMeridian > TWO_PI))
            { /* Origin Longitude out of range */
                errorStatus += ErrorMessages.centralMeridian;
            }
            if ((hemisphere != 'N') && (hemisphere != 'S'))
            {
                errorStatus += ErrorMessages.hemisphere;
            }

            if (errorStatus.Length > 0)
            {
                // throw CoordinateConversionException(errorStatus);
            }

            this.semiMajorAxis        = ellipsoidSemiMajorAxis;
            this.flattening           = ellipsoidFlattening;
            this.Polar_Scale_Factor   = scaleFactor;
            this.Polar_False_Easting  = falseEasting;
            this.Polar_False_Northing = falseNorthing;

            this.two_Polar_a = 2.0 * this.semiMajorAxis;
            es2       = 2 * this.flattening - this.flattening * this.flattening;
            es        = Math.Sqrt(es2);
            es_OVER_2 = es / 2.0;

            one_PLUS_es    = 1.0 + es;
            one_MINUS_es   = 1.0 - es;
            this.Polar_k90 = Math.Sqrt(Math.Pow(one_PLUS_es, one_PLUS_es) * Math.Pow(one_MINUS_es, one_MINUS_es));

            sk        = 0;
            sk_PLUS_1 = -1 + 2 * this.Polar_Scale_Factor;
            while (Math.Abs(sk_PLUS_1 - sk) > tolerance && count > 0)
            {
                sk              = sk_PLUS_1;
                one_PLUS_es_sk  = 1.0 + es * sk;
                one_MINUS_es_sk = 1.0 - es * sk;
                sk_PLUS_1       = ((2 * this.Polar_Scale_Factor * Math.Sqrt(Math.Pow(one_PLUS_es_sk, one_PLUS_es) * Math.Pow(one_MINUS_es_sk, one_MINUS_es))) / this.Polar_k90) - 1;
                count--;
            }

            if (count > 0)
            {
                //throw new ArgumentException(ErrorMessages.originLatitude);
            }

            double standardParallel = 0.0;

            if (sk_PLUS_1 >= -1.0 && sk_PLUS_1 <= 1.0)
            {
                standardParallel = Math.Asin(sk_PLUS_1);
            }
            else
            {
                throw new ArgumentException(ErrorMessages.originLatitude);
            }

            if (hemisphere == 'S')
            {
                standardParallel *= -1.0;
            }

            if (centralMeridian > Math.PI)
            {
                centralMeridian -= TWO_PI;
            }
            if (standardParallel < 0)
            {
                Southern_Hemisphere     = 1;
                Polar_Standard_Parallel = -standardParallel;
                Polar_Central_Meridian  = -centralMeridian;
            }
            else
            {
                Southern_Hemisphere     = 0;
                Polar_Standard_Parallel = standardParallel;
                Polar_Central_Meridian  = centralMeridian;
            }

            sinolat = Math.Sin(Polar_Standard_Parallel);

            if (Math.Abs(Math.Abs(Polar_Standard_Parallel) - PI_OVER_2) > 1.0e-10)
            {
                essin      = es * sinolat;
                pow_es     = polarPow(essin);
                cosolat    = Math.Cos(Polar_Standard_Parallel);
                mc         = cosolat / Math.Sqrt(1.0 - essin * essin);
                Polar_a_mc = semiMajorAxis * mc;
                Polar_tc   = Math.Tan(PI_OVER_4 - Polar_Standard_Parallel / 2.0) / pow_es;
            }

            /* Calculate Radius */
            MapProjectionCoordinates tempCoordinates = convertFromGeodetic(new GeodeticCoordinates(CoordinateType.Enum.geodetic, centralMeridian, 0));

            Polar_Delta_Northing = tempCoordinates.getNorthing();

            if (this.Polar_False_Northing > 0)
            {
                this.Polar_Delta_Northing -= this.Polar_False_Northing;
            }
            if (this.Polar_Delta_Northing < 0)
            {
                this.Polar_Delta_Northing = -this.Polar_Delta_Northing;
            }
            this.Polar_Delta_Northing *= 1.01;

            this.Polar_Delta_Easting = this.Polar_Delta_Northing;
        }
예제 #19
0
 public void set(CoordinateType.Enum coordinateType, string warningMessage, string errorMessage)
 {
     this.coordinateType = coordinateType;
     this.warningMessage = warningMessage;
     this.errorMessage   = errorMessage;
 }
예제 #20
0
 /// <summary>
 /// Constructs a new set of UTM Parameters with default values.
 /// </summary>
 /// <param name="coordinateType">Coordinate Type</param>
 public UTMParameters(CoordinateType.Enum coordinateType)
 {
     this.coordinateType = coordinateType;
     this.zone           = 32;
     this.zoneOverride   = 0;
 }
예제 #21
0
 public MapProjectionCoordinates(CoordinateType.Enum coordinateType, double easting, double northing)
 {
     this.coordinateType = coordinateType;
     this.easting        = easting;
     this.northing       = northing;
 }
        private double two_Polar_a; /* 2.0 * Polar_a */

        #endregion Fields

        #region Constructors

        /// <summary>
        /// The constructor receives the ellipsoid
        /// parameters and Polar Stereograpic (Standard Parallel) projection parameters as inputs, and
        /// sets the corresponding state variables.  If any errors occur, an 
        /// exception is thrown with a description of the error.
        /// </summary>
        /// <param name="ellipsoidSemiMajorAxis">Semi-major axis of ellipsoid, in meters</param>
        /// <param name="ellipsoidFlattening">Flattening of ellipsoid</param>
        /// <param name="centralMeridian">Longitude down from pole, in radians</param>
        /// <param name="standardParallel">Latitude of true scale, in radians</param>
        /// <param name="falseEasting">Easting (X) at center of projection, in meters</param>
        /// <param name="falseNorthing">Northing (Y) at center of projection, in meters</param>
        public PolarStereographic(double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double centralMeridian, double standardParallel, double falseEasting, double falseNorthing)
        {
            this.coordinateType = CoordinateType.Enum.polarStereographicStandardParallel;
            this.es = 0.08181919084262188000;
            this.es_OVER_2 = .040909595421311;
            this.Southern_Hemisphere = 0;
            this.Polar_tc = 1.0;
            this.Polar_k90 = 1.0033565552493;
            this.Polar_a_mc = 6378137.0;
            this.two_Polar_a = 12756274.0;
            this.Polar_Central_Meridian = 0.0;
            this.Polar_Standard_Parallel = ((Math.PI * 90) / 180);
            this.Polar_False_Easting = 0.0;
            this.Polar_False_Northing = 0.0;
            this.Polar_Scale_Factor = 1.0;
            this.Polar_Delta_Easting = 12713601.0;
            this.Polar_Delta_Northing = 12713601.0;

            double es2;
            double slat, sinolat, cosolat;
            double essin;
            double one_PLUS_es, one_MINUS_es;
            double one_PLUS_es_sinolat, one_MINUS_es_sinolat;
            double pow_es;
            double inv_f = 1 / ellipsoidFlattening;
            string errorStatus = "";

            if (ellipsoidSemiMajorAxis <= 0.0)
            { /* Semi-major axis must be greater than zero */
                errorStatus += ErrorMessages.semiMajorAxis;
            }
            if ((inv_f < 250) || (inv_f > 350))
            { /* Inverse flattening must be between 250 and 350 */
                errorStatus += ErrorMessages.ellipsoidFlattening;
            }
            if ((standardParallel < -PI_OVER_2) || (standardParallel > PI_OVER_2))
            { /* Origin Latitude out of range */
                errorStatus += ErrorMessages.originLatitude;
            }
            if ((centralMeridian < -Math.PI) || (centralMeridian > TWO_PI))
            { /* Origin Longitude out of range */
                errorStatus += ErrorMessages.centralMeridian;
            }

            if (errorStatus.Length > 0)
            {
                throw new ArgumentException(errorStatus);
            }

            this.semiMajorAxis = ellipsoidSemiMajorAxis;
            this.flattening = ellipsoidFlattening;

            two_Polar_a = 2.0 * semiMajorAxis;

            if (centralMeridian > Math.PI)
            {
                centralMeridian -= TWO_PI;
            }
            if (standardParallel < 0)
            {
                this.Southern_Hemisphere = 1;
                this.Polar_Standard_Parallel = -standardParallel;
                this.Polar_Central_Meridian = -centralMeridian;
            }
            else
            {
                Southern_Hemisphere = 0;
                this.Polar_Standard_Parallel = standardParallel;
                this.Polar_Central_Meridian = centralMeridian;
            }
            this.Polar_False_Easting = falseEasting;
            this.Polar_False_Northing = falseNorthing;

            es2 = 2 * this.flattening - this.flattening * this.flattening;
            es = Math.Sqrt(es2);
            es_OVER_2 = es / 2.0;

            if (Math.Abs(Math.Abs(Polar_Standard_Parallel) - PI_OVER_2) > 1.0e-10)
            {
                sinolat = Math.Sin(Polar_Standard_Parallel);
                essin = es * sinolat;
                pow_es = polarPow(essin);
                cosolat = Math.Cos(Polar_Standard_Parallel);
                double mc = cosolat / Math.Sqrt(1.0 - essin * essin);
                this.Polar_a_mc = semiMajorAxis * mc;
                this.Polar_tc = Math.Tan(PI_OVER_4 - Polar_Standard_Parallel / 2.0) / pow_es;
            }

            one_PLUS_es = 1.0 + es;
            one_MINUS_es = 1.0 - es;
            this.Polar_k90 = Math.Sqrt(Math.Pow(one_PLUS_es, one_PLUS_es) * Math.Pow(one_MINUS_es, one_MINUS_es));

            slat = Math.Sin(Math.Abs(standardParallel));
            one_PLUS_es_sinolat = 1.0 + es * slat;
            one_MINUS_es_sinolat = 1.0 - es * slat;
            this.Polar_Scale_Factor = ((1 + slat) / 2) * (Polar_k90 / Math.Sqrt(Math.Pow(one_PLUS_es_sinolat, one_PLUS_es) * Math.Pow(one_MINUS_es_sinolat, one_MINUS_es)));

            /* Calculate Radius */
            MapProjectionCoordinates tempCoordinates = convertFromGeodetic(new GeodeticCoordinates(CoordinateType.Enum.geodetic, centralMeridian, 0, 0));
            this.Polar_Delta_Northing = tempCoordinates.getNorthing();

            if (this.Polar_False_Northing != 0)
            {
                this.Polar_Delta_Northing -= this.Polar_False_Northing;
            }
            if (Polar_Delta_Northing < 0)
            {
                this.Polar_Delta_Northing = -this.Polar_Delta_Northing;
            }
            this.Polar_Delta_Northing *= 1.01;

            this.Polar_Delta_Easting = this.Polar_Delta_Northing;
        }
        /// <summary>
        /// The constructor receives the ellipsoid
        /// parameters and Polar Stereograpic (Scale Factor) projection parameters as inputs, and
        /// sets the corresponding state variables.  If any errors occur, an 
        /// exception is thrown with a description of the error.
        /// </summary>
        /// <param name="ellipsoidSemiMajorAxis">Semi-major axis of ellipsoid, in meters</param>
        /// <param name="ellipsoidFlattening">Flattening of ellipsoid</param>
        /// <param name="centralMeridian">Longitude down from pole, in radians</param>
        /// <param name="scaleFactor">Scale Factor</param>
        /// <param name="hemisphere">Hemisphere</param>
        /// <param name="falseEasting">Easting (X) at center of projection, in meters</param>
        /// <param name="falseNorthing">Northing (Y) at center of projection, in meters</param>
        public PolarStereographic(double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double centralMeridian, double scaleFactor, char hemisphere, double falseEasting, double falseNorthing)
        {
            this.coordinateType = CoordinateType.Enum.polarStereographicScaleFactor;
            this.es = 0.08181919084262188000;
            this.es_OVER_2 = .040909595421311;
            this.Southern_Hemisphere = 0;
            this.Polar_tc = 1.0;
            this.Polar_k90 = 1.0033565552493;
            this.Polar_a_mc = 6378137.0;
            this.two_Polar_a = 12756274.0;
            this.Polar_Central_Meridian = 0.0;
            this.Polar_Standard_Parallel = PI_OVER_2;
            this.Polar_False_Easting = 0.0;
            this.Polar_False_Northing = 0.0;
            this.Polar_Scale_Factor = 1.0;
            this.Polar_Delta_Easting = 12713601.0;
            this.Polar_Delta_Northing = 12713601.0;

            double es2;
            double sinolat, cosolat;
            double essin;
            double pow_es;
            double mc;
            double one_PLUS_es, one_MINUS_es;
            double one_PLUS_es_sk, one_MINUS_es_sk;
            double sk, sk_PLUS_1;
            double tolerance = 1.0e-15;
            int count = 30;
            double inv_f = 1 / ellipsoidFlattening;
            string errorStatus = "";

            if (ellipsoidSemiMajorAxis <= 0.0)
            { /* Semi-major axis must be greater than zero */
                errorStatus += ErrorMessages.semiMajorAxis;
            }
            if ((inv_f < 250) || (inv_f > 350))
            { /* Inverse flattening must be between 250 and 350 */
                errorStatus += ErrorMessages.ellipsoidFlattening;
            }
            if ((scaleFactor < MIN_SCALE_FACTOR) || (scaleFactor > MAX_SCALE_FACTOR))
            {
                errorStatus += ErrorMessages.scaleFactor;
            }
            if ((centralMeridian < -Math.PI) || (centralMeridian > TWO_PI))
            { /* Origin Longitude out of range */
                errorStatus += ErrorMessages.centralMeridian;
            }
            if ((hemisphere != 'N') && (hemisphere != 'S'))
            {
                errorStatus += ErrorMessages.hemisphere;
            }

            if (errorStatus.Length > 0)
            {
               // throw CoordinateConversionException(errorStatus);
            }

            this.semiMajorAxis = ellipsoidSemiMajorAxis;
            this.flattening = ellipsoidFlattening;
            this.Polar_Scale_Factor = scaleFactor;
            this.Polar_False_Easting = falseEasting;
            this.Polar_False_Northing = falseNorthing;

            this.two_Polar_a = 2.0 * this.semiMajorAxis;
            es2 = 2 * this.flattening - this.flattening * this.flattening;
            es = Math.Sqrt(es2);
            es_OVER_2 = es / 2.0;

            one_PLUS_es = 1.0 + es;
            one_MINUS_es = 1.0 - es;
            this.Polar_k90 = Math.Sqrt(Math.Pow(one_PLUS_es, one_PLUS_es) * Math.Pow(one_MINUS_es, one_MINUS_es));

            sk = 0;
            sk_PLUS_1 = -1 + 2 * this.Polar_Scale_Factor;
            while (Math.Abs(sk_PLUS_1 - sk) > tolerance && count > 0)
            {
                sk = sk_PLUS_1;
                one_PLUS_es_sk = 1.0 + es * sk;
                one_MINUS_es_sk = 1.0 - es * sk;
                sk_PLUS_1 = ((2 * this.Polar_Scale_Factor * Math.Sqrt(Math.Pow(one_PLUS_es_sk, one_PLUS_es) * Math.Pow(one_MINUS_es_sk, one_MINUS_es))) / this.Polar_k90) - 1;
                count--;
            }

            if (count > 0)
            {
                //throw new ArgumentException(ErrorMessages.originLatitude);
            }

            double standardParallel = 0.0;
            if (sk_PLUS_1 >= -1.0 && sk_PLUS_1 <= 1.0)
            {
                standardParallel = Math.Asin(sk_PLUS_1);
            }
            else
            {
                throw new ArgumentException(ErrorMessages.originLatitude);
            }

            if (hemisphere == 'S')
            {
                standardParallel *= -1.0;
            }

            if (centralMeridian > Math.PI)
            {
                centralMeridian -= TWO_PI;
            }
            if (standardParallel < 0)
            {
                Southern_Hemisphere = 1;
                Polar_Standard_Parallel = -standardParallel;
                Polar_Central_Meridian = -centralMeridian;
            }
            else
            {
                Southern_Hemisphere = 0;
                Polar_Standard_Parallel = standardParallel;
                Polar_Central_Meridian = centralMeridian;
            }

            sinolat = Math.Sin(Polar_Standard_Parallel);

            if (Math.Abs(Math.Abs(Polar_Standard_Parallel) - PI_OVER_2) > 1.0e-10)
            {
                essin = es * sinolat;
                pow_es = polarPow(essin);
                cosolat = Math.Cos(Polar_Standard_Parallel);
                mc = cosolat / Math.Sqrt(1.0 - essin * essin);
                Polar_a_mc = semiMajorAxis * mc;
                Polar_tc = Math.Tan(PI_OVER_4 - Polar_Standard_Parallel / 2.0) / pow_es;
            }

            /* Calculate Radius */
            MapProjectionCoordinates tempCoordinates = convertFromGeodetic(new GeodeticCoordinates(CoordinateType.Enum.geodetic, centralMeridian, 0));
            Polar_Delta_Northing = tempCoordinates.getNorthing();

            if (this.Polar_False_Northing > 0)
            {
                this.Polar_Delta_Northing -= this.Polar_False_Northing;
            }
            if (this.Polar_Delta_Northing < 0)
            {
                this.Polar_Delta_Northing = -this.Polar_Delta_Northing;
            }
            this.Polar_Delta_Northing *= 1.01;

            this.Polar_Delta_Easting = this.Polar_Delta_Northing;
        }
예제 #24
0
        /// <summary>
        /// The constructor receives the ellipsoid
        /// parameters and Polar Stereograpic (Standard Parallel) projection parameters as inputs, and
        /// sets the corresponding state variables.  If any errors occur, an
        /// exception is thrown with a description of the error.
        /// </summary>
        /// <param name="ellipsoidSemiMajorAxis">Semi-major axis of ellipsoid, in meters</param>
        /// <param name="ellipsoidFlattening">Flattening of ellipsoid</param>
        /// <param name="centralMeridian">Longitude down from pole, in radians</param>
        /// <param name="standardParallel">Latitude of true scale, in radians</param>
        /// <param name="falseEasting">Easting (X) at center of projection, in meters</param>
        /// <param name="falseNorthing">Northing (Y) at center of projection, in meters</param>
        public PolarStereographic(double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double centralMeridian, double standardParallel, double falseEasting, double falseNorthing)
        {
            this.coordinateType          = CoordinateType.Enum.polarStereographicStandardParallel;
            this.es                      = 0.08181919084262188000;
            this.es_OVER_2               = .040909595421311;
            this.Southern_Hemisphere     = 0;
            this.Polar_tc                = 1.0;
            this.Polar_k90               = 1.0033565552493;
            this.Polar_a_mc              = 6378137.0;
            this.two_Polar_a             = 12756274.0;
            this.Polar_Central_Meridian  = 0.0;
            this.Polar_Standard_Parallel = ((Math.PI * 90) / 180);
            this.Polar_False_Easting     = 0.0;
            this.Polar_False_Northing    = 0.0;
            this.Polar_Scale_Factor      = 1.0;
            this.Polar_Delta_Easting     = 12713601.0;
            this.Polar_Delta_Northing    = 12713601.0;

            double es2;
            double slat, sinolat, cosolat;
            double essin;
            double one_PLUS_es, one_MINUS_es;
            double one_PLUS_es_sinolat, one_MINUS_es_sinolat;
            double pow_es;
            double inv_f       = 1 / ellipsoidFlattening;
            string errorStatus = "";

            if (ellipsoidSemiMajorAxis <= 0.0)
            { /* Semi-major axis must be greater than zero */
                errorStatus += ErrorMessages.semiMajorAxis;
            }
            if ((inv_f < 250) || (inv_f > 350))
            { /* Inverse flattening must be between 250 and 350 */
                errorStatus += ErrorMessages.ellipsoidFlattening;
            }
            if ((standardParallel < -PI_OVER_2) || (standardParallel > PI_OVER_2))
            { /* Origin Latitude out of range */
                errorStatus += ErrorMessages.originLatitude;
            }
            if ((centralMeridian < -Math.PI) || (centralMeridian > TWO_PI))
            { /* Origin Longitude out of range */
                errorStatus += ErrorMessages.centralMeridian;
            }

            if (errorStatus.Length > 0)
            {
                throw new ArgumentException(errorStatus);
            }

            this.semiMajorAxis = ellipsoidSemiMajorAxis;
            this.flattening    = ellipsoidFlattening;

            two_Polar_a = 2.0 * semiMajorAxis;

            if (centralMeridian > Math.PI)
            {
                centralMeridian -= TWO_PI;
            }
            if (standardParallel < 0)
            {
                this.Southern_Hemisphere     = 1;
                this.Polar_Standard_Parallel = -standardParallel;
                this.Polar_Central_Meridian  = -centralMeridian;
            }
            else
            {
                Southern_Hemisphere          = 0;
                this.Polar_Standard_Parallel = standardParallel;
                this.Polar_Central_Meridian  = centralMeridian;
            }
            this.Polar_False_Easting  = falseEasting;
            this.Polar_False_Northing = falseNorthing;

            es2       = 2 * this.flattening - this.flattening * this.flattening;
            es        = Math.Sqrt(es2);
            es_OVER_2 = es / 2.0;

            if (Math.Abs(Math.Abs(Polar_Standard_Parallel) - PI_OVER_2) > 1.0e-10)
            {
                sinolat = Math.Sin(Polar_Standard_Parallel);
                essin   = es * sinolat;
                pow_es  = polarPow(essin);
                cosolat = Math.Cos(Polar_Standard_Parallel);
                double mc = cosolat / Math.Sqrt(1.0 - essin * essin);
                this.Polar_a_mc = semiMajorAxis * mc;
                this.Polar_tc   = Math.Tan(PI_OVER_4 - Polar_Standard_Parallel / 2.0) / pow_es;
            }

            one_PLUS_es    = 1.0 + es;
            one_MINUS_es   = 1.0 - es;
            this.Polar_k90 = Math.Sqrt(Math.Pow(one_PLUS_es, one_PLUS_es) * Math.Pow(one_MINUS_es, one_MINUS_es));

            slat = Math.Sin(Math.Abs(standardParallel));
            one_PLUS_es_sinolat     = 1.0 + es * slat;
            one_MINUS_es_sinolat    = 1.0 - es * slat;
            this.Polar_Scale_Factor = ((1 + slat) / 2) * (Polar_k90 / Math.Sqrt(Math.Pow(one_PLUS_es_sinolat, one_PLUS_es) * Math.Pow(one_MINUS_es_sinolat, one_MINUS_es)));

            /* Calculate Radius */
            MapProjectionCoordinates tempCoordinates = convertFromGeodetic(new GeodeticCoordinates(CoordinateType.Enum.geodetic, centralMeridian, 0, 0));

            this.Polar_Delta_Northing = tempCoordinates.getNorthing();

            if (this.Polar_False_Northing != 0)
            {
                this.Polar_Delta_Northing -= this.Polar_False_Northing;
            }
            if (Polar_Delta_Northing < 0)
            {
                this.Polar_Delta_Northing = -this.Polar_Delta_Northing;
            }
            this.Polar_Delta_Northing *= 1.01;

            this.Polar_Delta_Easting = this.Polar_Delta_Northing;
        }
예제 #25
0
 public CoordinateTuple(CoordinateType.Enum coordinateType, string warningMessage)
 {
     this.coordinateType = coordinateType;
     this.errorMessage   = "";
     this.warningMessage = warningMessage;
 }
예제 #26
0
 public void setCoordinateType(CoordinateType.Enum coordinateType)
 {
     this.coordinateType = coordinateType;
 }
예제 #27
0
 public CoordinateTuple(CoordinateType.Enum coordinateType, string warningMessage)
 {
     this.coordinateType = coordinateType;
     this.errorMessage = "";
     this.warningMessage = warningMessage;
 }
예제 #28
0
 public void set(CoordinateType.Enum coordinateType, string warningMessage, string errorMessage)
 {
     this.coordinateType = coordinateType;
     this.warningMessage = warningMessage;
     this.errorMessage = errorMessage;
 }
예제 #29
0
 public void setCoordinateType(CoordinateType.Enum coordinateType)
 {
     this.coordinateType = coordinateType;
 }
예제 #30
0
 public MapProjectionCoordinates(CoordinateType.Enum coordinateType)
 {
     this.coordinateType = coordinateType;
     this.easting        = 0;
     this.northing       = 0;
 }
예제 #31
0
 public MGRSorUSNGCoordinates(CoordinateType.Enum coordinateType, string MGRSString)
 {
     this.coordinateType = coordinateType;
     this.precision      = Precision.Enum.tenthOfSecond;
     this.MGRSString     = MGRSString;
 }
 public CoordinateSystemParameters(CoordinateType.Enum coordinateType)
 {
     this.coordinateType = coordinateType;
 }
예제 #33
0
 public CoordinateTuple()
 {
     this.coordinateType = CoordinateType.Enum.geodetic;
     this.errorMessage = "";
     this.warningMessage = "";
 }