]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/srs/projections/proj/eck3.hpp
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / boost / geometry / srs / projections / proj / eck3.hpp
1 #ifndef BOOST_GEOMETRY_PROJECTIONS_ECK3_HPP
2 #define BOOST_GEOMETRY_PROJECTIONS_ECK3_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.
10 // Modifications copyright (c) 2017, 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/core/ignore_unused.hpp>
45
46 #include <boost/geometry/srs/projections/impl/base_static.hpp>
47 #include <boost/geometry/srs/projections/impl/base_dynamic.hpp>
48 #include <boost/geometry/srs/projections/impl/projects.hpp>
49 #include <boost/geometry/srs/projections/impl/factory_entry.hpp>
50 #include <boost/geometry/srs/projections/impl/aasincos.hpp>
51
52 namespace boost { namespace geometry
53 {
54
55 namespace srs { namespace par4
56 {
57 struct eck3 {};
58 struct putp1 {};
59 struct wag6 {};
60 struct kav7 {};
61
62 }} //namespace srs::par4
63
64 namespace projections
65 {
66 #ifndef DOXYGEN_NO_DETAIL
67 namespace detail { namespace eck3
68 {
69
70 template <typename T>
71 struct par_eck3
72 {
73 T C_x, C_y, A, B;
74 };
75
76 // template class, using CRTP to implement forward/inverse
77 template <typename CalculationType, typename Parameters>
78 struct base_eck3_spheroid : public base_t_fi<base_eck3_spheroid<CalculationType, Parameters>,
79 CalculationType, Parameters>
80 {
81
82 typedef CalculationType geographic_type;
83 typedef CalculationType cartesian_type;
84
85 par_eck3<CalculationType> m_proj_parm;
86
87 inline base_eck3_spheroid(const Parameters& par)
88 : base_t_fi<base_eck3_spheroid<CalculationType, Parameters>,
89 CalculationType, Parameters>(*this, par) {}
90
91 // FORWARD(s_forward) spheroid
92 // Project coordinates from geographic (lon, lat) to cartesian (x, y)
93 inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
94 {
95 xy_y = this->m_proj_parm.C_y * lp_lat;
96 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));
97 }
98
99 // INVERSE(s_inverse) spheroid
100 // Project coordinates from cartesian (x, y) to geographic (lon, lat)
101 inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
102 {
103 lp_lat = xy_y / this->m_proj_parm.C_y;
104 lp_lon = xy_x / (this->m_proj_parm.C_x * (this->m_proj_parm.A + asqrt(1. - this->m_proj_parm.B * lp_lat * lp_lat)));
105 }
106
107 static inline std::string get_name()
108 {
109 return "eck3_spheroid";
110 }
111
112 };
113
114 template <typename Parameters, typename T>
115 inline void setup(Parameters& par, par_eck3<T>& proj_parm)
116 {
117 boost::ignore_unused(proj_parm);
118 par.es = 0.;
119 }
120
121
122 // Eckert III
123 template <typename Parameters, typename T>
124 inline void setup_eck3(Parameters& par, par_eck3<T>& proj_parm)
125 {
126 proj_parm.C_x = .42223820031577120149;
127 proj_parm.C_y = .84447640063154240298;
128 proj_parm.A = 1.;
129 proj_parm.B = 0.4052847345693510857755;
130 setup(par, proj_parm);
131 }
132
133 // Putnins P1
134 template <typename Parameters, typename T>
135 inline void setup_putp1(Parameters& par, par_eck3<T>& proj_parm)
136 {
137 proj_parm.C_x = 1.89490;
138 proj_parm.C_y = 0.94745;
139 proj_parm.A = -0.5;
140 proj_parm.B = 0.30396355092701331433;
141 setup(par, proj_parm);
142 }
143
144 // Wagner VI
145 template <typename Parameters, typename T>
146 inline void setup_wag6(Parameters& par, par_eck3<T>& proj_parm)
147 {
148 proj_parm.C_x = proj_parm.C_y = 0.94745;
149 proj_parm.A = 0.;
150 proj_parm.B = 0.30396355092701331433;
151 setup(par, proj_parm);
152 }
153
154 // Kavraisky VII
155 template <typename Parameters, typename T>
156 inline void setup_kav7(Parameters& par, par_eck3<T>& proj_parm)
157 {
158 proj_parm.C_x = 0.2632401569273184856851;
159 proj_parm.C_x = 0.8660254037844;
160 proj_parm.C_y = 1.;
161 proj_parm.A = 0.;
162 proj_parm.B = 0.30396355092701331433;
163 setup(par, proj_parm);
164 }
165
166 }} // namespace detail::eck3
167 #endif // doxygen
168
169 /*!
170 \brief Eckert III projection
171 \ingroup projections
172 \tparam Geographic latlong point type
173 \tparam Cartesian xy point type
174 \tparam Parameters parameter type
175 \par Projection characteristics
176 - Pseudocylindrical
177 - Spheroid
178 \par Example
179 \image html ex_eck3.gif
180 */
181 template <typename CalculationType, typename Parameters>
182 struct eck3_spheroid : public detail::eck3::base_eck3_spheroid<CalculationType, Parameters>
183 {
184 inline eck3_spheroid(const Parameters& par) : detail::eck3::base_eck3_spheroid<CalculationType, Parameters>(par)
185 {
186 detail::eck3::setup_eck3(this->m_par, this->m_proj_parm);
187 }
188 };
189
190 /*!
191 \brief Putnins P1 projection
192 \ingroup projections
193 \tparam Geographic latlong point type
194 \tparam Cartesian xy point type
195 \tparam Parameters parameter type
196 \par Projection characteristics
197 - Pseudocylindrical
198 - Spheroid
199 \par Example
200 \image html ex_putp1.gif
201 */
202 template <typename CalculationType, typename Parameters>
203 struct putp1_spheroid : public detail::eck3::base_eck3_spheroid<CalculationType, Parameters>
204 {
205 inline putp1_spheroid(const Parameters& par) : detail::eck3::base_eck3_spheroid<CalculationType, Parameters>(par)
206 {
207 detail::eck3::setup_putp1(this->m_par, this->m_proj_parm);
208 }
209 };
210
211 /*!
212 \brief Wagner VI projection
213 \ingroup projections
214 \tparam Geographic latlong point type
215 \tparam Cartesian xy point type
216 \tparam Parameters parameter type
217 \par Projection characteristics
218 - Pseudocylindrical
219 - Spheroid
220 \par Example
221 \image html ex_wag6.gif
222 */
223 template <typename CalculationType, typename Parameters>
224 struct wag6_spheroid : public detail::eck3::base_eck3_spheroid<CalculationType, Parameters>
225 {
226 inline wag6_spheroid(const Parameters& par) : detail::eck3::base_eck3_spheroid<CalculationType, Parameters>(par)
227 {
228 detail::eck3::setup_wag6(this->m_par, this->m_proj_parm);
229 }
230 };
231
232 /*!
233 \brief Kavraisky VII projection
234 \ingroup projections
235 \tparam Geographic latlong point type
236 \tparam Cartesian xy point type
237 \tparam Parameters parameter type
238 \par Projection characteristics
239 - Pseudocylindrical
240 - Spheroid
241 \par Example
242 \image html ex_kav7.gif
243 */
244 template <typename CalculationType, typename Parameters>
245 struct kav7_spheroid : public detail::eck3::base_eck3_spheroid<CalculationType, Parameters>
246 {
247 inline kav7_spheroid(const Parameters& par) : detail::eck3::base_eck3_spheroid<CalculationType, Parameters>(par)
248 {
249 detail::eck3::setup_kav7(this->m_par, this->m_proj_parm);
250 }
251 };
252
253 #ifndef DOXYGEN_NO_DETAIL
254 namespace detail
255 {
256
257 // Static projection
258 BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::eck3, eck3_spheroid, eck3_spheroid)
259 BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::putp1, putp1_spheroid, putp1_spheroid)
260 BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::wag6, wag6_spheroid, wag6_spheroid)
261 BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::kav7, kav7_spheroid, kav7_spheroid)
262
263 // Factory entry(s)
264 template <typename CalculationType, typename Parameters>
265 class eck3_entry : public detail::factory_entry<CalculationType, Parameters>
266 {
267 public :
268 virtual base_v<CalculationType, Parameters>* create_new(const Parameters& par) const
269 {
270 return new base_v_fi<eck3_spheroid<CalculationType, Parameters>, CalculationType, Parameters>(par);
271 }
272 };
273
274 template <typename CalculationType, typename Parameters>
275 class putp1_entry : public detail::factory_entry<CalculationType, Parameters>
276 {
277 public :
278 virtual base_v<CalculationType, Parameters>* create_new(const Parameters& par) const
279 {
280 return new base_v_fi<putp1_spheroid<CalculationType, Parameters>, CalculationType, Parameters>(par);
281 }
282 };
283
284 template <typename CalculationType, typename Parameters>
285 class wag6_entry : public detail::factory_entry<CalculationType, Parameters>
286 {
287 public :
288 virtual base_v<CalculationType, Parameters>* create_new(const Parameters& par) const
289 {
290 return new base_v_fi<wag6_spheroid<CalculationType, Parameters>, CalculationType, Parameters>(par);
291 }
292 };
293
294 template <typename CalculationType, typename Parameters>
295 class kav7_entry : public detail::factory_entry<CalculationType, Parameters>
296 {
297 public :
298 virtual base_v<CalculationType, Parameters>* create_new(const Parameters& par) const
299 {
300 return new base_v_fi<kav7_spheroid<CalculationType, Parameters>, CalculationType, Parameters>(par);
301 }
302 };
303
304 template <typename CalculationType, typename Parameters>
305 inline void eck3_init(detail::base_factory<CalculationType, Parameters>& factory)
306 {
307 factory.add_to_factory("eck3", new eck3_entry<CalculationType, Parameters>);
308 factory.add_to_factory("putp1", new putp1_entry<CalculationType, Parameters>);
309 factory.add_to_factory("wag6", new wag6_entry<CalculationType, Parameters>);
310 factory.add_to_factory("kav7", new kav7_entry<CalculationType, Parameters>);
311 }
312
313 } // namespace detail
314 #endif // doxygen
315
316 } // namespace projections
317
318 }} // namespace boost::geometry
319
320 #endif // BOOST_GEOMETRY_PROJECTIONS_ECK3_HPP
321