Exemple #1
0
 /// <summary>
 /// Returns the inverse of this projection.
 /// </summary>
 /// <returns>IMathTransform that is the reverse of the current projection.</returns>
 public override IMathTransform Inverse()
 {
     if (_inverse == null)
     {
         _inverse = new LambertConformalConic2SP(_Parameters.ToProjectionParameter(), this);
     }
     return(_inverse);
 }
Exemple #2
0
        /// <summary>
        /// Creates an instance of an Albers projection object.
        /// </summary>
        /// <remarks>
        /// <para>The parameters this projection expects are listed below.</para>
        /// <list type="table">
        /// <listheader><term>Parameter</term><description>Description</description></listheader>
        /// <item><term>latitude_of_origin</term><description>The latitude of the point which is not the natural origin and at which grid coordinate values false easting and false northing are defined.</description></item>
        /// <item><term>central_meridian</term><description>The longitude of the point which is not the natural origin and at which grid coordinate values false easting and false northing are defined.</description></item>
        /// <item><term>standard_parallel_1</term><description>For a conic projection with two standard parallels, this is the latitude of intersection of the cone with the ellipsoid that is nearest the pole.  Scale is true along this parallel.</description></item>
        /// <item><term>standard_parallel_2</term><description>For a conic projection with two standard parallels, this is the latitude of intersection of the cone with the ellipsoid that is furthest from the pole.  Scale is true along this parallel.</description></item>
        /// <item><term>false_easting</term><description>The easting value assigned to the false origin.</description></item>
        /// <item><term>false_northing</term><description>The northing value assigned to the false origin.</description></item>
        /// </list>
        /// </remarks>
        /// <param name="parameters">List of parameters to initialize the projection.</param>
        /// <param name="inverse">Indicates whether the projection forward (meters to degrees or degrees to meters).</param>
        protected LambertConformalConic2SP(IEnumerable <ProjectionParameter> parameters, LambertConformalConic2SP inverse)
            : base(parameters, inverse)
        {
            Name          = "Lambert_Conformal_Conic_2SP";
            Authority     = "EPSG";
            AuthorityCode = 9802;

            //Check for missing parameters
            var lat1 = Degrees2Radians(_Parameters.GetParameterValue("standard_parallel_1"));
            var lat2 = Degrees2Radians(_Parameters.GetParameterValue("standard_parallel_2"));

            double sin_po;                              /* sin value                            */
            double cos_po;                              /* cos value                            */
            double con;                                 /* temporary variable                   */
            double ms1;                                 /* small m 1                            */
            double ms2;                                 /* small m 2                            */
            double ts0;                                 /* small t 0                            */
            double ts1;                                 /* small t 1                            */
            double ts2;                                 /* small t 2                            */



            /* Standard Parallels cannot be equal and on opposite sides of the equator
            *  ------------------------------------------------------------------------*/

            if (Math.Abs(lat1 + lat2) < EPSLN)
            {
                //Debug.Assert(true,"LambertConformalConic:LambertConformalConic() - Equal Latitiudes for St. Parallels on opposite sides of equator");
                throw new ArgumentException("Equal latitudes for St. Parallels on opposite sides of equator.");
            }

            sincos(lat1, out sin_po, out cos_po);
            con = sin_po;
            ms1 = msfnz(_e, sin_po, cos_po);
            ts1 = tsfnz(_e, lat1, sin_po);
            sincos(lat2, out sin_po, out cos_po);
            ms2    = msfnz(_e, sin_po, cos_po);
            ts2    = tsfnz(_e, lat2, sin_po);
            sin_po = Math.Sin(lat_origin);
            ts0    = tsfnz(_e, lat_origin, sin_po);

            if (Math.Abs(lat1 - lat2) > EPSLN)
            {
                ns = Math.Log(ms1 / ms2) / Math.Log(ts1 / ts2);
            }
            else
            {
                ns = con;
            }
            f0 = ms1 / (ns * Math.Pow(ts1, ns));
            rh = _semiMajor * f0 * Math.Pow(ts0, ns);
        }