]>
Commit | Line | Data |
---|---|---|
1 | #ifndef BOOST_GEOMETRY_PROJECTIONS_PUTP4P_HPP | |
2 | #define BOOST_GEOMETRY_PROJECTIONS_PUTP4P_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 putp4p {}; | |
58 | struct weren {}; | |
59 | ||
60 | }} //namespace srs::par4 | |
61 | ||
62 | namespace projections | |
63 | { | |
64 | #ifndef DOXYGEN_NO_DETAIL | |
65 | namespace detail { namespace putp4p | |
66 | { | |
67 | template <typename T> | |
68 | struct par_putp4p | |
69 | { | |
70 | T C_x, C_y; | |
71 | }; | |
72 | ||
73 | // template class, using CRTP to implement forward/inverse | |
74 | template <typename CalculationType, typename Parameters> | |
75 | struct base_putp4p_spheroid : public base_t_fi<base_putp4p_spheroid<CalculationType, Parameters>, | |
76 | CalculationType, Parameters> | |
77 | { | |
78 | ||
79 | typedef CalculationType geographic_type; | |
80 | typedef CalculationType cartesian_type; | |
81 | ||
82 | par_putp4p<CalculationType> m_proj_parm; | |
83 | ||
84 | inline base_putp4p_spheroid(const Parameters& par) | |
85 | : base_t_fi<base_putp4p_spheroid<CalculationType, Parameters>, | |
86 | CalculationType, Parameters>(*this, par) {} | |
87 | ||
88 | // FORWARD(s_forward) spheroid | |
89 | // Project coordinates from geographic (lon, lat) to cartesian (x, y) | |
90 | inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const | |
91 | { | |
92 | lp_lat = aasin(0.883883476 * sin(lp_lat)); | |
93 | xy_x = this->m_proj_parm.C_x * lp_lon * cos(lp_lat); | |
94 | xy_x /= cos(lp_lat *= 0.333333333333333); | |
95 | xy_y = this->m_proj_parm.C_y * sin(lp_lat); | |
96 | } | |
97 | ||
98 | // INVERSE(s_inverse) spheroid | |
99 | // Project coordinates from cartesian (x, y) to geographic (lon, lat) | |
100 | inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const | |
101 | { | |
102 | lp_lat = aasin(xy_y / this->m_proj_parm.C_y); | |
103 | lp_lon = xy_x * cos(lp_lat) / this->m_proj_parm.C_x; | |
104 | lp_lat *= 3.; | |
105 | lp_lon /= cos(lp_lat); | |
106 | lp_lat = aasin(1.13137085 * sin(lp_lat)); | |
107 | } | |
108 | ||
109 | static inline std::string get_name() | |
110 | { | |
111 | return "putp4p_spheroid"; | |
112 | } | |
113 | ||
114 | }; | |
115 | ||
116 | template <typename Parameters, typename T> | |
117 | inline void setup(Parameters& par, par_putp4p<T>& proj_parm) | |
118 | { | |
119 | boost::ignore_unused(proj_parm); | |
120 | par.es = 0.; | |
121 | } | |
122 | ||
123 | ||
124 | // Putnins P4' | |
125 | template <typename Parameters, typename T> | |
126 | inline void setup_putp4p(Parameters& par, par_putp4p<T>& proj_parm) | |
127 | { | |
128 | proj_parm.C_x = 0.874038744; | |
129 | proj_parm.C_y = 3.883251825; | |
130 | setup(par, proj_parm); | |
131 | } | |
132 | ||
133 | // Werenskiold I | |
134 | template <typename Parameters, typename T> | |
135 | inline void setup_weren(Parameters& par, par_putp4p<T>& proj_parm) | |
136 | { | |
137 | proj_parm.C_x = 1.; | |
138 | proj_parm.C_y = 4.442882938; | |
139 | setup(par, proj_parm); | |
140 | } | |
141 | ||
142 | }} // namespace detail::putp4p | |
143 | #endif // doxygen | |
144 | ||
145 | /*! | |
146 | \brief Putnins P4' projection | |
147 | \ingroup projections | |
148 | \tparam Geographic latlong point type | |
149 | \tparam Cartesian xy point type | |
150 | \tparam Parameters parameter type | |
151 | \par Projection characteristics | |
152 | - Pseudocylindrical | |
153 | - Spheroid | |
154 | \par Example | |
155 | \image html ex_putp4p.gif | |
156 | */ | |
157 | template <typename CalculationType, typename Parameters> | |
158 | struct putp4p_spheroid : public detail::putp4p::base_putp4p_spheroid<CalculationType, Parameters> | |
159 | { | |
160 | inline putp4p_spheroid(const Parameters& par) : detail::putp4p::base_putp4p_spheroid<CalculationType, Parameters>(par) | |
161 | { | |
162 | detail::putp4p::setup_putp4p(this->m_par, this->m_proj_parm); | |
163 | } | |
164 | }; | |
165 | ||
166 | /*! | |
167 | \brief Werenskiold I projection | |
168 | \ingroup projections | |
169 | \tparam Geographic latlong point type | |
170 | \tparam Cartesian xy point type | |
171 | \tparam Parameters parameter type | |
172 | \par Projection characteristics | |
173 | - Pseudocylindrical | |
174 | - Spheroid | |
175 | \par Example | |
176 | \image html ex_weren.gif | |
177 | */ | |
178 | template <typename CalculationType, typename Parameters> | |
179 | struct weren_spheroid : public detail::putp4p::base_putp4p_spheroid<CalculationType, Parameters> | |
180 | { | |
181 | inline weren_spheroid(const Parameters& par) : detail::putp4p::base_putp4p_spheroid<CalculationType, Parameters>(par) | |
182 | { | |
183 | detail::putp4p::setup_weren(this->m_par, this->m_proj_parm); | |
184 | } | |
185 | }; | |
186 | ||
187 | #ifndef DOXYGEN_NO_DETAIL | |
188 | namespace detail | |
189 | { | |
190 | ||
191 | // Static projection | |
192 | BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::putp4p, putp4p_spheroid, putp4p_spheroid) | |
193 | BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::weren, weren_spheroid, weren_spheroid) | |
194 | ||
195 | // Factory entry(s) | |
196 | template <typename CalculationType, typename Parameters> | |
197 | class putp4p_entry : public detail::factory_entry<CalculationType, Parameters> | |
198 | { | |
199 | public : | |
200 | virtual base_v<CalculationType, Parameters>* create_new(const Parameters& par) const | |
201 | { | |
202 | return new base_v_fi<putp4p_spheroid<CalculationType, Parameters>, CalculationType, Parameters>(par); | |
203 | } | |
204 | }; | |
205 | ||
206 | template <typename CalculationType, typename Parameters> | |
207 | class weren_entry : public detail::factory_entry<CalculationType, Parameters> | |
208 | { | |
209 | public : | |
210 | virtual base_v<CalculationType, Parameters>* create_new(const Parameters& par) const | |
211 | { | |
212 | return new base_v_fi<weren_spheroid<CalculationType, Parameters>, CalculationType, Parameters>(par); | |
213 | } | |
214 | }; | |
215 | ||
216 | template <typename CalculationType, typename Parameters> | |
217 | inline void putp4p_init(detail::base_factory<CalculationType, Parameters>& factory) | |
218 | { | |
219 | factory.add_to_factory("putp4p", new putp4p_entry<CalculationType, Parameters>); | |
220 | factory.add_to_factory("weren", new weren_entry<CalculationType, Parameters>); | |
221 | } | |
222 | ||
223 | } // namespace detail | |
224 | #endif // doxygen | |
225 | ||
226 | } // namespace projections | |
227 | ||
228 | }} // namespace boost::geometry | |
229 | ||
230 | #endif // BOOST_GEOMETRY_PROJECTIONS_PUTP4P_HPP | |
231 |