1 #ifndef BOOST_GEOMETRY_PROJECTIONS_CRAST_HPP
2 #define BOOST_GEOMETRY_PROJECTIONS_CRAST_HPP
4 // Boost.Geometry - extensions-gis-projections (based on PROJ4)
5 // This file is automatically generated. DO NOT EDIT.
7 // Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
9 // This file was modified by Oracle on 2017.
10 // Modifications copyright (c) 2017, Oracle and/or its affiliates.
11 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
13 // Use, modification and distribution is subject to the Boost Software License,
14 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
15 // http://www.boost.org/LICENSE_1_0.txt)
17 // This file is converted from PROJ4, http://trac.osgeo.org/proj
18 // PROJ4 is originally written by Gerald Evenden (then of the USGS)
19 // PROJ4 is maintained by Frank Warmerdam
20 // PROJ4 is converted to Boost.Geometry by Barend Gehrels
22 // Last updated version of proj: 4.9.1
24 // Original copyright notice:
26 // Permission is hereby granted, free of charge, to any person obtaining a
27 // copy of this software and associated documentation files (the "Software"),
28 // to deal in the Software without restriction, including without limitation
29 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
30 // and/or sell copies of the Software, and to permit persons to whom the
31 // Software is furnished to do so, subject to the following conditions:
33 // The above copyright notice and this permission notice shall be included
34 // in all copies or substantial portions of the Software.
36 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
37 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
38 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
39 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
40 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
41 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
42 // DEALINGS IN THE SOFTWARE.
44 #include <boost/geometry/srs/projections/impl/base_static.hpp>
45 #include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
46 #include <boost/geometry/srs/projections/impl/projects.hpp>
47 #include <boost/geometry/srs/projections/impl/factory_entry.hpp>
49 namespace boost { namespace geometry
52 namespace srs { namespace par4
56 }} //namespace srs::par4
60 #ifndef DOXYGEN_NO_DETAIL
61 namespace detail { namespace crast
64 static const double XM = 0.97720502380583984317;
65 static const double RXM = 1.02332670794648848847;
66 static const double YM = 3.06998012383946546542;
67 static const double RYM = 0.32573500793527994772;
68 //static const double THIRD = 0.333333333333333333;
70 // template class, using CRTP to implement forward/inverse
71 template <typename CalculationType, typename Parameters>
72 struct base_crast_spheroid : public base_t_fi<base_crast_spheroid<CalculationType, Parameters>,
73 CalculationType, Parameters>
76 typedef CalculationType geographic_type;
77 typedef CalculationType cartesian_type;
80 inline base_crast_spheroid(const Parameters& par)
81 : base_t_fi<base_crast_spheroid<CalculationType, Parameters>,
82 CalculationType, Parameters>(*this, par) {}
84 // FORWARD(s_forward) spheroid
85 // Project coordinates from geographic (lon, lat) to cartesian (x, y)
86 inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
88 static const CalculationType THIRD = detail::THIRD<CalculationType>();
91 xy_x = XM * lp_lon * (2. * cos(lp_lat + lp_lat) - 1.);
92 xy_y = YM * sin(lp_lat);
95 // INVERSE(s_inverse) spheroid
96 // Project coordinates from cartesian (x, y) to geographic (lon, lat)
97 inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
99 static const CalculationType THIRD = detail::THIRD<CalculationType>();
101 lp_lat = 3. * asin(xy_y * RYM);
102 lp_lon = xy_x * RXM / (2. * cos((lp_lat + lp_lat) * THIRD) - 1);
105 static inline std::string get_name()
107 return "crast_spheroid";
112 // Craster Parabolic (Putnins P4)
113 template <typename Parameters>
114 inline void setup_crast(Parameters& par)
119 }} // namespace detail::crast
123 \brief Craster Parabolic (Putnins P4) projection
125 \tparam Geographic latlong point type
126 \tparam Cartesian xy point type
127 \tparam Parameters parameter type
128 \par Projection characteristics
132 \image html ex_crast.gif
134 template <typename CalculationType, typename Parameters>
135 struct crast_spheroid : public detail::crast::base_crast_spheroid<CalculationType, Parameters>
137 inline crast_spheroid(const Parameters& par) : detail::crast::base_crast_spheroid<CalculationType, Parameters>(par)
139 detail::crast::setup_crast(this->m_par);
143 #ifndef DOXYGEN_NO_DETAIL
148 BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::crast, crast_spheroid, crast_spheroid)
151 template <typename CalculationType, typename Parameters>
152 class crast_entry : public detail::factory_entry<CalculationType, Parameters>
155 virtual base_v<CalculationType, Parameters>* create_new(const Parameters& par) const
157 return new base_v_fi<crast_spheroid<CalculationType, Parameters>, CalculationType, Parameters>(par);
161 template <typename CalculationType, typename Parameters>
162 inline void crast_init(detail::base_factory<CalculationType, Parameters>& factory)
164 factory.add_to_factory("crast", new crast_entry<CalculationType, Parameters>);
167 } // namespace detail
170 } // namespace projections
172 }} // namespace boost::geometry
174 #endif // BOOST_GEOMETRY_PROJECTIONS_CRAST_HPP