]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/geometry/srs/projections/proj/wag3.hpp
Add patch for failing prerm scripts
[ceph.git] / ceph / src / boost / boost / geometry / srs / projections / proj / wag3.hpp
CommitLineData
11fdf7f2
TL
1#ifndef BOOST_GEOMETRY_PROJECTIONS_WAG3_HPP
2#define BOOST_GEOMETRY_PROJECTIONS_WAG3_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/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
49namespace boost { namespace geometry
50{
51
52namespace srs { namespace par4
53{
54 struct wag3 {};
55
56}} //namespace srs::par4
57
58namespace projections
59{
60 #ifndef DOXYGEN_NO_DETAIL
61 namespace detail { namespace wag3
62 {
63 template <typename T>
64 struct par_wag3
65 {
66 T C_x;
67 };
68
69 // template class, using CRTP to implement forward/inverse
70 template <typename CalculationType, typename Parameters>
71 struct base_wag3_spheroid : public base_t_fi<base_wag3_spheroid<CalculationType, Parameters>,
72 CalculationType, Parameters>
73 {
74
75 typedef CalculationType geographic_type;
76 typedef CalculationType cartesian_type;
77
78 par_wag3<CalculationType> m_proj_parm;
79
80 inline base_wag3_spheroid(const Parameters& par)
81 : base_t_fi<base_wag3_spheroid<CalculationType, Parameters>,
82 CalculationType, Parameters>(*this, par) {}
83
84 // FORWARD(s_forward) spheroid
85 // Project coordinates from geographic (lon, lat) to cartesian (x, y)
86 inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const
87 {
88 static const CalculationType TWOTHIRD = detail::TWOTHIRD<CalculationType>();
89
90 xy_x = this->m_proj_parm.C_x * lp_lon * cos(TWOTHIRD * lp_lat);
91 xy_y = lp_lat;
92 }
93
94 // INVERSE(s_inverse) spheroid
95 // Project coordinates from cartesian (x, y) to geographic (lon, lat)
96 inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
97 {
98 static const CalculationType TWOTHIRD = detail::TWOTHIRD<CalculationType>();
99
100 lp_lat = xy_y;
101 lp_lon = xy_x / (this->m_proj_parm.C_x * cos(TWOTHIRD * lp_lat));
102 }
103
104 static inline std::string get_name()
105 {
106 return "wag3_spheroid";
107 }
108
109 };
110
111 // Wagner III
112 template <typename Parameters, typename T>
113 inline void setup_wag3(Parameters& par, par_wag3<T>& proj_parm)
114 {
115 T ts;
116
117 ts = pj_param(par.params, "rlat_ts").f;
118 proj_parm.C_x = cos(ts) / cos(2.*ts/3.);
119 par.es = 0.;
120 }
121
122 }} // namespace detail::wag3
123 #endif // doxygen
124
125 /*!
126 \brief Wagner III projection
127 \ingroup projections
128 \tparam Geographic latlong point type
129 \tparam Cartesian xy point type
130 \tparam Parameters parameter type
131 \par Projection characteristics
132 - Pseudocylindrical
133 - Spheroid
134 \par Projection parameters
135 - lat_ts: Latitude of true scale (degrees)
136 \par Example
137 \image html ex_wag3.gif
138 */
139 template <typename CalculationType, typename Parameters>
140 struct wag3_spheroid : public detail::wag3::base_wag3_spheroid<CalculationType, Parameters>
141 {
142 inline wag3_spheroid(const Parameters& par) : detail::wag3::base_wag3_spheroid<CalculationType, Parameters>(par)
143 {
144 detail::wag3::setup_wag3(this->m_par, this->m_proj_parm);
145 }
146 };
147
148 #ifndef DOXYGEN_NO_DETAIL
149 namespace detail
150 {
151
152 // Static projection
153 BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::wag3, wag3_spheroid, wag3_spheroid)
154
155 // Factory entry(s)
156 template <typename CalculationType, typename Parameters>
157 class wag3_entry : public detail::factory_entry<CalculationType, Parameters>
158 {
159 public :
160 virtual base_v<CalculationType, Parameters>* create_new(const Parameters& par) const
161 {
162 return new base_v_fi<wag3_spheroid<CalculationType, Parameters>, CalculationType, Parameters>(par);
163 }
164 };
165
166 template <typename CalculationType, typename Parameters>
167 inline void wag3_init(detail::base_factory<CalculationType, Parameters>& factory)
168 {
169 factory.add_to_factory("wag3", new wag3_entry<CalculationType, Parameters>);
170 }
171
172 } // namespace detail
173 #endif // doxygen
174
175} // namespace projections
176
177}} // namespace boost::geometry
178
179#endif // BOOST_GEOMETRY_PROJECTIONS_WAG3_HPP
180