public GnomonicAzimuthalProjection(double projectionLatitude, double projectionLongitude) : base(projectionLatitude, projectionLongitude) { MinLatitude = ProjectionMath.ToRadians(0); MaxLatitude = ProjectionMath.ToRadians(90); Initialize(); }
public override Coordinate ProjectInverse(double x, double y, Coordinate lp) { int i; double t, t1; lp.X = x / FXC; lp.Y = Math.Abs(y / FYC); if (lp.Y >= 1.0) { if (lp.Y > 1.000001) { throw new ProjectionException(); } else { lp.Y = y < 0.0 ? -ProjectionMath.PiHalf : ProjectionMath.PiHalf; lp.X /= X[4 * NODES]; } } else { for (i = 4 * (int)Math.Floor(lp.Y * NODES); ;) { if (Y[i] > lp.Y) { i -= 4; } else if (Y[i + 4] <= lp.Y) { i += 4; } else { break; } } t = 5.0 * (lp.Y - Y[i]) / (Y[i + 4] - Y[i]); double Tc0 = Y[i]; double Tc1 = Y[i + 1]; double Tc2 = Y[i + 2]; double Tc3 = Y[i + 3]; t = 5.0 * (lp.Y - Tc0) / (Y[i + 1] - Tc0); Tc0 -= lp.Y; for (; ;) { // Newton-Raphson t -= t1 = (Tc0 + t * (Tc1 + t * (Tc2 + t * Tc3))) / (Tc1 + t * (Tc2 + Tc2 + t * 3.0 * Tc3)); if (Math.Abs(t1) < EPS) { break; } } lp.Y = ProjectionMath.ToRadians(5 * i + t); if (y < 0.0) { lp.Y = -lp.Y; } lp.X /= poly(X, i, t); } return(lp); }
internal override bool ReadHeader(GridTable table) { using (var sr = new StreamReader(OpenGridTableStream())) { table.Name = sr.ReadLine(); var definition = sr.ReadLine(); if (string.IsNullOrEmpty(definition)) { return(false); } var definitionParts = definition.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); table.NumLambdas = int.Parse(definitionParts[0], NumberStyles.Integer); table.NumPhis = int.Parse(definitionParts[0], NumberStyles.Integer); table.LowerLeft = new PhiLambda { Lambda = ProjectionMath.ToRadians(double.Parse(definitionParts[3], CultureInfo.InvariantCulture)), Phi = ProjectionMath.ToRadians(double.Parse(definitionParts[5], CultureInfo.InvariantCulture)) }; table.SizeOfGridCell = new PhiLambda { Lambda = ProjectionMath.ToRadians(double.Parse(definitionParts[4], CultureInfo.InvariantCulture)), Phi = ProjectionMath.ToRadians(double.Parse(definitionParts[6], CultureInfo.InvariantCulture)) }; table.UpperRight = table.LowerLeft + table.SizeOfGridCell.Times(table.NumPhis, table.NumLambdas); return(true); } }
public CassiniProjection() { ProjectionLatitude = ProjectionMath.ToRadians(0); ProjectionLongitude = ProjectionMath.ToRadians(0); MinLongitude = ProjectionMath.ToRadians(-90); MaxLongitude = ProjectionMath.ToRadians(90); Initialize(); }
//protected double projectionLatitude1 = MapMath.degToRad(45.5); //protected double projectionLatitude2 = MapMath.degToRad(29.5); public AlbersProjection() { MinLatitude = ProjectionMath.ToRadians(0); MaxLatitude = ProjectionMath.ToRadians(80); ProjectionLatitude1 = ProjectionMath.ToRadians(45.5); ProjectionLatitude2 = ProjectionMath.ToRadians(29.5); Initialize(); }
public static PhiLambda DegreesToRadians(PhiLambda plInDegrees) { return(new PhiLambda { Lambda = ProjectionMath.ToRadians(plInDegrees.Lambda), Phi = ProjectionMath.ToRadians(plInDegrees.Phi) }); }
public BipolarProjection() { MinLatitude = ProjectionMath.ToRadians(-80); MaxLatitude = ProjectionMath.ToRadians(80); ProjectionLongitude = ProjectionMath.ToRadians(-90); MinLongitude = ProjectionMath.ToRadians(-90); MaxLongitude = ProjectionMath.ToRadians(90); }
public PolyconicProjection() { MinLatitude = ProjectionMath.ToRadians(0); MaxLatitude = ProjectionMath.ToRadians(80); MinLongitude = ProjectionMath.ToRadians(-60); MaxLongitude = ProjectionMath.ToRadians(60); Initialize(); }
public LambertEqualAreaConicProjection(Boolean south) { MinLatitude = ProjectionMath.ToRadians(0); MaxLatitude = ProjectionMath.ToRadians(90); ProjectionLatitude1 = south ? -ProjectionMath.PiFourth : ProjectionMath.PiFourth; ProjectionLatitude2 = south ? -ProjectionMath.PiHalf : ProjectionMath.PiHalf; Initialize(); }
// ReSharper restore InconsistentNaming public AiryProjection() { _minLatitude = ProjectionMath.ToRadians(-60); _maxLatitude = ProjectionMath.ToRadians(60); _minLongitude = ProjectionMath.ToRadians(-90); _maxLongitude = ProjectionMath.ToRadians(90); Initialize(); }
public LambertEqualAreaConicProjection(Boolean south) { MinLatitude = ProjectionMath.ToRadians(0); MaxLatitude = ProjectionMath.ToRadians(90); ProjectionLatitude1 = south ? -ProjectionMath.QuarterPI : ProjectionMath.QuarterPI; ProjectionLatitude2 = south ? -ProjectionMath.HalfPI : ProjectionMath.HalfPI; Initialize(); }
public TransverseMercatorProjection() { Ellipsoid = Ellipsoid.GRS80; ProjectionLatitude = ProjectionMath.ToRadians(0); ProjectionLongitude = ProjectionMath.ToRadians(0); MinLongitude = ProjectionMath.ToRadians(-90); MaxLongitude = ProjectionMath.ToRadians(90); Initialize(); }
public LambertConformalConicProjection() { MinLatitude = ProjectionMath.ToRadians(0); MaxLatitude = ProjectionMath.ToRadians(80.0); ProjectionLatitude = ProjectionMath.PiFourth; ProjectionLatitude1 = 0; ProjectionLatitude2 = 0; Initialize(); }
public EquidistantConicProjection() { MinLatitude = ProjectionMath.ToRadians(10); MaxLatitude = ProjectionMath.ToRadians(70); MinLongitude = ProjectionMath.ToRadians(-90); MaxLongitude = ProjectionMath.ToRadians(90); _standardLatitude1 = ProjectionMath.ToDegrees(60); //??? _standardLatitude2 = ProjectionMath.ToDegrees(20); //??? Initialize(ProjectionMath.ToRadians(0), ProjectionMath.ToRadians(37.5), _standardLatitude1, _standardLatitude2); }
public ObliqueMercatorProjection() { Ellipsoid = new Ellipsoid("WGS84", 6378137.0, 0.0, 298.257223563, "WGS 84");//WGS84; ProjectionLatitude = ProjectionMath.ToRadians(0); ProjectionLongitude = ProjectionMath.ToRadians(0); MinLongitude = ProjectionMath.ToRadians(-60); MaxLongitude = ProjectionMath.ToRadians(60); MinLatitude = ProjectionMath.ToRadians(-80); MaxLatitude = ProjectionMath.ToRadians(80); Alpha = ProjectionMath.ToRadians(-45);//FIXME Initialize(); }
/// <summary> /// Factory method to create meridians by their <see cref="NamedMeridian"/> /// </summary> /// <param name="meridan">The named meridian</param> /// <returns>The meridian</returns> public static Meridian CreateByNamedMeridian(NamedMeridian meridan) { switch (meridan) { case NamedMeridian.Greenwich: return(new Meridian(meridan, 0)); case NamedMeridian.Lisbon: return(new Meridian(meridan, ProjectionMath.ToRadians(-9.131906111))); case NamedMeridian.Paris: return(new Meridian(meridan, ProjectionMath.ToRadians(2.337229167))); case NamedMeridian.Bogota: return(new Meridian(meridan, ProjectionMath.ToRadians(-74.08091667))); case NamedMeridian.Madrid: return(new Meridian(meridan, ProjectionMath.ToRadians(-3.687938889))); case NamedMeridian.Rome: return(new Meridian(meridan, ProjectionMath.ToRadians(12.45233333))); case NamedMeridian.Bern: return(new Meridian(meridan, ProjectionMath.ToRadians(7.439583333))); case NamedMeridian.Jakarta: return(new Meridian(meridan, ProjectionMath.ToRadians(106.8077194))); case NamedMeridian.Ferro: return(new Meridian(meridan, ProjectionMath.ToRadians(-17.66666667))); case NamedMeridian.Brussels: return(new Meridian(meridan, ProjectionMath.ToRadians(4.367975))); case NamedMeridian.Stockholm: return(new Meridian(meridan, ProjectionMath.ToRadians(18.05827778))); case NamedMeridian.Athens: return(new Meridian(meridan, ProjectionMath.ToRadians(23.7163375))); case NamedMeridian.Oslo: return(new Meridian(meridan, ProjectionMath.ToRadians(10.72291667))); } throw new ArgumentOutOfRangeException("meridan"); }
public override Boolean Inside(double lon, double lat) { return(ProjectionMath.GreatCircleDistance( ProjectionMath.ToRadians(lon), ProjectionMath.ToRadians(lat), ProjectionLongitude, ProjectionLatitude) < ProjectionMath.ToRadians(_mapRadius)); }
/// <summary> /// Factory method to create meridians by their degree value /// </summary> /// <param name="degree">The longitude of the meridian in degrees</param> /// <returns>The meridian</returns> public static Meridian CreateByDegree(double degree) { return(new Meridian(NamedMeridian.Undefined, ProjectionMath.ToRadians(degree))); }
//private double sinphi0, cosphi0; public EquidistantAzimuthalProjection() : this(ProjectionMath.ToRadians(90.0), ProjectionMath.ToRadians(0.0)) { }
protected AzimuthalProjection() : this(ProjectionMath.ToRadians(45.0), ProjectionMath.ToRadians(45.0)) { }
public StereographicAzimuthalProjection() : this(ProjectionMath.ToRadians(90.0), ProjectionMath.ToRadians(0.0)) { }
public Double Parse(String text) { double d = 0, m = 0, s = 0; double result; Boolean negate = false; int length = text.Length; if (length > 0) { char c = text[length - 1]; switch (c) { case 'W': case 'S': negate = true; text = text.Substring(0, text.Length - 1); break; case 'E': case 'N': text = text.Substring(0, text.Length - 1); break; } } int i = text.IndexOf('d'); if (i == -1) { i = text.IndexOf('\u00b0'); } if (i != -1) { String dd = text.Substring(0, i); String mmss = text.Substring(i + 1); d = Convert.ToDouble(dd, CultureInfo.InvariantCulture); i = mmss.IndexOf('m'); if (i == -1) { i = mmss.IndexOf('\''); } if (i != -1) { if (i != 0) { String mm = mmss.Substring(0, i); m = Convert.ToDouble(mm, CultureInfo.InvariantCulture); } if (mmss.EndsWith("s") || mmss.EndsWith("\"")) { mmss = mmss.Substring(0, mmss.Length - 1); } if (i != mmss.Length - 1) { String ss = mmss.Substring(i + 1); s = Convert.ToDouble(ss, CultureInfo.InvariantCulture); } #if SILVERLIGHT if (m < 0 || m > 59) { throw new ArgumentOutOfRangeException("m", "Minutes must be between 0 and 59"); } if (s < 0 || s >= 60) { throw new ArgumentOutOfRangeException("s", "Seconds must be between 0 and 59"); } #else if (m < 0 || m > 59) { throw new ArgumentOutOfRangeException("m", m, "Minutes must be between 0 and 59"); } if (s < 0 || s >= 60) { throw new ArgumentOutOfRangeException("s", s, "Seconds must be between 0 and 59"); } #endif } else if (i != 0) { m = Convert.ToDouble(mmss, CultureInfo.InvariantCulture); } if (_isDegrees) { result = ProjectionMath.DegreesMinutesSecondsToDegrees(d, m, s); } else { result = ProjectionMath.DegreesMinutesSecondsToRadians(d, m, s); } } else { result = Convert.ToDouble(text, CultureInfo.InvariantCulture); if (!_isDegrees) { result = ProjectionMath.ToRadians(result); } } if (negate) { result = -result; } return(result); }
public SimpleConicProjection(ConicTypes type) { _type = type; MinLatitude = ProjectionMath.ToRadians(0); MaxLatitude = ProjectionMath.ToRadians(80); }
public TransverseCentralCylindricalProjection() { MinLongitude = ProjectionMath.ToRadians(-60); MaxLongitude = ProjectionMath.ToRadians(60); }
public GnomonicAzimuthalProjection() : this(ProjectionMath.ToRadians(90.0), ProjectionMath.ToRadians(0.0)) { }
public override void Initialize() { base.Initialize(); double cs, dummy; /* get common factors for simple conics */ double p1, p2, d, s; int err = 0; /*FIXME * if (!pj_param(params, "tlat_1").i || * !pj_param(params, "tlat_2").i) { * err = -41; * } else { * p1 = pj_param(params, "rlat_1").f; * p2 = pj_param(params, "rlat_2").f; * del = 0.5 * (p2 - p1); * _sig = 0.5 * (p2 + p1); * err = (Math.abs(*del) < EPS10 || Math.abs(_sig) < EPS10) ? -42 : 0; * del = *del; * } */ p1 = ProjectionMath.ToRadians(30); //FIXME p2 = ProjectionMath.ToRadians(60); //FIXME var del = 0.5 * (p2 - p1); _sig = 0.5 * (p2 + p1); err = (Math.Abs(del) < EPS10 || Math.Abs(_sig) < EPS10) ? -42 : 0; del = del; if (err != 0) { throw new ProjectionException("Error " + err); } switch (ConicType) { case ConicTypes.Tissot: _n = Math.Sin(_sig); cs = Math.Cos(del); _rhoC = _n / cs + cs / _n; _rho0 = Math.Sqrt((_rhoC - 2 * Math.Sin(ProjectionLatitude)) / _n); break; case ConicTypes.Murdoch1: _rhoC = Math.Sin(del) / (del * Math.Tan(_sig)) + _sig; _rho0 = _rhoC - ProjectionLatitude; _n = Math.Sin(_sig); break; case ConicTypes.Murdoch2: _rhoC = (cs = Math.Sqrt(Math.Cos(del))) / Math.Tan(_sig); _rho0 = _rhoC + Math.Tan(_sig - ProjectionLatitude); _n = Math.Sin(_sig) * cs; break; case ConicTypes.Murdoch3: _rhoC = del / (Math.Tan(_sig) * Math.Tan(del)) + _sig; _rho0 = _rhoC - ProjectionLatitude; _n = Math.Sin(_sig) * Math.Sin(del) * Math.Tan(del) / (del * del); break; case ConicTypes.Euler: _n = Math.Sin(_sig) * Math.Sin(del) / del; del *= 0.5; _rhoC = del / (Math.Tan(del) * Math.Tan(_sig)) + _sig; _rho0 = _rhoC - ProjectionLatitude; break; case ConicTypes.PerspectiveConic: _n = Math.Sin(_sig); _c2 = Math.Cos(del); _c1 = 1.0 / Math.Tan(_sig); if (Math.Abs(del = ProjectionLatitude - _sig) - EPS10 >= ProjectionMath.PiHalf) { throw new ProjectionException("-43"); } _rho0 = _c2 * (_c1 - Math.Tan(del)); MaxLatitude = ProjectionMath.ToRadians(60); //FIXME break; case ConicTypes.Vitkovsky1: _n = (cs = Math.Tan(del)) * Math.Sin(_sig) / del; _rhoC = del / (cs * Math.Tan(_sig)) + _sig; _rho0 = _rhoC - ProjectionLatitude; break; } }
public MercatorProjection() { MinLatitude = ProjectionMath.ToRadians(-85); MaxLatitude = ProjectionMath.ToRadians(85); }
//private double _ap; //private final static double EPS10 = 1.e-10; public CentralCylindricalProjection() { MinLatitude = ProjectionMath.ToRadians(-80); MaxLatitude = ProjectionMath.ToRadians(80); }
public LoximuthalProjection() { phi1 = ProjectionMath.ToRadians(40.0); //FIXME - param cosphi1 = Math.Cos(phi1); tanphi1 = Math.Tan(ProjectionMath.PiFourth + 0.5 * phi1); }