]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/geometry/srs/projections/proj/tcea.hpp
Add patch for failing prerm scripts
[ceph.git] / ceph / src / boost / boost / geometry / srs / projections / proj / tcea.hpp
CommitLineData
11fdf7f2
TL
1#ifndef BOOST_GEOMETRY_PROJECTIONS_TCEA_HPP
2#define BOOST_GEOMETRY_PROJECTIONS_TCEA_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 tcea {};
55
56}} //namespace srs::par4
57
58namespace projections
59{
60 #ifndef DOXYGEN_NO_DETAIL
61 namespace detail { namespace tcea
62 {
63 template <typename T>
64 struct par_tcea
65 {
66 T rk0;
67 };
68
69 // template class, using CRTP to implement forward/inverse
70 template <typename CalculationType, typename Parameters>
71 struct base_tcea_spheroid : public base_t_fi<base_tcea_spheroid<CalculationType, Parameters>,
72 CalculationType, Parameters>
73 {
74
75 typedef CalculationType geographic_type;
76 typedef CalculationType cartesian_type;
77
78 par_tcea<CalculationType> m_proj_parm;
79
80 inline base_tcea_spheroid(const Parameters& par)
81 : base_t_fi<base_tcea_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 xy_x = this->m_proj_parm.rk0 * cos(lp_lat) * sin(lp_lon);
89 xy_y = this->m_par.k0 * (atan2(tan(lp_lat), cos(lp_lon)) - this->m_par.phi0);
90 }
91
92 // INVERSE(s_inverse) spheroid
93 // Project coordinates from cartesian (x, y) to geographic (lon, lat)
94 inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const
95 {
96 CalculationType t;
97
98 xy_y = xy_y * this->m_proj_parm.rk0 + this->m_par.phi0;
99 xy_x *= this->m_par.k0;
100 t = sqrt(1. - xy_x * xy_x);
101 lp_lat = asin(t * sin(xy_y));
102 lp_lon = atan2(xy_x, t * cos(xy_y));
103 }
104
105 static inline std::string get_name()
106 {
107 return "tcea_spheroid";
108 }
109
110 };
111
112 // Transverse Cylindrical Equal Area
113 template <typename Parameters, typename T>
114 inline void setup_tcea(Parameters& par, par_tcea<T>& proj_parm)
115 {
116 proj_parm.rk0 = 1 / par.k0;
117 par.es = 0.;
118 }
119
120 }} // namespace detail::tcea
121 #endif // doxygen
122
123 /*!
124 \brief Transverse Cylindrical Equal Area projection
125 \ingroup projections
126 \tparam Geographic latlong point type
127 \tparam Cartesian xy point type
128 \tparam Parameters parameter type
129 \par Projection characteristics
130 - Cylindrical
131 - Spheroid
132 \par Example
133 \image html ex_tcea.gif
134 */
135 template <typename CalculationType, typename Parameters>
136 struct tcea_spheroid : public detail::tcea::base_tcea_spheroid<CalculationType, Parameters>
137 {
138 inline tcea_spheroid(const Parameters& par) : detail::tcea::base_tcea_spheroid<CalculationType, Parameters>(par)
139 {
140 detail::tcea::setup_tcea(this->m_par, this->m_proj_parm);
141 }
142 };
143
144 #ifndef DOXYGEN_NO_DETAIL
145 namespace detail
146 {
147
148 // Static projection
149 BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::tcea, tcea_spheroid, tcea_spheroid)
150
151 // Factory entry(s)
152 template <typename CalculationType, typename Parameters>
153 class tcea_entry : public detail::factory_entry<CalculationType, Parameters>
154 {
155 public :
156 virtual base_v<CalculationType, Parameters>* create_new(const Parameters& par) const
157 {
158 return new base_v_fi<tcea_spheroid<CalculationType, Parameters>, CalculationType, Parameters>(par);
159 }
160 };
161
162 template <typename CalculationType, typename Parameters>
163 inline void tcea_init(detail::base_factory<CalculationType, Parameters>& factory)
164 {
165 factory.add_to_factory("tcea", new tcea_entry<CalculationType, Parameters>);
166 }
167
168 } // namespace detail
169 #endif // doxygen
170
171} // namespace projections
172
173}} // namespace boost::geometry
174
175#endif // BOOST_GEOMETRY_PROJECTIONS_TCEA_HPP
176