]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/srs/projections/proj/putp5.hpp
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / boost / geometry / srs / projections / proj / putp5.hpp
1 #ifndef BOOST_GEOMETRY_PROJECTIONS_PUTP5_HPP
2 #define BOOST_GEOMETRY_PROJECTIONS_PUTP5_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
51 namespace boost { namespace geometry
52 {
53
54 namespace srs { namespace par4
55 {
56 struct putp5 {};
57 struct putp5p {};
58
59 }} //namespace srs::par4
60
61 namespace projections
62 {
63 #ifndef DOXYGEN_NO_DETAIL
64 namespace detail { namespace putp5
65 {
66
67 static const double C = 1.01346;
68 static const double D = 1.2158542;
69
70 template <typename T>
71 struct par_putp5
72 {
73 T A, B;
74 };
75
76 // template class, using CRTP to implement forward/inverse
77 template <typename CalculationType, typename Parameters>
78 struct base_putp5_spheroid : public base_t_fi<base_putp5_spheroid<CalculationType, Parameters>,
79 CalculationType, Parameters>
80 {
81
82 typedef CalculationType geographic_type;
83 typedef CalculationType cartesian_type;
84
85 par_putp5<CalculationType> m_proj_parm;
86
87 inline base_putp5_spheroid(const Parameters& par)
88 : base_t_fi<base_putp5_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_x = C * lp_lon * (this->m_proj_parm.A - this->m_proj_parm.B * sqrt(1. + D * lp_lat * lp_lat));
96 xy_y = C * 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 / C;
104 lp_lon = xy_x / (C * (this->m_proj_parm.A - this->m_proj_parm.B * sqrt(1. + D * lp_lat * lp_lat)));
105 }
106
107 static inline std::string get_name()
108 {
109 return "putp5_spheroid";
110 }
111
112 };
113
114 template <typename Parameters, typename T>
115 inline void setup(Parameters& par, par_putp5<T>& proj_parm)
116 {
117 boost::ignore_unused(proj_parm);
118 par.es = 0.;
119 }
120
121
122 // Putnins P5
123 template <typename Parameters, typename T>
124 inline void setup_putp5(Parameters& par, par_putp5<T>& proj_parm)
125 {
126 proj_parm.A = 2.;
127 proj_parm.B = 1.;
128 setup(par, proj_parm);
129 }
130
131 // Putnins P5'
132 template <typename Parameters, typename T>
133 inline void setup_putp5p(Parameters& par, par_putp5<T>& proj_parm)
134 {
135 proj_parm.A = 1.5;
136 proj_parm.B = 0.5;
137 setup(par, proj_parm);
138 }
139
140 }} // namespace detail::putp5
141 #endif // doxygen
142
143 /*!
144 \brief Putnins P5 projection
145 \ingroup projections
146 \tparam Geographic latlong point type
147 \tparam Cartesian xy point type
148 \tparam Parameters parameter type
149 \par Projection characteristics
150 - Pseudocylindrical
151 - Spheroid
152 \par Example
153 \image html ex_putp5.gif
154 */
155 template <typename CalculationType, typename Parameters>
156 struct putp5_spheroid : public detail::putp5::base_putp5_spheroid<CalculationType, Parameters>
157 {
158 inline putp5_spheroid(const Parameters& par) : detail::putp5::base_putp5_spheroid<CalculationType, Parameters>(par)
159 {
160 detail::putp5::setup_putp5(this->m_par, this->m_proj_parm);
161 }
162 };
163
164 /*!
165 \brief Putnins P5' projection
166 \ingroup projections
167 \tparam Geographic latlong point type
168 \tparam Cartesian xy point type
169 \tparam Parameters parameter type
170 \par Projection characteristics
171 - Pseudocylindrical
172 - Spheroid
173 \par Example
174 \image html ex_putp5p.gif
175 */
176 template <typename CalculationType, typename Parameters>
177 struct putp5p_spheroid : public detail::putp5::base_putp5_spheroid<CalculationType, Parameters>
178 {
179 inline putp5p_spheroid(const Parameters& par) : detail::putp5::base_putp5_spheroid<CalculationType, Parameters>(par)
180 {
181 detail::putp5::setup_putp5p(this->m_par, this->m_proj_parm);
182 }
183 };
184
185 #ifndef DOXYGEN_NO_DETAIL
186 namespace detail
187 {
188
189 // Static projection
190 BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::putp5, putp5_spheroid, putp5_spheroid)
191 BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::putp5p, putp5p_spheroid, putp5p_spheroid)
192
193 // Factory entry(s)
194 template <typename CalculationType, typename Parameters>
195 class putp5_entry : public detail::factory_entry<CalculationType, Parameters>
196 {
197 public :
198 virtual base_v<CalculationType, Parameters>* create_new(const Parameters& par) const
199 {
200 return new base_v_fi<putp5_spheroid<CalculationType, Parameters>, CalculationType, Parameters>(par);
201 }
202 };
203
204 template <typename CalculationType, typename Parameters>
205 class putp5p_entry : public detail::factory_entry<CalculationType, Parameters>
206 {
207 public :
208 virtual base_v<CalculationType, Parameters>* create_new(const Parameters& par) const
209 {
210 return new base_v_fi<putp5p_spheroid<CalculationType, Parameters>, CalculationType, Parameters>(par);
211 }
212 };
213
214 template <typename CalculationType, typename Parameters>
215 inline void putp5_init(detail::base_factory<CalculationType, Parameters>& factory)
216 {
217 factory.add_to_factory("putp5", new putp5_entry<CalculationType, Parameters>);
218 factory.add_to_factory("putp5p", new putp5p_entry<CalculationType, Parameters>);
219 }
220
221 } // namespace detail
222 #endif // doxygen
223
224 } // namespace projections
225
226 }} // namespace boost::geometry
227
228 #endif // BOOST_GEOMETRY_PROJECTIONS_PUTP5_HPP
229