update boost on linux
This commit is contained in:
344
linx64/include/boost/geometry/srs/projections/proj/aea.hpp
Normal file
344
linx64/include/boost/geometry/srs/projections/proj/aea.hpp
Normal file
@@ -0,0 +1,344 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Author: Gerald Evenden (1995)
|
||||
// Thomas Knudsen (2016) - revise/add regression tests
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Purpose: Implementation of the aea (Albers Equal Area) projection.
|
||||
// Author: Gerald Evenden
|
||||
// Copyright (c) 1995, Gerald Evenden
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_AEA_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_AEA_HPP
|
||||
|
||||
#include <boost/core/ignore_unused.hpp>
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
#include <boost/math/special_functions/hypot.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_mlfn.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_msfn.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_qsfn.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace aea
|
||||
{
|
||||
|
||||
static const double epsilon10 = 1.e-10;
|
||||
static const double tolerance7 = 1.e-7;
|
||||
static const double epsilon = 1.0e-7;
|
||||
static const double tolerance = 1.0e-10;
|
||||
static const int n_iter = 15;
|
||||
|
||||
template <typename T>
|
||||
struct par_aea
|
||||
{
|
||||
T ec;
|
||||
T n;
|
||||
T c;
|
||||
T dd;
|
||||
T n2;
|
||||
T rho0;
|
||||
T phi1;
|
||||
T phi2;
|
||||
detail::en<T> en;
|
||||
int ellips;
|
||||
};
|
||||
|
||||
/* determine latitude angle phi-1 */
|
||||
template <typename T>
|
||||
inline T phi1_(T const& qs, T const& Te, T const& Tone_es)
|
||||
{
|
||||
int i;
|
||||
T Phi, sinpi, cospi, con, com, dphi;
|
||||
|
||||
Phi = asin (.5 * qs);
|
||||
if (Te < epsilon)
|
||||
return( Phi );
|
||||
i = n_iter;
|
||||
do {
|
||||
sinpi = sin (Phi);
|
||||
cospi = cos (Phi);
|
||||
con = Te * sinpi;
|
||||
com = 1. - con * con;
|
||||
dphi = .5 * com * com / cospi * (qs / Tone_es -
|
||||
sinpi / com + .5 / Te * log ((1. - con) /
|
||||
(1. + con)));
|
||||
Phi += dphi;
|
||||
} while (fabs(dphi) > tolerance && --i);
|
||||
return( i ? Phi : HUGE_VAL );
|
||||
}
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_aea_ellipsoid
|
||||
: public base_t_fi<base_aea_ellipsoid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_aea<T> m_proj_parm;
|
||||
|
||||
inline base_aea_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_aea_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_forward) ellipsoid & spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T rho = this->m_proj_parm.c - (this->m_proj_parm.ellips
|
||||
? this->m_proj_parm.n * pj_qsfn(sin(lp_lat), this->m_par.e, this->m_par.one_es)
|
||||
: this->m_proj_parm.n2 * sin(lp_lat));
|
||||
if (rho < 0.)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
rho = this->m_proj_parm.dd * sqrt(rho);
|
||||
xy_x = rho * sin( lp_lon *= this->m_proj_parm.n );
|
||||
xy_y = this->m_proj_parm.rho0 - rho * cos(lp_lon);
|
||||
}
|
||||
|
||||
// INVERSE(e_inverse) ellipsoid & spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T rho = 0.0;
|
||||
if( (rho = boost::math::hypot(xy_x, xy_y = this->m_proj_parm.rho0 - xy_y)) != 0.0 ) {
|
||||
if (this->m_proj_parm.n < 0.) {
|
||||
rho = -rho;
|
||||
xy_x = -xy_x;
|
||||
xy_y = -xy_y;
|
||||
}
|
||||
lp_lat = rho / this->m_proj_parm.dd;
|
||||
if (this->m_proj_parm.ellips) {
|
||||
lp_lat = (this->m_proj_parm.c - lp_lat * lp_lat) / this->m_proj_parm.n;
|
||||
if (fabs(this->m_proj_parm.ec - fabs(lp_lat)) > tolerance7) {
|
||||
if ((lp_lat = phi1_(lp_lat, this->m_par.e, this->m_par.one_es)) == HUGE_VAL)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
} else
|
||||
lp_lat = lp_lat < 0. ? -half_pi : half_pi;
|
||||
} else if (fabs(lp_lat = (this->m_proj_parm.c - lp_lat * lp_lat) / this->m_proj_parm.n2) <= 1.)
|
||||
lp_lat = asin(lp_lat);
|
||||
else
|
||||
lp_lat = lp_lat < 0. ? -half_pi : half_pi;
|
||||
lp_lon = atan2(xy_x, xy_y) / this->m_proj_parm.n;
|
||||
} else {
|
||||
lp_lon = 0.;
|
||||
lp_lat = this->m_proj_parm.n > 0. ? half_pi : - half_pi;
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "aea_ellipsoid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup(Parameters const& par, par_aea<T>& proj_parm)
|
||||
{
|
||||
T cosphi, sinphi;
|
||||
int secant;
|
||||
|
||||
if (fabs(proj_parm.phi1 + proj_parm.phi2) < epsilon10)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_conic_lat_equal) );
|
||||
proj_parm.n = sinphi = sin(proj_parm.phi1);
|
||||
cosphi = cos(proj_parm.phi1);
|
||||
secant = fabs(proj_parm.phi1 - proj_parm.phi2) >= epsilon10;
|
||||
if( (proj_parm.ellips = (par.es > 0.))) {
|
||||
T ml1, m1;
|
||||
|
||||
proj_parm.en = pj_enfn<T>(par.es);
|
||||
m1 = pj_msfn(sinphi, cosphi, par.es);
|
||||
ml1 = pj_qsfn(sinphi, par.e, par.one_es);
|
||||
if (secant) { /* secant cone */
|
||||
T ml2, m2;
|
||||
|
||||
sinphi = sin(proj_parm.phi2);
|
||||
cosphi = cos(proj_parm.phi2);
|
||||
m2 = pj_msfn(sinphi, cosphi, par.es);
|
||||
ml2 = pj_qsfn(sinphi, par.e, par.one_es);
|
||||
if (ml2 == ml1)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(0) );
|
||||
|
||||
proj_parm.n = (m1 * m1 - m2 * m2) / (ml2 - ml1);
|
||||
}
|
||||
proj_parm.ec = 1. - .5 * par.one_es * log((1. - par.e) /
|
||||
(1. + par.e)) / par.e;
|
||||
proj_parm.c = m1 * m1 + proj_parm.n * ml1;
|
||||
proj_parm.dd = 1. / proj_parm.n;
|
||||
proj_parm.rho0 = proj_parm.dd * sqrt(proj_parm.c - proj_parm.n * pj_qsfn(sin(par.phi0),
|
||||
par.e, par.one_es));
|
||||
} else {
|
||||
if (secant) proj_parm.n = .5 * (proj_parm.n + sin(proj_parm.phi2));
|
||||
proj_parm.n2 = proj_parm.n + proj_parm.n;
|
||||
proj_parm.c = cosphi * cosphi + proj_parm.n2 * sinphi;
|
||||
proj_parm.dd = 1. / proj_parm.n;
|
||||
proj_parm.rho0 = proj_parm.dd * sqrt(proj_parm.c - proj_parm.n2 * sin(par.phi0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Albers Equal Area
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_aea(Params const& params, Parameters const& par, par_aea<T>& proj_parm)
|
||||
{
|
||||
proj_parm.phi1 = 0.0;
|
||||
proj_parm.phi2 = 0.0;
|
||||
bool is_phi1_set = pj_param_r<srs::spar::lat_1>(params, "lat_1", srs::dpar::lat_1, proj_parm.phi1);
|
||||
bool is_phi2_set = pj_param_r<srs::spar::lat_2>(params, "lat_2", srs::dpar::lat_2, proj_parm.phi2);
|
||||
|
||||
// Boost.Geometry specific, set default parameters manually
|
||||
if (! is_phi1_set || ! is_phi2_set) {
|
||||
bool const use_defaults = ! pj_get_param_b<srs::spar::no_defs>(params, "no_defs", srs::dpar::no_defs);
|
||||
if (use_defaults) {
|
||||
if (!is_phi1_set)
|
||||
proj_parm.phi1 = 29.5;
|
||||
if (!is_phi2_set)
|
||||
proj_parm.phi2 = 45.5;
|
||||
}
|
||||
}
|
||||
|
||||
setup(par, proj_parm);
|
||||
}
|
||||
|
||||
// Lambert Equal Area Conic
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_leac(Params const& params, Parameters const& par, par_aea<T>& proj_parm)
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
proj_parm.phi2 = pj_get_param_r<T, srs::spar::lat_1>(params, "lat_1", srs::dpar::lat_1);
|
||||
proj_parm.phi1 = pj_get_param_b<srs::spar::south>(params, "south", srs::dpar::south) ? -half_pi : half_pi;
|
||||
setup(par, proj_parm);
|
||||
}
|
||||
|
||||
}} // namespace detail::aea
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Albers Equal Area projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Conic
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Projection parameters
|
||||
- lat_1: Latitude of first standard parallel (degrees)
|
||||
- lat_2: Latitude of second standard parallel (degrees)
|
||||
\par Example
|
||||
\image html ex_aea.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct aea_ellipsoid : public detail::aea::base_aea_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline aea_ellipsoid(Params const& params, Parameters const& par)
|
||||
: detail::aea::base_aea_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::aea::setup_aea(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Lambert Equal Area Conic projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Conic
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Projection parameters
|
||||
- lat_1: Latitude of first standard parallel (degrees)
|
||||
- south: Denotes southern hemisphere UTM zone (boolean)
|
||||
\par Example
|
||||
\image html ex_leac.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct leac_ellipsoid : public detail::aea::base_aea_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline leac_ellipsoid(Params const& params, Parameters const& par)
|
||||
: detail::aea::base_aea_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::aea::setup_leac(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_aea, aea_ellipsoid, aea_ellipsoid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_leac, leac_ellipsoid, leac_ellipsoid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(aea_entry, aea_ellipsoid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(leac_entry, leac_ellipsoid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(aea_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(aea, aea_entry)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(leac, leac_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_AEA_HPP
|
||||
|
||||
631
linx64/include/boost/geometry/srs/projections/proj/aeqd.hpp
Normal file
631
linx64/include/boost/geometry/srs/projections/proj/aeqd.hpp
Normal file
@@ -0,0 +1,631 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Purpose: Implementation of the aeqd (Azimuthal Equidistant) projection.
|
||||
// Author: Gerald Evenden
|
||||
// Copyright (c) 1995, Gerald Evenden
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_AEQD_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_AEQD_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <boost/geometry/formulas/vincenty_direct.hpp>
|
||||
#include <boost/geometry/formulas/vincenty_inverse.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/aasincos.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_mlfn.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
#include <boost/math/special_functions/hypot.hpp>
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace aeqd
|
||||
{
|
||||
|
||||
static const double epsilon10 = 1.e-10;
|
||||
static const double tolerance = 1.e-14;
|
||||
enum mode_type {
|
||||
n_pole = 0,
|
||||
s_pole = 1,
|
||||
equit = 2,
|
||||
obliq = 3
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct par_aeqd
|
||||
{
|
||||
T sinph0;
|
||||
T cosph0;
|
||||
detail::en<T> en;
|
||||
T M1;
|
||||
T N1;
|
||||
T Mp;
|
||||
T He;
|
||||
T G;
|
||||
mode_type mode;
|
||||
srs::spheroid<T> spheroid;
|
||||
};
|
||||
|
||||
template <typename T, typename Par, typename ProjParm>
|
||||
inline void e_forward(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y, Par const& par, ProjParm const& proj_parm)
|
||||
{
|
||||
T coslam, cosphi, sinphi, rho;
|
||||
//T azi1, s12;
|
||||
//T lam1, phi1, lam2, phi2;
|
||||
|
||||
coslam = cos(lp_lon);
|
||||
cosphi = cos(lp_lat);
|
||||
sinphi = sin(lp_lat);
|
||||
switch (proj_parm.mode) {
|
||||
case n_pole:
|
||||
coslam = - coslam;
|
||||
BOOST_FALLTHROUGH;
|
||||
case s_pole:
|
||||
xy_x = (rho = fabs(proj_parm.Mp - pj_mlfn(lp_lat, sinphi, cosphi, proj_parm.en))) *
|
||||
sin(lp_lon);
|
||||
xy_y = rho * coslam;
|
||||
break;
|
||||
case equit:
|
||||
case obliq:
|
||||
if (fabs(lp_lon) < epsilon10 && fabs(lp_lat - par.phi0) < epsilon10) {
|
||||
xy_x = xy_y = 0.;
|
||||
break;
|
||||
}
|
||||
|
||||
//phi1 = par.phi0; lam1 = par.lam0;
|
||||
//phi2 = lp_lat; lam2 = lp_lon + par.lam0;
|
||||
|
||||
formula::result_inverse<T> const inv =
|
||||
formula::vincenty_inverse
|
||||
<
|
||||
T, true, true
|
||||
>::apply(par.lam0, par.phi0, lp_lon + par.lam0, lp_lat, proj_parm.spheroid);
|
||||
//azi1 = inv.azimuth; s12 = inv.distance;
|
||||
xy_x = inv.distance * sin(inv.azimuth) / par.a;
|
||||
xy_y = inv.distance * cos(inv.azimuth) / par.a;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T, typename Par, typename ProjParm>
|
||||
inline void e_inverse(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat, Par const& par, ProjParm const& proj_parm)
|
||||
{
|
||||
T c;
|
||||
|
||||
if ((c = boost::math::hypot(xy_x, xy_y)) < epsilon10) {
|
||||
lp_lat = par.phi0;
|
||||
lp_lon = 0.;
|
||||
return;
|
||||
}
|
||||
if (proj_parm.mode == obliq || proj_parm.mode == equit) {
|
||||
T const x2 = xy_x * par.a;
|
||||
T const y2 = xy_y * par.a;
|
||||
//T const lat1 = par.phi0;
|
||||
//T const lon1 = par.lam0;
|
||||
T const azi1 = atan2(x2, y2);
|
||||
T const s12 = sqrt(x2 * x2 + y2 * y2);
|
||||
formula::result_direct<T> const dir =
|
||||
formula::vincenty_direct
|
||||
<
|
||||
T, true
|
||||
>::apply(par.lam0, par.phi0, s12, azi1, proj_parm.spheroid);
|
||||
lp_lat = dir.lat2;
|
||||
lp_lon = dir.lon2;
|
||||
lp_lon -= par.lam0;
|
||||
} else { /* Polar */
|
||||
lp_lat = pj_inv_mlfn(proj_parm.mode == n_pole ? proj_parm.Mp - c : proj_parm.Mp + c,
|
||||
par.es, proj_parm.en);
|
||||
lp_lon = atan2(xy_x, proj_parm.mode == n_pole ? -xy_y : xy_y);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T, typename Par, typename ProjParm>
|
||||
inline void e_guam_fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y, Par const& par, ProjParm const& proj_parm)
|
||||
{
|
||||
T cosphi, sinphi, t;
|
||||
|
||||
cosphi = cos(lp_lat);
|
||||
sinphi = sin(lp_lat);
|
||||
t = 1. / sqrt(1. - par.es * sinphi * sinphi);
|
||||
xy_x = lp_lon * cosphi * t;
|
||||
xy_y = pj_mlfn(lp_lat, sinphi, cosphi, proj_parm.en) - proj_parm.M1 +
|
||||
.5 * lp_lon * lp_lon * cosphi * sinphi * t;
|
||||
}
|
||||
|
||||
template <typename T, typename Par, typename ProjParm>
|
||||
inline void e_guam_inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat, Par const& par, ProjParm const& proj_parm)
|
||||
{
|
||||
T x2, t = 0.0;
|
||||
int i;
|
||||
|
||||
x2 = 0.5 * xy_x * xy_x;
|
||||
lp_lat = par.phi0;
|
||||
for (i = 0; i < 3; ++i) {
|
||||
t = par.e * sin(lp_lat);
|
||||
lp_lat = pj_inv_mlfn(proj_parm.M1 + xy_y -
|
||||
x2 * tan(lp_lat) * (t = sqrt(1. - t * t)), par.es, proj_parm.en);
|
||||
}
|
||||
lp_lon = xy_x * t / cos(lp_lat);
|
||||
}
|
||||
|
||||
template <typename T, typename Par, typename ProjParm>
|
||||
inline void s_forward(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y, Par const& /*par*/, ProjParm const& proj_parm)
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T coslam, cosphi, sinphi;
|
||||
|
||||
sinphi = sin(lp_lat);
|
||||
cosphi = cos(lp_lat);
|
||||
coslam = cos(lp_lon);
|
||||
switch (proj_parm.mode) {
|
||||
case equit:
|
||||
xy_y = cosphi * coslam;
|
||||
goto oblcon;
|
||||
case obliq:
|
||||
xy_y = proj_parm.sinph0 * sinphi + proj_parm.cosph0 * cosphi * coslam;
|
||||
oblcon:
|
||||
if (fabs(fabs(xy_y) - 1.) < tolerance)
|
||||
if (xy_y < 0.)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
else
|
||||
xy_x = xy_y = 0.;
|
||||
else {
|
||||
xy_y = acos(xy_y);
|
||||
xy_y /= sin(xy_y);
|
||||
xy_x = xy_y * cosphi * sin(lp_lon);
|
||||
xy_y *= (proj_parm.mode == equit) ? sinphi :
|
||||
proj_parm.cosph0 * sinphi - proj_parm.sinph0 * cosphi * coslam;
|
||||
}
|
||||
break;
|
||||
case n_pole:
|
||||
lp_lat = -lp_lat;
|
||||
coslam = -coslam;
|
||||
BOOST_FALLTHROUGH;
|
||||
case s_pole:
|
||||
if (fabs(lp_lat - half_pi) < epsilon10)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
xy_x = (xy_y = (half_pi + lp_lat)) * sin(lp_lon);
|
||||
xy_y *= coslam;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T, typename Par, typename ProjParm>
|
||||
inline void s_inverse(T xy_x, T xy_y, T& lp_lon, T& lp_lat, Par const& par, ProjParm const& proj_parm)
|
||||
{
|
||||
static const T pi = detail::pi<T>();
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T cosc, c_rh, sinc;
|
||||
|
||||
if ((c_rh = boost::math::hypot(xy_x, xy_y)) > pi) {
|
||||
if (c_rh - epsilon10 > pi)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
c_rh = pi;
|
||||
} else if (c_rh < epsilon10) {
|
||||
lp_lat = par.phi0;
|
||||
lp_lon = 0.;
|
||||
return;
|
||||
}
|
||||
if (proj_parm.mode == obliq || proj_parm.mode == equit) {
|
||||
sinc = sin(c_rh);
|
||||
cosc = cos(c_rh);
|
||||
if (proj_parm.mode == equit) {
|
||||
lp_lat = aasin(xy_y * sinc / c_rh);
|
||||
xy_x *= sinc;
|
||||
xy_y = cosc * c_rh;
|
||||
} else {
|
||||
lp_lat = aasin(cosc * proj_parm.sinph0 + xy_y * sinc * proj_parm.cosph0 /
|
||||
c_rh);
|
||||
xy_y = (cosc - proj_parm.sinph0 * sin(lp_lat)) * c_rh;
|
||||
xy_x *= sinc * proj_parm.cosph0;
|
||||
}
|
||||
lp_lon = xy_y == 0. ? 0. : atan2(xy_x, xy_y);
|
||||
} else if (proj_parm.mode == n_pole) {
|
||||
lp_lat = half_pi - c_rh;
|
||||
lp_lon = atan2(xy_x, -xy_y);
|
||||
} else {
|
||||
lp_lat = c_rh - half_pi;
|
||||
lp_lon = atan2(xy_x, xy_y);
|
||||
}
|
||||
}
|
||||
|
||||
// Azimuthal Equidistant
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_aeqd(Params const& params, Parameters& par, par_aeqd<T>& proj_parm, bool is_sphere, bool is_guam)
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
par.phi0 = pj_get_param_r<T, srs::spar::lat_0>(params, "lat_0", srs::dpar::lat_0);
|
||||
if (fabs(fabs(par.phi0) - half_pi) < epsilon10) {
|
||||
proj_parm.mode = par.phi0 < 0. ? s_pole : n_pole;
|
||||
proj_parm.sinph0 = par.phi0 < 0. ? -1. : 1.;
|
||||
proj_parm.cosph0 = 0.;
|
||||
} else if (fabs(par.phi0) < epsilon10) {
|
||||
proj_parm.mode = equit;
|
||||
proj_parm.sinph0 = 0.;
|
||||
proj_parm.cosph0 = 1.;
|
||||
} else {
|
||||
proj_parm.mode = obliq;
|
||||
proj_parm.sinph0 = sin(par.phi0);
|
||||
proj_parm.cosph0 = cos(par.phi0);
|
||||
}
|
||||
if (is_sphere) {
|
||||
/* empty */
|
||||
} else {
|
||||
proj_parm.en = pj_enfn<T>(par.es);
|
||||
if (is_guam) {
|
||||
proj_parm.M1 = pj_mlfn(par.phi0, proj_parm.sinph0, proj_parm.cosph0, proj_parm.en);
|
||||
} else {
|
||||
switch (proj_parm.mode) {
|
||||
case n_pole:
|
||||
proj_parm.Mp = pj_mlfn<T>(half_pi, 1., 0., proj_parm.en);
|
||||
break;
|
||||
case s_pole:
|
||||
proj_parm.Mp = pj_mlfn<T>(-half_pi, -1., 0., proj_parm.en);
|
||||
break;
|
||||
case equit:
|
||||
case obliq:
|
||||
proj_parm.N1 = 1. / sqrt(1. - par.es * proj_parm.sinph0 * proj_parm.sinph0);
|
||||
proj_parm.G = proj_parm.sinph0 * (proj_parm.He = par.e / sqrt(par.one_es));
|
||||
proj_parm.He *= proj_parm.cosph0;
|
||||
break;
|
||||
}
|
||||
// Boost.Geometry specific, in proj4 geodesic is initialized at the beginning
|
||||
T const b = math::sqrt(math::sqr(par.a) * (1. - par.es));
|
||||
proj_parm.spheroid = srs::spheroid<T>(par.a, b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_aeqd_e
|
||||
: public base_t_fi<base_aeqd_e<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_aeqd<T> m_proj_parm;
|
||||
|
||||
inline base_aeqd_e(const Parameters& par)
|
||||
: base_t_fi<base_aeqd_e<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_forward) elliptical
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
e_forward(lp_lon, lp_lat, xy_x, xy_y, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
|
||||
// INVERSE(e_inverse) elliptical
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
e_inverse(xy_x, xy_y, lp_lon, lp_lat, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "aeqd_e";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_aeqd_e_guam
|
||||
: public base_t_fi<base_aeqd_e_guam<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_aeqd<T> m_proj_parm;
|
||||
|
||||
inline base_aeqd_e_guam(const Parameters& par)
|
||||
: base_t_fi<base_aeqd_e_guam<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_guam_fwd) Guam elliptical
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
e_guam_fwd(lp_lon, lp_lat, xy_x, xy_y, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
|
||||
// INVERSE(e_guam_inv) Guam elliptical
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
e_guam_inv(xy_x, xy_y, lp_lon, lp_lat, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "aeqd_e_guam";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename BGParameters, typename T, typename Parameters>
|
||||
struct base_aeqd_e_static
|
||||
: public base_t_fi<base_aeqd_e_static<BGParameters, T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_aeqd<T> m_proj_parm;
|
||||
|
||||
static const bool is_guam = ! boost::is_same
|
||||
<
|
||||
typename srs::spar::detail::tuples_find_if
|
||||
<
|
||||
BGParameters,
|
||||
//srs::par4::detail::is_guam
|
||||
srs::spar::detail::is_param<srs::spar::guam>::pred
|
||||
>::type,
|
||||
void
|
||||
>::value;
|
||||
|
||||
inline base_aeqd_e_static(const Parameters& par)
|
||||
: base_t_fi<base_aeqd_e_static<BGParameters, T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_forward or e_guam_fwd) elliptical
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
if (is_guam)
|
||||
e_guam_fwd(lp_lon, lp_lat, xy_x, xy_y, this->m_par, this->m_proj_parm);
|
||||
else
|
||||
e_forward(lp_lon, lp_lat, xy_x, xy_y, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
|
||||
// INVERSE(e_inverse or e_guam_inv) elliptical
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
if (is_guam)
|
||||
e_guam_inv(xy_x, xy_y, lp_lon, lp_lat, this->m_par, this->m_proj_parm);
|
||||
else
|
||||
e_inverse(xy_x, xy_y, lp_lon, lp_lat, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "aeqd_e_static";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_aeqd_s
|
||||
: public base_t_fi<base_aeqd_s<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_aeqd<T> m_proj_parm;
|
||||
|
||||
inline base_aeqd_s(const Parameters& par)
|
||||
: base_t_fi<base_aeqd_s<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spherical
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
s_forward(lp_lon, lp_lat, xy_x, xy_y, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spherical
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
s_inverse(xy_x, xy_y, lp_lon, lp_lat, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "aeqd_s";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}} // namespace detail::aeqd
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Azimuthal Equidistant projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Azimuthal
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Projection parameters
|
||||
- lat_0: Latitude of origin (degrees)
|
||||
- guam (boolean)
|
||||
\par Example
|
||||
\image html ex_aeqd.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct aeqd_e : public detail::aeqd::base_aeqd_e<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline aeqd_e(Params const& params, Parameters const& par)
|
||||
: detail::aeqd::base_aeqd_e<T, Parameters>(par)
|
||||
{
|
||||
detail::aeqd::setup_aeqd(params, this->m_par, this->m_proj_parm, false, false);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Azimuthal Equidistant projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Azimuthal
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Projection parameters
|
||||
- lat_0: Latitude of origin (degrees)
|
||||
- guam (boolean)
|
||||
\par Example
|
||||
\image html ex_aeqd.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct aeqd_e_guam : public detail::aeqd::base_aeqd_e_guam<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline aeqd_e_guam(Params const& params, Parameters const& par)
|
||||
: detail::aeqd::base_aeqd_e_guam<T, Parameters>(par)
|
||||
{
|
||||
detail::aeqd::setup_aeqd(params, this->m_par, this->m_proj_parm, false, true);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Azimuthal Equidistant projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Azimuthal
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Projection parameters
|
||||
- lat_0: Latitude of origin (degrees)
|
||||
- guam (boolean)
|
||||
\par Example
|
||||
\image html ex_aeqd.gif
|
||||
*/
|
||||
template <typename SParams, typename T, typename Parameters>
|
||||
struct aeqd_e_static : public detail::aeqd::base_aeqd_e_static<SParams, T, Parameters>
|
||||
{
|
||||
inline aeqd_e_static(SParams const& params, Parameters const& par)
|
||||
: detail::aeqd::base_aeqd_e_static<SParams, T, Parameters>(par)
|
||||
{
|
||||
detail::aeqd::setup_aeqd(params, this->m_par, this->m_proj_parm,
|
||||
false,
|
||||
detail::aeqd::base_aeqd_e_static<SParams, T, Parameters>::is_guam);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Azimuthal Equidistant projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Azimuthal
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Projection parameters
|
||||
- lat_0: Latitude of origin (degrees)
|
||||
- guam (boolean)
|
||||
\par Example
|
||||
\image html ex_aeqd.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct aeqd_s : public detail::aeqd::base_aeqd_s<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline aeqd_s(Params const& params, Parameters const& par)
|
||||
: detail::aeqd::base_aeqd_s<T, Parameters>(par)
|
||||
{
|
||||
detail::aeqd::setup_aeqd(params, this->m_par, this->m_proj_parm, true, false);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
template <typename BGP, typename CT, typename P>
|
||||
struct static_projection_type<srs::spar::proj_aeqd, srs_sphere_tag, BGP, CT, P>
|
||||
{
|
||||
typedef aeqd_s<CT, P> type;
|
||||
};
|
||||
template <typename BGP, typename CT, typename P>
|
||||
struct static_projection_type<srs::spar::proj_aeqd, srs_spheroid_tag, BGP, CT, P>
|
||||
{
|
||||
typedef aeqd_e_static<BGP, CT, P> type;
|
||||
};
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_BEGIN(aeqd_entry)
|
||||
{
|
||||
bool const guam = pj_get_param_b<srs::spar::guam>(params, "guam", srs::dpar::guam);
|
||||
|
||||
if (parameters.es && ! guam)
|
||||
return new base_v_fi<aeqd_e<T, Parameters>, T, Parameters>(params, parameters);
|
||||
else if (parameters.es && guam)
|
||||
return new base_v_fi<aeqd_e_guam<T, Parameters>, T, Parameters>(params, parameters);
|
||||
else
|
||||
return new base_v_fi<aeqd_s<T, Parameters>, T, Parameters>(params, parameters);
|
||||
}
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_END
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(aeqd_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(aeqd, aeqd_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_AEQD_HPP
|
||||
|
||||
242
linx64/include/boost/geometry/srs/projections/proj/airy.hpp
Normal file
242
linx64/include/boost/geometry/srs/projections/proj/airy.hpp
Normal file
@@ -0,0 +1,242 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Purpose: Implementation of the airy (Airy) projection.
|
||||
// Author: Gerald Evenden (1995)
|
||||
// Thomas Knudsen (2016) - revise/add regression tests
|
||||
// Copyright (c) 1995, Gerald Evenden
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_AIRY_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_AIRY_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace airy
|
||||
{
|
||||
|
||||
static const double epsilon = 1.e-10;
|
||||
enum mode_type {
|
||||
n_pole = 0,
|
||||
s_pole = 1,
|
||||
equit = 2,
|
||||
obliq = 3
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct par_airy
|
||||
{
|
||||
T p_halfpi;
|
||||
T sinph0;
|
||||
T cosph0;
|
||||
T Cb;
|
||||
mode_type mode;
|
||||
int no_cut; /* do not cut at hemisphere limit */
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_airy_spheroid
|
||||
: public base_t_f<base_airy_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_airy<T> m_proj_parm;
|
||||
|
||||
inline base_airy_spheroid(const Parameters& par)
|
||||
: base_t_f<base_airy_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T sinlam, coslam, cosphi, sinphi, t, s, Krho, cosz;
|
||||
|
||||
sinlam = sin(lp_lon);
|
||||
coslam = cos(lp_lon);
|
||||
switch (this->m_proj_parm.mode) {
|
||||
case equit:
|
||||
case obliq:
|
||||
sinphi = sin(lp_lat);
|
||||
cosphi = cos(lp_lat);
|
||||
cosz = cosphi * coslam;
|
||||
if (this->m_proj_parm.mode == obliq)
|
||||
cosz = this->m_proj_parm.sinph0 * sinphi + this->m_proj_parm.cosph0 * cosz;
|
||||
if (!this->m_proj_parm.no_cut && cosz < -epsilon) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
if (fabs(s = 1. - cosz) > epsilon) {
|
||||
t = 0.5 * (1. + cosz);
|
||||
Krho = -log(t)/s - this->m_proj_parm.Cb / t;
|
||||
} else
|
||||
Krho = 0.5 - this->m_proj_parm.Cb;
|
||||
xy_x = Krho * cosphi * sinlam;
|
||||
if (this->m_proj_parm.mode == obliq)
|
||||
xy_y = Krho * (this->m_proj_parm.cosph0 * sinphi -
|
||||
this->m_proj_parm.sinph0 * cosphi * coslam);
|
||||
else
|
||||
xy_y = Krho * sinphi;
|
||||
break;
|
||||
case s_pole:
|
||||
case n_pole:
|
||||
lp_lat = fabs(this->m_proj_parm.p_halfpi - lp_lat);
|
||||
if (!this->m_proj_parm.no_cut && (lp_lat - epsilon) > half_pi)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
if ((lp_lat *= 0.5) > epsilon) {
|
||||
t = tan(lp_lat);
|
||||
Krho = -2.*(log(cos(lp_lat)) / t + t * this->m_proj_parm.Cb);
|
||||
xy_x = Krho * sinlam;
|
||||
xy_y = Krho * coslam;
|
||||
if (this->m_proj_parm.mode == n_pole)
|
||||
xy_y = -xy_y;
|
||||
} else
|
||||
xy_x = xy_y = 0.;
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "airy_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Airy
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_airy(Params const& params, Parameters& par, par_airy<T>& proj_parm)
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T beta;
|
||||
|
||||
proj_parm.no_cut = pj_get_param_b<srs::spar::no_cut>(params, "no_cut", srs::dpar::no_cut);
|
||||
beta = 0.5 * (half_pi - pj_get_param_r<T, srs::spar::lat_b>(params, "lat_b", srs::dpar::lat_b));
|
||||
if (fabs(beta) < epsilon)
|
||||
proj_parm.Cb = -0.5;
|
||||
else {
|
||||
proj_parm.Cb = 1./tan(beta);
|
||||
proj_parm.Cb *= proj_parm.Cb * log(cos(beta));
|
||||
}
|
||||
|
||||
if (fabs(fabs(par.phi0) - half_pi) < epsilon)
|
||||
if (par.phi0 < 0.) {
|
||||
proj_parm.p_halfpi = -half_pi;
|
||||
proj_parm.mode = s_pole;
|
||||
} else {
|
||||
proj_parm.p_halfpi = half_pi;
|
||||
proj_parm.mode = n_pole;
|
||||
}
|
||||
else {
|
||||
if (fabs(par.phi0) < epsilon)
|
||||
proj_parm.mode = equit;
|
||||
else {
|
||||
proj_parm.mode = obliq;
|
||||
proj_parm.sinph0 = sin(par.phi0);
|
||||
proj_parm.cosph0 = cos(par.phi0);
|
||||
}
|
||||
}
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::airy
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Airy projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
- no inverse
|
||||
\par Projection parameters
|
||||
- no_cut: Do not cut at hemisphere limit (boolean)
|
||||
- lat_b (degrees)
|
||||
\par Example
|
||||
\image html ex_airy.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct airy_spheroid : public detail::airy::base_airy_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline airy_spheroid(Params const& params, Parameters const& par)
|
||||
: detail::airy::base_airy_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::airy::setup_airy(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_airy, airy_spheroid, airy_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(airy_entry, airy_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(airy_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(airy, airy_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_AIRY_HPP
|
||||
|
||||
314
linx64/include/boost/geometry/srs/projections/proj/aitoff.hpp
Normal file
314
linx64/include/boost/geometry/srs/projections/proj/aitoff.hpp
Normal file
@@ -0,0 +1,314 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Purpose: Implementation of the aitoff (Aitoff) and wintri (Winkel Tripel)
|
||||
// projections.
|
||||
// Author: Gerald Evenden (1995)
|
||||
// Drazen Tutic, Lovro Gradiser (2015) - add inverse
|
||||
// Thomas Knudsen (2016) - revise/add regression tests
|
||||
// Copyright (c) 1995, Gerald Evenden
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_AITOFF_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_AITOFF_HPP
|
||||
|
||||
#include <boost/core/ignore_unused.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace aitoff
|
||||
{
|
||||
enum mode_type {
|
||||
mode_aitoff = 0,
|
||||
mode_winkel_tripel = 1
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct par_aitoff
|
||||
{
|
||||
T cosphi1;
|
||||
mode_type mode;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_aitoff_spheroid
|
||||
: public base_t_fi<base_aitoff_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_aitoff<T> m_proj_parm;
|
||||
|
||||
inline base_aitoff_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_aitoff_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T c, d;
|
||||
|
||||
if((d = acos(cos(lp_lat) * cos(c = 0.5 * lp_lon)))) {/* basic Aitoff */
|
||||
xy_x = 2. * d * cos(lp_lat) * sin(c) * (xy_y = 1. / sin(d));
|
||||
xy_y *= d * sin(lp_lat);
|
||||
} else
|
||||
xy_x = xy_y = 0.;
|
||||
if (this->m_proj_parm.mode == mode_winkel_tripel) { /* Winkel Tripel */
|
||||
xy_x = (xy_x + lp_lon * this->m_proj_parm.cosphi1) * 0.5;
|
||||
xy_y = (xy_y + lp_lat) * 0.5;
|
||||
}
|
||||
}
|
||||
/***********************************************************************************
|
||||
*
|
||||
* Inverse functions added by Drazen Tutic and Lovro Gradiser based on paper:
|
||||
*
|
||||
* I.Özbug Biklirici and Cengizhan Ipbüker. A General Algorithm for the Inverse
|
||||
* Transformation of Map Projections Using Jacobian Matrices. In Proceedings of the
|
||||
* Third International Symposium Mathematical & Computational Applications,
|
||||
* pages 175{182, Turkey, September 2002.
|
||||
*
|
||||
* Expected accuracy is defined by epsilon = 1e-12. Should be appropriate for
|
||||
* most applications of Aitoff and Winkel Tripel projections.
|
||||
*
|
||||
* Longitudes of 180W and 180E can be mixed in solution obtained.
|
||||
*
|
||||
* Inverse for Aitoff projection in poles is undefined, longitude value of 0 is assumed.
|
||||
*
|
||||
* Contact : dtutic@geof.hr
|
||||
* Date: 2015-02-16
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
// INVERSE(s_inverse) sphere
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T pi = detail::pi<T>();
|
||||
static const T two_pi = detail::two_pi<T>();
|
||||
static const T epsilon = 1e-12;
|
||||
|
||||
int iter, max_iter = 10, round = 0, max_round = 20;
|
||||
T D, C, f1, f2, f1p, f1l, f2p, f2l, dp, dl, sl, sp, cp, cl, x, y;
|
||||
|
||||
if ((fabs(xy_x) < epsilon) && (fabs(xy_y) < epsilon )) {
|
||||
lp_lat = 0.; lp_lon = 0.;
|
||||
return;
|
||||
}
|
||||
|
||||
/* intial values for Newton-Raphson method */
|
||||
lp_lat = xy_y; lp_lon = xy_x;
|
||||
do {
|
||||
iter = 0;
|
||||
do {
|
||||
sl = sin(lp_lon * 0.5); cl = cos(lp_lon * 0.5);
|
||||
sp = sin(lp_lat); cp = cos(lp_lat);
|
||||
D = cp * cl;
|
||||
C = 1. - D * D;
|
||||
D = acos(D) / math::pow(C, T(1.5));
|
||||
f1 = 2. * D * C * cp * sl;
|
||||
f2 = D * C * sp;
|
||||
f1p = 2.* (sl * cl * sp * cp / C - D * sp * sl);
|
||||
f1l = cp * cp * sl * sl / C + D * cp * cl * sp * sp;
|
||||
f2p = sp * sp * cl / C + D * sl * sl * cp;
|
||||
f2l = 0.5 * (sp * cp * sl / C - D * sp * cp * cp * sl * cl);
|
||||
if (this->m_proj_parm.mode == mode_winkel_tripel) { /* Winkel Tripel */
|
||||
f1 = 0.5 * (f1 + lp_lon * this->m_proj_parm.cosphi1);
|
||||
f2 = 0.5 * (f2 + lp_lat);
|
||||
f1p *= 0.5;
|
||||
f1l = 0.5 * (f1l + this->m_proj_parm.cosphi1);
|
||||
f2p = 0.5 * (f2p + 1.);
|
||||
f2l *= 0.5;
|
||||
}
|
||||
f1 -= xy_x; f2 -= xy_y;
|
||||
dl = (f2 * f1p - f1 * f2p) / (dp = f1p * f2l - f2p * f1l);
|
||||
dp = (f1 * f2l - f2 * f1l) / dp;
|
||||
dl = fmod(dl, pi); /* set to interval [-M_PI, M_PI] */
|
||||
lp_lat -= dp; lp_lon -= dl;
|
||||
} while ((fabs(dp) > epsilon || fabs(dl) > epsilon) && (iter++ < max_iter));
|
||||
if (lp_lat > two_pi) lp_lat -= 2.*(lp_lat-two_pi); /* correct if symmetrical solution for Aitoff */
|
||||
if (lp_lat < -two_pi) lp_lat -= 2.*(lp_lat+two_pi); /* correct if symmetrical solution for Aitoff */
|
||||
if ((fabs(fabs(lp_lat) - two_pi) < epsilon) && (!this->m_proj_parm.mode)) lp_lon = 0.; /* if pole in Aitoff, return longitude of 0 */
|
||||
|
||||
/* calculate x,y coordinates with solution obtained */
|
||||
if((D = acos(cos(lp_lat) * cos(C = 0.5 * lp_lon))) != 0.0) {/* Aitoff */
|
||||
x = 2. * D * cos(lp_lat) * sin(C) * (y = 1. / sin(D));
|
||||
y *= D * sin(lp_lat);
|
||||
} else
|
||||
x = y = 0.;
|
||||
if (this->m_proj_parm.mode == mode_winkel_tripel) { /* Winkel Tripel */
|
||||
x = (x + lp_lon * this->m_proj_parm.cosphi1) * 0.5;
|
||||
y = (y + lp_lat) * 0.5;
|
||||
}
|
||||
/* if too far from given values of x,y, repeat with better approximation of phi,lam */
|
||||
} while (((fabs(xy_x-x) > epsilon) || (fabs(xy_y-y) > epsilon)) && (round++ < max_round));
|
||||
|
||||
if (iter == max_iter && round == max_round)
|
||||
{
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_non_convergent) );
|
||||
//fprintf(stderr, "Warning: Accuracy of 1e-12 not reached. Last increments: dlat=%e and dlon=%e\n", dp, dl);
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "aitoff_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template <typename Parameters>
|
||||
inline void setup(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
|
||||
// Aitoff
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_aitoff(Parameters& par, par_aitoff<T>& proj_parm)
|
||||
{
|
||||
proj_parm.mode = mode_aitoff;
|
||||
setup(par);
|
||||
}
|
||||
|
||||
// Winkel Tripel
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_wintri(Params& params, Parameters& par, par_aitoff<T>& proj_parm)
|
||||
{
|
||||
static const T two_div_pi = detail::two_div_pi<T>();
|
||||
|
||||
T phi1;
|
||||
|
||||
proj_parm.mode = mode_winkel_tripel;
|
||||
if (pj_param_r<srs::spar::lat_1>(params, "lat_1", srs::dpar::lat_1, phi1)) {
|
||||
if ((proj_parm.cosphi1 = cos(phi1)) == 0.)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_lat_larger_than_90) );
|
||||
} else /* 50d28' or phi1=acos(2/pi) */
|
||||
proj_parm.cosphi1 = two_div_pi;
|
||||
setup(par);
|
||||
}
|
||||
|
||||
}} // namespace detail::aitoff
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Aitoff projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_aitoff.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct aitoff_spheroid : public detail::aitoff::base_aitoff_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline aitoff_spheroid(Params const& , Parameters const& par)
|
||||
: detail::aitoff::base_aitoff_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::aitoff::setup_aitoff(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Winkel Tripel projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
\par Projection parameters
|
||||
- lat_1: Latitude of first standard parallel (degrees)
|
||||
\par Example
|
||||
\image html ex_wintri.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct wintri_spheroid : public detail::aitoff::base_aitoff_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline wintri_spheroid(Params const& params, Parameters const& par)
|
||||
: detail::aitoff::base_aitoff_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::aitoff::setup_wintri(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_aitoff, aitoff_spheroid, aitoff_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_wintri, wintri_spheroid, wintri_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(aitoff_entry, aitoff_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(wintri_entry, wintri_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(aitoff_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(aitoff, aitoff_entry)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(wintri, wintri_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_AITOFF_HPP
|
||||
|
||||
149
linx64/include/boost/geometry/srs/projections/proj/august.hpp
Normal file
149
linx64/include/boost/geometry/srs/projections/proj/august.hpp
Normal file
@@ -0,0 +1,149 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_AUGUST_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_AUGUST_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace august
|
||||
{
|
||||
|
||||
//static const double M = 1.333333333333333;
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_august_spheroid
|
||||
: public base_t_f<base_august_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_august_spheroid(const Parameters& par)
|
||||
: base_t_f<base_august_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T M = 1.333333333333333333333333333333333333;
|
||||
|
||||
T t, c1, c, x1, x12, y1, y12;
|
||||
|
||||
t = tan(.5 * lp_lat);
|
||||
c1 = sqrt(1. - t * t);
|
||||
c = 1. + c1 * cos(lp_lon *= .5);
|
||||
x1 = sin(lp_lon) * c1 / c;
|
||||
y1 = t / c;
|
||||
xy_x = M * x1 * (3. + (x12 = x1 * x1) - 3. * (y12 = y1 * y1));
|
||||
xy_y = M * y1 * (3. + 3. * x12 - y12);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "august_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// August Epicycloidal
|
||||
template <typename Parameters>
|
||||
inline void setup_august(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::august
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief August Epicycloidal projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
- no inverse
|
||||
\par Example
|
||||
\image html ex_august.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct august_spheroid : public detail::august::base_august_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline august_spheroid(Params const& , Parameters const& par)
|
||||
: detail::august::base_august_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::august::setup_august(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_august, august_spheroid, august_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(august_entry, august_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(august_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(august, august_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_AUGUST_HPP
|
||||
|
||||
238
linx64/include/boost/geometry/srs/projections/proj/bacon.hpp
Normal file
238
linx64/include/boost/geometry/srs/projections/proj/bacon.hpp
Normal file
@@ -0,0 +1,238 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_BACON_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_BACON_HPP
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace bacon
|
||||
{
|
||||
|
||||
//static const double half_pi_sqr = 2.46740110027233965467;
|
||||
static const double epsilon = 1e-10;
|
||||
|
||||
struct par_bacon
|
||||
{
|
||||
int bacn;
|
||||
int ortl;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_bacon_spheroid
|
||||
: public base_t_f<base_bacon_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_bacon m_proj_parm;
|
||||
|
||||
inline base_bacon_spheroid(const Parameters& par)
|
||||
: base_t_f<base_bacon_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
static const T half_pi_sqr = detail::half_pi_sqr<T>();
|
||||
|
||||
T ax, f;
|
||||
|
||||
xy_y = this->m_proj_parm.bacn ? half_pi * sin(lp_lat) : lp_lat;
|
||||
if ((ax = fabs(lp_lon)) >= epsilon) {
|
||||
if (this->m_proj_parm.ortl && ax >= half_pi)
|
||||
xy_x = sqrt(half_pi_sqr - lp_lat * lp_lat + epsilon) + ax - half_pi;
|
||||
else {
|
||||
f = 0.5 * (half_pi_sqr / ax + ax);
|
||||
xy_x = ax - f + sqrt(f * f - xy_y * xy_y);
|
||||
}
|
||||
if (lp_lon < 0.) xy_x = - xy_x;
|
||||
} else
|
||||
xy_x = 0.;
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "bacon_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Apian Globular I
|
||||
template <typename Parameters>
|
||||
inline void setup_apian(Parameters& par, par_bacon& proj_parm)
|
||||
{
|
||||
proj_parm.bacn = proj_parm.ortl = 0;
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
// Ortelius Oval
|
||||
template <typename Parameters>
|
||||
inline void setup_ortel(Parameters& par, par_bacon& proj_parm)
|
||||
{
|
||||
proj_parm.bacn = 0;
|
||||
proj_parm.ortl = 1;
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
// Bacon Globular
|
||||
template <typename Parameters>
|
||||
inline void setup_bacon(Parameters& par, par_bacon& proj_parm)
|
||||
{
|
||||
proj_parm.bacn = 1;
|
||||
proj_parm.ortl = 0;
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::bacon
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Apian Globular I projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
- no inverse
|
||||
\par Example
|
||||
\image html ex_apian.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct apian_spheroid : public detail::bacon::base_bacon_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline apian_spheroid(Params const& , Parameters const& par)
|
||||
: detail::bacon::base_bacon_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::bacon::setup_apian(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Ortelius Oval projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
- no inverse
|
||||
\par Example
|
||||
\image html ex_ortel.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct ortel_spheroid : public detail::bacon::base_bacon_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline ortel_spheroid(Params const& , Parameters const& par)
|
||||
: detail::bacon::base_bacon_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::bacon::setup_ortel(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Bacon Globular projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
- no inverse
|
||||
\par Example
|
||||
\image html ex_bacon.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct bacon_spheroid : public detail::bacon::base_bacon_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline bacon_spheroid(Params const& , Parameters const& par)
|
||||
: detail::bacon::base_bacon_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::bacon::setup_bacon(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_apian, apian_spheroid, apian_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_bacon, bacon_spheroid, bacon_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_ortel, ortel_spheroid, ortel_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(apian_entry, apian_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(ortel_entry, ortel_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(bacon_entry, bacon_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(bacon_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(apian, apian_entry)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(ortel, ortel_entry)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(bacon, bacon_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_BACON_HPP
|
||||
|
||||
284
linx64/include/boost/geometry/srs/projections/proj/bipc.hpp
Normal file
284
linx64/include/boost/geometry/srs/projections/proj/bipc.hpp
Normal file
@@ -0,0 +1,284 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_BIPC_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_BIPC_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
#include <boost/math/special_functions/hypot.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace bipc
|
||||
{
|
||||
|
||||
static const double epsilon = 1e-10;
|
||||
static const double epsilon10 = 1e-10;
|
||||
static const double one_plus_eps = 1.000000001;
|
||||
static const int n_iter = 10;
|
||||
static const double lamB = -.34894976726250681539;
|
||||
static const double n = .63055844881274687180;
|
||||
static const double F = 1.89724742567461030582;
|
||||
static const double Azab = .81650043674686363166;
|
||||
static const double Azba = 1.82261843856185925133;
|
||||
static const double const_T = 1.27246578267089012270;
|
||||
static const double rhoc = 1.20709121521568721927;
|
||||
static const double cAzc = .69691523038678375519;
|
||||
static const double sAzc = .71715351331143607555;
|
||||
static const double C45 = .70710678118654752469;
|
||||
static const double S45 = .70710678118654752410;
|
||||
static const double C20 = .93969262078590838411;
|
||||
static const double S20 = -.34202014332566873287;
|
||||
static const double R110 = 1.91986217719376253360;
|
||||
static const double R104 = 1.81514242207410275904;
|
||||
|
||||
struct par_bipc
|
||||
{
|
||||
int noskew;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_bipc_spheroid
|
||||
: public base_t_fi<base_bipc_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_bipc m_proj_parm;
|
||||
|
||||
inline base_bipc_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_bipc_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
static const T pi = detail::pi<T>();
|
||||
|
||||
T cphi, sphi, tphi, t, al, Az, z, Av, cdlam, sdlam, r;
|
||||
int tag;
|
||||
|
||||
cphi = cos(lp_lat);
|
||||
sphi = sin(lp_lat);
|
||||
cdlam = cos(sdlam = lamB - lp_lon);
|
||||
sdlam = sin(sdlam);
|
||||
if (fabs(fabs(lp_lat) - half_pi) < epsilon10) {
|
||||
Az = lp_lat < 0. ? pi : 0.;
|
||||
tphi = HUGE_VAL;
|
||||
} else {
|
||||
tphi = sphi / cphi;
|
||||
Az = atan2(sdlam , C45 * (tphi - cdlam));
|
||||
}
|
||||
if( (tag = (Az > Azba)) ) {
|
||||
cdlam = cos(sdlam = lp_lon + R110);
|
||||
sdlam = sin(sdlam);
|
||||
z = S20 * sphi + C20 * cphi * cdlam;
|
||||
if (fabs(z) > 1.) {
|
||||
if (fabs(z) > one_plus_eps)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
else
|
||||
z = z < 0. ? -1. : 1.;
|
||||
} else
|
||||
z = acos(z);
|
||||
if (tphi != HUGE_VAL)
|
||||
Az = atan2(sdlam, (C20 * tphi - S20 * cdlam));
|
||||
Av = Azab;
|
||||
xy_y = rhoc;
|
||||
} else {
|
||||
z = S45 * (sphi + cphi * cdlam);
|
||||
if (fabs(z) > 1.) {
|
||||
if (fabs(z) > one_plus_eps)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
else
|
||||
z = z < 0. ? -1. : 1.;
|
||||
} else
|
||||
z = acos(z);
|
||||
Av = Azba;
|
||||
xy_y = -rhoc;
|
||||
}
|
||||
if (z < 0.) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
r = F * (t = math::pow(tan(T(0.5) * z), n));
|
||||
if ((al = .5 * (R104 - z)) < 0.) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
al = (t + math::pow(al, n)) / const_T;
|
||||
if (fabs(al) > 1.) {
|
||||
if (fabs(al) > one_plus_eps)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
else
|
||||
al = al < 0. ? -1. : 1.;
|
||||
} else
|
||||
al = acos(al);
|
||||
if (fabs(t = n * (Av - Az)) < al)
|
||||
r /= cos(al + (tag ? t : -t));
|
||||
xy_x = r * sin(t);
|
||||
xy_y += (tag ? -r : r) * cos(t);
|
||||
if (this->m_proj_parm.noskew) {
|
||||
t = xy_x;
|
||||
xy_x = -xy_x * cAzc - xy_y * sAzc;
|
||||
xy_y = -xy_y * cAzc + t * sAzc;
|
||||
}
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
T t, r, rp, rl, al, z, fAz, Az, s, c, Av;
|
||||
int neg, i;
|
||||
|
||||
if (this->m_proj_parm.noskew) {
|
||||
t = xy_x;
|
||||
xy_x = -xy_x * cAzc + xy_y * sAzc;
|
||||
xy_y = -xy_y * cAzc - t * sAzc;
|
||||
}
|
||||
if( (neg = (xy_x < 0.)) ) {
|
||||
xy_y = rhoc - xy_y;
|
||||
s = S20;
|
||||
c = C20;
|
||||
Av = Azab;
|
||||
} else {
|
||||
xy_y += rhoc;
|
||||
s = S45;
|
||||
c = C45;
|
||||
Av = Azba;
|
||||
}
|
||||
rl = rp = r = boost::math::hypot(xy_x, xy_y);
|
||||
fAz = fabs(Az = atan2(xy_x, xy_y));
|
||||
for (i = n_iter; i ; --i) {
|
||||
z = 2. * atan(math::pow(r / F,T(1) / n));
|
||||
al = acos((math::pow(tan(T(0.5) * z), n) +
|
||||
math::pow(tan(T(0.5) * (R104 - z)), n)) / const_T);
|
||||
if (fAz < al)
|
||||
r = rp * cos(al + (neg ? Az : -Az));
|
||||
if (fabs(rl - r) < epsilon)
|
||||
break;
|
||||
rl = r;
|
||||
}
|
||||
if (! i)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
Az = Av - Az / n;
|
||||
lp_lat = asin(s * cos(z) + c * sin(z) * cos(Az));
|
||||
lp_lon = atan2(sin(Az), c / tan(z) - s * cos(Az));
|
||||
if (neg)
|
||||
lp_lon -= R110;
|
||||
else
|
||||
lp_lon = lamB - lp_lon;
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "bipc_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Bipolar conic of western hemisphere
|
||||
template <typename Params, typename Parameters>
|
||||
inline void setup_bipc(Params const& params, Parameters& par, par_bipc& proj_parm)
|
||||
{
|
||||
proj_parm.noskew = pj_get_param_b<srs::spar::ns>(params, "ns", srs::dpar::ns);
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::bipc
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Bipolar conic of western hemisphere projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Conic
|
||||
- Spheroid
|
||||
\par Projection parameters
|
||||
- ns (boolean)
|
||||
\par Example
|
||||
\image html ex_bipc.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct bipc_spheroid : public detail::bipc::base_bipc_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline bipc_spheroid(Params const& params, Parameters const& par)
|
||||
: detail::bipc::base_bipc_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::bipc::setup_bipc(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_bipc, bipc_spheroid, bipc_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(bipc_entry, bipc_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(bipc_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(bipc, bipc_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_BIPC_HPP
|
||||
|
||||
165
linx64/include/boost/geometry/srs/projections/proj/boggs.hpp
Normal file
165
linx64/include/boost/geometry/srs/projections/proj/boggs.hpp
Normal file
@@ -0,0 +1,165 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_BOGGS_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_BOGGS_HPP
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace boggs
|
||||
{
|
||||
|
||||
static const int n_iter = 20;
|
||||
static const double epsilon = 1e-7;
|
||||
static const double FXC = 2.00276;
|
||||
static const double FXC2 = 1.11072;
|
||||
static const double FYC = 0.49931;
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_boggs_spheroid
|
||||
: public base_t_f<base_boggs_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_boggs_spheroid(const Parameters& par)
|
||||
: base_t_f<base_boggs_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
static const T pi = detail::pi<T>();
|
||||
static const T root_two = boost::math::constants::root_two<T>();
|
||||
|
||||
T theta, th1, c;
|
||||
int i;
|
||||
|
||||
theta = lp_lat;
|
||||
if (fabs(fabs(lp_lat) - half_pi) < epsilon)
|
||||
xy_x = 0.;
|
||||
else {
|
||||
c = sin(theta) * pi;
|
||||
for (i = n_iter; i; --i) {
|
||||
theta -= th1 = (theta + sin(theta) - c) /
|
||||
(1. + cos(theta));
|
||||
if (fabs(th1) < epsilon) break;
|
||||
}
|
||||
theta *= 0.5;
|
||||
xy_x = FXC * lp_lon / (1. / cos(lp_lat) + FXC2 / cos(theta));
|
||||
}
|
||||
xy_y = FYC * (lp_lat + root_two * sin(theta));
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "boggs_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Boggs Eumorphic
|
||||
template <typename Parameters>
|
||||
inline void setup_boggs(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::boggs
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Boggs Eumorphic projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- no inverse
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_boggs.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct boggs_spheroid : public detail::boggs::base_boggs_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline boggs_spheroid(Params const& , Parameters const& par)
|
||||
: detail::boggs::base_boggs_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::boggs::setup_boggs(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_boggs, boggs_spheroid, boggs_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(boggs_entry, boggs_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(boggs_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(boggs, boggs_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_BOGGS_HPP
|
||||
|
||||
279
linx64/include/boost/geometry/srs/projections/proj/bonne.hpp
Normal file
279
linx64/include/boost/geometry/srs/projections/proj/bonne.hpp
Normal file
@@ -0,0 +1,279 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_BONNE_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_BONNE_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_mlfn.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
#include <boost/math/special_functions/hypot.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace bonne
|
||||
{
|
||||
|
||||
static const double epsilon10 = 1e-10;
|
||||
|
||||
template <typename T>
|
||||
struct par_bonne
|
||||
{
|
||||
T phi1;
|
||||
T cphi1;
|
||||
T am1;
|
||||
T m1;
|
||||
detail::en<T> en;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_bonne_ellipsoid
|
||||
: public base_t_fi<base_bonne_ellipsoid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_bonne<T> m_proj_parm;
|
||||
|
||||
inline base_bonne_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_bonne_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_forward) ellipsoid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T rh, E, c;
|
||||
|
||||
rh = this->m_proj_parm.am1 + this->m_proj_parm.m1 - pj_mlfn(lp_lat, E = sin(lp_lat), c = cos(lp_lat), this->m_proj_parm.en);
|
||||
E = c * lp_lon / (rh * sqrt(1. - this->m_par.es * E * E));
|
||||
xy_x = rh * sin(E);
|
||||
xy_y = this->m_proj_parm.am1 - rh * cos(E);
|
||||
}
|
||||
|
||||
// INVERSE(e_inverse) ellipsoid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T s, rh;
|
||||
|
||||
rh = boost::math::hypot(xy_x, xy_y = this->m_proj_parm.am1 - xy_y);
|
||||
lp_lat = pj_inv_mlfn(this->m_proj_parm.am1 + this->m_proj_parm.m1 - rh, this->m_par.es, this->m_proj_parm.en);
|
||||
if ((s = fabs(lp_lat)) < half_pi) {
|
||||
s = sin(lp_lat);
|
||||
lp_lon = rh * atan2(xy_x, xy_y) *
|
||||
sqrt(1. - this->m_par.es * s * s) / cos(lp_lat);
|
||||
} else if (fabs(s - half_pi) <= epsilon10)
|
||||
lp_lon = 0.;
|
||||
else
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "bonne_ellipsoid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_bonne_spheroid
|
||||
: public base_t_fi<base_bonne_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_bonne<T> m_proj_parm;
|
||||
|
||||
inline base_bonne_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_bonne_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T E, rh;
|
||||
|
||||
rh = this->m_proj_parm.cphi1 + this->m_proj_parm.phi1 - lp_lat;
|
||||
if (fabs(rh) > epsilon10) {
|
||||
xy_x = rh * sin(E = lp_lon * cos(lp_lat) / rh);
|
||||
xy_y = this->m_proj_parm.cphi1 - rh * cos(E);
|
||||
} else
|
||||
xy_x = xy_y = 0.;
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T rh;
|
||||
|
||||
rh = boost::math::hypot(xy_x, xy_y = this->m_proj_parm.cphi1 - xy_y);
|
||||
lp_lat = this->m_proj_parm.cphi1 + this->m_proj_parm.phi1 - rh;
|
||||
if (fabs(lp_lat) > half_pi) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
if (fabs(fabs(lp_lat) - half_pi) <= epsilon10)
|
||||
lp_lon = 0.;
|
||||
else
|
||||
lp_lon = rh * atan2(xy_x, xy_y) / cos(lp_lat);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "bonne_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Bonne (Werner lat_1=90)
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_bonne(Params const& params, Parameters& par, par_bonne<T>& proj_parm)
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T c;
|
||||
|
||||
proj_parm.phi1 = pj_get_param_r<T, srs::spar::lat_1>(params, "lat_1", srs::dpar::lat_1);
|
||||
if (fabs(proj_parm.phi1) < epsilon10)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_lat1_is_zero) );
|
||||
|
||||
if (par.es != 0.0) {
|
||||
proj_parm.en = pj_enfn<T>(par.es);
|
||||
proj_parm.m1 = pj_mlfn(proj_parm.phi1, proj_parm.am1 = sin(proj_parm.phi1),
|
||||
c = cos(proj_parm.phi1), proj_parm.en);
|
||||
proj_parm.am1 = c / (sqrt(1. - par.es * proj_parm.am1 * proj_parm.am1) * proj_parm.am1);
|
||||
} else {
|
||||
if (fabs(proj_parm.phi1) + epsilon10 >= half_pi)
|
||||
proj_parm.cphi1 = 0.;
|
||||
else
|
||||
proj_parm.cphi1 = 1. / tan(proj_parm.phi1);
|
||||
}
|
||||
}
|
||||
|
||||
}} // namespace detail::bonne
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Bonne (Werner lat_1=90) projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Conic
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Projection parameters
|
||||
- lat_1: Latitude of first standard parallel (degrees)
|
||||
\par Example
|
||||
\image html ex_bonne.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct bonne_ellipsoid : public detail::bonne::base_bonne_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline bonne_ellipsoid(Params const& params, Parameters const& par)
|
||||
: detail::bonne::base_bonne_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::bonne::setup_bonne(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Bonne (Werner lat_1=90) projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Conic
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Projection parameters
|
||||
- lat_1: Latitude of first standard parallel (degrees)
|
||||
\par Example
|
||||
\image html ex_bonne.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct bonne_spheroid : public detail::bonne::base_bonne_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline bonne_spheroid(Params const& params, Parameters const& par)
|
||||
: detail::bonne::base_bonne_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::bonne::setup_bonne(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_bonne, bonne_spheroid, bonne_ellipsoid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(bonne_entry, bonne_spheroid, bonne_ellipsoid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(bonne_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(bonne, bonne_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_BONNE_HPP
|
||||
|
||||
269
linx64/include/boost/geometry/srs/projections/proj/cass.hpp
Normal file
269
linx64/include/boost/geometry/srs/projections/proj/cass.hpp
Normal file
@@ -0,0 +1,269 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_CASS_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_CASS_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_mlfn.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace cass
|
||||
{
|
||||
|
||||
//static const double epsilon10 = 1e-10;
|
||||
//static const double C1 = .16666666666666666666;
|
||||
//static const double C2 = .00833333333333333333;
|
||||
//static const double C3 = .04166666666666666666;
|
||||
//static const double C4 = .33333333333333333333;
|
||||
//static const double C5 = .06666666666666666666;
|
||||
|
||||
template <typename T>
|
||||
inline T C1() { return .16666666666666666666666666666666666666; }
|
||||
template <typename T>
|
||||
inline T C2() { return .00833333333333333333333333333333333333; }
|
||||
template <typename T>
|
||||
inline T C3() { return .04166666666666666666666666666666666666; }
|
||||
template <typename T>
|
||||
inline T C4() { return .33333333333333333333333333333333333333; }
|
||||
template <typename T>
|
||||
inline T C5() { return .06666666666666666666666666666666666666; }
|
||||
|
||||
template <typename T>
|
||||
struct par_cass
|
||||
{
|
||||
T m0;
|
||||
detail::en<T> en;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_cass_ellipsoid
|
||||
: public base_t_fi<base_cass_ellipsoid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_cass<T> m_proj_parm;
|
||||
|
||||
inline base_cass_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_cass_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_forward) ellipsoid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T C1 = cass::C1<T>();
|
||||
static const T C2 = cass::C2<T>();
|
||||
static const T C3 = cass::C3<T>();
|
||||
|
||||
T n = sin(lp_lat);
|
||||
T c = cos(lp_lat);
|
||||
xy_y = pj_mlfn(lp_lat, n, c, this->m_proj_parm.en);
|
||||
n = 1./sqrt(1. - this->m_par.es * n * n);
|
||||
T tn = tan(lp_lat);
|
||||
T t = tn * tn;
|
||||
T a1 = lp_lon * c;
|
||||
c *= this->m_par.es * c / (1 - this->m_par.es);
|
||||
T a2 = a1 * a1;
|
||||
xy_x = n * a1 * (1. - a2 * t *
|
||||
(C1 - (8. - t + 8. * c) * a2 * C2));
|
||||
xy_y -= this->m_proj_parm.m0 - n * tn * a2 *
|
||||
(.5 + (5. - t + 6. * c) * a2 * C3);
|
||||
}
|
||||
|
||||
// INVERSE(e_inverse) ellipsoid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T C3 = cass::C3<T>();
|
||||
static const T C4 = cass::C4<T>();
|
||||
static const T C5 = cass::C5<T>();
|
||||
|
||||
T ph1;
|
||||
|
||||
ph1 = pj_inv_mlfn(this->m_proj_parm.m0 + xy_y, this->m_par.es, this->m_proj_parm.en);
|
||||
T tn = tan(ph1); T t = tn * tn;
|
||||
T n = sin(ph1);
|
||||
T r = 1. / (1. - this->m_par.es * n * n);
|
||||
n = sqrt(r);
|
||||
r *= (1. - this->m_par.es) * n;
|
||||
T dd = xy_x / n;
|
||||
T d2 = dd * dd;
|
||||
lp_lat = ph1 - (n * tn / r) * d2 *
|
||||
(.5 - (1. + 3. * t) * d2 * C3);
|
||||
lp_lon = dd * (1. + t * d2 *
|
||||
(-C4 + (1. + 3. * t) * d2 * C5)) / cos(ph1);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "cass_ellipsoid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_cass_spheroid
|
||||
: public base_t_fi<base_cass_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_cass<T> m_proj_parm;
|
||||
|
||||
inline base_cass_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_cass_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
xy_x = asin(cos(lp_lat) * sin(lp_lon));
|
||||
xy_y = atan2(tan(lp_lat) , cos(lp_lon)) - this->m_par.phi0;
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
T dd = xy_y + this->m_par.phi0;
|
||||
lp_lat = asin(sin(dd) * cos(xy_x));
|
||||
lp_lon = atan2(tan(xy_x), cos(dd));
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "cass_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Cassini
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_cass(Parameters& par, par_cass<T>& proj_parm)
|
||||
{
|
||||
if (par.es) {
|
||||
proj_parm.en = pj_enfn<T>(par.es);
|
||||
proj_parm.m0 = pj_mlfn(par.phi0, sin(par.phi0), cos(par.phi0), proj_parm.en);
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
}} // namespace detail::cass
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Cassini projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Example
|
||||
\image html ex_cass.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct cass_ellipsoid : public detail::cass::base_cass_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline cass_ellipsoid(Params const& , Parameters const& par)
|
||||
: detail::cass::base_cass_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::cass::setup_cass(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Cassini projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Example
|
||||
\image html ex_cass.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct cass_spheroid : public detail::cass::base_cass_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline cass_spheroid(Params const& , Parameters const& par)
|
||||
: detail::cass::base_cass_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::cass::setup_cass(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_cass, cass_spheroid, cass_ellipsoid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(cass_entry, cass_spheroid, cass_ellipsoid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(cass_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(cass, cass_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_CASS_HPP
|
||||
|
||||
154
linx64/include/boost/geometry/srs/projections/proj/cc.hpp
Normal file
154
linx64/include/boost/geometry/srs/projections/proj/cc.hpp
Normal file
@@ -0,0 +1,154 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_CC_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_CC_HPP
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace cc
|
||||
{
|
||||
|
||||
static const double epsilon10 = 1.e-10;
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_cc_spheroid
|
||||
: public base_t_fi<base_cc_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_cc_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_cc_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
if (fabs(fabs(lp_lat) - half_pi) <= epsilon10) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
xy_x = lp_lon;
|
||||
xy_y = tan(lp_lat);
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
lp_lat = atan(xy_y);
|
||||
lp_lon = xy_x;
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "cc_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Central Cylindrical
|
||||
template <typename Parameters>
|
||||
inline void setup_cc(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::cc
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Central Cylindrical projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_cc.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct cc_spheroid : public detail::cc::base_cc_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline cc_spheroid(Params const& , Parameters const& par)
|
||||
: detail::cc::base_cc_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::cc::setup_cc(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_cc, cc_spheroid, cc_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(cc_entry, cc_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(cc_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(cc, cc_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_CC_HPP
|
||||
|
||||
249
linx64/include/boost/geometry/srs/projections/proj/cea.hpp
Normal file
249
linx64/include/boost/geometry/srs/projections/proj/cea.hpp
Normal file
@@ -0,0 +1,249 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_CEA_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_CEA_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_auth.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_qsfn.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace cea
|
||||
{
|
||||
|
||||
static const double epsilon = 1e-10;
|
||||
|
||||
template <typename T>
|
||||
struct par_cea
|
||||
{
|
||||
T qp;
|
||||
detail::apa<T> apa;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_cea_ellipsoid
|
||||
: public base_t_fi<base_cea_ellipsoid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_cea<T> m_proj_parm;
|
||||
|
||||
inline base_cea_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_cea_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
xy_x = this->m_par.k0 * lp_lon;
|
||||
xy_y = .5 * pj_qsfn(sin(lp_lat), this->m_par.e, this->m_par.one_es) / this->m_par.k0;
|
||||
}
|
||||
|
||||
// INVERSE(e_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
lp_lat = pj_authlat(asin( 2. * xy_y * this->m_par.k0 / this->m_proj_parm.qp), this->m_proj_parm.apa);
|
||||
lp_lon = xy_x / this->m_par.k0;
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "cea_ellipsoid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_cea_spheroid
|
||||
: public base_t_fi<base_cea_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_cea<T> m_proj_parm;
|
||||
|
||||
inline base_cea_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_cea_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
xy_x = this->m_par.k0 * lp_lon;
|
||||
xy_y = sin(lp_lat) / this->m_par.k0;
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T t;
|
||||
|
||||
if ((t = fabs(xy_y *= this->m_par.k0)) - epsilon <= 1.) {
|
||||
if (t >= 1.)
|
||||
lp_lat = xy_y < 0. ? -half_pi : half_pi;
|
||||
else
|
||||
lp_lat = asin(xy_y);
|
||||
lp_lon = xy_x / this->m_par.k0;
|
||||
} else
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "cea_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Equal Area Cylindrical
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_cea(Params const& params, Parameters& par, par_cea<T>& proj_parm)
|
||||
{
|
||||
T t = 0;
|
||||
|
||||
if (pj_param_r<srs::spar::lat_ts>(params, "lat_ts", srs::dpar::lat_ts, t)) {
|
||||
par.k0 = cos(t);
|
||||
if (par.k0 < 0.) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_lat_ts_larger_than_90) );
|
||||
}
|
||||
}
|
||||
if (par.es != 0.0) {
|
||||
t = sin(t);
|
||||
par.k0 /= sqrt(1. - par.es * t * t);
|
||||
par.e = sqrt(par.es);
|
||||
proj_parm.apa = pj_authset<T>(par.es);
|
||||
|
||||
proj_parm.qp = pj_qsfn(1., par.e, par.one_es);
|
||||
}
|
||||
}
|
||||
|
||||
}} // namespace detail::cea
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Equal Area Cylindrical projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Projection parameters
|
||||
- lat_ts: Latitude of true scale (degrees)
|
||||
\par Example
|
||||
\image html ex_cea.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct cea_ellipsoid : public detail::cea::base_cea_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline cea_ellipsoid(Params const& params, Parameters const& par)
|
||||
: detail::cea::base_cea_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::cea::setup_cea(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Equal Area Cylindrical projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Projection parameters
|
||||
- lat_ts: Latitude of true scale (degrees)
|
||||
\par Example
|
||||
\image html ex_cea.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct cea_spheroid : public detail::cea::base_cea_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline cea_spheroid(Params const& params, Parameters const& par)
|
||||
: detail::cea::base_cea_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::cea::setup_cea(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_cea, cea_spheroid, cea_ellipsoid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(cea_entry, cea_spheroid, cea_ellipsoid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(cea_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(cea, cea_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_CEA_HPP
|
||||
|
||||
296
linx64/include/boost/geometry/srs/projections/proj/chamb.hpp
Normal file
296
linx64/include/boost/geometry/srs/projections/proj/chamb.hpp
Normal file
@@ -0,0 +1,296 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_CHAMB_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_CHAMB_HPP
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/aasincos.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace chamb
|
||||
{
|
||||
|
||||
//static const double third = 0.333333333333333333;
|
||||
static const double tolerance = 1e-9;
|
||||
|
||||
// specific for 'chamb'
|
||||
template <typename T>
|
||||
struct vect_ra { T r, Az; };
|
||||
template <typename T>
|
||||
struct point_xy { T x, y; };
|
||||
|
||||
template <typename T>
|
||||
struct par_chamb
|
||||
{
|
||||
struct { /* control point data */
|
||||
T phi, lam;
|
||||
T cosphi, sinphi;
|
||||
vect_ra<T> v;
|
||||
point_xy<T> p;
|
||||
T Az;
|
||||
} c[3];
|
||||
point_xy<T> p;
|
||||
T beta_0, beta_1, beta_2;
|
||||
};
|
||||
|
||||
/* distance and azimuth from point 1 to point 2 */
|
||||
template <typename T>
|
||||
inline vect_ra<T> vect(T const& dphi, T const& c1, T const& s1, T const& c2, T const& s2, T const& dlam)
|
||||
{
|
||||
vect_ra<T> v;
|
||||
T cdl, dp, dl;
|
||||
|
||||
cdl = cos(dlam);
|
||||
if (fabs(dphi) > 1. || fabs(dlam) > 1.)
|
||||
v.r = aacos(s1 * s2 + c1 * c2 * cdl);
|
||||
else { /* more accurate for smaller distances */
|
||||
dp = sin(.5 * dphi);
|
||||
dl = sin(.5 * dlam);
|
||||
v.r = 2. * aasin(sqrt(dp * dp + c1 * c2 * dl * dl));
|
||||
}
|
||||
if (fabs(v.r) > tolerance)
|
||||
v.Az = atan2(c2 * sin(dlam), c1 * s2 - s1 * c2 * cdl);
|
||||
else
|
||||
v.r = v.Az = 0.;
|
||||
return v;
|
||||
}
|
||||
|
||||
/* law of cosines */
|
||||
template <typename T>
|
||||
inline T lc(T const& b, T const& c, T const& a)
|
||||
{
|
||||
return aacos(.5 * (b * b + c * c - a * a) / (b * c));
|
||||
}
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_chamb_spheroid
|
||||
: public base_t_f<base_chamb_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_chamb<T> m_proj_parm;
|
||||
|
||||
inline base_chamb_spheroid(const Parameters& par)
|
||||
: base_t_f<base_chamb_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T third = detail::third<T>();
|
||||
|
||||
T sinphi, cosphi, a;
|
||||
vect_ra<T> v[3];
|
||||
int i, j;
|
||||
|
||||
sinphi = sin(lp_lat);
|
||||
cosphi = cos(lp_lat);
|
||||
for (i = 0; i < 3; ++i) { /* dist/azimiths from control */
|
||||
v[i] = vect(lp_lat - this->m_proj_parm.c[i].phi, this->m_proj_parm.c[i].cosphi, this->m_proj_parm.c[i].sinphi,
|
||||
cosphi, sinphi, lp_lon - this->m_proj_parm.c[i].lam);
|
||||
if (v[i].r == 0.0)
|
||||
break;
|
||||
v[i].Az = adjlon(v[i].Az - this->m_proj_parm.c[i].v.Az);
|
||||
}
|
||||
if (i < 3) /* current point at control point */
|
||||
{ xy_x = this->m_proj_parm.c[i].p.x; xy_y = this->m_proj_parm.c[i].p.y; }
|
||||
else { /* point mean of intersepts */
|
||||
{ xy_x = this->m_proj_parm.p.x; xy_y = this->m_proj_parm.p.y; }
|
||||
for (i = 0; i < 3; ++i) {
|
||||
j = i == 2 ? 0 : i + 1;
|
||||
a = lc(this->m_proj_parm.c[i].v.r, v[i].r, v[j].r);
|
||||
if (v[i].Az < 0.)
|
||||
a = -a;
|
||||
if (! i) { /* coord comp unique to each arc */
|
||||
xy_x += v[i].r * cos(a);
|
||||
xy_y -= v[i].r * sin(a);
|
||||
} else if (i == 1) {
|
||||
a = this->m_proj_parm.beta_1 - a;
|
||||
xy_x -= v[i].r * cos(a);
|
||||
xy_y -= v[i].r * sin(a);
|
||||
} else {
|
||||
a = this->m_proj_parm.beta_2 - a;
|
||||
xy_x += v[i].r * cos(a);
|
||||
xy_y += v[i].r * sin(a);
|
||||
}
|
||||
}
|
||||
xy_x *= third; /* mean of arc intercepts */
|
||||
xy_y *= third;
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "chamb_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
inline T chamb_init_lat(srs::detail::proj4_parameters const& params, int i)
|
||||
{
|
||||
static const std::string lat[3] = {"lat_1", "lat_2", "lat_3"};
|
||||
return _pj_get_param_r<T>(params, lat[i]);
|
||||
}
|
||||
template <typename T>
|
||||
inline T chamb_init_lat(srs::dpar::parameters<T> const& params, int i)
|
||||
{
|
||||
static const srs::dpar::name_r lat[3] = {srs::dpar::lat_1, srs::dpar::lat_2, srs::dpar::lat_3};
|
||||
return _pj_get_param_r<T>(params, lat[i]);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T chamb_init_lon(srs::detail::proj4_parameters const& params, int i)
|
||||
{
|
||||
static const std::string lon[3] = {"lon_1", "lon_2", "lon_3"};
|
||||
return _pj_get_param_r<T>(params, lon[i]);
|
||||
}
|
||||
template <typename T>
|
||||
inline T chamb_init_lon(srs::dpar::parameters<T> const& params, int i)
|
||||
{
|
||||
static const srs::dpar::name_r lon[3] = {srs::dpar::lon_1, srs::dpar::lon_2, srs::dpar::lon_3};
|
||||
return _pj_get_param_r<T>(params, lon[i]);
|
||||
}
|
||||
|
||||
// Chamberlin Trimetric
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_chamb(Params const& params, Parameters& par, par_chamb<T>& proj_parm)
|
||||
{
|
||||
static const T pi = detail::pi<T>();
|
||||
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < 3; ++i) { /* get control point locations */
|
||||
proj_parm.c[i].phi = chamb_init_lat<T>(params, i);
|
||||
proj_parm.c[i].lam = chamb_init_lon<T>(params, i);
|
||||
proj_parm.c[i].lam = adjlon(proj_parm.c[i].lam - par.lam0);
|
||||
proj_parm.c[i].cosphi = cos(proj_parm.c[i].phi);
|
||||
proj_parm.c[i].sinphi = sin(proj_parm.c[i].phi);
|
||||
}
|
||||
for (i = 0; i < 3; ++i) { /* inter ctl pt. distances and azimuths */
|
||||
j = i == 2 ? 0 : i + 1;
|
||||
proj_parm.c[i].v = vect(proj_parm.c[j].phi - proj_parm.c[i].phi, proj_parm.c[i].cosphi, proj_parm.c[i].sinphi,
|
||||
proj_parm.c[j].cosphi, proj_parm.c[j].sinphi, proj_parm.c[j].lam - proj_parm.c[i].lam);
|
||||
if (proj_parm.c[i].v.r == 0.0)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_control_point_no_dist) );
|
||||
/* co-linearity problem ignored for now */
|
||||
}
|
||||
proj_parm.beta_0 = lc(proj_parm.c[0].v.r, proj_parm.c[2].v.r, proj_parm.c[1].v.r);
|
||||
proj_parm.beta_1 = lc(proj_parm.c[0].v.r, proj_parm.c[1].v.r, proj_parm.c[2].v.r);
|
||||
proj_parm.beta_2 = pi - proj_parm.beta_0;
|
||||
proj_parm.p.y = 2. * (proj_parm.c[0].p.y = proj_parm.c[1].p.y = proj_parm.c[2].v.r * sin(proj_parm.beta_0));
|
||||
proj_parm.c[2].p.y = 0.;
|
||||
proj_parm.c[0].p.x = - (proj_parm.c[1].p.x = 0.5 * proj_parm.c[0].v.r);
|
||||
proj_parm.p.x = proj_parm.c[2].p.x = proj_parm.c[0].p.x + proj_parm.c[2].v.r * cos(proj_parm.beta_0);
|
||||
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::chamb
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Chamberlin Trimetric projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
- no inverse
|
||||
\par Projection parameters
|
||||
- lat_1: Latitude of control point 1 (degrees)
|
||||
- lon_1: Longitude of control point 1 (degrees)
|
||||
- lat_2: Latitude of control point 2 (degrees)
|
||||
- lon_2: Longitude of control point 2 (degrees)
|
||||
- lat_3: Latitude of control point 3 (degrees)
|
||||
- lon_3: Longitude of control point 3 (degrees)
|
||||
\par Example
|
||||
\image html ex_chamb.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct chamb_spheroid : public detail::chamb::base_chamb_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline chamb_spheroid(Params const& params, Parameters const& par)
|
||||
: detail::chamb::base_chamb_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::chamb::setup_chamb(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_chamb, chamb_spheroid, chamb_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(chamb_entry, chamb_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(chamb_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(chamb, chamb_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_CHAMB_HPP
|
||||
|
||||
168
linx64/include/boost/geometry/srs/projections/proj/collg.hpp
Normal file
168
linx64/include/boost/geometry/srs/projections/proj/collg.hpp
Normal file
@@ -0,0 +1,168 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_COLLG_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_COLLG_HPP
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace collg
|
||||
{
|
||||
|
||||
static const double FXC = 1.12837916709551257390;
|
||||
static const double FYC = 1.77245385090551602729;
|
||||
static const double one_plus_eps = 1.0000001;
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_collg_spheroid
|
||||
: public base_t_fi<base_collg_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_collg_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_collg_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
if ((xy_y = 1. - sin(lp_lat)) <= 0.)
|
||||
xy_y = 0.;
|
||||
else
|
||||
xy_y = sqrt(xy_y);
|
||||
xy_x = FXC * lp_lon * xy_y;
|
||||
xy_y = FYC * (1. - xy_y);
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static T const half_pi = detail::half_pi<T>();
|
||||
|
||||
lp_lat = xy_y / FYC - 1.;
|
||||
if (fabs(lp_lat = 1. - lp_lat * lp_lat) < 1.)
|
||||
lp_lat = asin(lp_lat);
|
||||
else if (fabs(lp_lat) > one_plus_eps) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
} else {
|
||||
lp_lat = lp_lat < 0. ? -half_pi : half_pi;
|
||||
}
|
||||
|
||||
if ((lp_lon = 1. - sin(lp_lat)) <= 0.)
|
||||
lp_lon = 0.;
|
||||
else
|
||||
lp_lon = xy_x / (FXC * sqrt(lp_lon));
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "collg_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Collignon
|
||||
template <typename Parameters>
|
||||
inline void setup_collg(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace collg
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Collignon projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_collg.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct collg_spheroid : public detail::collg::base_collg_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline collg_spheroid(Params const& , Parameters const& par)
|
||||
: detail::collg::base_collg_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::collg::setup_collg(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_collg, collg_spheroid, collg_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(collg_entry, collg_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(collg_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(collg, collg_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_COLLG_HPP
|
||||
|
||||
156
linx64/include/boost/geometry/srs/projections/proj/crast.hpp
Normal file
156
linx64/include/boost/geometry/srs/projections/proj/crast.hpp
Normal file
@@ -0,0 +1,156 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_CRAST_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_CRAST_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace crast
|
||||
{
|
||||
|
||||
static const double XM = 0.97720502380583984317;
|
||||
static const double RXM = 1.02332670794648848847;
|
||||
static const double YM = 3.06998012383946546542;
|
||||
static const double RYM = 0.32573500793527994772;
|
||||
//static const double third = 0.333333333333333333;
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_crast_spheroid
|
||||
: public base_t_fi<base_crast_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_crast_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_crast_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T third = detail::third<T>();
|
||||
|
||||
lp_lat *= third;
|
||||
xy_x = XM * lp_lon * (2. * cos(lp_lat + lp_lat) - 1.);
|
||||
xy_y = YM * sin(lp_lat);
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T third = detail::third<T>();
|
||||
|
||||
lp_lat = 3. * asin(xy_y * RYM);
|
||||
lp_lon = xy_x * RXM / (2. * cos((lp_lat + lp_lat) * third) - 1);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "crast_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Craster Parabolic (Putnins P4)
|
||||
template <typename Parameters>
|
||||
inline void setup_crast(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::crast
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Craster Parabolic (Putnins P4) projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_crast.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct crast_spheroid : public detail::crast::base_crast_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline crast_spheroid(Params const& , Parameters const& par)
|
||||
: detail::crast::base_crast_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::crast::setup_crast(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_crast, crast_spheroid, crast_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(crast_entry, crast_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(crast_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(crast, crast_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_CRAST_HPP
|
||||
|
||||
155
linx64/include/boost/geometry/srs/projections/proj/denoy.hpp
Normal file
155
linx64/include/boost/geometry/srs/projections/proj/denoy.hpp
Normal file
@@ -0,0 +1,155 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_DENOY_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_DENOY_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace denoy
|
||||
{
|
||||
|
||||
static const double C0 = 0.95;
|
||||
//static const double C1 = -0.08333333333333333333;
|
||||
//static const double C3 = 0.00166666666666666666;
|
||||
static const double D1 = 0.9;
|
||||
static const double D5 = 0.03;
|
||||
|
||||
template <typename T>
|
||||
inline T C1() { return -0.0833333333333333333333333333333; }
|
||||
template <typename T>
|
||||
inline T C3() { return 0.0016666666666666666666666666666; }
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_denoy_spheroid
|
||||
: public base_t_f<base_denoy_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_denoy_spheroid(const Parameters& par)
|
||||
: base_t_f<base_denoy_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T C1 = denoy::C1<T>();
|
||||
static const T C3 = denoy::C3<T>();
|
||||
|
||||
xy_y = lp_lat;
|
||||
xy_x = lp_lon;
|
||||
lp_lon = fabs(lp_lon);
|
||||
xy_x *= cos((C0 + lp_lon * (C1 + lp_lon * lp_lon * C3)) *
|
||||
(lp_lat * (D1 + D5 * lp_lat * lp_lat * lp_lat * lp_lat)));
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "denoy_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Denoyer Semi-Elliptical
|
||||
template <typename Parameters>
|
||||
inline void setup_denoy(Parameters& par)
|
||||
{
|
||||
par.es = 0.0;
|
||||
}
|
||||
|
||||
}} // namespace detail::denoy
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Denoyer Semi-Elliptical projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- no inverse
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_denoy.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct denoy_spheroid : public detail::denoy::base_denoy_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline denoy_spheroid(Params const& , Parameters const& par)
|
||||
: detail::denoy::base_denoy_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::denoy::setup_denoy(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_denoy, denoy_spheroid, denoy_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(denoy_entry, denoy_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(denoy_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(denoy, denoy_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_DENOY_HPP
|
||||
|
||||
148
linx64/include/boost/geometry/srs/projections/proj/eck1.hpp
Normal file
148
linx64/include/boost/geometry/srs/projections/proj/eck1.hpp
Normal file
@@ -0,0 +1,148 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_ECK1_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_ECK1_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace eck1
|
||||
{
|
||||
|
||||
static const double FC = .92131773192356127802;
|
||||
static const double RP = .31830988618379067154;
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_eck1_spheroid
|
||||
: public base_t_fi<base_eck1_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_eck1_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_eck1_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
xy_x = FC * lp_lon * (1. - RP * fabs(lp_lat));
|
||||
xy_y = FC * lp_lat;
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
lp_lat = xy_y / FC;
|
||||
lp_lon = xy_x / (FC * (1. - RP * fabs(lp_lat)));
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "eck1_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Eckert I
|
||||
template <typename Parameters>
|
||||
inline void setup_eck1(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::eck1
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Eckert I projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_eck1.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct eck1_spheroid : public detail::eck1::base_eck1_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline eck1_spheroid(Params const& , Parameters const& par)
|
||||
: detail::eck1::base_eck1_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::eck1::setup_eck1(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_eck1, eck1_spheroid, eck1_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(eck1_entry, eck1_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(eck1_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(eck1, eck1_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_ECK1_HPP
|
||||
|
||||
165
linx64/include/boost/geometry/srs/projections/proj/eck2.hpp
Normal file
165
linx64/include/boost/geometry/srs/projections/proj/eck2.hpp
Normal file
@@ -0,0 +1,165 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_ECK2_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_ECK2_HPP
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace eck2
|
||||
{
|
||||
|
||||
static const double FXC = 0.46065886596178063902;
|
||||
static const double FYC = 1.44720250911653531871;
|
||||
//static const double C13 = 0.33333333333333333333;
|
||||
static const double one_plus_eps = 1.0000001;
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_eck2_spheroid
|
||||
: public base_t_fi<base_eck2_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_eck2_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_eck2_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
xy_x = FXC * lp_lon * (xy_y = sqrt(4. - 3. * sin(fabs(lp_lat))));
|
||||
xy_y = FYC * (2. - xy_y);
|
||||
if ( lp_lat < 0.) xy_y = -xy_y;
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
static const T C13 = detail::third<T>();
|
||||
|
||||
lp_lon = xy_x / (FXC * ( lp_lat = 2. - fabs(xy_y) / FYC) );
|
||||
lp_lat = (4. - lp_lat * lp_lat) * C13;
|
||||
if (fabs(lp_lat) >= 1.) {
|
||||
if (fabs(lp_lat) > one_plus_eps)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
else
|
||||
lp_lat = lp_lat < 0. ? -half_pi : half_pi;
|
||||
} else
|
||||
lp_lat = asin(lp_lat);
|
||||
if (xy_y < 0)
|
||||
lp_lat = -lp_lat;
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "eck2_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Eckert II
|
||||
template <typename Parameters>
|
||||
inline void setup_eck2(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::eck2
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Eckert II projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_eck2.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct eck2_spheroid : public detail::eck2::base_eck2_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline eck2_spheroid(Params const& , Parameters const& par)
|
||||
: detail::eck2::base_eck2_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::eck2::setup_eck2(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_eck2, eck2_spheroid, eck2_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(eck2_entry, eck2_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(eck2_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(eck2, eck2_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_ECK2_HPP
|
||||
|
||||
290
linx64/include/boost/geometry/srs/projections/proj/eck3.hpp
Normal file
290
linx64/include/boost/geometry/srs/projections/proj/eck3.hpp
Normal file
@@ -0,0 +1,290 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_ECK3_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_ECK3_HPP
|
||||
|
||||
#include <boost/core/ignore_unused.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/aasincos.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace eck3
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct par_eck3
|
||||
{
|
||||
T C_x, C_y, A, B;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_eck3_spheroid
|
||||
: public base_t_fi<base_eck3_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_eck3<T> m_proj_parm;
|
||||
|
||||
inline base_eck3_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_eck3_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
xy_y = this->m_proj_parm.C_y * lp_lat;
|
||||
xy_x = this->m_proj_parm.C_x * lp_lon * (this->m_proj_parm.A + asqrt(1. - this->m_proj_parm.B * lp_lat * lp_lat));
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
T denominator;
|
||||
lp_lat = xy_y / this->m_proj_parm.C_y;
|
||||
denominator = (this->m_proj_parm.C_x * (this->m_proj_parm.A + asqrt(1. - this->m_proj_parm.B * lp_lat * lp_lat)));
|
||||
if ( denominator == 0.0) {
|
||||
lp_lon = HUGE_VAL;
|
||||
lp_lat = HUGE_VAL;
|
||||
} else
|
||||
lp_lon = xy_x / denominator;
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "eck3_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template <typename Parameters>
|
||||
inline void setup(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
|
||||
// Eckert III
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_eck3(Parameters& par, par_eck3<T>& proj_parm)
|
||||
{
|
||||
proj_parm.C_x = 0.42223820031577120149;
|
||||
proj_parm.C_y = 0.84447640063154240298;
|
||||
proj_parm.A = 1.0;
|
||||
proj_parm.B = 0.4052847345693510857755;
|
||||
|
||||
setup(par);
|
||||
}
|
||||
|
||||
// Putnins P1
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_putp1(Parameters& par, par_eck3<T>& proj_parm)
|
||||
{
|
||||
proj_parm.C_x = 1.89490;
|
||||
proj_parm.C_y = 0.94745;
|
||||
proj_parm.A = -0.5;
|
||||
proj_parm.B = 0.30396355092701331433;
|
||||
|
||||
setup(par);
|
||||
}
|
||||
|
||||
// Wagner VI
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_wag6(Parameters& par, par_eck3<T>& proj_parm)
|
||||
{
|
||||
proj_parm.C_x = proj_parm.C_y = 0.94745;
|
||||
proj_parm.A = 0.0;
|
||||
proj_parm.B = 0.30396355092701331433;
|
||||
|
||||
setup(par);
|
||||
}
|
||||
|
||||
// Kavraisky VII
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_kav7(Parameters& par, par_eck3<T>& proj_parm)
|
||||
{
|
||||
/* Defined twice in original code - Using 0.866...,
|
||||
* but leaving the other one here as a safety measure.
|
||||
* proj_parm.C_x = 0.2632401569273184856851; */
|
||||
proj_parm.C_x = 0.8660254037844;
|
||||
proj_parm.C_y = 1.0;
|
||||
proj_parm.A = 0.0;
|
||||
proj_parm.B = 0.30396355092701331433;
|
||||
|
||||
setup(par);
|
||||
}
|
||||
|
||||
}} // namespace detail::eck3
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Eckert III projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_eck3.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct eck3_spheroid : public detail::eck3::base_eck3_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline eck3_spheroid(Params const& , Parameters const& par)
|
||||
: detail::eck3::base_eck3_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::eck3::setup_eck3(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Putnins P1 projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_putp1.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct putp1_spheroid : public detail::eck3::base_eck3_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline putp1_spheroid(Params const& , Parameters const& par)
|
||||
: detail::eck3::base_eck3_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::eck3::setup_putp1(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Wagner VI projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_wag6.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct wag6_spheroid : public detail::eck3::base_eck3_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline wag6_spheroid(Params const& , Parameters const& par)
|
||||
: detail::eck3::base_eck3_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::eck3::setup_wag6(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Kavraisky VII projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_kav7.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct kav7_spheroid : public detail::eck3::base_eck3_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline kav7_spheroid(Params const& , Parameters const& par)
|
||||
: detail::eck3::base_eck3_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::eck3::setup_kav7(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_eck3, eck3_spheroid, eck3_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_putp1, putp1_spheroid, putp1_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_wag6, wag6_spheroid, wag6_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_kav7, kav7_spheroid, kav7_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(eck3_entry, eck3_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(putp1_entry, putp1_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(wag6_entry, wag6_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(kav7_entry, kav7_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(eck3_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(eck3, eck3_entry);
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(putp1, putp1_entry);
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(wag6, wag6_entry);
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(kav7, kav7_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_ECK3_HPP
|
||||
|
||||
176
linx64/include/boost/geometry/srs/projections/proj/eck4.hpp
Normal file
176
linx64/include/boost/geometry/srs/projections/proj/eck4.hpp
Normal file
@@ -0,0 +1,176 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_ECK4_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_ECK4_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/aasincos.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace eck4
|
||||
{
|
||||
|
||||
static const double C_x = .42223820031577120149;
|
||||
static const double C_y = 1.32650042817700232218;
|
||||
static const double RC_y = .75386330736002178205;
|
||||
static const double C_p = 3.57079632679489661922;
|
||||
static const double RC_p = .28004957675577868795;
|
||||
static const double epsilon = 1e-7;
|
||||
static const int n_iter = 6;
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_eck4_spheroid
|
||||
: public base_t_fi<base_eck4_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_eck4_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_eck4_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T p, V, s, c;
|
||||
int i;
|
||||
|
||||
p = C_p * sin(lp_lat);
|
||||
V = lp_lat * lp_lat;
|
||||
lp_lat *= 0.895168 + V * ( 0.0218849 + V * 0.00826809 );
|
||||
for (i = n_iter; i ; --i) {
|
||||
c = cos(lp_lat);
|
||||
s = sin(lp_lat);
|
||||
lp_lat -= V = (lp_lat + s * (c + 2.) - p) /
|
||||
(1. + c * (c + 2.) - s * s);
|
||||
if (fabs(V) < epsilon)
|
||||
break;
|
||||
}
|
||||
if (!i) {
|
||||
xy_x = C_x * lp_lon;
|
||||
xy_y = lp_lat < 0. ? -C_y : C_y;
|
||||
} else {
|
||||
xy_x = C_x * lp_lon * (1. + cos(lp_lat));
|
||||
xy_y = C_y * sin(lp_lat);
|
||||
}
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
T c;
|
||||
|
||||
lp_lat = aasin(xy_y * RC_y);
|
||||
lp_lon = xy_x / (C_x * (1. + (c = cos(lp_lat))));
|
||||
lp_lat = aasin((lp_lat + sin(lp_lat) * (c + 2.)) * RC_p);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "eck4_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Eckert IV
|
||||
template <typename Parameters>
|
||||
inline void setup_eck4(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::eck4
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Eckert IV projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_eck4.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct eck4_spheroid : public detail::eck4::base_eck4_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline eck4_spheroid(Params const& , Parameters const& par)
|
||||
: detail::eck4::base_eck4_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::eck4::setup_eck4(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_eck4, eck4_spheroid, eck4_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(eck4_entry, eck4_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(eck4_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(eck4, eck4_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_ECK4_HPP
|
||||
|
||||
149
linx64/include/boost/geometry/srs/projections/proj/eck5.hpp
Normal file
149
linx64/include/boost/geometry/srs/projections/proj/eck5.hpp
Normal file
@@ -0,0 +1,149 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_ECK5_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_ECK5_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace eck5
|
||||
{
|
||||
|
||||
static const double XF = 0.44101277172455148219;
|
||||
static const double RXF = 2.26750802723822639137;
|
||||
static const double YF = 0.88202554344910296438;
|
||||
static const double RYF = 1.13375401361911319568;
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_eck5_spheroid
|
||||
: public base_t_fi<base_eck5_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_eck5_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_eck5_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
xy_x = XF * (1. + cos(lp_lat)) * lp_lon;
|
||||
xy_y = YF * lp_lat;
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
lp_lon = RXF * xy_x / (1. + cos( lp_lat = RYF * xy_y));
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "eck5_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Eckert V
|
||||
template <typename Parameters>
|
||||
inline void setup_eck5(Parameters& par)
|
||||
{
|
||||
par.es = 0.0;
|
||||
}
|
||||
|
||||
}} // namespace detail::eck5
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Eckert V projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_eck5.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct eck5_spheroid : public detail::eck5::base_eck5_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline eck5_spheroid(Params const& , Parameters const& par)
|
||||
: detail::eck5::base_eck5_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::eck5::setup_eck5(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_eck5, eck5_spheroid, eck5_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(eck5_entry, eck5_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(eck5_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(eck5, eck5_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_ECK5_HPP
|
||||
|
||||
159
linx64/include/boost/geometry/srs/projections/proj/eqc.hpp
Normal file
159
linx64/include/boost/geometry/srs/projections/proj/eqc.hpp
Normal file
@@ -0,0 +1,159 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_EQC_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_EQC_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace eqc
|
||||
{
|
||||
template <typename T>
|
||||
struct par_eqc
|
||||
{
|
||||
T rc;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_eqc_spheroid
|
||||
: public base_t_fi<base_eqc_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_eqc<T> m_proj_parm;
|
||||
|
||||
inline base_eqc_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_eqc_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
xy_x = this->m_proj_parm.rc * lp_lon;
|
||||
xy_y = lp_lat - this->m_par.phi0;
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
lp_lon = xy_x / this->m_proj_parm.rc;
|
||||
lp_lat = xy_y + this->m_par.phi0;
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "eqc_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Equidistant Cylindrical (Plate Caree)
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_eqc(Params const& params, Parameters& par, par_eqc<T>& proj_parm)
|
||||
{
|
||||
proj_parm.rc = cos(pj_get_param_r<T, srs::spar::lat_ts>(params, "lat_ts", srs::dpar::lat_ts));
|
||||
if (proj_parm.rc <= 0.)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_lat_ts_larger_than_90) );
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::eqc
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Equidistant Cylindrical (Plate Caree) projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
\par Projection parameters
|
||||
- lat_ts: Latitude of true scale (degrees)
|
||||
- lat_0: Latitude of origin
|
||||
\par Example
|
||||
\image html ex_eqc.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct eqc_spheroid : public detail::eqc::base_eqc_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline eqc_spheroid(Params const& params, Parameters const& par)
|
||||
: detail::eqc::base_eqc_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::eqc::setup_eqc(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_eqc, eqc_spheroid, eqc_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(eqc_entry, eqc_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(eqc_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(eqc, eqc_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_EQC_HPP
|
||||
|
||||
225
linx64/include/boost/geometry/srs/projections/proj/eqdc.hpp
Normal file
225
linx64/include/boost/geometry/srs/projections/proj/eqdc.hpp
Normal file
@@ -0,0 +1,225 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_EQDC_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_EQDC_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_mlfn.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_msfn.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
#include <boost/math/special_functions/hypot.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace eqdc
|
||||
{
|
||||
|
||||
static const double epsilon10 = 1.e-10;
|
||||
|
||||
template <typename T>
|
||||
struct par_eqdc
|
||||
{
|
||||
T phi1;
|
||||
T phi2;
|
||||
T n;
|
||||
T rho0;
|
||||
T c;
|
||||
detail::en<T> en;
|
||||
bool ellips;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_eqdc_ellipsoid
|
||||
: public base_t_fi<base_eqdc_ellipsoid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_eqdc<T> m_proj_parm;
|
||||
|
||||
inline base_eqdc_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_eqdc_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_forward) sphere & ellipsoid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T rho = 0.0;
|
||||
|
||||
rho = this->m_proj_parm.c - (this->m_proj_parm.ellips ? pj_mlfn(lp_lat, sin(lp_lat),
|
||||
cos(lp_lat), this->m_proj_parm.en) : lp_lat);
|
||||
xy_x = rho * sin( lp_lon *= this->m_proj_parm.n );
|
||||
xy_y = this->m_proj_parm.rho0 - rho * cos(lp_lon);
|
||||
}
|
||||
|
||||
// INVERSE(e_inverse) sphere & ellipsoid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static T const half_pi = detail::half_pi<T>();
|
||||
|
||||
T rho = 0.0;
|
||||
|
||||
if ((rho = boost::math::hypot(xy_x, xy_y = this->m_proj_parm.rho0 - xy_y)) != 0.0 ) {
|
||||
if (this->m_proj_parm.n < 0.) {
|
||||
rho = -rho;
|
||||
xy_x = -xy_x;
|
||||
xy_y = -xy_y;
|
||||
}
|
||||
lp_lat = this->m_proj_parm.c - rho;
|
||||
if (this->m_proj_parm.ellips)
|
||||
lp_lat = pj_inv_mlfn(lp_lat, this->m_par.es, this->m_proj_parm.en);
|
||||
lp_lon = atan2(xy_x, xy_y) / this->m_proj_parm.n;
|
||||
} else {
|
||||
lp_lon = 0.;
|
||||
lp_lat = this->m_proj_parm.n > 0. ? half_pi : -half_pi;
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "eqdc_ellipsoid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Equidistant Conic
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_eqdc(Params const& params, Parameters& par, par_eqdc<T>& proj_parm)
|
||||
{
|
||||
T cosphi, sinphi;
|
||||
int secant;
|
||||
|
||||
proj_parm.phi1 = pj_get_param_r<T, srs::spar::lat_1>(params, "lat_1", srs::dpar::lat_1);
|
||||
proj_parm.phi2 = pj_get_param_r<T, srs::spar::lat_2>(params, "lat_2", srs::dpar::lat_2);
|
||||
|
||||
if (fabs(proj_parm.phi1 + proj_parm.phi2) < epsilon10)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_conic_lat_equal) );
|
||||
|
||||
proj_parm.en = pj_enfn<T>(par.es);
|
||||
|
||||
proj_parm.n = sinphi = sin(proj_parm.phi1);
|
||||
cosphi = cos(proj_parm.phi1);
|
||||
secant = fabs(proj_parm.phi1 - proj_parm.phi2) >= epsilon10;
|
||||
if( (proj_parm.ellips = (par.es > 0.)) ) {
|
||||
double ml1, m1;
|
||||
|
||||
m1 = pj_msfn(sinphi, cosphi, par.es);
|
||||
ml1 = pj_mlfn(proj_parm.phi1, sinphi, cosphi, proj_parm.en);
|
||||
if (secant) { /* secant cone */
|
||||
sinphi = sin(proj_parm.phi2);
|
||||
cosphi = cos(proj_parm.phi2);
|
||||
proj_parm.n = (m1 - pj_msfn(sinphi, cosphi, par.es)) /
|
||||
(pj_mlfn(proj_parm.phi2, sinphi, cosphi, proj_parm.en) - ml1);
|
||||
}
|
||||
proj_parm.c = ml1 + m1 / proj_parm.n;
|
||||
proj_parm.rho0 = proj_parm.c - pj_mlfn(par.phi0, sin(par.phi0),
|
||||
cos(par.phi0), proj_parm.en);
|
||||
} else {
|
||||
if (secant)
|
||||
proj_parm.n = (cosphi - cos(proj_parm.phi2)) / (proj_parm.phi2 - proj_parm.phi1);
|
||||
proj_parm.c = proj_parm.phi1 + cos(proj_parm.phi1) / proj_parm.n;
|
||||
proj_parm.rho0 = proj_parm.c - par.phi0;
|
||||
}
|
||||
}
|
||||
|
||||
}} // namespace detail::eqdc
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Equidistant Conic projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Conic
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Projection parameters
|
||||
- lat_1: Latitude of first standard parallel (degrees)
|
||||
- lat_2: Latitude of second standard parallel (degrees)
|
||||
\par Example
|
||||
\image html ex_eqdc.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct eqdc_ellipsoid : public detail::eqdc::base_eqdc_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline eqdc_ellipsoid(Params const& params, Parameters const& par)
|
||||
: detail::eqdc::base_eqdc_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::eqdc::setup_eqdc(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_eqdc, eqdc_ellipsoid, eqdc_ellipsoid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(eqdc_entry, eqdc_ellipsoid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(eqdc_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(eqdc, eqdc_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_EQDC_HPP
|
||||
|
||||
453
linx64/include/boost/geometry/srs/projections/proj/etmerc.hpp
Normal file
453
linx64/include/boost/geometry/srs/projections/proj/etmerc.hpp
Normal file
@@ -0,0 +1,453 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Copyright (c) 2008 Gerald I. Evenden
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
/* The code in this file is largly based upon procedures:
|
||||
*
|
||||
* Written by: Knud Poder and Karsten Engsager
|
||||
*
|
||||
* Based on math from: R.Koenig and K.H. Weise, "Mathematische
|
||||
* Grundlagen der hoeheren Geodaesie und Kartographie,
|
||||
* Springer-Verlag, Berlin/Goettingen" Heidelberg, 1951.
|
||||
*
|
||||
* Modified and used here by permission of Reference Networks
|
||||
* Division, Kort og Matrikelstyrelsen (KMS), Copenhagen, Denmark
|
||||
*/
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_ETMERC_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_ETMERC_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/function_overloads.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
#include <boost/math/special_functions/hypot.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace etmerc
|
||||
{
|
||||
|
||||
static const int PROJ_ETMERC_ORDER = 6;
|
||||
|
||||
template <typename T>
|
||||
struct par_etmerc
|
||||
{
|
||||
T Qn; /* Merid. quad., scaled to the projection */
|
||||
T Zb; /* Radius vector in polar coord. systems */
|
||||
T cgb[6]; /* Constants for Gauss -> Geo lat */
|
||||
T cbg[6]; /* Constants for Geo lat -> Gauss */
|
||||
T utg[6]; /* Constants for transv. merc. -> geo */
|
||||
T gtu[6]; /* Constants for geo -> transv. merc. */
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
inline T log1py(T const& x) { /* Compute log(1+x) accurately */
|
||||
volatile T
|
||||
y = 1 + x,
|
||||
z = y - 1;
|
||||
/* Here's the explanation for this magic: y = 1 + z, exactly, and z
|
||||
* approx x, thus log(y)/z (which is nearly constant near z = 0) returns
|
||||
* a good approximation to the true log(1 + x)/x. The multiplication x *
|
||||
* (log(y)/z) introduces little additional error. */
|
||||
return z == 0 ? x : x * log(y) / z;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T asinhy(T const& x) { /* Compute asinh(x) accurately */
|
||||
T y = fabs(x); /* Enforce odd parity */
|
||||
y = log1py(y * (1 + y/(boost::math::hypot(1.0, y) + 1)));
|
||||
return x < 0 ? -y : y;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T gatg(const T *p1, int len_p1, T const& B) {
|
||||
const T *p;
|
||||
T h = 0, h1, h2 = 0, cos_2B;
|
||||
|
||||
cos_2B = 2*cos(2*B);
|
||||
for (p = p1 + len_p1, h1 = *--p; p - p1; h2 = h1, h1 = h)
|
||||
h = -h2 + cos_2B*h1 + *--p;
|
||||
return (B + h*sin(2*B));
|
||||
}
|
||||
|
||||
/* Complex Clenshaw summation */
|
||||
template <typename T>
|
||||
inline T clenS(const T *a, int size, T const& arg_r, T const& arg_i, T *R, T *I) {
|
||||
T r, i, hr, hr1, hr2, hi, hi1, hi2;
|
||||
T sin_arg_r, cos_arg_r, sinh_arg_i, cosh_arg_i;
|
||||
|
||||
/* arguments */
|
||||
const T* p = a + size;
|
||||
sin_arg_r = sin(arg_r);
|
||||
cos_arg_r = cos(arg_r);
|
||||
sinh_arg_i = sinh(arg_i);
|
||||
cosh_arg_i = cosh(arg_i);
|
||||
r = 2*cos_arg_r*cosh_arg_i;
|
||||
i = -2*sin_arg_r*sinh_arg_i;
|
||||
/* summation loop */
|
||||
for (hi1 = hr1 = hi = 0, hr = *--p; a - p;) {
|
||||
hr2 = hr1;
|
||||
hi2 = hi1;
|
||||
hr1 = hr;
|
||||
hi1 = hi;
|
||||
hr = -hr2 + r*hr1 - i*hi1 + *--p;
|
||||
hi = -hi2 + i*hr1 + r*hi1;
|
||||
}
|
||||
r = sin_arg_r*cosh_arg_i;
|
||||
i = cos_arg_r*sinh_arg_i;
|
||||
*R = r*hr - i*hi;
|
||||
*I = r*hi + i*hr;
|
||||
return(*R);
|
||||
}
|
||||
|
||||
/* Real Clenshaw summation */
|
||||
template <typename T>
|
||||
inline T clens(const T *a, int size, T const& arg_r) {
|
||||
T r, hr, hr1, hr2, cos_arg_r;
|
||||
|
||||
const T* p = a + size;
|
||||
cos_arg_r = cos(arg_r);
|
||||
r = 2*cos_arg_r;
|
||||
|
||||
/* summation loop */
|
||||
for (hr1 = 0, hr = *--p; a - p;) {
|
||||
hr2 = hr1;
|
||||
hr1 = hr;
|
||||
hr = -hr2 + r*hr1 + *--p;
|
||||
}
|
||||
return(sin(arg_r)*hr);
|
||||
}
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_etmerc_ellipsoid
|
||||
: public base_t_fi<base_etmerc_ellipsoid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_etmerc<T> m_proj_parm;
|
||||
|
||||
inline base_etmerc_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_etmerc_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_forward) ellipsoid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T sin_Cn, cos_Cn, cos_Ce, sin_Ce, dCn, dCe;
|
||||
T Cn = lp_lat, Ce = lp_lon;
|
||||
|
||||
/* ell. LAT, LNG -> Gaussian LAT, LNG */
|
||||
Cn = gatg(this->m_proj_parm.cbg, PROJ_ETMERC_ORDER, Cn);
|
||||
/* Gaussian LAT, LNG -> compl. sph. LAT */
|
||||
sin_Cn = sin(Cn);
|
||||
cos_Cn = cos(Cn);
|
||||
sin_Ce = sin(Ce);
|
||||
cos_Ce = cos(Ce);
|
||||
|
||||
Cn = atan2(sin_Cn, cos_Ce*cos_Cn);
|
||||
Ce = atan2(sin_Ce*cos_Cn, boost::math::hypot(sin_Cn, cos_Cn*cos_Ce));
|
||||
|
||||
/* compl. sph. N, E -> ell. norm. N, E */
|
||||
Ce = asinhy(tan(Ce)); /* Replaces: Ce = log(tan(fourth_pi + Ce*0.5)); */
|
||||
Cn += clenS(this->m_proj_parm.gtu, PROJ_ETMERC_ORDER, 2*Cn, 2*Ce, &dCn, &dCe);
|
||||
Ce += dCe;
|
||||
if (fabs(Ce) <= 2.623395162778) {
|
||||
xy_y = this->m_proj_parm.Qn * Cn + this->m_proj_parm.Zb; /* Northing */
|
||||
xy_x = this->m_proj_parm.Qn * Ce; /* Easting */
|
||||
} else
|
||||
xy_x = xy_y = HUGE_VAL;
|
||||
}
|
||||
|
||||
// INVERSE(e_inverse) ellipsoid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
T sin_Cn, cos_Cn, cos_Ce, sin_Ce, dCn, dCe;
|
||||
T Cn = xy_y, Ce = xy_x;
|
||||
|
||||
/* normalize N, E */
|
||||
Cn = (Cn - this->m_proj_parm.Zb)/this->m_proj_parm.Qn;
|
||||
Ce = Ce/this->m_proj_parm.Qn;
|
||||
|
||||
if (fabs(Ce) <= 2.623395162778) { /* 150 degrees */
|
||||
/* norm. N, E -> compl. sph. LAT, LNG */
|
||||
Cn += clenS(this->m_proj_parm.utg, PROJ_ETMERC_ORDER, 2*Cn, 2*Ce, &dCn, &dCe);
|
||||
Ce += dCe;
|
||||
Ce = atan(sinh(Ce)); /* Replaces: Ce = 2*(atan(exp(Ce)) - fourth_pi); */
|
||||
/* compl. sph. LAT -> Gaussian LAT, LNG */
|
||||
sin_Cn = sin(Cn);
|
||||
cos_Cn = cos(Cn);
|
||||
sin_Ce = sin(Ce);
|
||||
cos_Ce = cos(Ce);
|
||||
Ce = atan2(sin_Ce, cos_Ce*cos_Cn);
|
||||
Cn = atan2(sin_Cn*cos_Ce, boost::math::hypot(sin_Ce, cos_Ce*cos_Cn));
|
||||
/* Gaussian LAT, LNG -> ell. LAT, LNG */
|
||||
lp_lat = gatg(this->m_proj_parm.cgb, PROJ_ETMERC_ORDER, Cn);
|
||||
lp_lon = Ce;
|
||||
}
|
||||
else
|
||||
lp_lat = lp_lon = HUGE_VAL;
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "etmerc_ellipsoid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup(Parameters& par, par_etmerc<T>& proj_parm)
|
||||
{
|
||||
T f, n, np, Z;
|
||||
|
||||
if (par.es <= 0) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_ellipsoid_use_required) );
|
||||
}
|
||||
|
||||
f = par.es / (1 + sqrt(1 - par.es)); /* Replaces: f = 1 - sqrt(1-par.es); */
|
||||
|
||||
/* third flattening */
|
||||
np = n = f/(2 - f);
|
||||
|
||||
/* COEF. OF TRIG SERIES GEO <-> GAUSS */
|
||||
/* cgb := Gaussian -> Geodetic, KW p190 - 191 (61) - (62) */
|
||||
/* cbg := Geodetic -> Gaussian, KW p186 - 187 (51) - (52) */
|
||||
/* PROJ_ETMERC_ORDER = 6th degree : Engsager and Poder: ICC2007 */
|
||||
|
||||
proj_parm.cgb[0] = n*( 2 + n*(-2/3.0 + n*(-2 + n*(116/45.0 + n*(26/45.0 +
|
||||
n*(-2854/675.0 ))))));
|
||||
proj_parm.cbg[0] = n*(-2 + n*( 2/3.0 + n*( 4/3.0 + n*(-82/45.0 + n*(32/45.0 +
|
||||
n*( 4642/4725.0))))));
|
||||
np *= n;
|
||||
proj_parm.cgb[1] = np*(7/3.0 + n*( -8/5.0 + n*(-227/45.0 + n*(2704/315.0 +
|
||||
n*( 2323/945.0)))));
|
||||
proj_parm.cbg[1] = np*(5/3.0 + n*(-16/15.0 + n*( -13/9.0 + n*( 904/315.0 +
|
||||
n*(-1522/945.0)))));
|
||||
np *= n;
|
||||
/* n^5 coeff corrected from 1262/105 -> -1262/105 */
|
||||
proj_parm.cgb[2] = np*( 56/15.0 + n*(-136/35.0 + n*(-1262/105.0 +
|
||||
n*( 73814/2835.0))));
|
||||
proj_parm.cbg[2] = np*(-26/15.0 + n*( 34/21.0 + n*( 8/5.0 +
|
||||
n*(-12686/2835.0))));
|
||||
np *= n;
|
||||
/* n^5 coeff corrected from 322/35 -> 332/35 */
|
||||
proj_parm.cgb[3] = np*(4279/630.0 + n*(-332/35.0 + n*(-399572/14175.0)));
|
||||
proj_parm.cbg[3] = np*(1237/630.0 + n*( -12/5.0 + n*( -24832/14175.0)));
|
||||
np *= n;
|
||||
proj_parm.cgb[4] = np*(4174/315.0 + n*(-144838/6237.0 ));
|
||||
proj_parm.cbg[4] = np*(-734/315.0 + n*( 109598/31185.0));
|
||||
np *= n;
|
||||
proj_parm.cgb[5] = np*(601676/22275.0 );
|
||||
proj_parm.cbg[5] = np*(444337/155925.0);
|
||||
|
||||
/* Constants of the projections */
|
||||
/* Transverse Mercator (UTM, ITM, etc) */
|
||||
np = n*n;
|
||||
/* Norm. mer. quad, K&W p.50 (96), p.19 (38b), p.5 (2) */
|
||||
proj_parm.Qn = par.k0/(1 + n) * (1 + np*(1/4.0 + np*(1/64.0 + np/256.0)));
|
||||
/* coef of trig series */
|
||||
/* utg := ell. N, E -> sph. N, E, KW p194 (65) */
|
||||
/* gtu := sph. N, E -> ell. N, E, KW p196 (69) */
|
||||
proj_parm.utg[0] = n*(-0.5 + n*( 2/3.0 + n*(-37/96.0 + n*( 1/360.0 +
|
||||
n*( 81/512.0 + n*(-96199/604800.0))))));
|
||||
proj_parm.gtu[0] = n*( 0.5 + n*(-2/3.0 + n*( 5/16.0 + n*(41/180.0 +
|
||||
n*(-127/288.0 + n*( 7891/37800.0 ))))));
|
||||
proj_parm.utg[1] = np*(-1/48.0 + n*(-1/15.0 + n*(437/1440.0 + n*(-46/105.0 +
|
||||
n*( 1118711/3870720.0)))));
|
||||
proj_parm.gtu[1] = np*(13/48.0 + n*(-3/5.0 + n*(557/1440.0 + n*(281/630.0 +
|
||||
n*(-1983433/1935360.0)))));
|
||||
np *= n;
|
||||
proj_parm.utg[2] = np*(-17/480.0 + n*( 37/840.0 + n*( 209/4480.0 +
|
||||
n*( -5569/90720.0 ))));
|
||||
proj_parm.gtu[2] = np*( 61/240.0 + n*(-103/140.0 + n*(15061/26880.0 +
|
||||
n*(167603/181440.0))));
|
||||
np *= n;
|
||||
proj_parm.utg[3] = np*(-4397/161280.0 + n*( 11/504.0 + n*( 830251/7257600.0)));
|
||||
proj_parm.gtu[3] = np*(49561/161280.0 + n*(-179/168.0 + n*(6601661/7257600.0)));
|
||||
np *= n;
|
||||
proj_parm.utg[4] = np*(-4583/161280.0 + n*( 108847/3991680.0));
|
||||
proj_parm.gtu[4] = np*(34729/80640.0 + n*(-3418889/1995840.0));
|
||||
np *= n;
|
||||
proj_parm.utg[5] = np*(-20648693/638668800.0);
|
||||
proj_parm.gtu[5] = np*(212378941/319334400.0);
|
||||
|
||||
/* Gaussian latitude value of the origin latitude */
|
||||
Z = gatg(proj_parm.cbg, PROJ_ETMERC_ORDER, par.phi0);
|
||||
|
||||
/* Origin northing minus true northing at the origin latitude */
|
||||
/* i.e. true northing = N - proj_parm.Zb */
|
||||
proj_parm.Zb = - proj_parm.Qn*(Z + clens(proj_parm.gtu, PROJ_ETMERC_ORDER, 2*Z));
|
||||
}
|
||||
|
||||
// Extended Transverse Mercator
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_etmerc(Parameters& par, par_etmerc<T>& proj_parm)
|
||||
{
|
||||
setup(par, proj_parm);
|
||||
}
|
||||
|
||||
// Universal Transverse Mercator (UTM)
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_utm(Params const& params, Parameters& par, par_etmerc<T>& proj_parm)
|
||||
{
|
||||
static const T pi = detail::pi<T>();
|
||||
|
||||
int zone;
|
||||
|
||||
if (par.es == 0.0) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_ellipsoid_use_required) );
|
||||
}
|
||||
|
||||
par.y0 = pj_get_param_b<srs::spar::south>(params, "south", srs::dpar::south) ? 10000000. : 0.;
|
||||
par.x0 = 500000.;
|
||||
if (pj_param_i<srs::spar::zone>(params, "zone", srs::dpar::zone, zone)) /* zone input ? */
|
||||
{
|
||||
if (zone > 0 && zone <= 60)
|
||||
--zone;
|
||||
else {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_invalid_utm_zone) );
|
||||
}
|
||||
}
|
||||
else /* nearest central meridian input */
|
||||
{
|
||||
zone = int_floor((adjlon(par.lam0) + pi) * 30. / pi);
|
||||
if (zone < 0)
|
||||
zone = 0;
|
||||
else if (zone >= 60)
|
||||
zone = 59;
|
||||
}
|
||||
par.lam0 = (zone + .5) * pi / 30. - pi;
|
||||
par.k0 = 0.9996;
|
||||
par.phi0 = 0.;
|
||||
|
||||
setup(par, proj_parm);
|
||||
}
|
||||
|
||||
}} // namespace detail::etmerc
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Extended Transverse Mercator projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
\par Projection parameters
|
||||
- lat_ts: Latitude of true scale
|
||||
- lat_0: Latitude of origin
|
||||
\par Example
|
||||
\image html ex_etmerc.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct etmerc_ellipsoid : public detail::etmerc::base_etmerc_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline etmerc_ellipsoid(Params const& , Parameters const& par)
|
||||
: detail::etmerc::base_etmerc_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::etmerc::setup_etmerc(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Universal Transverse Mercator (UTM) projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
\par Projection parameters
|
||||
- zone: UTM Zone (integer)
|
||||
- south: Denotes southern hemisphere UTM zone (boolean)
|
||||
\par Example
|
||||
\image html ex_utm.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct utm_ellipsoid : public detail::etmerc::base_etmerc_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline utm_ellipsoid(Params const& params, Parameters const& par)
|
||||
: detail::etmerc::base_etmerc_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::etmerc::setup_utm(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_etmerc, etmerc_ellipsoid, etmerc_ellipsoid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_utm, utm_ellipsoid, utm_ellipsoid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(etmerc_entry, etmerc_ellipsoid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(utm_entry, utm_ellipsoid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(etmerc_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(etmerc, etmerc_entry);
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(utm, utm_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_ETMERC_HPP
|
||||
|
||||
151
linx64/include/boost/geometry/srs/projections/proj/fahey.hpp
Normal file
151
linx64/include/boost/geometry/srs/projections/proj/fahey.hpp
Normal file
@@ -0,0 +1,151 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_FAHEY_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_FAHEY_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/aasincos.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace fahey
|
||||
{
|
||||
|
||||
static const double tolerance = 1e-6;
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_fahey_spheroid
|
||||
: public base_t_fi<base_fahey_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_fahey_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_fahey_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
xy_x = tan(0.5 * lp_lat);
|
||||
xy_y = 1.819152 * xy_x;
|
||||
xy_x = 0.819152 * lp_lon * asqrt(1 - xy_x * xy_x);
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
xy_y /= 1.819152;
|
||||
lp_lat = 2. * atan(xy_y);
|
||||
xy_y = 1. - xy_y * xy_y;
|
||||
lp_lon = fabs(xy_y) < tolerance ? 0. : xy_x / (0.819152 * sqrt(xy_y));
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "fahey_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Fahey
|
||||
template <typename Parameters>
|
||||
inline void setup_fahey(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::fahey
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Fahey projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_fahey.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct fahey_spheroid : public detail::fahey::base_fahey_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline fahey_spheroid(Params const& , Parameters const& par)
|
||||
: detail::fahey::base_fahey_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::fahey::setup_fahey(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_fahey, fahey_spheroid, fahey_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(fahey_entry, fahey_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(fahey_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(fahey, fahey_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_FAHEY_HPP
|
||||
|
||||
187
linx64/include/boost/geometry/srs/projections/proj/fouc_s.hpp
Normal file
187
linx64/include/boost/geometry/srs/projections/proj/fouc_s.hpp
Normal file
@@ -0,0 +1,187 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_FOUC_S_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_FOUC_S_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/aasincos.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace fouc_s
|
||||
{
|
||||
|
||||
static const int max_iter = 10;
|
||||
static const double loop_tol = 1e-7;
|
||||
|
||||
template <typename T>
|
||||
struct par_fouc_s
|
||||
{
|
||||
T n, n1;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_fouc_s_spheroid
|
||||
: public base_t_fi<base_fouc_s_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_fouc_s<T> m_proj_parm;
|
||||
|
||||
inline base_fouc_s_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_fouc_s_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T t;
|
||||
|
||||
t = cos(lp_lat);
|
||||
xy_x = lp_lon * t / (this->m_proj_parm.n + this->m_proj_parm.n1 * t);
|
||||
xy_y = this->m_proj_parm.n * lp_lat + this->m_proj_parm.n1 * sin(lp_lat);
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static T const half_pi = detail::half_pi<T>();
|
||||
|
||||
T V;
|
||||
int i;
|
||||
|
||||
if (this->m_proj_parm.n != 0.0) {
|
||||
lp_lat = xy_y;
|
||||
for (i = max_iter; i ; --i) {
|
||||
lp_lat -= V = (this->m_proj_parm.n * lp_lat + this->m_proj_parm.n1 * sin(lp_lat) - xy_y ) /
|
||||
(this->m_proj_parm.n + this->m_proj_parm.n1 * cos(lp_lat));
|
||||
if (fabs(V) < loop_tol)
|
||||
break;
|
||||
}
|
||||
if (!i)
|
||||
lp_lat = xy_y < 0. ? -half_pi : half_pi;
|
||||
} else
|
||||
lp_lat = aasin(xy_y);
|
||||
V = cos(lp_lat);
|
||||
lp_lon = xy_x * (this->m_proj_parm.n + this->m_proj_parm.n1 * V) / V;
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "fouc_s_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Foucaut Sinusoidal
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_fouc_s(Params const& params, Parameters& par, par_fouc_s<T>& proj_parm)
|
||||
{
|
||||
proj_parm.n = pj_get_param_f<T, srs::spar::n>(params, "n", srs::dpar::n);
|
||||
if ((proj_parm.n < 0.) || (proj_parm.n > 1.))
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_n_out_of_range) );
|
||||
|
||||
proj_parm.n1 = 1. - proj_parm.n;
|
||||
par.es = 0;
|
||||
}
|
||||
|
||||
}} // namespace detail::fouc_s
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Foucaut Sinusoidal projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Projection parameters
|
||||
- n (real)
|
||||
\par Example
|
||||
\image html ex_fouc_s.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct fouc_s_spheroid : public detail::fouc_s::base_fouc_s_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline fouc_s_spheroid(Params const& params, Parameters const& par)
|
||||
: detail::fouc_s::base_fouc_s_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::fouc_s::setup_fouc_s(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_fouc_s, fouc_s_spheroid, fouc_s_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(fouc_s_entry, fouc_s_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(fouc_s_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(fouc_s, fouc_s_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_FOUC_S_HPP
|
||||
|
||||
150
linx64/include/boost/geometry/srs/projections/proj/gall.hpp
Normal file
150
linx64/include/boost/geometry/srs/projections/proj/gall.hpp
Normal file
@@ -0,0 +1,150 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_GALL_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_GALL_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace gall
|
||||
{
|
||||
|
||||
static const double YF = 1.70710678118654752440;
|
||||
static const double XF = 0.70710678118654752440;
|
||||
static const double RYF = 0.58578643762690495119;
|
||||
static const double RXF = 1.41421356237309504880;
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_gall_spheroid
|
||||
: public base_t_fi<base_gall_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_gall_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_gall_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
xy_x = XF * lp_lon;
|
||||
xy_y = YF * tan(.5 * lp_lat);
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
lp_lon = RXF * xy_x;
|
||||
lp_lat = 2. * atan(xy_y * RYF);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "gall_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Gall (Gall Stereographic)
|
||||
template <typename Parameters>
|
||||
inline void setup_gall(Parameters& par)
|
||||
{
|
||||
par.es = 0.0;
|
||||
}
|
||||
|
||||
}} // namespace detail::gall
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Gall (Gall Stereographic) projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_gall.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct gall_spheroid : public detail::gall::base_gall_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline gall_spheroid(Params const& , Parameters const& par)
|
||||
: detail::gall::base_gall_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::gall::setup_gall(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_gall, gall_spheroid, gall_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(gall_entry, gall_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(gall_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(gall, gall_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_GALL_HPP
|
||||
|
||||
150
linx64/include/boost/geometry/srs/projections/proj/geocent.hpp
Normal file
150
linx64/include/boost/geometry/srs/projections/proj/geocent.hpp
Normal file
@@ -0,0 +1,150 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Purpose: Stub projection for geocentric. The transformation isn't
|
||||
// really done here since this code is 2D. The real transformation
|
||||
// is handled by pj_transform.c.
|
||||
// Author: Frank Warmerdam, warmerdam@pobox.com
|
||||
// Copyright (c) 2002, Frank Warmerdam
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_GEOCENT_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_GEOCENT_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace geocent
|
||||
{
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_geocent_other
|
||||
: public base_t_fi<base_geocent_other<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_geocent_other(const Parameters& par)
|
||||
: base_t_fi<base_geocent_other<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(forward)
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
xy_x = lp_lon;
|
||||
xy_y = lp_lat;
|
||||
}
|
||||
|
||||
// INVERSE(inverse)
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
lp_lat = xy_y;
|
||||
lp_lon = xy_x;
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "geocent_other";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Geocentric
|
||||
template <typename Parameters>
|
||||
inline void setup_geocent(Parameters& par)
|
||||
{
|
||||
par.is_geocent = 1;
|
||||
par.x0 = 0.0;
|
||||
par.y0 = 0.0;
|
||||
}
|
||||
|
||||
}} // namespace detail::geocent
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Geocentric projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Example
|
||||
\image html ex_geocent.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct geocent_other : public detail::geocent::base_geocent_other<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline geocent_other(Params const& , Parameters const& par)
|
||||
: detail::geocent::base_geocent_other<T, Parameters>(par)
|
||||
{
|
||||
detail::geocent::setup_geocent(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_geocent, geocent_other, geocent_other)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(geocent_entry, geocent_other)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(geocent_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(geocent, geocent_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_GEOCENT_HPP
|
||||
|
||||
384
linx64/include/boost/geometry/srs/projections/proj/geos.hpp
Normal file
384
linx64/include/boost/geometry/srs/projections/proj/geos.hpp
Normal file
@@ -0,0 +1,384 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Copyright (c) 2004 Gerald I. Evenden
|
||||
// Copyright (c) 2012 Martin Raspaud
|
||||
|
||||
// See also (section 4.4.3.2):
|
||||
// http://www.eumetsat.int/en/area4/msg/news/us_doc/cgms_03_26.pdf
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_GEOS_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_GEOS_HPP
|
||||
|
||||
#include <boost/math/special_functions/hypot.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace geos
|
||||
{
|
||||
template <typename T>
|
||||
struct par_geos
|
||||
{
|
||||
T h;
|
||||
T radius_p;
|
||||
T radius_p2;
|
||||
T radius_p_inv2;
|
||||
T radius_g;
|
||||
T radius_g_1;
|
||||
T C;
|
||||
bool flip_axis;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_geos_ellipsoid
|
||||
: public base_t_fi<base_geos_ellipsoid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_geos<T> m_proj_parm;
|
||||
|
||||
inline base_geos_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_geos_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_forward) ellipsoid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T r, Vx, Vy, Vz, tmp;
|
||||
|
||||
/* Calculation of geocentric latitude. */
|
||||
lp_lat = atan (this->m_proj_parm.radius_p2 * tan (lp_lat));
|
||||
|
||||
/* Calculation of the three components of the vector from satellite to
|
||||
** position on earth surface (lon,lat).*/
|
||||
r = (this->m_proj_parm.radius_p) / boost::math::hypot(this->m_proj_parm.radius_p * cos (lp_lat), sin (lp_lat));
|
||||
Vx = r * cos (lp_lon) * cos (lp_lat);
|
||||
Vy = r * sin (lp_lon) * cos (lp_lat);
|
||||
Vz = r * sin (lp_lat);
|
||||
|
||||
/* Check visibility. */
|
||||
if (((this->m_proj_parm.radius_g - Vx) * Vx - Vy * Vy - Vz * Vz * this->m_proj_parm.radius_p_inv2) < 0.) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
|
||||
/* Calculation based on view angles from satellite. */
|
||||
tmp = this->m_proj_parm.radius_g - Vx;
|
||||
|
||||
if(this->m_proj_parm.flip_axis) {
|
||||
xy_x = this->m_proj_parm.radius_g_1 * atan (Vy / boost::math::hypot (Vz, tmp));
|
||||
xy_y = this->m_proj_parm.radius_g_1 * atan (Vz / tmp);
|
||||
} else {
|
||||
xy_x = this->m_proj_parm.radius_g_1 * atan (Vy / tmp);
|
||||
xy_y = this->m_proj_parm.radius_g_1 * atan (Vz / boost::math::hypot (Vy, tmp));
|
||||
}
|
||||
}
|
||||
|
||||
// INVERSE(e_inverse) ellipsoid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
T Vx, Vy, Vz, a, b, det, k;
|
||||
|
||||
/* Setting three components of vector from satellite to position.*/
|
||||
Vx = -1.0;
|
||||
|
||||
if(this->m_proj_parm.flip_axis) {
|
||||
Vz = tan (xy_y / this->m_proj_parm.radius_g_1);
|
||||
Vy = tan (xy_x / this->m_proj_parm.radius_g_1) * boost::math::hypot(1.0, Vz);
|
||||
} else {
|
||||
Vy = tan (xy_x / this->m_proj_parm.radius_g_1);
|
||||
Vz = tan (xy_y / this->m_proj_parm.radius_g_1) * boost::math::hypot(1.0, Vy);
|
||||
}
|
||||
|
||||
/* Calculation of terms in cubic equation and determinant.*/
|
||||
a = Vz / this->m_proj_parm.radius_p;
|
||||
a = Vy * Vy + a * a + Vx * Vx;
|
||||
b = 2 * this->m_proj_parm.radius_g * Vx;
|
||||
if ((det = (b * b) - 4 * a * this->m_proj_parm.C) < 0.) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
|
||||
/* Calculation of three components of vector from satellite to position.*/
|
||||
k = (-b - sqrt(det)) / (2. * a);
|
||||
Vx = this->m_proj_parm.radius_g + k * Vx;
|
||||
Vy *= k;
|
||||
Vz *= k;
|
||||
|
||||
/* Calculation of longitude and latitude.*/
|
||||
lp_lon = atan2 (Vy, Vx);
|
||||
lp_lat = atan (Vz * cos (lp_lon) / Vx);
|
||||
lp_lat = atan (this->m_proj_parm.radius_p_inv2 * tan (lp_lat));
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "geos_ellipsoid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_geos_spheroid
|
||||
: public base_t_fi<base_geos_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_geos<T> m_proj_parm;
|
||||
|
||||
inline base_geos_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_geos_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T Vx, Vy, Vz, tmp;
|
||||
|
||||
/* Calculation of the three components of the vector from satellite to
|
||||
** position on earth surface (lon,lat).*/
|
||||
tmp = cos(lp_lat);
|
||||
Vx = cos (lp_lon) * tmp;
|
||||
Vy = sin (lp_lon) * tmp;
|
||||
Vz = sin (lp_lat);
|
||||
|
||||
/* Check visibility.*/
|
||||
// TODO: in proj4 5.0.0 this check is not present
|
||||
if (((this->m_proj_parm.radius_g - Vx) * Vx - Vy * Vy - Vz * Vz) < 0.)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
|
||||
/* Calculation based on view angles from satellite.*/
|
||||
tmp = this->m_proj_parm.radius_g - Vx;
|
||||
|
||||
if(this->m_proj_parm.flip_axis) {
|
||||
xy_x = this->m_proj_parm.radius_g_1 * atan(Vy / boost::math::hypot(Vz, tmp));
|
||||
xy_y = this->m_proj_parm.radius_g_1 * atan(Vz / tmp);
|
||||
} else {
|
||||
xy_x = this->m_proj_parm.radius_g_1 * atan(Vy / tmp);
|
||||
xy_y = this->m_proj_parm.radius_g_1 * atan(Vz / boost::math::hypot(Vy, tmp));
|
||||
}
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
T Vx, Vy, Vz, a, b, det, k;
|
||||
|
||||
/* Setting three components of vector from satellite to position.*/
|
||||
Vx = -1.0;
|
||||
if(this->m_proj_parm.flip_axis) {
|
||||
Vz = tan (xy_y / (this->m_proj_parm.radius_g - 1.0));
|
||||
Vy = tan (xy_x / (this->m_proj_parm.radius_g - 1.0)) * sqrt (1.0 + Vz * Vz);
|
||||
} else {
|
||||
Vy = tan (xy_x / (this->m_proj_parm.radius_g - 1.0));
|
||||
Vz = tan (xy_y / (this->m_proj_parm.radius_g - 1.0)) * sqrt (1.0 + Vy * Vy);
|
||||
}
|
||||
|
||||
/* Calculation of terms in cubic equation and determinant.*/
|
||||
a = Vy * Vy + Vz * Vz + Vx * Vx;
|
||||
b = 2 * this->m_proj_parm.radius_g * Vx;
|
||||
if ((det = (b * b) - 4 * a * this->m_proj_parm.C) < 0.) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
|
||||
/* Calculation of three components of vector from satellite to position.*/
|
||||
k = (-b - sqrt(det)) / (2 * a);
|
||||
Vx = this->m_proj_parm.radius_g + k * Vx;
|
||||
Vy *= k;
|
||||
Vz *= k;
|
||||
|
||||
/* Calculation of longitude and latitude.*/
|
||||
lp_lon = atan2 (Vy, Vx);
|
||||
lp_lat = atan (Vz * cos (lp_lon) / Vx);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "geos_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
inline bool geos_flip_axis(srs::detail::proj4_parameters const& params)
|
||||
{
|
||||
std::string sweep_axis = pj_get_param_s(params, "sweep");
|
||||
if (sweep_axis.empty())
|
||||
return false;
|
||||
else {
|
||||
if (sweep_axis[1] != '\0' || (sweep_axis[0] != 'x' && sweep_axis[0] != 'y'))
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_invalid_sweep_axis) );
|
||||
|
||||
if (sweep_axis[0] == 'x')
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline bool geos_flip_axis(srs::dpar::parameters<T> const& params)
|
||||
{
|
||||
typename srs::dpar::parameters<T>::const_iterator
|
||||
it = pj_param_find(params, srs::dpar::sweep);
|
||||
if (it == params.end()) {
|
||||
return false;
|
||||
} else {
|
||||
srs::dpar::value_sweep s = static_cast<srs::dpar::value_sweep>(it->template get_value<int>());
|
||||
return s == srs::dpar::sweep_x;
|
||||
}
|
||||
}
|
||||
|
||||
// Geostationary Satellite View
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_geos(Params const& params, Parameters& par, par_geos<T>& proj_parm)
|
||||
{
|
||||
std::string sweep_axis;
|
||||
|
||||
if ((proj_parm.h = pj_get_param_f<T, srs::spar::h>(params, "h", srs::dpar::h)) <= 0.)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_h_less_than_zero) );
|
||||
|
||||
if (par.phi0 != 0.0)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_unknown_prime_meridian) );
|
||||
|
||||
|
||||
proj_parm.flip_axis = geos_flip_axis(params);
|
||||
|
||||
proj_parm.radius_g_1 = proj_parm.h / par.a;
|
||||
proj_parm.radius_g = 1. + proj_parm.radius_g_1;
|
||||
proj_parm.C = proj_parm.radius_g * proj_parm.radius_g - 1.0;
|
||||
if (par.es != 0.0) {
|
||||
proj_parm.radius_p = sqrt (par.one_es);
|
||||
proj_parm.radius_p2 = par.one_es;
|
||||
proj_parm.radius_p_inv2 = par.rone_es;
|
||||
} else {
|
||||
proj_parm.radius_p = proj_parm.radius_p2 = proj_parm.radius_p_inv2 = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
}} // namespace detail::geos
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Geostationary Satellite View projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Azimuthal
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Projection parameters
|
||||
- h: Height (real)
|
||||
- sweep: Sweep axis ('x' or 'y') (string)
|
||||
\par Example
|
||||
\image html ex_geos.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct geos_ellipsoid : public detail::geos::base_geos_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline geos_ellipsoid(Params const& params, Parameters const& par)
|
||||
: detail::geos::base_geos_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::geos::setup_geos(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Geostationary Satellite View projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Azimuthal
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Projection parameters
|
||||
- h: Height (real)
|
||||
- sweep: Sweep axis ('x' or 'y') (string)
|
||||
\par Example
|
||||
\image html ex_geos.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct geos_spheroid : public detail::geos::base_geos_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline geos_spheroid(Params const& params, Parameters const& par)
|
||||
: detail::geos::base_geos_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::geos::setup_geos(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_geos, geos_spheroid, geos_ellipsoid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(geos_entry, geos_spheroid, geos_ellipsoid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(geos_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(geos, geos_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_GEOS_HPP
|
||||
|
||||
151
linx64/include/boost/geometry/srs/projections/proj/gins8.hpp
Normal file
151
linx64/include/boost/geometry/srs/projections/proj/gins8.hpp
Normal file
@@ -0,0 +1,151 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_GINS8_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_GINS8_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace gins8
|
||||
{
|
||||
|
||||
static const double Cl = 0.000952426;
|
||||
static const double Cp = 0.162388;
|
||||
//static const double C12 = 0.08333333333333333;
|
||||
|
||||
template <typename T>
|
||||
inline T C12() { return 0.083333333333333333333333333333333333; }
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_gins8_spheroid
|
||||
: public base_t_f<base_gins8_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_gins8_spheroid(const Parameters& par)
|
||||
: base_t_f<base_gins8_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T C12 = gins8::C12<T>();
|
||||
|
||||
T t = lp_lat * lp_lat;
|
||||
|
||||
xy_y = lp_lat * (1. + t * C12);
|
||||
xy_x = lp_lon * (1. - Cp * t);
|
||||
t = lp_lon * lp_lon;
|
||||
xy_x *= (0.87 - Cl * t * t);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "gins8_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Ginsburg VIII (TsNIIGAiK)
|
||||
template <typename Parameters>
|
||||
inline void setup_gins8(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::gins8
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Ginsburg VIII (TsNIIGAiK) projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
- no inverse
|
||||
\par Example
|
||||
\image html ex_gins8.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct gins8_spheroid : public detail::gins8::base_gins8_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline gins8_spheroid(Params const& , Parameters const& par)
|
||||
: detail::gins8::base_gins8_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::gins8::setup_gins8(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_gins8, gins8_spheroid, gins8_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(gins8_entry, gins8_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(gins8_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(gins8, gins8_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_GINS8_HPP
|
||||
|
||||
385
linx64/include/boost/geometry/srs/projections/proj/gn_sinu.hpp
Normal file
385
linx64/include/boost/geometry/srs/projections/proj/gn_sinu.hpp
Normal file
@@ -0,0 +1,385 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_GN_SINU_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_GN_SINU_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/aasincos.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_mlfn.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace gn_sinu
|
||||
{
|
||||
|
||||
static const double epsilon10 = 1e-10;
|
||||
static const int max_iter = 8;
|
||||
static const double loop_tol = 1e-7;
|
||||
|
||||
template <typename T>
|
||||
struct par_gn_sinu
|
||||
{
|
||||
detail::en<T> en;
|
||||
T m, n, C_x, C_y;
|
||||
};
|
||||
|
||||
/* Ellipsoidal Sinusoidal only */
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_gn_sinu_ellipsoid
|
||||
: public base_t_fi<base_gn_sinu_ellipsoid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_gn_sinu<T> m_proj_parm;
|
||||
|
||||
inline base_gn_sinu_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_gn_sinu_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_forward) ellipsoid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T s, c;
|
||||
|
||||
xy_y = pj_mlfn(lp_lat, s = sin(lp_lat), c = cos(lp_lat), this->m_proj_parm.en);
|
||||
xy_x = lp_lon * c / sqrt(1. - this->m_par.es * s * s);
|
||||
}
|
||||
|
||||
// INVERSE(e_inverse) ellipsoid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T s;
|
||||
|
||||
if ((s = fabs(lp_lat = pj_inv_mlfn(xy_y, this->m_par.es, this->m_proj_parm.en))) < half_pi) {
|
||||
s = sin(lp_lat);
|
||||
lp_lon = xy_x * sqrt(1. - this->m_par.es * s * s) / cos(lp_lat);
|
||||
} else if ((s - epsilon10) < half_pi)
|
||||
lp_lon = 0.;
|
||||
else
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
/* General spherical sinusoidals */
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "gn_sinu_ellipsoid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_gn_sinu_spheroid
|
||||
: public base_t_fi<base_gn_sinu_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_gn_sinu<T> m_proj_parm;
|
||||
|
||||
inline base_gn_sinu_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_gn_sinu_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) sphere
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
if (this->m_proj_parm.m == 0.0)
|
||||
lp_lat = this->m_proj_parm.n != 1. ? aasin(this->m_proj_parm.n * sin(lp_lat)): lp_lat;
|
||||
else {
|
||||
T k, V;
|
||||
int i;
|
||||
|
||||
k = this->m_proj_parm.n * sin(lp_lat);
|
||||
for (i = max_iter; i ; --i) {
|
||||
lp_lat -= V = (this->m_proj_parm.m * lp_lat + sin(lp_lat) - k) /
|
||||
(this->m_proj_parm.m + cos(lp_lat));
|
||||
if (fabs(V) < loop_tol)
|
||||
break;
|
||||
}
|
||||
if (!i) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
}
|
||||
xy_x = this->m_proj_parm.C_x * lp_lon * (this->m_proj_parm.m + cos(lp_lat));
|
||||
xy_y = this->m_proj_parm.C_y * lp_lat;
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) sphere
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
xy_y /= this->m_proj_parm.C_y;
|
||||
lp_lat = (this->m_proj_parm.m != 0.0) ? aasin((this->m_proj_parm.m * xy_y + sin(xy_y)) / this->m_proj_parm.n) :
|
||||
( this->m_proj_parm.n != 1. ? aasin(sin(xy_y) / this->m_proj_parm.n) : xy_y );
|
||||
lp_lon = xy_x / (this->m_proj_parm.C_x * (this->m_proj_parm.m + cos(xy_y)));
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "gn_sinu_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup(Parameters& par, par_gn_sinu<T>& proj_parm)
|
||||
{
|
||||
par.es = 0;
|
||||
|
||||
proj_parm.C_x = (proj_parm.C_y = sqrt((proj_parm.m + 1.) / proj_parm.n))/(proj_parm.m + 1.);
|
||||
}
|
||||
|
||||
|
||||
// General Sinusoidal Series
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_gn_sinu(Params const& params, Parameters& par, par_gn_sinu<T>& proj_parm)
|
||||
{
|
||||
if (pj_param_f<srs::spar::n>(params, "n", srs::dpar::n, proj_parm.n)
|
||||
&& pj_param_f<srs::spar::m>(params, "m", srs::dpar::m, proj_parm.m)) {
|
||||
if (proj_parm.n <= 0 || proj_parm.m < 0)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_invalid_m_or_n) );
|
||||
} else
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_invalid_m_or_n) );
|
||||
|
||||
setup(par, proj_parm);
|
||||
}
|
||||
|
||||
// Sinusoidal (Sanson-Flamsteed)
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_sinu(Parameters& par, par_gn_sinu<T>& proj_parm)
|
||||
{
|
||||
proj_parm.en = pj_enfn<T>(par.es);
|
||||
|
||||
if (par.es != 0.0) {
|
||||
/* empty */
|
||||
} else {
|
||||
proj_parm.n = 1.;
|
||||
proj_parm.m = 0.;
|
||||
setup(par, proj_parm);
|
||||
}
|
||||
}
|
||||
|
||||
// Eckert VI
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_eck6(Parameters& par, par_gn_sinu<T>& proj_parm)
|
||||
{
|
||||
proj_parm.m = 1.;
|
||||
proj_parm.n = 2.570796326794896619231321691;
|
||||
setup(par, proj_parm);
|
||||
}
|
||||
|
||||
// McBryde-Thomas Flat-Polar Sinusoidal
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_mbtfps(Parameters& par, par_gn_sinu<T>& proj_parm)
|
||||
{
|
||||
proj_parm.m = 0.5;
|
||||
proj_parm.n = 1.785398163397448309615660845;
|
||||
setup(par, proj_parm);
|
||||
}
|
||||
|
||||
}} // namespace detail::gn_sinu
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief General Sinusoidal Series projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Projection parameters
|
||||
- m (real)
|
||||
- n (real)
|
||||
\par Example
|
||||
\image html ex_gn_sinu.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct gn_sinu_spheroid : public detail::gn_sinu::base_gn_sinu_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline gn_sinu_spheroid(Params const& params, Parameters const& par)
|
||||
: detail::gn_sinu::base_gn_sinu_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::gn_sinu::setup_gn_sinu(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Sinusoidal (Sanson-Flamsteed) projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Example
|
||||
\image html ex_sinu.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct sinu_ellipsoid : public detail::gn_sinu::base_gn_sinu_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline sinu_ellipsoid(Params const& , Parameters const& par)
|
||||
: detail::gn_sinu::base_gn_sinu_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::gn_sinu::setup_sinu(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Sinusoidal (Sanson-Flamsteed) projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Example
|
||||
\image html ex_sinu.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct sinu_spheroid : public detail::gn_sinu::base_gn_sinu_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline sinu_spheroid(Params const& , Parameters const& par)
|
||||
: detail::gn_sinu::base_gn_sinu_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::gn_sinu::setup_sinu(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Eckert VI projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_eck6.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct eck6_spheroid : public detail::gn_sinu::base_gn_sinu_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline eck6_spheroid(Params const& , Parameters const& par)
|
||||
: detail::gn_sinu::base_gn_sinu_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::gn_sinu::setup_eck6(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief McBryde-Thomas Flat-Polar Sinusoidal projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_mbtfps.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct mbtfps_spheroid : public detail::gn_sinu::base_gn_sinu_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline mbtfps_spheroid(Params const& , Parameters const& par)
|
||||
: detail::gn_sinu::base_gn_sinu_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::gn_sinu::setup_mbtfps(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_gn_sinu, gn_sinu_spheroid, gn_sinu_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_sinu, sinu_spheroid, sinu_ellipsoid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_eck6, eck6_spheroid, eck6_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_mbtfps, mbtfps_spheroid, mbtfps_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(gn_sinu_entry, gn_sinu_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(sinu_entry, sinu_spheroid, sinu_ellipsoid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(eck6_entry, eck6_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(mbtfps_entry, mbtfps_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(gn_sinu_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(gn_sinu, gn_sinu_entry);
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(sinu, sinu_entry);
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(eck6, eck6_entry);
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(mbtfps, mbtfps_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_GN_SINU_HPP
|
||||
|
||||
256
linx64/include/boost/geometry/srs/projections/proj/gnom.hpp
Normal file
256
linx64/include/boost/geometry/srs/projections/proj/gnom.hpp
Normal file
@@ -0,0 +1,256 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_GNOM_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_GNOM_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
#include <boost/math/special_functions/hypot.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace gnom
|
||||
{
|
||||
|
||||
static const double epsilon10 = 1.e-10;
|
||||
enum mode_type {
|
||||
n_pole = 0,
|
||||
s_pole = 1,
|
||||
equit = 2,
|
||||
obliq = 3
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct par_gnom
|
||||
{
|
||||
T sinph0;
|
||||
T cosph0;
|
||||
mode_type mode;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_gnom_spheroid
|
||||
: public base_t_fi<base_gnom_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_gnom<T> m_proj_parm;
|
||||
|
||||
inline base_gnom_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_gnom_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T coslam, cosphi, sinphi;
|
||||
|
||||
sinphi = sin(lp_lat);
|
||||
cosphi = cos(lp_lat);
|
||||
coslam = cos(lp_lon);
|
||||
|
||||
switch (this->m_proj_parm.mode) {
|
||||
case equit:
|
||||
xy_y = cosphi * coslam;
|
||||
break;
|
||||
case obliq:
|
||||
xy_y = this->m_proj_parm.sinph0 * sinphi + this->m_proj_parm.cosph0 * cosphi * coslam;
|
||||
break;
|
||||
case s_pole:
|
||||
xy_y = - sinphi;
|
||||
break;
|
||||
case n_pole:
|
||||
xy_y = sinphi;
|
||||
break;
|
||||
}
|
||||
|
||||
if (xy_y <= epsilon10) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
|
||||
xy_x = (xy_y = 1. / xy_y) * cosphi * sin(lp_lon);
|
||||
switch (this->m_proj_parm.mode) {
|
||||
case equit:
|
||||
xy_y *= sinphi;
|
||||
break;
|
||||
case obliq:
|
||||
xy_y *= this->m_proj_parm.cosph0 * sinphi - this->m_proj_parm.sinph0 * cosphi * coslam;
|
||||
break;
|
||||
case n_pole:
|
||||
coslam = - coslam;
|
||||
BOOST_FALLTHROUGH;
|
||||
case s_pole:
|
||||
xy_y *= cosphi * coslam;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T rh, cosz, sinz;
|
||||
|
||||
rh = boost::math::hypot(xy_x, xy_y);
|
||||
sinz = sin(lp_lat = atan(rh));
|
||||
cosz = sqrt(1. - sinz * sinz);
|
||||
|
||||
if (fabs(rh) <= epsilon10) {
|
||||
lp_lat = this->m_par.phi0;
|
||||
lp_lon = 0.;
|
||||
} else {
|
||||
switch (this->m_proj_parm.mode) {
|
||||
case obliq:
|
||||
lp_lat = cosz * this->m_proj_parm.sinph0 + xy_y * sinz * this->m_proj_parm.cosph0 / rh;
|
||||
if (fabs(lp_lat) >= 1.)
|
||||
lp_lat = lp_lat > 0. ? half_pi : -half_pi;
|
||||
else
|
||||
lp_lat = asin(lp_lat);
|
||||
xy_y = (cosz - this->m_proj_parm.sinph0 * sin(lp_lat)) * rh;
|
||||
xy_x *= sinz * this->m_proj_parm.cosph0;
|
||||
break;
|
||||
case equit:
|
||||
lp_lat = xy_y * sinz / rh;
|
||||
if (fabs(lp_lat) >= 1.)
|
||||
lp_lat = lp_lat > 0. ? half_pi : -half_pi;
|
||||
else
|
||||
lp_lat = asin(lp_lat);
|
||||
xy_y = cosz * rh;
|
||||
xy_x *= sinz;
|
||||
break;
|
||||
case s_pole:
|
||||
lp_lat -= half_pi;
|
||||
break;
|
||||
case n_pole:
|
||||
lp_lat = half_pi - lp_lat;
|
||||
xy_y = -xy_y;
|
||||
break;
|
||||
}
|
||||
lp_lon = atan2(xy_x, xy_y);
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "gnom_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Gnomonic
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_gnom(Parameters& par, par_gnom<T>& proj_parm)
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
if (fabs(fabs(par.phi0) - half_pi) < epsilon10) {
|
||||
proj_parm.mode = par.phi0 < 0. ? s_pole : n_pole;
|
||||
} else if (fabs(par.phi0) < epsilon10) {
|
||||
proj_parm.mode = equit;
|
||||
} else {
|
||||
proj_parm.mode = obliq;
|
||||
proj_parm.sinph0 = sin(par.phi0);
|
||||
proj_parm.cosph0 = cos(par.phi0);
|
||||
}
|
||||
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::gnom
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Gnomonic projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Azimuthal
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_gnom.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct gnom_spheroid : public detail::gnom::base_gnom_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline gnom_spheroid(Params const& , Parameters const& par)
|
||||
: detail::gnom::base_gnom_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::gnom::setup_gnom(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_gnom, gnom_spheroid, gnom_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(gnom_entry, gnom_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(gnom_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(gnom, gnom_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_GNOM_HPP
|
||||
|
||||
190
linx64/include/boost/geometry/srs/projections/proj/goode.hpp
Normal file
190
linx64/include/boost/geometry/srs/projections/proj/goode.hpp
Normal file
@@ -0,0 +1,190 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_GOODE_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_GOODE_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/proj/gn_sinu.hpp>
|
||||
#include <boost/geometry/srs/projections/proj/moll.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace goode
|
||||
{
|
||||
|
||||
static const double Y_COR = 0.05280;
|
||||
static const double PHI_LIM = .71093078197902358062;
|
||||
|
||||
// TODO: consider storing references to Parameters instead of copies
|
||||
template <typename T, typename Par>
|
||||
struct par_goode
|
||||
{
|
||||
sinu_spheroid<T, Par> sinu;
|
||||
moll_spheroid<T, Par> moll;
|
||||
|
||||
template <typename Params>
|
||||
par_goode(Params const& params, Par const& par)
|
||||
: sinu(params, par), moll(params, par)
|
||||
{}
|
||||
};
|
||||
|
||||
template <typename T, typename Par>
|
||||
inline void s_forward(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y,
|
||||
par_goode<T, Par> const& proj_par)
|
||||
{
|
||||
if (fabs(lp_lat) <= PHI_LIM)
|
||||
proj_par.sinu.fwd(lp_lon, lp_lat, xy_x, xy_y);
|
||||
else {
|
||||
proj_par.moll.fwd(lp_lon, lp_lat, xy_x, xy_y);
|
||||
xy_y -= lp_lat >= 0.0 ? Y_COR : -Y_COR;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T, typename Par>
|
||||
inline void s_inverse(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat,
|
||||
par_goode<T, Par> const& proj_par)
|
||||
{
|
||||
if (fabs(xy_y) <= PHI_LIM)
|
||||
proj_par.sinu.inv(xy_x, xy_y, lp_lon, lp_lat);
|
||||
else {
|
||||
xy_y += xy_y >= 0.0 ? Y_COR : -Y_COR;
|
||||
proj_par.moll.inv(xy_x, xy_y, lp_lon, lp_lat);
|
||||
}
|
||||
}
|
||||
|
||||
// Goode Homolosine
|
||||
template <typename Par>
|
||||
inline void setup_goode(Par& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
|
||||
// NOTE: The following explicit initialization of sinu projection
|
||||
// is not needed because setup_goode() is called before proj_par.sinu
|
||||
// is constructed and m_par of parent projection is used.
|
||||
|
||||
//proj_par.sinu.m_par.es = 0.;
|
||||
//detail::gn_sinu::setup_sinu(proj_par.sinu.m_par, proj_par.sinu.m_proj_parm);
|
||||
}
|
||||
|
||||
}} // namespace detail::goode
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Goode Homolosine projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_goode.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct goode_spheroid : public detail::base_t_fi<goode_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
detail::goode::par_goode<T, Parameters> m_proj_parm;
|
||||
|
||||
template <typename Params>
|
||||
inline goode_spheroid(Params const& params, Parameters const& par)
|
||||
: detail::base_t_fi<goode_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
, m_proj_parm(params, setup(this->m_par))
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
detail::goode::s_forward(lp_lon, lp_lat, xy_x, xy_y, this->m_proj_parm);
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
detail::goode::s_inverse(xy_x, xy_y, lp_lon, lp_lat, this->m_proj_parm);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "goode_spheroid";
|
||||
}
|
||||
|
||||
private:
|
||||
static Parameters& setup(Parameters& par)
|
||||
{
|
||||
detail::goode::setup_goode(par);
|
||||
return par;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_goode, goode_spheroid, goode_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(goode_entry, goode_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(goode_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(goode, goode_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_GOODE_HPP
|
||||
|
||||
183
linx64/include/boost/geometry/srs/projections/proj/gstmerc.hpp
Normal file
183
linx64/include/boost/geometry/srs/projections/proj/gstmerc.hpp
Normal file
@@ -0,0 +1,183 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_GSTMERC_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_GSTMERC_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_phi2.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_tsfn.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace gstmerc
|
||||
{
|
||||
template <typename T>
|
||||
struct par_gstmerc
|
||||
{
|
||||
T lamc;
|
||||
T phic;
|
||||
T c;
|
||||
T n1;
|
||||
T n2;
|
||||
T XS;
|
||||
T YS;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_gstmerc_spheroid
|
||||
: public base_t_fi<base_gstmerc_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_gstmerc<T> m_proj_parm;
|
||||
|
||||
inline base_gstmerc_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_gstmerc_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T L, Ls, sinLs1, Ls1;
|
||||
|
||||
L= this->m_proj_parm.n1*lp_lon;
|
||||
Ls= this->m_proj_parm.c+this->m_proj_parm.n1*log(pj_tsfn(-1.0*lp_lat,-1.0*sin(lp_lat),this->m_par.e));
|
||||
sinLs1= sin(L)/cosh(Ls);
|
||||
Ls1= log(pj_tsfn(-1.0*asin(sinLs1),0.0,0.0));
|
||||
xy_x= (this->m_proj_parm.XS + this->m_proj_parm.n2*Ls1)*this->m_par.ra;
|
||||
xy_y= (this->m_proj_parm.YS + this->m_proj_parm.n2*atan(sinh(Ls)/cos(L)))*this->m_par.ra;
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
T L, LC, sinC;
|
||||
|
||||
L= atan(sinh((xy_x*this->m_par.a - this->m_proj_parm.XS)/this->m_proj_parm.n2)/cos((xy_y*this->m_par.a - this->m_proj_parm.YS)/this->m_proj_parm.n2));
|
||||
sinC= sin((xy_y*this->m_par.a - this->m_proj_parm.YS)/this->m_proj_parm.n2)/cosh((xy_x*this->m_par.a - this->m_proj_parm.XS)/this->m_proj_parm.n2);
|
||||
LC= log(pj_tsfn(-1.0*asin(sinC),0.0,0.0));
|
||||
lp_lon= L/this->m_proj_parm.n1;
|
||||
lp_lat= -1.0*pj_phi2(exp((LC-this->m_proj_parm.c)/this->m_proj_parm.n1),this->m_par.e);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "gstmerc_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Gauss-Schreiber Transverse Mercator (aka Gauss-Laborde Reunion)
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_gstmerc(Parameters& par, par_gstmerc<T>& proj_parm)
|
||||
{
|
||||
proj_parm.lamc= par.lam0;
|
||||
proj_parm.n1= sqrt(T(1)+par.es*math::pow(cos(par.phi0),4)/(T(1)-par.es));
|
||||
proj_parm.phic= asin(sin(par.phi0)/proj_parm.n1);
|
||||
proj_parm.c= log(pj_tsfn(-1.0*proj_parm.phic,0.0,0.0))
|
||||
- proj_parm.n1*log(pj_tsfn(-1.0*par.phi0,-1.0*sin(par.phi0),par.e));
|
||||
proj_parm.n2= par.k0*par.a*sqrt(1.0-par.es)/(1.0-par.es*sin(par.phi0)*sin(par.phi0));
|
||||
proj_parm.XS= 0;/* -par.x0 */
|
||||
proj_parm.YS= -1.0*proj_parm.n2*proj_parm.phic;/* -par.y0 */
|
||||
}
|
||||
|
||||
}} // namespace detail::gstmerc
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Gauss-Schreiber Transverse Mercator (aka Gauss-Laborde Reunion) projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Projection parameters
|
||||
- lat_0: Latitude of origin
|
||||
- lon_0: Central meridian
|
||||
- k_0: Scale factor
|
||||
\par Example
|
||||
\image html ex_gstmerc.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct gstmerc_spheroid : public detail::gstmerc::base_gstmerc_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline gstmerc_spheroid(Params const& , Parameters const& par)
|
||||
: detail::gstmerc::base_gstmerc_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::gstmerc::setup_gstmerc(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_gstmerc, gstmerc_spheroid, gstmerc_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(gstmerc_entry, gstmerc_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(gstmerc_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(gstmerc, gstmerc_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_GSTMERC_HPP
|
||||
|
||||
188
linx64/include/boost/geometry/srs/projections/proj/hammer.hpp
Normal file
188
linx64/include/boost/geometry/srs/projections/proj/hammer.hpp
Normal file
@@ -0,0 +1,188 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_HAMMER_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_HAMMER_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace hammer
|
||||
{
|
||||
static const double epsilon = 1.0e-10;
|
||||
|
||||
template <typename T>
|
||||
struct par_hammer
|
||||
{
|
||||
T w;
|
||||
T m, rm;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_hammer_spheroid
|
||||
: public base_t_fi<base_hammer_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_hammer<T> m_proj_parm;
|
||||
|
||||
inline base_hammer_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_hammer_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T cosphi, d;
|
||||
|
||||
d = sqrt(2./(1. + (cosphi = cos(lp_lat)) * cos(lp_lon *= this->m_proj_parm.w)));
|
||||
xy_x = this->m_proj_parm.m * d * cosphi * sin(lp_lon);
|
||||
xy_y = this->m_proj_parm.rm * d * sin(lp_lat);
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
T z;
|
||||
|
||||
z = sqrt(1. - 0.25*this->m_proj_parm.w*this->m_proj_parm.w*xy_x*xy_x - 0.25*xy_y*xy_y);
|
||||
if (geometry::math::abs(2.*z*z-1.) < epsilon) {
|
||||
lp_lon = HUGE_VAL;
|
||||
lp_lat = HUGE_VAL;
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_lat_or_lon_exceed_limit) );
|
||||
} else {
|
||||
lp_lon = aatan2(this->m_proj_parm.w * xy_x * z,2. * z * z - 1)/this->m_proj_parm.w;
|
||||
lp_lat = aasin(z * xy_y);
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "hammer_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Hammer & Eckert-Greifendorff
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_hammer(Params const& params, Parameters& par, par_hammer<T>& proj_parm)
|
||||
{
|
||||
T tmp;
|
||||
|
||||
if (pj_param_f<srs::spar::w>(params, "W", srs::dpar::w, tmp)) {
|
||||
if ((proj_parm.w = fabs(tmp)) <= 0.)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_w_or_m_zero_or_less) );
|
||||
} else
|
||||
proj_parm.w = .5;
|
||||
if (pj_param_f<srs::spar::m>(params, "M", srs::dpar::m, tmp)) {
|
||||
if ((proj_parm.m = fabs(tmp)) <= 0.)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_w_or_m_zero_or_less) );
|
||||
} else
|
||||
proj_parm.m = 1.;
|
||||
|
||||
proj_parm.rm = 1. / proj_parm.m;
|
||||
proj_parm.m /= proj_parm.w;
|
||||
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::hammer
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Hammer & Eckert-Greifendorff projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
- no inverse
|
||||
\par Projection parameters
|
||||
- W (real)
|
||||
- M (real)
|
||||
\par Example
|
||||
\image html ex_hammer.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct hammer_spheroid : public detail::hammer::base_hammer_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline hammer_spheroid(Params const& params, Parameters const& par)
|
||||
: detail::hammer::base_hammer_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::hammer::setup_hammer(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_hammer, hammer_spheroid, hammer_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(hammer_entry, hammer_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(hammer_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(hammer, hammer_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_HAMMER_HPP
|
||||
|
||||
194
linx64/include/boost/geometry/srs/projections/proj/hatano.hpp
Normal file
194
linx64/include/boost/geometry/srs/projections/proj/hatano.hpp
Normal file
@@ -0,0 +1,194 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_HATANO_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_HATANO_HPP
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace hatano
|
||||
{
|
||||
|
||||
static const int n_iter = 20;
|
||||
static const double epsilon = 1e-7;
|
||||
static const double one_plus_tol = 1.000001;
|
||||
static const double CN_ = 2.67595;
|
||||
static const double CS_ = 2.43763;
|
||||
static const double RCN = 0.37369906014686373063;
|
||||
static const double RCS = 0.41023453108141924738;
|
||||
static const double FYCN = 1.75859;
|
||||
static const double FYCS = 1.93052;
|
||||
static const double RYCN = 0.56863737426006061674;
|
||||
static const double RYCS = 0.51799515156538134803;
|
||||
static const double FXC = 0.85;
|
||||
static const double RXC = 1.17647058823529411764;
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_hatano_spheroid
|
||||
: public base_t_fi<base_hatano_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_hatano_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_hatano_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T th1, c;
|
||||
int i;
|
||||
|
||||
c = sin(lp_lat) * (lp_lat < 0. ? CS_ : CN_);
|
||||
for (i = n_iter; i; --i) {
|
||||
lp_lat -= th1 = (lp_lat + sin(lp_lat) - c) / (1. + cos(lp_lat));
|
||||
if (fabs(th1) < epsilon) break;
|
||||
}
|
||||
xy_x = FXC * lp_lon * cos(lp_lat *= .5);
|
||||
xy_y = sin(lp_lat) * (lp_lat < 0. ? FYCS : FYCN);
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static T const half_pi = detail::half_pi<T>();
|
||||
|
||||
T th;
|
||||
|
||||
th = xy_y * ( xy_y < 0. ? RYCS : RYCN);
|
||||
if (fabs(th) > 1.) {
|
||||
if (fabs(th) > one_plus_tol) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
} else {
|
||||
th = th > 0. ? half_pi : - half_pi;
|
||||
}
|
||||
} else {
|
||||
th = asin(th);
|
||||
}
|
||||
|
||||
lp_lon = RXC * xy_x / cos(th);
|
||||
th += th;
|
||||
lp_lat = (th + sin(th)) * (xy_y < 0. ? RCS : RCN);
|
||||
if (fabs(lp_lat) > 1.) {
|
||||
if (fabs(lp_lat) > one_plus_tol) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
} else {
|
||||
lp_lat = lp_lat > 0. ? half_pi : - half_pi;
|
||||
}
|
||||
} else {
|
||||
lp_lat = asin(lp_lat);
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "hatano_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Hatano Asymmetrical Equal Area
|
||||
template <typename Parameters>
|
||||
inline void setup_hatano(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::hatano
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Hatano Asymmetrical Equal Area projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_hatano.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct hatano_spheroid : public detail::hatano::base_hatano_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline hatano_spheroid(Params const& , Parameters const& par)
|
||||
: detail::hatano::base_hatano_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::hatano::setup_hatano(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_hatano, hatano_spheroid, hatano_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(hatano_entry, hatano_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(hatano_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(hatano, hatano_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_HATANO_HPP
|
||||
|
||||
873
linx64/include/boost/geometry/srs/projections/proj/healpix.hpp
Normal file
873
linx64/include/boost/geometry/srs/projections/proj/healpix.hpp
Normal file
@@ -0,0 +1,873 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Purpose: Implementation of the HEALPix and rHEALPix projections.
|
||||
// For background see <http://code.scenzgrid.org/index.php/p/scenzgrid-py/source/tree/master/docs/rhealpix_dggs.pdf>.
|
||||
// Authors: Alex Raichev (raichev@cs.auckland.ac.nz)
|
||||
// Michael Speth (spethm@landcareresearch.co.nz)
|
||||
// Notes: Raichev implemented these projections in Python and
|
||||
// Speth translated them into C here.
|
||||
|
||||
// Copyright (c) 2001, Thomas Flemming, tf@ttqv.com
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_HEALPIX_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_HEALPIX_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_auth.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_qsfn.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace healpix
|
||||
{
|
||||
|
||||
/* Fuzz to handle rounding errors: */
|
||||
static const double epsilon = 1e-15;
|
||||
|
||||
template <typename T>
|
||||
struct par_healpix
|
||||
{
|
||||
int north_square;
|
||||
int south_square;
|
||||
T qp;
|
||||
detail::apa<T> apa;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct cap_map
|
||||
{
|
||||
int cn; /* An integer 0--3 indicating the position of the polar cap. */
|
||||
T x, y; /* Coordinates of the pole point (point of most extreme latitude on the polar caps). */
|
||||
enum region_type {north, south, equatorial} region;
|
||||
};
|
||||
template <typename T>
|
||||
struct point_xy
|
||||
{
|
||||
T x, y;
|
||||
};
|
||||
|
||||
/* IDENT, R1, R2, R3, R1 inverse, R2 inverse, R3 inverse:*/
|
||||
static double rot[7][2][2] = {
|
||||
/* Identity matrix */
|
||||
{{1, 0},{0, 1}},
|
||||
/* Matrix for counterclockwise rotation by pi/2: */
|
||||
{{ 0,-1},{ 1, 0}},
|
||||
/* Matrix for counterclockwise rotation by pi: */
|
||||
{{-1, 0},{ 0,-1}},
|
||||
/* Matrix for counterclockwise rotation by 3*pi/2: */
|
||||
{{ 0, 1},{-1, 0}},
|
||||
{{ 0, 1},{-1, 0}}, // 3*pi/2
|
||||
{{-1, 0},{ 0,-1}}, // pi
|
||||
{{ 0,-1},{ 1, 0}} // pi/2
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the sign of the double.
|
||||
* @param v the parameter whose sign is returned.
|
||||
* @return 1 for positive number, -1 for negative, and 0 for zero.
|
||||
**/
|
||||
template <typename T>
|
||||
inline T pj_sign (T const& v)
|
||||
{
|
||||
return v > 0 ? 1 : (v < 0 ? -1 : 0);
|
||||
}
|
||||
/**
|
||||
* Return the index of the matrix in {{{1, 0},{0, 1}}, {{ 0,-1},{ 1, 0}}, {{-1, 0},{ 0,-1}}, {{ 0, 1},{-1, 0}}, {{ 0, 1},{-1, 0}}, {{-1, 0},{ 0,-1}}, {{ 0,-1},{ 1, 0}}}.
|
||||
* @param index ranges from -3 to 3.
|
||||
*/
|
||||
inline int get_rotate_index(int index)
|
||||
{
|
||||
switch(index) {
|
||||
case 0:
|
||||
return 0;
|
||||
case 1:
|
||||
return 1;
|
||||
case 2:
|
||||
return 2;
|
||||
case 3:
|
||||
return 3;
|
||||
case -1:
|
||||
return 4;
|
||||
case -2:
|
||||
return 5;
|
||||
case -3:
|
||||
return 6;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
* Return 1 if point (testx, testy) lies in the interior of the polygon
|
||||
* determined by the vertices in vert, and return 0 otherwise.
|
||||
* See http://paulbourke.net/geometry/polygonmesh/ for more details.
|
||||
* @param nvert the number of vertices in the polygon.
|
||||
* @param vert the (x, y)-coordinates of the polygon's vertices
|
||||
**/
|
||||
template <typename T>
|
||||
inline int pnpoly(int nvert, T vert[][2], T const& testx, T const& testy)
|
||||
{
|
||||
int i;
|
||||
int counter = 0;
|
||||
T xinters;
|
||||
point_xy<T> p1, p2;
|
||||
|
||||
/* Check for boundrary cases */
|
||||
for (i = 0; i < nvert; i++) {
|
||||
if (testx == vert[i][0] && testy == vert[i][1]) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
p1.x = vert[0][0];
|
||||
p1.y = vert[0][1];
|
||||
|
||||
for (i = 1; i < nvert; i++) {
|
||||
p2.x = vert[i % nvert][0];
|
||||
p2.y = vert[i % nvert][1];
|
||||
if (testy > (std::min)(p1.y, p2.y) &&
|
||||
testy <= (std::max)(p1.y, p2.y) &&
|
||||
testx <= (std::max)(p1.x, p2.x) &&
|
||||
p1.y != p2.y)
|
||||
{
|
||||
xinters = (testy-p1.y)*(p2.x-p1.x)/(p2.y-p1.y)+p1.x;
|
||||
if (p1.x == p2.x || testx <= xinters)
|
||||
counter++;
|
||||
}
|
||||
p1 = p2;
|
||||
}
|
||||
|
||||
if (counter % 2 == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Return 1 if (x, y) lies in (the interior or boundary of) the image of the
|
||||
* HEALPix projection (in case proj=0) or in the image the rHEALPix projection
|
||||
* (in case proj=1), and return 0 otherwise.
|
||||
* @param north_square the position of the north polar square (rHEALPix only)
|
||||
* @param south_square the position of the south polar square (rHEALPix only)
|
||||
**/
|
||||
template <typename T>
|
||||
inline int in_image(T const& x, T const& y, int proj, int north_square, int south_square)
|
||||
{
|
||||
static const T pi = detail::pi<T>();
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
static const T fourth_pi = detail::fourth_pi<T>();
|
||||
|
||||
if (proj == 0) {
|
||||
T healpixVertsJit[][2] = {
|
||||
{-pi - epsilon, fourth_pi},
|
||||
{-3.0*fourth_pi, half_pi + epsilon},
|
||||
{-half_pi, fourth_pi + epsilon},
|
||||
{-fourth_pi, half_pi + epsilon},
|
||||
{0.0, fourth_pi + epsilon},
|
||||
{fourth_pi, half_pi + epsilon},
|
||||
{half_pi, fourth_pi + epsilon},
|
||||
{3.0*fourth_pi, half_pi + epsilon},
|
||||
{pi + epsilon, fourth_pi},
|
||||
{pi + epsilon, -fourth_pi},
|
||||
{3.0*fourth_pi, -half_pi - epsilon},
|
||||
{half_pi, -fourth_pi - epsilon},
|
||||
{fourth_pi, -half_pi - epsilon},
|
||||
{0.0, -fourth_pi - epsilon},
|
||||
{-fourth_pi, -half_pi - epsilon},
|
||||
{-half_pi, -fourth_pi - epsilon},
|
||||
{-3.0*fourth_pi, -half_pi - epsilon},
|
||||
{-pi - epsilon, -fourth_pi}
|
||||
};
|
||||
return pnpoly((int)sizeof(healpixVertsJit)/
|
||||
sizeof(healpixVertsJit[0]), healpixVertsJit, x, y);
|
||||
} else {
|
||||
T rhealpixVertsJit[][2] = {
|
||||
{-pi - epsilon, fourth_pi + epsilon},
|
||||
{-pi + north_square*half_pi - epsilon, fourth_pi + epsilon},
|
||||
{-pi + north_square*half_pi - epsilon, 3.0*fourth_pi + epsilon},
|
||||
{-pi + (north_square + 1.0)*half_pi + epsilon, 3.0*fourth_pi + epsilon},
|
||||
{-pi + (north_square + 1.0)*half_pi + epsilon, fourth_pi + epsilon},
|
||||
{pi + epsilon, fourth_pi + epsilon},
|
||||
{pi + epsilon, -fourth_pi - epsilon},
|
||||
{-pi + (south_square + 1.0)*half_pi + epsilon, -fourth_pi - epsilon},
|
||||
{-pi + (south_square + 1.0)*half_pi + epsilon, -3.0*fourth_pi - epsilon},
|
||||
{-pi + south_square*half_pi - epsilon, -3.0*fourth_pi - epsilon},
|
||||
{-pi + south_square*half_pi - epsilon, -fourth_pi - epsilon},
|
||||
{-pi - epsilon, -fourth_pi - epsilon}
|
||||
};
|
||||
|
||||
return pnpoly((int)sizeof(rhealpixVertsJit)/
|
||||
sizeof(rhealpixVertsJit[0]), rhealpixVertsJit, x, y);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Return the authalic latitude of latitude alpha (if inverse=0) or
|
||||
* return the approximate latitude of authalic latitude alpha (if inverse=1).
|
||||
* P contains the relavent ellipsoid parameters.
|
||||
**/
|
||||
template <typename Parameters, typename T>
|
||||
inline T auth_lat(const Parameters& par, const par_healpix<T>& proj_parm, T const& alpha, int inverse)
|
||||
{
|
||||
if (inverse == 0) {
|
||||
/* Authalic latitude. */
|
||||
T q = pj_qsfn(sin(alpha), par.e, 1.0 - par.es);
|
||||
T qp = proj_parm.qp;
|
||||
T ratio = q/qp;
|
||||
|
||||
if (math::abs(ratio) > 1) {
|
||||
/* Rounding error. */
|
||||
ratio = pj_sign(ratio);
|
||||
}
|
||||
|
||||
return asin(ratio);
|
||||
} else {
|
||||
/* Approximation to inverse authalic latitude. */
|
||||
return pj_authlat(alpha, proj_parm.apa);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Return the HEALPix projection of the longitude-latitude point lp on
|
||||
* the unit sphere.
|
||||
**/
|
||||
template <typename T>
|
||||
inline void healpix_sphere(T const& lp_lam, T const& lp_phi, T& xy_x, T& xy_y)
|
||||
{
|
||||
static const T pi = detail::pi<T>();
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
static const T fourth_pi = detail::fourth_pi<T>();
|
||||
|
||||
T lam = lp_lam;
|
||||
T phi = lp_phi;
|
||||
T phi0 = asin(T(2.0)/T(3.0));
|
||||
|
||||
/* equatorial region */
|
||||
if ( fabsl(phi) <= phi0) {
|
||||
xy_x = lam;
|
||||
xy_y = 3.0*pi/8.0*sin(phi);
|
||||
} else {
|
||||
T lamc;
|
||||
T sigma = sqrt(3.0*(1 - math::abs(sin(phi))));
|
||||
T cn = floor(2*lam / pi + 2);
|
||||
if (cn >= 4) {
|
||||
cn = 3;
|
||||
}
|
||||
lamc = -3*fourth_pi + half_pi*cn;
|
||||
xy_x = lamc + (lam - lamc)*sigma;
|
||||
xy_y = pj_sign(phi)*fourth_pi*(2 - sigma);
|
||||
}
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Return the inverse of healpix_sphere().
|
||||
**/
|
||||
template <typename T>
|
||||
inline void healpix_sphere_inverse(T const& xy_x, T const& xy_y, T& lp_lam, T& lp_phi)
|
||||
{
|
||||
static const T pi = detail::pi<T>();
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
static const T fourth_pi = detail::fourth_pi<T>();
|
||||
|
||||
T x = xy_x;
|
||||
T y = xy_y;
|
||||
T y0 = fourth_pi;
|
||||
|
||||
/* Equatorial region. */
|
||||
if (math::abs(y) <= y0) {
|
||||
lp_lam = x;
|
||||
lp_phi = asin(8.0*y/(3.0*pi));
|
||||
} else if (fabsl(y) < half_pi) {
|
||||
T cn = floor(2.0*x/pi + 2.0);
|
||||
T xc, tau;
|
||||
if (cn >= 4) {
|
||||
cn = 3;
|
||||
}
|
||||
xc = -3.0*fourth_pi + (half_pi)*cn;
|
||||
tau = 2.0 - 4.0*fabsl(y)/pi;
|
||||
lp_lam = xc + (x - xc)/tau;
|
||||
lp_phi = pj_sign(y)*asin(1.0 - math::pow(tau, 2)/3.0);
|
||||
} else {
|
||||
lp_lam = -1.0*pi;
|
||||
lp_phi = pj_sign(y)*half_pi;
|
||||
}
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Return the vector sum a + b, where a and b are 2-dimensional vectors.
|
||||
* @param ret holds a + b.
|
||||
**/
|
||||
template <typename T>
|
||||
inline void vector_add(const T a[2], const T b[2], T ret[2])
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < 2; i++) {
|
||||
ret[i] = a[i] + b[i];
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Return the vector difference a - b, where a and b are 2-dimensional vectors.
|
||||
* @param ret holds a - b.
|
||||
**/
|
||||
template <typename T>
|
||||
inline void vector_sub(const T a[2], const T b[2], T ret[2])
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < 2; i++) {
|
||||
ret[i] = a[i] - b[i];
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Return the 2 x 1 matrix product a*b, where a is a 2 x 2 matrix and
|
||||
* b is a 2 x 1 matrix.
|
||||
* @param ret holds a*b.
|
||||
**/
|
||||
template <typename T1, typename T2>
|
||||
inline void dot_product(const T1 a[2][2], const T2 b[2], T2 ret[2])
|
||||
{
|
||||
int i, j;
|
||||
int length = 2;
|
||||
for(i = 0; i < length; i++) {
|
||||
ret[i] = 0;
|
||||
for(j = 0; j < length; j++) {
|
||||
ret[i] += a[i][j]*b[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Return the number of the polar cap, the pole point coordinates, and
|
||||
* the region that (x, y) lies in.
|
||||
* If inverse=0, then assume (x,y) lies in the image of the HEALPix
|
||||
* projection of the unit sphere.
|
||||
* If inverse=1, then assume (x,y) lies in the image of the
|
||||
* (north_square, south_square)-rHEALPix projection of the unit sphere.
|
||||
**/
|
||||
template <typename T>
|
||||
inline cap_map<T> get_cap(T x, T const& y, int north_square, int south_square,
|
||||
int inverse)
|
||||
{
|
||||
static const T pi = detail::pi<T>();
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
static const T fourth_pi = detail::fourth_pi<T>();
|
||||
|
||||
cap_map<T> capmap;
|
||||
T c;
|
||||
capmap.x = x;
|
||||
capmap.y = y;
|
||||
if (inverse == 0) {
|
||||
if (y > fourth_pi) {
|
||||
capmap.region = cap_map<T>::north;
|
||||
c = half_pi;
|
||||
} else if (y < -fourth_pi) {
|
||||
capmap.region = cap_map<T>::south;
|
||||
c = -half_pi;
|
||||
} else {
|
||||
capmap.region = cap_map<T>::equatorial;
|
||||
capmap.cn = 0;
|
||||
return capmap;
|
||||
}
|
||||
/* polar region */
|
||||
if (x < -half_pi) {
|
||||
capmap.cn = 0;
|
||||
capmap.x = (-3.0*fourth_pi);
|
||||
capmap.y = c;
|
||||
} else if (x >= -half_pi && x < 0) {
|
||||
capmap.cn = 1;
|
||||
capmap.x = -fourth_pi;
|
||||
capmap.y = c;
|
||||
} else if (x >= 0 && x < half_pi) {
|
||||
capmap.cn = 2;
|
||||
capmap.x = fourth_pi;
|
||||
capmap.y = c;
|
||||
} else {
|
||||
capmap.cn = 3;
|
||||
capmap.x = 3.0*fourth_pi;
|
||||
capmap.y = c;
|
||||
}
|
||||
} else {
|
||||
if (y > fourth_pi) {
|
||||
capmap.region = cap_map<T>::north;
|
||||
capmap.x = (-3.0*fourth_pi + north_square*half_pi);
|
||||
capmap.y = half_pi;
|
||||
x = x - north_square*half_pi;
|
||||
} else if (y < -fourth_pi) {
|
||||
capmap.region = cap_map<T>::south;
|
||||
capmap.x = (-3.0*fourth_pi + south_square*pi/2);
|
||||
capmap.y = -half_pi;
|
||||
x = x - south_square*half_pi;
|
||||
} else {
|
||||
capmap.region = cap_map<T>::equatorial;
|
||||
capmap.cn = 0;
|
||||
return capmap;
|
||||
}
|
||||
/* Polar Region, find the HEALPix polar cap number that
|
||||
x, y moves to when rHEALPix polar square is disassembled. */
|
||||
if (capmap.region == cap_map<T>::north) {
|
||||
if (y >= -x - fourth_pi - epsilon && y < x + 5.0*fourth_pi - epsilon) {
|
||||
capmap.cn = (north_square + 1) % 4;
|
||||
} else if (y > -x -fourth_pi + epsilon && y >= x + 5.0*fourth_pi - epsilon) {
|
||||
capmap.cn = (north_square + 2) % 4;
|
||||
} else if (y <= -x -fourth_pi + epsilon && y > x + 5.0*fourth_pi + epsilon) {
|
||||
capmap.cn = (north_square + 3) % 4;
|
||||
} else {
|
||||
capmap.cn = north_square;
|
||||
}
|
||||
} else if (capmap.region == cap_map<T>::south) {
|
||||
if (y <= x + fourth_pi + epsilon && y > -x - 5.0*fourth_pi + epsilon) {
|
||||
capmap.cn = (south_square + 1) % 4;
|
||||
} else if (y < x + fourth_pi - epsilon && y <= -x - 5.0*fourth_pi + epsilon) {
|
||||
capmap.cn = (south_square + 2) % 4;
|
||||
} else if (y >= x + fourth_pi - epsilon && y < -x - 5.0*fourth_pi - epsilon) {
|
||||
capmap.cn = (south_square + 3) % 4;
|
||||
} else {
|
||||
capmap.cn = south_square;
|
||||
}
|
||||
}
|
||||
}
|
||||
return capmap;
|
||||
}
|
||||
/**
|
||||
* Rearrange point (x, y) in the HEALPix projection by
|
||||
* combining the polar caps into two polar squares.
|
||||
* Put the north polar square in position north_square and
|
||||
* the south polar square in position south_square.
|
||||
* If inverse=1, then uncombine the polar caps.
|
||||
* @param north_square integer between 0 and 3.
|
||||
* @param south_square integer between 0 and 3.
|
||||
**/
|
||||
template <typename T>
|
||||
inline void combine_caps(T& xy_x, T& xy_y, int north_square, int south_square,
|
||||
int inverse)
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
static const T fourth_pi = detail::fourth_pi<T>();
|
||||
|
||||
T v[2];
|
||||
T c[2];
|
||||
T vector[2];
|
||||
T v_min_c[2];
|
||||
T ret_dot[2];
|
||||
const double (*tmpRot)[2];
|
||||
int pole = 0;
|
||||
|
||||
cap_map<T> capmap = get_cap(xy_x, xy_y, north_square, south_square, inverse);
|
||||
if (capmap.region == cap_map<T>::equatorial) {
|
||||
xy_x = capmap.x;
|
||||
xy_y = capmap.y;
|
||||
return;
|
||||
}
|
||||
|
||||
v[0] = xy_x; v[1] = xy_y;
|
||||
c[0] = capmap.x; c[1] = capmap.y;
|
||||
|
||||
if (inverse == 0) {
|
||||
/* Rotate (xy_x, xy_y) about its polar cap tip and then translate it to
|
||||
north_square or south_square. */
|
||||
|
||||
if (capmap.region == cap_map<T>::north) {
|
||||
pole = north_square;
|
||||
tmpRot = rot[get_rotate_index(capmap.cn - pole)];
|
||||
} else {
|
||||
pole = south_square;
|
||||
tmpRot = rot[get_rotate_index(-1*(capmap.cn - pole))];
|
||||
}
|
||||
} else {
|
||||
/* Inverse function.
|
||||
Unrotate (xy_x, xy_y) and then translate it back. */
|
||||
|
||||
/* disassemble */
|
||||
if (capmap.region == cap_map<T>::north) {
|
||||
pole = north_square;
|
||||
tmpRot = rot[get_rotate_index(-1*(capmap.cn - pole))];
|
||||
} else {
|
||||
pole = south_square;
|
||||
tmpRot = rot[get_rotate_index(capmap.cn - pole)];
|
||||
}
|
||||
}
|
||||
|
||||
vector_sub(v, c, v_min_c);
|
||||
dot_product(tmpRot, v_min_c, ret_dot);
|
||||
|
||||
{
|
||||
T a[2];
|
||||
/* Workaround cppcheck git issue */
|
||||
T* pa = a;
|
||||
// TODO: in proj4 5.0.0 this line is used instead
|
||||
//pa[0] = -3.0*fourth_pi + ((inverse == 0) ? 0 : capmap.cn) *half_pi;
|
||||
pa[0] = -3.0*fourth_pi + ((inverse == 0) ? pole : capmap.cn) *half_pi;
|
||||
pa[1] = half_pi;
|
||||
vector_add(ret_dot, a, vector);
|
||||
}
|
||||
|
||||
xy_x = vector[0];
|
||||
xy_y = vector[1];
|
||||
}
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_healpix_ellipsoid
|
||||
: public base_t_fi<base_healpix_ellipsoid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_healpix<T> m_proj_parm;
|
||||
|
||||
inline base_healpix_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_healpix_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_healpix_forward) ellipsoid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
lp_lat = auth_lat(this->params(), m_proj_parm, lp_lat, 0);
|
||||
return healpix_sphere(lp_lon, lp_lat, xy_x, xy_y);
|
||||
}
|
||||
|
||||
// INVERSE(e_healpix_inverse) ellipsoid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
/* Check whether (x, y) lies in the HEALPix image. */
|
||||
if (in_image(xy_x, xy_y, 0, 0, 0) == 0) {
|
||||
lp_lon = HUGE_VAL;
|
||||
lp_lat = HUGE_VAL;
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_invalid_x_or_y) );
|
||||
}
|
||||
healpix_sphere_inverse(xy_x, xy_y, lp_lon, lp_lat);
|
||||
lp_lat = auth_lat(this->params(), m_proj_parm, lp_lat, 1);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "healpix_ellipsoid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_healpix_spheroid
|
||||
: public base_t_fi<base_healpix_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_healpix<T> m_proj_parm;
|
||||
|
||||
inline base_healpix_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_healpix_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_healpix_forward) sphere
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
return healpix_sphere(lp_lon, lp_lat, xy_x, xy_y);
|
||||
}
|
||||
|
||||
// INVERSE(s_healpix_inverse) sphere
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
/* Check whether (x, y) lies in the HEALPix image */
|
||||
if (in_image(xy_x, xy_y, 0, 0, 0) == 0) {
|
||||
lp_lon = HUGE_VAL;
|
||||
lp_lat = HUGE_VAL;
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_invalid_x_or_y) );
|
||||
}
|
||||
return healpix_sphere_inverse(xy_x, xy_y, lp_lon, lp_lat);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "healpix_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_rhealpix_ellipsoid
|
||||
: public base_t_fi<base_rhealpix_ellipsoid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_healpix<T> m_proj_parm;
|
||||
|
||||
inline base_rhealpix_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_rhealpix_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_rhealpix_forward) ellipsoid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
lp_lat = auth_lat(this->params(), m_proj_parm, lp_lat, 0);
|
||||
healpix_sphere(lp_lon, lp_lat, xy_x, xy_y);
|
||||
combine_caps(xy_x, xy_y, this->m_proj_parm.north_square, this->m_proj_parm.south_square, 0);
|
||||
}
|
||||
|
||||
// INVERSE(e_rhealpix_inverse) ellipsoid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
/* Check whether (x, y) lies in the rHEALPix image. */
|
||||
if (in_image(xy_x, xy_y, 1, this->m_proj_parm.north_square, this->m_proj_parm.south_square) == 0) {
|
||||
lp_lon = HUGE_VAL;
|
||||
lp_lat = HUGE_VAL;
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_invalid_x_or_y) );
|
||||
}
|
||||
combine_caps(xy_x, xy_y, this->m_proj_parm.north_square, this->m_proj_parm.south_square, 1);
|
||||
healpix_sphere_inverse(xy_x, xy_y, lp_lon, lp_lat);
|
||||
lp_lat = auth_lat(this->params(), m_proj_parm, lp_lat, 1);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "rhealpix_ellipsoid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_rhealpix_spheroid
|
||||
: public base_t_fi<base_rhealpix_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_healpix<T> m_proj_parm;
|
||||
|
||||
inline base_rhealpix_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_rhealpix_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_rhealpix_forward) sphere
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
healpix_sphere(lp_lon, lp_lat, xy_x, xy_y);
|
||||
combine_caps(xy_x, xy_y, this->m_proj_parm.north_square, this->m_proj_parm.south_square, 0);
|
||||
}
|
||||
|
||||
// INVERSE(s_rhealpix_inverse) sphere
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
/* Check whether (x, y) lies in the rHEALPix image. */
|
||||
if (in_image(xy_x, xy_y, 1, this->m_proj_parm.north_square, this->m_proj_parm.south_square) == 0) {
|
||||
lp_lon = HUGE_VAL;
|
||||
lp_lat = HUGE_VAL;
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_invalid_x_or_y) );
|
||||
}
|
||||
combine_caps(xy_x, xy_y, this->m_proj_parm.north_square, this->m_proj_parm.south_square, 1);
|
||||
return healpix_sphere_inverse(xy_x, xy_y, lp_lon, lp_lat);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "rhealpix_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// HEALPix
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_healpix(Parameters& par, par_healpix<T>& proj_parm)
|
||||
{
|
||||
if (par.es != 0.0) {
|
||||
proj_parm.apa = pj_authset<T>(par.es); /* For auth_lat(). */
|
||||
proj_parm.qp = pj_qsfn(1.0, par.e, par.one_es); /* For auth_lat(). */
|
||||
par.a = par.a*sqrt(0.5*proj_parm.qp); /* Set par.a to authalic radius. */
|
||||
pj_calc_ellipsoid_params(par, par.a, par.es); /* Ensure we have a consistent parameter set */
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
// rHEALPix
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_rhealpix(Params const& params, Parameters& par, par_healpix<T>& proj_parm)
|
||||
{
|
||||
proj_parm.north_square = pj_get_param_i<srs::spar::north_square>(params, "north_square", srs::dpar::north_square);
|
||||
proj_parm.south_square = pj_get_param_i<srs::spar::south_square>(params, "south_square", srs::dpar::south_square);
|
||||
/* Check for valid north_square and south_square inputs. */
|
||||
if ((proj_parm.north_square < 0) || (proj_parm.north_square > 3)) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_axis) );
|
||||
}
|
||||
if ((proj_parm.south_square < 0) || (proj_parm.south_square > 3)) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_axis) );
|
||||
}
|
||||
if (par.es != 0.0) {
|
||||
proj_parm.apa = pj_authset<T>(par.es); /* For auth_lat(). */
|
||||
proj_parm.qp = pj_qsfn(1.0, par.e, par.one_es); /* For auth_lat(). */
|
||||
par.a = par.a*sqrt(0.5*proj_parm.qp); /* Set par.a to authalic radius. */
|
||||
// TODO: why not the same as in healpix?
|
||||
//pj_calc_ellipsoid_params(par, par.a, par.es);
|
||||
par.ra = 1.0/par.a;
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
}} // namespace detail::healpix
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief HEALPix projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Example
|
||||
\image html ex_healpix.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct healpix_ellipsoid : public detail::healpix::base_healpix_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline healpix_ellipsoid(Params const& , Parameters const& par)
|
||||
: detail::healpix::base_healpix_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::healpix::setup_healpix(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief HEALPix projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Example
|
||||
\image html ex_healpix.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct healpix_spheroid : public detail::healpix::base_healpix_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline healpix_spheroid(Params const& , Parameters const& par)
|
||||
: detail::healpix::base_healpix_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::healpix::setup_healpix(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief rHEALPix projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Projection parameters
|
||||
- north_square (integer)
|
||||
- south_square (integer)
|
||||
\par Example
|
||||
\image html ex_rhealpix.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct rhealpix_ellipsoid : public detail::healpix::base_rhealpix_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline rhealpix_ellipsoid(Params const& params, Parameters const& par)
|
||||
: detail::healpix::base_rhealpix_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::healpix::setup_rhealpix(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief rHEALPix projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Projection parameters
|
||||
- north_square (integer)
|
||||
- south_square (integer)
|
||||
\par Example
|
||||
\image html ex_rhealpix.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct rhealpix_spheroid : public detail::healpix::base_rhealpix_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline rhealpix_spheroid(Params const& params, Parameters const& par)
|
||||
: detail::healpix::base_rhealpix_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::healpix::setup_rhealpix(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_healpix, healpix_spheroid, healpix_ellipsoid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_rhealpix, rhealpix_spheroid, rhealpix_ellipsoid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(healpix_entry, healpix_spheroid, healpix_ellipsoid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(rhealpix_entry, rhealpix_spheroid, rhealpix_ellipsoid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(healpix_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(healpix, healpix_entry)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(rhealpix, rhealpix_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_HEALPIX_HPP
|
||||
|
||||
371
linx64/include/boost/geometry/srs/projections/proj/igh.hpp
Normal file
371
linx64/include/boost/geometry/srs/projections/proj/igh.hpp
Normal file
@@ -0,0 +1,371 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_IGH_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_IGH_HPP
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/proj/gn_sinu.hpp>
|
||||
#include <boost/geometry/srs/projections/proj/moll.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace igh
|
||||
{
|
||||
// TODO: consider replacing dynamically created projections
|
||||
// with member objects
|
||||
template <typename T, typename Parameters>
|
||||
struct par_igh
|
||||
{
|
||||
boost::shared_ptr<base_v<T, Parameters> > pj[12];
|
||||
T dy0;
|
||||
};
|
||||
|
||||
/* 40d 44' 11.8" [degrees] */
|
||||
template <typename T>
|
||||
inline T d4044118() { return (T(40) + T(44)/T(60.) + T(11.8)/T(3600.)) * geometry::math::d2r<T>(); }
|
||||
|
||||
template <typename T>
|
||||
inline T d10() { return T(10) * geometry::math::d2r<T>(); }
|
||||
template <typename T>
|
||||
inline T d20() { return T(20) * geometry::math::d2r<T>(); }
|
||||
template <typename T>
|
||||
inline T d30() { return T(30) * geometry::math::d2r<T>(); }
|
||||
template <typename T>
|
||||
inline T d40() { return T(40) * geometry::math::d2r<T>(); }
|
||||
template <typename T>
|
||||
inline T d50() { return T(50) * geometry::math::d2r<T>(); }
|
||||
template <typename T>
|
||||
inline T d60() { return T(60) * geometry::math::d2r<T>(); }
|
||||
template <typename T>
|
||||
inline T d80() { return T(80) * geometry::math::d2r<T>(); }
|
||||
template <typename T>
|
||||
inline T d90() { return T(90) * geometry::math::d2r<T>(); }
|
||||
template <typename T>
|
||||
inline T d100() { return T(100) * geometry::math::d2r<T>(); }
|
||||
template <typename T>
|
||||
inline T d140() { return T(140) * geometry::math::d2r<T>(); }
|
||||
template <typename T>
|
||||
inline T d160() { return T(160) * geometry::math::d2r<T>(); }
|
||||
template <typename T>
|
||||
inline T d180() { return T(180) * geometry::math::d2r<T>(); }
|
||||
|
||||
static const double epsilon = 1.e-10; // allow a little 'slack' on zone edge positions
|
||||
|
||||
// Converted from #define SETUP(n, proj, x_0, y_0, lon_0)
|
||||
template <template <typename, typename, typename> class Entry, typename Params, typename Parameters, typename T>
|
||||
inline void do_setup(int n, Params const& params, Parameters const& par, par_igh<T, Parameters>& proj_parm,
|
||||
T const& x_0, T const& y_0,
|
||||
T const& lon_0)
|
||||
{
|
||||
// NOTE: in the original proj4 these projections are initialized
|
||||
// with zeroed parameters which could be done here as well instead
|
||||
// of initializing with parent projection's parameters.
|
||||
Entry<Params, T, Parameters> entry;
|
||||
proj_parm.pj[n-1].reset(entry.create_new(params, par));
|
||||
proj_parm.pj[n-1]->mutable_params().x0 = x_0;
|
||||
proj_parm.pj[n-1]->mutable_params().y0 = y_0;
|
||||
proj_parm.pj[n-1]->mutable_params().lam0 = lon_0;
|
||||
}
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_igh_spheroid
|
||||
: public base_t_fi<base_igh_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_igh<T, Parameters> m_proj_parm;
|
||||
|
||||
inline base_igh_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_igh_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T d4044118 = igh::d4044118<T>();
|
||||
static const T d20 = igh::d20<T>();
|
||||
static const T d40 = igh::d40<T>();
|
||||
static const T d80 = igh::d80<T>();
|
||||
static const T d100 = igh::d100<T>();
|
||||
|
||||
int z;
|
||||
if (lp_lat >= d4044118) { // 1|2
|
||||
z = (lp_lon <= -d40 ? 1: 2);
|
||||
}
|
||||
else if (lp_lat >= 0) { // 3|4
|
||||
z = (lp_lon <= -d40 ? 3: 4);
|
||||
}
|
||||
else if (lp_lat >= -d4044118) { // 5|6|7|8
|
||||
if (lp_lon <= -d100) z = 5; // 5
|
||||
else if (lp_lon <= -d20) z = 6; // 6
|
||||
else if (lp_lon <= d80) z = 7; // 7
|
||||
else z = 8; // 8
|
||||
}
|
||||
else { // 9|10|11|12
|
||||
if (lp_lon <= -d100) z = 9; // 9
|
||||
else if (lp_lon <= -d20) z = 10; // 10
|
||||
else if (lp_lon <= d80) z = 11; // 11
|
||||
else z = 12; // 12
|
||||
}
|
||||
|
||||
lp_lon -= this->m_proj_parm.pj[z-1]->params().lam0;
|
||||
this->m_proj_parm.pj[z-1]->fwd(lp_lon, lp_lat, xy_x, xy_y);
|
||||
xy_x += this->m_proj_parm.pj[z-1]->params().x0;
|
||||
xy_y += this->m_proj_parm.pj[z-1]->params().y0;
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T d4044118 = igh::d4044118<T>();
|
||||
static const T d10 = igh::d10<T>();
|
||||
static const T d20 = igh::d20<T>();
|
||||
static const T d40 = igh::d40<T>();
|
||||
static const T d50 = igh::d50<T>();
|
||||
static const T d60 = igh::d60<T>();
|
||||
static const T d80 = igh::d80<T>();
|
||||
static const T d90 = igh::d90<T>();
|
||||
static const T d100 = igh::d100<T>();
|
||||
static const T d160 = igh::d160<T>();
|
||||
static const T d180 = igh::d180<T>();
|
||||
|
||||
static const T c2 = 2.0;
|
||||
|
||||
const T y90 = this->m_proj_parm.dy0 + sqrt(c2); // lt=90 corresponds to y=y0+sqrt(2.0)
|
||||
|
||||
int z = 0;
|
||||
if (xy_y > y90+epsilon || xy_y < -y90+epsilon) // 0
|
||||
z = 0;
|
||||
else if (xy_y >= d4044118) // 1|2
|
||||
z = (xy_x <= -d40? 1: 2);
|
||||
else if (xy_y >= 0) // 3|4
|
||||
z = (xy_x <= -d40? 3: 4);
|
||||
else if (xy_y >= -d4044118) { // 5|6|7|8
|
||||
if (xy_x <= -d100) z = 5; // 5
|
||||
else if (xy_x <= -d20) z = 6; // 6
|
||||
else if (xy_x <= d80) z = 7; // 7
|
||||
else z = 8; // 8
|
||||
}
|
||||
else { // 9|10|11|12
|
||||
if (xy_x <= -d100) z = 9; // 9
|
||||
else if (xy_x <= -d20) z = 10; // 10
|
||||
else if (xy_x <= d80) z = 11; // 11
|
||||
else z = 12; // 12
|
||||
}
|
||||
|
||||
if (z)
|
||||
{
|
||||
int ok = 0;
|
||||
|
||||
xy_x -= this->m_proj_parm.pj[z-1]->params().x0;
|
||||
xy_y -= this->m_proj_parm.pj[z-1]->params().y0;
|
||||
this->m_proj_parm.pj[z-1]->inv(xy_x, xy_y, lp_lon, lp_lat);
|
||||
lp_lon += this->m_proj_parm.pj[z-1]->params().lam0;
|
||||
|
||||
switch (z) {
|
||||
case 1: ok = (lp_lon >= -d180-epsilon && lp_lon <= -d40+epsilon) ||
|
||||
((lp_lon >= -d40-epsilon && lp_lon <= -d10+epsilon) &&
|
||||
(lp_lat >= d60-epsilon && lp_lat <= d90+epsilon)); break;
|
||||
case 2: ok = (lp_lon >= -d40-epsilon && lp_lon <= d180+epsilon) ||
|
||||
((lp_lon >= -d180-epsilon && lp_lon <= -d160+epsilon) &&
|
||||
(lp_lat >= d50-epsilon && lp_lat <= d90+epsilon)) ||
|
||||
((lp_lon >= -d50-epsilon && lp_lon <= -d40+epsilon) &&
|
||||
(lp_lat >= d60-epsilon && lp_lat <= d90+epsilon)); break;
|
||||
case 3: ok = (lp_lon >= -d180-epsilon && lp_lon <= -d40+epsilon); break;
|
||||
case 4: ok = (lp_lon >= -d40-epsilon && lp_lon <= d180+epsilon); break;
|
||||
case 5: ok = (lp_lon >= -d180-epsilon && lp_lon <= -d100+epsilon); break;
|
||||
case 6: ok = (lp_lon >= -d100-epsilon && lp_lon <= -d20+epsilon); break;
|
||||
case 7: ok = (lp_lon >= -d20-epsilon && lp_lon <= d80+epsilon); break;
|
||||
case 8: ok = (lp_lon >= d80-epsilon && lp_lon <= d180+epsilon); break;
|
||||
case 9: ok = (lp_lon >= -d180-epsilon && lp_lon <= -d100+epsilon); break;
|
||||
case 10: ok = (lp_lon >= -d100-epsilon && lp_lon <= -d20+epsilon); break;
|
||||
case 11: ok = (lp_lon >= -d20-epsilon && lp_lon <= d80+epsilon); break;
|
||||
case 12: ok = (lp_lon >= d80-epsilon && lp_lon <= d180+epsilon); break;
|
||||
}
|
||||
|
||||
z = (!ok? 0: z); // projectable?
|
||||
}
|
||||
// if (!z) pj_errno = -15; // invalid x or y
|
||||
if (!z) lp_lon = HUGE_VAL;
|
||||
if (!z) lp_lat = HUGE_VAL;
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "igh_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Interrupted Goode Homolosine
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_igh(Params const& params, Parameters& par, par_igh<T, Parameters>& proj_parm)
|
||||
{
|
||||
static const T d0 = 0;
|
||||
static const T d4044118 = igh::d4044118<T>();
|
||||
static const T d20 = igh::d20<T>();
|
||||
static const T d30 = igh::d30<T>();
|
||||
static const T d60 = igh::d60<T>();
|
||||
static const T d100 = igh::d100<T>();
|
||||
static const T d140 = igh::d140<T>();
|
||||
static const T d160 = igh::d160<T>();
|
||||
|
||||
/*
|
||||
Zones:
|
||||
|
||||
-180 -40 180
|
||||
+--------------+-------------------------+ Zones 1,2,9,10,11 & 12:
|
||||
|1 |2 | Mollweide projection
|
||||
| | |
|
||||
+--------------+-------------------------+ Zones 3,4,5,6,7 & 8:
|
||||
|3 |4 | Sinusoidal projection
|
||||
| | |
|
||||
0 +-------+------+-+-----------+-----------+
|
||||
|5 |6 |7 |8 |
|
||||
| | | | |
|
||||
+-------+--------+-----------+-----------+
|
||||
|9 |10 |11 |12 |
|
||||
| | | | |
|
||||
+-------+--------+-----------+-----------+
|
||||
-180 -100 -20 80 180
|
||||
*/
|
||||
|
||||
T lp_lam = 0, lp_phi = d4044118;
|
||||
T xy1_x, xy1_y;
|
||||
T xy3_x, xy3_y;
|
||||
|
||||
// IMPORTANT: Force spherical sinu projection
|
||||
// This is required because unlike in the original proj4 here
|
||||
// parameters are used to initialize underlying projections.
|
||||
// In the original code zeroed parameters are passed which
|
||||
// could be done here as well though.
|
||||
par.es = 0.;
|
||||
|
||||
// sinusoidal zones
|
||||
do_setup<sinu_entry>(3, params, par, proj_parm, -d100, d0, -d100);
|
||||
do_setup<sinu_entry>(4, params, par, proj_parm, d30, d0, d30);
|
||||
do_setup<sinu_entry>(5, params, par, proj_parm, -d160, d0, -d160);
|
||||
do_setup<sinu_entry>(6, params, par, proj_parm, -d60, d0, -d60);
|
||||
do_setup<sinu_entry>(7, params, par, proj_parm, d20, d0, d20);
|
||||
do_setup<sinu_entry>(8, params, par, proj_parm, d140, d0, d140);
|
||||
|
||||
// mollweide zones
|
||||
do_setup<moll_entry>(1, params, par, proj_parm, -d100, d0, -d100);
|
||||
|
||||
// y0 ?
|
||||
proj_parm.pj[0]->fwd(lp_lam, lp_phi, xy1_x, xy1_y); // zone 1
|
||||
proj_parm.pj[2]->fwd(lp_lam, lp_phi, xy3_x, xy3_y); // zone 3
|
||||
// y0 + xy1_y = xy3_y for lt = 40d44'11.8"
|
||||
proj_parm.dy0 = xy3_y - xy1_y;
|
||||
|
||||
proj_parm.pj[0]->mutable_params().y0 = proj_parm.dy0;
|
||||
|
||||
// mollweide zones (cont'd)
|
||||
do_setup<moll_entry>( 2, params, par, proj_parm, d30, proj_parm.dy0, d30);
|
||||
do_setup<moll_entry>( 9, params, par, proj_parm, -d160, -proj_parm.dy0, -d160);
|
||||
do_setup<moll_entry>(10, params, par, proj_parm, -d60, -proj_parm.dy0, -d60);
|
||||
do_setup<moll_entry>(11, params, par, proj_parm, d20, -proj_parm.dy0, d20);
|
||||
do_setup<moll_entry>(12, params, par, proj_parm, d140, -proj_parm.dy0, d140);
|
||||
|
||||
// Already done before
|
||||
//par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::igh
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Interrupted Goode Homolosine projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_igh.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct igh_spheroid : public detail::igh::base_igh_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline igh_spheroid(Params const& params, Parameters const& par)
|
||||
: detail::igh::base_igh_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::igh::setup_igh(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_igh, igh_spheroid, igh_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(igh_entry, igh_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(igh_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(igh, igh_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_IGH_HPP
|
||||
|
||||
322
linx64/include/boost/geometry/srs/projections/proj/imw_p.hpp
Normal file
322
linx64/include/boost/geometry/srs/projections/proj/imw_p.hpp
Normal file
@@ -0,0 +1,322 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_IMW_P_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_IMW_P_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_mlfn.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace imw_p
|
||||
{
|
||||
|
||||
static const double tolerance = 1e-10;
|
||||
static const double epsilon = 1e-10;
|
||||
|
||||
template <typename T>
|
||||
struct point_xy { T x, y; }; // specific for IMW_P
|
||||
|
||||
enum mode_type {
|
||||
none_is_zero = 0, /* phi_1 and phi_2 != 0 */
|
||||
phi_1_is_zero = 1, /* phi_1 = 0 */
|
||||
phi_2_is_zero = -1 /* phi_2 = 0 */
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct par_imw_p
|
||||
{
|
||||
T P, Pp, Q, Qp, R_1, R_2, sphi_1, sphi_2, C2;
|
||||
T phi_1, phi_2, lam_1;
|
||||
detail::en<T> en;
|
||||
mode_type mode;
|
||||
};
|
||||
|
||||
template <typename Params, typename T>
|
||||
inline int phi12(Params const& params,
|
||||
par_imw_p<T> & proj_parm, T *del, T *sig)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
if (!pj_param_r<srs::spar::lat_1>(params, "lat_1", srs::dpar::lat_1, proj_parm.phi_1) ||
|
||||
!pj_param_r<srs::spar::lat_2>(params, "lat_2", srs::dpar::lat_2, proj_parm.phi_2)) {
|
||||
err = -41;
|
||||
} else {
|
||||
//proj_parm.phi_1 = pj_get_param_r(par.params, "lat_1"); // set above
|
||||
//proj_parm.phi_2 = pj_get_param_r(par.params, "lat_2"); // set above
|
||||
*del = 0.5 * (proj_parm.phi_2 - proj_parm.phi_1);
|
||||
*sig = 0.5 * (proj_parm.phi_2 + proj_parm.phi_1);
|
||||
err = (fabs(*del) < epsilon || fabs(*sig) < epsilon) ? -42 : 0;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
template <typename Parameters, typename T>
|
||||
inline point_xy<T> loc_for(T const& lp_lam, T const& lp_phi,
|
||||
Parameters const& par,
|
||||
par_imw_p<T> const& proj_parm,
|
||||
T *yc)
|
||||
{
|
||||
point_xy<T> xy;
|
||||
|
||||
if (lp_phi == 0.0) {
|
||||
xy.x = lp_lam;
|
||||
xy.y = 0.;
|
||||
} else {
|
||||
T xa, ya, xb, yb, xc, D, B, m, sp, t, R, C;
|
||||
|
||||
sp = sin(lp_phi);
|
||||
m = pj_mlfn(lp_phi, sp, cos(lp_phi), proj_parm.en);
|
||||
xa = proj_parm.Pp + proj_parm.Qp * m;
|
||||
ya = proj_parm.P + proj_parm.Q * m;
|
||||
R = 1. / (tan(lp_phi) * sqrt(1. - par.es * sp * sp));
|
||||
C = sqrt(R * R - xa * xa);
|
||||
if (lp_phi < 0.) C = - C;
|
||||
C += ya - R;
|
||||
if (proj_parm.mode == phi_2_is_zero) {
|
||||
xb = lp_lam;
|
||||
yb = proj_parm.C2;
|
||||
} else {
|
||||
t = lp_lam * proj_parm.sphi_2;
|
||||
xb = proj_parm.R_2 * sin(t);
|
||||
yb = proj_parm.C2 + proj_parm.R_2 * (1. - cos(t));
|
||||
}
|
||||
if (proj_parm.mode == phi_1_is_zero) {
|
||||
xc = lp_lam;
|
||||
*yc = 0.;
|
||||
} else {
|
||||
t = lp_lam * proj_parm.sphi_1;
|
||||
xc = proj_parm.R_1 * sin(t);
|
||||
*yc = proj_parm.R_1 * (1. - cos(t));
|
||||
}
|
||||
D = (xb - xc)/(yb - *yc);
|
||||
B = xc + D * (C + R - *yc);
|
||||
xy.x = D * sqrt(R * R * (1 + D * D) - B * B);
|
||||
if (lp_phi > 0)
|
||||
xy.x = - xy.x;
|
||||
xy.x = (B + xy.x) / (1. + D * D);
|
||||
xy.y = sqrt(R * R - xy.x * xy.x);
|
||||
if (lp_phi > 0)
|
||||
xy.y = - xy.y;
|
||||
xy.y += C + R;
|
||||
}
|
||||
return (xy);
|
||||
}
|
||||
template <typename Parameters, typename T>
|
||||
inline void xy(Parameters const& par, par_imw_p<T> const& proj_parm,
|
||||
T const& phi,
|
||||
T *x, T *y, T *sp, T *R)
|
||||
{
|
||||
T F;
|
||||
|
||||
*sp = sin(phi);
|
||||
*R = 1./(tan(phi) * sqrt(1. - par.es * *sp * *sp ));
|
||||
F = proj_parm.lam_1 * *sp;
|
||||
*y = *R * (1 - cos(F));
|
||||
*x = *R * sin(F);
|
||||
}
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_imw_p_ellipsoid
|
||||
: public base_t_fi<base_imw_p_ellipsoid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_imw_p<T> m_proj_parm;
|
||||
|
||||
inline base_imw_p_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_imw_p_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_forward) ellipsoid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T yc = 0;
|
||||
point_xy<T> xy = loc_for(lp_lon, lp_lat, this->m_par, m_proj_parm, &yc);
|
||||
xy_x = xy.x; xy_y = xy.y;
|
||||
}
|
||||
|
||||
// INVERSE(e_inverse) ellipsoid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
point_xy<T> t;
|
||||
T yc = 0.0;
|
||||
int i = 0;
|
||||
const int n_max_iter = 1000; /* Arbitrarily choosen number... */
|
||||
|
||||
lp_lat = this->m_proj_parm.phi_2;
|
||||
lp_lon = xy_x / cos(lp_lat);
|
||||
do {
|
||||
t = loc_for(lp_lon, lp_lat, this->m_par, m_proj_parm, &yc);
|
||||
lp_lat = ((lp_lat - this->m_proj_parm.phi_1) * (xy_y - yc) / (t.y - yc)) + this->m_proj_parm.phi_1;
|
||||
lp_lon = lp_lon * xy_x / t.x;
|
||||
i++;
|
||||
} while (i < n_max_iter &&
|
||||
(fabs(t.x - xy_x) > tolerance || fabs(t.y - xy_y) > tolerance));
|
||||
|
||||
if( i == n_max_iter )
|
||||
{
|
||||
lp_lon = lp_lat = HUGE_VAL;
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "imw_p_ellipsoid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// International Map of the World Polyconic
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_imw_p(Params const& params, Parameters const& par, par_imw_p<T>& proj_parm)
|
||||
{
|
||||
T del, sig, s, t, x1, x2, T2, y1, m1, m2, y2;
|
||||
int err;
|
||||
|
||||
proj_parm.en = pj_enfn<T>(par.es);
|
||||
if( (err = phi12(params, proj_parm, &del, &sig)) != 0)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(err) );
|
||||
if (proj_parm.phi_2 < proj_parm.phi_1) { /* make sure proj_parm.phi_1 most southerly */
|
||||
del = proj_parm.phi_1;
|
||||
proj_parm.phi_1 = proj_parm.phi_2;
|
||||
proj_parm.phi_2 = del;
|
||||
}
|
||||
if (pj_param_r<srs::spar::lon_1>(params, "lon_1", srs::dpar::lon_1, proj_parm.lam_1)) {
|
||||
/* empty */
|
||||
} else { /* use predefined based upon latitude */
|
||||
sig = fabs(sig * geometry::math::r2d<T>());
|
||||
if (sig <= 60) sig = 2.;
|
||||
else if (sig <= 76) sig = 4.;
|
||||
else sig = 8.;
|
||||
proj_parm.lam_1 = sig * geometry::math::d2r<T>();
|
||||
}
|
||||
proj_parm.mode = none_is_zero;
|
||||
if (proj_parm.phi_1 != 0.0)
|
||||
xy(par, proj_parm, proj_parm.phi_1, &x1, &y1, &proj_parm.sphi_1, &proj_parm.R_1);
|
||||
else {
|
||||
proj_parm.mode = phi_1_is_zero;
|
||||
y1 = 0.;
|
||||
x1 = proj_parm.lam_1;
|
||||
}
|
||||
if (proj_parm.phi_2 != 0.0)
|
||||
xy(par, proj_parm, proj_parm.phi_2, &x2, &T2, &proj_parm.sphi_2, &proj_parm.R_2);
|
||||
else {
|
||||
proj_parm.mode = phi_2_is_zero;
|
||||
T2 = 0.;
|
||||
x2 = proj_parm.lam_1;
|
||||
}
|
||||
m1 = pj_mlfn(proj_parm.phi_1, proj_parm.sphi_1, cos(proj_parm.phi_1), proj_parm.en);
|
||||
m2 = pj_mlfn(proj_parm.phi_2, proj_parm.sphi_2, cos(proj_parm.phi_2), proj_parm.en);
|
||||
t = m2 - m1;
|
||||
s = x2 - x1;
|
||||
y2 = sqrt(t * t - s * s) + y1;
|
||||
proj_parm.C2 = y2 - T2;
|
||||
t = 1. / t;
|
||||
proj_parm.P = (m2 * y1 - m1 * y2) * t;
|
||||
proj_parm.Q = (y2 - y1) * t;
|
||||
proj_parm.Pp = (m2 * x1 - m1 * x2) * t;
|
||||
proj_parm.Qp = (x2 - x1) * t;
|
||||
}
|
||||
|
||||
}} // namespace detail::imw_p
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief International Map of the World Polyconic projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Mod. Polyconic
|
||||
- Ellipsoid
|
||||
\par Projection parameters
|
||||
- lat_1: Latitude of first standard parallel
|
||||
- lat_2: Latitude of second standard parallel
|
||||
- lon_1 (degrees)
|
||||
\par Example
|
||||
\image html ex_imw_p.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct imw_p_ellipsoid : public detail::imw_p::base_imw_p_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline imw_p_ellipsoid(Params const& params, Parameters const& par)
|
||||
: detail::imw_p::base_imw_p_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::imw_p::setup_imw_p(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_imw_p, imw_p_ellipsoid, imw_p_ellipsoid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(imw_p_entry, imw_p_ellipsoid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(imw_p_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(imw_p, imw_p_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_IMW_P_HPP
|
||||
|
||||
1327
linx64/include/boost/geometry/srs/projections/proj/isea.hpp
Normal file
1327
linx64/include/boost/geometry/srs/projections/proj/isea.hpp
Normal file
File diff suppressed because it is too large
Load Diff
285
linx64/include/boost/geometry/srs/projections/proj/krovak.hpp
Normal file
285
linx64/include/boost/geometry/srs/projections/proj/krovak.hpp
Normal file
@@ -0,0 +1,285 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Purpose: Implementation of the krovak (Krovak) projection.
|
||||
// Definition: http://www.ihsenergy.com/epsg/guid7.html#1.4.3
|
||||
// Author: Thomas Flemming, tf@ttqv.com
|
||||
// Copyright (c) 2001, Thomas Flemming, tf@ttqv.com
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_KROVAK_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_KROVAK_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace krovak
|
||||
{
|
||||
static double epsilon = 1e-15;
|
||||
static double S45 = 0.785398163397448; /* 45 deg */
|
||||
static double S90 = 1.570796326794896; /* 90 deg */
|
||||
static double UQ = 1.04216856380474; /* DU(2, 59, 42, 42.69689) */
|
||||
static double S0 = 1.37008346281555; /* Latitude of pseudo standard parallel 78deg 30'00" N */
|
||||
/* Not sure at all of the appropriate number for max_iter... */
|
||||
static int max_iter = 100;
|
||||
|
||||
template <typename T>
|
||||
struct par_krovak
|
||||
{
|
||||
T alpha;
|
||||
T k;
|
||||
T n;
|
||||
T rho0;
|
||||
T ad;
|
||||
int czech;
|
||||
};
|
||||
|
||||
/**
|
||||
NOTES: According to EPSG the full Krovak projection method should have
|
||||
the following parameters. Within PROJ.4 the azimuth, and pseudo
|
||||
standard parallel are hardcoded in the algorithm and can't be
|
||||
altered from outside. The others all have defaults to match the
|
||||
common usage with Krovak projection.
|
||||
|
||||
lat_0 = latitude of centre of the projection
|
||||
|
||||
lon_0 = longitude of centre of the projection
|
||||
|
||||
** = azimuth (true) of the centre line passing through the centre of the projection
|
||||
|
||||
** = latitude of pseudo standard parallel
|
||||
|
||||
k = scale factor on the pseudo standard parallel
|
||||
|
||||
x_0 = False Easting of the centre of the projection at the apex of the cone
|
||||
|
||||
y_0 = False Northing of the centre of the projection at the apex of the cone
|
||||
|
||||
**/
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_krovak_ellipsoid
|
||||
: public base_t_fi<base_krovak_ellipsoid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_krovak<T> m_proj_parm;
|
||||
|
||||
inline base_krovak_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_krovak_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_forward) ellipsoid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T gfi, u, deltav, s, d, eps, rho;
|
||||
|
||||
gfi = math::pow( (T(1) + this->m_par.e * sin(lp_lat)) / (T(1) - this->m_par.e * sin(lp_lat)), this->m_proj_parm.alpha * this->m_par.e / T(2));
|
||||
|
||||
u = 2. * (atan(this->m_proj_parm.k * math::pow( tan(lp_lat / T(2) + S45), this->m_proj_parm.alpha) / gfi)-S45);
|
||||
deltav = -lp_lon * this->m_proj_parm.alpha;
|
||||
|
||||
s = asin(cos(this->m_proj_parm.ad) * sin(u) + sin(this->m_proj_parm.ad) * cos(u) * cos(deltav));
|
||||
d = asin(cos(u) * sin(deltav) / cos(s));
|
||||
|
||||
eps = this->m_proj_parm.n * d;
|
||||
rho = this->m_proj_parm.rho0 * math::pow(tan(S0 / T(2) + S45) , this->m_proj_parm.n) / math::pow(tan(s / T(2) + S45) , this->m_proj_parm.n);
|
||||
|
||||
xy_y = rho * cos(eps);
|
||||
xy_x = rho * sin(eps);
|
||||
|
||||
xy_y *= this->m_proj_parm.czech;
|
||||
xy_x *= this->m_proj_parm.czech;
|
||||
}
|
||||
|
||||
// INVERSE(e_inverse) ellipsoid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
T u, deltav, s, d, eps, rho, fi1, xy0;
|
||||
int i;
|
||||
|
||||
// TODO: replace with std::swap()
|
||||
xy0 = xy_x;
|
||||
xy_x = xy_y;
|
||||
xy_y = xy0;
|
||||
|
||||
xy_x *= this->m_proj_parm.czech;
|
||||
xy_y *= this->m_proj_parm.czech;
|
||||
|
||||
rho = sqrt(xy_x * xy_x + xy_y * xy_y);
|
||||
eps = atan2(xy_y, xy_x);
|
||||
|
||||
d = eps / sin(S0);
|
||||
s = T(2) * (atan(math::pow(this->m_proj_parm.rho0 / rho, T(1) / this->m_proj_parm.n) * tan(S0 / T(2) + S45)) - S45);
|
||||
|
||||
u = asin(cos(this->m_proj_parm.ad) * sin(s) - sin(this->m_proj_parm.ad) * cos(s) * cos(d));
|
||||
deltav = asin(cos(s) * sin(d) / cos(u));
|
||||
|
||||
lp_lon = this->m_par.lam0 - deltav / this->m_proj_parm.alpha;
|
||||
|
||||
/* ITERATION FOR lp_lat */
|
||||
fi1 = u;
|
||||
|
||||
for (i = max_iter; i ; --i) {
|
||||
lp_lat = T(2) * ( atan( math::pow( this->m_proj_parm.k, T(-1) / this->m_proj_parm.alpha) *
|
||||
math::pow( tan(u / T(2) + S45) , T(1) / this->m_proj_parm.alpha) *
|
||||
math::pow( (T(1) + this->m_par.e * sin(fi1)) / (T(1) - this->m_par.e * sin(fi1)) , this->m_par.e / T(2))
|
||||
) - S45);
|
||||
|
||||
if (fabs(fi1 - lp_lat) < epsilon)
|
||||
break;
|
||||
fi1 = lp_lat;
|
||||
}
|
||||
if( i == 0 )
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_non_convergent) );
|
||||
|
||||
lp_lon -= this->m_par.lam0;
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "krovak_ellipsoid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Krovak
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_krovak(Params const& params, Parameters& par, par_krovak<T>& proj_parm)
|
||||
{
|
||||
T u0, n0, g;
|
||||
|
||||
/* we want Bessel as fixed ellipsoid */
|
||||
par.a = 6377397.155;
|
||||
par.es = 0.006674372230614;
|
||||
par.e = sqrt(par.es);
|
||||
|
||||
/* if latitude of projection center is not set, use 49d30'N */
|
||||
if (!pj_param_exists<srs::spar::lat_0>(params, "lat_0", srs::dpar::lat_0))
|
||||
par.phi0 = 0.863937979737193;
|
||||
|
||||
/* if center long is not set use 42d30'E of Ferro - 17d40' for Ferro */
|
||||
/* that will correspond to using longitudes relative to greenwich */
|
||||
/* as input and output, instead of lat/long relative to Ferro */
|
||||
if (!pj_param_exists<srs::spar::lon_0>(params, "lon_0", srs::dpar::lon_0))
|
||||
par.lam0 = 0.7417649320975901 - 0.308341501185665;
|
||||
|
||||
/* if scale not set default to 0.9999 */
|
||||
if (!pj_param_exists<srs::spar::k>(params, "k", srs::dpar::k))
|
||||
par.k0 = 0.9999;
|
||||
|
||||
proj_parm.czech = 1;
|
||||
if( !pj_param_exists<srs::spar::czech>(params, "czech", srs::dpar::czech) )
|
||||
proj_parm.czech = -1;
|
||||
|
||||
/* Set up shared parameters between forward and inverse */
|
||||
proj_parm.alpha = sqrt(T(1) + (par.es * math::pow(cos(par.phi0), 4)) / (T(1) - par.es));
|
||||
u0 = asin(sin(par.phi0) / proj_parm.alpha);
|
||||
g = math::pow( (T(1) + par.e * sin(par.phi0)) / (T(1) - par.e * sin(par.phi0)) , proj_parm.alpha * par.e / T(2) );
|
||||
proj_parm.k = tan( u0 / 2. + S45) / math::pow(tan(par.phi0 / T(2) + S45) , proj_parm.alpha) * g;
|
||||
n0 = sqrt(T(1) - par.es) / (T(1) - par.es * math::pow(sin(par.phi0), 2));
|
||||
proj_parm.n = sin(S0);
|
||||
proj_parm.rho0 = par.k0 * n0 / tan(S0);
|
||||
proj_parm.ad = S90 - UQ;
|
||||
}
|
||||
|
||||
}} // namespace detail::krovak
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Krovak projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Ellipsoid
|
||||
\par Projection parameters
|
||||
- lat_ts: Latitude of true scale (degrees)
|
||||
- lat_0: Latitude of origin
|
||||
- lon_0: Central meridian
|
||||
- k: Scale factor on the pseudo standard parallel
|
||||
\par Example
|
||||
\image html ex_krovak.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct krovak_ellipsoid : public detail::krovak::base_krovak_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline krovak_ellipsoid(Params const& params, Parameters const& par)
|
||||
: detail::krovak::base_krovak_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::krovak::setup_krovak(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_krovak, krovak_ellipsoid, krovak_ellipsoid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(krovak_entry, krovak_ellipsoid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(krovak_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(krovak, krovak_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_KROVAK_HPP
|
||||
|
||||
252
linx64/include/boost/geometry/srs/projections/proj/labrd.hpp
Normal file
252
linx64/include/boost/geometry/srs/projections/proj/labrd.hpp
Normal file
@@ -0,0 +1,252 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_LABRD_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_LABRD_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace labrd
|
||||
{
|
||||
static const double epsilon = 1.e-10;
|
||||
|
||||
template <typename T>
|
||||
struct par_labrd
|
||||
{
|
||||
T Az, kRg, p0s, A, C, Ca, Cb, Cc, Cd;
|
||||
int rot;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_labrd_ellipsoid
|
||||
: public base_t_fi<base_labrd_ellipsoid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_labrd<T> m_proj_parm;
|
||||
|
||||
inline base_labrd_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_labrd_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_forward)
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T fourth_pi = detail::fourth_pi<T>();
|
||||
|
||||
T V1, V2, ps, sinps, cosps, sinps2, cosps2;
|
||||
T I1, I2, I3, I4, I5, I6, x2, y2, t;
|
||||
|
||||
V1 = this->m_proj_parm.A * log( tan(fourth_pi + .5 * lp_lat) );
|
||||
t = this->m_par.e * sin(lp_lat);
|
||||
V2 = .5 * this->m_par.e * this->m_proj_parm.A * log ((1. + t)/(1. - t));
|
||||
ps = 2. * (atan(exp(V1 - V2 + this->m_proj_parm.C)) - fourth_pi);
|
||||
I1 = ps - this->m_proj_parm.p0s;
|
||||
cosps = cos(ps); cosps2 = cosps * cosps;
|
||||
sinps = sin(ps); sinps2 = sinps * sinps;
|
||||
I4 = this->m_proj_parm.A * cosps;
|
||||
I2 = .5 * this->m_proj_parm.A * I4 * sinps;
|
||||
I3 = I2 * this->m_proj_parm.A * this->m_proj_parm.A * (5. * cosps2 - sinps2) / 12.;
|
||||
I6 = I4 * this->m_proj_parm.A * this->m_proj_parm.A;
|
||||
I5 = I6 * (cosps2 - sinps2) / 6.;
|
||||
I6 *= this->m_proj_parm.A * this->m_proj_parm.A *
|
||||
(5. * cosps2 * cosps2 + sinps2 * (sinps2 - 18. * cosps2)) / 120.;
|
||||
t = lp_lon * lp_lon;
|
||||
xy_x = this->m_proj_parm.kRg * lp_lon * (I4 + t * (I5 + t * I6));
|
||||
xy_y = this->m_proj_parm.kRg * (I1 + t * (I2 + t * I3));
|
||||
x2 = xy_x * xy_x;
|
||||
y2 = xy_y * xy_y;
|
||||
V1 = 3. * xy_x * y2 - xy_x * x2;
|
||||
V2 = xy_y * y2 - 3. * x2 * xy_y;
|
||||
xy_x += this->m_proj_parm.Ca * V1 + this->m_proj_parm.Cb * V2;
|
||||
xy_y += this->m_proj_parm.Ca * V2 - this->m_proj_parm.Cb * V1;
|
||||
}
|
||||
|
||||
// INVERSE(e_inverse) ellipsoid & spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T fourth_pi = detail::fourth_pi<T>();
|
||||
|
||||
/* t = 0.0 optimization is to avoid a false positive cppcheck warning */
|
||||
/* (cppcheck git beaf29c15867984aa3c2a15cf15bd7576ccde2b3). Might no */
|
||||
/* longer be necessary with later versions. */
|
||||
T x2, y2, V1, V2, V3, V4, t = 0.0, t2, ps, pe, tpe, s;
|
||||
T I7, I8, I9, I10, I11, d, Re;
|
||||
int i;
|
||||
|
||||
x2 = xy_x * xy_x;
|
||||
y2 = xy_y * xy_y;
|
||||
V1 = 3. * xy_x * y2 - xy_x * x2;
|
||||
V2 = xy_y * y2 - 3. * x2 * xy_y;
|
||||
V3 = xy_x * (5. * y2 * y2 + x2 * (-10. * y2 + x2 ));
|
||||
V4 = xy_y * (5. * x2 * x2 + y2 * (-10. * x2 + y2 ));
|
||||
xy_x += - this->m_proj_parm.Ca * V1 - this->m_proj_parm.Cb * V2 + this->m_proj_parm.Cc * V3 + this->m_proj_parm.Cd * V4;
|
||||
xy_y += this->m_proj_parm.Cb * V1 - this->m_proj_parm.Ca * V2 - this->m_proj_parm.Cd * V3 + this->m_proj_parm.Cc * V4;
|
||||
ps = this->m_proj_parm.p0s + xy_y / this->m_proj_parm.kRg;
|
||||
pe = ps + this->m_par.phi0 - this->m_proj_parm.p0s;
|
||||
|
||||
for ( i = 20; i; --i) {
|
||||
V1 = this->m_proj_parm.A * log(tan(fourth_pi + .5 * pe));
|
||||
tpe = this->m_par.e * sin(pe);
|
||||
V2 = .5 * this->m_par.e * this->m_proj_parm.A * log((1. + tpe)/(1. - tpe));
|
||||
t = ps - 2. * (atan(exp(V1 - V2 + this->m_proj_parm.C)) - fourth_pi);
|
||||
pe += t;
|
||||
if (fabs(t) < epsilon)
|
||||
break;
|
||||
}
|
||||
|
||||
t = this->m_par.e * sin(pe);
|
||||
t = 1. - t * t;
|
||||
Re = this->m_par.one_es / ( t * sqrt(t) );
|
||||
t = tan(ps);
|
||||
t2 = t * t;
|
||||
s = this->m_proj_parm.kRg * this->m_proj_parm.kRg;
|
||||
d = Re * this->m_par.k0 * this->m_proj_parm.kRg;
|
||||
I7 = t / (2. * d);
|
||||
I8 = t * (5. + 3. * t2) / (24. * d * s);
|
||||
d = cos(ps) * this->m_proj_parm.kRg * this->m_proj_parm.A;
|
||||
I9 = 1. / d;
|
||||
d *= s;
|
||||
I10 = (1. + 2. * t2) / (6. * d);
|
||||
I11 = (5. + t2 * (28. + 24. * t2)) / (120. * d * s);
|
||||
x2 = xy_x * xy_x;
|
||||
lp_lat = pe + x2 * (-I7 + I8 * x2);
|
||||
lp_lon = xy_x * (I9 + x2 * (-I10 + x2 * I11));
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "labrd_ellipsoid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Laborde
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_labrd(Params const& params, Parameters& par, par_labrd<T>& proj_parm)
|
||||
{
|
||||
static const T fourth_pi = detail::fourth_pi<T>();
|
||||
|
||||
T Az, sinp, R, N, t;
|
||||
|
||||
proj_parm.rot = pj_get_param_b<srs::spar::no_rot>(params, "no_rot", srs::dpar::no_rot);
|
||||
Az = pj_get_param_r<T, srs::spar::azi>(params, "azi", srs::dpar::azi);
|
||||
sinp = sin(par.phi0);
|
||||
t = 1. - par.es * sinp * sinp;
|
||||
N = 1. / sqrt(t);
|
||||
R = par.one_es * N / t;
|
||||
proj_parm.kRg = par.k0 * sqrt( N * R );
|
||||
proj_parm.p0s = atan( sqrt(R / N) * tan(par.phi0) );
|
||||
proj_parm.A = sinp / sin(proj_parm.p0s);
|
||||
t = par.e * sinp;
|
||||
proj_parm.C = .5 * par.e * proj_parm.A * log((1. + t)/(1. - t)) +
|
||||
- proj_parm.A * log( tan(fourth_pi + .5 * par.phi0))
|
||||
+ log( tan(fourth_pi + .5 * proj_parm.p0s));
|
||||
t = Az + Az;
|
||||
proj_parm.Ca = (1. - cos(t)) * ( proj_parm.Cb = 1. / (12. * proj_parm.kRg * proj_parm.kRg) );
|
||||
proj_parm.Cb *= sin(t);
|
||||
proj_parm.Cc = 3. * (proj_parm.Ca * proj_parm.Ca - proj_parm.Cb * proj_parm.Cb);
|
||||
proj_parm.Cd = 6. * proj_parm.Ca * proj_parm.Cb;
|
||||
}
|
||||
|
||||
}} // namespace detail::labrd
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Laborde projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
- Special for Madagascar
|
||||
\par Projection parameters
|
||||
- no_rot: No rotation (boolean)
|
||||
- azi: Azimuth (or Gamma) (degrees)
|
||||
\par Example
|
||||
\image html ex_labrd.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct labrd_ellipsoid : public detail::labrd::base_labrd_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline labrd_ellipsoid(Params const& params, Parameters const& par)
|
||||
: detail::labrd::base_labrd_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::labrd::setup_labrd(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_labrd, labrd_ellipsoid, labrd_ellipsoid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(labrd_entry, labrd_ellipsoid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(labrd_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(labrd, labrd_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_LABRD_HPP
|
||||
|
||||
439
linx64/include/boost/geometry/srs/projections/proj/laea.hpp
Normal file
439
linx64/include/boost/geometry/srs/projections/proj/laea.hpp
Normal file
@@ -0,0 +1,439 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_LAEA_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_LAEA_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
#include <boost/math/special_functions/hypot.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_auth.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_qsfn.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace laea
|
||||
{
|
||||
static const double epsilon10 = 1.e-10;
|
||||
|
||||
enum mode_type {
|
||||
n_pole = 0,
|
||||
s_pole = 1,
|
||||
equit = 2,
|
||||
obliq = 3
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct par_laea
|
||||
{
|
||||
T sinb1;
|
||||
T cosb1;
|
||||
T xmf;
|
||||
T ymf;
|
||||
T mmf;
|
||||
T qp;
|
||||
T dd;
|
||||
T rq;
|
||||
detail::apa<T> apa;
|
||||
mode_type mode;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_laea_ellipsoid
|
||||
: public base_t_fi<base_laea_ellipsoid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_laea<T> m_proj_parm;
|
||||
|
||||
inline base_laea_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_laea_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_forward) ellipsoid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T coslam, sinlam, sinphi, q, sinb=0.0, cosb=0.0, b=0.0;
|
||||
|
||||
coslam = cos(lp_lon);
|
||||
sinlam = sin(lp_lon);
|
||||
sinphi = sin(lp_lat);
|
||||
q = pj_qsfn(sinphi, this->m_par.e, this->m_par.one_es);
|
||||
|
||||
if (this->m_proj_parm.mode == obliq || this->m_proj_parm.mode == equit) {
|
||||
sinb = q / this->m_proj_parm.qp;
|
||||
cosb = sqrt(1. - sinb * sinb);
|
||||
}
|
||||
|
||||
switch (this->m_proj_parm.mode) {
|
||||
case obliq:
|
||||
b = 1. + this->m_proj_parm.sinb1 * sinb + this->m_proj_parm.cosb1 * cosb * coslam;
|
||||
break;
|
||||
case equit:
|
||||
b = 1. + cosb * coslam;
|
||||
break;
|
||||
case n_pole:
|
||||
b = half_pi + lp_lat;
|
||||
q = this->m_proj_parm.qp - q;
|
||||
break;
|
||||
case s_pole:
|
||||
b = lp_lat - half_pi;
|
||||
q = this->m_proj_parm.qp + q;
|
||||
break;
|
||||
}
|
||||
if (fabs(b) < epsilon10) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
|
||||
switch (this->m_proj_parm.mode) {
|
||||
case obliq:
|
||||
b = sqrt(2. / b);
|
||||
xy_y = this->m_proj_parm.ymf * b * (this->m_proj_parm.cosb1 * sinb - this->m_proj_parm.sinb1 * cosb * coslam);
|
||||
goto eqcon;
|
||||
break;
|
||||
case equit:
|
||||
b = sqrt(2. / (1. + cosb * coslam));
|
||||
xy_y = b * sinb * this->m_proj_parm.ymf;
|
||||
eqcon:
|
||||
xy_x = this->m_proj_parm.xmf * b * cosb * sinlam;
|
||||
break;
|
||||
case n_pole:
|
||||
case s_pole:
|
||||
if (q >= 0.) {
|
||||
b = sqrt(q);
|
||||
xy_x = b * sinlam;
|
||||
xy_y = coslam * (this->m_proj_parm.mode == s_pole ? b : -b);
|
||||
} else
|
||||
xy_x = xy_y = 0.;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// INVERSE(e_inverse) ellipsoid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
T cCe, sCe, q, rho, ab=0.0;
|
||||
|
||||
switch (this->m_proj_parm.mode) {
|
||||
case equit:
|
||||
case obliq:
|
||||
xy_x /= this->m_proj_parm.dd;
|
||||
xy_y *= this->m_proj_parm.dd;
|
||||
rho = boost::math::hypot(xy_x, xy_y);
|
||||
if (rho < epsilon10) {
|
||||
lp_lon = 0.;
|
||||
lp_lat = this->m_par.phi0;
|
||||
return;
|
||||
}
|
||||
sCe = 2. * asin(.5 * rho / this->m_proj_parm.rq);
|
||||
cCe = cos(sCe);
|
||||
sCe = sin(sCe);
|
||||
xy_x *= sCe;
|
||||
if (this->m_proj_parm.mode == obliq) {
|
||||
ab = cCe * this->m_proj_parm.sinb1 + xy_y * sCe * this->m_proj_parm.cosb1 / rho;
|
||||
xy_y = rho * this->m_proj_parm.cosb1 * cCe - xy_y * this->m_proj_parm.sinb1 * sCe;
|
||||
} else {
|
||||
ab = xy_y * sCe / rho;
|
||||
xy_y = rho * cCe;
|
||||
}
|
||||
break;
|
||||
case n_pole:
|
||||
xy_y = -xy_y;
|
||||
BOOST_FALLTHROUGH;
|
||||
case s_pole:
|
||||
q = (xy_x * xy_x + xy_y * xy_y);
|
||||
if (q == 0.0) {
|
||||
lp_lon = 0.;
|
||||
lp_lat = this->m_par.phi0;
|
||||
return;
|
||||
}
|
||||
ab = 1. - q / this->m_proj_parm.qp;
|
||||
if (this->m_proj_parm.mode == s_pole)
|
||||
ab = - ab;
|
||||
break;
|
||||
}
|
||||
lp_lon = atan2(xy_x, xy_y);
|
||||
lp_lat = pj_authlat(asin(ab), this->m_proj_parm.apa);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "laea_ellipsoid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_laea_spheroid
|
||||
: public base_t_fi<base_laea_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_laea<T> m_proj_parm;
|
||||
|
||||
inline base_laea_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_laea_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T fourth_pi = detail::fourth_pi<T>();
|
||||
|
||||
T coslam, cosphi, sinphi;
|
||||
|
||||
sinphi = sin(lp_lat);
|
||||
cosphi = cos(lp_lat);
|
||||
coslam = cos(lp_lon);
|
||||
switch (this->m_proj_parm.mode) {
|
||||
case equit:
|
||||
xy_y = 1. + cosphi * coslam;
|
||||
goto oblcon;
|
||||
case obliq:
|
||||
xy_y = 1. + this->m_proj_parm.sinb1 * sinphi + this->m_proj_parm.cosb1 * cosphi * coslam;
|
||||
oblcon:
|
||||
if (xy_y <= epsilon10) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
xy_y = sqrt(2. / xy_y);
|
||||
xy_x = xy_y * cosphi * sin(lp_lon);
|
||||
xy_y *= this->m_proj_parm.mode == equit ? sinphi :
|
||||
this->m_proj_parm.cosb1 * sinphi - this->m_proj_parm.sinb1 * cosphi * coslam;
|
||||
break;
|
||||
case n_pole:
|
||||
coslam = -coslam;
|
||||
BOOST_FALLTHROUGH;
|
||||
case s_pole:
|
||||
if (fabs(lp_lat + this->m_par.phi0) < epsilon10) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
xy_y = fourth_pi - lp_lat * .5;
|
||||
xy_y = 2. * (this->m_proj_parm.mode == s_pole ? cos(xy_y) : sin(xy_y));
|
||||
xy_x = xy_y * sin(lp_lon);
|
||||
xy_y *= coslam;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T cosz=0.0, rh, sinz=0.0;
|
||||
|
||||
rh = boost::math::hypot(xy_x, xy_y);
|
||||
if ((lp_lat = rh * .5 ) > 1.) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
lp_lat = 2. * asin(lp_lat);
|
||||
if (this->m_proj_parm.mode == obliq || this->m_proj_parm.mode == equit) {
|
||||
sinz = sin(lp_lat);
|
||||
cosz = cos(lp_lat);
|
||||
}
|
||||
switch (this->m_proj_parm.mode) {
|
||||
case equit:
|
||||
lp_lat = fabs(rh) <= epsilon10 ? 0. : asin(xy_y * sinz / rh);
|
||||
xy_x *= sinz;
|
||||
xy_y = cosz * rh;
|
||||
break;
|
||||
case obliq:
|
||||
lp_lat = fabs(rh) <= epsilon10 ? this->m_par.phi0 :
|
||||
asin(cosz * this->m_proj_parm.sinb1 + xy_y * sinz * this->m_proj_parm.cosb1 / rh);
|
||||
xy_x *= sinz * this->m_proj_parm.cosb1;
|
||||
xy_y = (cosz - sin(lp_lat) * this->m_proj_parm.sinb1) * rh;
|
||||
break;
|
||||
case n_pole:
|
||||
xy_y = -xy_y;
|
||||
lp_lat = half_pi - lp_lat;
|
||||
break;
|
||||
case s_pole:
|
||||
lp_lat -= half_pi;
|
||||
break;
|
||||
}
|
||||
lp_lon = (xy_y == 0. && (this->m_proj_parm.mode == equit || this->m_proj_parm.mode == obliq)) ?
|
||||
0. : atan2(xy_x, xy_y);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "laea_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Lambert Azimuthal Equal Area
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_laea(Parameters& par, par_laea<T>& proj_parm)
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T t;
|
||||
|
||||
t = fabs(par.phi0);
|
||||
if (fabs(t - half_pi) < epsilon10)
|
||||
proj_parm.mode = par.phi0 < 0. ? s_pole : n_pole;
|
||||
else if (fabs(t) < epsilon10)
|
||||
proj_parm.mode = equit;
|
||||
else
|
||||
proj_parm.mode = obliq;
|
||||
if (par.es != 0.0) {
|
||||
double sinphi;
|
||||
|
||||
par.e = sqrt(par.es);
|
||||
proj_parm.qp = pj_qsfn(1., par.e, par.one_es);
|
||||
proj_parm.mmf = .5 / (1. - par.es);
|
||||
proj_parm.apa = pj_authset<T>(par.es);
|
||||
switch (proj_parm.mode) {
|
||||
case n_pole:
|
||||
case s_pole:
|
||||
proj_parm.dd = 1.;
|
||||
break;
|
||||
case equit:
|
||||
proj_parm.dd = 1. / (proj_parm.rq = sqrt(.5 * proj_parm.qp));
|
||||
proj_parm.xmf = 1.;
|
||||
proj_parm.ymf = .5 * proj_parm.qp;
|
||||
break;
|
||||
case obliq:
|
||||
proj_parm.rq = sqrt(.5 * proj_parm.qp);
|
||||
sinphi = sin(par.phi0);
|
||||
proj_parm.sinb1 = pj_qsfn(sinphi, par.e, par.one_es) / proj_parm.qp;
|
||||
proj_parm.cosb1 = sqrt(1. - proj_parm.sinb1 * proj_parm.sinb1);
|
||||
proj_parm.dd = cos(par.phi0) / (sqrt(1. - par.es * sinphi * sinphi) *
|
||||
proj_parm.rq * proj_parm.cosb1);
|
||||
proj_parm.ymf = (proj_parm.xmf = proj_parm.rq) / proj_parm.dd;
|
||||
proj_parm.xmf *= proj_parm.dd;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (proj_parm.mode == obliq) {
|
||||
proj_parm.sinb1 = sin(par.phi0);
|
||||
proj_parm.cosb1 = cos(par.phi0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}} // namespace laea
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Lambert Azimuthal Equal Area projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Azimuthal
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Example
|
||||
\image html ex_laea.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct laea_ellipsoid : public detail::laea::base_laea_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline laea_ellipsoid(Params const& , Parameters const& par)
|
||||
: detail::laea::base_laea_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::laea::setup_laea(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Lambert Azimuthal Equal Area projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Azimuthal
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Example
|
||||
\image html ex_laea.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct laea_spheroid : public detail::laea::base_laea_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline laea_spheroid(Params const& , Parameters const& par)
|
||||
: detail::laea::base_laea_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::laea::setup_laea(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_laea, laea_spheroid, laea_ellipsoid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(laea_entry, laea_spheroid, laea_ellipsoid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(laea_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(laea, laea_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_LAEA_HPP
|
||||
|
||||
194
linx64/include/boost/geometry/srs/projections/proj/lagrng.hpp
Normal file
194
linx64/include/boost/geometry/srs/projections/proj/lagrng.hpp
Normal file
@@ -0,0 +1,194 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_LAGRNG_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_LAGRNG_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace lagrng
|
||||
{
|
||||
|
||||
static const double tolerance = 1e-10;
|
||||
|
||||
template <typename T>
|
||||
struct par_lagrng
|
||||
{
|
||||
T a1;
|
||||
T rw;
|
||||
T hrw;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_lagrng_spheroid
|
||||
: public base_t_f<base_lagrng_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_lagrng<T> m_proj_parm;
|
||||
|
||||
inline base_lagrng_spheroid(const Parameters& par)
|
||||
: base_t_f<base_lagrng_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T lp_lon, T lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T v, c;
|
||||
|
||||
if (fabs(fabs(lp_lat) - half_pi) < tolerance) {
|
||||
xy_x = 0;
|
||||
xy_y = lp_lat < 0 ? -2. : 2.;
|
||||
} else {
|
||||
lp_lat = sin(lp_lat);
|
||||
v = this->m_proj_parm.a1 * math::pow((T(1) + lp_lat)/(T(1) - lp_lat), this->m_proj_parm.hrw);
|
||||
if ((c = 0.5 * (v + 1./v) + cos(lp_lon *= this->m_proj_parm.rw)) < tolerance) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
xy_x = 2. * sin(lp_lon) / c;
|
||||
xy_y = (v - 1./v) / c;
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "lagrng_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Lagrange
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_lagrng(Params const& params, Parameters& par, par_lagrng<T>& proj_parm)
|
||||
{
|
||||
T phi1;
|
||||
|
||||
proj_parm.rw = 0.0;
|
||||
bool is_w_set = pj_param_f<srs::spar::w>(params, "W", srs::dpar::w, proj_parm.rw);
|
||||
|
||||
// Boost.Geometry specific, set default parameters manually
|
||||
if (! is_w_set) {
|
||||
bool const use_defaults = ! pj_get_param_b<srs::spar::no_defs>(params, "no_defs", srs::dpar::no_defs);
|
||||
if (use_defaults) {
|
||||
proj_parm.rw = 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (proj_parm.rw <= 0)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_w_or_m_zero_or_less) );
|
||||
|
||||
proj_parm.rw = 1. / proj_parm.rw;
|
||||
proj_parm.hrw = 0.5 * proj_parm.rw;
|
||||
phi1 = pj_get_param_r<T, srs::spar::lat_1>(params, "lat_1", srs::dpar::lat_1);
|
||||
if (fabs(fabs(phi1 = sin(phi1)) - 1.) < tolerance)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_lat_larger_than_90) );
|
||||
|
||||
proj_parm.a1 = math::pow((T(1) - phi1)/(T(1) + phi1), proj_parm.hrw);
|
||||
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::lagrng
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Lagrange projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
- no inverse
|
||||
\par Projection parameters
|
||||
- W (real)
|
||||
- lat_1: Latitude of first standard parallel (degrees)
|
||||
\par Example
|
||||
\image html ex_lagrng.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct lagrng_spheroid : public detail::lagrng::base_lagrng_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline lagrng_spheroid(Params const& params, Parameters const& par)
|
||||
: detail::lagrng::base_lagrng_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::lagrng::setup_lagrng(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_lagrng, lagrng_spheroid, lagrng_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(lagrng_entry, lagrng_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(lagrng_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(lagrng, lagrng_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_LAGRNG_HPP
|
||||
|
||||
140
linx64/include/boost/geometry/srs/projections/proj/larr.hpp
Normal file
140
linx64/include/boost/geometry/srs/projections/proj/larr.hpp
Normal file
@@ -0,0 +1,140 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_LARR_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_LARR_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace larr
|
||||
{
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_larr_spheroid
|
||||
: public base_t_f<base_larr_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_larr_spheroid(const Parameters& par)
|
||||
: base_t_f<base_larr_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) sphere
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T sixth = detail::sixth<T>();
|
||||
|
||||
xy_x = 0.5 * lp_lon * (1. + sqrt(cos(lp_lat)));
|
||||
xy_y = lp_lat / (cos(0.5 * lp_lat) * cos(sixth * lp_lon));
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "larr_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Larrivee
|
||||
template <typename Parameters>
|
||||
inline void setup_larr(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::larr
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Larrivee projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
- no inverse
|
||||
\par Example
|
||||
\image html ex_larr.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct larr_spheroid : public detail::larr::base_larr_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline larr_spheroid(Params const& , Parameters const& par)
|
||||
: detail::larr::base_larr_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::larr::setup_larr(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_larr, larr_spheroid, larr_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(larr_entry, larr_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(larr_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(larr, larr_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_LARR_HPP
|
||||
|
||||
154
linx64/include/boost/geometry/srs/projections/proj/lask.hpp
Normal file
154
linx64/include/boost/geometry/srs/projections/proj/lask.hpp
Normal file
@@ -0,0 +1,154 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_LASK_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_LASK_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace lask
|
||||
{
|
||||
|
||||
static const double a10 = 0.975534;
|
||||
static const double a12 = -0.119161;
|
||||
static const double a32 = -0.0143059;
|
||||
static const double a14 = -0.0547009;
|
||||
static const double b01 = 1.00384;
|
||||
static const double b21 = 0.0802894;
|
||||
static const double b03 = 0.0998909;
|
||||
static const double b41 = 0.000199025;
|
||||
static const double b23 = -0.0285500;
|
||||
static const double b05 = -0.0491032;
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_lask_spheroid
|
||||
: public base_t_f<base_lask_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_lask_spheroid(const Parameters& par)
|
||||
: base_t_f<base_lask_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) sphere
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T l2, p2;
|
||||
|
||||
l2 = lp_lon * lp_lon;
|
||||
p2 = lp_lat * lp_lat;
|
||||
xy_x = lp_lon * (a10 + p2 * (a12 + l2 * a32 + p2 * a14));
|
||||
xy_y = lp_lat * (b01 + l2 * (b21 + p2 * b23 + l2 * b41) +
|
||||
p2 * (b03 + p2 * b05));
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "lask_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Laskowski
|
||||
template <typename Parameters>
|
||||
inline void setup_lask(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::lask
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Laskowski projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
- no inverse
|
||||
\par Example
|
||||
\image html ex_lask.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct lask_spheroid : public detail::lask::base_lask_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline lask_spheroid(Params const& , Parameters const& par)
|
||||
: detail::lask::base_lask_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::lask::setup_lask(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_lask, lask_spheroid, lask_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(lask_entry, lask_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(lask_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(lask, lask_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_LASK_HPP
|
||||
|
||||
163
linx64/include/boost/geometry/srs/projections/proj/latlong.hpp
Normal file
163
linx64/include/boost/geometry/srs/projections/proj/latlong.hpp
Normal file
@@ -0,0 +1,163 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Purpose: Stub projection implementation for lat/long coordinates. We
|
||||
// don't actually change the coordinates, but we want proj=latlong
|
||||
// to act sort of like a projection.
|
||||
// Author: Frank Warmerdam, warmerdam@pobox.com
|
||||
// Copyright (c) 2000, Frank Warmerdam
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_LATLONG_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_LATLONG_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace latlong
|
||||
{
|
||||
|
||||
/* very loosely based upon DMA code by Bradford W. Drew */
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_latlong_other
|
||||
: public base_t_fi<base_latlong_other<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_latlong_other(const Parameters& par)
|
||||
: base_t_fi<base_latlong_other<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(forward)
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
// TODO: in the original code a is not used
|
||||
// different mechanism is probably used instead
|
||||
xy_x = lp_lon / this->m_par.a;
|
||||
xy_y = lp_lat / this->m_par.a;
|
||||
}
|
||||
|
||||
// INVERSE(inverse)
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
// TODO: in the original code a is not used
|
||||
// different mechanism is probably used instead
|
||||
lp_lat = xy_y * this->m_par.a;
|
||||
lp_lon = xy_x * this->m_par.a;
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "latlong_other";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Lat/long (Geodetic)
|
||||
template <typename Parameters>
|
||||
inline void setup_latlong(Parameters& par)
|
||||
{
|
||||
par.is_latlong = 1;
|
||||
par.x0 = 0.0;
|
||||
par.y0 = 0.0;
|
||||
}
|
||||
|
||||
}} // namespace detail::latlong
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Lat/long (Geodetic) projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Example
|
||||
\image html ex_latlong.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct latlong_other : public detail::latlong::base_latlong_other<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline latlong_other(Params const& , Parameters const& par)
|
||||
: detail::latlong::base_latlong_other<T, Parameters>(par)
|
||||
{
|
||||
detail::latlong::setup_latlong(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_lonlat, latlong_other, latlong_other)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_latlon, latlong_other, latlong_other)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_latlong, latlong_other, latlong_other)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_longlat, latlong_other, latlong_other)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(latlong_entry, latlong_other)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(latlong_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(lonlat, latlong_entry)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(latlon, latlong_entry)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(latlong, latlong_entry)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(longlat, latlong_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_LATLONG_HPP
|
||||
|
||||
272
linx64/include/boost/geometry/srs/projections/proj/lcc.hpp
Normal file
272
linx64/include/boost/geometry/srs/projections/proj/lcc.hpp
Normal file
@@ -0,0 +1,272 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_LCC_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_LCC_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_msfn.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_phi2.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_tsfn.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
#include <boost/math/special_functions/hypot.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace lcc
|
||||
{
|
||||
static const double epsilon10 = 1.e-10;
|
||||
|
||||
template <typename T>
|
||||
struct par_lcc
|
||||
{
|
||||
T phi1;
|
||||
T phi2;
|
||||
T n;
|
||||
T rho0;
|
||||
T c;
|
||||
int ellips;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_lcc_ellipsoid
|
||||
: public base_t_fi<base_lcc_ellipsoid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_lcc<T> m_proj_parm;
|
||||
|
||||
inline base_lcc_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_lcc_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_forward) ellipsoid & spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T fourth_pi = detail::fourth_pi<T>();
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T rho;
|
||||
|
||||
if (fabs(fabs(lp_lat) - half_pi) < epsilon10) {
|
||||
if ((lp_lat * this->m_proj_parm.n) <= 0.) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
rho = 0.;
|
||||
} else {
|
||||
rho = this->m_proj_parm.c * (this->m_proj_parm.ellips
|
||||
? math::pow(pj_tsfn(lp_lat, sin(lp_lat), this->m_par.e), this->m_proj_parm.n)
|
||||
: math::pow(tan(fourth_pi + T(0.5) * lp_lat), -this->m_proj_parm.n));
|
||||
}
|
||||
lp_lon *= this->m_proj_parm.n;
|
||||
xy_x = this->m_par.k0 * (rho * sin( lp_lon) );
|
||||
xy_y = this->m_par.k0 * (this->m_proj_parm.rho0 - rho * cos(lp_lon) );
|
||||
}
|
||||
|
||||
// INVERSE(e_inverse) ellipsoid & spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T rho;
|
||||
|
||||
xy_x /= this->m_par.k0;
|
||||
xy_y /= this->m_par.k0;
|
||||
|
||||
xy_y = this->m_proj_parm.rho0 - xy_y;
|
||||
rho = boost::math::hypot(xy_x, xy_y);
|
||||
if(rho != 0.0) {
|
||||
if (this->m_proj_parm.n < 0.) {
|
||||
rho = -rho;
|
||||
xy_x = -xy_x;
|
||||
xy_y = -xy_y;
|
||||
}
|
||||
if (this->m_proj_parm.ellips) {
|
||||
lp_lat = pj_phi2(math::pow(rho / this->m_proj_parm.c, T(1)/this->m_proj_parm.n), this->m_par.e);
|
||||
if (lp_lat == HUGE_VAL) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
} else
|
||||
lp_lat = 2. * atan(math::pow(this->m_proj_parm.c / rho, T(1)/this->m_proj_parm.n)) - half_pi;
|
||||
lp_lon = atan2(xy_x, xy_y) / this->m_proj_parm.n;
|
||||
} else {
|
||||
lp_lon = 0.;
|
||||
lp_lat = this->m_proj_parm.n > 0. ? half_pi : -half_pi;
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "lcc_ellipsoid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Lambert Conformal Conic
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_lcc(Params const& params, Parameters& par, par_lcc<T>& proj_parm)
|
||||
{
|
||||
static const T fourth_pi = detail::fourth_pi<T>();
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T cosphi, sinphi;
|
||||
int secant;
|
||||
|
||||
proj_parm.phi1 = 0.0;
|
||||
proj_parm.phi2 = 0.0;
|
||||
bool is_phi1_set = pj_param_r<srs::spar::lat_1>(params, "lat_1", srs::dpar::lat_1, proj_parm.phi1);
|
||||
bool is_phi2_set = pj_param_r<srs::spar::lat_2>(params, "lat_2", srs::dpar::lat_2, proj_parm.phi2);
|
||||
|
||||
// Boost.Geometry specific, set default parameters manually
|
||||
if (! is_phi1_set || ! is_phi2_set) {
|
||||
bool const use_defaults = ! pj_get_param_b<srs::spar::no_defs>(params, "no_defs", srs::dpar::no_defs);
|
||||
if (use_defaults) {
|
||||
if (!is_phi1_set) {
|
||||
proj_parm.phi1 = 33;
|
||||
is_phi1_set = true;
|
||||
}
|
||||
if (!is_phi2_set) {
|
||||
proj_parm.phi2 = 45;
|
||||
is_phi2_set = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! is_phi2_set) {
|
||||
proj_parm.phi2 = proj_parm.phi1;
|
||||
if (! pj_param_exists<srs::spar::lat_0>(params, "lat_0", srs::dpar::lat_0))
|
||||
par.phi0 = proj_parm.phi1;
|
||||
}
|
||||
if (fabs(proj_parm.phi1 + proj_parm.phi2) < epsilon10)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_conic_lat_equal) );
|
||||
|
||||
proj_parm.n = sinphi = sin(proj_parm.phi1);
|
||||
cosphi = cos(proj_parm.phi1);
|
||||
secant = fabs(proj_parm.phi1 - proj_parm.phi2) >= epsilon10;
|
||||
if( (proj_parm.ellips = (par.es != 0.)) ) {
|
||||
double ml1, m1;
|
||||
|
||||
par.e = sqrt(par.es);
|
||||
m1 = pj_msfn(sinphi, cosphi, par.es);
|
||||
ml1 = pj_tsfn(proj_parm.phi1, sinphi, par.e);
|
||||
if (secant) { /* secant cone */
|
||||
sinphi = sin(proj_parm.phi2);
|
||||
proj_parm.n = log(m1 / pj_msfn(sinphi, cos(proj_parm.phi2), par.es));
|
||||
proj_parm.n /= log(ml1 / pj_tsfn(proj_parm.phi2, sinphi, par.e));
|
||||
}
|
||||
proj_parm.c = (proj_parm.rho0 = m1 * math::pow(ml1, -proj_parm.n) / proj_parm.n);
|
||||
proj_parm.rho0 *= (fabs(fabs(par.phi0) - half_pi) < epsilon10) ? T(0) :
|
||||
math::pow(pj_tsfn(par.phi0, sin(par.phi0), par.e), proj_parm.n);
|
||||
} else {
|
||||
if (secant)
|
||||
proj_parm.n = log(cosphi / cos(proj_parm.phi2)) /
|
||||
log(tan(fourth_pi + .5 * proj_parm.phi2) /
|
||||
tan(fourth_pi + .5 * proj_parm.phi1));
|
||||
proj_parm.c = cosphi * math::pow(tan(fourth_pi + T(0.5) * proj_parm.phi1), proj_parm.n) / proj_parm.n;
|
||||
proj_parm.rho0 = (fabs(fabs(par.phi0) - half_pi) < epsilon10) ? 0. :
|
||||
proj_parm.c * math::pow(tan(fourth_pi + T(0.5) * par.phi0), -proj_parm.n);
|
||||
}
|
||||
}
|
||||
|
||||
}} // namespace detail::lcc
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Lambert Conformal Conic projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Conic
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Projection parameters
|
||||
- lat_1: Latitude of first standard parallel (degrees)
|
||||
- lat_2: Latitude of second standard parallel (degrees)
|
||||
- lat_0: Latitude of origin
|
||||
\par Example
|
||||
\image html ex_lcc.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct lcc_ellipsoid : public detail::lcc::base_lcc_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline lcc_ellipsoid(Params const& params, Parameters const& par)
|
||||
: detail::lcc::base_lcc_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::lcc::setup_lcc(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_lcc, lcc_ellipsoid, lcc_ellipsoid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(lcc_entry, lcc_ellipsoid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(lcc_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(lcc, lcc_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_LCC_HPP
|
||||
|
||||
256
linx64/include/boost/geometry/srs/projections/proj/lcca.hpp
Normal file
256
linx64/include/boost/geometry/srs/projections/proj/lcca.hpp
Normal file
@@ -0,0 +1,256 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
/*****************************************************************************
|
||||
|
||||
Lambert Conformal Conic Alternative
|
||||
-----------------------------------
|
||||
|
||||
This is Gerald Evenden's 2003 implementation of an alternative
|
||||
"almost" LCC, which has been in use historically, but which
|
||||
should NOT be used for new projects - i.e: use this implementation
|
||||
if you need interoperability with old data represented in this
|
||||
projection, but not in any other case.
|
||||
|
||||
The code was originally discussed on the PROJ.4 mailing list in
|
||||
a thread archived over at
|
||||
|
||||
http://lists.maptools.org/pipermail/proj/2003-March/000644.html
|
||||
|
||||
It was discussed again in the thread starting at
|
||||
|
||||
http://lists.maptools.org/pipermail/proj/2017-October/007828.html
|
||||
and continuing at
|
||||
http://lists.maptools.org/pipermail/proj/2017-November/007831.html
|
||||
|
||||
which prompted Clifford J. Mugnier to add these clarifying notes:
|
||||
|
||||
The French Army Truncated Cubic Lambert (partially conformal) Conic
|
||||
projection is the Legal system for the projection in France between
|
||||
the late 1800s and 1948 when the French Legislature changed the law
|
||||
to recognize the fully conformal version.
|
||||
|
||||
It was (might still be in one or two North African prior French
|
||||
Colonies) used in North Africa in Algeria, Tunisia, & Morocco, as
|
||||
well as in Syria during the Levant.
|
||||
|
||||
Last time I have seen it used was about 30+ years ago in
|
||||
Algeria when it was used to define Lease Block boundaries for
|
||||
Petroleum Exploration & Production.
|
||||
|
||||
(signed)
|
||||
|
||||
Clifford J. Mugnier, c.p., c.m.s.
|
||||
Chief of Geodesy
|
||||
LSU Center for GeoInformatics
|
||||
Dept. of Civil Engineering
|
||||
LOUISIANA STATE UNIVERSITY
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_LCCA_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_LCCA_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_mlfn.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace lcca
|
||||
{
|
||||
|
||||
static const int max_iter = 10;
|
||||
static const double del_tol = 1e-12;
|
||||
|
||||
template <typename T>
|
||||
struct par_lcca
|
||||
{
|
||||
detail::en<T> en;
|
||||
T r0, l, M0;
|
||||
T C;
|
||||
};
|
||||
|
||||
template <typename T> /* func to compute dr */
|
||||
inline T fS(T const& S, T const& C)
|
||||
{
|
||||
return(S * ( 1. + S * S * C));
|
||||
}
|
||||
|
||||
template <typename T> /* deriv of fs */
|
||||
inline T fSp(T const& S, T const& C)
|
||||
{
|
||||
return(1. + 3.* S * S * C);
|
||||
}
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_lcca_ellipsoid
|
||||
: public base_t_fi<base_lcca_ellipsoid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_lcca<T> m_proj_parm;
|
||||
|
||||
inline base_lcca_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_lcca_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_forward) ellipsoid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T S, r, dr;
|
||||
|
||||
S = pj_mlfn(lp_lat, sin(lp_lat), cos(lp_lat), this->m_proj_parm.en) - this->m_proj_parm.M0;
|
||||
dr = fS(S, this->m_proj_parm.C);
|
||||
r = this->m_proj_parm.r0 - dr;
|
||||
xy_x = this->m_par.k0 * (r * sin( lp_lon *= this->m_proj_parm.l ) );
|
||||
xy_y = this->m_par.k0 * (this->m_proj_parm.r0 - r * cos(lp_lon) );
|
||||
}
|
||||
|
||||
// INVERSE(e_inverse) ellipsoid & spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
T theta, dr, S, dif;
|
||||
int i;
|
||||
|
||||
xy_x /= this->m_par.k0;
|
||||
xy_y /= this->m_par.k0;
|
||||
theta = atan2(xy_x , this->m_proj_parm.r0 - xy_y);
|
||||
dr = xy_y - xy_x * tan(0.5 * theta);
|
||||
lp_lon = theta / this->m_proj_parm.l;
|
||||
S = dr;
|
||||
for (i = max_iter; i ; --i) {
|
||||
S -= (dif = (fS(S, this->m_proj_parm.C) - dr) / fSp(S, this->m_proj_parm.C));
|
||||
if (fabs(dif) < del_tol) break;
|
||||
}
|
||||
if (!i) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
lp_lat = pj_inv_mlfn(S + this->m_proj_parm.M0, this->m_par.es, this->m_proj_parm.en);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "lcca_ellipsoid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Lambert Conformal Conic Alternative
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_lcca(Parameters& par, par_lcca<T>& proj_parm)
|
||||
{
|
||||
T s2p0, N0, R0, tan0;
|
||||
|
||||
proj_parm.en = pj_enfn<T>(par.es);
|
||||
|
||||
if (par.phi0 == 0.) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_lat_0_is_zero) );
|
||||
}
|
||||
proj_parm.l = sin(par.phi0);
|
||||
proj_parm.M0 = pj_mlfn(par.phi0, proj_parm.l, cos(par.phi0), proj_parm.en);
|
||||
s2p0 = proj_parm.l * proj_parm.l;
|
||||
R0 = 1. / (1. - par.es * s2p0);
|
||||
N0 = sqrt(R0);
|
||||
R0 *= par.one_es * N0;
|
||||
tan0 = tan(par.phi0);
|
||||
proj_parm.r0 = N0 / tan0;
|
||||
proj_parm.C = 1. / (6. * R0 * N0);
|
||||
}
|
||||
|
||||
}} // namespace detail::lcca
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Lambert Conformal Conic Alternative projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Conic
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Projection parameters
|
||||
- lat_0: Latitude of origin
|
||||
\par Example
|
||||
\image html ex_lcca.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct lcca_ellipsoid : public detail::lcca::base_lcca_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline lcca_ellipsoid(Params const& , Parameters const& par)
|
||||
: detail::lcca::base_lcca_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::lcca::setup_lcca(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_lcca, lcca_ellipsoid, lcca_ellipsoid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(lcca_entry, lcca_ellipsoid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(lcca_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(lcca, lcca_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_LCCA_HPP
|
||||
|
||||
192
linx64/include/boost/geometry/srs/projections/proj/loxim.hpp
Normal file
192
linx64/include/boost/geometry/srs/projections/proj/loxim.hpp
Normal file
@@ -0,0 +1,192 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_LOXIM_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_LOXIM_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace loxim
|
||||
{
|
||||
static const double epsilon = 1e-8;
|
||||
|
||||
template <typename T>
|
||||
struct par_loxim
|
||||
{
|
||||
T phi1;
|
||||
T cosphi1;
|
||||
T tanphi1;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_loxim_spheroid
|
||||
: public base_t_fi<base_loxim_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_loxim<T> m_proj_parm;
|
||||
|
||||
inline base_loxim_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_loxim_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T fourth_pi = detail::fourth_pi<T>();
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
xy_y = lp_lat - this->m_proj_parm.phi1;
|
||||
if (fabs(xy_y) < epsilon)
|
||||
xy_x = lp_lon * this->m_proj_parm.cosphi1;
|
||||
else {
|
||||
xy_x = fourth_pi + 0.5 * lp_lat;
|
||||
if (fabs(xy_x) < epsilon || fabs(fabs(xy_x) - half_pi) < epsilon)
|
||||
xy_x = 0.;
|
||||
else
|
||||
xy_x = lp_lon * xy_y / log( tan(xy_x) / this->m_proj_parm.tanphi1 );
|
||||
}
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T fourth_pi = detail::fourth_pi<T>();
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
lp_lat = xy_y + this->m_proj_parm.phi1;
|
||||
if (fabs(xy_y) < epsilon) {
|
||||
lp_lon = xy_x / this->m_proj_parm.cosphi1;
|
||||
} else {
|
||||
lp_lon = fourth_pi + 0.5 * lp_lat;
|
||||
if (fabs(lp_lon) < epsilon || fabs(fabs(lp_lon) - half_pi) < epsilon)
|
||||
lp_lon = 0.;
|
||||
else
|
||||
lp_lon = xy_x * log( tan(lp_lon) / this->m_proj_parm.tanphi1 ) / xy_y ;
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "loxim_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Loximuthal
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_loxim(Params const& params, Parameters& par, par_loxim<T>& proj_parm)
|
||||
{
|
||||
static const T fourth_pi = detail::fourth_pi<T>();
|
||||
|
||||
proj_parm.phi1 = pj_get_param_r<T, srs::spar::lat_1>(params, "lat_1", srs::dpar::lat_1);
|
||||
proj_parm.cosphi1 = cos(proj_parm.phi1);
|
||||
if (proj_parm.cosphi1 < epsilon)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_lat_larger_than_90) );
|
||||
|
||||
proj_parm.tanphi1 = tan(fourth_pi + 0.5 * proj_parm.phi1);
|
||||
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::loxim
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Loximuthal projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Projection parameters
|
||||
- lat_1: Latitude of first standard parallel (degrees)
|
||||
\par Example
|
||||
\image html ex_loxim.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct loxim_spheroid : public detail::loxim::base_loxim_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline loxim_spheroid(Params const& params, Parameters const& par)
|
||||
: detail::loxim::base_loxim_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::loxim::setup_loxim(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_loxim, loxim_spheroid, loxim_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(loxim_entry, loxim_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(loxim_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(loxim, loxim_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_LOXIM_HPP
|
||||
|
||||
340
linx64/include/boost/geometry/srs/projections/proj/lsat.hpp
Normal file
340
linx64/include/boost/geometry/srs/projections/proj/lsat.hpp
Normal file
@@ -0,0 +1,340 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_LSAT_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_LSAT_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/aasincos.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace lsat
|
||||
{
|
||||
static const double tolerance = 1e-7;
|
||||
|
||||
template <typename T>
|
||||
struct par_lsat
|
||||
{
|
||||
T a2, a4, b, c1, c3;
|
||||
T q, t, u, w, p22, sa, ca, xj, rlm, rlm2;
|
||||
};
|
||||
|
||||
/* based upon Snyder and Linck, USGS-NMD */
|
||||
template <typename T>
|
||||
inline void
|
||||
seraz0(T lam, T const& mult, par_lsat<T>& proj_parm)
|
||||
{
|
||||
T sdsq, h, s, fc, sd, sq, d__1 = 0;
|
||||
|
||||
lam *= geometry::math::d2r<T>();
|
||||
sd = sin(lam);
|
||||
sdsq = sd * sd;
|
||||
s = proj_parm.p22 * proj_parm.sa * cos(lam) * sqrt((1. + proj_parm.t * sdsq)
|
||||
/ ((1. + proj_parm.w * sdsq) * (1. + proj_parm.q * sdsq)));
|
||||
|
||||
d__1 = 1. + proj_parm.q * sdsq;
|
||||
h = sqrt((1. + proj_parm.q * sdsq) / (1. + proj_parm.w * sdsq)) * ((1. + proj_parm.w * sdsq)
|
||||
/ (d__1 * d__1) - proj_parm.p22 * proj_parm.ca);
|
||||
|
||||
sq = sqrt(proj_parm.xj * proj_parm.xj + s * s);
|
||||
fc = mult * (h * proj_parm.xj - s * s) / sq;
|
||||
proj_parm.b += fc;
|
||||
proj_parm.a2 += fc * cos(lam + lam);
|
||||
proj_parm.a4 += fc * cos(lam * 4.);
|
||||
fc = mult * s * (h + proj_parm.xj) / sq;
|
||||
proj_parm.c1 += fc * cos(lam);
|
||||
proj_parm.c3 += fc * cos(lam * 3.);
|
||||
}
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_lsat_ellipsoid
|
||||
: public base_t_fi<base_lsat_ellipsoid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_lsat<T> m_proj_parm;
|
||||
|
||||
inline base_lsat_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_lsat_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_forward) ellipsoid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T fourth_pi = detail::fourth_pi<T>();
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
static const T one_and_half_pi = detail::one_and_half_pi<T>();
|
||||
static const T two_and_half_pi = detail::two_and_half_pi<T>();
|
||||
|
||||
int l, nn;
|
||||
T lamt = 0.0, xlam, sdsq, c, d, s, lamdp = 0.0, phidp, lampp, tanph;
|
||||
T lamtp, cl, sd, sp, sav, tanphi;
|
||||
|
||||
if (lp_lat > half_pi)
|
||||
lp_lat = half_pi;
|
||||
else if (lp_lat < -half_pi)
|
||||
lp_lat = -half_pi;
|
||||
|
||||
if (lp_lat >= 0. )
|
||||
lampp = half_pi;
|
||||
else
|
||||
lampp = one_and_half_pi;
|
||||
tanphi = tan(lp_lat);
|
||||
for (nn = 0;;) {
|
||||
T fac;
|
||||
sav = lampp;
|
||||
lamtp = lp_lon + this->m_proj_parm.p22 * lampp;
|
||||
cl = cos(lamtp);
|
||||
if (fabs(cl) < tolerance)
|
||||
lamtp -= tolerance;
|
||||
if( cl < 0 )
|
||||
fac = lampp + sin(lampp) * half_pi;
|
||||
else
|
||||
fac = lampp - sin(lampp) * half_pi;
|
||||
for (l = 50; l; --l) {
|
||||
lamt = lp_lon + this->m_proj_parm.p22 * sav;
|
||||
c = cos(lamt);
|
||||
if (fabs(c) < tolerance)
|
||||
lamt -= tolerance;
|
||||
xlam = (this->m_par.one_es * tanphi * this->m_proj_parm.sa + sin(lamt) * this->m_proj_parm.ca) / c;
|
||||
lamdp = atan(xlam) + fac;
|
||||
if (fabs(fabs(sav) - fabs(lamdp)) < tolerance)
|
||||
break;
|
||||
sav = lamdp;
|
||||
}
|
||||
if (!l || ++nn >= 3 || (lamdp > this->m_proj_parm.rlm && lamdp < this->m_proj_parm.rlm2))
|
||||
break;
|
||||
if (lamdp <= this->m_proj_parm.rlm)
|
||||
lampp = two_and_half_pi;
|
||||
else if (lamdp >= this->m_proj_parm.rlm2)
|
||||
lampp = half_pi;
|
||||
}
|
||||
if (l) {
|
||||
sp = sin(lp_lat);
|
||||
phidp = aasin((this->m_par.one_es * this->m_proj_parm.ca * sp - this->m_proj_parm.sa * cos(lp_lat) *
|
||||
sin(lamt)) / sqrt(1. - this->m_par.es * sp * sp));
|
||||
tanph = log(tan(fourth_pi + .5 * phidp));
|
||||
sd = sin(lamdp);
|
||||
sdsq = sd * sd;
|
||||
s = this->m_proj_parm.p22 * this->m_proj_parm.sa * cos(lamdp) * sqrt((1. + this->m_proj_parm.t * sdsq)
|
||||
/ ((1. + this->m_proj_parm.w * sdsq) * (1. + this->m_proj_parm.q * sdsq)));
|
||||
d = sqrt(this->m_proj_parm.xj * this->m_proj_parm.xj + s * s);
|
||||
xy_x = this->m_proj_parm.b * lamdp + this->m_proj_parm.a2 * sin(2. * lamdp) + this->m_proj_parm.a4 *
|
||||
sin(lamdp * 4.) - tanph * s / d;
|
||||
xy_y = this->m_proj_parm.c1 * sd + this->m_proj_parm.c3 * sin(lamdp * 3.) + tanph * this->m_proj_parm.xj / d;
|
||||
} else
|
||||
xy_x = xy_y = HUGE_VAL;
|
||||
}
|
||||
|
||||
// INVERSE(e_inverse) ellipsoid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T fourth_pi = detail::fourth_pi<T>();
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
int nn;
|
||||
T lamt, sdsq, s, lamdp, phidp, sppsq, dd, sd, sl, fac, scl, sav, spp;
|
||||
|
||||
lamdp = xy_x / this->m_proj_parm.b;
|
||||
nn = 50;
|
||||
do {
|
||||
sav = lamdp;
|
||||
sd = sin(lamdp);
|
||||
sdsq = sd * sd;
|
||||
s = this->m_proj_parm.p22 * this->m_proj_parm.sa * cos(lamdp) * sqrt((1. + this->m_proj_parm.t * sdsq)
|
||||
/ ((1. + this->m_proj_parm.w * sdsq) * (1. + this->m_proj_parm.q * sdsq)));
|
||||
lamdp = xy_x + xy_y * s / this->m_proj_parm.xj - this->m_proj_parm.a2 * sin(
|
||||
2. * lamdp) - this->m_proj_parm.a4 * sin(lamdp * 4.) - s / this->m_proj_parm.xj * (
|
||||
this->m_proj_parm.c1 * sin(lamdp) + this->m_proj_parm.c3 * sin(lamdp * 3.));
|
||||
lamdp /= this->m_proj_parm.b;
|
||||
} while (fabs(lamdp - sav) >= tolerance && --nn);
|
||||
sl = sin(lamdp);
|
||||
fac = exp(sqrt(1. + s * s / this->m_proj_parm.xj / this->m_proj_parm.xj) * (xy_y -
|
||||
this->m_proj_parm.c1 * sl - this->m_proj_parm.c3 * sin(lamdp * 3.)));
|
||||
phidp = 2. * (atan(fac) - fourth_pi);
|
||||
dd = sl * sl;
|
||||
if (fabs(cos(lamdp)) < tolerance)
|
||||
lamdp -= tolerance;
|
||||
spp = sin(phidp);
|
||||
sppsq = spp * spp;
|
||||
lamt = atan(((1. - sppsq * this->m_par.rone_es) * tan(lamdp) *
|
||||
this->m_proj_parm.ca - spp * this->m_proj_parm.sa * sqrt((1. + this->m_proj_parm.q * dd) * (
|
||||
1. - sppsq) - sppsq * this->m_proj_parm.u) / cos(lamdp)) / (1. - sppsq
|
||||
* (1. + this->m_proj_parm.u)));
|
||||
sl = lamt >= 0. ? 1. : -1.;
|
||||
scl = cos(lamdp) >= 0. ? 1. : -1;
|
||||
lamt -= half_pi * (1. - scl) * sl;
|
||||
lp_lon = lamt - this->m_proj_parm.p22 * lamdp;
|
||||
if (fabs(this->m_proj_parm.sa) < tolerance)
|
||||
lp_lat = aasin(spp / sqrt(this->m_par.one_es * this->m_par.one_es + this->m_par.es * sppsq));
|
||||
else
|
||||
lp_lat = atan((tan(lamdp) * cos(lamt) - this->m_proj_parm.ca * sin(lamt)) /
|
||||
(this->m_par.one_es * this->m_proj_parm.sa));
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "lsat_ellipsoid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Space oblique for LANDSAT
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_lsat(Params const& params, Parameters& par, par_lsat<T>& proj_parm)
|
||||
{
|
||||
static T const d2r = geometry::math::d2r<T>();
|
||||
static T const pi = detail::pi<T>();
|
||||
static T const two_pi = detail::two_pi<T>();
|
||||
|
||||
int land, path;
|
||||
T lam, alf, esc, ess;
|
||||
|
||||
land = pj_get_param_i<srs::spar::lsat>(params, "lsat", srs::dpar::lsat);
|
||||
if (land <= 0 || land > 5)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_lsat_not_in_range) );
|
||||
|
||||
path = pj_get_param_i<srs::spar::path>(params, "path", srs::dpar::path);
|
||||
if (path <= 0 || path > (land <= 3 ? 251 : 233))
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_path_not_in_range) );
|
||||
|
||||
if (land <= 3) {
|
||||
par.lam0 = d2r * 128.87 - two_pi / 251. * path;
|
||||
proj_parm.p22 = 103.2669323;
|
||||
alf = d2r * 99.092;
|
||||
} else {
|
||||
par.lam0 = d2r * 129.3 - two_pi / 233. * path;
|
||||
proj_parm.p22 = 98.8841202;
|
||||
alf = d2r * 98.2;
|
||||
}
|
||||
proj_parm.p22 /= 1440.;
|
||||
proj_parm.sa = sin(alf);
|
||||
proj_parm.ca = cos(alf);
|
||||
if (fabs(proj_parm.ca) < 1e-9)
|
||||
proj_parm.ca = 1e-9;
|
||||
esc = par.es * proj_parm.ca * proj_parm.ca;
|
||||
ess = par.es * proj_parm.sa * proj_parm.sa;
|
||||
proj_parm.w = (1. - esc) * par.rone_es;
|
||||
proj_parm.w = proj_parm.w * proj_parm.w - 1.;
|
||||
proj_parm.q = ess * par.rone_es;
|
||||
proj_parm.t = ess * (2. - par.es) * par.rone_es * par.rone_es;
|
||||
proj_parm.u = esc * par.rone_es;
|
||||
proj_parm.xj = par.one_es * par.one_es * par.one_es;
|
||||
proj_parm.rlm = pi * (1. / 248. + .5161290322580645);
|
||||
proj_parm.rlm2 = proj_parm.rlm + two_pi;
|
||||
proj_parm.a2 = proj_parm.a4 = proj_parm.b = proj_parm.c1 = proj_parm.c3 = 0.;
|
||||
seraz0(0., 1., proj_parm);
|
||||
for (lam = 9.; lam <= 81.0001; lam += 18.)
|
||||
seraz0(lam, 4., proj_parm);
|
||||
for (lam = 18; lam <= 72.0001; lam += 18.)
|
||||
seraz0(lam, 2., proj_parm);
|
||||
seraz0(90., 1., proj_parm);
|
||||
proj_parm.a2 /= 30.;
|
||||
proj_parm.a4 /= 60.;
|
||||
proj_parm.b /= 30.;
|
||||
proj_parm.c1 /= 15.;
|
||||
proj_parm.c3 /= 45.;
|
||||
}
|
||||
|
||||
}} // namespace detail::lsat
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Space oblique for LANDSAT projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Projection parameters
|
||||
- lsat (integer)
|
||||
- path (integer)
|
||||
\par Example
|
||||
\image html ex_lsat.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct lsat_ellipsoid : public detail::lsat::base_lsat_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline lsat_ellipsoid(Params const& params, Parameters const& par)
|
||||
: detail::lsat::base_lsat_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::lsat::setup_lsat(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_lsat, lsat_ellipsoid, lsat_ellipsoid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(lsat_entry, lsat_ellipsoid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(lsat_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(lsat, lsat_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_LSAT_HPP
|
||||
|
||||
175
linx64/include/boost/geometry/srs/projections/proj/mbt_fps.hpp
Normal file
175
linx64/include/boost/geometry/srs/projections/proj/mbt_fps.hpp
Normal file
@@ -0,0 +1,175 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_MBT_FPS_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_MBT_FPS_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/aasincos.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace mbt_fps
|
||||
{
|
||||
|
||||
static const int max_iter = 10;
|
||||
static const double loop_tol = 1e-7;
|
||||
static const double C1 = 0.45503;
|
||||
static const double C2 = 1.36509;
|
||||
static const double C3 = 1.41546;
|
||||
static const double C_x = 0.22248;
|
||||
static const double C_y = 1.44492;
|
||||
//static const double C1_2 = 0.33333333333333333333333333;
|
||||
|
||||
template <typename T>
|
||||
inline T C1_2() { return detail::third<T>(); }
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_mbt_fps_spheroid
|
||||
: public base_t_fi<base_mbt_fps_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_mbt_fps_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_mbt_fps_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T C1_2 = mbt_fps::C1_2<T>();
|
||||
|
||||
T k, V, t;
|
||||
int i;
|
||||
|
||||
k = C3 * sin(lp_lat);
|
||||
for (i = max_iter; i ; --i) {
|
||||
t = lp_lat / C2;
|
||||
lp_lat -= V = (C1 * sin(t) + sin(lp_lat) - k) /
|
||||
(C1_2 * cos(t) + cos(lp_lat));
|
||||
if (fabs(V) < loop_tol)
|
||||
break;
|
||||
}
|
||||
t = lp_lat / C2;
|
||||
xy_x = C_x * lp_lon * (1. + 3. * cos(lp_lat)/cos(t) );
|
||||
xy_y = C_y * sin(t);
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
T t;
|
||||
|
||||
lp_lat = C2 * (t = aasin(xy_y / C_y));
|
||||
lp_lon = xy_x / (C_x * (1. + 3. * cos(lp_lat)/cos(t)));
|
||||
lp_lat = aasin((C1 * sin(t) + sin(lp_lat)) / C3);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "mbt_fps_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// McBryde-Thomas Flat-Pole Sine (No. 2)
|
||||
template <typename Parameters>
|
||||
inline void setup_mbt_fps(Parameters& par)
|
||||
{
|
||||
par.es = 0;
|
||||
}
|
||||
|
||||
}} // namespace detail::mbt_fps
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief McBryde-Thomas Flat-Pole Sine (No. 2) projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_mbt_fps.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct mbt_fps_spheroid : public detail::mbt_fps::base_mbt_fps_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline mbt_fps_spheroid(Params const& , Parameters const& par)
|
||||
: detail::mbt_fps::base_mbt_fps_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::mbt_fps::setup_mbt_fps(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_mbt_fps, mbt_fps_spheroid, mbt_fps_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(mbt_fps_entry, mbt_fps_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(mbt_fps_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(mbt_fps, mbt_fps_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_MBT_FPS_HPP
|
||||
|
||||
178
linx64/include/boost/geometry/srs/projections/proj/mbtfpp.hpp
Normal file
178
linx64/include/boost/geometry/srs/projections/proj/mbtfpp.hpp
Normal file
@@ -0,0 +1,178 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_MBTFPP_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_MBTFPP_HPP
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace mbtfpp
|
||||
{
|
||||
|
||||
static const double CS_ = .95257934441568037152;
|
||||
static const double FXC = .92582009977255146156;
|
||||
static const double FYC = 3.40168025708304504493;
|
||||
//static const double C23 = .66666666666666666666;
|
||||
//static const double C13 = .33333333333333333333;
|
||||
static const double one_plus_eps = 1.0000001;
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_mbtfpp_spheroid
|
||||
: public base_t_fi<base_mbtfpp_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_mbtfpp_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_mbtfpp_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T C23 = detail::two_thirds<T>();
|
||||
static const T C13 = detail::third<T>();
|
||||
|
||||
lp_lat = asin(CS_ * sin(lp_lat));
|
||||
xy_x = FXC * lp_lon * (2. * cos(C23 * lp_lat) - 1.);
|
||||
xy_y = FYC * sin(C13 * lp_lat);
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
static const T C23 = detail::two_thirds<T>();
|
||||
|
||||
lp_lat = xy_y / FYC;
|
||||
if (fabs(lp_lat) >= 1.) {
|
||||
if (fabs(lp_lat) > one_plus_eps) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
} else {
|
||||
lp_lat = (lp_lat < 0.) ? -half_pi : half_pi;
|
||||
}
|
||||
} else
|
||||
lp_lat = asin(lp_lat);
|
||||
|
||||
lp_lon = xy_x / ( FXC * (2. * cos(C23 * (lp_lat *= 3.)) - 1.) );
|
||||
if (fabs(lp_lat = sin(lp_lat) / CS_) >= 1.) {
|
||||
if (fabs(lp_lat) > one_plus_eps) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
} else {
|
||||
lp_lat = (lp_lat < 0.) ? -half_pi : half_pi;
|
||||
}
|
||||
} else
|
||||
lp_lat = asin(lp_lat);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "mbtfpp_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// McBride-Thomas Flat-Polar Parabolic
|
||||
template <typename Parameters>
|
||||
inline void setup_mbtfpp(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::mbtfpp
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief McBride-Thomas Flat-Polar Parabolic projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_mbtfpp.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct mbtfpp_spheroid : public detail::mbtfpp::base_mbtfpp_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline mbtfpp_spheroid(Params const& , Parameters const& par)
|
||||
: detail::mbtfpp::base_mbtfpp_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::mbtfpp::setup_mbtfpp(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_mbtfpp, mbtfpp_spheroid, mbtfpp_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(mbtfpp_entry, mbtfpp_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(mbtfpp_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(mbtfpp, mbtfpp_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_MBTFPP_HPP
|
||||
|
||||
189
linx64/include/boost/geometry/srs/projections/proj/mbtfpq.hpp
Normal file
189
linx64/include/boost/geometry/srs/projections/proj/mbtfpq.hpp
Normal file
@@ -0,0 +1,189 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_MBTFPQ_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_MBTFPQ_HPP
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace mbtfpq
|
||||
{
|
||||
|
||||
static const int n_iter = 20;
|
||||
static const double epsilon = 1e-7;
|
||||
static const double one_plus_tol = 1.000001;
|
||||
static const double C = 1.70710678118654752440;
|
||||
static const double RC = 0.58578643762690495119;
|
||||
static const double FYC = 1.87475828462269495505;
|
||||
static const double RYC = 0.53340209679417701685;
|
||||
static const double FXC = 0.31245971410378249250;
|
||||
static const double RXC = 3.20041258076506210122;
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_mbtfpq_spheroid
|
||||
: public base_t_fi<base_mbtfpq_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_mbtfpq_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_mbtfpq_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T th1, c;
|
||||
int i;
|
||||
|
||||
c = C * sin(lp_lat);
|
||||
for (i = n_iter; i; --i) {
|
||||
lp_lat -= th1 = (sin(.5*lp_lat) + sin(lp_lat) - c) /
|
||||
(.5*cos(.5*lp_lat) + cos(lp_lat));
|
||||
if (fabs(th1) < epsilon) break;
|
||||
}
|
||||
xy_x = FXC * lp_lon * (1.0 + 2. * cos(lp_lat)/cos(0.5 * lp_lat));
|
||||
xy_y = FYC * sin(0.5 * lp_lat);
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T pi = detail::pi<T>();
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T t;
|
||||
|
||||
lp_lat = RYC * xy_y;
|
||||
if (fabs(lp_lat) > 1.) {
|
||||
if (fabs(lp_lat) > one_plus_tol) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
} else if (lp_lat < 0.) {
|
||||
t = -1.; lp_lat = -pi;
|
||||
} else {
|
||||
t = 1.; lp_lat = pi;
|
||||
}
|
||||
} else
|
||||
lp_lat = 2. * asin(t = lp_lat);
|
||||
lp_lon = RXC * xy_x / (1. + 2. * cos(lp_lat)/cos(0.5 * lp_lat));
|
||||
lp_lat = RC * (t + sin(lp_lat));
|
||||
if (fabs(lp_lat) > 1.)
|
||||
if (fabs(lp_lat) > one_plus_tol) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
} else
|
||||
lp_lat = lp_lat < 0. ? -half_pi : half_pi;
|
||||
else
|
||||
lp_lat = asin(lp_lat);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "mbtfpq_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// McBryde-Thomas Flat-Polar Quartic
|
||||
template <typename Parameters>
|
||||
inline void setup_mbtfpq(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::mbtfpq
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief McBryde-Thomas Flat-Polar Quartic projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_mbtfpq.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct mbtfpq_spheroid : public detail::mbtfpq::base_mbtfpq_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline mbtfpq_spheroid(Params const& , Parameters const& par)
|
||||
: detail::mbtfpq::base_mbtfpq_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::mbtfpq::setup_mbtfpq(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_mbtfpq, mbtfpq_spheroid, mbtfpq_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(mbtfpq_entry, mbtfpq_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(mbtfpq_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(mbtfpq, mbtfpq_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_MBTFPQ_HPP
|
||||
|
||||
246
linx64/include/boost/geometry/srs/projections/proj/merc.hpp
Normal file
246
linx64/include/boost/geometry/srs/projections/proj/merc.hpp
Normal file
@@ -0,0 +1,246 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_MERC_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_MERC_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_msfn.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_phi2.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_tsfn.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace merc
|
||||
{
|
||||
|
||||
static const double epsilon10 = 1.e-10;
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_merc_ellipsoid
|
||||
: public base_t_fi<base_merc_ellipsoid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_merc_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_merc_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_forward) ellipsoid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
if (fabs(fabs(lp_lat) - half_pi) <= epsilon10) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
xy_x = this->m_par.k0 * lp_lon;
|
||||
xy_y = - this->m_par.k0 * log(pj_tsfn(lp_lat, sin(lp_lat), this->m_par.e));
|
||||
}
|
||||
|
||||
// INVERSE(e_inverse) ellipsoid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
if ((lp_lat = pj_phi2(exp(- xy_y / this->m_par.k0), this->m_par.e)) == HUGE_VAL) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
lp_lon = xy_x / this->m_par.k0;
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "merc_ellipsoid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_merc_spheroid
|
||||
: public base_t_fi<base_merc_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_merc_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_merc_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
static const T fourth_pi = detail::fourth_pi<T>();
|
||||
|
||||
if (fabs(fabs(lp_lat) - half_pi) <= epsilon10) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
xy_x = this->m_par.k0 * lp_lon;
|
||||
xy_y = this->m_par.k0 * log(tan(fourth_pi + .5 * lp_lat));
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
lp_lat = half_pi - 2. * atan(exp(-xy_y / this->m_par.k0));
|
||||
lp_lon = xy_x / this->m_par.k0;
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "merc_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Mercator
|
||||
template <typename Params, typename Parameters>
|
||||
inline void setup_merc(Params const& params, Parameters& par)
|
||||
{
|
||||
typedef typename Parameters::type calc_t;
|
||||
static const calc_t half_pi = detail::half_pi<calc_t>();
|
||||
|
||||
calc_t phits=0.0;
|
||||
int is_phits;
|
||||
|
||||
if( (is_phits = pj_param_r<srs::spar::lat_ts>(params, "lat_ts", srs::dpar::lat_ts, phits)) ) {
|
||||
phits = fabs(phits);
|
||||
if (phits >= half_pi)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_lat_ts_larger_than_90) );
|
||||
}
|
||||
if (par.es != 0.0) { /* ellipsoid */
|
||||
if (is_phits)
|
||||
par.k0 = pj_msfn(sin(phits), cos(phits), par.es);
|
||||
} else { /* sphere */
|
||||
if (is_phits)
|
||||
par.k0 = cos(phits);
|
||||
}
|
||||
}
|
||||
|
||||
}} // namespace detail::merc
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Mercator projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Projection parameters
|
||||
- lat_ts: Latitude of true scale (degrees)
|
||||
\par Example
|
||||
\image html ex_merc.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct merc_ellipsoid : public detail::merc::base_merc_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline merc_ellipsoid(Params const& params, Parameters const& par)
|
||||
: detail::merc::base_merc_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::merc::setup_merc(params, this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Mercator projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Projection parameters
|
||||
- lat_ts: Latitude of true scale (degrees)
|
||||
\par Example
|
||||
\image html ex_merc.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct merc_spheroid : public detail::merc::base_merc_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline merc_spheroid(Params const& params, Parameters const& par)
|
||||
: detail::merc::base_merc_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::merc::setup_merc(params, this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_merc, merc_spheroid, merc_ellipsoid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(merc_entry, merc_spheroid, merc_ellipsoid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(merc_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(merc, merc_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_MERC_HPP
|
||||
|
||||
148
linx64/include/boost/geometry/srs/projections/proj/mill.hpp
Normal file
148
linx64/include/boost/geometry/srs/projections/proj/mill.hpp
Normal file
@@ -0,0 +1,148 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_MILL_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_MILL_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace mill
|
||||
{
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_mill_spheroid
|
||||
: public base_t_fi<base_mill_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_mill_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_mill_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T fourth_pi = detail::fourth_pi<T>();
|
||||
|
||||
xy_x = lp_lon;
|
||||
xy_y = log(tan(fourth_pi + lp_lat * .4)) * 1.25;
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T fourth_pi = detail::fourth_pi<T>();
|
||||
|
||||
lp_lon = xy_x;
|
||||
lp_lat = 2.5 * (atan(exp(.8 * xy_y)) - fourth_pi);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "mill_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Miller Cylindrical
|
||||
template <typename Parameters>
|
||||
inline void setup_mill(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::mill
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Miller Cylindrical projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_mill.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct mill_spheroid : public detail::mill::base_mill_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline mill_spheroid(Params const& , Parameters const& par)
|
||||
: detail::mill::base_mill_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::mill::setup_mill(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_mill, mill_spheroid, mill_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(mill_entry, mill_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(mill_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(mill, mill_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_MILL_HPP
|
||||
|
||||
490
linx64/include/boost/geometry/srs/projections/proj/mod_ster.hpp
Normal file
490
linx64/include/boost/geometry/srs/projections/proj/mod_ster.hpp
Normal file
@@ -0,0 +1,490 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_MOD_STER_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_MOD_STER_HPP
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
#include <boost/math/special_functions/hypot.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/aasincos.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_zpoly1.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace mod_ster
|
||||
{
|
||||
|
||||
static const double epsilon = 1e-12;
|
||||
|
||||
template <typename T>
|
||||
struct par_mod_ster
|
||||
{
|
||||
pj_complex<T> *zcoeff;
|
||||
T cchio, schio;
|
||||
int n;
|
||||
};
|
||||
|
||||
/* based upon Snyder and Linck, USGS-NMD */
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_mod_ster_ellipsoid
|
||||
: public base_t_fi<base_mod_ster_ellipsoid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_mod_ster<T> m_proj_parm;
|
||||
|
||||
inline base_mod_ster_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_mod_ster_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_forward) ellipsoid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T sinlon, coslon, esphi, chi, schi, cchi, s;
|
||||
pj_complex<T> p;
|
||||
|
||||
sinlon = sin(lp_lon);
|
||||
coslon = cos(lp_lon);
|
||||
esphi = this->m_par.e * sin(lp_lat);
|
||||
chi = 2. * atan(tan((half_pi + lp_lat) * .5) *
|
||||
math::pow((T(1) - esphi) / (T(1) + esphi), this->m_par.e * T(0.5))) - half_pi;
|
||||
schi = sin(chi);
|
||||
cchi = cos(chi);
|
||||
s = 2. / (1. + this->m_proj_parm.schio * schi + this->m_proj_parm.cchio * cchi * coslon);
|
||||
p.r = s * cchi * sinlon;
|
||||
p.i = s * (this->m_proj_parm.cchio * schi - this->m_proj_parm.schio * cchi * coslon);
|
||||
p = pj_zpoly1(p, this->m_proj_parm.zcoeff, this->m_proj_parm.n);
|
||||
xy_x = p.r;
|
||||
xy_y = p.i;
|
||||
}
|
||||
|
||||
// INVERSE(e_inverse) ellipsoid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
int nn;
|
||||
pj_complex<T> p, fxy, fpxy, dp;
|
||||
T den, rh = 0, z, sinz = 0, cosz = 0, chi, phi = 0, dphi, esphi;
|
||||
|
||||
p.r = xy_x;
|
||||
p.i = xy_y;
|
||||
for (nn = 20; nn ;--nn) {
|
||||
fxy = pj_zpolyd1(p, this->m_proj_parm.zcoeff, this->m_proj_parm.n, &fpxy);
|
||||
fxy.r -= xy_x;
|
||||
fxy.i -= xy_y;
|
||||
den = fpxy.r * fpxy.r + fpxy.i * fpxy.i;
|
||||
dp.r = -(fxy.r * fpxy.r + fxy.i * fpxy.i) / den;
|
||||
dp.i = -(fxy.i * fpxy.r - fxy.r * fpxy.i) / den;
|
||||
p.r += dp.r;
|
||||
p.i += dp.i;
|
||||
if ((fabs(dp.r) + fabs(dp.i)) <= epsilon)
|
||||
break;
|
||||
}
|
||||
if (nn) {
|
||||
rh = boost::math::hypot(p.r, p.i);
|
||||
z = 2. * atan(.5 * rh);
|
||||
sinz = sin(z);
|
||||
cosz = cos(z);
|
||||
lp_lon = this->m_par.lam0;
|
||||
if (fabs(rh) <= epsilon) {
|
||||
/* if we end up here input coordinates were (0,0).
|
||||
* pj_inv() adds P->lam0 to lp.lam, this way we are
|
||||
* sure to get the correct offset */
|
||||
lp_lon = 0.0;
|
||||
lp_lat = this->m_par.phi0;
|
||||
return;
|
||||
}
|
||||
chi = aasin(cosz * this->m_proj_parm.schio + p.i * sinz * this->m_proj_parm.cchio / rh);
|
||||
phi = chi;
|
||||
for (nn = 20; nn ;--nn) {
|
||||
esphi = this->m_par.e * sin(phi);
|
||||
dphi = 2. * atan(tan((half_pi + chi) * .5) *
|
||||
math::pow((T(1) + esphi) / (T(1) - esphi), this->m_par.e * T(0.5))) - half_pi - phi;
|
||||
phi += dphi;
|
||||
if (fabs(dphi) <= epsilon)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (nn) {
|
||||
lp_lat = phi;
|
||||
lp_lon = atan2(p.r * sinz, rh * this->m_proj_parm.cchio * cosz - p.i *
|
||||
this->m_proj_parm.schio * sinz);
|
||||
} else
|
||||
lp_lon = lp_lat = HUGE_VAL;
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "mod_ster_ellipsoid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup(Parameters& par, par_mod_ster<T>& proj_parm) /* general initialization */
|
||||
{
|
||||
static T const half_pi = detail::half_pi<T>();
|
||||
|
||||
T esphi, chio;
|
||||
|
||||
if (par.es != 0.0) {
|
||||
esphi = par.e * sin(par.phi0);
|
||||
chio = 2. * atan(tan((half_pi + par.phi0) * .5) *
|
||||
math::pow((T(1) - esphi) / (T(1) + esphi), par.e * T(0.5))) - half_pi;
|
||||
} else
|
||||
chio = par.phi0;
|
||||
proj_parm.schio = sin(chio);
|
||||
proj_parm.cchio = cos(chio);
|
||||
}
|
||||
|
||||
|
||||
/* Miller Oblated Stereographic */
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_mil_os(Parameters& par, par_mod_ster<T>& proj_parm)
|
||||
{
|
||||
static const T d2r = geometry::math::d2r<T>();
|
||||
|
||||
static pj_complex<T> AB[] = {
|
||||
{0.924500, 0.},
|
||||
{0., 0.},
|
||||
{0.019430, 0.}
|
||||
};
|
||||
|
||||
proj_parm.n = 2;
|
||||
par.lam0 = d2r * 20.;
|
||||
par.phi0 = d2r * 18.;
|
||||
proj_parm.zcoeff = AB;
|
||||
par.es = 0.;
|
||||
|
||||
setup(par, proj_parm);
|
||||
}
|
||||
|
||||
/* Lee Oblated Stereographic */
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_lee_os(Parameters& par, par_mod_ster<T>& proj_parm)
|
||||
{
|
||||
static const T d2r = geometry::math::d2r<T>();
|
||||
|
||||
static pj_complex<T> AB[] = {
|
||||
{ 0.721316, 0.},
|
||||
{ 0., 0.},
|
||||
{-0.0088162, -0.00617325}
|
||||
};
|
||||
|
||||
proj_parm.n = 2;
|
||||
par.lam0 = d2r * -165.;
|
||||
par.phi0 = d2r * -10.;
|
||||
proj_parm.zcoeff = AB;
|
||||
par.es = 0.;
|
||||
|
||||
setup(par, proj_parm);
|
||||
}
|
||||
|
||||
// Mod. Stererographics of 48 U.S.
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_gs48(Parameters& par, par_mod_ster<T>& proj_parm)
|
||||
{
|
||||
static const T d2r = geometry::math::d2r<T>();
|
||||
|
||||
static pj_complex<T> AB[] = { /* 48 United States */
|
||||
{ 0.98879, 0.},
|
||||
{ 0., 0.},
|
||||
{-0.050909, 0.},
|
||||
{ 0., 0.},
|
||||
{ 0.075528, 0.}
|
||||
};
|
||||
|
||||
proj_parm.n = 4;
|
||||
par.lam0 = d2r * -96.;
|
||||
par.phi0 = d2r * -39.;
|
||||
proj_parm.zcoeff = AB;
|
||||
par.es = 0.;
|
||||
par.a = 6370997.;
|
||||
|
||||
setup(par, proj_parm);
|
||||
}
|
||||
|
||||
// Mod. Stererographics of Alaska
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_alsk(Parameters& par, par_mod_ster<T>& proj_parm)
|
||||
{
|
||||
static const T d2r = geometry::math::d2r<T>();
|
||||
|
||||
static pj_complex<T> ABe[] = { /* Alaska ellipsoid */
|
||||
{ .9945303, 0.},
|
||||
{ .0052083, -.0027404},
|
||||
{ .0072721, .0048181},
|
||||
{-.0151089, -.1932526},
|
||||
{ .0642675, -.1381226},
|
||||
{ .3582802, -.2884586}
|
||||
};
|
||||
|
||||
static pj_complex<T> ABs[] = { /* Alaska sphere */
|
||||
{ .9972523, 0.},
|
||||
{ .0052513, -.0041175},
|
||||
{ .0074606, .0048125},
|
||||
{-.0153783, -.1968253},
|
||||
{ .0636871, -.1408027},
|
||||
{ .3660976, -.2937382}
|
||||
};
|
||||
|
||||
proj_parm.n = 5;
|
||||
par.lam0 = d2r * -152.;
|
||||
par.phi0 = d2r * 64.;
|
||||
if (par.es != 0.0) { /* fixed ellipsoid/sphere */
|
||||
proj_parm.zcoeff = ABe;
|
||||
par.a = 6378206.4;
|
||||
par.e = sqrt(par.es = 0.00676866);
|
||||
} else {
|
||||
proj_parm.zcoeff = ABs;
|
||||
par.a = 6370997.;
|
||||
}
|
||||
|
||||
setup(par, proj_parm);
|
||||
}
|
||||
|
||||
// Mod. Stererographics of 50 U.S.
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_gs50(Parameters& par, par_mod_ster<T>& proj_parm)
|
||||
{
|
||||
static const T d2r = geometry::math::d2r<T>();
|
||||
|
||||
static pj_complex<T> ABe[] = { /* GS50 ellipsoid */
|
||||
{ .9827497, 0.},
|
||||
{ .0210669, .0053804},
|
||||
{-.1031415, -.0571664},
|
||||
{-.0323337, -.0322847},
|
||||
{ .0502303, .1211983},
|
||||
{ .0251805, .0895678},
|
||||
{-.0012315, -.1416121},
|
||||
{ .0072202, -.1317091},
|
||||
{-.0194029, .0759677},
|
||||
{-.0210072, .0834037}
|
||||
};
|
||||
static pj_complex<T> ABs[] = { /* GS50 sphere */
|
||||
{ .9842990, 0.},
|
||||
{ .0211642, .0037608},
|
||||
{-.1036018, -.0575102},
|
||||
{-.0329095, -.0320119},
|
||||
{ .0499471, .1223335},
|
||||
{ .0260460, .0899805},
|
||||
{ .0007388, -.1435792},
|
||||
{ .0075848, -.1334108},
|
||||
{-.0216473, .0776645},
|
||||
{-.0225161, .0853673}
|
||||
};
|
||||
|
||||
proj_parm.n = 9;
|
||||
par.lam0 = d2r * -120.;
|
||||
par.phi0 = d2r * 45.;
|
||||
if (par.es != 0.0) { /* fixed ellipsoid/sphere */
|
||||
proj_parm.zcoeff = ABe;
|
||||
par.a = 6378206.4;
|
||||
par.e = sqrt(par.es = 0.00676866);
|
||||
} else {
|
||||
proj_parm.zcoeff = ABs;
|
||||
par.a = 6370997.;
|
||||
}
|
||||
|
||||
setup(par, proj_parm);
|
||||
}
|
||||
|
||||
}} // namespace detail::mod_ster
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Miller Oblated Stereographic projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Azimuthal (mod)
|
||||
\par Example
|
||||
\image html ex_mil_os.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct mil_os_ellipsoid : public detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline mil_os_ellipsoid(Params const& , Parameters const& par)
|
||||
: detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::mod_ster::setup_mil_os(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Lee Oblated Stereographic projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Azimuthal (mod)
|
||||
\par Example
|
||||
\image html ex_lee_os.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct lee_os_ellipsoid : public detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline lee_os_ellipsoid(Params const& , Parameters const& par)
|
||||
: detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::mod_ster::setup_lee_os(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Mod. Stererographics of 48 U.S. projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Azimuthal (mod)
|
||||
\par Example
|
||||
\image html ex_gs48.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct gs48_ellipsoid : public detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline gs48_ellipsoid(Params const& , Parameters const& par)
|
||||
: detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::mod_ster::setup_gs48(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Mod. Stererographics of Alaska projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Azimuthal (mod)
|
||||
\par Example
|
||||
\image html ex_alsk.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct alsk_ellipsoid : public detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline alsk_ellipsoid(Params const& , Parameters const& par)
|
||||
: detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::mod_ster::setup_alsk(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Mod. Stererographics of 50 U.S. projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Azimuthal (mod)
|
||||
\par Example
|
||||
\image html ex_gs50.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct gs50_ellipsoid : public detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline gs50_ellipsoid(Params const& , Parameters const& par)
|
||||
: detail::mod_ster::base_mod_ster_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::mod_ster::setup_gs50(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_mil_os, mil_os_ellipsoid, mil_os_ellipsoid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_lee_os, lee_os_ellipsoid, lee_os_ellipsoid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_gs48, gs48_ellipsoid, gs48_ellipsoid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_alsk, alsk_ellipsoid, alsk_ellipsoid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_gs50, gs50_ellipsoid, gs50_ellipsoid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(mil_os_entry, mil_os_ellipsoid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(lee_os_entry, lee_os_ellipsoid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(gs48_entry, gs48_ellipsoid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(alsk_entry, alsk_ellipsoid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(gs50_entry, gs50_ellipsoid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(mod_ster_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(mil_os, mil_os_entry)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(lee_os, lee_os_entry)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(gs48, gs48_entry)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(alsk, alsk_entry)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(gs50, gs50_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_MOD_STER_HPP
|
||||
|
||||
267
linx64/include/boost/geometry/srs/projections/proj/moll.hpp
Normal file
267
linx64/include/boost/geometry/srs/projections/proj/moll.hpp
Normal file
@@ -0,0 +1,267 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_MOLL_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_MOLL_HPP
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/aasincos.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace moll
|
||||
{
|
||||
|
||||
static const int max_iter = 10;
|
||||
static const double loop_tol = 1e-7;
|
||||
|
||||
template <typename T>
|
||||
struct par_moll
|
||||
{
|
||||
T C_x, C_y, C_p;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_moll_spheroid
|
||||
: public base_t_fi<base_moll_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_moll<T> m_proj_parm;
|
||||
|
||||
inline base_moll_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_moll_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T k, V;
|
||||
int i;
|
||||
|
||||
k = this->m_proj_parm.C_p * sin(lp_lat);
|
||||
for (i = max_iter; i ; --i) {
|
||||
lp_lat -= V = (lp_lat + sin(lp_lat) - k) /
|
||||
(1. + cos(lp_lat));
|
||||
if (fabs(V) < loop_tol)
|
||||
break;
|
||||
}
|
||||
if (!i)
|
||||
lp_lat = (lp_lat < 0.) ? -half_pi : half_pi;
|
||||
else
|
||||
lp_lat *= 0.5;
|
||||
xy_x = this->m_proj_parm.C_x * lp_lon * cos(lp_lat);
|
||||
xy_y = this->m_proj_parm.C_y * sin(lp_lat);
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T pi = detail::pi<T>();
|
||||
|
||||
lp_lat = aasin(xy_y / this->m_proj_parm.C_y);
|
||||
lp_lon = xy_x / (this->m_proj_parm.C_x * cos(lp_lat));
|
||||
if (fabs(lp_lon) < pi) {
|
||||
lp_lat += lp_lat;
|
||||
lp_lat = aasin((lp_lat + sin(lp_lat)) / this->m_proj_parm.C_p);
|
||||
} else {
|
||||
lp_lon = lp_lat = HUGE_VAL;
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "moll_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup(Parameters& par, par_moll<T>& proj_parm, T const& p)
|
||||
{
|
||||
T r, sp, p2 = p + p;
|
||||
|
||||
par.es = 0;
|
||||
sp = sin(p);
|
||||
r = sqrt(geometry::math::two_pi<T>() * sp / (p2 + sin(p2)));
|
||||
|
||||
proj_parm.C_x = 2. * r / geometry::math::pi<T>();
|
||||
proj_parm.C_y = r / sp;
|
||||
proj_parm.C_p = p2 + sin(p2);
|
||||
}
|
||||
|
||||
|
||||
// Mollweide
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_moll(Parameters& par, par_moll<T>& proj_parm)
|
||||
{
|
||||
setup(par, proj_parm, geometry::math::half_pi<T>());
|
||||
}
|
||||
|
||||
// Wagner IV
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_wag4(Parameters& par, par_moll<T>& proj_parm)
|
||||
{
|
||||
setup(par, proj_parm, geometry::math::pi<T>()/3.);
|
||||
}
|
||||
|
||||
// Wagner V
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_wag5(Parameters& par, par_moll<T>& proj_parm)
|
||||
{
|
||||
par.es = 0;
|
||||
proj_parm.C_x = 0.90977;
|
||||
proj_parm.C_y = 1.65014;
|
||||
proj_parm.C_p = 3.00896;
|
||||
}
|
||||
|
||||
}} // namespace detail::moll
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Mollweide projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_moll.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct moll_spheroid : public detail::moll::base_moll_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline moll_spheroid(Params const& , Parameters const& par)
|
||||
: detail::moll::base_moll_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::moll::setup_moll(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Wagner IV projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_wag4.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct wag4_spheroid : public detail::moll::base_moll_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline wag4_spheroid(Params const& , Parameters const& par)
|
||||
: detail::moll::base_moll_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::moll::setup_wag4(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Wagner V projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_wag5.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct wag5_spheroid : public detail::moll::base_moll_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline wag5_spheroid(Params const& , Parameters const& par)
|
||||
: detail::moll::base_moll_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::moll::setup_wag5(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_moll, moll_spheroid, moll_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_wag4, wag4_spheroid, wag4_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_wag5, wag5_spheroid, wag5_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(moll_entry, moll_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(wag4_entry, wag4_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(wag5_entry, wag5_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(moll_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(moll, moll_entry);
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(wag4, wag4_entry);
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(wag5, wag5_entry);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_MOLL_HPP
|
||||
|
||||
214
linx64/include/boost/geometry/srs/projections/proj/natearth.hpp
Normal file
214
linx64/include/boost/geometry/srs/projections/proj/natearth.hpp
Normal file
@@ -0,0 +1,214 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// The Natural Earth projection was designed by Tom Patterson, US National Park
|
||||
// Service, in 2007, using Flex Projector. The shape of the original projection
|
||||
// was defined at every 5 degrees and piece-wise cubic spline interpolation was
|
||||
// used to compute the complete graticule.
|
||||
// The code here uses polynomial functions instead of cubic splines and
|
||||
// is therefore much simpler to program. The polynomial approximation was
|
||||
// developed by Bojan Savric, in collaboration with Tom Patterson and Bernhard
|
||||
// Jenny, Institute of Cartography, ETH Zurich. It slightly deviates from
|
||||
// Patterson's original projection by adding additional curvature to meridians
|
||||
// where they meet the horizontal pole line. This improvement is by intention
|
||||
// and designed in collaboration with Tom Patterson.
|
||||
// Port to PROJ.4 by Bernhard Jenny, 6 June 2011
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_NATEARTH_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_NATEARTH_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace natearth
|
||||
{
|
||||
|
||||
static const double A0 = 0.8707;
|
||||
static const double A1 = -0.131979;
|
||||
static const double A2 = -0.013791;
|
||||
static const double A3 = 0.003971;
|
||||
static const double A4 = -0.001529;
|
||||
static const double B0 = 1.007226;
|
||||
static const double B1 = 0.015085;
|
||||
static const double B2 = -0.044475;
|
||||
static const double B3 = 0.028874;
|
||||
static const double B4 = -0.005916;
|
||||
static const double C0 = B0;
|
||||
static const double C1 = (3 * B1);
|
||||
static const double C2 = (7 * B2);
|
||||
static const double C3 = (9 * B3);
|
||||
static const double C4 = (11 * B4);
|
||||
static const double epsilon = 1e-11;
|
||||
|
||||
template <typename T>
|
||||
inline T max_y() { return (0.8707 * 0.52 * detail::pi<T>()); }
|
||||
|
||||
/* Not sure at all of the appropriate number for max_iter... */
|
||||
static const int max_iter = 100;
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_natearth_spheroid
|
||||
: public base_t_fi<base_natearth_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_natearth_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_natearth_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T phi2, phi4;
|
||||
|
||||
phi2 = lp_lat * lp_lat;
|
||||
phi4 = phi2 * phi2;
|
||||
xy_x = lp_lon * (A0 + phi2 * (A1 + phi2 * (A2 + phi4 * phi2 * (A3 + phi2 * A4))));
|
||||
xy_y = lp_lat * (B0 + phi2 * (B1 + phi4 * (B2 + B3 * phi2 + B4 * phi4)));
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T max_y = natearth::max_y<T>();
|
||||
|
||||
T yc, tol, y2, y4, f, fder;
|
||||
int i;
|
||||
|
||||
/* make sure y is inside valid range */
|
||||
if (xy_y > max_y) {
|
||||
xy_y = max_y;
|
||||
} else if (xy_y < -max_y) {
|
||||
xy_y = -max_y;
|
||||
}
|
||||
|
||||
/* latitude */
|
||||
yc = xy_y;
|
||||
for (i = max_iter; i ; --i) { /* Newton-Raphson */
|
||||
y2 = yc * yc;
|
||||
y4 = y2 * y2;
|
||||
f = (yc * (B0 + y2 * (B1 + y4 * (B2 + B3 * y2 + B4 * y4)))) - xy_y;
|
||||
fder = C0 + y2 * (C1 + y4 * (C2 + C3 * y2 + C4 * y4));
|
||||
yc -= tol = f / fder;
|
||||
if (fabs(tol) < epsilon) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( i == 0 )
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_non_convergent) );
|
||||
lp_lat = yc;
|
||||
|
||||
/* longitude */
|
||||
y2 = yc * yc;
|
||||
lp_lon = xy_x / (A0 + y2 * (A1 + y2 * (A2 + y2 * y2 * y2 * (A3 + y2 * A4))));
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "natearth_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Natural Earth
|
||||
template <typename Parameters>
|
||||
inline void setup_natearth(Parameters& par)
|
||||
{
|
||||
par.es = 0;
|
||||
}
|
||||
|
||||
}} // namespace detail::natearth
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Natural Earth projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_natearth.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct natearth_spheroid : public detail::natearth::base_natearth_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline natearth_spheroid(Params const& , Parameters const& par)
|
||||
: detail::natearth::base_natearth_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::natearth::setup_natearth(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_natearth, natearth_spheroid, natearth_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(natearth_entry, natearth_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(natearth_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(natearth, natearth_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_NATEARTH_HPP
|
||||
|
||||
161
linx64/include/boost/geometry/srs/projections/proj/nell.hpp
Normal file
161
linx64/include/boost/geometry/srs/projections/proj/nell.hpp
Normal file
@@ -0,0 +1,161 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_NELL_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_NELL_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/aasincos.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace nell
|
||||
{
|
||||
|
||||
static const int max_iter = 10;
|
||||
static const double loop_tol = 1e-7;
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_nell_spheroid
|
||||
: public base_t_fi<base_nell_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_nell_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_nell_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T k, V;
|
||||
int i;
|
||||
|
||||
k = 2. * sin(lp_lat);
|
||||
V = lp_lat * lp_lat;
|
||||
lp_lat *= 1.00371 + V * (-0.0935382 + V * -0.011412);
|
||||
for (i = max_iter; i ; --i) {
|
||||
lp_lat -= V = (lp_lat + sin(lp_lat) - k) /
|
||||
(1. + cos(lp_lat));
|
||||
if (fabs(V) < loop_tol)
|
||||
break;
|
||||
}
|
||||
xy_x = 0.5 * lp_lon * (1. + cos(lp_lat));
|
||||
xy_y = lp_lat;
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
lp_lon = 2. * xy_x / (1. + cos(xy_y));
|
||||
lp_lat = aasin(0.5 * (xy_y + sin(xy_y)));
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "nell_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Nell
|
||||
template <typename Parameters>
|
||||
inline void setup_nell(Parameters& par)
|
||||
{
|
||||
par.es = 0;
|
||||
}
|
||||
|
||||
}} // namespace detail::nell
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Nell projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_nell.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct nell_spheroid : public detail::nell::base_nell_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline nell_spheroid(Params const& , Parameters const& par)
|
||||
: detail::nell::base_nell_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::nell::setup_nell(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_nell, nell_spheroid, nell_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(nell_entry, nell_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(nell_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(nell, nell_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_NELL_HPP
|
||||
|
||||
165
linx64/include/boost/geometry/srs/projections/proj/nell_h.hpp
Normal file
165
linx64/include/boost/geometry/srs/projections/proj/nell_h.hpp
Normal file
@@ -0,0 +1,165 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_NELL_H_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_NELL_H_HPP
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace nell_h
|
||||
{
|
||||
|
||||
static const int n_iter = 9;
|
||||
static const double epsilon = 1e-7;
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_nell_h_spheroid
|
||||
: public base_t_fi<base_nell_h_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_nell_h_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_nell_h_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
xy_x = 0.5 * lp_lon * (1. + cos(lp_lat));
|
||||
xy_y = 2.0 * (lp_lat - tan(0.5 *lp_lat));
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T V, c, p;
|
||||
int i;
|
||||
|
||||
p = 0.5 * xy_y;
|
||||
for (i = n_iter; i ; --i) {
|
||||
c = cos(0.5 * lp_lat);
|
||||
lp_lat -= V = (lp_lat - tan(lp_lat/2) - p)/(1. - 0.5/(c*c));
|
||||
if (fabs(V) < epsilon)
|
||||
break;
|
||||
}
|
||||
if (!i) {
|
||||
lp_lat = p < 0. ? -half_pi : half_pi;
|
||||
lp_lon = 2. * xy_x;
|
||||
} else
|
||||
lp_lon = 2. * xy_x / (1. + cos(lp_lat));
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "nell_h_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Nell-Hammer
|
||||
template <typename Parameters>
|
||||
inline void setup_nell_h(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::nell_h
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Nell-Hammer projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_nell_h.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct nell_h_spheroid : public detail::nell_h::base_nell_h_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline nell_h_spheroid(Params const& , Parameters const& par)
|
||||
: detail::nell_h::base_nell_h_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::nell_h::setup_nell_h(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_nell_h, nell_h_spheroid, nell_h_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(nell_h_entry, nell_h_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(nell_h_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(nell_h, nell_h_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_NELL_H_HPP
|
||||
|
||||
171
linx64/include/boost/geometry/srs/projections/proj/nocol.hpp
Normal file
171
linx64/include/boost/geometry/srs/projections/proj/nocol.hpp
Normal file
@@ -0,0 +1,171 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_NOCOL_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_NOCOL_HPP
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace nocol
|
||||
{
|
||||
|
||||
static const double epsilon = 1e-10;
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_nocol_spheroid
|
||||
: public base_t_f<base_nocol_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_nocol_spheroid(const Parameters& par)
|
||||
: base_t_f<base_nocol_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
if (fabs(lp_lon) < epsilon) {
|
||||
xy_x = 0;
|
||||
xy_y = lp_lat;
|
||||
} else if (fabs(lp_lat) < epsilon) {
|
||||
xy_x = lp_lon;
|
||||
xy_y = 0.;
|
||||
} else if (fabs(fabs(lp_lon) - half_pi) < epsilon) {
|
||||
xy_x = lp_lon * cos(lp_lat);
|
||||
xy_y = half_pi * sin(lp_lat);
|
||||
} else if (fabs(fabs(lp_lat) - half_pi) < epsilon) {
|
||||
xy_x = 0;
|
||||
xy_y = lp_lat;
|
||||
} else {
|
||||
T tb, c, d, m, n, r2, sp;
|
||||
|
||||
tb = half_pi / lp_lon - lp_lon / half_pi;
|
||||
c = lp_lat / half_pi;
|
||||
d = (1 - c * c)/((sp = sin(lp_lat)) - c);
|
||||
r2 = tb / d;
|
||||
r2 *= r2;
|
||||
m = (tb * sp / d - 0.5 * tb)/(1. + r2);
|
||||
n = (sp / r2 + 0.5 * d)/(1. + 1./r2);
|
||||
xy_x = cos(lp_lat);
|
||||
xy_x = sqrt(m * m + xy_x * xy_x / (1. + r2));
|
||||
xy_x = half_pi * ( m + (lp_lon < 0. ? -xy_x : xy_x));
|
||||
xy_y = sqrt(n * n - (sp * sp / r2 + d * sp - 1.) /
|
||||
(1. + 1./r2));
|
||||
xy_y = half_pi * ( n + (lp_lat < 0. ? xy_y : -xy_y ));
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "nocol_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Nicolosi Globular
|
||||
template <typename Parameters>
|
||||
inline void setup_nicol(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::nocol
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Nicolosi Globular projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
- no inverse
|
||||
\par Example
|
||||
\image html ex_nicol.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct nicol_spheroid : public detail::nocol::base_nocol_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline nicol_spheroid(Params const& , Parameters const& par)
|
||||
: detail::nocol::base_nocol_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::nocol::setup_nicol(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_nicol, nicol_spheroid, nicol_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(nicol_entry, nicol_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(nocol_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(nicol, nicol_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_NOCOL_HPP
|
||||
|
||||
338
linx64/include/boost/geometry/srs/projections/proj/nsper.hpp
Normal file
338
linx64/include/boost/geometry/srs/projections/proj/nsper.hpp
Normal file
@@ -0,0 +1,338 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_NSPER_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_NSPER_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
#include <boost/math/special_functions/hypot.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace nsper
|
||||
{
|
||||
|
||||
static const double epsilon10 = 1.e-10;
|
||||
enum mode_type {
|
||||
n_pole = 0,
|
||||
s_pole = 1,
|
||||
equit = 2,
|
||||
obliq = 3
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct par_nsper
|
||||
{
|
||||
T height;
|
||||
T sinph0;
|
||||
T cosph0;
|
||||
T p;
|
||||
T rp;
|
||||
T pn1;
|
||||
T pfact;
|
||||
T h;
|
||||
T cg;
|
||||
T sg;
|
||||
T sw;
|
||||
T cw;
|
||||
mode_type mode;
|
||||
int tilt;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_nsper_spheroid
|
||||
: public base_t_fi<base_nsper_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_nsper<T> m_proj_parm;
|
||||
|
||||
inline base_nsper_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_nsper_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T coslam, cosphi, sinphi;
|
||||
|
||||
sinphi = sin(lp_lat);
|
||||
cosphi = cos(lp_lat);
|
||||
coslam = cos(lp_lon);
|
||||
switch (this->m_proj_parm.mode) {
|
||||
case obliq:
|
||||
xy_y = this->m_proj_parm.sinph0 * sinphi + this->m_proj_parm.cosph0 * cosphi * coslam;
|
||||
break;
|
||||
case equit:
|
||||
xy_y = cosphi * coslam;
|
||||
break;
|
||||
case s_pole:
|
||||
xy_y = - sinphi;
|
||||
break;
|
||||
case n_pole:
|
||||
xy_y = sinphi;
|
||||
break;
|
||||
}
|
||||
if (xy_y < this->m_proj_parm.rp) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
xy_y = this->m_proj_parm.pn1 / (this->m_proj_parm.p - xy_y);
|
||||
xy_x = xy_y * cosphi * sin(lp_lon);
|
||||
switch (this->m_proj_parm.mode) {
|
||||
case obliq:
|
||||
xy_y *= (this->m_proj_parm.cosph0 * sinphi -
|
||||
this->m_proj_parm.sinph0 * cosphi * coslam);
|
||||
break;
|
||||
case equit:
|
||||
xy_y *= sinphi;
|
||||
break;
|
||||
case n_pole:
|
||||
coslam = - coslam;
|
||||
BOOST_FALLTHROUGH;
|
||||
case s_pole:
|
||||
xy_y *= cosphi * coslam;
|
||||
break;
|
||||
}
|
||||
if (this->m_proj_parm.tilt) {
|
||||
T yt, ba;
|
||||
|
||||
yt = xy_y * this->m_proj_parm.cg + xy_x * this->m_proj_parm.sg;
|
||||
ba = 1. / (yt * this->m_proj_parm.sw * this->m_proj_parm.h + this->m_proj_parm.cw);
|
||||
xy_x = (xy_x * this->m_proj_parm.cg - xy_y * this->m_proj_parm.sg) * this->m_proj_parm.cw * ba;
|
||||
xy_y = yt * ba;
|
||||
}
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
T rh, cosz, sinz;
|
||||
|
||||
if (this->m_proj_parm.tilt) {
|
||||
T bm, bq, yt;
|
||||
|
||||
yt = 1./(this->m_proj_parm.pn1 - xy_y * this->m_proj_parm.sw);
|
||||
bm = this->m_proj_parm.pn1 * xy_x * yt;
|
||||
bq = this->m_proj_parm.pn1 * xy_y * this->m_proj_parm.cw * yt;
|
||||
xy_x = bm * this->m_proj_parm.cg + bq * this->m_proj_parm.sg;
|
||||
xy_y = bq * this->m_proj_parm.cg - bm * this->m_proj_parm.sg;
|
||||
}
|
||||
rh = boost::math::hypot(xy_x, xy_y);
|
||||
if ((sinz = 1. - rh * rh * this->m_proj_parm.pfact) < 0.) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
sinz = (this->m_proj_parm.p - sqrt(sinz)) / (this->m_proj_parm.pn1 / rh + rh / this->m_proj_parm.pn1);
|
||||
cosz = sqrt(1. - sinz * sinz);
|
||||
if (fabs(rh) <= epsilon10) {
|
||||
lp_lon = 0.;
|
||||
lp_lat = this->m_par.phi0;
|
||||
} else {
|
||||
switch (this->m_proj_parm.mode) {
|
||||
case obliq:
|
||||
lp_lat = asin(cosz * this->m_proj_parm.sinph0 + xy_y * sinz * this->m_proj_parm.cosph0 / rh);
|
||||
xy_y = (cosz - this->m_proj_parm.sinph0 * sin(lp_lat)) * rh;
|
||||
xy_x *= sinz * this->m_proj_parm.cosph0;
|
||||
break;
|
||||
case equit:
|
||||
lp_lat = asin(xy_y * sinz / rh);
|
||||
xy_y = cosz * rh;
|
||||
xy_x *= sinz;
|
||||
break;
|
||||
case n_pole:
|
||||
lp_lat = asin(cosz);
|
||||
xy_y = -xy_y;
|
||||
break;
|
||||
case s_pole:
|
||||
lp_lat = - asin(cosz);
|
||||
break;
|
||||
}
|
||||
lp_lon = atan2(xy_x, xy_y);
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "nsper_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup(Params const& params, Parameters& par, par_nsper<T>& proj_parm)
|
||||
{
|
||||
proj_parm.height = pj_get_param_f<T, srs::spar::h>(params, "h", srs::dpar::h);
|
||||
if (proj_parm.height <= 0.)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_h_less_than_zero) );
|
||||
|
||||
if (fabs(fabs(par.phi0) - geometry::math::half_pi<T>()) < epsilon10)
|
||||
proj_parm.mode = par.phi0 < 0. ? s_pole : n_pole;
|
||||
else if (fabs(par.phi0) < epsilon10)
|
||||
proj_parm.mode = equit;
|
||||
else {
|
||||
proj_parm.mode = obliq;
|
||||
proj_parm.sinph0 = sin(par.phi0);
|
||||
proj_parm.cosph0 = cos(par.phi0);
|
||||
}
|
||||
proj_parm.pn1 = proj_parm.height / par.a; /* normalize by radius */
|
||||
proj_parm.p = 1. + proj_parm.pn1;
|
||||
proj_parm.rp = 1. / proj_parm.p;
|
||||
proj_parm.h = 1. / proj_parm.pn1;
|
||||
proj_parm.pfact = (proj_parm.p + 1.) * proj_parm.h;
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
|
||||
// Near-sided perspective
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_nsper(Params const& params, Parameters& par, par_nsper<T>& proj_parm)
|
||||
{
|
||||
proj_parm.tilt = 0;
|
||||
|
||||
setup(params, par, proj_parm);
|
||||
}
|
||||
|
||||
// Tilted perspective
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_tpers(Params const& params, Parameters& par, par_nsper<T>& proj_parm)
|
||||
{
|
||||
T const omega = pj_get_param_r<T, srs::spar::tilt>(params, "tilt", srs::dpar::tilt);
|
||||
T const gamma = pj_get_param_r<T, srs::spar::azi>(params, "azi", srs::dpar::azi);
|
||||
proj_parm.tilt = 1;
|
||||
proj_parm.cg = cos(gamma); proj_parm.sg = sin(gamma);
|
||||
proj_parm.cw = cos(omega); proj_parm.sw = sin(omega);
|
||||
|
||||
setup(params, par, proj_parm);
|
||||
}
|
||||
|
||||
}} // namespace detail::nsper
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Near-sided perspective projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Azimuthal
|
||||
- Spheroid
|
||||
\par Projection parameters
|
||||
- h: Height
|
||||
\par Example
|
||||
\image html ex_nsper.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct nsper_spheroid : public detail::nsper::base_nsper_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline nsper_spheroid(Params const& params, Parameters const& par)
|
||||
: detail::nsper::base_nsper_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::nsper::setup_nsper(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Tilted perspective projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Azimuthal
|
||||
- Spheroid
|
||||
\par Projection parameters
|
||||
- tilt: Tilt, or Omega (real)
|
||||
- azi: Azimuth (or Gamma) (real)
|
||||
- h: Height
|
||||
\par Example
|
||||
\image html ex_tpers.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct tpers_spheroid : public detail::nsper::base_nsper_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline tpers_spheroid(Params const& params, Parameters const& par)
|
||||
: detail::nsper::base_nsper_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::nsper::setup_tpers(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_nsper, nsper_spheroid, nsper_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_tpers, tpers_spheroid, tpers_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(nsper_entry, nsper_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(tpers_entry, tpers_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(nsper_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(nsper, nsper_entry)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(tpers, tpers_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_NSPER_HPP
|
||||
|
||||
237
linx64/include/boost/geometry/srs/projections/proj/nzmg.hpp
Normal file
237
linx64/include/boost/geometry/srs/projections/proj/nzmg.hpp
Normal file
@@ -0,0 +1,237 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Purpose: Implementation of the nzmg (New Zealand Map Grid) projection.
|
||||
// Very loosely based upon DMA code by Bradford W. Drew
|
||||
// Author: Gerald Evenden
|
||||
// Copyright (c) 1995, Gerald Evenden
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_NZMG_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_NZMG_HPP
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_zpoly1.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace nzmg
|
||||
{
|
||||
|
||||
static const double epsilon = 1e-10;
|
||||
static const int Nbf = 5;
|
||||
static const int Ntpsi = 9;
|
||||
static const int Ntphi = 8;
|
||||
|
||||
template <typename T>
|
||||
inline T sec5_to_rad() { return 0.4848136811095359935899141023; }
|
||||
template <typename T>
|
||||
inline T rad_to_sec5() { return 2.062648062470963551564733573; }
|
||||
|
||||
template <typename T>
|
||||
inline const pj_complex<T> * bf()
|
||||
{
|
||||
static const pj_complex<T> result[] = {
|
||||
{.7557853228, 0.0},
|
||||
{.249204646, .003371507},
|
||||
{-.001541739, .041058560},
|
||||
{-.10162907, .01727609},
|
||||
{-.26623489, -.36249218},
|
||||
{-.6870983, -1.1651967}
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline const T * tphi()
|
||||
{
|
||||
static const T result[] = { 1.5627014243, .5185406398, -.03333098,
|
||||
-.1052906, -.0368594, .007317,
|
||||
.01220, .00394, -.0013 };
|
||||
return result;
|
||||
}
|
||||
template <typename T>
|
||||
inline const T * tpsi()
|
||||
{
|
||||
static const T result[] = { .6399175073, -.1358797613, .063294409, -.02526853, .0117879,
|
||||
-.0055161, .0026906, -.001333, .00067, -.00034 };
|
||||
return result;
|
||||
}
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_nzmg_ellipsoid
|
||||
: public base_t_fi<base_nzmg_ellipsoid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_nzmg_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_nzmg_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_forward) ellipsoid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T rad_to_sec5 = nzmg::rad_to_sec5<T>();
|
||||
|
||||
pj_complex<T> p;
|
||||
const T * C;
|
||||
int i;
|
||||
|
||||
lp_lat = (lp_lat - this->m_par.phi0) * rad_to_sec5;
|
||||
for (p.r = *(C = tpsi<T>() + (i = Ntpsi)); i ; --i)
|
||||
p.r = *--C + lp_lat * p.r;
|
||||
p.r *= lp_lat;
|
||||
p.i = lp_lon;
|
||||
p = pj_zpoly1(p, bf<T>(), Nbf);
|
||||
xy_x = p.i;
|
||||
xy_y = p.r;
|
||||
}
|
||||
|
||||
// INVERSE(e_inverse) ellipsoid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T sec5_to_rad = nzmg::sec5_to_rad<T>();
|
||||
|
||||
int nn, i;
|
||||
pj_complex<T> p, f, fp, dp;
|
||||
T den;
|
||||
const T* C;
|
||||
|
||||
p.r = xy_y;
|
||||
p.i = xy_x;
|
||||
for (nn = 20; nn ;--nn) {
|
||||
f = pj_zpolyd1(p, bf<T>(), Nbf, &fp);
|
||||
f.r -= xy_y;
|
||||
f.i -= xy_x;
|
||||
den = fp.r * fp.r + fp.i * fp.i;
|
||||
p.r += dp.r = -(f.r * fp.r + f.i * fp.i) / den;
|
||||
p.i += dp.i = -(f.i * fp.r - f.r * fp.i) / den;
|
||||
if ((fabs(dp.r) + fabs(dp.i)) <= epsilon)
|
||||
break;
|
||||
}
|
||||
if (nn) {
|
||||
lp_lon = p.i;
|
||||
for (lp_lat = *(C = tphi<T>() + (i = Ntphi)); i ; --i)
|
||||
lp_lat = *--C + p.r * lp_lat;
|
||||
lp_lat = this->m_par.phi0 + p.r * lp_lat * sec5_to_rad;
|
||||
} else
|
||||
lp_lon = lp_lat = HUGE_VAL;
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "nzmg_ellipsoid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// New Zealand Map Grid
|
||||
template <typename Parameters>
|
||||
inline void setup_nzmg(Parameters& par)
|
||||
{
|
||||
typedef typename Parameters::type calc_t;
|
||||
static const calc_t d2r = geometry::math::d2r<calc_t>();
|
||||
|
||||
/* force to International major axis */
|
||||
par.a = 6378388.0;
|
||||
par.ra = 1. / par.a;
|
||||
par.lam0 = 173. * d2r;
|
||||
par.phi0 = -41. * d2r;
|
||||
par.x0 = 2510000.;
|
||||
par.y0 = 6023150.;
|
||||
}
|
||||
|
||||
}} // namespace detail::nzmg
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief New Zealand Map Grid projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Fixed Earth
|
||||
\par Example
|
||||
\image html ex_nzmg.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct nzmg_ellipsoid : public detail::nzmg::base_nzmg_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline nzmg_ellipsoid(Params const& , Parameters const& par)
|
||||
: detail::nzmg::base_nzmg_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::nzmg::setup_nzmg(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_nzmg, nzmg_ellipsoid, nzmg_ellipsoid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(nzmg_entry, nzmg_ellipsoid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(nzmg_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(nzmg, nzmg_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_NZMG_HPP
|
||||
|
||||
627
linx64/include/boost/geometry/srs/projections/proj/ob_tran.hpp
Normal file
627
linx64/include/boost/geometry/srs/projections/proj/ob_tran.hpp
Normal file
@@ -0,0 +1,627 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018, 2019.
|
||||
// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_OB_TRAN_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_OB_TRAN_HPP
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/aasincos.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_ell_set.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail {
|
||||
|
||||
// fwd declaration needed below
|
||||
template <typename T>
|
||||
inline detail::base_v<T, projections::parameters<T> >*
|
||||
create_new(srs::detail::proj4_parameters const& params,
|
||||
projections::parameters<T> const& parameters);
|
||||
|
||||
template <typename T>
|
||||
inline detail::base_v<T, projections::parameters<T> >*
|
||||
create_new(srs::dpar::parameters<T> const& params,
|
||||
projections::parameters<T> const& parameters);
|
||||
|
||||
} // namespace detail
|
||||
|
||||
namespace detail { namespace ob_tran
|
||||
{
|
||||
|
||||
static const double tolerance = 1e-10;
|
||||
|
||||
template <typename Parameters>
|
||||
inline Parameters o_proj_parameters(srs::detail::proj4_parameters const& params,
|
||||
Parameters const& par)
|
||||
{
|
||||
/* copy existing header into new */
|
||||
Parameters pj = par;
|
||||
|
||||
/* get name of projection to be translated */
|
||||
pj.id = pj_get_param_s(params, "o_proj");
|
||||
if (pj.id.is_unknown())
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_no_rotation_proj) );
|
||||
|
||||
/* avoid endless recursion */
|
||||
if( pj.id.name == "ob_tran")
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_failed_to_find_proj) );
|
||||
|
||||
// Commented out for consistency with Proj4 >= 5.0.0
|
||||
/* force spherical earth */
|
||||
//pj.one_es = pj.rone_es = 1.;
|
||||
//pj.es = pj.e = 0.;
|
||||
|
||||
return pj;
|
||||
}
|
||||
|
||||
template <typename T, typename Parameters>
|
||||
inline Parameters o_proj_parameters(srs::dpar::parameters<T> const& params,
|
||||
Parameters const& par)
|
||||
{
|
||||
/* copy existing header into new */
|
||||
Parameters pj = par;
|
||||
|
||||
/* get name of projection to be translated */
|
||||
typename srs::dpar::parameters<T>::const_iterator
|
||||
it = pj_param_find(params, srs::dpar::o_proj);
|
||||
if (it != params.end())
|
||||
pj.id = static_cast<srs::dpar::value_proj>(it->template get_value<int>());
|
||||
else
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_no_rotation_proj) );
|
||||
|
||||
/* avoid endless recursion */
|
||||
if( pj.id.id == srs::dpar::proj_ob_tran)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_failed_to_find_proj) );
|
||||
|
||||
// Commented out for consistency with Proj4 >= 5.0.0
|
||||
/* force spherical earth */
|
||||
//pj.one_es = pj.rone_es = 1.;
|
||||
//pj.es = pj.e = 0.;
|
||||
|
||||
return pj;
|
||||
}
|
||||
|
||||
template <BOOST_GEOMETRY_PROJECTIONS_DETAIL_TYPENAME_PX, typename Parameters>
|
||||
inline Parameters o_proj_parameters(srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX> const& /*params*/,
|
||||
Parameters const& par)
|
||||
{
|
||||
/* copy existing header into new */
|
||||
Parameters pj = par;
|
||||
|
||||
/* get name of projection to be translated */
|
||||
typedef srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX> params_type;
|
||||
typedef typename srs::spar::detail::tuples_find_if
|
||||
<
|
||||
params_type,
|
||||
srs::spar::detail::is_param_t<srs::spar::o_proj>::pred
|
||||
>::type o_proj_type;
|
||||
|
||||
static const bool is_found = srs::spar::detail::tuples_is_found<o_proj_type>::value;
|
||||
BOOST_MPL_ASSERT_MSG((is_found), NO_ROTATION_PROJ, (params_type));
|
||||
|
||||
typedef typename o_proj_type::type proj_type;
|
||||
static const bool is_specialized = srs::spar::detail::proj_traits<proj_type>::is_specialized;
|
||||
BOOST_MPL_ASSERT_MSG((is_specialized), NO_ROTATION_PROJ, (params_type));
|
||||
|
||||
pj.id = srs::spar::detail::proj_traits<proj_type>::id;
|
||||
|
||||
/* avoid endless recursion */
|
||||
static const bool is_non_resursive = ! boost::is_same<proj_type, srs::spar::proj_ob_tran>::value;
|
||||
BOOST_MPL_ASSERT_MSG((is_non_resursive), INVALID_O_PROJ_PARAMETER, (params_type));
|
||||
|
||||
// Commented out for consistency with Proj4 >= 5.0.0
|
||||
/* force spherical earth */
|
||||
//pj.one_es = pj.rone_es = 1.;
|
||||
//pj.es = pj.e = 0.;
|
||||
|
||||
return pj;
|
||||
}
|
||||
|
||||
template <typename T, typename Parameters>
|
||||
struct par_ob_tran
|
||||
{
|
||||
template <typename Params>
|
||||
par_ob_tran(Params const& params, Parameters const& par)
|
||||
: link(projections::detail::create_new(params, o_proj_parameters(params, par)))
|
||||
{
|
||||
if (! link.get())
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_unknown_projection_id) );
|
||||
}
|
||||
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
link->fwd(lp_lon, lp_lat, xy_x, xy_y);
|
||||
}
|
||||
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
link->inv(xy_x, xy_y, lp_lon, lp_lat);
|
||||
}
|
||||
|
||||
boost::shared_ptr<base_v<T, Parameters> > link;
|
||||
T lamp;
|
||||
T cphip, sphip;
|
||||
};
|
||||
|
||||
template <typename StaticParameters, typename T, typename Parameters>
|
||||
struct par_ob_tran_static
|
||||
{
|
||||
// this metafunction handles static error handling
|
||||
typedef typename srs::spar::detail::pick_o_proj_tag
|
||||
<
|
||||
StaticParameters
|
||||
>::type o_proj_tag;
|
||||
|
||||
/* avoid endless recursion */
|
||||
static const bool is_o_proj_not_ob_tran = ! boost::is_same<o_proj_tag, srs::spar::proj_ob_tran>::value;
|
||||
BOOST_MPL_ASSERT_MSG((is_o_proj_not_ob_tran), INVALID_O_PROJ_PARAMETER, (StaticParameters));
|
||||
|
||||
typedef typename projections::detail::static_projection_type
|
||||
<
|
||||
o_proj_tag,
|
||||
// Commented out for consistency with Proj4 >= 5.0.0
|
||||
//srs_sphere_tag, // force spherical
|
||||
typename projections::detail::static_srs_tag<StaticParameters>::type,
|
||||
StaticParameters,
|
||||
T,
|
||||
Parameters
|
||||
>::type projection_type;
|
||||
|
||||
par_ob_tran_static(StaticParameters const& params, Parameters const& par)
|
||||
: link(params, o_proj_parameters(params, par))
|
||||
{}
|
||||
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
link.fwd(lp_lon, lp_lat, xy_x, xy_y);
|
||||
}
|
||||
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
link.inv(xy_x, xy_y, lp_lon, lp_lat);
|
||||
}
|
||||
|
||||
projection_type link;
|
||||
T lamp;
|
||||
T cphip, sphip;
|
||||
};
|
||||
|
||||
template <typename T, typename Par>
|
||||
inline void o_forward(T lp_lon, T lp_lat, T& xy_x, T& xy_y, Par const& proj_parm)
|
||||
{
|
||||
T coslam, sinphi, cosphi;
|
||||
|
||||
coslam = cos(lp_lon);
|
||||
sinphi = sin(lp_lat);
|
||||
cosphi = cos(lp_lat);
|
||||
lp_lon = adjlon(aatan2(cosphi * sin(lp_lon), proj_parm.sphip * cosphi * coslam +
|
||||
proj_parm.cphip * sinphi) + proj_parm.lamp);
|
||||
lp_lat = aasin(proj_parm.sphip * sinphi - proj_parm.cphip * cosphi * coslam);
|
||||
|
||||
proj_parm.fwd(lp_lon, lp_lat, xy_x, xy_y);
|
||||
}
|
||||
|
||||
template <typename T, typename Par>
|
||||
inline void o_inverse(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat, Par const& proj_parm)
|
||||
{
|
||||
T coslam, sinphi, cosphi;
|
||||
|
||||
proj_parm.inv(xy_x, xy_y, lp_lon, lp_lat);
|
||||
if (lp_lon != HUGE_VAL) {
|
||||
coslam = cos(lp_lon -= proj_parm.lamp);
|
||||
sinphi = sin(lp_lat);
|
||||
cosphi = cos(lp_lat);
|
||||
lp_lat = aasin(proj_parm.sphip * sinphi + proj_parm.cphip * cosphi * coslam);
|
||||
lp_lon = aatan2(cosphi * sin(lp_lon), proj_parm.sphip * cosphi * coslam -
|
||||
proj_parm.cphip * sinphi);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T, typename Par>
|
||||
inline void t_forward(T lp_lon, T lp_lat, T& xy_x, T& xy_y, Par const& proj_parm)
|
||||
{
|
||||
T cosphi, coslam;
|
||||
|
||||
cosphi = cos(lp_lat);
|
||||
coslam = cos(lp_lon);
|
||||
lp_lon = adjlon(aatan2(cosphi * sin(lp_lon), sin(lp_lat)) + proj_parm.lamp);
|
||||
lp_lat = aasin(- cosphi * coslam);
|
||||
|
||||
proj_parm.fwd(lp_lon, lp_lat, xy_x, xy_y);
|
||||
}
|
||||
|
||||
template <typename T, typename Par>
|
||||
inline void t_inverse(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat, Par const& proj_parm)
|
||||
{
|
||||
T cosphi, t;
|
||||
|
||||
proj_parm.inv(xy_x, xy_y, lp_lon, lp_lat);
|
||||
if (lp_lon != HUGE_VAL) {
|
||||
cosphi = cos(lp_lat);
|
||||
t = lp_lon - proj_parm.lamp;
|
||||
lp_lon = aatan2(cosphi * sin(t), - sin(lp_lat));
|
||||
lp_lat = aasin(cosphi * cos(t));
|
||||
}
|
||||
}
|
||||
|
||||
// General Oblique Transformation
|
||||
template <typename T, typename Params, typename Parameters, typename ProjParameters>
|
||||
inline T setup_ob_tran(Params const& params, Parameters & /*par*/, ProjParameters& proj_parm)
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T phip, alpha;
|
||||
|
||||
// Commented out for consistency with Proj4 >= 5.0.0
|
||||
//par.es = 0.; /* force to spherical */
|
||||
|
||||
// proj_parm.link should be created at this point
|
||||
|
||||
if (pj_param_r<srs::spar::o_alpha>(params, "o_alpha", srs::dpar::o_alpha, alpha)) {
|
||||
T lamc, phic;
|
||||
|
||||
lamc = pj_get_param_r<T, srs::spar::o_lon_c>(params, "o_lon_c", srs::dpar::o_lon_c);
|
||||
phic = pj_get_param_r<T, srs::spar::o_lon_c>(params, "o_lat_c", srs::dpar::o_lat_c);
|
||||
//alpha = pj_get_param_r(par.params, "o_alpha");
|
||||
|
||||
if (fabs(fabs(phic) - half_pi) <= tolerance)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_lat_0_or_alpha_eq_90) );
|
||||
|
||||
proj_parm.lamp = lamc + aatan2(-cos(alpha), -sin(alpha) * sin(phic));
|
||||
phip = aasin(cos(phic) * sin(alpha));
|
||||
} else if (pj_param_r<srs::spar::o_lat_p>(params, "o_lat_p", srs::dpar::o_lat_p, phip)) { /* specified new pole */
|
||||
proj_parm.lamp = pj_get_param_r<T, srs::spar::o_lon_p>(params, "o_lon_p", srs::dpar::o_lon_p);
|
||||
//phip = pj_param_r(par.params, "o_lat_p");
|
||||
} else { /* specified new "equator" points */
|
||||
T lam1, lam2, phi1, phi2, con;
|
||||
|
||||
lam1 = pj_get_param_r<T, srs::spar::o_lon_1>(params, "o_lon_1", srs::dpar::o_lon_1);
|
||||
phi1 = pj_get_param_r<T, srs::spar::o_lat_1>(params, "o_lat_1", srs::dpar::o_lat_1);
|
||||
lam2 = pj_get_param_r<T, srs::spar::o_lon_2>(params, "o_lon_2", srs::dpar::o_lon_2);
|
||||
phi2 = pj_get_param_r<T, srs::spar::o_lat_2>(params, "o_lat_2", srs::dpar::o_lat_2);
|
||||
if (fabs(phi1 - phi2) <= tolerance || (con = fabs(phi1)) <= tolerance ||
|
||||
fabs(con - half_pi) <= tolerance || fabs(fabs(phi2) - half_pi) <= tolerance)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_lat_1_or_2_zero_or_90) );
|
||||
|
||||
proj_parm.lamp = atan2(cos(phi1) * sin(phi2) * cos(lam1) -
|
||||
sin(phi1) * cos(phi2) * cos(lam2),
|
||||
sin(phi1) * cos(phi2) * sin(lam2) -
|
||||
cos(phi1) * sin(phi2) * sin(lam1));
|
||||
phip = atan(-cos(proj_parm.lamp - lam1) / tan(phi1));
|
||||
}
|
||||
|
||||
if (fabs(phip) > tolerance) { /* oblique */
|
||||
proj_parm.cphip = cos(phip);
|
||||
proj_parm.sphip = sin(phip);
|
||||
} else { /* transverse */
|
||||
}
|
||||
|
||||
// TODO:
|
||||
/* Support some rather speculative test cases, where the rotated projection */
|
||||
/* is actually latlong. We do not want scaling in that case... */
|
||||
//if (proj_parm.link...mutable_parameters().right==PJ_IO_UNITS_ANGULAR)
|
||||
// par.right = PJ_IO_UNITS_PROJECTED;
|
||||
|
||||
// return phip to choose model
|
||||
return phip;
|
||||
}
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_ob_tran_oblique
|
||||
: public base_t_fi<base_ob_tran_oblique<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_ob_tran<T, Parameters> m_proj_parm;
|
||||
|
||||
inline base_ob_tran_oblique(Parameters const& par,
|
||||
par_ob_tran<T, Parameters> const& proj_parm)
|
||||
: base_t_fi
|
||||
<
|
||||
base_ob_tran_oblique<T, Parameters>, T, Parameters
|
||||
>(*this, par)
|
||||
, m_proj_parm(proj_parm)
|
||||
{}
|
||||
|
||||
// FORWARD(o_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
o_forward(lp_lon, lp_lat, xy_x, xy_y, this->m_proj_parm);
|
||||
}
|
||||
|
||||
// INVERSE(o_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
o_inverse(xy_x, xy_y, lp_lon, lp_lat, this->m_proj_parm);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "ob_tran_oblique";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_ob_tran_transverse
|
||||
: public base_t_fi<base_ob_tran_transverse<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_ob_tran<T, Parameters> m_proj_parm;
|
||||
|
||||
inline base_ob_tran_transverse(Parameters const& par,
|
||||
par_ob_tran<T, Parameters> const& proj_parm)
|
||||
: base_t_fi
|
||||
<
|
||||
base_ob_tran_transverse<T, Parameters>, T, Parameters
|
||||
>(*this, par)
|
||||
, m_proj_parm(proj_parm)
|
||||
{}
|
||||
|
||||
// FORWARD(t_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
t_forward(lp_lon, lp_lat, xy_x, xy_y, this->m_proj_parm);
|
||||
}
|
||||
|
||||
// INVERSE(t_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
t_inverse(xy_x, xy_y, lp_lon, lp_lat, this->m_proj_parm);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "ob_tran_transverse";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename StaticParameters, typename T, typename Parameters>
|
||||
struct base_ob_tran_static
|
||||
: public base_t_fi<base_ob_tran_static<StaticParameters, T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_ob_tran_static<StaticParameters, T, Parameters> m_proj_parm;
|
||||
bool m_is_oblique;
|
||||
|
||||
inline base_ob_tran_static(StaticParameters const& params, Parameters const& par)
|
||||
: base_t_fi<base_ob_tran_static<StaticParameters, T, Parameters>, T, Parameters>(*this, par)
|
||||
, m_proj_parm(params, par)
|
||||
{}
|
||||
|
||||
// FORWARD(o_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
if (m_is_oblique) {
|
||||
o_forward(lp_lon, lp_lat, xy_x, xy_y, this->m_proj_parm);
|
||||
} else {
|
||||
t_forward(lp_lon, lp_lat, xy_x, xy_y, this->m_proj_parm);
|
||||
}
|
||||
}
|
||||
|
||||
// INVERSE(o_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
if (m_is_oblique) {
|
||||
o_inverse(xy_x, xy_y, lp_lon, lp_lat, this->m_proj_parm);
|
||||
} else {
|
||||
t_inverse(xy_x, xy_y, lp_lon, lp_lat, this->m_proj_parm);
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "ob_tran";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}} // namespace detail::ob_tran
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief General Oblique Transformation projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
\par Projection parameters
|
||||
- o_proj (string)
|
||||
- Plus projection parameters
|
||||
- o_lat_p (degrees)
|
||||
- o_lon_p (degrees)
|
||||
- New pole
|
||||
- o_alpha: Alpha (degrees)
|
||||
- o_lon_c (degrees)
|
||||
- o_lat_c (degrees)
|
||||
- o_lon_1 (degrees)
|
||||
- o_lat_1: Latitude of first standard parallel (degrees)
|
||||
- o_lon_2 (degrees)
|
||||
- o_lat_2: Latitude of second standard parallel (degrees)
|
||||
\par Example
|
||||
\image html ex_ob_tran.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct ob_tran_oblique : public detail::ob_tran::base_ob_tran_oblique<T, Parameters>
|
||||
{
|
||||
inline ob_tran_oblique(Parameters const& par,
|
||||
detail::ob_tran::par_ob_tran<T, Parameters> const& proj_parm)
|
||||
: detail::ob_tran::base_ob_tran_oblique<T, Parameters>(par, proj_parm)
|
||||
{
|
||||
// already done
|
||||
//detail::ob_tran::setup_ob_tran(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief General Oblique Transformation projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
\par Projection parameters
|
||||
- o_proj (string)
|
||||
- Plus projection parameters
|
||||
- o_lat_p (degrees)
|
||||
- o_lon_p (degrees)
|
||||
- New pole
|
||||
- o_alpha: Alpha (degrees)
|
||||
- o_lon_c (degrees)
|
||||
- o_lat_c (degrees)
|
||||
- o_lon_1 (degrees)
|
||||
- o_lat_1: Latitude of first standard parallel (degrees)
|
||||
- o_lon_2 (degrees)
|
||||
- o_lat_2: Latitude of second standard parallel (degrees)
|
||||
\par Example
|
||||
\image html ex_ob_tran.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct ob_tran_transverse : public detail::ob_tran::base_ob_tran_transverse<T, Parameters>
|
||||
{
|
||||
inline ob_tran_transverse(Parameters const& par,
|
||||
detail::ob_tran::par_ob_tran<T, Parameters> const& proj_parm)
|
||||
: detail::ob_tran::base_ob_tran_transverse<T, Parameters>(par, proj_parm)
|
||||
{
|
||||
// already done
|
||||
//detail::ob_tran::setup_ob_tran(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief General Oblique Transformation projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
\par Projection parameters
|
||||
- o_proj (string)
|
||||
- Plus projection parameters
|
||||
- o_lat_p (degrees)
|
||||
- o_lon_p (degrees)
|
||||
- New pole
|
||||
- o_alpha: Alpha (degrees)
|
||||
- o_lon_c (degrees)
|
||||
- o_lat_c (degrees)
|
||||
- o_lon_1 (degrees)
|
||||
- o_lat_1: Latitude of first standard parallel (degrees)
|
||||
- o_lon_2 (degrees)
|
||||
- o_lat_2: Latitude of second standard parallel (degrees)
|
||||
\par Example
|
||||
\image html ex_ob_tran.gif
|
||||
*/
|
||||
template <typename StaticParameters, typename T, typename Parameters>
|
||||
struct ob_tran_static : public detail::ob_tran::base_ob_tran_static<StaticParameters, T, Parameters>
|
||||
{
|
||||
inline ob_tran_static(StaticParameters const& params, Parameters const& par)
|
||||
: detail::ob_tran::base_ob_tran_static<StaticParameters, T, Parameters>(params, par)
|
||||
{
|
||||
T phip = detail::ob_tran::setup_ob_tran<T>(params, this->m_par, this->m_proj_parm);
|
||||
this->m_is_oblique = fabs(phip) > detail::ob_tran::tolerance;
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
template <typename SP, typename CT, typename P>
|
||||
struct static_projection_type<srs::spar::proj_ob_tran, srs_sphere_tag, SP, CT, P>
|
||||
{
|
||||
typedef ob_tran_static<SP, CT, P> type;
|
||||
};
|
||||
template <typename SP, typename CT, typename P>
|
||||
struct static_projection_type<srs::spar::proj_ob_tran, srs_spheroid_tag, SP, CT, P>
|
||||
{
|
||||
typedef ob_tran_static<SP, CT, P> type;
|
||||
};
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_BEGIN(ob_tran_entry)
|
||||
{
|
||||
Parameters parameters_copy = parameters;
|
||||
detail::ob_tran::par_ob_tran<T, Parameters> proj_parm(params, parameters_copy);
|
||||
T phip = detail::ob_tran::setup_ob_tran<T>(params, parameters_copy, proj_parm);
|
||||
|
||||
if (fabs(phip) > detail::ob_tran::tolerance)
|
||||
return new base_v_fi<ob_tran_oblique<T, Parameters>, T, Parameters>(parameters_copy, proj_parm);
|
||||
else
|
||||
return new base_v_fi<ob_tran_transverse<T, Parameters>, T, Parameters>(parameters_copy, proj_parm);
|
||||
}
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_END
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(ob_tran_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(ob_tran, ob_tran_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_OB_TRAN_HPP
|
||||
|
||||
222
linx64/include/boost/geometry/srs/projections/proj/ocea.hpp
Normal file
222
linx64/include/boost/geometry/srs/projections/proj/ocea.hpp
Normal file
@@ -0,0 +1,222 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_OCEA_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_OCEA_HPP
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace ocea
|
||||
{
|
||||
template <typename T>
|
||||
struct par_ocea
|
||||
{
|
||||
T rok;
|
||||
T rtk;
|
||||
T sinphi;
|
||||
T cosphi;
|
||||
T singam;
|
||||
T cosgam;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_ocea_spheroid
|
||||
: public base_t_fi<base_ocea_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_ocea<T> m_proj_parm;
|
||||
|
||||
inline base_ocea_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_ocea_spheroid<T, Parameters>,
|
||||
T, Parameters>(*this, par) {}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T pi = detail::pi<T>();
|
||||
|
||||
T t;
|
||||
|
||||
xy_y = sin(lp_lon);
|
||||
t = cos(lp_lon);
|
||||
xy_x = atan((tan(lp_lat) * this->m_proj_parm.cosphi + this->m_proj_parm.sinphi * xy_y) / t);
|
||||
if (t < 0.)
|
||||
xy_x += pi;
|
||||
xy_x *= this->m_proj_parm.rtk;
|
||||
xy_y = this->m_proj_parm.rok * (this->m_proj_parm.sinphi * sin(lp_lat) - this->m_proj_parm.cosphi * cos(lp_lat) * xy_y);
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
T t, s;
|
||||
|
||||
xy_y /= this->m_proj_parm.rok;
|
||||
xy_x /= this->m_proj_parm.rtk;
|
||||
t = sqrt(1. - xy_y * xy_y);
|
||||
lp_lat = asin(xy_y * this->m_proj_parm.sinphi + t * this->m_proj_parm.cosphi * (s = sin(xy_x)));
|
||||
lp_lon = atan2(t * this->m_proj_parm.sinphi * s - xy_y * this->m_proj_parm.cosphi,
|
||||
t * cos(xy_x));
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "ocea_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Oblique Cylindrical Equal Area
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_ocea(Params const& params, Parameters& par, par_ocea<T>& proj_parm)
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T phi_0=0.0, phi_1, phi_2, lam_1, lam_2, lonz, alpha;
|
||||
|
||||
proj_parm.rok = 1. / par.k0;
|
||||
proj_parm.rtk = par.k0;
|
||||
/*If the keyword "alpha" is found in the sentence then use 1point+1azimuth*/
|
||||
if ( pj_param_r<srs::spar::alpha>(params, "alpha", srs::dpar::alpha, alpha)) {
|
||||
/*Define Pole of oblique transformation from 1 point & 1 azimuth*/
|
||||
//alpha = pj_get_param_r(par.params, "alpha"); // set above
|
||||
lonz = pj_get_param_r<T, srs::spar::lonc>(params, "lonc", srs::dpar::lonc);
|
||||
/*Equation 9-8 page 80 (http://pubs.usgs.gov/pp/1395/report.pdf)*/
|
||||
proj_parm.singam = atan(-cos(alpha)/(-sin(phi_0) * sin(alpha))) + lonz;
|
||||
/*Equation 9-7 page 80 (http://pubs.usgs.gov/pp/1395/report.pdf)*/
|
||||
proj_parm.sinphi = asin(cos(phi_0) * sin(alpha));
|
||||
/*If the keyword "alpha" is NOT found in the sentence then use 2points*/
|
||||
} else {
|
||||
/*Define Pole of oblique transformation from 2 points*/
|
||||
phi_1 = pj_get_param_r<T, srs::spar::lat_1>(params, "lat_1", srs::dpar::lat_1);
|
||||
phi_2 = pj_get_param_r<T, srs::spar::lat_2>(params, "lat_2", srs::dpar::lat_2);
|
||||
lam_1 = pj_get_param_r<T, srs::spar::lon_1>(params, "lon_1", srs::dpar::lon_1);
|
||||
lam_2 = pj_get_param_r<T, srs::spar::lon_2>(params, "lon_2", srs::dpar::lon_2);
|
||||
/*Equation 9-1 page 80 (http://pubs.usgs.gov/pp/1395/report.pdf)*/
|
||||
proj_parm.singam = atan2(cos(phi_1) * sin(phi_2) * cos(lam_1) -
|
||||
sin(phi_1) * cos(phi_2) * cos(lam_2),
|
||||
sin(phi_1) * cos(phi_2) * sin(lam_2) -
|
||||
cos(phi_1) * sin(phi_2) * sin(lam_1) );
|
||||
|
||||
/* take care of P->lam0 wrap-around when +lam_1=-90*/
|
||||
if (lam_1 == -half_pi)
|
||||
proj_parm.singam = -proj_parm.singam;
|
||||
|
||||
/*Equation 9-2 page 80 (http://pubs.usgs.gov/pp/1395/report.pdf)*/
|
||||
proj_parm.sinphi = atan(-cos(proj_parm.singam - lam_1) / tan(phi_1));
|
||||
}
|
||||
par.lam0 = proj_parm.singam + half_pi;
|
||||
proj_parm.cosphi = cos(proj_parm.sinphi);
|
||||
proj_parm.sinphi = sin(proj_parm.sinphi);
|
||||
proj_parm.cosgam = cos(proj_parm.singam);
|
||||
proj_parm.singam = sin(proj_parm.singam);
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::ocea
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Oblique Cylindrical Equal Area projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
\par Projection parameters
|
||||
- lonc: Longitude (only used if alpha (or gamma) is specified) (degrees)
|
||||
- alpha: Alpha (degrees)
|
||||
- lat_1: Latitude of first standard parallel (degrees)
|
||||
- lat_2: Latitude of second standard parallel (degrees)
|
||||
- lon_1 (degrees)
|
||||
- lon_2 (degrees)
|
||||
\par Example
|
||||
\image html ex_ocea.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct ocea_spheroid : public detail::ocea::base_ocea_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline ocea_spheroid(Params const& params, Parameters const& par)
|
||||
: detail::ocea::base_ocea_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::ocea::setup_ocea(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_ocea, ocea_spheroid, ocea_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(ocea_entry, ocea_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(ocea_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(ocea, ocea_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_OCEA_HPP
|
||||
|
||||
197
linx64/include/boost/geometry/srs/projections/proj/oea.hpp
Normal file
197
linx64/include/boost/geometry/srs/projections/proj/oea.hpp
Normal file
@@ -0,0 +1,197 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_OEA_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_OEA_HPP
|
||||
|
||||
#include <boost/math/special_functions/hypot.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/aasincos.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace oea
|
||||
{
|
||||
template <typename T>
|
||||
struct par_oea
|
||||
{
|
||||
T theta;
|
||||
T m, n;
|
||||
T two_r_m, two_r_n, rm, rn, hm, hn;
|
||||
T cp0, sp0;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_oea_spheroid
|
||||
: public base_t_fi<base_oea_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_oea<T> m_proj_parm;
|
||||
|
||||
inline base_oea_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_oea_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) sphere
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T Az, M, N, cp, sp, cl, shz;
|
||||
|
||||
cp = cos(lp_lat);
|
||||
sp = sin(lp_lat);
|
||||
cl = cos(lp_lon);
|
||||
Az = aatan2(cp * sin(lp_lon), this->m_proj_parm.cp0 * sp - this->m_proj_parm.sp0 * cp * cl) + this->m_proj_parm.theta;
|
||||
shz = sin(0.5 * aacos(this->m_proj_parm.sp0 * sp + this->m_proj_parm.cp0 * cp * cl));
|
||||
M = aasin(shz * sin(Az));
|
||||
N = aasin(shz * cos(Az) * cos(M) / cos(M * this->m_proj_parm.two_r_m));
|
||||
xy_y = this->m_proj_parm.n * sin(N * this->m_proj_parm.two_r_n);
|
||||
xy_x = this->m_proj_parm.m * sin(M * this->m_proj_parm.two_r_m) * cos(N) / cos(N * this->m_proj_parm.two_r_n);
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) sphere
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
T N, M, xp, yp, z, Az, cz, sz, cAz;
|
||||
|
||||
N = this->m_proj_parm.hn * aasin(xy_y * this->m_proj_parm.rn);
|
||||
M = this->m_proj_parm.hm * aasin(xy_x * this->m_proj_parm.rm * cos(N * this->m_proj_parm.two_r_n) / cos(N));
|
||||
xp = 2. * sin(M);
|
||||
yp = 2. * sin(N) * cos(M * this->m_proj_parm.two_r_m) / cos(M);
|
||||
cAz = cos(Az = aatan2(xp, yp) - this->m_proj_parm.theta);
|
||||
z = 2. * aasin(0.5 * boost::math::hypot(xp, yp));
|
||||
sz = sin(z);
|
||||
cz = cos(z);
|
||||
lp_lat = aasin(this->m_proj_parm.sp0 * cz + this->m_proj_parm.cp0 * sz * cAz);
|
||||
lp_lon = aatan2(sz * sin(Az),
|
||||
this->m_proj_parm.cp0 * cz - this->m_proj_parm.sp0 * sz * cAz);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "oea_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Oblated Equal Area
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_oea(Params const& params, Parameters& par, par_oea<T>& proj_parm)
|
||||
{
|
||||
if (((proj_parm.n = pj_get_param_f<T, srs::spar::n>(params, "n", srs::dpar::n)) <= 0.) ||
|
||||
((proj_parm.m = pj_get_param_f<T, srs::spar::m>(params, "m", srs::dpar::m)) <= 0.)) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_invalid_m_or_n) );
|
||||
} else {
|
||||
proj_parm.theta = pj_get_param_r<T, srs::spar::theta>(params, "theta", srs::dpar::theta);
|
||||
proj_parm.sp0 = sin(par.phi0);
|
||||
proj_parm.cp0 = cos(par.phi0);
|
||||
proj_parm.rn = 1./ proj_parm.n;
|
||||
proj_parm.rm = 1./ proj_parm.m;
|
||||
proj_parm.two_r_n = 2. * proj_parm.rn;
|
||||
proj_parm.two_r_m = 2. * proj_parm.rm;
|
||||
proj_parm.hm = 0.5 * proj_parm.m;
|
||||
proj_parm.hn = 0.5 * proj_parm.n;
|
||||
par.es = 0.;
|
||||
}
|
||||
}
|
||||
|
||||
}} // namespace detail::oea
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Oblated Equal Area projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
\par Projection parameters
|
||||
- n (real)
|
||||
- m (real)
|
||||
- theta: Theta (degrees)
|
||||
\par Example
|
||||
\image html ex_oea.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct oea_spheroid : public detail::oea::base_oea_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline oea_spheroid(Params const& params, Parameters const& par)
|
||||
: detail::oea::base_oea_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::oea::setup_oea(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_oea, oea_spheroid, oea_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(oea_entry, oea_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(oea_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(oea, oea_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_OEA_HPP
|
||||
|
||||
334
linx64/include/boost/geometry/srs/projections/proj/omerc.hpp
Normal file
334
linx64/include/boost/geometry/srs/projections/proj/omerc.hpp
Normal file
@@ -0,0 +1,334 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Copyright (c) 2003, 2006 Gerald I. Evenden
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_OMERC_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_OMERC_HPP
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_phi2.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_tsfn.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace omerc
|
||||
{
|
||||
template <typename T>
|
||||
struct par_omerc
|
||||
{
|
||||
T A, B, E, AB, ArB, BrA, rB, singam, cosgam, sinrot, cosrot;
|
||||
T v_pole_n, v_pole_s, u_0;
|
||||
int no_rot;
|
||||
};
|
||||
|
||||
static const double tolerance = 1.e-7;
|
||||
static const double epsilon = 1.e-10;
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_omerc_ellipsoid
|
||||
: public base_t_fi<base_omerc_ellipsoid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_omerc<T> m_proj_parm;
|
||||
|
||||
inline base_omerc_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_omerc_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_forward) ellipsoid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T s, t, U, V, W, temp, u, v;
|
||||
|
||||
if (fabs(fabs(lp_lat) - half_pi) > epsilon) {
|
||||
W = this->m_proj_parm.E / math::pow(pj_tsfn(lp_lat, sin(lp_lat), this->m_par.e), this->m_proj_parm.B);
|
||||
temp = 1. / W;
|
||||
s = .5 * (W - temp);
|
||||
t = .5 * (W + temp);
|
||||
V = sin(this->m_proj_parm.B * lp_lon);
|
||||
U = (s * this->m_proj_parm.singam - V * this->m_proj_parm.cosgam) / t;
|
||||
if (fabs(fabs(U) - 1.0) < epsilon) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
v = 0.5 * this->m_proj_parm.ArB * log((1. - U)/(1. + U));
|
||||
temp = cos(this->m_proj_parm.B * lp_lon);
|
||||
if(fabs(temp) < tolerance) {
|
||||
u = this->m_proj_parm.A * lp_lon;
|
||||
} else {
|
||||
u = this->m_proj_parm.ArB * atan2((s * this->m_proj_parm.cosgam + V * this->m_proj_parm.singam), temp);
|
||||
}
|
||||
} else {
|
||||
v = lp_lat > 0 ? this->m_proj_parm.v_pole_n : this->m_proj_parm.v_pole_s;
|
||||
u = this->m_proj_parm.ArB * lp_lat;
|
||||
}
|
||||
if (this->m_proj_parm.no_rot) {
|
||||
xy_x = u;
|
||||
xy_y = v;
|
||||
} else {
|
||||
u -= this->m_proj_parm.u_0;
|
||||
xy_x = v * this->m_proj_parm.cosrot + u * this->m_proj_parm.sinrot;
|
||||
xy_y = u * this->m_proj_parm.cosrot - v * this->m_proj_parm.sinrot;
|
||||
}
|
||||
}
|
||||
|
||||
// INVERSE(e_inverse) ellipsoid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T u, v, Qp, Sp, Tp, Vp, Up;
|
||||
|
||||
if (this->m_proj_parm.no_rot) {
|
||||
v = xy_y;
|
||||
u = xy_x;
|
||||
} else {
|
||||
v = xy_x * this->m_proj_parm.cosrot - xy_y * this->m_proj_parm.sinrot;
|
||||
u = xy_y * this->m_proj_parm.cosrot + xy_x * this->m_proj_parm.sinrot + this->m_proj_parm.u_0;
|
||||
}
|
||||
Qp = exp(- this->m_proj_parm.BrA * v);
|
||||
Sp = .5 * (Qp - 1. / Qp);
|
||||
Tp = .5 * (Qp + 1. / Qp);
|
||||
Vp = sin(this->m_proj_parm.BrA * u);
|
||||
Up = (Vp * this->m_proj_parm.cosgam + Sp * this->m_proj_parm.singam) / Tp;
|
||||
if (fabs(fabs(Up) - 1.) < epsilon) {
|
||||
lp_lon = 0.;
|
||||
lp_lat = Up < 0. ? -half_pi : half_pi;
|
||||
} else {
|
||||
lp_lat = this->m_proj_parm.E / sqrt((1. + Up) / (1. - Up));
|
||||
if ((lp_lat = pj_phi2(math::pow(lp_lat, T(1) / this->m_proj_parm.B), this->m_par.e)) == HUGE_VAL) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
lp_lon = - this->m_proj_parm.rB * atan2((Sp * this->m_proj_parm.cosgam -
|
||||
Vp * this->m_proj_parm.singam), cos(this->m_proj_parm.BrA * u));
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "omerc_ellipsoid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Oblique Mercator
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_omerc(Params const& params, Parameters& par, par_omerc<T>& proj_parm)
|
||||
{
|
||||
static const T fourth_pi = detail::fourth_pi<T>();
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
static const T pi = detail::pi<T>();
|
||||
static const T two_pi = detail::two_pi<T>();
|
||||
|
||||
T con, com, cosph0, D, F, H, L, sinph0, p, J, gamma=0,
|
||||
gamma0, lamc=0, lam1=0, lam2=0, phi1=0, phi2=0, alpha_c=0;
|
||||
int alp, gam, no_off = 0;
|
||||
|
||||
proj_parm.no_rot = pj_get_param_b<srs::spar::no_rot>(params, "no_rot", srs::dpar::no_rot);
|
||||
alp = pj_param_r<srs::spar::alpha>(params, "alpha", srs::dpar::alpha, alpha_c);
|
||||
gam = pj_param_r<srs::spar::gamma>(params, "gamma", srs::dpar::gamma, gamma);
|
||||
if (alp || gam) {
|
||||
lamc = pj_get_param_r<T, srs::spar::lonc>(params, "lonc", srs::dpar::lonc);
|
||||
// NOTE: This is not needed in Boost.Geometry
|
||||
//no_off =
|
||||
// /* For libproj4 compatability */
|
||||
// pj_param_exists(par.params, "no_off")
|
||||
// /* for backward compatibility */
|
||||
// || pj_param_exists(par.params, "no_uoff");
|
||||
//if( no_off )
|
||||
//{
|
||||
// /* Mark the parameter as used, so that the pj_get_def() return them */
|
||||
// pj_get_param_s(par.params, "no_uoff");
|
||||
// pj_get_param_s(par.params, "no_off");
|
||||
//}
|
||||
} else {
|
||||
lam1 = pj_get_param_r<T, srs::spar::lon_1>(params, "lon_1", srs::dpar::lon_1);
|
||||
phi1 = pj_get_param_r<T, srs::spar::lat_1>(params, "lat_1", srs::dpar::lat_1);
|
||||
lam2 = pj_get_param_r<T, srs::spar::lon_2>(params, "lon_2", srs::dpar::lon_2);
|
||||
phi2 = pj_get_param_r<T, srs::spar::lat_2>(params, "lat_2", srs::dpar::lat_2);
|
||||
if (fabs(phi1 - phi2) <= tolerance ||
|
||||
(con = fabs(phi1)) <= tolerance ||
|
||||
fabs(con - half_pi) <= tolerance ||
|
||||
fabs(fabs(par.phi0) - half_pi) <= tolerance ||
|
||||
fabs(fabs(phi2) - half_pi) <= tolerance)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_lat_0_or_alpha_eq_90) );
|
||||
}
|
||||
com = sqrt(par.one_es);
|
||||
if (fabs(par.phi0) > epsilon) {
|
||||
sinph0 = sin(par.phi0);
|
||||
cosph0 = cos(par.phi0);
|
||||
con = 1. - par.es * sinph0 * sinph0;
|
||||
proj_parm.B = cosph0 * cosph0;
|
||||
proj_parm.B = sqrt(1. + par.es * proj_parm.B * proj_parm.B / par.one_es);
|
||||
proj_parm.A = proj_parm.B * par.k0 * com / con;
|
||||
D = proj_parm.B * com / (cosph0 * sqrt(con));
|
||||
if ((F = D * D - 1.) <= 0.)
|
||||
F = 0.;
|
||||
else {
|
||||
F = sqrt(F);
|
||||
if (par.phi0 < 0.)
|
||||
F = -F;
|
||||
}
|
||||
proj_parm.E = F += D;
|
||||
proj_parm.E *= math::pow(pj_tsfn(par.phi0, sinph0, par.e), proj_parm.B);
|
||||
} else {
|
||||
proj_parm.B = 1. / com;
|
||||
proj_parm.A = par.k0;
|
||||
proj_parm.E = D = F = 1.;
|
||||
}
|
||||
if (alp || gam) {
|
||||
if (alp) {
|
||||
gamma0 = aasin(sin(alpha_c) / D);
|
||||
if (!gam)
|
||||
gamma = alpha_c;
|
||||
} else
|
||||
alpha_c = aasin(D*sin(gamma0 = gamma));
|
||||
par.lam0 = lamc - aasin(.5 * (F - 1. / F) *
|
||||
tan(gamma0)) / proj_parm.B;
|
||||
} else {
|
||||
H = math::pow(pj_tsfn(phi1, sin(phi1), par.e), proj_parm.B);
|
||||
L = math::pow(pj_tsfn(phi2, sin(phi2), par.e), proj_parm.B);
|
||||
F = proj_parm.E / H;
|
||||
p = (L - H) / (L + H);
|
||||
J = proj_parm.E * proj_parm.E;
|
||||
J = (J - L * H) / (J + L * H);
|
||||
if ((con = lam1 - lam2) < -pi)
|
||||
lam2 -= two_pi;
|
||||
else if (con > pi)
|
||||
lam2 += two_pi;
|
||||
par.lam0 = adjlon(.5 * (lam1 + lam2) - atan(
|
||||
J * tan(.5 * proj_parm.B * (lam1 - lam2)) / p) / proj_parm.B);
|
||||
gamma0 = atan(2. * sin(proj_parm.B * adjlon(lam1 - par.lam0)) /
|
||||
(F - 1. / F));
|
||||
gamma = alpha_c = aasin(D * sin(gamma0));
|
||||
}
|
||||
proj_parm.singam = sin(gamma0);
|
||||
proj_parm.cosgam = cos(gamma0);
|
||||
proj_parm.sinrot = sin(gamma);
|
||||
proj_parm.cosrot = cos(gamma);
|
||||
proj_parm.BrA = 1. / (proj_parm.ArB = proj_parm.A * (proj_parm.rB = 1. / proj_parm.B));
|
||||
proj_parm.AB = proj_parm.A * proj_parm.B;
|
||||
if (no_off)
|
||||
proj_parm.u_0 = 0;
|
||||
else {
|
||||
proj_parm.u_0 = fabs(proj_parm.ArB * atan(sqrt(D * D - 1.) / cos(alpha_c)));
|
||||
if (par.phi0 < 0.)
|
||||
proj_parm.u_0 = - proj_parm.u_0;
|
||||
}
|
||||
F = 0.5 * gamma0;
|
||||
proj_parm.v_pole_n = proj_parm.ArB * log(tan(fourth_pi - F));
|
||||
proj_parm.v_pole_s = proj_parm.ArB * log(tan(fourth_pi + F));
|
||||
}
|
||||
|
||||
}} // namespace detail::omerc
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Oblique Mercator projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Projection parameters
|
||||
- no_rot: No rotation
|
||||
- alpha: Alpha (degrees)
|
||||
- gamma: Gamma (degrees)
|
||||
- no_off: Only for compatibility with libproj, proj4 (string)
|
||||
- lonc: Longitude (only used if alpha (or gamma) is specified) (degrees)
|
||||
- lon_1 (degrees)
|
||||
- lat_1: Latitude of first standard parallel (degrees)
|
||||
- lon_2 (degrees)
|
||||
- lat_2: Latitude of second standard parallel (degrees)
|
||||
- no_uoff (string)
|
||||
\par Example
|
||||
\image html ex_omerc.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct omerc_ellipsoid : public detail::omerc::base_omerc_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline omerc_ellipsoid(Params const& params, Parameters const& par)
|
||||
: detail::omerc::base_omerc_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::omerc::setup_omerc(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_omerc, omerc_ellipsoid, omerc_ellipsoid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(omerc_entry, omerc_ellipsoid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(omerc_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(omerc, omerc_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_OMERC_HPP
|
||||
|
||||
246
linx64/include/boost/geometry/srs/projections/proj/ortho.hpp
Normal file
246
linx64/include/boost/geometry/srs/projections/proj/ortho.hpp
Normal file
@@ -0,0 +1,246 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_ORTHO_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_ORTHO_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
#include <boost/math/special_functions/hypot.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace ortho
|
||||
{
|
||||
|
||||
enum mode_type {
|
||||
n_pole = 0,
|
||||
s_pole = 1,
|
||||
equit = 2,
|
||||
obliq = 3
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct par_ortho
|
||||
{
|
||||
T sinph0;
|
||||
T cosph0;
|
||||
mode_type mode;
|
||||
};
|
||||
|
||||
static const double epsilon10 = 1.e-10;
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_ortho_spheroid
|
||||
: public base_t_fi<base_ortho_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_ortho<T> m_proj_parm;
|
||||
|
||||
inline base_ortho_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_ortho_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T coslam, cosphi, sinphi;
|
||||
|
||||
cosphi = cos(lp_lat);
|
||||
coslam = cos(lp_lon);
|
||||
switch (this->m_proj_parm.mode) {
|
||||
case equit:
|
||||
if (cosphi * coslam < - epsilon10) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
xy_y = sin(lp_lat);
|
||||
break;
|
||||
case obliq:
|
||||
if (this->m_proj_parm.sinph0 * (sinphi = sin(lp_lat)) +
|
||||
this->m_proj_parm.cosph0 * cosphi * coslam < - epsilon10) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
xy_y = this->m_proj_parm.cosph0 * sinphi - this->m_proj_parm.sinph0 * cosphi * coslam;
|
||||
break;
|
||||
case n_pole:
|
||||
coslam = - coslam;
|
||||
BOOST_FALLTHROUGH;
|
||||
case s_pole:
|
||||
if (fabs(lp_lat - this->m_par.phi0) - epsilon10 > half_pi) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
xy_y = cosphi * coslam;
|
||||
break;
|
||||
}
|
||||
xy_x = cosphi * sin(lp_lon);
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T rh, cosc, sinc;
|
||||
|
||||
if ((sinc = (rh = boost::math::hypot(xy_x, xy_y))) > 1.) {
|
||||
if ((sinc - 1.) > epsilon10) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
sinc = 1.;
|
||||
}
|
||||
cosc = sqrt(1. - sinc * sinc); /* in this range OK */
|
||||
if (fabs(rh) <= epsilon10) {
|
||||
lp_lat = this->m_par.phi0;
|
||||
lp_lon = 0.0;
|
||||
} else {
|
||||
switch (this->m_proj_parm.mode) {
|
||||
case n_pole:
|
||||
xy_y = -xy_y;
|
||||
lp_lat = acos(sinc);
|
||||
break;
|
||||
case s_pole:
|
||||
lp_lat = - acos(sinc);
|
||||
break;
|
||||
case equit:
|
||||
lp_lat = xy_y * sinc / rh;
|
||||
xy_x *= sinc;
|
||||
xy_y = cosc * rh;
|
||||
goto sinchk;
|
||||
case obliq:
|
||||
lp_lat = cosc * this->m_proj_parm.sinph0 + xy_y * sinc * this->m_proj_parm.cosph0 /rh;
|
||||
xy_y = (cosc - this->m_proj_parm.sinph0 * lp_lat) * rh;
|
||||
xy_x *= sinc * this->m_proj_parm.cosph0;
|
||||
sinchk:
|
||||
if (fabs(lp_lat) >= 1.)
|
||||
lp_lat = lp_lat < 0. ? -half_pi : half_pi;
|
||||
else
|
||||
lp_lat = asin(lp_lat);
|
||||
break;
|
||||
}
|
||||
lp_lon = (xy_y == 0. && (this->m_proj_parm.mode == obliq || this->m_proj_parm.mode == equit))
|
||||
? (xy_x == 0. ? 0. : xy_x < 0. ? -half_pi : half_pi)
|
||||
: atan2(xy_x, xy_y);
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "ortho_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Orthographic
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_ortho(Parameters& par, par_ortho<T>& proj_parm)
|
||||
{
|
||||
if (fabs(fabs(par.phi0) - geometry::math::half_pi<T>()) <= epsilon10)
|
||||
proj_parm.mode = par.phi0 < 0. ? s_pole : n_pole;
|
||||
else if (fabs(par.phi0) > epsilon10) {
|
||||
proj_parm.mode = obliq;
|
||||
proj_parm.sinph0 = sin(par.phi0);
|
||||
proj_parm.cosph0 = cos(par.phi0);
|
||||
} else
|
||||
proj_parm.mode = equit;
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::ortho
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Orthographic projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Azimuthal
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_ortho.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct ortho_spheroid : public detail::ortho::base_ortho_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline ortho_spheroid(Params const& , Parameters const& par)
|
||||
: detail::ortho::base_ortho_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::ortho::setup_ortho(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_ortho, ortho_spheroid, ortho_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(ortho_entry, ortho_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(ortho_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(ortho, ortho_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_ORTHO_HPP
|
||||
|
||||
292
linx64/include/boost/geometry/srs/projections/proj/poly.hpp
Normal file
292
linx64/include/boost/geometry/srs/projections/proj/poly.hpp
Normal file
@@ -0,0 +1,292 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_POLY_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_POLY_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_mlfn.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_msfn.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace poly
|
||||
{
|
||||
|
||||
static const double tolerance = 1e-10;
|
||||
static const double conv_tolerance = 1e-10;
|
||||
static const int n_iter = 10;
|
||||
static const int i_iter = 20;
|
||||
static const double i_tolerance = 1.e-12;
|
||||
|
||||
template <typename T>
|
||||
struct par_poly
|
||||
{
|
||||
T ml0;
|
||||
detail::en<T> en;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_poly_ellipsoid
|
||||
: public base_t_fi<base_poly_ellipsoid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_poly<T> m_proj_parm;
|
||||
|
||||
inline base_poly_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_poly_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_forward) ellipsoid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T ms, sp, cp;
|
||||
|
||||
if (fabs(lp_lat) <= tolerance) {
|
||||
xy_x = lp_lon;
|
||||
xy_y = -this->m_proj_parm.ml0;
|
||||
} else {
|
||||
sp = sin(lp_lat);
|
||||
ms = fabs(cp = cos(lp_lat)) > tolerance ? pj_msfn(sp, cp, this->m_par.es) / sp : 0.;
|
||||
xy_x = ms * sin(lp_lon *= sp);
|
||||
xy_y = (pj_mlfn(lp_lat, sp, cp, this->m_proj_parm.en) - this->m_proj_parm.ml0) + ms * (1. - cos(lp_lon));
|
||||
}
|
||||
}
|
||||
|
||||
// INVERSE(e_inverse) ellipsoid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
xy_y += this->m_proj_parm.ml0;
|
||||
if (fabs(xy_y) <= tolerance) {
|
||||
lp_lon = xy_x;
|
||||
lp_lat = 0.;
|
||||
} else {
|
||||
T r, c, sp, cp, s2ph, ml, mlb, mlp, dPhi;
|
||||
int i;
|
||||
|
||||
r = xy_y * xy_y + xy_x * xy_x;
|
||||
for (lp_lat = xy_y, i = i_iter; i ; --i) {
|
||||
sp = sin(lp_lat);
|
||||
s2ph = sp * ( cp = cos(lp_lat));
|
||||
if (fabs(cp) < i_tolerance) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
c = sp * (mlp = sqrt(1. - this->m_par.es * sp * sp)) / cp;
|
||||
ml = pj_mlfn(lp_lat, sp, cp, this->m_proj_parm.en);
|
||||
mlb = ml * ml + r;
|
||||
mlp = this->m_par.one_es / (mlp * mlp * mlp);
|
||||
lp_lat += ( dPhi =
|
||||
( ml + ml + c * mlb - 2. * xy_y * (c * ml + 1.) ) / (
|
||||
this->m_par.es * s2ph * (mlb - 2. * xy_y * ml) / c +
|
||||
2.* (xy_y - ml) * (c * mlp - 1. / s2ph) - mlp - mlp ));
|
||||
if (fabs(dPhi) <= i_tolerance)
|
||||
break;
|
||||
}
|
||||
if (!i) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
c = sin(lp_lat);
|
||||
lp_lon = asin(xy_x * tan(lp_lat) * sqrt(1. - this->m_par.es * c * c)) / sin(lp_lat);
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "poly_ellipsoid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_poly_spheroid
|
||||
: public base_t_fi<base_poly_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_poly<T> m_proj_parm;
|
||||
|
||||
inline base_poly_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_poly_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T cot, E;
|
||||
|
||||
if (fabs(lp_lat) <= tolerance) {
|
||||
xy_x = lp_lon;
|
||||
xy_y = this->m_proj_parm.ml0;
|
||||
} else {
|
||||
cot = 1. / tan(lp_lat);
|
||||
xy_x = sin(E = lp_lon * sin(lp_lat)) * cot;
|
||||
xy_y = lp_lat - this->m_par.phi0 + cot * (1. - cos(E));
|
||||
}
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
T B, dphi, tp;
|
||||
int i;
|
||||
|
||||
if (fabs(xy_y = this->m_par.phi0 + xy_y) <= tolerance) {
|
||||
lp_lon = xy_x;
|
||||
lp_lat = 0.;
|
||||
} else {
|
||||
lp_lat = xy_y;
|
||||
B = xy_x * xy_x + xy_y * xy_y;
|
||||
i = n_iter;
|
||||
do {
|
||||
tp = tan(lp_lat);
|
||||
lp_lat -= (dphi = (xy_y * (lp_lat * tp + 1.) - lp_lat -
|
||||
.5 * ( lp_lat * lp_lat + B) * tp) /
|
||||
((lp_lat - xy_y) / tp - 1.));
|
||||
} while (fabs(dphi) > conv_tolerance && --i);
|
||||
if (! i) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
lp_lon = asin(xy_x * tan(lp_lat)) / sin(lp_lat);
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "poly_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Polyconic (American)
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_poly(Parameters& par, par_poly<T>& proj_parm)
|
||||
{
|
||||
if (par.es != 0.0) {
|
||||
proj_parm.en = pj_enfn<T>(par.es);
|
||||
proj_parm.ml0 = pj_mlfn(par.phi0, sin(par.phi0), cos(par.phi0), proj_parm.en);
|
||||
} else {
|
||||
proj_parm.ml0 = -par.phi0;
|
||||
}
|
||||
}
|
||||
|
||||
}} // namespace detail::poly
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Polyconic (American) projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Conic
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Example
|
||||
\image html ex_poly.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct poly_ellipsoid : public detail::poly::base_poly_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline poly_ellipsoid(Params const& , Parameters const& par)
|
||||
: detail::poly::base_poly_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::poly::setup_poly(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Polyconic (American) projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Conic
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Example
|
||||
\image html ex_poly.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct poly_spheroid : public detail::poly::base_poly_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline poly_spheroid(Params const& , Parameters const& par)
|
||||
: detail::poly::base_poly_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::poly::setup_poly(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_poly, poly_spheroid, poly_ellipsoid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(poly_entry, poly_spheroid, poly_ellipsoid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(poly_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(poly, poly_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_POLY_HPP
|
||||
|
||||
175
linx64/include/boost/geometry/srs/projections/proj/putp2.hpp
Normal file
175
linx64/include/boost/geometry/srs/projections/proj/putp2.hpp
Normal file
@@ -0,0 +1,175 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_PUTP2_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_PUTP2_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/aasincos.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace putp2
|
||||
{
|
||||
|
||||
static const double C_x = 1.89490;
|
||||
static const double C_y = 1.71848;
|
||||
static const double C_p = 0.6141848493043784;
|
||||
static const double epsilon = 1e-10;
|
||||
static const int n_iter = 10;
|
||||
//static const double third_pi = 1.0471975511965977;
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_putp2_spheroid
|
||||
: public base_t_fi<base_putp2_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
|
||||
inline base_putp2_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_putp2_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T third_pi = detail::third_pi<T>();
|
||||
|
||||
T p, c, s, V;
|
||||
int i;
|
||||
|
||||
p = C_p * sin(lp_lat);
|
||||
s = lp_lat * lp_lat;
|
||||
lp_lat *= 0.615709 + s * ( 0.00909953 + s * 0.0046292 );
|
||||
for (i = n_iter; i ; --i) {
|
||||
c = cos(lp_lat);
|
||||
s = sin(lp_lat);
|
||||
lp_lat -= V = (lp_lat + s * (c - 1.) - p) /
|
||||
(1. + c * (c - 1.) - s * s);
|
||||
if (fabs(V) < epsilon)
|
||||
break;
|
||||
}
|
||||
if (!i)
|
||||
lp_lat = lp_lat < 0 ? - third_pi : third_pi;
|
||||
xy_x = C_x * lp_lon * (cos(lp_lat) - 0.5);
|
||||
xy_y = C_y * sin(lp_lat);
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
T c;
|
||||
|
||||
lp_lat = aasin(xy_y / C_y);
|
||||
lp_lon = xy_x / (C_x * ((c = cos(lp_lat)) - 0.5));
|
||||
lp_lat = aasin((lp_lat + sin(lp_lat) * (c - 1.)) / C_p);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "putp2_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Putnins P2
|
||||
template <typename Parameters>
|
||||
inline void setup_putp2(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::putp2
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Putnins P2 projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_putp2.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct putp2_spheroid : public detail::putp2::base_putp2_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline putp2_spheroid(Params const& , Parameters const& par)
|
||||
: detail::putp2::base_putp2_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::putp2::setup_putp2(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_putp2, putp2_spheroid, putp2_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(putp2_entry, putp2_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(putp2_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(putp2, putp2_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_PUTP2_HPP
|
||||
|
||||
194
linx64/include/boost/geometry/srs/projections/proj/putp3.hpp
Normal file
194
linx64/include/boost/geometry/srs/projections/proj/putp3.hpp
Normal file
@@ -0,0 +1,194 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_PUTP3_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_PUTP3_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace putp3
|
||||
{
|
||||
|
||||
static const double C = 0.79788456;
|
||||
static const double RPISQ = 0.1013211836;
|
||||
|
||||
template <typename T>
|
||||
struct par_putp3
|
||||
{
|
||||
T A;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_putp3_spheroid
|
||||
: public base_t_fi<base_putp3_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_putp3<T> m_proj_parm;
|
||||
|
||||
inline base_putp3_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_putp3_spheroid<T, Parameters>,
|
||||
T, Parameters>(*this, par) {}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
xy_x = C * lp_lon * (1. - this->m_proj_parm.A * lp_lat * lp_lat);
|
||||
xy_y = C * lp_lat;
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
lp_lat = xy_y / C;
|
||||
lp_lon = xy_x / (C * (1. - this->m_proj_parm.A * lp_lat * lp_lat));
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "putp3_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
// Putnins P3
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_putp3(Parameters& par, par_putp3<T>& proj_parm)
|
||||
{
|
||||
proj_parm.A = 4. * RPISQ;
|
||||
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
// Putnins P3'
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_putp3p(Parameters& par, par_putp3<T>& proj_parm)
|
||||
{
|
||||
proj_parm.A = 2. * RPISQ;
|
||||
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::putp3
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Putnins P3 projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_putp3.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct putp3_spheroid : public detail::putp3::base_putp3_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline putp3_spheroid(Params const& , Parameters const& par)
|
||||
: detail::putp3::base_putp3_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::putp3::setup_putp3(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Putnins P3' projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_putp3p.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct putp3p_spheroid : public detail::putp3::base_putp3_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline putp3p_spheroid(Params const& , Parameters const& par)
|
||||
: detail::putp3::base_putp3_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::putp3::setup_putp3p(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_putp3, putp3_spheroid, putp3_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_putp3p, putp3p_spheroid, putp3p_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(putp3_entry, putp3_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(putp3p_entry, putp3p_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(putp3_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(putp3, putp3_entry)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(putp3p, putp3p_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_PUTP3_HPP
|
||||
|
||||
200
linx64/include/boost/geometry/srs/projections/proj/putp4p.hpp
Normal file
200
linx64/include/boost/geometry/srs/projections/proj/putp4p.hpp
Normal file
@@ -0,0 +1,200 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_PUTP4P_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_PUTP4P_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/aasincos.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace putp4p
|
||||
{
|
||||
template <typename T>
|
||||
struct par_putp4p
|
||||
{
|
||||
T C_x, C_y;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_putp4p_spheroid
|
||||
: public base_t_fi<base_putp4p_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_putp4p<T> m_proj_parm;
|
||||
|
||||
inline base_putp4p_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_putp4p_spheroid<T, Parameters>,
|
||||
T, Parameters>(*this, par) {}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static T const third = detail::third<T>();
|
||||
|
||||
lp_lat = aasin(0.883883476 * sin(lp_lat));
|
||||
xy_x = this->m_proj_parm.C_x * lp_lon * cos(lp_lat);
|
||||
xy_x /= cos(lp_lat *= third);
|
||||
xy_y = this->m_proj_parm.C_y * sin(lp_lat);
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
lp_lat = aasin(xy_y / this->m_proj_parm.C_y);
|
||||
lp_lon = xy_x * cos(lp_lat) / this->m_proj_parm.C_x;
|
||||
lp_lat *= 3.;
|
||||
lp_lon /= cos(lp_lat);
|
||||
lp_lat = aasin(1.13137085 * sin(lp_lat));
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "putp4p_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
// Putnins P4'
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_putp4p(Parameters& par, par_putp4p<T>& proj_parm)
|
||||
{
|
||||
proj_parm.C_x = 0.874038744;
|
||||
proj_parm.C_y = 3.883251825;
|
||||
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
// Werenskiold I
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_weren(Parameters& par, par_putp4p<T>& proj_parm)
|
||||
{
|
||||
proj_parm.C_x = 1.;
|
||||
proj_parm.C_y = 4.442882938;
|
||||
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::putp4p
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Putnins P4' projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_putp4p.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct putp4p_spheroid : public detail::putp4p::base_putp4p_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline putp4p_spheroid(Params const& , Parameters const& par)
|
||||
: detail::putp4p::base_putp4p_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::putp4p::setup_putp4p(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Werenskiold I projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_weren.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct weren_spheroid : public detail::putp4p::base_putp4p_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline weren_spheroid(Params const& , Parameters const& par)
|
||||
: detail::putp4p::base_putp4p_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::putp4p::setup_weren(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_putp4p, putp4p_spheroid, putp4p_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_weren, weren_spheroid, weren_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(putp4p_entry, putp4p_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(weren_entry, weren_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(putp4p_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(putp4p, putp4p_entry)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(weren, weren_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_PUTP4P_HPP
|
||||
|
||||
196
linx64/include/boost/geometry/srs/projections/proj/putp5.hpp
Normal file
196
linx64/include/boost/geometry/srs/projections/proj/putp5.hpp
Normal file
@@ -0,0 +1,196 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_PUTP5_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_PUTP5_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace putp5
|
||||
{
|
||||
|
||||
static const double C = 1.01346;
|
||||
static const double D = 1.2158542;
|
||||
|
||||
template <typename T>
|
||||
struct par_putp5
|
||||
{
|
||||
T A, B;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_putp5_spheroid
|
||||
: public base_t_fi<base_putp5_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_putp5<T> m_proj_parm;
|
||||
|
||||
inline base_putp5_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_putp5_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
xy_x = C * lp_lon * (this->m_proj_parm.A - this->m_proj_parm.B * sqrt(1. + D * lp_lat * lp_lat));
|
||||
xy_y = C * lp_lat;
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
lp_lat = xy_y / C;
|
||||
lp_lon = xy_x / (C * (this->m_proj_parm.A - this->m_proj_parm.B * sqrt(1. + D * lp_lat * lp_lat)));
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "putp5_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
// Putnins P5
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_putp5(Parameters& par, par_putp5<T>& proj_parm)
|
||||
{
|
||||
proj_parm.A = 2.;
|
||||
proj_parm.B = 1.;
|
||||
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
// Putnins P5'
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_putp5p(Parameters& par, par_putp5<T>& proj_parm)
|
||||
{
|
||||
proj_parm.A = 1.5;
|
||||
proj_parm.B = 0.5;
|
||||
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::putp5
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Putnins P5 projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_putp5.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct putp5_spheroid : public detail::putp5::base_putp5_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline putp5_spheroid(Params const& , Parameters const& par)
|
||||
: detail::putp5::base_putp5_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::putp5::setup_putp5(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Putnins P5' projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_putp5p.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct putp5p_spheroid : public detail::putp5::base_putp5_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline putp5p_spheroid(Params const& , Parameters const& par)
|
||||
: detail::putp5::base_putp5_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::putp5::setup_putp5p(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_putp5, putp5_spheroid, putp5_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_putp5p, putp5p_spheroid, putp5p_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(putp5_entry, putp5_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(putp5p_entry, putp5p_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(putp5_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(putp5, putp5_entry)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(putp5p, putp5p_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_PUTP5_HPP
|
||||
|
||||
222
linx64/include/boost/geometry/srs/projections/proj/putp6.hpp
Normal file
222
linx64/include/boost/geometry/srs/projections/proj/putp6.hpp
Normal file
@@ -0,0 +1,222 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_PUTP6_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_PUTP6_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/aasincos.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace putp6
|
||||
{
|
||||
|
||||
static const double epsilon = 1e-10;
|
||||
static const int n_iter = 10;
|
||||
static const double CON_POLE = 1.732050807568877;
|
||||
|
||||
template <typename T>
|
||||
struct par_putp6
|
||||
{
|
||||
T C_x, C_y, A, B, D;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_putp6_spheroid
|
||||
: public base_t_fi<base_putp6_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_putp6<T> m_proj_parm;
|
||||
|
||||
inline base_putp6_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_putp6_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T p, r, V;
|
||||
int i;
|
||||
|
||||
p = this->m_proj_parm.B * sin(lp_lat);
|
||||
lp_lat *= 1.10265779;
|
||||
for (i = n_iter; i ; --i) {
|
||||
r = sqrt(1. + lp_lat * lp_lat);
|
||||
lp_lat -= V = ( (this->m_proj_parm.A - r) * lp_lat - log(lp_lat + r) - p ) /
|
||||
(this->m_proj_parm.A - 2. * r);
|
||||
if (fabs(V) < epsilon)
|
||||
break;
|
||||
}
|
||||
if (!i)
|
||||
lp_lat = p < 0. ? -CON_POLE : CON_POLE;
|
||||
xy_x = this->m_proj_parm.C_x * lp_lon * (this->m_proj_parm.D - sqrt(1. + lp_lat * lp_lat));
|
||||
xy_y = this->m_proj_parm.C_y * lp_lat;
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
T r;
|
||||
|
||||
lp_lat = xy_y / this->m_proj_parm.C_y;
|
||||
r = sqrt(1. + lp_lat * lp_lat);
|
||||
lp_lon = xy_x / (this->m_proj_parm.C_x * (this->m_proj_parm.D - r));
|
||||
lp_lat = aasin(( (this->m_proj_parm.A - r) * lp_lat - log(lp_lat + r) ) / this->m_proj_parm.B);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "putp6_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
// Putnins P6
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_putp6(Parameters& par, par_putp6<T>& proj_parm)
|
||||
{
|
||||
proj_parm.C_x = 1.01346;
|
||||
proj_parm.C_y = 0.91910;
|
||||
proj_parm.A = 4.;
|
||||
proj_parm.B = 2.1471437182129378784;
|
||||
proj_parm.D = 2.;
|
||||
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
// Putnins P6'
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_putp6p(Parameters& par, par_putp6<T>& proj_parm)
|
||||
{
|
||||
proj_parm.C_x = 0.44329;
|
||||
proj_parm.C_y = 0.80404;
|
||||
proj_parm.A = 6.;
|
||||
proj_parm.B = 5.61125;
|
||||
proj_parm.D = 3.;
|
||||
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::putp6
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Putnins P6 projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_putp6.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct putp6_spheroid : public detail::putp6::base_putp6_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline putp6_spheroid(Params const& , Parameters const& par)
|
||||
: detail::putp6::base_putp6_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::putp6::setup_putp6(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Putnins P6' projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_putp6p.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct putp6p_spheroid : public detail::putp6::base_putp6_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline putp6p_spheroid(Params const& , Parameters const& par)
|
||||
: detail::putp6::base_putp6_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::putp6::setup_putp6p(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_putp6, putp6_spheroid, putp6_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_putp6p, putp6p_spheroid, putp6p_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(putp6_entry, putp6_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(putp6p_entry, putp6p_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(putp6_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(putp6, putp6_entry)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(putp6p, putp6p_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_PUTP6_HPP
|
||||
|
||||
537
linx64/include/boost/geometry/srs/projections/proj/qsc.hpp
Normal file
537
linx64/include/boost/geometry/srs/projections/proj/qsc.hpp
Normal file
@@ -0,0 +1,537 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// This implements the Quadrilateralized Spherical Cube (QSC) projection.
|
||||
// Copyright (c) 2011, 2012 Martin Lambers <marlam@marlam.de>
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// The QSC projection was introduced in:
|
||||
// [OL76]
|
||||
// E.M. O'Neill and R.E. Laubscher, "Extended Studies of a Quadrilateralized
|
||||
// Spherical Cube Earth Data Base", Naval Environmental Prediction Research
|
||||
// Facility Tech. Report NEPRF 3-76 (CSC), May 1976.
|
||||
|
||||
// The preceding shift from an ellipsoid to a sphere, which allows to apply
|
||||
// this projection to ellipsoids as used in the Ellipsoidal Cube Map model,
|
||||
// is described in
|
||||
// [LK12]
|
||||
// M. Lambers and A. Kolb, "Ellipsoidal Cube Maps for Accurate Rendering of
|
||||
// Planetary-Scale Terrain Data", Proc. Pacfic Graphics (Short Papers), Sep.
|
||||
// 2012
|
||||
|
||||
// You have to choose one of the following projection centers,
|
||||
// corresponding to the centers of the six cube faces:
|
||||
// phi0 = 0.0, lam0 = 0.0 ("front" face)
|
||||
// phi0 = 0.0, lam0 = 90.0 ("right" face)
|
||||
// phi0 = 0.0, lam0 = 180.0 ("back" face)
|
||||
// phi0 = 0.0, lam0 = -90.0 ("left" face)
|
||||
// phi0 = 90.0 ("top" face)
|
||||
// phi0 = -90.0 ("bottom" face)
|
||||
// Other projection centers will not work!
|
||||
|
||||
// In the projection code below, each cube face is handled differently.
|
||||
// See the computation of the face parameter in the ENTRY0(qsc) function
|
||||
// and the handling of different face values (FACE_*) in the forward and
|
||||
// inverse projections.
|
||||
|
||||
// Furthermore, the projection is originally only defined for theta angles
|
||||
// between (-1/4 * PI) and (+1/4 * PI) on the current cube face. This area
|
||||
// of definition is named AREA_0 in the projection code below. The other
|
||||
// three areas of a cube face are handled by rotation of AREA_0.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_QSC_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_QSC_HPP
|
||||
|
||||
#include <boost/core/ignore_unused.hpp>
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace qsc
|
||||
{
|
||||
|
||||
/* The six cube faces. */
|
||||
enum face_type {
|
||||
face_front = 0,
|
||||
face_right = 1,
|
||||
face_back = 2,
|
||||
face_left = 3,
|
||||
face_top = 4,
|
||||
face_bottom = 5
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct par_qsc
|
||||
{
|
||||
face_type face;
|
||||
T a_squared;
|
||||
T b;
|
||||
T one_minus_f;
|
||||
T one_minus_f_squared;
|
||||
};
|
||||
|
||||
static const double epsilon10 = 1.e-10;
|
||||
|
||||
/* The four areas on a cube face. AREA_0 is the area of definition,
|
||||
* the other three areas are counted counterclockwise. */
|
||||
enum area_type {
|
||||
area_0 = 0,
|
||||
area_1 = 1,
|
||||
area_2 = 2,
|
||||
area_3 = 3
|
||||
};
|
||||
|
||||
/* Helper function for forward projection: compute the theta angle
|
||||
* and determine the area number. */
|
||||
template <typename T>
|
||||
inline T qsc_fwd_equat_face_theta(T const& phi, T const& y, T const& x, area_type *area)
|
||||
{
|
||||
static const T fourth_pi = detail::fourth_pi<T>();
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
static const T pi = detail::pi<T>();
|
||||
|
||||
T theta;
|
||||
if (phi < epsilon10) {
|
||||
*area = area_0;
|
||||
theta = 0.0;
|
||||
} else {
|
||||
theta = atan2(y, x);
|
||||
if (fabs(theta) <= fourth_pi) {
|
||||
*area = area_0;
|
||||
} else if (theta > fourth_pi && theta <= half_pi + fourth_pi) {
|
||||
*area = area_1;
|
||||
theta -= half_pi;
|
||||
} else if (theta > half_pi + fourth_pi || theta <= -(half_pi + fourth_pi)) {
|
||||
*area = area_2;
|
||||
theta = (theta >= 0.0 ? theta - pi : theta + pi);
|
||||
} else {
|
||||
*area = area_3;
|
||||
theta += half_pi;
|
||||
}
|
||||
}
|
||||
return theta;
|
||||
}
|
||||
|
||||
/* Helper function: shift the longitude. */
|
||||
template <typename T>
|
||||
inline T qsc_shift_lon_origin(T const& lon, T const& offset)
|
||||
{
|
||||
static const T pi = detail::pi<T>();
|
||||
static const T two_pi = detail::two_pi<T>();
|
||||
|
||||
T slon = lon + offset;
|
||||
if (slon < -pi) {
|
||||
slon += two_pi;
|
||||
} else if (slon > +pi) {
|
||||
slon -= two_pi;
|
||||
}
|
||||
return slon;
|
||||
}
|
||||
|
||||
/* Forward projection, ellipsoid */
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_qsc_ellipsoid
|
||||
: public base_t_fi<base_qsc_ellipsoid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_qsc<T> m_proj_parm;
|
||||
|
||||
inline base_qsc_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_qsc_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_forward)
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T fourth_pi = detail::fourth_pi<T>();
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
static const T pi = detail::pi<T>();
|
||||
|
||||
T lat, lon;
|
||||
T theta, phi;
|
||||
T t, mu; /* nu; */
|
||||
area_type area;
|
||||
|
||||
/* Convert the geodetic latitude to a geocentric latitude.
|
||||
* This corresponds to the shift from the ellipsoid to the sphere
|
||||
* described in [LK12]. */
|
||||
if (this->m_par.es != 0.0) {
|
||||
lat = atan(this->m_proj_parm.one_minus_f_squared * tan(lp_lat));
|
||||
} else {
|
||||
lat = lp_lat;
|
||||
}
|
||||
|
||||
/* Convert the input lat, lon into theta, phi as used by QSC.
|
||||
* This depends on the cube face and the area on it.
|
||||
* For the top and bottom face, we can compute theta and phi
|
||||
* directly from phi, lam. For the other faces, we must use
|
||||
* unit sphere cartesian coordinates as an intermediate step. */
|
||||
lon = lp_lon;
|
||||
if (this->m_proj_parm.face == face_top) {
|
||||
phi = half_pi - lat;
|
||||
if (lon >= fourth_pi && lon <= half_pi + fourth_pi) {
|
||||
area = area_0;
|
||||
theta = lon - half_pi;
|
||||
} else if (lon > half_pi + fourth_pi || lon <= -(half_pi + fourth_pi)) {
|
||||
area = area_1;
|
||||
theta = (lon > 0.0 ? lon - pi : lon + pi);
|
||||
} else if (lon > -(half_pi + fourth_pi) && lon <= -fourth_pi) {
|
||||
area = area_2;
|
||||
theta = lon + half_pi;
|
||||
} else {
|
||||
area = area_3;
|
||||
theta = lon;
|
||||
}
|
||||
} else if (this->m_proj_parm.face == face_bottom) {
|
||||
phi = half_pi + lat;
|
||||
if (lon >= fourth_pi && lon <= half_pi + fourth_pi) {
|
||||
area = area_0;
|
||||
theta = -lon + half_pi;
|
||||
} else if (lon < fourth_pi && lon >= -fourth_pi) {
|
||||
area = area_1;
|
||||
theta = -lon;
|
||||
} else if (lon < -fourth_pi && lon >= -(half_pi + fourth_pi)) {
|
||||
area = area_2;
|
||||
theta = -lon - half_pi;
|
||||
} else {
|
||||
area = area_3;
|
||||
theta = (lon > 0.0 ? -lon + pi : -lon - pi);
|
||||
}
|
||||
} else {
|
||||
T q, r, s;
|
||||
T sinlat, coslat;
|
||||
T sinlon, coslon;
|
||||
|
||||
if (this->m_proj_parm.face == face_right) {
|
||||
lon = qsc_shift_lon_origin(lon, +half_pi);
|
||||
} else if (this->m_proj_parm.face == face_back) {
|
||||
lon = qsc_shift_lon_origin(lon, +pi);
|
||||
} else if (this->m_proj_parm.face == face_left) {
|
||||
lon = qsc_shift_lon_origin(lon, -half_pi);
|
||||
}
|
||||
sinlat = sin(lat);
|
||||
coslat = cos(lat);
|
||||
sinlon = sin(lon);
|
||||
coslon = cos(lon);
|
||||
q = coslat * coslon;
|
||||
r = coslat * sinlon;
|
||||
s = sinlat;
|
||||
|
||||
if (this->m_proj_parm.face == face_front) {
|
||||
phi = acos(q);
|
||||
theta = qsc_fwd_equat_face_theta(phi, s, r, &area);
|
||||
} else if (this->m_proj_parm.face == face_right) {
|
||||
phi = acos(r);
|
||||
theta = qsc_fwd_equat_face_theta(phi, s, -q, &area);
|
||||
} else if (this->m_proj_parm.face == face_back) {
|
||||
phi = acos(-q);
|
||||
theta = qsc_fwd_equat_face_theta(phi, s, -r, &area);
|
||||
} else if (this->m_proj_parm.face == face_left) {
|
||||
phi = acos(-r);
|
||||
theta = qsc_fwd_equat_face_theta(phi, s, q, &area);
|
||||
} else {
|
||||
/* Impossible */
|
||||
phi = theta = 0.0;
|
||||
area = area_0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Compute mu and nu for the area of definition.
|
||||
* For mu, see Eq. (3-21) in [OL76], but note the typos:
|
||||
* compare with Eq. (3-14). For nu, see Eq. (3-38). */
|
||||
mu = atan((12.0 / pi) * (theta + acos(sin(theta) * cos(fourth_pi)) - half_pi));
|
||||
// TODO: (cos(mu) * cos(mu)) could be replaced with sqr(cos(mu))
|
||||
t = sqrt((1.0 - cos(phi)) / (cos(mu) * cos(mu)) / (1.0 - cos(atan(1.0 / cos(theta)))));
|
||||
/* nu = atan(t); We don't really need nu, just t, see below. */
|
||||
|
||||
/* Apply the result to the real area. */
|
||||
if (area == area_1) {
|
||||
mu += half_pi;
|
||||
} else if (area == area_2) {
|
||||
mu += pi;
|
||||
} else if (area == area_3) {
|
||||
mu += half_pi + pi;
|
||||
}
|
||||
|
||||
/* Now compute x, y from mu and nu */
|
||||
/* t = tan(nu); */
|
||||
xy_x = t * cos(mu);
|
||||
xy_y = t * sin(mu);
|
||||
}
|
||||
/* Inverse projection, ellipsoid */
|
||||
|
||||
// INVERSE(e_inverse)
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
static const T pi = detail::pi<T>();
|
||||
|
||||
T mu, nu, cosmu, tannu;
|
||||
T tantheta, theta, cosphi, phi;
|
||||
T t;
|
||||
int area;
|
||||
|
||||
/* Convert the input x, y to the mu and nu angles as used by QSC.
|
||||
* This depends on the area of the cube face. */
|
||||
nu = atan(sqrt(xy_x * xy_x + xy_y * xy_y));
|
||||
mu = atan2(xy_y, xy_x);
|
||||
if (xy_x >= 0.0 && xy_x >= fabs(xy_y)) {
|
||||
area = area_0;
|
||||
} else if (xy_y >= 0.0 && xy_y >= fabs(xy_x)) {
|
||||
area = area_1;
|
||||
mu -= half_pi;
|
||||
} else if (xy_x < 0.0 && -xy_x >= fabs(xy_y)) {
|
||||
area = area_2;
|
||||
mu = (mu < 0.0 ? mu + pi : mu - pi);
|
||||
} else {
|
||||
area = area_3;
|
||||
mu += half_pi;
|
||||
}
|
||||
|
||||
/* Compute phi and theta for the area of definition.
|
||||
* The inverse projection is not described in the original paper, but some
|
||||
* good hints can be found here (as of 2011-12-14):
|
||||
* http://fits.gsfc.nasa.gov/fitsbits/saf.93/saf.9302
|
||||
* (search for "Message-Id: <9302181759.AA25477 at fits.cv.nrao.edu>") */
|
||||
t = (pi / 12.0) * tan(mu);
|
||||
tantheta = sin(t) / (cos(t) - (1.0 / sqrt(2.0)));
|
||||
theta = atan(tantheta);
|
||||
cosmu = cos(mu);
|
||||
tannu = tan(nu);
|
||||
cosphi = 1.0 - cosmu * cosmu * tannu * tannu * (1.0 - cos(atan(1.0 / cos(theta))));
|
||||
if (cosphi < -1.0) {
|
||||
cosphi = -1.0;
|
||||
} else if (cosphi > +1.0) {
|
||||
cosphi = +1.0;
|
||||
}
|
||||
|
||||
/* Apply the result to the real area on the cube face.
|
||||
* For the top and bottom face, we can compute phi and lam directly.
|
||||
* For the other faces, we must use unit sphere cartesian coordinates
|
||||
* as an intermediate step. */
|
||||
if (this->m_proj_parm.face == face_top) {
|
||||
phi = acos(cosphi);
|
||||
lp_lat = half_pi - phi;
|
||||
if (area == area_0) {
|
||||
lp_lon = theta + half_pi;
|
||||
} else if (area == area_1) {
|
||||
lp_lon = (theta < 0.0 ? theta + pi : theta - pi);
|
||||
} else if (area == area_2) {
|
||||
lp_lon = theta - half_pi;
|
||||
} else /* area == AREA_3 */ {
|
||||
lp_lon = theta;
|
||||
}
|
||||
} else if (this->m_proj_parm.face == face_bottom) {
|
||||
phi = acos(cosphi);
|
||||
lp_lat = phi - half_pi;
|
||||
if (area == area_0) {
|
||||
lp_lon = -theta + half_pi;
|
||||
} else if (area == area_1) {
|
||||
lp_lon = -theta;
|
||||
} else if (area == area_2) {
|
||||
lp_lon = -theta - half_pi;
|
||||
} else /* area == area_3 */ {
|
||||
lp_lon = (theta < 0.0 ? -theta - pi : -theta + pi);
|
||||
}
|
||||
} else {
|
||||
/* Compute phi and lam via cartesian unit sphere coordinates. */
|
||||
T q, r, s;
|
||||
q = cosphi;
|
||||
t = q * q;
|
||||
if (t >= 1.0) {
|
||||
s = 0.0;
|
||||
} else {
|
||||
s = sqrt(1.0 - t) * sin(theta);
|
||||
}
|
||||
t += s * s;
|
||||
if (t >= 1.0) {
|
||||
r = 0.0;
|
||||
} else {
|
||||
r = sqrt(1.0 - t);
|
||||
}
|
||||
/* Rotate q,r,s into the correct area. */
|
||||
if (area == area_1) {
|
||||
t = r;
|
||||
r = -s;
|
||||
s = t;
|
||||
} else if (area == area_2) {
|
||||
r = -r;
|
||||
s = -s;
|
||||
} else if (area == area_3) {
|
||||
t = r;
|
||||
r = s;
|
||||
s = -t;
|
||||
}
|
||||
/* Rotate q,r,s into the correct cube face. */
|
||||
if (this->m_proj_parm.face == face_right) {
|
||||
t = q;
|
||||
q = -r;
|
||||
r = t;
|
||||
} else if (this->m_proj_parm.face == face_back) {
|
||||
q = -q;
|
||||
r = -r;
|
||||
} else if (this->m_proj_parm.face == face_left) {
|
||||
t = q;
|
||||
q = r;
|
||||
r = -t;
|
||||
}
|
||||
/* Now compute phi and lam from the unit sphere coordinates. */
|
||||
lp_lat = acos(-s) - half_pi;
|
||||
lp_lon = atan2(r, q);
|
||||
if (this->m_proj_parm.face == face_right) {
|
||||
lp_lon = qsc_shift_lon_origin(lp_lon, -half_pi);
|
||||
} else if (this->m_proj_parm.face == face_back) {
|
||||
lp_lon = qsc_shift_lon_origin(lp_lon, -pi);
|
||||
} else if (this->m_proj_parm.face == face_left) {
|
||||
lp_lon = qsc_shift_lon_origin(lp_lon, +half_pi);
|
||||
}
|
||||
}
|
||||
|
||||
/* Apply the shift from the sphere to the ellipsoid as described
|
||||
* in [LK12]. */
|
||||
if (this->m_par.es != 0.0) {
|
||||
int invert_sign;
|
||||
T tanphi, xa;
|
||||
invert_sign = (lp_lat < 0.0 ? 1 : 0);
|
||||
tanphi = tan(lp_lat);
|
||||
xa = this->m_proj_parm.b / sqrt(tanphi * tanphi + this->m_proj_parm.one_minus_f_squared);
|
||||
lp_lat = atan(sqrt(this->m_par.a * this->m_par.a - xa * xa) / (this->m_proj_parm.one_minus_f * xa));
|
||||
if (invert_sign) {
|
||||
lp_lat = -lp_lat;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "qsc_ellipsoid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Quadrilateralized Spherical Cube
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_qsc(Parameters& par, par_qsc<T>& proj_parm)
|
||||
{
|
||||
static const T fourth_pi = detail::fourth_pi<T>();
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
/* Determine the cube face from the center of projection. */
|
||||
if (par.phi0 >= half_pi - fourth_pi / 2.0) {
|
||||
proj_parm.face = face_top;
|
||||
} else if (par.phi0 <= -(half_pi - fourth_pi / 2.0)) {
|
||||
proj_parm.face = face_bottom;
|
||||
} else if (fabs(par.lam0) <= fourth_pi) {
|
||||
proj_parm.face = face_front;
|
||||
} else if (fabs(par.lam0) <= half_pi + fourth_pi) {
|
||||
proj_parm.face = (par.lam0 > 0.0 ? face_right : face_left);
|
||||
} else {
|
||||
proj_parm.face = face_back;
|
||||
}
|
||||
/* Fill in useful values for the ellipsoid <-> sphere shift
|
||||
* described in [LK12]. */
|
||||
if (par.es != 0.0) {
|
||||
proj_parm.a_squared = par.a * par.a;
|
||||
proj_parm.b = par.a * sqrt(1.0 - par.es);
|
||||
proj_parm.one_minus_f = 1.0 - (par.a - proj_parm.b) / par.a;
|
||||
proj_parm.one_minus_f_squared = proj_parm.one_minus_f * proj_parm.one_minus_f;
|
||||
}
|
||||
}
|
||||
|
||||
}} // namespace detail::qsc
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Quadrilateralized Spherical Cube projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Azimuthal
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_qsc.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct qsc_ellipsoid : public detail::qsc::base_qsc_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline qsc_ellipsoid(Params const& , Parameters const& par)
|
||||
: detail::qsc::base_qsc_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::qsc::setup_qsc(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_qsc, qsc_ellipsoid, qsc_ellipsoid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(qsc_entry, qsc_ellipsoid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(qsc_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(qsc, qsc_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_QSC_HPP
|
||||
|
||||
284
linx64/include/boost/geometry/srs/projections/proj/robin.hpp
Normal file
284
linx64/include/boost/geometry/srs/projections/proj/robin.hpp
Normal file
@@ -0,0 +1,284 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_ROBIN_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_ROBIN_HPP
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/function_overloads.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace robin
|
||||
{
|
||||
|
||||
static const double FXC = 0.8487;
|
||||
static const double FYC = 1.3523;
|
||||
static const double C1 = 11.45915590261646417544;
|
||||
static const double RC1 = 0.08726646259971647884;
|
||||
static const int n_nodes = 18;
|
||||
static const double one_plus_eps = 1.000001;
|
||||
static const double epsilon = 1e-8;
|
||||
/* Not sure at all of the appropriate number for max_iter... */
|
||||
static const int max_iter = 100;
|
||||
|
||||
/*
|
||||
note: following terms based upon 5 deg. intervals in degrees.
|
||||
|
||||
Some background on these coefficients is available at:
|
||||
|
||||
http://article.gmane.org/gmane.comp.gis.proj-4.devel/6039
|
||||
http://trac.osgeo.org/proj/ticket/113
|
||||
*/
|
||||
|
||||
template <typename T>
|
||||
struct coefs {
|
||||
T c0, c1, c2, c3;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
inline const coefs<T> * coefs_x()
|
||||
{
|
||||
static const coefs<T> result[] = {
|
||||
{1.0, 2.2199e-17, -7.15515e-05, 3.1103e-06},
|
||||
{0.9986, -0.000482243, -2.4897e-05, -1.3309e-06},
|
||||
{0.9954, -0.00083103, -4.48605e-05, -9.86701e-07},
|
||||
{0.99, -0.00135364, -5.9661e-05, 3.6777e-06},
|
||||
{0.9822, -0.00167442, -4.49547e-06, -5.72411e-06},
|
||||
{0.973, -0.00214868, -9.03571e-05, 1.8736e-08},
|
||||
{0.96, -0.00305085, -9.00761e-05, 1.64917e-06},
|
||||
{0.9427, -0.00382792, -6.53386e-05, -2.6154e-06},
|
||||
{0.9216, -0.00467746, -0.00010457, 4.81243e-06},
|
||||
{0.8962, -0.00536223, -3.23831e-05, -5.43432e-06},
|
||||
{0.8679, -0.00609363, -0.000113898, 3.32484e-06},
|
||||
{0.835, -0.00698325, -6.40253e-05, 9.34959e-07},
|
||||
{0.7986, -0.00755338, -5.00009e-05, 9.35324e-07},
|
||||
{0.7597, -0.00798324, -3.5971e-05, -2.27626e-06},
|
||||
{0.7186, -0.00851367, -7.01149e-05, -8.6303e-06},
|
||||
{0.6732, -0.00986209, -0.000199569, 1.91974e-05},
|
||||
{0.6213, -0.010418, 8.83923e-05, 6.24051e-06},
|
||||
{0.5722, -0.00906601, 0.000182, 6.24051e-06},
|
||||
{0.5322, -0.00677797, 0.000275608, 6.24051e-06}
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline const coefs<T> * coefs_y()
|
||||
{
|
||||
static const coefs<T> result[] = {
|
||||
{-5.20417e-18, 0.0124, 1.21431e-18, -8.45284e-11},
|
||||
{0.062, 0.0124, -1.26793e-09, 4.22642e-10},
|
||||
{0.124, 0.0124, 5.07171e-09, -1.60604e-09},
|
||||
{0.186, 0.0123999, -1.90189e-08, 6.00152e-09},
|
||||
{0.248, 0.0124002, 7.10039e-08, -2.24e-08},
|
||||
{0.31, 0.0123992, -2.64997e-07, 8.35986e-08},
|
||||
{0.372, 0.0124029, 9.88983e-07, -3.11994e-07},
|
||||
{0.434, 0.0123893, -3.69093e-06, -4.35621e-07},
|
||||
{0.4958, 0.0123198, -1.02252e-05, -3.45523e-07},
|
||||
{0.5571, 0.0121916, -1.54081e-05, -5.82288e-07},
|
||||
{0.6176, 0.0119938, -2.41424e-05, -5.25327e-07},
|
||||
{0.6769, 0.011713, -3.20223e-05, -5.16405e-07},
|
||||
{0.7346, 0.0113541, -3.97684e-05, -6.09052e-07},
|
||||
{0.7903, 0.0109107, -4.89042e-05, -1.04739e-06},
|
||||
{0.8435, 0.0103431, -6.4615e-05, -1.40374e-09},
|
||||
{0.8936, 0.00969686, -6.4636e-05, -8.547e-06},
|
||||
{0.9394, 0.00840947, -0.000192841, -4.2106e-06},
|
||||
{0.9761, 0.00616527, -0.000256, -4.2106e-06},
|
||||
{1.0, 0.00328947, -0.000319159, -4.2106e-06}
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_robin_spheroid
|
||||
: public base_t_fi<base_robin_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_robin_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_robin_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
inline T v(coefs<T> const& c, T const& z) const
|
||||
{ return (c.c0 + z * (c.c1 + z * (c.c2 + z * c.c3))); }
|
||||
inline T dv(coefs<T> const& c, T const& z) const
|
||||
{ return (c.c1 + z * (c.c2 + c.c2 + z * 3. * c.c3)); }
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
int i;
|
||||
T dphi;
|
||||
|
||||
i = int_floor((dphi = fabs(lp_lat)) * C1);
|
||||
if (i < 0) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
if (i >= n_nodes) i = n_nodes - 1;
|
||||
dphi = geometry::math::r2d<T>() * (dphi - RC1 * i);
|
||||
xy_x = v(coefs_x<T>()[i], dphi) * FXC * lp_lon;
|
||||
xy_y = v(coefs_y<T>()[i], dphi) * FYC;
|
||||
if (lp_lat < 0.) xy_y = -xy_y;
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
const coefs<T> * coefs_x = robin::coefs_x<T>();
|
||||
const coefs<T> * coefs_y = robin::coefs_y<T>();
|
||||
|
||||
int i;
|
||||
T t, t1;
|
||||
coefs<T> coefs_t;
|
||||
int iters;
|
||||
|
||||
lp_lon = xy_x / FXC;
|
||||
lp_lat = fabs(xy_y / FYC);
|
||||
if (lp_lat >= 1.) { /* simple pathologic cases */
|
||||
if (lp_lat > one_plus_eps) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
} else {
|
||||
lp_lat = xy_y < 0. ? -half_pi : half_pi;
|
||||
lp_lon /= coefs_x[n_nodes].c0;
|
||||
}
|
||||
} else { /* general problem */
|
||||
/* in Y space, reduce to table interval */
|
||||
i = int_floor(lp_lat * n_nodes);
|
||||
if( i < 0 || i >= n_nodes ) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
for (;;) {
|
||||
if (coefs_y[i].c0 > lp_lat) --i;
|
||||
else if (coefs_y[i+1].c0 <= lp_lat) ++i;
|
||||
else break;
|
||||
}
|
||||
coefs_t = coefs_y[i];
|
||||
/* first guess, linear interp */
|
||||
t = 5. * (lp_lat - coefs_t.c0)/(coefs_y[i+1].c0 - coefs_t.c0);
|
||||
/* make into root */
|
||||
coefs_t.c0 = (T)(coefs_t.c0 - lp_lat);
|
||||
for (iters = max_iter; iters ; --iters) { /* Newton-Raphson */
|
||||
t -= t1 = v(coefs_t,t) / dv(coefs_t,t);
|
||||
if (fabs(t1) < epsilon)
|
||||
break;
|
||||
}
|
||||
if( iters == 0 )
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_non_convergent) );
|
||||
lp_lat = (5 * i + t) * geometry::math::d2r<T>();
|
||||
if (xy_y < 0.) lp_lat = -lp_lat;
|
||||
lp_lon /= v(coefs_x[i], t);
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "robin_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Robinson
|
||||
template <typename Parameters>
|
||||
inline void setup_robin(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::robin
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Robinson projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_robin.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct robin_spheroid : public detail::robin::base_robin_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline robin_spheroid(Params const& , Parameters const& par)
|
||||
: detail::robin::base_robin_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::robin::setup_robin(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_robin, robin_spheroid, robin_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(robin_entry, robin_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(robin_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(robin, robin_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_ROBIN_HPP
|
||||
|
||||
224
linx64/include/boost/geometry/srs/projections/proj/rouss.hpp
Normal file
224
linx64/include/boost/geometry/srs/projections/proj/rouss.hpp
Normal file
@@ -0,0 +1,224 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Copyright (c) 2003, 2006 Gerald I. Evenden
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_ROUSS_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_ROUSS_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/proj_mdist.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace rouss
|
||||
{
|
||||
template <typename T>
|
||||
struct par_rouss
|
||||
{
|
||||
T s0;
|
||||
T A1, A2, A3, A4, A5, A6;
|
||||
T B1, B2, B3, B4, B5, B6, B7, B8;
|
||||
T C1, C2, C3, C4, C5, C6, C7, C8;
|
||||
T D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11;
|
||||
mdist<T> en;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_rouss_ellipsoid
|
||||
: public base_t_fi<base_rouss_ellipsoid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_rouss<T> m_proj_parm;
|
||||
|
||||
inline base_rouss_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_rouss_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_forward) ellipsoid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T s, al, cp, sp, al2, s2;
|
||||
|
||||
cp = cos(lp_lat);
|
||||
sp = sin(lp_lat);
|
||||
s = proj_mdist(lp_lat, sp, cp, this->m_proj_parm.en) - this->m_proj_parm.s0;
|
||||
s2 = s * s;
|
||||
al = lp_lon * cp / sqrt(1. - this->m_par.es * sp * sp);
|
||||
al2 = al * al;
|
||||
xy_x = this->m_par.k0 * al*(1.+s2*(this->m_proj_parm.A1+s2*this->m_proj_parm.A4)-al2*(this->m_proj_parm.A2+s*this->m_proj_parm.A3+s2*this->m_proj_parm.A5
|
||||
+al2*this->m_proj_parm.A6));
|
||||
xy_y = this->m_par.k0 * (al2*(this->m_proj_parm.B1+al2*this->m_proj_parm.B4)+
|
||||
s*(1.+al2*(this->m_proj_parm.B3-al2*this->m_proj_parm.B6)+s2*(this->m_proj_parm.B2+s2*this->m_proj_parm.B8)+
|
||||
s*al2*(this->m_proj_parm.B5+s*this->m_proj_parm.B7)));
|
||||
}
|
||||
|
||||
// INVERSE(e_inverse) ellipsoid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
T s, al, x = xy_x / this->m_par.k0, y = xy_y / this->m_par.k0, x2, y2;
|
||||
|
||||
x2 = x * x;
|
||||
y2 = y * y;
|
||||
al = x*(1.-this->m_proj_parm.C1*y2+x2*(this->m_proj_parm.C2+this->m_proj_parm.C3*y-this->m_proj_parm.C4*x2+this->m_proj_parm.C5*y2-this->m_proj_parm.C7*x2*y)
|
||||
+y2*(this->m_proj_parm.C6*y2-this->m_proj_parm.C8*x2*y));
|
||||
s = this->m_proj_parm.s0 + y*(1.+y2*(-this->m_proj_parm.D2+this->m_proj_parm.D8*y2))+
|
||||
x2*(-this->m_proj_parm.D1+y*(-this->m_proj_parm.D3+y*(-this->m_proj_parm.D5+y*(-this->m_proj_parm.D7+y*this->m_proj_parm.D11)))+
|
||||
x2*(this->m_proj_parm.D4+y*(this->m_proj_parm.D6+y*this->m_proj_parm.D10)-x2*this->m_proj_parm.D9));
|
||||
lp_lat=proj_inv_mdist(s, this->m_proj_parm.en);
|
||||
s = sin(lp_lat);
|
||||
lp_lon=al * sqrt(1. - this->m_par.es * s * s)/cos(lp_lat);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "rouss_ellipsoid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Roussilhe Stereographic
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_rouss(Parameters& par, par_rouss<T>& proj_parm)
|
||||
{
|
||||
T N0, es2, t, t2, R_R0_2, R_R0_4;
|
||||
|
||||
if (!proj_mdist_ini(par.es, proj_parm.en))
|
||||
BOOST_THROW_EXCEPTION( projection_exception(0) );
|
||||
|
||||
es2 = sin(par.phi0);
|
||||
proj_parm.s0 = proj_mdist(par.phi0, es2, cos(par.phi0), proj_parm.en);
|
||||
t = 1. - (es2 = par.es * es2 * es2);
|
||||
N0 = 1./sqrt(t);
|
||||
R_R0_2 = t * t / par.one_es;
|
||||
R_R0_4 = R_R0_2 * R_R0_2;
|
||||
t = tan(par.phi0);
|
||||
t2 = t * t;
|
||||
proj_parm.C1 = proj_parm.A1 = R_R0_2 / 4.;
|
||||
proj_parm.C2 = proj_parm.A2 = R_R0_2 * (2 * t2 - 1. - 2. * es2) / 12.;
|
||||
proj_parm.A3 = R_R0_2 * t * (1. + 4. * t2)/ ( 12. * N0);
|
||||
proj_parm.A4 = R_R0_4 / 24.;
|
||||
proj_parm.A5 = R_R0_4 * ( -1. + t2 * (11. + 12. * t2))/24.;
|
||||
proj_parm.A6 = R_R0_4 * ( -2. + t2 * (11. - 2. * t2))/240.;
|
||||
proj_parm.B1 = t / (2. * N0);
|
||||
proj_parm.B2 = R_R0_2 / 12.;
|
||||
proj_parm.B3 = R_R0_2 * (1. + 2. * t2 - 2. * es2)/4.;
|
||||
proj_parm.B4 = R_R0_2 * t * (2. - t2)/(24. * N0);
|
||||
proj_parm.B5 = R_R0_2 * t * (5. + 4.* t2)/(8. * N0);
|
||||
proj_parm.B6 = R_R0_4 * (-2. + t2 * (-5. + 6. * t2))/48.;
|
||||
proj_parm.B7 = R_R0_4 * (5. + t2 * (19. + 12. * t2))/24.;
|
||||
proj_parm.B8 = R_R0_4 / 120.;
|
||||
proj_parm.C3 = R_R0_2 * t * (1. + t2)/(3. * N0);
|
||||
proj_parm.C4 = R_R0_4 * (-3. + t2 * (34. + 22. * t2))/240.;
|
||||
proj_parm.C5 = R_R0_4 * (4. + t2 * (13. + 12. * t2))/24.;
|
||||
proj_parm.C6 = R_R0_4 / 16.;
|
||||
proj_parm.C7 = R_R0_4 * t * (11. + t2 * (33. + t2 * 16.))/(48. * N0);
|
||||
proj_parm.C8 = R_R0_4 * t * (1. + t2 * 4.)/(36. * N0);
|
||||
proj_parm.D1 = t / (2. * N0);
|
||||
proj_parm.D2 = R_R0_2 / 12.;
|
||||
proj_parm.D3 = R_R0_2 * (2 * t2 + 1. - 2. * es2) / 4.;
|
||||
proj_parm.D4 = R_R0_2 * t * (1. + t2)/(8. * N0);
|
||||
proj_parm.D5 = R_R0_2 * t * (1. + t2 * 2.)/(4. * N0);
|
||||
proj_parm.D6 = R_R0_4 * (1. + t2 * (6. + t2 * 6.))/16.;
|
||||
proj_parm.D7 = R_R0_4 * t2 * (3. + t2 * 4.)/8.;
|
||||
proj_parm.D8 = R_R0_4 / 80.;
|
||||
proj_parm.D9 = R_R0_4 * t * (-21. + t2 * (178. - t2 * 26.))/720.;
|
||||
proj_parm.D10 = R_R0_4 * t * (29. + t2 * (86. + t2 * 48.))/(96. * N0);
|
||||
proj_parm.D11 = R_R0_4 * t * (37. + t2 * 44.)/(96. * N0);
|
||||
}
|
||||
|
||||
}} // namespace detail::rouss
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Roussilhe Stereographic projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Azimuthal
|
||||
- Ellipsoid
|
||||
\par Example
|
||||
\image html ex_rouss.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct rouss_ellipsoid : public detail::rouss::base_rouss_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline rouss_ellipsoid(Params const& , Parameters const& par)
|
||||
: detail::rouss::base_rouss_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::rouss::setup_rouss(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_rouss, rouss_ellipsoid, rouss_ellipsoid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(rouss_entry, rouss_ellipsoid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(rouss_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(rouss, rouss_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_ROUSS_HPP
|
||||
|
||||
172
linx64/include/boost/geometry/srs/projections/proj/rpoly.hpp
Normal file
172
linx64/include/boost/geometry/srs/projections/proj/rpoly.hpp
Normal file
@@ -0,0 +1,172 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_RPOLY_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_RPOLY_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace rpoly
|
||||
{
|
||||
|
||||
static const double epsilon = 1e-9;
|
||||
|
||||
template <typename T>
|
||||
struct par_rpoly
|
||||
{
|
||||
T phi1;
|
||||
T fxa;
|
||||
T fxb;
|
||||
int mode;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_rpoly_spheroid
|
||||
: public base_t_f<base_rpoly_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_rpoly<T> m_proj_parm;
|
||||
|
||||
inline base_rpoly_spheroid(const Parameters& par)
|
||||
: base_t_f<base_rpoly_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T fa;
|
||||
|
||||
if (this->m_proj_parm.mode)
|
||||
fa = tan(lp_lon * this->m_proj_parm.fxb) * this->m_proj_parm.fxa;
|
||||
else
|
||||
fa = 0.5 * lp_lon;
|
||||
if (fabs(lp_lat) < epsilon) {
|
||||
xy_x = fa + fa;
|
||||
xy_y = - this->m_par.phi0;
|
||||
} else {
|
||||
xy_y = 1. / tan(lp_lat);
|
||||
xy_x = sin(fa = 2. * atan(fa * sin(lp_lat))) * xy_y;
|
||||
xy_y = lp_lat - this->m_par.phi0 + (1. - cos(fa)) * xy_y;
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "rpoly_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Rectangular Polyconic
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_rpoly(Params const& params, Parameters& par, par_rpoly<T>& proj_parm)
|
||||
{
|
||||
proj_parm.phi1 = fabs(pj_get_param_r<T, srs::spar::lat_ts>(params, "lat_ts", srs::dpar::lat_ts));
|
||||
if ((proj_parm.mode = (proj_parm.phi1 > epsilon)))
|
||||
{
|
||||
proj_parm.fxb = 0.5 * sin(proj_parm.phi1);
|
||||
proj_parm.fxa = 0.5 / proj_parm.fxb;
|
||||
}
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::rpoly
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Rectangular Polyconic projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Conic
|
||||
- Spheroid
|
||||
- no inverse
|
||||
\par Projection parameters
|
||||
- lat_ts: Latitude of true scale (degrees)
|
||||
\par Example
|
||||
\image html ex_rpoly.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct rpoly_spheroid : public detail::rpoly::base_rpoly_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline rpoly_spheroid(Params const& params, Parameters const& par)
|
||||
: detail::rpoly::base_rpoly_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::rpoly::setup_rpoly(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_rpoly, rpoly_spheroid, rpoly_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(rpoly_entry, rpoly_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(rpoly_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(rpoly, rpoly_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_RPOLY_HPP
|
||||
|
||||
507
linx64/include/boost/geometry/srs/projections/proj/sconics.hpp
Normal file
507
linx64/include/boost/geometry/srs/projections/proj/sconics.hpp
Normal file
@@ -0,0 +1,507 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_SCONICS_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_SCONICS_HPP
|
||||
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
#include <boost/math/special_functions/hypot.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace sconics
|
||||
{
|
||||
|
||||
enum proj_type {
|
||||
proj_euler = 0,
|
||||
proj_murd1 = 1,
|
||||
proj_murd2 = 2,
|
||||
proj_murd3 = 3,
|
||||
proj_pconic = 4,
|
||||
proj_tissot = 5,
|
||||
proj_vitk1 = 6
|
||||
};
|
||||
static const double epsilon10 = 1.e-10;
|
||||
static const double epsilon = 1e-10;
|
||||
|
||||
template <typename T>
|
||||
struct par_sconics
|
||||
{
|
||||
T n;
|
||||
T rho_c;
|
||||
T rho_0;
|
||||
T sig;
|
||||
T c1, c2;
|
||||
proj_type type;
|
||||
};
|
||||
|
||||
/* get common factors for simple conics */
|
||||
template <typename Params, typename T>
|
||||
inline int phi12(Params const& params, par_sconics<T>& proj_parm, T *del)
|
||||
{
|
||||
T p1, p2;
|
||||
int err = 0;
|
||||
|
||||
if (!pj_param_r<srs::spar::lat_1>(params, "lat_1", srs::dpar::lat_1, p1) ||
|
||||
!pj_param_r<srs::spar::lat_2>(params, "lat_2", srs::dpar::lat_2, p2)) {
|
||||
err = -41;
|
||||
} else {
|
||||
//p1 = pj_get_param_r(par.params, "lat_1"); // set above
|
||||
//p2 = pj_get_param_r(par.params, "lat_2"); // set above
|
||||
*del = 0.5 * (p2 - p1);
|
||||
proj_parm.sig = 0.5 * (p2 + p1);
|
||||
err = (fabs(*del) < epsilon || fabs(proj_parm.sig) < epsilon) ? -42 : 0;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_sconics_spheroid
|
||||
: public base_t_fi<base_sconics_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_sconics<T> m_proj_parm;
|
||||
|
||||
inline base_sconics_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_sconics_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T rho;
|
||||
|
||||
switch (this->m_proj_parm.type) {
|
||||
case proj_murd2:
|
||||
rho = this->m_proj_parm.rho_c + tan(this->m_proj_parm.sig - lp_lat);
|
||||
break;
|
||||
case proj_pconic:
|
||||
rho = this->m_proj_parm.c2 * (this->m_proj_parm.c1 - tan(lp_lat - this->m_proj_parm.sig));
|
||||
break;
|
||||
default:
|
||||
rho = this->m_proj_parm.rho_c - lp_lat;
|
||||
break;
|
||||
}
|
||||
xy_x = rho * sin( lp_lon *= this->m_proj_parm.n );
|
||||
xy_y = this->m_proj_parm.rho_0 - rho * cos(lp_lon);
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) ellipsoid & spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
T rho;
|
||||
|
||||
rho = boost::math::hypot(xy_x, xy_y = this->m_proj_parm.rho_0 - xy_y);
|
||||
if (this->m_proj_parm.n < 0.) {
|
||||
rho = - rho;
|
||||
xy_x = - xy_x;
|
||||
xy_y = - xy_y;
|
||||
}
|
||||
|
||||
lp_lon = atan2(xy_x, xy_y) / this->m_proj_parm.n;
|
||||
|
||||
switch (this->m_proj_parm.type) {
|
||||
case proj_pconic:
|
||||
lp_lat = atan(this->m_proj_parm.c1 - rho / this->m_proj_parm.c2) + this->m_proj_parm.sig;
|
||||
break;
|
||||
case proj_murd2:
|
||||
lp_lat = this->m_proj_parm.sig - atan(rho - this->m_proj_parm.rho_c);
|
||||
break;
|
||||
default:
|
||||
lp_lat = this->m_proj_parm.rho_c - rho;
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "sconics_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup(Params const& params, Parameters& par, par_sconics<T>& proj_parm, proj_type type)
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T del, cs;
|
||||
int err;
|
||||
|
||||
proj_parm.type = type;
|
||||
|
||||
err = phi12(params, proj_parm, &del);
|
||||
if(err)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(err) );
|
||||
|
||||
switch (proj_parm.type) {
|
||||
case proj_tissot:
|
||||
proj_parm.n = sin(proj_parm.sig);
|
||||
cs = cos(del);
|
||||
proj_parm.rho_c = proj_parm.n / cs + cs / proj_parm.n;
|
||||
proj_parm.rho_0 = sqrt((proj_parm.rho_c - 2 * sin(par.phi0))/proj_parm.n);
|
||||
break;
|
||||
case proj_murd1:
|
||||
proj_parm.rho_c = sin(del)/(del * tan(proj_parm.sig)) + proj_parm.sig;
|
||||
proj_parm.rho_0 = proj_parm.rho_c - par.phi0;
|
||||
proj_parm.n = sin(proj_parm.sig);
|
||||
break;
|
||||
case proj_murd2:
|
||||
proj_parm.rho_c = (cs = sqrt(cos(del))) / tan(proj_parm.sig);
|
||||
proj_parm.rho_0 = proj_parm.rho_c + tan(proj_parm.sig - par.phi0);
|
||||
proj_parm.n = sin(proj_parm.sig) * cs;
|
||||
break;
|
||||
case proj_murd3:
|
||||
proj_parm.rho_c = del / (tan(proj_parm.sig) * tan(del)) + proj_parm.sig;
|
||||
proj_parm.rho_0 = proj_parm.rho_c - par.phi0;
|
||||
proj_parm.n = sin(proj_parm.sig) * sin(del) * tan(del) / (del * del);
|
||||
break;
|
||||
case proj_euler:
|
||||
proj_parm.n = sin(proj_parm.sig) * sin(del) / del;
|
||||
del *= 0.5;
|
||||
proj_parm.rho_c = del / (tan(del) * tan(proj_parm.sig)) + proj_parm.sig;
|
||||
proj_parm.rho_0 = proj_parm.rho_c - par.phi0;
|
||||
break;
|
||||
case proj_pconic:
|
||||
proj_parm.n = sin(proj_parm.sig);
|
||||
proj_parm.c2 = cos(del);
|
||||
proj_parm.c1 = 1./tan(proj_parm.sig);
|
||||
if (fabs(del = par.phi0 - proj_parm.sig) - epsilon10 >= half_pi)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_lat_0_half_pi_from_mean) );
|
||||
proj_parm.rho_0 = proj_parm.c2 * (proj_parm.c1 - tan(del));
|
||||
break;
|
||||
case proj_vitk1:
|
||||
proj_parm.n = (cs = tan(del)) * sin(proj_parm.sig) / del;
|
||||
proj_parm.rho_c = del / (cs * tan(proj_parm.sig)) + proj_parm.sig;
|
||||
proj_parm.rho_0 = proj_parm.rho_c - par.phi0;
|
||||
break;
|
||||
}
|
||||
|
||||
par.es = 0;
|
||||
}
|
||||
|
||||
|
||||
// Euler
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_euler(Params const& params, Parameters& par, par_sconics<T>& proj_parm)
|
||||
{
|
||||
setup(params, par, proj_parm, proj_euler);
|
||||
}
|
||||
|
||||
// Tissot
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_tissot(Params const& params, Parameters& par, par_sconics<T>& proj_parm)
|
||||
{
|
||||
setup(params, par, proj_parm, proj_tissot);
|
||||
}
|
||||
|
||||
// Murdoch I
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_murd1(Params const& params, Parameters& par, par_sconics<T>& proj_parm)
|
||||
{
|
||||
setup(params, par, proj_parm, proj_murd1);
|
||||
}
|
||||
|
||||
// Murdoch II
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_murd2(Params const& params, Parameters& par, par_sconics<T>& proj_parm)
|
||||
{
|
||||
setup(params, par, proj_parm, proj_murd2);
|
||||
}
|
||||
|
||||
// Murdoch III
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_murd3(Params const& params, Parameters& par, par_sconics<T>& proj_parm)
|
||||
{
|
||||
setup(params, par, proj_parm, proj_murd3);
|
||||
}
|
||||
|
||||
// Perspective Conic
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_pconic(Params const& params, Parameters& par, par_sconics<T>& proj_parm)
|
||||
{
|
||||
setup(params, par, proj_parm, proj_pconic);
|
||||
}
|
||||
|
||||
// Vitkovsky I
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_vitk1(Params const& params, Parameters& par, par_sconics<T>& proj_parm)
|
||||
{
|
||||
setup(params, par, proj_parm, proj_vitk1);
|
||||
}
|
||||
|
||||
}} // namespace detail::sconics
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Tissot projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Conic
|
||||
- Spheroid
|
||||
\par Projection parameters
|
||||
- lat_1: Latitude of first standard parallel
|
||||
- lat_2: Latitude of second standard parallel
|
||||
\par Example
|
||||
\image html ex_tissot.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct tissot_spheroid : public detail::sconics::base_sconics_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline tissot_spheroid(Params const& params, const Parameters& par)
|
||||
: detail::sconics::base_sconics_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::sconics::setup_tissot(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Murdoch I projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Conic
|
||||
- Spheroid
|
||||
\par Projection parameters
|
||||
- lat_1: Latitude of first standard parallel
|
||||
- lat_2: Latitude of second standard parallel
|
||||
\par Example
|
||||
\image html ex_murd1.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct murd1_spheroid : public detail::sconics::base_sconics_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline murd1_spheroid(Params const& params, const Parameters& par)
|
||||
: detail::sconics::base_sconics_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::sconics::setup_murd1(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Murdoch II projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Conic
|
||||
- Spheroid
|
||||
\par Projection parameters
|
||||
- lat_1: Latitude of first standard parallel
|
||||
- lat_2: Latitude of second standard parallel
|
||||
\par Example
|
||||
\image html ex_murd2.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct murd2_spheroid : public detail::sconics::base_sconics_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline murd2_spheroid(Params const& params, const Parameters& par)
|
||||
: detail::sconics::base_sconics_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::sconics::setup_murd2(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Murdoch III projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Conic
|
||||
- Spheroid
|
||||
\par Projection parameters
|
||||
- lat_1: Latitude of first standard parallel
|
||||
- lat_2: Latitude of second standard parallel
|
||||
\par Example
|
||||
\image html ex_murd3.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct murd3_spheroid : public detail::sconics::base_sconics_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline murd3_spheroid(Params const& params, const Parameters& par)
|
||||
: detail::sconics::base_sconics_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::sconics::setup_murd3(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Euler projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Conic
|
||||
- Spheroid
|
||||
\par Projection parameters
|
||||
- lat_1: Latitude of first standard parallel
|
||||
- lat_2: Latitude of second standard parallel
|
||||
\par Example
|
||||
\image html ex_euler.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct euler_spheroid : public detail::sconics::base_sconics_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline euler_spheroid(Params const& params, const Parameters& par)
|
||||
: detail::sconics::base_sconics_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::sconics::setup_euler(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Perspective Conic projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Conic
|
||||
- Spheroid
|
||||
\par Projection parameters
|
||||
- lat_1: Latitude of first standard parallel
|
||||
- lat_2: Latitude of second standard parallel
|
||||
\par Example
|
||||
\image html ex_pconic.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct pconic_spheroid : public detail::sconics::base_sconics_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline pconic_spheroid(Params const& params, const Parameters& par)
|
||||
: detail::sconics::base_sconics_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::sconics::setup_pconic(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Vitkovsky I projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Conic
|
||||
- Spheroid
|
||||
\par Projection parameters
|
||||
- lat_1: Latitude of first standard parallel
|
||||
- lat_2: Latitude of second standard parallel
|
||||
\par Example
|
||||
\image html ex_vitk1.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct vitk1_spheroid : public detail::sconics::base_sconics_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline vitk1_spheroid(Params const& params, const Parameters& par)
|
||||
: detail::sconics::base_sconics_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::sconics::setup_vitk1(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_euler, euler_spheroid, euler_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_murd1, murd1_spheroid, murd1_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_murd2, murd2_spheroid, murd2_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_murd3, murd3_spheroid, murd3_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_pconic, pconic_spheroid, pconic_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_tissot, tissot_spheroid, tissot_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_vitk1, vitk1_spheroid, vitk1_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(euler_entry, euler_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(murd1_entry, murd1_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(murd2_entry, murd2_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(murd3_entry, murd3_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(pconic_entry, pconic_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(tissot_entry, tissot_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(vitk1_entry, vitk1_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(sconics_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(euler, euler_entry)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(murd1, murd1_entry)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(murd2, murd2_entry)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(murd3, murd3_entry)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(pconic, pconic_entry)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(tissot, tissot_entry)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(vitk1, vitk1_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_SCONICS_HPP
|
||||
|
||||
210
linx64/include/boost/geometry/srs/projections/proj/somerc.hpp
Normal file
210
linx64/include/boost/geometry/srs/projections/proj/somerc.hpp
Normal file
@@ -0,0 +1,210 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_SOMERC_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_SOMERC_HPP
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/aasincos.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace somerc
|
||||
{
|
||||
static const double epsilon = 1.e-10;
|
||||
static const int n_iter = 6;
|
||||
|
||||
template <typename T>
|
||||
struct par_somerc
|
||||
{
|
||||
T K, c, hlf_e, kR, cosp0, sinp0;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_somerc_ellipsoid
|
||||
: public base_t_fi<base_somerc_ellipsoid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_somerc<T> m_proj_parm;
|
||||
|
||||
inline base_somerc_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_somerc_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_forward)
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T fourth_pi = detail::fourth_pi<T>();
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T phip, lamp, phipp, lampp, sp, cp;
|
||||
|
||||
sp = this->m_par.e * sin(lp_lat);
|
||||
phip = 2.* atan( exp( this->m_proj_parm.c * (
|
||||
log(tan(fourth_pi + 0.5 * lp_lat)) - this->m_proj_parm.hlf_e * log((1. + sp)/(1. - sp)))
|
||||
+ this->m_proj_parm.K)) - half_pi;
|
||||
lamp = this->m_proj_parm.c * lp_lon;
|
||||
cp = cos(phip);
|
||||
phipp = aasin(this->m_proj_parm.cosp0 * sin(phip) - this->m_proj_parm.sinp0 * cp * cos(lamp));
|
||||
lampp = aasin(cp * sin(lamp) / cos(phipp));
|
||||
xy_x = this->m_proj_parm.kR * lampp;
|
||||
xy_y = this->m_proj_parm.kR * log(tan(fourth_pi + 0.5 * phipp));
|
||||
}
|
||||
|
||||
// INVERSE(e_inverse) ellipsoid & spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T fourth_pi = detail::fourth_pi<T>();
|
||||
|
||||
T phip, lamp, phipp, lampp, cp, esp, con, delp;
|
||||
int i;
|
||||
|
||||
phipp = 2. * (atan(exp(xy_y / this->m_proj_parm.kR)) - fourth_pi);
|
||||
lampp = xy_x / this->m_proj_parm.kR;
|
||||
cp = cos(phipp);
|
||||
phip = aasin(this->m_proj_parm.cosp0 * sin(phipp) + this->m_proj_parm.sinp0 * cp * cos(lampp));
|
||||
lamp = aasin(cp * sin(lampp) / cos(phip));
|
||||
con = (this->m_proj_parm.K - log(tan(fourth_pi + 0.5 * phip)))/this->m_proj_parm.c;
|
||||
for (i = n_iter; i ; --i) {
|
||||
esp = this->m_par.e * sin(phip);
|
||||
delp = (con + log(tan(fourth_pi + 0.5 * phip)) - this->m_proj_parm.hlf_e *
|
||||
log((1. + esp)/(1. - esp)) ) *
|
||||
(1. - esp * esp) * cos(phip) * this->m_par.rone_es;
|
||||
phip -= delp;
|
||||
if (fabs(delp) < epsilon)
|
||||
break;
|
||||
}
|
||||
if (i) {
|
||||
lp_lat = phip;
|
||||
lp_lon = lamp / this->m_proj_parm.c;
|
||||
} else {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "somerc_ellipsoid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Swiss. Obl. Mercator
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_somerc(Parameters& par, par_somerc<T>& proj_parm)
|
||||
{
|
||||
static const T fourth_pi = detail::fourth_pi<T>();
|
||||
|
||||
T cp, phip0, sp;
|
||||
|
||||
proj_parm.hlf_e = 0.5 * par.e;
|
||||
cp = cos(par.phi0);
|
||||
cp *= cp;
|
||||
proj_parm.c = sqrt(1 + par.es * cp * cp * par.rone_es);
|
||||
sp = sin(par.phi0);
|
||||
proj_parm.cosp0 = cos( phip0 = aasin(proj_parm.sinp0 = sp / proj_parm.c) );
|
||||
sp *= par.e;
|
||||
proj_parm.K = log(tan(fourth_pi + 0.5 * phip0)) - proj_parm.c * (
|
||||
log(tan(fourth_pi + 0.5 * par.phi0)) - proj_parm.hlf_e *
|
||||
log((1. + sp) / (1. - sp)));
|
||||
proj_parm.kR = par.k0 * sqrt(par.one_es) / (1. - sp * sp);
|
||||
}
|
||||
|
||||
}} // namespace detail::somerc
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Swiss. Obl. Mercator projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Cylindrical
|
||||
- Ellipsoid
|
||||
- For CH1903
|
||||
\par Example
|
||||
\image html ex_somerc.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct somerc_ellipsoid : public detail::somerc::base_somerc_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline somerc_ellipsoid(Params const& , Parameters const& par)
|
||||
: detail::somerc::base_somerc_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::somerc::setup_somerc(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_somerc, somerc_ellipsoid, somerc_ellipsoid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(somerc_entry, somerc_ellipsoid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(somerc_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(somerc, somerc_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_SOMERC_HPP
|
||||
|
||||
533
linx64/include/boost/geometry/srs/projections/proj/stere.hpp
Normal file
533
linx64/include/boost/geometry/srs/projections/proj/stere.hpp
Normal file
@@ -0,0 +1,533 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_STERE_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_STERE_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
#include <boost/math/special_functions/hypot.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_tsfn.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace stere
|
||||
{
|
||||
static const double epsilon10 = 1.e-10;
|
||||
static const double tolerance = 1.e-8;
|
||||
static const int n_iter = 8;
|
||||
static const double conv_tolerance = 1.e-10;
|
||||
|
||||
enum mode_type {
|
||||
s_pole = 0,
|
||||
n_pole = 1,
|
||||
obliq = 2,
|
||||
equit = 3
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct par_stere
|
||||
{
|
||||
T phits;
|
||||
T sinX1;
|
||||
T cosX1;
|
||||
T akm1;
|
||||
mode_type mode;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
inline T ssfn_(T const& phit, T sinphi, T const& eccen)
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
sinphi *= eccen;
|
||||
return (tan (.5 * (half_pi + phit)) *
|
||||
math::pow((T(1) - sinphi) / (T(1) + sinphi), T(0.5) * eccen));
|
||||
}
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_stere_ellipsoid
|
||||
: public base_t_fi<base_stere_ellipsoid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_stere<T> m_proj_parm;
|
||||
|
||||
inline base_stere_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_stere_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_forward) ellipsoid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T coslam, sinlam, sinX=0.0, cosX=0.0, X, A = 0.0, sinphi;
|
||||
|
||||
coslam = cos(lp_lon);
|
||||
sinlam = sin(lp_lon);
|
||||
sinphi = sin(lp_lat);
|
||||
if (this->m_proj_parm.mode == obliq || this->m_proj_parm.mode == equit) {
|
||||
sinX = sin(X = 2. * atan(ssfn_(lp_lat, sinphi, this->m_par.e)) - half_pi);
|
||||
cosX = cos(X);
|
||||
}
|
||||
switch (this->m_proj_parm.mode) {
|
||||
case obliq:
|
||||
A = this->m_proj_parm.akm1 / (this->m_proj_parm.cosX1 * (1. + this->m_proj_parm.sinX1 * sinX +
|
||||
this->m_proj_parm.cosX1 * cosX * coslam));
|
||||
xy_y = A * (this->m_proj_parm.cosX1 * sinX - this->m_proj_parm.sinX1 * cosX * coslam);
|
||||
goto xmul; /* but why not just xy.x = A * cosX; break; ? */
|
||||
|
||||
case equit:
|
||||
// TODO: calculate denominator once
|
||||
/* avoid zero division */
|
||||
if (1. + cosX * coslam == 0.0) {
|
||||
xy_y = HUGE_VAL;
|
||||
} else {
|
||||
A = this->m_proj_parm.akm1 / (1. + cosX * coslam);
|
||||
xy_y = A * sinX;
|
||||
}
|
||||
xmul:
|
||||
xy_x = A * cosX;
|
||||
break;
|
||||
|
||||
case s_pole:
|
||||
lp_lat = -lp_lat;
|
||||
coslam = - coslam;
|
||||
sinphi = -sinphi;
|
||||
BOOST_FALLTHROUGH;
|
||||
case n_pole:
|
||||
xy_x = this->m_proj_parm.akm1 * pj_tsfn(lp_lat, sinphi, this->m_par.e);
|
||||
xy_y = - xy_x * coslam;
|
||||
break;
|
||||
}
|
||||
|
||||
xy_x = xy_x * sinlam;
|
||||
}
|
||||
|
||||
// INVERSE(e_inverse) ellipsoid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T cosphi, sinphi, tp=0.0, phi_l=0.0, rho, halfe=0.0, halfpi=0.0;
|
||||
int i;
|
||||
|
||||
rho = boost::math::hypot(xy_x, xy_y);
|
||||
switch (this->m_proj_parm.mode) {
|
||||
case obliq:
|
||||
case equit:
|
||||
cosphi = cos( tp = 2. * atan2(rho * this->m_proj_parm.cosX1 , this->m_proj_parm.akm1) );
|
||||
sinphi = sin(tp);
|
||||
if( rho == 0.0 )
|
||||
phi_l = asin(cosphi * this->m_proj_parm.sinX1);
|
||||
else
|
||||
phi_l = asin(cosphi * this->m_proj_parm.sinX1 + (xy_y * sinphi * this->m_proj_parm.cosX1 / rho));
|
||||
|
||||
tp = tan(.5 * (half_pi + phi_l));
|
||||
xy_x *= sinphi;
|
||||
xy_y = rho * this->m_proj_parm.cosX1 * cosphi - xy_y * this->m_proj_parm.sinX1* sinphi;
|
||||
halfpi = half_pi;
|
||||
halfe = .5 * this->m_par.e;
|
||||
break;
|
||||
case n_pole:
|
||||
xy_y = -xy_y;
|
||||
BOOST_FALLTHROUGH;
|
||||
case s_pole:
|
||||
phi_l = half_pi - 2. * atan(tp = - rho / this->m_proj_parm.akm1);
|
||||
halfpi = -half_pi;
|
||||
halfe = -.5 * this->m_par.e;
|
||||
break;
|
||||
}
|
||||
for (i = n_iter; i--; phi_l = lp_lat) {
|
||||
sinphi = this->m_par.e * sin(phi_l);
|
||||
lp_lat = T(2) * atan(tp * math::pow((T(1)+sinphi)/(T(1)-sinphi), halfe)) - halfpi;
|
||||
if (fabs(phi_l - lp_lat) < conv_tolerance) {
|
||||
if (this->m_proj_parm.mode == s_pole)
|
||||
lp_lat = -lp_lat;
|
||||
lp_lon = (xy_x == 0. && xy_y == 0.) ? 0. : atan2(xy_x, xy_y);
|
||||
return;
|
||||
}
|
||||
}
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "stere_ellipsoid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_stere_spheroid
|
||||
: public base_t_fi<base_stere_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_stere<T> m_proj_parm;
|
||||
|
||||
inline base_stere_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_stere_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T fourth_pi = detail::fourth_pi<T>();
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T sinphi, cosphi, coslam, sinlam;
|
||||
|
||||
sinphi = sin(lp_lat);
|
||||
cosphi = cos(lp_lat);
|
||||
coslam = cos(lp_lon);
|
||||
sinlam = sin(lp_lon);
|
||||
switch (this->m_proj_parm.mode) {
|
||||
case equit:
|
||||
xy_y = 1. + cosphi * coslam;
|
||||
goto oblcon;
|
||||
case obliq:
|
||||
xy_y = 1. + this->m_proj_parm.sinX1 * sinphi + this->m_proj_parm.cosX1 * cosphi * coslam;
|
||||
oblcon:
|
||||
if (xy_y <= epsilon10) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
xy_x = (xy_y = this->m_proj_parm.akm1 / xy_y) * cosphi * sinlam;
|
||||
xy_y *= (this->m_proj_parm.mode == equit) ? sinphi :
|
||||
this->m_proj_parm.cosX1 * sinphi - this->m_proj_parm.sinX1 * cosphi * coslam;
|
||||
break;
|
||||
case n_pole:
|
||||
coslam = - coslam;
|
||||
lp_lat = - lp_lat;
|
||||
BOOST_FALLTHROUGH;
|
||||
case s_pole:
|
||||
if (fabs(lp_lat - half_pi) < tolerance) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
xy_x = sinlam * ( xy_y = this->m_proj_parm.akm1 * tan(fourth_pi + .5 * lp_lat) );
|
||||
xy_y *= coslam;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
T c, rh, sinc, cosc;
|
||||
|
||||
sinc = sin(c = 2. * atan((rh = boost::math::hypot(xy_x, xy_y)) / this->m_proj_parm.akm1));
|
||||
cosc = cos(c);
|
||||
lp_lon = 0.;
|
||||
|
||||
switch (this->m_proj_parm.mode) {
|
||||
case equit:
|
||||
if (fabs(rh) <= epsilon10)
|
||||
lp_lat = 0.;
|
||||
else
|
||||
lp_lat = asin(xy_y * sinc / rh);
|
||||
if (cosc != 0. || xy_x != 0.)
|
||||
lp_lon = atan2(xy_x * sinc, cosc * rh);
|
||||
break;
|
||||
case obliq:
|
||||
if (fabs(rh) <= epsilon10)
|
||||
lp_lat = this->m_par.phi0;
|
||||
else
|
||||
lp_lat = asin(cosc * this->m_proj_parm.sinX1 + xy_y * sinc * this->m_proj_parm.cosX1 / rh);
|
||||
if ((c = cosc - this->m_proj_parm.sinX1 * sin(lp_lat)) != 0. || xy_x != 0.)
|
||||
lp_lon = atan2(xy_x * sinc * this->m_proj_parm.cosX1, c * rh);
|
||||
break;
|
||||
case n_pole:
|
||||
xy_y = -xy_y;
|
||||
BOOST_FALLTHROUGH;
|
||||
case s_pole:
|
||||
if (fabs(rh) <= epsilon10)
|
||||
lp_lat = this->m_par.phi0;
|
||||
else
|
||||
lp_lat = asin(this->m_proj_parm.mode == s_pole ? - cosc : cosc);
|
||||
lp_lon = (xy_x == 0. && xy_y == 0.) ? 0. : atan2(xy_x, xy_y);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "stere_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup(Parameters& par, par_stere<T>& proj_parm) /* general initialization */
|
||||
{
|
||||
static const T fourth_pi = detail::fourth_pi<T>();
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T t;
|
||||
|
||||
if (fabs((t = fabs(par.phi0)) - half_pi) < epsilon10)
|
||||
proj_parm.mode = par.phi0 < 0. ? s_pole : n_pole;
|
||||
else
|
||||
proj_parm.mode = t > epsilon10 ? obliq : equit;
|
||||
proj_parm.phits = fabs(proj_parm.phits);
|
||||
|
||||
if (par.es != 0.0) {
|
||||
T X;
|
||||
|
||||
switch (proj_parm.mode) {
|
||||
case n_pole:
|
||||
case s_pole:
|
||||
if (fabs(proj_parm.phits - half_pi) < epsilon10)
|
||||
proj_parm.akm1 = 2. * par.k0 /
|
||||
sqrt(math::pow(T(1)+par.e,T(1)+par.e)*math::pow(T(1)-par.e,T(1)-par.e));
|
||||
else {
|
||||
proj_parm.akm1 = cos(proj_parm.phits) /
|
||||
pj_tsfn(proj_parm.phits, t = sin(proj_parm.phits), par.e);
|
||||
t *= par.e;
|
||||
proj_parm.akm1 /= sqrt(1. - t * t);
|
||||
}
|
||||
break;
|
||||
case equit:
|
||||
case obliq:
|
||||
t = sin(par.phi0);
|
||||
X = 2. * atan(ssfn_(par.phi0, t, par.e)) - half_pi;
|
||||
t *= par.e;
|
||||
proj_parm.akm1 = 2. * par.k0 * cos(par.phi0) / sqrt(1. - t * t);
|
||||
proj_parm.sinX1 = sin(X);
|
||||
proj_parm.cosX1 = cos(X);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (proj_parm.mode) {
|
||||
case obliq:
|
||||
proj_parm.sinX1 = sin(par.phi0);
|
||||
proj_parm.cosX1 = cos(par.phi0);
|
||||
BOOST_FALLTHROUGH;
|
||||
case equit:
|
||||
proj_parm.akm1 = 2. * par.k0;
|
||||
break;
|
||||
case s_pole:
|
||||
case n_pole:
|
||||
proj_parm.akm1 = fabs(proj_parm.phits - half_pi) >= epsilon10 ?
|
||||
cos(proj_parm.phits) / tan(fourth_pi - .5 * proj_parm.phits) :
|
||||
2. * par.k0 ;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Stereographic
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_stere(Params const& params, Parameters& par, par_stere<T>& proj_parm)
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
if (! pj_param_r<srs::spar::lat_ts>(params, "lat_ts", srs::dpar::lat_ts, proj_parm.phits))
|
||||
proj_parm.phits = half_pi;
|
||||
|
||||
setup(par, proj_parm);
|
||||
}
|
||||
|
||||
// Universal Polar Stereographic
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_ups(Params const& params, Parameters& par, par_stere<T>& proj_parm)
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
/* International Ellipsoid */
|
||||
par.phi0 = pj_get_param_b<srs::spar::south>(params, "south", srs::dpar::south) ? -half_pi: half_pi;
|
||||
if (par.es == 0.0) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_ellipsoid_use_required) );
|
||||
}
|
||||
par.k0 = .994;
|
||||
par.x0 = 2000000.;
|
||||
par.y0 = 2000000.;
|
||||
proj_parm.phits = half_pi;
|
||||
par.lam0 = 0.;
|
||||
|
||||
setup(par, proj_parm);
|
||||
}
|
||||
|
||||
}} // namespace detail::stere
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Stereographic projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Azimuthal
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Projection parameters
|
||||
- lat_ts: Latitude of true scale (degrees)
|
||||
\par Example
|
||||
\image html ex_stere.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct stere_ellipsoid : public detail::stere::base_stere_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline stere_ellipsoid(Params const& params, const Parameters& par)
|
||||
: detail::stere::base_stere_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::stere::setup_stere(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Stereographic projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Azimuthal
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Projection parameters
|
||||
- lat_ts: Latitude of true scale (degrees)
|
||||
\par Example
|
||||
\image html ex_stere.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct stere_spheroid : public detail::stere::base_stere_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline stere_spheroid(Params const& params, const Parameters& par)
|
||||
: detail::stere::base_stere_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::stere::setup_stere(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Universal Polar Stereographic projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Azimuthal
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Projection parameters
|
||||
- south: Denotes southern hemisphere UTM zone (boolean)
|
||||
\par Example
|
||||
\image html ex_ups.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct ups_ellipsoid : public detail::stere::base_stere_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline ups_ellipsoid(Params const& params, const Parameters& par)
|
||||
: detail::stere::base_stere_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::stere::setup_ups(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Universal Polar Stereographic projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Azimuthal
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Projection parameters
|
||||
- south: Denotes southern hemisphere UTM zone (boolean)
|
||||
\par Example
|
||||
\image html ex_ups.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct ups_spheroid : public detail::stere::base_stere_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline ups_spheroid(Params const& params, const Parameters& par)
|
||||
: detail::stere::base_stere_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::stere::setup_ups(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_stere, stere_spheroid, stere_ellipsoid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_ups, ups_spheroid, ups_ellipsoid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(stere_entry, stere_spheroid, stere_ellipsoid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(ups_entry, ups_spheroid, ups_ellipsoid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(stere_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(stere, stere_entry)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(ups, ups_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_STERE_HPP
|
||||
|
||||
189
linx64/include/boost/geometry/srs/projections/proj/sterea.hpp
Normal file
189
linx64/include/boost/geometry/srs/projections/proj/sterea.hpp
Normal file
@@ -0,0 +1,189 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Copyright (c) 2003 Gerald I. Evenden
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_STEREA_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_STEREA_HPP
|
||||
|
||||
#include <boost/math/special_functions/hypot.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_gauss.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace sterea
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct par_sterea
|
||||
{
|
||||
T phic0;
|
||||
T cosc0, sinc0;
|
||||
T R2;
|
||||
gauss<T> en;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_sterea_ellipsoid
|
||||
: public base_t_fi<base_sterea_ellipsoid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_sterea<T> m_proj_parm;
|
||||
|
||||
inline base_sterea_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_sterea_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_forward) ellipsoid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T lp_lon, T lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T cosc, sinc, cosl_, k;
|
||||
|
||||
detail::gauss_fwd(m_proj_parm.en, lp_lon, lp_lat);
|
||||
sinc = sin(lp_lat);
|
||||
cosc = cos(lp_lat);
|
||||
cosl_ = cos(lp_lon);
|
||||
k = this->m_par.k0 * this->m_proj_parm.R2 / (1. + this->m_proj_parm.sinc0 * sinc + this->m_proj_parm.cosc0 * cosc * cosl_);
|
||||
xy_x = k * cosc * sin(lp_lon);
|
||||
xy_y = k * (this->m_proj_parm.cosc0 * sinc - this->m_proj_parm.sinc0 * cosc * cosl_);
|
||||
}
|
||||
|
||||
// INVERSE(e_inverse) ellipsoid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
T rho, c, sinc, cosc;
|
||||
|
||||
xy_x /= this->m_par.k0;
|
||||
xy_y /= this->m_par.k0;
|
||||
if((rho = boost::math::hypot(xy_x, xy_y)) != 0.0) {
|
||||
c = 2. * atan2(rho, this->m_proj_parm.R2);
|
||||
sinc = sin(c);
|
||||
cosc = cos(c);
|
||||
lp_lat = asin(cosc * this->m_proj_parm.sinc0 + xy_y * sinc * this->m_proj_parm.cosc0 / rho);
|
||||
lp_lon = atan2(xy_x * sinc, rho * this->m_proj_parm.cosc0 * cosc -
|
||||
xy_y * this->m_proj_parm.sinc0 * sinc);
|
||||
} else {
|
||||
lp_lat = this->m_proj_parm.phic0;
|
||||
lp_lon = 0.;
|
||||
}
|
||||
detail::gauss_inv(m_proj_parm.en, lp_lon, lp_lat);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "sterea_ellipsoid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Oblique Stereographic Alternative
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_sterea(Parameters& par, par_sterea<T>& proj_parm)
|
||||
{
|
||||
T R;
|
||||
|
||||
proj_parm.en = detail::gauss_ini(par.e, par.phi0, proj_parm.phic0, R);
|
||||
proj_parm.sinc0 = sin(proj_parm.phic0);
|
||||
proj_parm.cosc0 = cos(proj_parm.phic0);
|
||||
proj_parm.R2 = 2. * R;
|
||||
}
|
||||
|
||||
}} // namespace detail::sterea
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Oblique Stereographic Alternative projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Azimuthal
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Example
|
||||
\image html ex_sterea.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct sterea_ellipsoid : public detail::sterea::base_sterea_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline sterea_ellipsoid(Params const& , Parameters const& par)
|
||||
: detail::sterea::base_sterea_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::sterea::setup_sterea(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_sterea, sterea_ellipsoid, sterea_ellipsoid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(sterea_entry, sterea_ellipsoid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(sterea_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(sterea, sterea_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_STEREA_HPP
|
||||
|
||||
283
linx64/include/boost/geometry/srs/projections/proj/sts.hpp
Normal file
283
linx64/include/boost/geometry/srs/projections/proj/sts.hpp
Normal file
@@ -0,0 +1,283 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_STS_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_STS_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/aasincos.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace sts
|
||||
{
|
||||
template <typename T>
|
||||
struct par_sts
|
||||
{
|
||||
T C_x, C_y, C_p;
|
||||
bool tan_mode;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_sts_spheroid
|
||||
: public base_t_fi<base_sts_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_sts<T> m_proj_parm;
|
||||
|
||||
inline base_sts_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_sts_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T c;
|
||||
|
||||
xy_x = this->m_proj_parm.C_x * lp_lon * cos(lp_lat);
|
||||
xy_y = this->m_proj_parm.C_y;
|
||||
lp_lat *= this->m_proj_parm.C_p;
|
||||
c = cos(lp_lat);
|
||||
if (this->m_proj_parm.tan_mode) {
|
||||
xy_x *= c * c;
|
||||
xy_y *= tan(lp_lat);
|
||||
} else {
|
||||
xy_x /= c;
|
||||
xy_y *= sin(lp_lat);
|
||||
}
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
T c;
|
||||
|
||||
xy_y /= this->m_proj_parm.C_y;
|
||||
c = cos(lp_lat = this->m_proj_parm.tan_mode ? atan(xy_y) : aasin(xy_y));
|
||||
lp_lat /= this->m_proj_parm.C_p;
|
||||
lp_lon = xy_x / (this->m_proj_parm.C_x * cos(lp_lat));
|
||||
if (this->m_proj_parm.tan_mode)
|
||||
lp_lon /= c * c;
|
||||
else
|
||||
lp_lon *= c;
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "sts_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup(Parameters& par, par_sts<T>& proj_parm, T const& p, T const& q, bool mode)
|
||||
{
|
||||
par.es = 0.;
|
||||
proj_parm.C_x = q / p;
|
||||
proj_parm.C_y = p;
|
||||
proj_parm.C_p = 1/ q;
|
||||
proj_parm.tan_mode = mode;
|
||||
}
|
||||
|
||||
|
||||
// Foucaut
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_fouc(Parameters& par, par_sts<T>& proj_parm)
|
||||
{
|
||||
setup(par, proj_parm, 2., 2., true);
|
||||
}
|
||||
|
||||
// Kavraisky V
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_kav5(Parameters& par, par_sts<T>& proj_parm)
|
||||
{
|
||||
setup(par, proj_parm, 1.50488, 1.35439, false);
|
||||
}
|
||||
|
||||
// Quartic Authalic
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_qua_aut(Parameters& par, par_sts<T>& proj_parm)
|
||||
{
|
||||
setup(par, proj_parm, 2., 2., false);
|
||||
}
|
||||
|
||||
// McBryde-Thomas Flat-Polar Sine (No. 1)
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_mbt_s(Parameters& par, par_sts<T>& proj_parm)
|
||||
{
|
||||
setup(par, proj_parm, 1.48875, 1.36509, false);
|
||||
}
|
||||
|
||||
}} // namespace detail::sts
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Kavraisky V projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_kav5.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct kav5_spheroid : public detail::sts::base_sts_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline kav5_spheroid(Params const& , Parameters const& par)
|
||||
: detail::sts::base_sts_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::sts::setup_kav5(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Quartic Authalic projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_qua_aut.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct qua_aut_spheroid : public detail::sts::base_sts_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline qua_aut_spheroid(Params const& , Parameters const& par)
|
||||
: detail::sts::base_sts_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::sts::setup_qua_aut(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief McBryde-Thomas Flat-Polar Sine (No. 1) projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_mbt_s.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct mbt_s_spheroid : public detail::sts::base_sts_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline mbt_s_spheroid(Params const& , Parameters const& par)
|
||||
: detail::sts::base_sts_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::sts::setup_mbt_s(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Foucaut projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_fouc.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct fouc_spheroid : public detail::sts::base_sts_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline fouc_spheroid(Params const& , Parameters const& par)
|
||||
: detail::sts::base_sts_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::sts::setup_fouc(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_kav5, kav5_spheroid, kav5_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_qua_aut, qua_aut_spheroid, qua_aut_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_mbt_s, mbt_s_spheroid, mbt_s_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_fouc, fouc_spheroid, fouc_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(kav5_entry, kav5_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(qua_aut_entry, qua_aut_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(mbt_s_entry, mbt_s_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(fouc_entry, fouc_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(sts_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(kav5, kav5_entry)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(qua_aut, qua_aut_entry)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(mbt_s, mbt_s_entry)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(fouc, fouc_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_STS_HPP
|
||||
|
||||
146
linx64/include/boost/geometry/srs/projections/proj/tcc.hpp
Normal file
146
linx64/include/boost/geometry/srs/projections/proj/tcc.hpp
Normal file
@@ -0,0 +1,146 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_TCC_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_TCC_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace tcc
|
||||
{
|
||||
|
||||
static const double epsilon10 = 1.e-10;
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_tcc_spheroid
|
||||
: public base_t_f<base_tcc_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_tcc_spheroid(const Parameters& par)
|
||||
: base_t_f<base_tcc_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T b, bt;
|
||||
|
||||
b = cos(lp_lat) * sin(lp_lon);
|
||||
if ((bt = 1. - b * b) < epsilon10) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
xy_x = b / sqrt(bt);
|
||||
xy_y = atan2(tan(lp_lat) , cos(lp_lon));
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "tcc_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Transverse Central Cylindrical
|
||||
template <typename Parameters>
|
||||
inline void setup_tcc(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::tcc
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Transverse Central Cylindrical projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
- no inverse
|
||||
\par Example
|
||||
\image html ex_tcc.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct tcc_spheroid : public detail::tcc::base_tcc_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline tcc_spheroid(Params const& , Parameters const& par)
|
||||
: detail::tcc::base_tcc_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::tcc::setup_tcc(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_tcc, tcc_spheroid, tcc_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(tcc_entry, tcc_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(tcc_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(tcc, tcc_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_TCC_HPP
|
||||
|
||||
149
linx64/include/boost/geometry/srs/projections/proj/tcea.hpp
Normal file
149
linx64/include/boost/geometry/srs/projections/proj/tcea.hpp
Normal file
@@ -0,0 +1,149 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_TCEA_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_TCEA_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace tcea
|
||||
{
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_tcea_spheroid
|
||||
: public base_t_fi<base_tcea_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_tcea_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_tcea_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
xy_x = cos(lp_lat) * sin(lp_lon) / this->m_par.k0;
|
||||
xy_y = this->m_par.k0 * (atan2(tan(lp_lat), cos(lp_lon)) - this->m_par.phi0);
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
T t;
|
||||
|
||||
xy_y = xy_y / this->m_par.k0 + this->m_par.phi0;
|
||||
xy_x *= this->m_par.k0;
|
||||
t = sqrt(1. - xy_x * xy_x);
|
||||
lp_lat = asin(t * sin(xy_y));
|
||||
lp_lon = atan2(xy_x, t * cos(xy_y));
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "tcea_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Transverse Cylindrical Equal Area
|
||||
template <typename Parameters>
|
||||
inline void setup_tcea(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::tcea
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Transverse Cylindrical Equal Area projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_tcea.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct tcea_spheroid : public detail::tcea::base_tcea_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline tcea_spheroid(Params const& , Parameters const& par)
|
||||
: detail::tcea::base_tcea_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::tcea::setup_tcea(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_tcea, tcea_spheroid, tcea_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(tcea_entry, tcea_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(tcea_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(tcea, tcea_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_TCEA_HPP
|
||||
|
||||
368
linx64/include/boost/geometry/srs/projections/proj/tmerc.hpp
Normal file
368
linx64/include/boost/geometry/srs/projections/proj/tmerc.hpp
Normal file
@@ -0,0 +1,368 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_TMERC_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_TMERC_HPP
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/function_overloads.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_mlfn.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace tmerc
|
||||
{
|
||||
|
||||
static const double epsilon10 = 1.e-10;
|
||||
|
||||
template <typename T>
|
||||
inline T FC1() { return 1.; }
|
||||
template <typename T>
|
||||
inline T FC2() { return .5; }
|
||||
template <typename T>
|
||||
inline T FC3() { return .16666666666666666666666666666666666666; }
|
||||
template <typename T>
|
||||
inline T FC4() { return .08333333333333333333333333333333333333; }
|
||||
template <typename T>
|
||||
inline T FC5() { return .05; }
|
||||
template <typename T>
|
||||
inline T FC6() { return .03333333333333333333333333333333333333; }
|
||||
template <typename T>
|
||||
inline T FC7() { return .02380952380952380952380952380952380952; }
|
||||
template <typename T>
|
||||
inline T FC8() { return .01785714285714285714285714285714285714; }
|
||||
|
||||
template <typename T>
|
||||
struct par_tmerc
|
||||
{
|
||||
T esp;
|
||||
T ml0;
|
||||
detail::en<T> en;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_tmerc_ellipsoid
|
||||
: public base_t_fi<base_tmerc_ellipsoid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_tmerc<T> m_proj_parm;
|
||||
|
||||
inline base_tmerc_ellipsoid(const Parameters& par)
|
||||
: base_t_fi<base_tmerc_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(e_forward) ellipse
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
static const T FC1 = tmerc::FC1<T>();
|
||||
static const T FC2 = tmerc::FC2<T>();
|
||||
static const T FC3 = tmerc::FC3<T>();
|
||||
static const T FC4 = tmerc::FC4<T>();
|
||||
static const T FC5 = tmerc::FC5<T>();
|
||||
static const T FC6 = tmerc::FC6<T>();
|
||||
static const T FC7 = tmerc::FC7<T>();
|
||||
static const T FC8 = tmerc::FC8<T>();
|
||||
|
||||
T al, als, n, cosphi, sinphi, t;
|
||||
|
||||
/*
|
||||
* 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_lon < -half_pi || lp_lon > half_pi )
|
||||
{
|
||||
xy_x = HUGE_VAL;
|
||||
xy_y = HUGE_VAL;
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_lat_or_lon_exceed_limit) );
|
||||
return;
|
||||
}
|
||||
|
||||
sinphi = sin(lp_lat);
|
||||
cosphi = cos(lp_lat);
|
||||
t = fabs(cosphi) > 1e-10 ? sinphi/cosphi : 0.;
|
||||
t *= t;
|
||||
al = cosphi * lp_lon;
|
||||
als = al * al;
|
||||
al /= sqrt(1. - this->m_par.es * sinphi * sinphi);
|
||||
n = this->m_proj_parm.esp * cosphi * cosphi;
|
||||
xy_x = this->m_par.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 = this->m_par.k0 * (pj_mlfn(lp_lat, sinphi, cosphi, this->m_proj_parm.en) - this->m_proj_parm.ml0 +
|
||||
sinphi * al * lp_lon * 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.) )
|
||||
))));
|
||||
}
|
||||
|
||||
// INVERSE(e_inverse) ellipsoid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
static const T FC1 = tmerc::FC1<T>();
|
||||
static const T FC2 = tmerc::FC2<T>();
|
||||
static const T FC3 = tmerc::FC3<T>();
|
||||
static const T FC4 = tmerc::FC4<T>();
|
||||
static const T FC5 = tmerc::FC5<T>();
|
||||
static const T FC6 = tmerc::FC6<T>();
|
||||
static const T FC7 = tmerc::FC7<T>();
|
||||
static const T FC8 = tmerc::FC8<T>();
|
||||
|
||||
T n, con, cosphi, d, ds, sinphi, t;
|
||||
|
||||
lp_lat = pj_inv_mlfn(this->m_proj_parm.ml0 + xy_y / this->m_par.k0, this->m_par.es, this->m_proj_parm.en);
|
||||
if (fabs(lp_lat) >= half_pi) {
|
||||
lp_lat = xy_y < 0. ? -half_pi : half_pi;
|
||||
lp_lon = 0.;
|
||||
} else {
|
||||
sinphi = sin(lp_lat);
|
||||
cosphi = cos(lp_lat);
|
||||
t = fabs(cosphi) > 1e-10 ? sinphi/cosphi : 0.;
|
||||
n = this->m_proj_parm.esp * cosphi * cosphi;
|
||||
d = xy_x * sqrt(con = 1. - this->m_par.es * sinphi * sinphi) / this->m_par.k0;
|
||||
con *= t;
|
||||
t *= t;
|
||||
ds = d * d;
|
||||
lp_lat -= (con * ds / (1.-this->m_par.es)) * FC2 * (1. -
|
||||
ds * FC4 * (5. + t * (3. - 9. * n) + n * (1. - 4 * n) -
|
||||
ds * FC6 * (61. + t * (90. - 252. * n +
|
||||
45. * t) + 46. * n
|
||||
- ds * FC8 * (1385. + t * (3633. + t * (4095. + 1574. * t)) )
|
||||
)));
|
||||
lp_lon = d*(FC1 -
|
||||
ds*FC3*( 1. + 2.*t + n -
|
||||
ds*FC5*(5. + t*(28. + 24.*t + 8.*n) + 6.*n
|
||||
- ds * FC7 * (61. + t * (662. + t * (1320. + 720. * t)) )
|
||||
))) / cosphi;
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "tmerc_ellipsoid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_tmerc_spheroid
|
||||
: public base_t_fi<base_tmerc_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_tmerc<T> m_proj_parm;
|
||||
|
||||
inline base_tmerc_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_tmerc_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) sphere
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
|
||||
T b, cosphi;
|
||||
|
||||
/*
|
||||
* 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_lon < -half_pi || lp_lon > half_pi )
|
||||
{
|
||||
xy_x = HUGE_VAL;
|
||||
xy_y = HUGE_VAL;
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_lat_or_lon_exceed_limit) );
|
||||
return;
|
||||
}
|
||||
|
||||
cosphi = cos(lp_lat);
|
||||
b = cosphi * sin(lp_lon);
|
||||
if (fabs(fabs(b) - 1.) <= epsilon10)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
|
||||
xy_x = this->m_proj_parm.ml0 * log((1. + b) / (1. - b));
|
||||
xy_y = cosphi * cos(lp_lon) / sqrt(1. - b * b);
|
||||
|
||||
b = fabs( xy_y );
|
||||
if (b >= 1.) {
|
||||
if ((b - 1.) > epsilon10)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
else xy_y = 0.;
|
||||
} else
|
||||
xy_y = acos(xy_y);
|
||||
|
||||
if (lp_lat < 0.)
|
||||
xy_y = -xy_y;
|
||||
xy_y = this->m_proj_parm.esp * (xy_y - this->m_par.phi0);
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) sphere
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
T h, g;
|
||||
|
||||
h = exp(xy_x / this->m_proj_parm.esp);
|
||||
g = .5 * (h - 1. / h);
|
||||
h = cos(this->m_par.phi0 + xy_y / this->m_proj_parm.esp);
|
||||
lp_lat = asin(sqrt((1. - h * h) / (1. + g * g)));
|
||||
|
||||
/* Make sure that phi is on the correct hemisphere when false northing is used */
|
||||
if (xy_y < 0. && -lp_lat+this->m_par.phi0 < 0.0) lp_lat = -lp_lat;
|
||||
|
||||
lp_lon = (g != 0.0 || h != 0.0) ? atan2(g, h) : 0.;
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "tmerc_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup(Parameters& par, par_tmerc<T>& proj_parm)
|
||||
{
|
||||
if (par.es != 0.0) {
|
||||
proj_parm.en = pj_enfn<T>(par.es);
|
||||
proj_parm.ml0 = pj_mlfn(par.phi0, sin(par.phi0), cos(par.phi0), proj_parm.en);
|
||||
proj_parm.esp = par.es / (1. - par.es);
|
||||
} else {
|
||||
proj_parm.esp = par.k0;
|
||||
proj_parm.ml0 = .5 * proj_parm.esp;
|
||||
}
|
||||
}
|
||||
|
||||
}} // namespace detail::tmerc
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Transverse Mercator projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Example
|
||||
\image html ex_tmerc.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct tmerc_ellipsoid : public detail::tmerc::base_tmerc_ellipsoid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline tmerc_ellipsoid(Params const&, Parameters const& par)
|
||||
: detail::tmerc::base_tmerc_ellipsoid<T, Parameters>(par)
|
||||
{
|
||||
detail::tmerc::setup(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Transverse Mercator projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Cylindrical
|
||||
- Spheroid
|
||||
- Ellipsoid
|
||||
\par Example
|
||||
\image html ex_tmerc.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct tmerc_spheroid : public detail::tmerc::base_tmerc_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline tmerc_spheroid(Params const&, Parameters const& par)
|
||||
: detail::tmerc::base_tmerc_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::tmerc::setup(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_tmerc, tmerc_spheroid, tmerc_ellipsoid)
|
||||
|
||||
// Factory entry(s) - dynamic projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI2(tmerc_entry, tmerc_spheroid, tmerc_ellipsoid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(tmerc_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(tmerc, tmerc_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_TMERC_HPP
|
||||
|
||||
223
linx64/include/boost/geometry/srs/projections/proj/tpeqd.hpp
Normal file
223
linx64/include/boost/geometry/srs/projections/proj/tpeqd.hpp
Normal file
@@ -0,0 +1,223 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_TPEQD_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_TPEQD_HPP
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
#include <boost/math/special_functions/hypot.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/aasincos.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace tpeqd
|
||||
{
|
||||
template <typename T>
|
||||
struct par_tpeqd
|
||||
{
|
||||
T cp1, sp1, cp2, sp2, ccs, cs, sc, r2z0, z02, dlam2;
|
||||
T hz0, thz0, rhshz0, ca, sa, lp, lamc;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_tpeqd_spheroid
|
||||
: public base_t_fi<base_tpeqd_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_tpeqd<T> m_proj_parm;
|
||||
|
||||
inline base_tpeqd_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_tpeqd_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) sphere
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T t, z1, z2, dl1, dl2, sp, cp;
|
||||
|
||||
sp = sin(lp_lat);
|
||||
cp = cos(lp_lat);
|
||||
z1 = aacos(this->m_proj_parm.sp1 * sp + this->m_proj_parm.cp1 * cp * cos(dl1 = lp_lon + this->m_proj_parm.dlam2));
|
||||
z2 = aacos(this->m_proj_parm.sp2 * sp + this->m_proj_parm.cp2 * cp * cos(dl2 = lp_lon - this->m_proj_parm.dlam2));
|
||||
z1 *= z1;
|
||||
z2 *= z2;
|
||||
|
||||
xy_x = this->m_proj_parm.r2z0 * (t = z1 - z2);
|
||||
t = this->m_proj_parm.z02 - t;
|
||||
xy_y = this->m_proj_parm.r2z0 * asqrt(4. * this->m_proj_parm.z02 * z2 - t * t);
|
||||
if ((this->m_proj_parm.ccs * sp - cp * (this->m_proj_parm.cs * sin(dl1) - this->m_proj_parm.sc * sin(dl2))) < 0.)
|
||||
xy_y = -xy_y;
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) sphere
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
T cz1, cz2, s, d, cp, sp;
|
||||
|
||||
cz1 = cos(boost::math::hypot(xy_y, xy_x + this->m_proj_parm.hz0));
|
||||
cz2 = cos(boost::math::hypot(xy_y, xy_x - this->m_proj_parm.hz0));
|
||||
s = cz1 + cz2;
|
||||
d = cz1 - cz2;
|
||||
lp_lon = - atan2(d, (s * this->m_proj_parm.thz0));
|
||||
lp_lat = aacos(boost::math::hypot(this->m_proj_parm.thz0 * s, d) * this->m_proj_parm.rhshz0);
|
||||
if ( xy_y < 0. )
|
||||
lp_lat = - lp_lat;
|
||||
/* lam--phi now in system relative to P1--P2 base equator */
|
||||
sp = sin(lp_lat);
|
||||
cp = cos(lp_lat);
|
||||
lp_lat = aasin(this->m_proj_parm.sa * sp + this->m_proj_parm.ca * cp * (s = cos(lp_lon -= this->m_proj_parm.lp)));
|
||||
lp_lon = atan2(cp * sin(lp_lon), this->m_proj_parm.sa * cp * s - this->m_proj_parm.ca * sp) + this->m_proj_parm.lamc;
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "tpeqd_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Two Point Equidistant
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_tpeqd(Params const& params, Parameters& par, par_tpeqd<T>& proj_parm)
|
||||
{
|
||||
T lam_1, lam_2, phi_1, phi_2, A12, pp;
|
||||
|
||||
/* get control point locations */
|
||||
phi_1 = pj_get_param_r<T, srs::spar::lat_1>(params, "lat_1", srs::dpar::lat_1);
|
||||
lam_1 = pj_get_param_r<T, srs::spar::lon_1>(params, "lon_1", srs::dpar::lon_1);
|
||||
phi_2 = pj_get_param_r<T, srs::spar::lat_2>(params, "lat_2", srs::dpar::lat_2);
|
||||
lam_2 = pj_get_param_r<T, srs::spar::lon_2>(params, "lon_2", srs::dpar::lon_2);
|
||||
|
||||
if (phi_1 == phi_2 && lam_1 == lam_2)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_control_point_no_dist) );
|
||||
|
||||
par.lam0 = adjlon(0.5 * (lam_1 + lam_2));
|
||||
proj_parm.dlam2 = adjlon(lam_2 - lam_1);
|
||||
|
||||
proj_parm.cp1 = cos(phi_1);
|
||||
proj_parm.cp2 = cos(phi_2);
|
||||
proj_parm.sp1 = sin(phi_1);
|
||||
proj_parm.sp2 = sin(phi_2);
|
||||
proj_parm.cs = proj_parm.cp1 * proj_parm.sp2;
|
||||
proj_parm.sc = proj_parm.sp1 * proj_parm.cp2;
|
||||
proj_parm.ccs = proj_parm.cp1 * proj_parm.cp2 * sin(proj_parm.dlam2);
|
||||
proj_parm.z02 = aacos(proj_parm.sp1 * proj_parm.sp2 + proj_parm.cp1 * proj_parm.cp2 * cos(proj_parm.dlam2));
|
||||
proj_parm.hz0 = .5 * proj_parm.z02;
|
||||
A12 = atan2(proj_parm.cp2 * sin(proj_parm.dlam2),
|
||||
proj_parm.cp1 * proj_parm.sp2 - proj_parm.sp1 * proj_parm.cp2 * cos(proj_parm.dlam2));
|
||||
proj_parm.ca = cos(pp = aasin(proj_parm.cp1 * sin(A12)));
|
||||
proj_parm.sa = sin(pp);
|
||||
proj_parm.lp = adjlon(atan2(proj_parm.cp1 * cos(A12), proj_parm.sp1) - proj_parm.hz0);
|
||||
proj_parm.dlam2 *= .5;
|
||||
proj_parm.lamc = geometry::math::half_pi<T>() - atan2(sin(A12) * proj_parm.sp1, cos(A12)) - proj_parm.dlam2;
|
||||
proj_parm.thz0 = tan(proj_parm.hz0);
|
||||
proj_parm.rhshz0 = .5 / sin(proj_parm.hz0);
|
||||
proj_parm.r2z0 = 0.5 / proj_parm.z02;
|
||||
proj_parm.z02 *= proj_parm.z02;
|
||||
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::tpeqd
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Two Point Equidistant projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
\par Projection parameters
|
||||
- lat_1: Latitude of first standard parallel (degrees)
|
||||
- lon_1 (degrees)
|
||||
- lat_2: Latitude of second standard parallel (degrees)
|
||||
- lon_2 (degrees)
|
||||
\par Example
|
||||
\image html ex_tpeqd.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct tpeqd_spheroid : public detail::tpeqd::base_tpeqd_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline tpeqd_spheroid(Params const& params, Parameters const& par)
|
||||
: detail::tpeqd::base_tpeqd_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::tpeqd::setup_tpeqd(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_tpeqd, tpeqd_spheroid, tpeqd_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(tpeqd_entry, tpeqd_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(tpeqd_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(tpeqd, tpeqd_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_TPEQD_HPP
|
||||
|
||||
169
linx64/include/boost/geometry/srs/projections/proj/urm5.hpp
Normal file
169
linx64/include/boost/geometry/srs/projections/proj/urm5.hpp
Normal file
@@ -0,0 +1,169 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_URM5_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_URM5_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/aasincos.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace urm5
|
||||
{
|
||||
template <typename T>
|
||||
struct par_urm5
|
||||
{
|
||||
T m, rmn, q3, n;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_urm5_spheroid
|
||||
: public base_t_f<base_urm5_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_urm5<T> m_proj_parm;
|
||||
|
||||
inline base_urm5_spheroid(const Parameters& par)
|
||||
: base_t_f<base_urm5_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T t;
|
||||
|
||||
t = lp_lat = aasin(this->m_proj_parm.n * sin(lp_lat));
|
||||
xy_x = this->m_proj_parm.m * lp_lon * cos(lp_lat);
|
||||
t *= t;
|
||||
xy_y = lp_lat * (1. + t * this->m_proj_parm.q3) * this->m_proj_parm.rmn;
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "urm5_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Urmaev V
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_urm5(Params const& params, Parameters& par, par_urm5<T>& proj_parm)
|
||||
{
|
||||
T alpha, t;
|
||||
|
||||
if (pj_param_f<srs::spar::n>(params, "n", srs::dpar::n, proj_parm.n)) {
|
||||
if (proj_parm.n <= 0. || proj_parm.n > 1.)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_n_out_of_range) );
|
||||
} else {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_n_out_of_range) );
|
||||
}
|
||||
proj_parm.q3 = pj_get_param_f<T, srs::spar::q>(params, "q", srs::dpar::q) / 3.;
|
||||
alpha = pj_get_param_r<T, srs::spar::alpha>(params, "alpha", srs::dpar::alpha);
|
||||
t = proj_parm.n * sin(alpha);
|
||||
proj_parm.m = cos(alpha) / sqrt(1. - t * t);
|
||||
proj_parm.rmn = 1. / (proj_parm.m * proj_parm.n);
|
||||
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::urm5
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Urmaev V projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
- no inverse
|
||||
\par Projection parameters
|
||||
- n (real)
|
||||
- q (real)
|
||||
- alpha: Alpha (degrees)
|
||||
\par Example
|
||||
\image html ex_urm5.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct urm5_spheroid : public detail::urm5::base_urm5_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline urm5_spheroid(Params const& params, Parameters const& par)
|
||||
: detail::urm5::base_urm5_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::urm5::setup_urm5(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_urm5, urm5_spheroid, urm5_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(urm5_entry, urm5_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(urm5_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(urm5, urm5_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_URM5_HPP
|
||||
|
||||
210
linx64/include/boost/geometry/srs/projections/proj/urmfps.hpp
Normal file
210
linx64/include/boost/geometry/srs/projections/proj/urmfps.hpp
Normal file
@@ -0,0 +1,210 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_URMFPS_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_URMFPS_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/aasincos.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace urmfps
|
||||
{
|
||||
|
||||
static const double C_x = 0.8773826753;
|
||||
static const double Cy = 1.139753528477;
|
||||
|
||||
template <typename T>
|
||||
struct par_urmfps
|
||||
{
|
||||
T n, C_y;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_urmfps_spheroid
|
||||
: public base_t_fi<base_urmfps_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_urmfps<T> m_proj_parm;
|
||||
|
||||
inline base_urmfps_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_urmfps_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) sphere
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
lp_lat = aasin(this->m_proj_parm.n * sin(lp_lat));
|
||||
xy_x = C_x * lp_lon * cos(lp_lat);
|
||||
xy_y = this->m_proj_parm.C_y * lp_lat;
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) sphere
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
xy_y /= this->m_proj_parm.C_y;
|
||||
lp_lat = aasin(sin(xy_y) / this->m_proj_parm.n);
|
||||
lp_lon = xy_x / (C_x * cos(xy_y));
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "urmfps_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup(Parameters& par, par_urmfps<T>& proj_parm)
|
||||
{
|
||||
proj_parm.C_y = Cy / proj_parm.n;
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
|
||||
// Urmaev Flat-Polar Sinusoidal
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_urmfps(Params const& params, Parameters& par, par_urmfps<T>& proj_parm)
|
||||
{
|
||||
if (pj_param_f<srs::spar::n>(params, "n", srs::dpar::n, proj_parm.n)) {
|
||||
if (proj_parm.n <= 0. || proj_parm.n > 1.)
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_n_out_of_range) );
|
||||
} else
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_n_out_of_range) );
|
||||
|
||||
setup(par, proj_parm);
|
||||
}
|
||||
|
||||
// Wagner I (Kavraisky VI)
|
||||
template <typename Parameters, typename T>
|
||||
inline void setup_wag1(Parameters& par, par_urmfps<T>& proj_parm)
|
||||
{
|
||||
proj_parm.n = 0.8660254037844386467637231707;
|
||||
setup(par, proj_parm);
|
||||
}
|
||||
|
||||
}} // namespace detail::urmfps
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Urmaev Flat-Polar Sinusoidal projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Projection parameters
|
||||
- n (real)
|
||||
\par Example
|
||||
\image html ex_urmfps.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct urmfps_spheroid : public detail::urmfps::base_urmfps_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline urmfps_spheroid(Params const& params, Parameters const& par)
|
||||
: detail::urmfps::base_urmfps_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::urmfps::setup_urmfps(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Wagner I (Kavraisky VI) projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_wag1.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct wag1_spheroid : public detail::urmfps::base_urmfps_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline wag1_spheroid(Params const& , Parameters const& par)
|
||||
: detail::urmfps::base_urmfps_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::urmfps::setup_wag1(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_urmfps, urmfps_spheroid, urmfps_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_wag1, wag1_spheroid, wag1_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(urmfps_entry, urmfps_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(wag1_entry, wag1_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(urmfps_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(urmfps, urmfps_entry)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(wag1, wag1_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_URMFPS_HPP
|
||||
|
||||
234
linx64/include/boost/geometry/srs/projections/proj/vandg.hpp
Normal file
234
linx64/include/boost/geometry/srs/projections/proj/vandg.hpp
Normal file
@@ -0,0 +1,234 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017, 2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_VANDG_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_VANDG_HPP
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace vandg
|
||||
{
|
||||
|
||||
static const double tolerance = 1.e-10;
|
||||
|
||||
template <typename T>
|
||||
inline T C2_27() { return .07407407407407407407407407407407; }
|
||||
template <typename T>
|
||||
inline T PI4_3() { return boost::math::constants::four_thirds_pi<T>(); }
|
||||
template <typename T>
|
||||
inline T TPISQ() { return 19.739208802178717237668981999752; }
|
||||
template <typename T>
|
||||
inline T HPISQ() { return 4.9348022005446793094172454999381; }
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_vandg_spheroid
|
||||
: public base_t_fi<base_vandg_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_vandg_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_vandg_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
static const T pi = detail::pi<T>();
|
||||
|
||||
T al, al2, g, g2, p2;
|
||||
|
||||
p2 = fabs(lp_lat / half_pi);
|
||||
if ((p2 - tolerance) > 1.) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
if (p2 > 1.)
|
||||
p2 = 1.;
|
||||
if (fabs(lp_lat) <= tolerance) {
|
||||
xy_x = lp_lon;
|
||||
xy_y = 0.;
|
||||
} else if (fabs(lp_lon) <= tolerance || fabs(p2 - 1.) < tolerance) {
|
||||
xy_x = 0.;
|
||||
xy_y = pi * tan(.5 * asin(p2));
|
||||
if (lp_lat < 0.) xy_y = -xy_y;
|
||||
} else {
|
||||
al = .5 * fabs(pi / lp_lon - lp_lon / pi);
|
||||
al2 = al * al;
|
||||
g = sqrt(1. - p2 * p2);
|
||||
g = g / (p2 + g - 1.);
|
||||
g2 = g * g;
|
||||
p2 = g * (2. / p2 - 1.);
|
||||
p2 = p2 * p2;
|
||||
xy_x = g - p2; g = p2 + al2;
|
||||
xy_x = pi * (al * xy_x + sqrt(al2 * xy_x * xy_x - g * (g2 - p2))) / g;
|
||||
if (lp_lon < 0.) xy_x = -xy_x;
|
||||
xy_y = fabs(xy_x / pi);
|
||||
xy_y = 1. - xy_y * (xy_y + 2. * al);
|
||||
if (xy_y < -tolerance) {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
if (xy_y < 0.)
|
||||
xy_y = 0.;
|
||||
else
|
||||
xy_y = sqrt(xy_y) * (lp_lat < 0. ? -pi : pi);
|
||||
}
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
static const T pi = detail::pi<T>();
|
||||
static const T pi_sqr = detail::pi_sqr<T>();
|
||||
static const T third = detail::third<T>();
|
||||
static const T two_pi = detail::two_pi<T>();
|
||||
|
||||
static const T C2_27 = vandg::C2_27<T>();
|
||||
static const T PI4_3 = vandg::PI4_3<T>();
|
||||
static const T TPISQ = vandg::TPISQ<T>();
|
||||
static const T HPISQ = vandg::HPISQ<T>();
|
||||
|
||||
T t, c0, c1, c2, c3, al, r2, r, m, d, ay, x2, y2;
|
||||
|
||||
x2 = xy_x * xy_x;
|
||||
if ((ay = fabs(xy_y)) < tolerance) {
|
||||
lp_lat = 0.;
|
||||
t = x2 * x2 + TPISQ * (x2 + HPISQ);
|
||||
lp_lon = fabs(xy_x) <= tolerance ? 0. :
|
||||
.5 * (x2 - pi_sqr + sqrt(t)) / xy_x;
|
||||
return;
|
||||
}
|
||||
y2 = xy_y * xy_y;
|
||||
r = x2 + y2; r2 = r * r;
|
||||
c1 = - pi * ay * (r + pi_sqr);
|
||||
c3 = r2 + two_pi * (ay * r + pi * (y2 + pi * (ay + half_pi)));
|
||||
c2 = c1 + pi_sqr * (r - 3. * y2);
|
||||
c0 = pi * ay;
|
||||
c2 /= c3;
|
||||
al = c1 / c3 - third * c2 * c2;
|
||||
m = 2. * sqrt(-third * al);
|
||||
d = C2_27 * c2 * c2 * c2 + (c0 * c0 - third * c2 * c1) / c3;
|
||||
if (((t = fabs(d = 3. * d / (al * m))) - tolerance) <= 1.) {
|
||||
d = t > 1. ? (d > 0. ? 0. : pi) : acos(d);
|
||||
lp_lat = pi * (m * cos(d * third + PI4_3) - third * c2);
|
||||
if (xy_y < 0.) lp_lat = -lp_lat;
|
||||
t = r2 + TPISQ * (x2 - y2 + HPISQ);
|
||||
lp_lon = fabs(xy_x) <= tolerance ? 0. :
|
||||
.5 * (r - pi_sqr + (t <= 0. ? 0. : sqrt(t))) / xy_x;
|
||||
} else {
|
||||
BOOST_THROW_EXCEPTION( projection_exception(error_tolerance_condition) );
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "vandg_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// van der Grinten (I)
|
||||
template <typename Parameters>
|
||||
inline void setup_vandg(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::vandg
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief van der Grinten (I) projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_vandg.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct vandg_spheroid : public detail::vandg::base_vandg_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline vandg_spheroid(Params const& , Parameters const& par)
|
||||
: detail::vandg::base_vandg_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::vandg::setup_vandg(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_vandg, vandg_spheroid, vandg_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(vandg_entry, vandg_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(vandg_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(vandg, vandg_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_VANDG_HPP
|
||||
|
||||
209
linx64/include/boost/geometry/srs/projections/proj/vandg2.hpp
Normal file
209
linx64/include/boost/geometry/srs/projections/proj/vandg2.hpp
Normal file
@@ -0,0 +1,209 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_VANDG2_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_VANDG2_HPP
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace vandg2
|
||||
{
|
||||
|
||||
static const double tolerance = 1e-10;
|
||||
|
||||
struct par_vandg2
|
||||
{
|
||||
bool vdg3;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_vandg2_spheroid
|
||||
: public base_t_f<base_vandg2_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_vandg2 m_proj_parm;
|
||||
|
||||
inline base_vandg2_spheroid(const Parameters& par)
|
||||
: base_t_f<base_vandg2_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T pi = detail::pi<T>();
|
||||
static const T two_div_pi = detail::two_div_pi<T>();
|
||||
|
||||
T x1, at, bt, ct;
|
||||
|
||||
bt = fabs(two_div_pi * lp_lat);
|
||||
if ((ct = 1. - bt * bt) < 0.)
|
||||
ct = 0.;
|
||||
else
|
||||
ct = sqrt(ct);
|
||||
if (fabs(lp_lon) < tolerance) {
|
||||
xy_x = 0.;
|
||||
xy_y = pi * (lp_lat < 0. ? -bt : bt) / (1. + ct);
|
||||
} else {
|
||||
at = 0.5 * fabs(pi / lp_lon - lp_lon / pi);
|
||||
if (this->m_proj_parm.vdg3) {
|
||||
x1 = bt / (1. + ct);
|
||||
xy_x = pi * (sqrt(at * at + 1. - x1 * x1) - at);
|
||||
xy_y = pi * x1;
|
||||
} else {
|
||||
x1 = (ct * sqrt(1. + at * at) - at * ct * ct) /
|
||||
(1. + at * at * bt * bt);
|
||||
xy_x = pi * x1;
|
||||
xy_y = pi * sqrt(1. - x1 * (x1 + 2. * at) + tolerance);
|
||||
}
|
||||
if ( lp_lon < 0.) xy_x = -xy_x;
|
||||
if ( lp_lat < 0.) xy_y = -xy_y;
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "vandg2_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// van der Grinten II
|
||||
inline void setup_vandg2(par_vandg2& proj_parm)
|
||||
{
|
||||
proj_parm.vdg3 = false;
|
||||
}
|
||||
|
||||
// van der Grinten III
|
||||
template <typename Parameters>
|
||||
inline void setup_vandg3(Parameters& par, par_vandg2& proj_parm)
|
||||
{
|
||||
proj_parm.vdg3 = true;
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::vandg2
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief van der Grinten II projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
- no inverse
|
||||
\par Example
|
||||
\image html ex_vandg2.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct vandg2_spheroid : public detail::vandg2::base_vandg2_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline vandg2_spheroid(Params const& , Parameters const& par)
|
||||
: detail::vandg2::base_vandg2_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::vandg2::setup_vandg2(this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief van der Grinten III projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
- no inverse
|
||||
\par Example
|
||||
\image html ex_vandg3.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct vandg3_spheroid : public detail::vandg2::base_vandg2_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline vandg3_spheroid(Params const& , Parameters const& par)
|
||||
: detail::vandg2::base_vandg2_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::vandg2::setup_vandg3(this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_vandg2, vandg2_spheroid, vandg2_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_vandg3, vandg3_spheroid, vandg3_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(vandg2_entry, vandg2_spheroid)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(vandg3_entry, vandg3_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(vandg2_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(vandg2, vandg2_entry)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(vandg3, vandg3_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_VANDG2_HPP
|
||||
|
||||
174
linx64/include/boost/geometry/srs/projections/proj/vandg4.hpp
Normal file
174
linx64/include/boost/geometry/srs/projections/proj/vandg4.hpp
Normal file
@@ -0,0 +1,174 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_VANDG4_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_VANDG4_HPP
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace vandg4
|
||||
{
|
||||
|
||||
static const double tolerance = 1e-10;
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_vandg4_spheroid
|
||||
: public base_t_f<base_vandg4_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_vandg4_spheroid(const Parameters& par)
|
||||
: base_t_f<base_vandg4_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
static const T two_div_pi = detail::two_div_pi<T>();
|
||||
|
||||
T x1, t, bt, ct, ft, bt2, ct2, dt, dt2;
|
||||
|
||||
if (fabs(lp_lat) < tolerance) {
|
||||
xy_x = lp_lon;
|
||||
xy_y = 0.;
|
||||
} else if (fabs(lp_lon) < tolerance || fabs(fabs(lp_lat) - half_pi) < tolerance) {
|
||||
xy_x = 0.;
|
||||
xy_y = lp_lat;
|
||||
} else {
|
||||
bt = fabs(two_div_pi * lp_lat);
|
||||
bt2 = bt * bt;
|
||||
ct = 0.5 * (bt * (8. - bt * (2. + bt2)) - 5.)
|
||||
/ (bt2 * (bt - 1.));
|
||||
ct2 = ct * ct;
|
||||
dt = two_div_pi * lp_lon;
|
||||
dt = dt + 1. / dt;
|
||||
dt = sqrt(dt * dt - 4.);
|
||||
if ((fabs(lp_lon) - half_pi) < 0.) dt = -dt;
|
||||
dt2 = dt * dt;
|
||||
x1 = bt + ct; x1 *= x1;
|
||||
t = bt + 3.*ct;
|
||||
ft = x1 * (bt2 + ct2 * dt2 - 1.) + (1.-bt2) * (
|
||||
bt2 * (t * t + 4. * ct2) +
|
||||
ct2 * (12. * bt * ct + 4. * ct2) );
|
||||
x1 = (dt*(x1 + ct2 - 1.) + 2.*sqrt(ft)) /
|
||||
(4.* x1 + dt2);
|
||||
xy_x = half_pi * x1;
|
||||
xy_y = half_pi * sqrt(1. + dt * fabs(x1) - x1 * x1);
|
||||
if (lp_lon < 0.) xy_x = -xy_x;
|
||||
if (lp_lat < 0.) xy_y = -xy_y;
|
||||
}
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "vandg4_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// van der Grinten IV
|
||||
template <typename Parameters>
|
||||
inline void setup_vandg4(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::vandg4
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief van der Grinten IV projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
- no inverse
|
||||
\par Example
|
||||
\image html ex_vandg4.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct vandg4_spheroid : public detail::vandg4::base_vandg4_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline vandg4_spheroid(Params const& , Parameters const& par)
|
||||
: detail::vandg4::base_vandg4_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::vandg4::setup_vandg4(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_vandg4, vandg4_spheroid, vandg4_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(vandg4_entry, vandg4_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(vandg4_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(vandg4, vandg4_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_VANDG4_HPP
|
||||
|
||||
153
linx64/include/boost/geometry/srs/projections/proj/wag2.hpp
Normal file
153
linx64/include/boost/geometry/srs/projections/proj/wag2.hpp
Normal file
@@ -0,0 +1,153 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_WAG2_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_WAG2_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/aasincos.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace wag2
|
||||
{
|
||||
|
||||
static const double C_x = 0.92483;
|
||||
static const double C_y = 1.38725;
|
||||
static const double C_p1 = 0.88022;
|
||||
static const double C_p2 = 0.88550;
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_wag2_spheroid
|
||||
: public base_t_fi<base_wag2_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_wag2_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_wag2_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
lp_lat = aasin(C_p1 * sin(C_p2 * lp_lat));
|
||||
xy_x = C_x * lp_lon * cos(lp_lat);
|
||||
xy_y = C_y * lp_lat;
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
lp_lat = xy_y / C_y;
|
||||
lp_lon = xy_x / (C_x * cos(lp_lat));
|
||||
lp_lat = aasin(sin(lp_lat) / C_p1) / C_p2;
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "wag2_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Wagner II
|
||||
template <typename Parameters>
|
||||
inline void setup_wag2(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::wag2
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Wagner II projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Example
|
||||
\image html ex_wag2.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct wag2_spheroid : public detail::wag2::base_wag2_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline wag2_spheroid(Params const& , Parameters const& par)
|
||||
: detail::wag2::base_wag2_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::wag2::setup_wag2(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_wag2, wag2_spheroid, wag2_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(wag2_entry, wag2_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(wag2_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(wag2, wag2_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_WAG2_HPP
|
||||
|
||||
161
linx64/include/boost/geometry/srs/projections/proj/wag3.hpp
Normal file
161
linx64/include/boost/geometry/srs/projections/proj/wag3.hpp
Normal file
@@ -0,0 +1,161 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_WAG3_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_WAG3_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace wag3
|
||||
{
|
||||
template <typename T>
|
||||
struct par_wag3
|
||||
{
|
||||
T C_x;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_wag3_spheroid
|
||||
: public base_t_fi<base_wag3_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
par_wag3<T> m_proj_parm;
|
||||
|
||||
inline base_wag3_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_wag3_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T two_thirds = detail::two_thirds<T>();
|
||||
|
||||
xy_x = this->m_proj_parm.C_x * lp_lon * cos(two_thirds * lp_lat);
|
||||
xy_y = lp_lat;
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
static const T two_thirds = detail::two_thirds<T>();
|
||||
|
||||
lp_lat = xy_y;
|
||||
lp_lon = xy_x / (this->m_proj_parm.C_x * cos(two_thirds * lp_lat));
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "wag3_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Wagner III
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_wag3(Params const& params, Parameters& par, par_wag3<T>& proj_parm)
|
||||
{
|
||||
T const ts = pj_get_param_r<T, srs::spar::lat_ts>(params, "lat_ts", srs::dpar::lat_ts);
|
||||
proj_parm.C_x = cos(ts) / cos(2.*ts/3.);
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::wag3
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Wagner III projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Projection parameters
|
||||
- lat_ts: Latitude of true scale (degrees)
|
||||
\par Example
|
||||
\image html ex_wag3.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct wag3_spheroid : public detail::wag3::base_wag3_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline wag3_spheroid(Params const& params, Parameters const& par)
|
||||
: detail::wag3::base_wag3_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::wag3::setup_wag3(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_wag3, wag3_spheroid, wag3_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(wag3_entry, wag3_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(wag3_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(wag3, wag3_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_WAG3_HPP
|
||||
|
||||
142
linx64/include/boost/geometry/srs/projections/proj/wag7.hpp
Normal file
142
linx64/include/boost/geometry/srs/projections/proj/wag7.hpp
Normal file
@@ -0,0 +1,142 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_WAG7_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_WAG7_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace wag7
|
||||
{
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_wag7_spheroid
|
||||
: public base_t_f<base_wag7_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
inline base_wag7_spheroid(const Parameters& par)
|
||||
: base_t_f<base_wag7_spheroid<T, Parameters>, T, Parameters>(*this, par)
|
||||
{}
|
||||
|
||||
// FORWARD(s_forward) sphere
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
T theta, ct, D;
|
||||
|
||||
theta = asin(xy_y = 0.90630778703664996 * sin(lp_lat));
|
||||
xy_x = 2.66723 * (ct = cos(theta)) * sin(lp_lon /= 3.);
|
||||
xy_y *= 1.24104 * (D = 1/(sqrt(0.5 * (1 + ct * cos(lp_lon)))));
|
||||
xy_x *= D;
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "wag7_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Wagner VII
|
||||
template <typename Parameters>
|
||||
inline void setup_wag7(Parameters& par)
|
||||
{
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::wag7
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Wagner VII projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Miscellaneous
|
||||
- Spheroid
|
||||
- no inverse
|
||||
\par Example
|
||||
\image html ex_wag7.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct wag7_spheroid : public detail::wag7::base_wag7_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline wag7_spheroid(Params const& , Parameters const& par)
|
||||
: detail::wag7::base_wag7_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::wag7::setup_wag7(this->m_par);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_wag7, wag7_spheroid, wag7_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(wag7_entry, wag7_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(wag7_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(wag7, wag7_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_WAG7_HPP
|
||||
|
||||
157
linx64/include/boost/geometry/srs/projections/proj/wink1.hpp
Normal file
157
linx64/include/boost/geometry/srs/projections/proj/wink1.hpp
Normal file
@@ -0,0 +1,157 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_WINK1_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_WINK1_HPP
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace wink1
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct par_wink1
|
||||
{
|
||||
T cosphi1;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_wink1_spheroid
|
||||
: public base_t_fi<base_wink1_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
|
||||
par_wink1<T> m_proj_parm;
|
||||
|
||||
inline base_wink1_spheroid(const Parameters& par)
|
||||
: base_t_fi<base_wink1_spheroid<T, Parameters>, T, Parameters>(*this, par) {}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
xy_x = .5 * lp_lon * (this->m_proj_parm.cosphi1 + cos(lp_lat));
|
||||
xy_y = lp_lat;
|
||||
}
|
||||
|
||||
// INVERSE(s_inverse) spheroid
|
||||
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
|
||||
inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
|
||||
{
|
||||
lp_lat = xy_y;
|
||||
lp_lon = 2. * xy_x / (this->m_proj_parm.cosphi1 + cos(lp_lat));
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "wink1_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Winkel I
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_wink1(Params const& params, Parameters& par, par_wink1<T>& proj_parm)
|
||||
{
|
||||
proj_parm.cosphi1 = cos(pj_get_param_r<T, srs::spar::lat_ts>(params, "lat_ts", srs::dpar::lat_ts));
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::wink1
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Winkel I projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
\par Projection parameters
|
||||
- lat_ts: Latitude of true scale (degrees)
|
||||
\par Example
|
||||
\image html ex_wink1.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct wink1_spheroid : public detail::wink1::base_wink1_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline wink1_spheroid(Params const& params, Parameters const& par)
|
||||
: detail::wink1::base_wink1_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::wink1::setup_wink1(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_wink1, wink1_spheroid, wink1_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(wink1_entry, wink1_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(wink1_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(wink1, wink1_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_WINK1_HPP
|
||||
|
||||
176
linx64/include/boost/geometry/srs/projections/proj/wink2.hpp
Normal file
176
linx64/include/boost/geometry/srs/projections/proj/wink2.hpp
Normal file
@@ -0,0 +1,176 @@
|
||||
// Boost.Geometry - gis-projections (based on PROJ4)
|
||||
|
||||
// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This file is converted from PROJ4, http://trac.osgeo.org/proj
|
||||
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
|
||||
// PROJ4 is maintained by Frank Warmerdam
|
||||
// PROJ4 is converted to Boost.Geometry by Barend Gehrels
|
||||
|
||||
// Last updated version of proj: 5.0.0
|
||||
|
||||
// Original copyright notice:
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_WINK2_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_WINK2_HPP
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
#include <boost/geometry/srs/projections/impl/base_static.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/pj_param.hpp>
|
||||
#include <boost/geometry/srs/projections/impl/projects.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace projections
|
||||
{
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace wink2
|
||||
{
|
||||
|
||||
static const int max_iter = 10;
|
||||
static const double loop_tol = 1e-7;
|
||||
|
||||
template <typename T>
|
||||
struct par_wink2
|
||||
{
|
||||
T cosphi1;
|
||||
};
|
||||
|
||||
// template class, using CRTP to implement forward/inverse
|
||||
template <typename T, typename Parameters>
|
||||
struct base_wink2_spheroid
|
||||
: public base_t_f<base_wink2_spheroid<T, Parameters>, T, Parameters>
|
||||
{
|
||||
|
||||
par_wink2<T> m_proj_parm;
|
||||
|
||||
inline base_wink2_spheroid(const Parameters& par)
|
||||
: base_t_f<base_wink2_spheroid<T, Parameters>, T, Parameters>(*this, par) {}
|
||||
|
||||
// FORWARD(s_forward) spheroid
|
||||
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
|
||||
inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const
|
||||
{
|
||||
static const T pi = detail::pi<T>();
|
||||
static const T half_pi = detail::half_pi<T>();
|
||||
static const T fourth_pi = detail::fourth_pi<T>();
|
||||
static const T two_div_pi = detail::two_div_pi<T>();
|
||||
|
||||
T k, V;
|
||||
int i;
|
||||
|
||||
xy_y = lp_lat * two_div_pi;
|
||||
k = pi * sin(lp_lat);
|
||||
lp_lat *= 1.8;
|
||||
for (i = max_iter; i ; --i) {
|
||||
lp_lat -= V = (lp_lat + sin(lp_lat) - k) /
|
||||
(1. + cos(lp_lat));
|
||||
if (fabs(V) < loop_tol)
|
||||
break;
|
||||
}
|
||||
if (!i)
|
||||
lp_lat = (lp_lat < 0.) ? -half_pi : half_pi;
|
||||
else
|
||||
lp_lat *= 0.5;
|
||||
xy_x = 0.5 * lp_lon * (cos(lp_lat) + this->m_proj_parm.cosphi1);
|
||||
xy_y = fourth_pi * (sin(lp_lat) + xy_y);
|
||||
}
|
||||
|
||||
static inline std::string get_name()
|
||||
{
|
||||
return "wink2_spheroid";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Winkel II
|
||||
template <typename Params, typename Parameters, typename T>
|
||||
inline void setup_wink2(Params const& params, Parameters& par, par_wink2<T>& proj_parm)
|
||||
{
|
||||
proj_parm.cosphi1 = cos(pj_get_param_r<T, srs::spar::lat_1>(params, "lat_1", srs::dpar::lat_1));
|
||||
par.es = 0.;
|
||||
}
|
||||
|
||||
}} // namespace detail::wink2
|
||||
#endif // doxygen
|
||||
|
||||
/*!
|
||||
\brief Winkel II projection
|
||||
\ingroup projections
|
||||
\tparam Geographic latlong point type
|
||||
\tparam Cartesian xy point type
|
||||
\tparam Parameters parameter type
|
||||
\par Projection characteristics
|
||||
- Pseudocylindrical
|
||||
- Spheroid
|
||||
- no inverse
|
||||
\par Projection parameters
|
||||
- lat_1: Latitude of first standard parallel (degrees)
|
||||
\par Example
|
||||
\image html ex_wink2.gif
|
||||
*/
|
||||
template <typename T, typename Parameters>
|
||||
struct wink2_spheroid : public detail::wink2::base_wink2_spheroid<T, Parameters>
|
||||
{
|
||||
template <typename Params>
|
||||
inline wink2_spheroid(Params const& params, Parameters const& par)
|
||||
: detail::wink2::base_wink2_spheroid<T, Parameters>(par)
|
||||
{
|
||||
detail::wink2::setup_wink2(params, this->m_par, this->m_proj_parm);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Static projection
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_wink2, wink2_spheroid, wink2_spheroid)
|
||||
|
||||
// Factory entry(s)
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_F(wink2_entry, wink2_spheroid)
|
||||
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(wink2_init)
|
||||
{
|
||||
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(wink2, wink2_entry)
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
#endif // doxygen
|
||||
|
||||
} // namespace projections
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_WINK2_HPP
|
||||
|
||||
Reference in New Issue
Block a user