|
||||
File indexing completed on 2025-01-18 09:35:43
0001 // Boost.Geometry - gis-projections (based on PROJ4) 0002 0003 // Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands. 0004 0005 // This file was modified by Oracle on 2017, 2018, 2019. 0006 // Modifications copyright (c) 2017-2019, Oracle and/or its affiliates. 0007 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle. 0008 0009 // Use, modification and distribution is subject to the Boost Software License, 0010 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 0011 // http://www.boost.org/LICENSE_1_0.txt) 0012 0013 // This file is converted from PROJ4, http://trac.osgeo.org/proj 0014 // PROJ4 is originally written by Gerald Evenden (then of the USGS) 0015 // PROJ4 is maintained by Frank Warmerdam 0016 // PROJ4 is converted to Boost.Geometry by Barend Gehrels 0017 0018 // Last updated version of proj: 5.0.0 0019 0020 // Original copyright notice: 0021 0022 // Purpose: Stub projection implementation for lat/long coordinates. We 0023 // don't actually change the coordinates, but we want proj=latlong 0024 // to act sort of like a projection. 0025 // Author: Frank Warmerdam, warmerdam@pobox.com 0026 // Copyright (c) 2000, Frank Warmerdam 0027 0028 // Permission is hereby granted, free of charge, to any person obtaining a 0029 // copy of this software and associated documentation files (the "Software"), 0030 // to deal in the Software without restriction, including without limitation 0031 // the rights to use, copy, modify, merge, publish, distribute, sublicense, 0032 // and/or sell copies of the Software, and to permit persons to whom the 0033 // Software is furnished to do so, subject to the following conditions: 0034 0035 // The above copyright notice and this permission notice shall be included 0036 // in all copies or substantial portions of the Software. 0037 0038 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 0039 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 0040 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 0041 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 0042 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 0043 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 0044 // DEALINGS IN THE SOFTWARE. 0045 0046 #ifndef BOOST_GEOMETRY_PROJECTIONS_LATLONG_HPP 0047 #define BOOST_GEOMETRY_PROJECTIONS_LATLONG_HPP 0048 0049 #include <boost/geometry/srs/projections/impl/base_static.hpp> 0050 #include <boost/geometry/srs/projections/impl/base_dynamic.hpp> 0051 #include <boost/geometry/srs/projections/impl/projects.hpp> 0052 #include <boost/geometry/srs/projections/impl/factory_entry.hpp> 0053 0054 0055 namespace boost { namespace geometry 0056 { 0057 0058 namespace projections 0059 { 0060 #ifndef DOXYGEN_NO_DETAIL 0061 namespace detail { namespace latlong 0062 { 0063 0064 /* very loosely based upon DMA code by Bradford W. Drew */ 0065 0066 template <typename T, typename Parameters> 0067 struct base_latlong_other 0068 { 0069 // FORWARD(forward) 0070 // Project coordinates from geographic (lon, lat) to cartesian (x, y) 0071 inline void fwd(Parameters const& par, T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const 0072 { 0073 // TODO: in the original code a is not used 0074 // different mechanism is probably used instead 0075 xy_x = lp_lon / par.a; 0076 xy_y = lp_lat / par.a; 0077 } 0078 0079 // INVERSE(inverse) 0080 // Project coordinates from cartesian (x, y) to geographic (lon, lat) 0081 inline void inv(Parameters const& par, T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const 0082 { 0083 // TODO: in the original code a is not used 0084 // different mechanism is probably used instead 0085 lp_lat = xy_y * par.a; 0086 lp_lon = xy_x * par.a; 0087 } 0088 0089 static inline std::string get_name() 0090 { 0091 return "latlong_other"; 0092 } 0093 0094 }; 0095 0096 // Lat/long (Geodetic) 0097 template <typename Parameters> 0098 inline void setup_latlong(Parameters& par) 0099 { 0100 par.is_latlong = 1; 0101 par.x0 = 0.0; 0102 par.y0 = 0.0; 0103 } 0104 0105 }} // namespace detail::latlong 0106 #endif // doxygen 0107 0108 /*! 0109 \brief Lat/long (Geodetic) projection 0110 \ingroup projections 0111 \tparam Geographic latlong point type 0112 \tparam Cartesian xy point type 0113 \tparam Parameters parameter type 0114 \par Example 0115 \image html ex_latlong.gif 0116 */ 0117 template <typename T, typename Parameters> 0118 struct latlong_other : public detail::latlong::base_latlong_other<T, Parameters> 0119 { 0120 template <typename Params> 0121 inline latlong_other(Params const& , Parameters & par) 0122 { 0123 detail::latlong::setup_latlong(par); 0124 } 0125 }; 0126 0127 #ifndef DOXYGEN_NO_DETAIL 0128 namespace detail 0129 { 0130 0131 // Static projection 0132 BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_lonlat, latlong_other) 0133 BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_latlon, latlong_other) 0134 BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_latlong, latlong_other) 0135 BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_longlat, latlong_other) 0136 0137 // Factory entry(s) 0138 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(latlong_entry, latlong_other) 0139 0140 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(latlong_init) 0141 { 0142 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(lonlat, latlong_entry) 0143 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(latlon, latlong_entry) 0144 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(latlong, latlong_entry) 0145 BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(longlat, latlong_entry) 0146 } 0147 0148 } // namespace detail 0149 #endif // doxygen 0150 0151 } // namespace projections 0152 0153 }} // namespace boost::geometry 0154 0155 #endif // BOOST_GEOMETRY_PROJECTIONS_LATLONG_HPP 0156
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |