/// <summary> /// Checks whether the values of this instance is equal to the values of another instance. /// Only parameters used for coordinate system are used for comparison. /// Name, abbreviation, authority, alias and remarks are ignored in the comparison. /// </summary> /// <param name="obj"></param> /// <returns>True if equal</returns> public bool EqualParams(object obj) { if (!(obj is MapProjection)) { return(false); } MapProjection proj = obj as MapProjection; if (proj.NumParameters != this.NumParameters) { return(false); } for (int i = 0; i < _Parameters.Count; i++) { ProjectionParameter param = _Parameters.Find(delegate(ProjectionParameter par) { return(par.Name.Equals(proj.GetParameter(i).Name, StringComparison.OrdinalIgnoreCase)); }); if (param == null) { return(false); } if (param.Value != proj.GetParameter(i).Value) { return(false); } } if (this.IsInverse != proj.IsInverse) { return(false); } return(true); }
// ReSharper restore InconsistentNaming /// <summary> /// Creates an instance of this class /// </summary> /// <param name="parameters">An enumeration of projection parameters</param> /// <param name="inverse">Indicator if this projection is inverse</param> protected MapProjection(IEnumerable<ProjectionParameter> parameters, MapProjection inverse) : this(parameters) { _inverse = inverse; if (_inverse != null) { inverse._inverse = this; _isInverse = !inverse._isInverse; } }
// ReSharper restore InconsistentNaming /// <summary> /// Creates an instance of this class /// </summary> /// <param name="parameters">An enumeration of projection parameters</param> /// <param name="inverse">Indicator if this projection is inverse</param> protected MapProjection(IEnumerable <ProjectionParameter> parameters, MapProjection inverse) : this(parameters) { _inverse = inverse; if (_inverse != null) { inverse._inverse = this; _isInverse = !inverse._isInverse; } }
/// <summary> /// Creates an instance of this class /// </summary> /// <param name="parameters">An enumeration of Projection parameters</param> /// <param name="inverse">The inverse projection</param> public LambertAzimuthalEqualAreaProjection(IEnumerable <ProjectionParameter> parameters, MapProjection inverse) : base(parameters, inverse) { double phi0 = lat_origin; double t = Math.Abs(phi0); if (t > HALF_PI + EPS10) { throw new ArgumentException(nameof(parameters)); } if (Math.Abs(t - HALF_PI) < EPS10) { _mode = phi0 < 0.0 ? Mode.S_POLE : Mode.N_POLE; } else if (Math.Abs(t) < EPS10) { _mode = Mode.EQUIT; } else { _mode = Mode.OBLIQ; } if (_es != 0d) { _one_es = 1.0 - _es; _qp = qsfn(1, _e, _one_es); //_mmf = 0.5 / (1.0 - _es); _apa = authset(_es); if (_apa == null) { throw new ArgumentException(nameof(parameters)); } switch (_mode) { case Mode.N_POLE: case Mode.S_POLE: _dd = 1.0; break; case Mode.EQUIT: _dd = 1.0 / (_rq = Math.Sqrt(0.5 * _qp)); _xmf = 1.0; _ymf = 0.5 * _qp; break; case Mode.OBLIQ: _rq = Math.Sqrt(0.5 * _qp); double sinphi = Math.Sin(phi0); _sinb1 = qsfn(sinphi, _e, _one_es) / _qp; _cosb1 = Math.Sqrt(1.0 - _sinb1 * _sinb1); _dd = Math.Cos(phi0) / (Math.Sqrt(1.0 - _es * sinphi * sinphi) * _rq * _cosb1); _ymf = (_xmf = _rq) / _dd; _xmf *= _dd; break; } _radiansToMeters = EllipsoidalRadiansToMeters; _metersToRadians = EllipsoidalMetersToRadians; } else { if (_mode == Mode.OBLIQ) { _sinb1 = Math.Sin(phi0); _cosb1 = Math.Cos(phi0); } _radiansToMeters = SphericalRadiansToMeters; _metersToRadians = SphericalMetersToRadians; } _reciprocSemiMajorTimesScaleFactor = 1d / (scale_factor * _semiMajor); }