]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/srs/projections/proj/goode.hpp
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / boost / geometry / srs / projections / proj / goode.hpp
1 #ifndef BOOST_GEOMETRY_PROJECTIONS_GOODE_HPP
2 #define BOOST_GEOMETRY_PROJECTIONS_GOODE_HPP
3
4 // Boost.Geometry - extensions-gis-projections (based on PROJ4)
5 // This file is automatically generated. DO NOT EDIT.
6
7 // Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
8
9 // This file was modified by Oracle on 2017, 2018.
10 // Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
11 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
12
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)
16
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
21
22 // Last updated version of proj: 4.9.1
23
24 // Original copyright notice:
25
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:
32
33 // The above copyright notice and this permission notice shall be included
34 // in all copies or substantial portions of the Software.
35
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.
43
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>
48 #include <boost/geometry/srs/projections/proj/gn_sinu.hpp>
49 #include <boost/geometry/srs/projections/proj/moll.hpp>
50
51 namespace boost { namespace geometry
52 {
53
54 namespace srs { namespace par4
55 {
56 struct goode {};
57
58 }} //namespace srs::par4
59
60 namespace projections
61 {
62 #ifndef DOXYGEN_NO_DETAIL
63 namespace detail { namespace goode
64 {
65
66 static const double Y_COR = 0.05280;
67 static const double PHI_LIM = .71093078197902358062;
68
69 template <typename CalculationType, typename Parameters>
70 struct par_goode
71 {
72 sinu_ellipsoid<CalculationType, Parameters> sinu;
73 moll_spheroid<CalculationType, Parameters> moll;
74
75 par_goode(const Parameters& par) : sinu(par), moll(par) {}
76 };
77
78 // template class, using CRTP to implement forward/inverse
79 template <typename CalculationType, typename Parameters>
80 struct base_goode_spheroid : public base_t_fi<base_goode_spheroid<CalculationType, Parameters>,
81 CalculationType, Parameters>
82 {
83
84 typedef CalculationType geographic_type;
85 typedef CalculationType cartesian_type;
86
87 par_goode<CalculationType, Parameters> m_proj_parm;
88
89 inline base_goode_spheroid(const Parameters& par)
90 : base_t_fi<base_goode_spheroid<CalculationType, Parameters>,
91 CalculationType, Parameters>(*this, par), m_proj_parm(par) {}
92
93 // FORWARD(s_forward) spheroid
94 // Project coordinates from geographic (lon, lat) to cartesian (x, y)
95 inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
96 {
97 if (fabs(lp_lat) <= PHI_LIM)
98 this->m_proj_parm.sinu.fwd(lp_lon, lp_lat, xy_x, xy_y);
99 else {
100 this->m_proj_parm.moll.fwd(lp_lon, lp_lat, xy_x, xy_y);
101 xy_y -= lp_lat >= 0.0 ? Y_COR : -Y_COR;
102 }
103 }
104
105 // INVERSE(s_inverse) spheroid
106 // Project coordinates from cartesian (x, y) to geographic (lon, lat)
107 inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
108 {
109 if (fabs(xy_y) <= PHI_LIM)
110 this->m_proj_parm.sinu.inv(xy_x, xy_y, lp_lon, lp_lat);
111 else {
112 xy_y += xy_y >= 0.0 ? Y_COR : -Y_COR;
113 this->m_proj_parm.moll.inv(xy_x, xy_y, lp_lon, lp_lat);
114 }
115 }
116
117 static inline std::string get_name()
118 {
119 return "goode_spheroid";
120 }
121
122 };
123
124 // Goode Homolosine
125 template <typename CalculationType, typename Parameters>
126 inline void setup_goode(Parameters& par, par_goode<CalculationType, Parameters>& /*proj_parm*/)
127 {
128 par.es = 0.;
129 }
130
131 }} // namespace detail::goode
132 #endif // doxygen
133
134 /*!
135 \brief Goode Homolosine projection
136 \ingroup projections
137 \tparam Geographic latlong point type
138 \tparam Cartesian xy point type
139 \tparam Parameters parameter type
140 \par Projection characteristics
141 - Pseudocylindrical
142 - Spheroid
143 \par Example
144 \image html ex_goode.gif
145 */
146 template <typename CalculationType, typename Parameters>
147 struct goode_spheroid : public detail::goode::base_goode_spheroid<CalculationType, Parameters>
148 {
149 inline goode_spheroid(const Parameters& par) : detail::goode::base_goode_spheroid<CalculationType, Parameters>(par)
150 {
151 detail::goode::setup_goode(this->m_par, this->m_proj_parm);
152 }
153 };
154
155 #ifndef DOXYGEN_NO_DETAIL
156 namespace detail
157 {
158
159 // Static projection
160 BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::goode, goode_spheroid, goode_spheroid)
161
162 // Factory entry(s)
163 template <typename CalculationType, typename Parameters>
164 class goode_entry : public detail::factory_entry<CalculationType, Parameters>
165 {
166 public :
167 virtual base_v<CalculationType, Parameters>* create_new(const Parameters& par) const
168 {
169 return new base_v_fi<goode_spheroid<CalculationType, Parameters>, CalculationType, Parameters>(par);
170 }
171 };
172
173 template <typename CalculationType, typename Parameters>
174 inline void goode_init(detail::base_factory<CalculationType, Parameters>& factory)
175 {
176 factory.add_to_factory("goode", new goode_entry<CalculationType, Parameters>);
177 }
178
179 } // namespace detail
180 #endif // doxygen
181
182 } // namespace projections
183
184 }} // namespace boost::geometry
185
186 #endif // BOOST_GEOMETRY_PROJECTIONS_GOODE_HPP
187