Beispiel #1
0
 /// <summary>
 /// Returns the inverse of this conversion.
 /// </summary>
 /// <returns>IMathTransform that is the reverse of the current conversion.</returns>
 public override IMathTransform Inverse()
 {
     if (this._inverse == null)
     {
         this._inverse = new GeocentricTransform(this._Parameters, !this._isInverse);
     }
     return(this._inverse);
 }
Beispiel #2
0
        /// <summary>
        /// Converts coordinates in decimal degrees to projected meters.
        /// </summary>
        /// <param name="lonlat">The point in decimal degrees.</param>
        /// <returns>Point in projected meters</returns>
        private double[] DegreesToMeters(double[] lonlat)
        {
            double d    = MathTransform.Degrees2Radians(lonlat[0]);
            double a    = MathTransform.Degrees2Radians(lonlat[1]);
            double num3 = (lonlat.Length < 3) ? 0 : (lonlat[2].Equals(double.NaN) ? 0 : lonlat[2]);
            double num4 = this.semiMajor / Math.Sqrt(1 - (this.es * Math.Pow(Math.Sin(a), 2)));
            double num5 = ((num4 + num3) * Math.Cos(a)) * Math.Cos(d);
            double num6 = ((num4 + num3) * Math.Cos(a)) * Math.Sin(d);
            double num7 = (((1 - this.es) * num4) + num3) * Math.Sin(a);

            return(new double[] { num5, num6, num7 });
        }
Beispiel #3
0
        /// <summary>
        /// Converts coordinates in projected meters to decimal degrees.
        /// </summary>
        /// <param name="pnt">Point in meters</param>
        /// <returns>Transformed point in decimal degrees</returns>
        private double[] MetersToDegrees(double[] pnt)
        {
            bool   flag = false;
            double num  = (pnt.Length < 3) ? 0 : (pnt[2].Equals(double.NaN) ? 0 : pnt[2]);
            double rad  = 0;
            double num3 = 0;
            double num4 = 0;

            if (pnt[0] != 0)
            {
                rad = Math.Atan2(pnt[1], pnt[0]);
            }
            else if (pnt[1] > 0)
            {
                rad = 1.5707963267948966;
            }
            else if (pnt[1] < 0)
            {
                rad = -1.5707963267948966;
            }
            else
            {
                flag = true;
                rad  = 0;
                if (num > 0)
                {
                    num3 = 1.5707963267948966;
                }
                else if (num < 0)
                {
                    num3 = -1.5707963267948966;
                }
                else
                {
                    return(new double[] { MathTransform.Radians2Degrees(rad), MathTransform.Radians2Degrees(1.5707963267948966), -this.semiMinor });
                }
            }
            double d     = (pnt[0] * pnt[0]) + (pnt[1] * pnt[1]);
            double num6  = Math.Sqrt(d);
            double num7  = num * 1.0026;
            double num8  = Math.Sqrt((num7 * num7) + d);
            double x     = num7 / num8;
            double num10 = num6 / num8;
            double num11 = Math.Pow(x, 3);
            double num12 = num + ((this.semiMinor * this.ses) * num11);
            double num13 = num6 - ((((this.semiMajor * this.es) * num10) * num10) * num10);
            double num14 = Math.Sqrt((num12 * num12) + (num13 * num13));
            double num15 = num12 / num14;
            double num16 = num13 / num14;
            double num17 = this.semiMajor / Math.Sqrt(1 - ((this.es * num15) * num15));

            if (num16 >= 0.38268343236508978)
            {
                num4 = (num6 / num16) - num17;
            }
            else if (num16 <= -0.38268343236508978)
            {
                num4 = (num6 / -num16) - num17;
            }
            else
            {
                num4 = (num / num15) + (num17 * (this.es - 1));
            }
            if (!flag)
            {
                num3 = Math.Atan(num15 / num16);
            }
            return(new double[] { MathTransform.Radians2Degrees(rad), MathTransform.Radians2Degrees(num3), num4 });
        }
 /// <summary>
 /// Returns the inverse of this conversion.
 /// </summary>
 /// <returns>IMathTransform that is the reverse of the current conversion.</returns>
 public override IMathTransform Inverse()
 {
     if (this._inverse == null)
     {
         this._inverse = new GeocentricTransform(this._Parameters, !this._isInverse);
     }
     return this._inverse;
 }