123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- #ifndef BOOST_GEOMETRY_PROJECTIONS_IMPL_PJ_FWD_HPP
- #define BOOST_GEOMETRY_PROJECTIONS_IMPL_PJ_FWD_HPP
- #include <boost/geometry/core/radian_access.hpp>
- #include <boost/geometry/util/math.hpp>
- #include <boost/geometry/srs/projections/impl/adjlon.hpp>
- #include <boost/geometry/srs/projections/impl/projects.hpp>
- #include <boost/math/constants/constants.hpp>
- namespace boost { namespace geometry { namespace projections {
- namespace detail {
- template <typename Prj, typename LL, typename XY, typename P>
- inline void pj_fwd(Prj const& prj, P const& par, LL const& ll, XY& xy)
- {
- typedef typename P::type calc_t;
- static const calc_t EPS = 1.0e-12;
- using namespace detail;
- calc_t lp_lon = geometry::get_as_radian<0>(ll);
- calc_t lp_lat = geometry::get_as_radian<1>(ll);
- calc_t const t = geometry::math::abs(lp_lat) - geometry::math::half_pi<calc_t>();
-
- if (t > EPS || geometry::math::abs(lp_lon) > 10.)
- {
- BOOST_THROW_EXCEPTION( projection_exception(error_lat_or_lon_exceed_limit) );
- }
- if (geometry::math::abs(t) <= EPS)
- {
- lp_lat = lp_lat < 0. ? -geometry::math::half_pi<calc_t>() : geometry::math::half_pi<calc_t>();
- }
- else if (par.geoc)
- {
- lp_lat = atan(par.rone_es * tan(lp_lat));
- }
- lp_lon -= par.lam0;
- if (! par.over)
- {
- lp_lon = adjlon(lp_lon);
- }
- calc_t x = 0;
- calc_t y = 0;
- prj.fwd(par, lp_lon, lp_lat, x, y);
- if (par.axis[0] == 0)
- {
- geometry::set<0>(xy, par.sign[0] * par.fr_meter * (par.a * x + par.x0));
- geometry::set<1>(xy, par.sign[1] * par.fr_meter * (par.a * y + par.y0));
- } else {
- geometry::set<1>(xy, par.sign[1] * par.fr_meter * (par.a * x + par.x0));
- geometry::set<0>(xy, par.sign[0] * par.fr_meter * (par.a * y + par.y0));
- }
- }
- }
- }}}
- #endif
|