Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:35:41

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 for geocentric.  The transformation isn't
0023 //           really done here since this code is 2D.  The real transformation
0024 //           is handled by pj_transform.c.
0025 // Author:   Frank Warmerdam, warmerdam@pobox.com
0026 // Copyright (c) 2002, 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_GEOCENT_HPP
0047 #define BOOST_GEOMETRY_PROJECTIONS_GEOCENT_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 namespace boost { namespace geometry
0055 {
0056 
0057 namespace projections
0058 {
0059     #ifndef DOXYGEN_NO_DETAIL
0060     namespace detail { namespace geocent
0061     {
0062 
0063             template <typename T, typename Parameters>
0064             struct base_geocent_other
0065             {
0066                 // FORWARD(forward)
0067                 // Project coordinates from geographic (lon, lat) to cartesian (x, y)
0068                 inline void fwd(Parameters const& , T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
0069                 {
0070                         xy_x = lp_lon;
0071                         xy_y = lp_lat;
0072                 }
0073 
0074                 // INVERSE(inverse)
0075                 // Project coordinates from cartesian (x, y) to geographic (lon, lat)
0076                 inline void inv(Parameters const& , T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
0077                 {
0078                         lp_lat = xy_y;
0079                         lp_lon = xy_x;
0080                 }
0081 
0082                 static inline std::string get_name()
0083                 {
0084                     return "geocent_other";
0085                 }
0086 
0087             };
0088 
0089             // Geocentric
0090             template <typename Parameters>
0091             inline void setup_geocent(Parameters& par)
0092             {
0093                 par.is_geocent = true;
0094                 par.x0 = 0.0;
0095                 par.y0 = 0.0;
0096             }
0097 
0098     }} // namespace detail::geocent
0099     #endif // doxygen
0100 
0101     /*!
0102         \brief Geocentric projection
0103         \ingroup projections
0104         \tparam Geographic latlong point type
0105         \tparam Cartesian xy point type
0106         \tparam Parameters parameter type
0107         \par Example
0108         \image html ex_geocent.gif
0109     */
0110     template <typename T, typename Parameters>
0111     struct geocent_other : public detail::geocent::base_geocent_other<T, Parameters>
0112     {
0113         template <typename Params>
0114         inline geocent_other(Params const& , Parameters & par)
0115         {
0116             detail::geocent::setup_geocent(par);
0117         }
0118     };
0119 
0120     #ifndef DOXYGEN_NO_DETAIL
0121     namespace detail
0122     {
0123 
0124         // Static projection
0125         BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_geocent, geocent_other)
0126 
0127         // Factory entry(s)
0128         BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(geocent_entry, geocent_other)
0129 
0130         BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_BEGIN(geocent_init)
0131         {
0132             BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_INIT_ENTRY(geocent, geocent_entry);
0133         }
0134 
0135     } // namespace detail
0136     #endif // doxygen
0137 
0138 } // namespace projections
0139 
0140 }} // namespace boost::geometry
0141 
0142 #endif // BOOST_GEOMETRY_PROJECTIONS_GEOCENT_HPP
0143