]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
1 | #ifndef BOOST_GEOMETRY_PROJECTIONS_FAHEY_HPP |
2 | #define BOOST_GEOMETRY_PROJECTIONS_FAHEY_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 | #include <boost/geometry/srs/projections/impl/aasincos.hpp> | |
49 | ||
50 | namespace boost { namespace geometry | |
51 | { | |
52 | ||
53 | namespace srs { namespace par4 | |
54 | { | |
55 | struct fahey {}; | |
56 | ||
57 | }} //namespace srs::par4 | |
58 | ||
59 | namespace projections | |
60 | { | |
61 | #ifndef DOXYGEN_NO_DETAIL | |
62 | namespace detail { namespace fahey | |
63 | { | |
64 | ||
65 | static const double TOL = 1e-6; | |
66 | ||
67 | // template class, using CRTP to implement forward/inverse | |
68 | template <typename CalculationType, typename Parameters> | |
69 | struct base_fahey_spheroid : public base_t_fi<base_fahey_spheroid<CalculationType, Parameters>, | |
70 | CalculationType, Parameters> | |
71 | { | |
72 | ||
73 | typedef CalculationType geographic_type; | |
74 | typedef CalculationType cartesian_type; | |
75 | ||
76 | ||
77 | inline base_fahey_spheroid(const Parameters& par) | |
78 | : base_t_fi<base_fahey_spheroid<CalculationType, Parameters>, | |
79 | CalculationType, Parameters>(*this, par) {} | |
80 | ||
81 | // FORWARD(s_forward) spheroid | |
82 | // Project coordinates from geographic (lon, lat) to cartesian (x, y) | |
83 | inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const | |
84 | { | |
85 | xy_y = 1.819152 * ( xy_x = tan(0.5 * lp_lat) ); | |
86 | xy_x = 0.819152 * lp_lon * asqrt(1 - xy_x * xy_x); | |
87 | } | |
88 | ||
89 | // INVERSE(s_inverse) spheroid | |
90 | // Project coordinates from cartesian (x, y) to geographic (lon, lat) | |
91 | inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const | |
92 | { | |
93 | lp_lat = 2. * atan(xy_y /= 1.819152); | |
94 | lp_lon = fabs(xy_y = 1. - xy_y * xy_y) < TOL ? 0. : | |
95 | xy_x / (0.819152 * sqrt(xy_y)); | |
96 | } | |
97 | ||
98 | static inline std::string get_name() | |
99 | { | |
100 | return "fahey_spheroid"; | |
101 | } | |
102 | ||
103 | }; | |
104 | ||
105 | // Fahey | |
106 | template <typename Parameters> | |
107 | inline void setup_fahey(Parameters& par) | |
108 | { | |
109 | par.es = 0.; | |
110 | } | |
111 | ||
112 | }} // namespace detail::fahey | |
113 | #endif // doxygen | |
114 | ||
115 | /*! | |
116 | \brief Fahey projection | |
117 | \ingroup projections | |
118 | \tparam Geographic latlong point type | |
119 | \tparam Cartesian xy point type | |
120 | \tparam Parameters parameter type | |
121 | \par Projection characteristics | |
122 | - Pseudocylindrical | |
123 | - Spheroid | |
124 | \par Example | |
125 | \image html ex_fahey.gif | |
126 | */ | |
127 | template <typename CalculationType, typename Parameters> | |
128 | struct fahey_spheroid : public detail::fahey::base_fahey_spheroid<CalculationType, Parameters> | |
129 | { | |
130 | inline fahey_spheroid(const Parameters& par) : detail::fahey::base_fahey_spheroid<CalculationType, Parameters>(par) | |
131 | { | |
132 | detail::fahey::setup_fahey(this->m_par); | |
133 | } | |
134 | }; | |
135 | ||
136 | #ifndef DOXYGEN_NO_DETAIL | |
137 | namespace detail | |
138 | { | |
139 | ||
140 | // Static projection | |
141 | BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::par4::fahey, fahey_spheroid, fahey_spheroid) | |
142 | ||
143 | // Factory entry(s) | |
144 | template <typename CalculationType, typename Parameters> | |
145 | class fahey_entry : public detail::factory_entry<CalculationType, Parameters> | |
146 | { | |
147 | public : | |
148 | virtual base_v<CalculationType, Parameters>* create_new(const Parameters& par) const | |
149 | { | |
150 | return new base_v_fi<fahey_spheroid<CalculationType, Parameters>, CalculationType, Parameters>(par); | |
151 | } | |
152 | }; | |
153 | ||
154 | template <typename CalculationType, typename Parameters> | |
155 | inline void fahey_init(detail::base_factory<CalculationType, Parameters>& factory) | |
156 | { | |
157 | factory.add_to_factory("fahey", new fahey_entry<CalculationType, Parameters>); | |
158 | } | |
159 | ||
160 | } // namespace detail | |
161 | #endif // doxygen | |
162 | ||
163 | } // namespace projections | |
164 | ||
165 | }} // namespace boost::geometry | |
166 | ||
167 | #endif // BOOST_GEOMETRY_PROJECTIONS_FAHEY_HPP | |
168 |