/// <summary> /// Converts coordinates in projected meters to decimal degrees. /// </summary> /// <param name="p">Point in meters</param> /// <returns>Transformed point in decimal degrees</returns> public override double[] MetersToDegrees(double[] p) { double num = Math.Atan((p[0] - this._falseEasting) / (this.ro0 - (p[1] - this._falseNorthing))); double x = Math.Sqrt(Math.Pow(p[0] - this._falseEasting, 2) + Math.Pow(this.ro0 - (p[1] - this._falseNorthing), 2)); double num3 = (this.C - ((Math.Pow(x, 2) * Math.Pow(this.n, 2)) / Math.Pow(base._semiMajor, 2))) / this.n; Math.Sin(num3 / (1 - (((1 - this.e_sq) / (2 * this.e)) * Math.Log((1 - this.e) / (1 + this.e))))); double a = Math.Asin(num3 * 0.5); double maxValue = double.MaxValue; int num6 = 0; while (Math.Abs((double)(a - maxValue)) > 1E-06) { maxValue = a; double num7 = Math.Sin(a); double num8 = this.e_sq * Math.Pow(num7, 2); a += (Math.Pow(1 - num8, 2) / (2 * Math.Cos(a))) * (((num3 / (1 - this.e_sq)) - (num7 / (1 - num8))) + ((1 / (2 * this.e)) * Math.Log((1 - (this.e * num7)) / (1 + (this.e * num7))))); num6++; if (num6 > 0x19) { throw new ApplicationException("Transformation failed to converge in Albers backwards transformation"); } } double rad = this.lon_center + (num / this.n); return(new double[] { MathTransform.Radians2Degrees(rad), MathTransform.Radians2Degrees(a) }); }
/// <summary> /// Converts coordinates in projected meters to decimal degrees. /// </summary> /// <param name="p">Point in meters</param> /// <returns>Transformed point in decimal degrees</returns> public override double[] MetersToDegrees(double[] p) { double naN = double.NaN; double rad = double.NaN; double num3 = p[0] - this._falseEasting; double num4 = p[1] - this._falseNorthing; double d = Math.Exp(-num4 / (base._semiMajor * this.k0)); double num6 = 1.5707963267948966 - (2 * Math.Atan(d)); double num7 = Math.Pow(this.e, 4); double num8 = Math.Pow(this.e, 6); double num9 = Math.Pow(this.e, 8); rad = (((num6 + (((((this.e2 * 0.5) + ((5 * num7) / 24)) + (num8 / 12)) + ((13 * num9) / 360)) * Math.Sin(2 * num6))) + (((((7 * num7) / 48) + ((29 * num8) / 240)) + ((811 * num9) / 11520)) * Math.Sin(4 * num6))) + ((((7 * num8) / 120) + ((81 * num9) / 1120)) * Math.Sin(6 * num6))) + (((4279 * num9) / 161280) * Math.Sin(8 * num6)); naN = (num3 / (base._semiMajor * this.k0)) + this.lon_center; return(new double[] { MathTransform.Radians2Degrees(naN), MathTransform.Radians2Degrees(rad) }); }
/// <summary> /// Converts coordinates in projected meters to decimal degrees. /// </summary> /// <param name="p">Point in meters</param> /// <returns>Transformed point in decimal degrees</returns> public override double[] MetersToDegrees(double[] p) { long num16 = 6L; double num17 = p[0] - this.false_easting; double x = p[1] - this.false_northing; double d = (this.ml0 + (x / this.scale_factor)) / this.r_major; double num2 = d; long num4 = 0L; while (true) { double num3 = ((((d + (this.e1 * Math.Sin(2 * num2))) - (this.e2 * Math.Sin(4 * num2))) + (this.e3 * Math.Sin(6 * num2))) / this.e0) - num2; num2 += num3; if (Math.Abs(num3) <= 1E-10) { break; } if (num4 >= num16) { throw new ApplicationException("Latitude failed to converge"); } num4 += 1L; } if (Math.Abs(num2) < 1.5707963267948966) { double num5; double num6; MapProjection.sincos(num2, out num5, out num6); double num7 = Math.Tan(num2); double num8 = this.esp * Math.Pow(num6, 2); double num9 = Math.Pow(num8, 2); double num10 = Math.Pow(num7, 2); double num11 = Math.Pow(num10, 2); d = 1 - (this.es * Math.Pow(num5, 2)); double num12 = this.r_major / Math.Sqrt(d); double num13 = (num12 * (1 - this.es)) / d; double num14 = num17 / (num12 * this.scale_factor); double num15 = Math.Pow(num14, 2); double rad = num2 - ((((num12 * num7) * num15) / num13) * (0.5 - ((num15 / 24) * (((((5 + (3 * num10)) + (10 * num8)) - (4 * num9)) - (9 * this.esp)) - ((num15 / 30) * (((((61 + (90 * num10)) + (298 * num8)) + (45 * num11)) - (252 * this.esp)) - (3 * num9))))))); double num20 = MapProjection.adjust_lon(this.central_meridian + ((num14 * (1 - ((num15 / 6) * (((1 + (2 * num10)) + num8) - ((num15 / 20) * (((((5 - (2 * num8)) + (28 * num10)) - (3 * num9)) + (8 * this.esp)) + (24 * num11))))))) / num6)); return(new double[] { MathTransform.Radians2Degrees(num20), MathTransform.Radians2Degrees(rad) }); } return(new double[] { MathTransform.Radians2Degrees(1.5707963267948966 * MapProjection.sign(x)), MathTransform.Radians2Degrees(this.central_meridian) }); }
/// <summary> /// Converts coordinates in projected meters to decimal degrees. /// </summary> /// <param name="p">Point in meters</param> /// <returns>Transformed point in decimal degrees</returns> public override double[] MetersToDegrees(double[] p) { double num3; double num4; double naN = double.NaN; double rad = double.NaN; long flag = 0L; double num8 = p[0] - this._falseEasting; double num9 = (this.rh - p[1]) + this._falseNorthing; if (this.ns > 0) { num3 = Math.Sqrt((num8 * num8) + (num9 * num9)); num4 = 1; } else { num3 = -Math.Sqrt((num8 * num8) + (num9 * num9)); num4 = -1; } double num6 = 0; if (num3 != 0) { num6 = Math.Atan2(num4 * num8, num4 * num9); } if ((num3 != 0) || (this.ns > 0)) { num4 = 1 / this.ns; double ts = Math.Pow(num3 / (base._semiMajor * this.f0), num4); rad = MapProjection.phi2z(this.e, ts, out flag); if (flag != 0L) { throw new ApplicationException(); } } else { rad = -1.5707963267948966; } naN = MapProjection.adjust_lon((num6 / this.ns) + this.center_lon); return(new double[] { MathTransform.Radians2Degrees(naN), MathTransform.Radians2Degrees(rad) }); }