예제 #1
0
        public override void Initialize()
        {
            base.Initialize();

            double c;

            //_phi1 = pj_param(params, "rlat_1").f;
            _phi1 = ProjectionMath.PiHalf;
            if (Math.Abs(_phi1) < EPS10)
            {
                throw new ProjectionException("-23");
            }
            if (!_spherical)
            {
                _en = ProjectionMath.enfn(_es);
                _m1 = ProjectionMath.mlfn(_phi1, _am1 = Math.Sin(_phi1),
                                          c = Math.Cos(_phi1), _en);
                _am1 = c / (Math.Sqrt(1.0 - _es * _am1 * _am1) * _am1);
            }
            else
            {
                if (Math.Abs(_phi1) + EPS10 >= ProjectionMath.PiHalf)
                {
                    _cphi1 = 0.0;
                }
                else
                {
                    _cphi1 = 1.0 / Math.Tan(_phi1);
                }
            }
        }
예제 #2
0
        public override void Initialize()
        {
            base.Initialize();
            double  cosphi, sinphi;
            Boolean secant;

            _phi1 = ProjectionLatitude1;
            _phi2 = ProjectionLatitude2;

            if (Math.Abs(_phi1 + _phi2) < EPS10)
            {
                throw new ProjectionException("-21");
            }
            _n     = sinphi = Math.Sin(_phi1);
            cosphi = Math.Cos(_phi1);
            secant = Math.Abs(_phi1 - _phi2) >= EPS10;
            //spherical = es > 0.0;
            if (!_spherical)
            {
                double ml1, m1;

                if ((_en = ProjectionMath.enfn(_es)) == null)
                {
                    throw new ProjectionException("0");
                }
                m1  = ProjectionMath.msfn(sinphi, cosphi, _es);
                ml1 = ProjectionMath.Qsfn(sinphi, _e, _oneEs);
                if (secant)
                {
                    /* secant cone */
                    double ml2, m2;

                    sinphi = Math.Sin(_phi2);
                    cosphi = Math.Cos(_phi2);
                    m2     = ProjectionMath.msfn(sinphi, cosphi, _es);
                    ml2    = ProjectionMath.Qsfn(sinphi, _e, _oneEs);
                    _n     = (m1 * m1 - m2 * m2) / (ml2 - ml1);
                }
                _ec = 1.0 - .5 * _oneEs * Math.Log((1.0 - _e) /
                                                   (1.0 + _e)) / _e;
                _c    = m1 * m1 + _n * ml1;
                _dd   = 1.0 / _n;
                _rho0 = _dd * Math.Sqrt(_c - _n * ProjectionMath.Qsfn(Math.Sin(ProjectionLatitude),
                                                                      _e, _oneEs));
            }
            else
            {
                if (secant)
                {
                    _n = .5 * (_n + Math.Sin(_phi2));
                }
                _n2   = _n + _n;
                _c    = cosphi * cosphi + _n2 * sinphi;
                _dd   = 1.0 / _n;
                _rho0 = _dd * Math.Sqrt(_c - _n2 * Math.Sin(ProjectionLatitude));
            }
        }
예제 #3
0
 public override void Initialize()
 {
     base.Initialize();
     if (!_spherical)
     {
         if ((_en = ProjectionMath.enfn(_es)) == null)
         {
             throw new ProjectionException();
         }
         _m0 = ProjectionMath.mlfn(ProjectionLatitude, Math.Sin(ProjectionLatitude), Math.Cos(ProjectionLatitude), _en);
     }
 }
예제 #4
0
 public override void Initialize()
 {
     base.Initialize();
     if (_spherical)
     {
         _esp = ScaleFactor;
         _ml0 = .5 * _esp;
     }
     else
     {
         _en  = ProjectionMath.enfn(_es);
         _ml0 = ProjectionMath.mlfn(_projectionLatitude, Math.Sin(_projectionLatitude), Math.Cos(_projectionLatitude), _en);
         _esp = _es / (1.0 - _es);
     }
 }
예제 #5
0
 public override void Initialize()
 {
     base.Initialize();
     _spherical = true;//FIXME
     if (!Spherical)
     {
         _en = ProjectionMath.enfn(EccentricitySquared);
         if (_en == null)
         {
             throw new ProjectionException("E");
         }
         _ml0 = ProjectionMath.mlfn(ProjectionLatitude, Math.Sin(ProjectionLatitude), Math.Cos(ProjectionLatitude), _en);
     }
     else
     {
         _ml0 = -ProjectionLatitude;
     }
 }
        public override void Initialize()
        {
            base.Initialize();
            if (Math.Abs(Math.Abs(ProjectionLatitude) - ProjectionMath.PiHalf) < EPS10)
            {
                _mode    = ProjectionLatitude < 0.0 ? AzimuthalMode.SouthPole : AzimuthalMode.NorthPole;
                _sinphi0 = ProjectionLatitude < 0.0 ? -1.0 : 1.0;
                _cosphi0 = 0.0;
            }
            else if (Math.Abs(ProjectionLatitude) < EPS10)
            {
                _mode    = AzimuthalMode.Equator;
                _sinphi0 = 0.0;
                _cosphi0 = 1.0;
            }
            else
            {
                _mode    = AzimuthalMode.Oblique;
                _sinphi0 = Math.Sin(ProjectionLatitude);
                _cosphi0 = Math.Cos(ProjectionLatitude);
            }
            if (!Spherical)
            {
                _en = ProjectionMath.enfn(EccentricitySquared);
                switch (Mode)
                {
                case AzimuthalMode.NorthPole:
                    _mp = ProjectionMath.mlfn(ProjectionMath.PiHalf, 1.0, 0.0, _en);
                    break;

                case AzimuthalMode.SouthPole:
                    _mp = ProjectionMath.mlfn(-ProjectionMath.PiHalf, -1.0, 0.0, _en);
                    break;

                case AzimuthalMode.Equator:
                case AzimuthalMode.Oblique:
                    _n1  = 1.0 / Math.Sqrt(1.0 - EccentricitySquared * _sinphi0 * _sinphi0);
                    _g   = _sinphi0 * (_he = Eccentricity / Math.Sqrt(_oneEs));
                    _he *= _cosphi0;
                    break;
                }
            }
        }