示例#1
0
        public override PJ Init()
        {
            g=new geod_geodesic(a, es/(1+Math.Sqrt(one_es)));

            phi0=Proj.pj_param_r(ctx, parameters, "lat_0");
            if(Math.Abs(Math.Abs(phi0)-Proj.HALFPI)<EPS10)
            {
                mode=phi0<0.0?aeqd_mode.S_POLE:aeqd_mode.N_POLE;
                sinph0=phi0<0.0?-1.0:1.0;
                cosph0=0.0;
            }
            else if(Math.Abs(phi0)<EPS10)
            {
                mode=aeqd_mode.EQUIT;
                sinph0=0.0;
                cosph0=1.0;
            }
            else
            {
                mode=aeqd_mode.OBLIQ;
                sinph0=Math.Sin(phi0);
                cosph0=Math.Cos(phi0);
            }

            if(es==0)
            {
                inv=s_inverse;
                fwd=s_forward;
            }
            else
            {
                en=Proj.pj_enfn(es);
                if(en==null) return null;
                if(Proj.pj_param_b(ctx, parameters, "guam"))
                {
                    M1=Proj.pj_mlfn(phi0, sinph0, cosph0, en);
                    inv=e_guam_inv;
                    fwd=e_guam_fwd;
                }
                else
                {
                    switch(mode)
                    {
                        case aeqd_mode.N_POLE:
                            Mp=Proj.pj_mlfn(Proj.HALFPI, 1.0, 0.0, en);
                            break;
                        case aeqd_mode.S_POLE:
                            Mp=Proj.pj_mlfn(-Proj.HALFPI, -1.0, 0.0, en);
                            break;
                        case aeqd_mode.EQUIT:
                        case aeqd_mode.OBLIQ:
                            inv=e_inverse;
                            fwd=e_forward;
                            N1=1.0/Math.Sqrt(1.0-es*sinph0*sinph0);
                            He=e/Math.Sqrt(one_es);
                            G=sinph0*He;
                            He*=cosph0;
                            break;
                    }
                    inv=e_inverse;
                    fwd=e_forward;
                }
            }

            return this;
        }
示例#2
0
        public override PJ Init()
        {
            g = new geod_geodesic(a, es / (1 + Math.Sqrt(one_es)));

            phi0 = Proj.pj_param_r(ctx, parameters, "lat_0");
            if (Math.Abs(Math.Abs(phi0) - Proj.HALFPI) < EPS10)
            {
                mode   = phi0 < 0.0?aeqd_mode.S_POLE:aeqd_mode.N_POLE;
                sinph0 = phi0 < 0.0?-1.0:1.0;
                cosph0 = 0.0;
            }
            else if (Math.Abs(phi0) < EPS10)
            {
                mode   = aeqd_mode.EQUIT;
                sinph0 = 0.0;
                cosph0 = 1.0;
            }
            else
            {
                mode   = aeqd_mode.OBLIQ;
                sinph0 = Math.Sin(phi0);
                cosph0 = Math.Cos(phi0);
            }

            if (es == 0)
            {
                inv = s_inverse;
                fwd = s_forward;
            }
            else
            {
                en = Proj.pj_enfn(es);
                if (en == null)
                {
                    return(null);
                }
                if (Proj.pj_param_b(ctx, parameters, "guam"))
                {
                    M1  = Proj.pj_mlfn(phi0, sinph0, cosph0, en);
                    inv = e_guam_inv;
                    fwd = e_guam_fwd;
                }
                else
                {
                    switch (mode)
                    {
                    case aeqd_mode.N_POLE:
                        Mp = Proj.pj_mlfn(Proj.HALFPI, 1.0, 0.0, en);
                        break;

                    case aeqd_mode.S_POLE:
                        Mp = Proj.pj_mlfn(-Proj.HALFPI, -1.0, 0.0, en);
                        break;

                    case aeqd_mode.EQUIT:
                    case aeqd_mode.OBLIQ:
                        inv = e_inverse;
                        fwd = e_forward;
                        N1  = 1.0 / Math.Sqrt(1.0 - es * sinph0 * sinph0);
                        He  = e / Math.Sqrt(one_es);
                        G   = sinph0 * He;
                        He *= cosph0;
                        break;
                    }
                    inv = e_inverse;
                    fwd = e_forward;
                }
            }

            return(this);
        }