Ejemplo n.º 1
0
        /// <summary>
        /// Initializes the transform using the parameters from the specified coordinate system information
        /// </summary>
        /// <param name="projInfo">A ProjectionInfo class contains all the standard and custom parameters needed to initialize this transform</param>
        protected override void OnInit(ProjectionInfo projInfo)
        {
            if (Es != 0)
            {
                _en = MeridionalDistance.GetEn(Es);
                if (_en == null)
                {
                    throw new ProjectionException(0);
                }

                _ml0 = MeridionalDistance.MeridionalLength(Phi0, Math.Sin(Phi0), Math.Cos(Phi0), _en);
                _esp = Es / (1 - Es);
            }
            else
            {
                _esp = K0;
                _ml0 = .5 * _esp;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The forward transform where the spheroidal model of the earth has a flattening factor,
        /// matching more closely with the oblique spheroid of the actual earth
        /// </summary>
        /// <param name="lp">The double values for geodetic lambda and phi organized into a one dimensional array</param>
        /// <param name="xy">The double values for linear x and y organized into a one dimensional array</param>
        /// <param name="startIndex">The zero based integer start index</param>
        /// <param name="numPoints">The integer count of the number of xy pairs in the lp and xy arrays</param>
        protected override void EllipticalForward(double[] lp, double[] xy, int startIndex, int numPoints)
        {
            for (int i = startIndex; i < startIndex + numPoints; i++)
            {
                int phi = i * 2 + PHI;
                int lam = i * 2 + LAMBDA;
                int x   = i * 2 + X;
                int y   = i * 2 + Y;

                /*
                 * Fail if our longitude is more than 90 degrees from the
                 * central meridian since the results are essentially garbage.
                 * Is error -20 really an appropriate return value?
                 *
                 *  http://trac.osgeo.org/proj/ticket/5
                 */
                if (lp[lam] < -HALF_PI || lp[lam] > HALF_PI)
                {
                    xy[x] = double.NaN;
                    xy[y] = double.NaN;
                    continue;
                    //ProjectionException(14);
                }
                double sinphi = Math.Sin(lp[phi]);
                double cosphi = Math.Cos(lp[phi]);
                double t      = Math.Abs(cosphi) > 1E-10 ? sinphi / cosphi : 0;
                t *= t;
                double al  = cosphi * lp[lam];
                double als = al * al;
                al /= Math.Sqrt(1 - Es * sinphi * sinphi);
                double n = _esp * cosphi * cosphi;
                xy[x] = K0 * al * (FC1 +
                                   FC3 * als * (1 - t + n +
                                                FC5 * als * (5 + t * (t - 18) + n * (14 - 58 * t) +
                                                             FC7 * als * (61 + t * (t * (179 - t) - 479)))));
                xy[y] = K0 * (MeridionalDistance.MeridionalLength(lp[phi], sinphi, cosphi, _en) - _ml0 +
                              sinphi * al * lp[lam] * FC2 * (1 +
                                                             FC4 * als * (5 - t + n * (9 + 4 * n) +
                                                                          FC6 * als * (61 + t * (t - 58) + n * (270 - 330 * t) +
                                                                                       FC8 * als * (1385 + t * (t * (543 - t) - 3111))))));
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Meridonal length function
 /// </summary>
 /// <param name="phi"></param>
 /// <param name="sphi"></param>
 /// <param name="cphi"></param>
 /// <param name="en"></param>
 /// <returns></returns>
 public static double Mlfn(double phi, double sphi, double cphi, double[] en)
 {
     return(MeridionalDistance.MeridionalLength(phi, sphi, cphi, en));
 }