1
#ifndef GGL_PROJECTIONS_STEREA_HPP
2
#define GGL_PROJECTIONS_STEREA_HPP
4
// Generic Geometry Library - projections (based on PROJ4)
5
// This file is automatically generated. DO NOT EDIT.
7
// Copyright Barend Gehrels (1995-2009), Geodan Holding B.V. Amsterdam, the Netherlands.
8
// Copyright Bruno Lalande (2008-2009)
9
// Use, modification and distribution is subject to the Boost Software License,
10
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
11
// http://www.boost.org/LICENSE_1_0.txt)
13
// This file is converted from PROJ4, http://trac.osgeo.org/proj
14
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
15
// PROJ4 is maintained by Frank Warmerdam
16
// PROJ4 is converted to Geometry Library by Barend Gehrels (Geodan, Amsterdam)
18
// Original copyright notice:
20
// Permission is hereby granted, free of charge, to any person obtaining a
21
// copy of this software and associated documentation files (the "Software"),
22
// to deal in the Software without restriction, including without limitation
23
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
24
// and/or sell copies of the Software, and to permit persons to whom the
25
// Software is furnished to do so, subject to the following conditions:
27
// The above copyright notice and this permission notice shall be included
28
// in all copies or substantial portions of the Software.
30
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
31
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
33
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
35
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
36
// DEALINGS IN THE SOFTWARE.
38
#include <boost/math/special_functions/hypot.hpp>
40
#include <ggl/projections/impl/base_static.hpp>
41
#include <ggl/projections/impl/base_dynamic.hpp>
42
#include <ggl/projections/impl/projects.hpp>
43
#include <ggl/projections/impl/factory_entry.hpp>
44
#include <ggl/projections/impl/pj_gauss.hpp>
46
#include <ggl/projections/epsg_traits.hpp>
48
namespace ggl { namespace projection
50
#ifndef DOXYGEN_NO_DETAIL
51
namespace detail { namespace sterea{
52
static const double DEL_TOL = 1.e-14;
53
static const int MAX_ITER = 10;
66
// template class, using CRTP to implement forward/inverse
67
template <typename Geographic, typename Cartesian, typename Parameters>
68
struct base_sterea_ellipsoid : public base_t_fi<base_sterea_ellipsoid<Geographic, Cartesian, Parameters>,
69
Geographic, Cartesian, Parameters>
72
typedef double geographic_type;
73
typedef double cartesian_type;
75
par_sterea m_proj_parm;
77
inline base_sterea_ellipsoid(const Parameters& par)
78
: base_t_fi<base_sterea_ellipsoid<Geographic, Cartesian, Parameters>,
79
Geographic, Cartesian, Parameters>(*this, par) {}
81
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
83
double cosc, sinc, cosl, k;
85
detail::gauss::gauss(m_proj_parm.en, lp_lon, lp_lat);
89
k = this->m_par.k0 * this->m_proj_parm.R2 / (1. + this->m_proj_parm.sinc0 * sinc + this->m_proj_parm.cosc0 * cosc * cosl);
90
xy_x = k * cosc * sin(lp_lon);
91
xy_y = k * (this->m_proj_parm.cosc0 * sinc - this->m_proj_parm.sinc0 * cosc * cosl);
94
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
96
double rho, c, sinc, cosc;
98
xy_x /= this->m_par.k0;
99
xy_y /= this->m_par.k0;
100
if((rho = boost::math::hypot(xy_x, xy_y))) {
101
c = 2. * atan2(rho, this->m_proj_parm.R2);
104
lp_lat = asin(cosc * this->m_proj_parm.sinc0 + xy_y * sinc * this->m_proj_parm.cosc0 / rho);
105
lp_lon = atan2(xy_x * sinc, rho * this->m_proj_parm.cosc0 * cosc -
106
xy_y * this->m_proj_parm.sinc0 * sinc);
108
lp_lat = this->m_proj_parm.phic0;
111
detail::gauss::inv_gauss(m_proj_parm.en, lp_lon, lp_lat);
115
// Oblique Stereographic Alternative
116
template <typename Parameters>
117
void setup_sterea(Parameters& par, par_sterea& proj_parm)
120
proj_parm.en = detail::gauss::gauss_ini(par.e, par.phi0, proj_parm.phic0, R);
121
proj_parm.sinc0 = sin(proj_parm.phic0);
122
proj_parm.cosc0 = cos(proj_parm.phic0);
123
proj_parm.R2 = 2. * R;
124
// par.inv = e_inverse;
125
// par.fwd = e_forward;
128
}} // namespace detail::sterea
132
\brief Oblique Stereographic Alternative projection
134
\tparam Geographic latlong point type
135
\tparam Cartesian xy point type
136
\tparam Parameters parameter type
137
\par Projection characteristics
142
\image html ex_sterea.gif
144
template <typename Geographic, typename Cartesian, typename Parameters = parameters>
145
struct sterea_ellipsoid : public detail::sterea::base_sterea_ellipsoid<Geographic, Cartesian, Parameters>
147
inline sterea_ellipsoid(const Parameters& par) : detail::sterea::base_sterea_ellipsoid<Geographic, Cartesian, Parameters>(par)
149
detail::sterea::setup_sterea(this->m_par, this->m_proj_parm);
153
#ifndef DOXYGEN_NO_DETAIL
158
template <typename Geographic, typename Cartesian, typename Parameters>
159
class sterea_entry : public detail::factory_entry<Geographic, Cartesian, Parameters>
162
virtual projection<Geographic, Cartesian>* create_new(const Parameters& par) const
164
return new base_v_fi<sterea_ellipsoid<Geographic, Cartesian, Parameters>, Geographic, Cartesian, Parameters>(par);
168
template <typename Geographic, typename Cartesian, typename Parameters>
169
inline void sterea_init(detail::base_factory<Geographic, Cartesian, Parameters>& factory)
171
factory.add_to_factory("sterea", new sterea_entry<Geographic, Cartesian, Parameters>);
174
} // namespace detail
175
// Create EPSG specializations
176
// (Proof of Concept, only for some)
178
template<typename LatLongRadian, typename Cartesian, typename Parameters>
179
struct epsg_traits<2036, LatLongRadian, Cartesian, Parameters>
181
typedef sterea_ellipsoid<LatLongRadian, Cartesian, Parameters> type;
182
static inline std::string par()
184
return "+proj=sterea +lat_0=46.5 +lon_0=-66.5 +k=0.999912 +x_0=2500000 +y_0=7500000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m";
189
template<typename LatLongRadian, typename Cartesian, typename Parameters>
190
struct epsg_traits<2171, LatLongRadian, Cartesian, Parameters>
192
typedef sterea_ellipsoid<LatLongRadian, Cartesian, Parameters> type;
193
static inline std::string par()
195
return "+proj=sterea +lat_0=50.625 +lon_0=21.08333333333333 +k=0.9998 +x_0=4637000 +y_0=5647000 +ellps=krass +towgs84=33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84 +units=m";
200
template<typename LatLongRadian, typename Cartesian, typename Parameters>
201
struct epsg_traits<2172, LatLongRadian, Cartesian, Parameters>
203
typedef sterea_ellipsoid<LatLongRadian, Cartesian, Parameters> type;
204
static inline std::string par()
206
return "+proj=sterea +lat_0=53.00194444444445 +lon_0=21.50277777777778 +k=0.9998 +x_0=4603000 +y_0=5806000 +ellps=krass +towgs84=33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84 +units=m";
211
template<typename LatLongRadian, typename Cartesian, typename Parameters>
212
struct epsg_traits<2173, LatLongRadian, Cartesian, Parameters>
214
typedef sterea_ellipsoid<LatLongRadian, Cartesian, Parameters> type;
215
static inline std::string par()
217
return "+proj=sterea +lat_0=53.58333333333334 +lon_0=17.00833333333333 +k=0.9998 +x_0=3501000 +y_0=5999000 +ellps=krass +towgs84=33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84 +units=m";
222
template<typename LatLongRadian, typename Cartesian, typename Parameters>
223
struct epsg_traits<2174, LatLongRadian, Cartesian, Parameters>
225
typedef sterea_ellipsoid<LatLongRadian, Cartesian, Parameters> type;
226
static inline std::string par()
228
return "+proj=sterea +lat_0=51.67083333333333 +lon_0=16.67222222222222 +k=0.9998 +x_0=3703000 +y_0=5627000 +ellps=krass +towgs84=33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84 +units=m";
233
template<typename LatLongRadian, typename Cartesian, typename Parameters>
234
struct epsg_traits<2200, LatLongRadian, Cartesian, Parameters>
236
typedef sterea_ellipsoid<LatLongRadian, Cartesian, Parameters> type;
237
static inline std::string par()
239
return "+proj=sterea +lat_0=46.5 +lon_0=-66.5 +k=0.999912 +x_0=300000 +y_0=800000 +a=6378135 +b=6356750.304921594 +units=m";
244
template<typename LatLongRadian, typename Cartesian, typename Parameters>
245
struct epsg_traits<2290, LatLongRadian, Cartesian, Parameters>
247
typedef sterea_ellipsoid<LatLongRadian, Cartesian, Parameters> type;
248
static inline std::string par()
250
return "+proj=sterea +lat_0=47.25 +lon_0=-63 +k=0.999912 +x_0=700000 +y_0=400000 +a=6378135 +b=6356750.304921594 +units=m";
255
template<typename LatLongRadian, typename Cartesian, typename Parameters>
256
struct epsg_traits<2291, LatLongRadian, Cartesian, Parameters>
258
typedef sterea_ellipsoid<LatLongRadian, Cartesian, Parameters> type;
259
static inline std::string par()
261
return "+proj=sterea +lat_0=47.25 +lon_0=-63 +k=0.999912 +x_0=400000 +y_0=800000 +a=6378135 +b=6356750.304921594 +units=m";
266
template<typename LatLongRadian, typename Cartesian, typename Parameters>
267
struct epsg_traits<2292, LatLongRadian, Cartesian, Parameters>
269
typedef sterea_ellipsoid<LatLongRadian, Cartesian, Parameters> type;
270
static inline std::string par()
272
return "+proj=sterea +lat_0=47.25 +lon_0=-63 +k=0.999912 +x_0=400000 +y_0=800000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m";
277
template<typename LatLongRadian, typename Cartesian, typename Parameters>
278
struct epsg_traits<2953, LatLongRadian, Cartesian, Parameters>
280
typedef sterea_ellipsoid<LatLongRadian, Cartesian, Parameters> type;
281
static inline std::string par()
283
return "+proj=sterea +lat_0=46.5 +lon_0=-66.5 +k=0.999912 +x_0=2500000 +y_0=7500000 +ellps=GRS80 +units=m";
288
template<typename LatLongRadian, typename Cartesian, typename Parameters>
289
struct epsg_traits<2954, LatLongRadian, Cartesian, Parameters>
291
typedef sterea_ellipsoid<LatLongRadian, Cartesian, Parameters> type;
292
static inline std::string par()
294
return "+proj=sterea +lat_0=47.25 +lon_0=-63 +k=0.999912 +x_0=400000 +y_0=800000 +ellps=GRS80 +units=m";
299
template<typename LatLongRadian, typename Cartesian, typename Parameters>
300
struct epsg_traits<3120, LatLongRadian, Cartesian, Parameters>
302
typedef sterea_ellipsoid<LatLongRadian, Cartesian, Parameters> type;
303
static inline std::string par()
305
return "+proj=sterea +lat_0=50.625 +lon_0=21.08333333333333 +k=0.9998 +x_0=4637000 +y_0=5467000 +ellps=krass +towgs84=33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84 +units=m";
310
template<typename LatLongRadian, typename Cartesian, typename Parameters>
311
struct epsg_traits<3328, LatLongRadian, Cartesian, Parameters>
313
typedef sterea_ellipsoid<LatLongRadian, Cartesian, Parameters> type;
314
static inline std::string par()
316
return "+proj=sterea +lat_0=52.16666666666666 +lon_0=19.16666666666667 +k=0.999714 +x_0=500000 +y_0=500000 +ellps=krass +towgs84=33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84 +units=m";
321
template<typename LatLongRadian, typename Cartesian, typename Parameters>
322
struct epsg_traits<22780, LatLongRadian, Cartesian, Parameters>
324
typedef sterea_ellipsoid<LatLongRadian, Cartesian, Parameters> type;
325
static inline std::string par()
327
return "+proj=sterea +lat_0=34.2 +lon_0=39.15 +k=0.9995341 +x_0=0 +y_0=0 +a=6378249.2 +b=6356515 +units=m";
332
template<typename LatLongRadian, typename Cartesian, typename Parameters>
333
struct epsg_traits<28991, LatLongRadian, Cartesian, Parameters>
335
typedef sterea_ellipsoid<LatLongRadian, Cartesian, Parameters> type;
336
static inline std::string par()
338
return "+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=0 +y_0=0 +ellps=bessel +units=m";
343
template<typename LatLongRadian, typename Cartesian, typename Parameters>
344
struct epsg_traits<28992, LatLongRadian, Cartesian, Parameters>
346
typedef sterea_ellipsoid<LatLongRadian, Cartesian, Parameters> type;
347
static inline std::string par()
349
return "+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +units=m";
354
template<typename LatLongRadian, typename Cartesian, typename Parameters>
355
struct epsg_traits<31600, LatLongRadian, Cartesian, Parameters>
357
typedef sterea_ellipsoid<LatLongRadian, Cartesian, Parameters> type;
358
static inline std::string par()
360
return "+proj=sterea +lat_0=45.9 +lon_0=25.39246588888889 +k=0.9996667 +x_0=500000 +y_0=500000 +ellps=intl +units=m";
365
template<typename LatLongRadian, typename Cartesian, typename Parameters>
366
struct epsg_traits<31700, LatLongRadian, Cartesian, Parameters>
368
typedef sterea_ellipsoid<LatLongRadian, Cartesian, Parameters> type;
369
static inline std::string par()
371
return "+proj=sterea +lat_0=46 +lon_0=25 +k=0.99975 +x_0=500000 +y_0=500000 +ellps=krass +units=m";
378
}} // namespace ggl::projection
380
#endif // GGL_PROJECTIONS_STEREA_HPP