Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 // This file is manually converted from PROJ4 (projects.h)
0003 
0004 // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
0005 
0006 // This file was modified by Oracle on 2017-2020.
0007 // Modifications copyright (c) 2017-2020, Oracle and/or its affiliates.
0008 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0009 
0010 // Use, modification and distribution is subject to the Boost Software License,
0011 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0012 // http://www.boost.org/LICENSE_1_0.txt)
0013 
0014 // This file is converted from PROJ4, http://trac.osgeo.org/proj
0015 // PROJ4 is originally written by Gerald Evenden (then of the USGS)
0016 // PROJ4 is maintained by Frank Warmerdam
0017 // PROJ4 is converted to Geometry Library by Barend Gehrels (Geodan, Amsterdam)
0018 
0019 // Original copyright notice:
0020 
0021 // Permission is hereby granted, free of charge, to any person obtaining a
0022 // copy of this software and associated documentation files (the "Software"),
0023 // to deal in the Software without restriction, including without limitation
0024 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
0025 // and/or sell copies of the Software, and to permit persons to whom the
0026 // Software is furnished to do so, subject to the following conditions:
0027 
0028 // The above copyright notice and this permission notice shall be included
0029 // in all copies or substantial portions of the Software.
0030 
0031 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
0032 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0033 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
0034 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
0035 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
0036 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
0037 // DEALINGS IN THE SOFTWARE.
0038 
0039 #ifndef BOOST_GEOMETRY_PROJECTIONS_IMPL_PROJECTS_HPP
0040 #define BOOST_GEOMETRY_PROJECTIONS_IMPL_PROJECTS_HPP
0041 
0042 
0043 #include <cstring>
0044 #include <string>
0045 #include <vector>
0046 
0047 #include <boost/config.hpp>
0048 #include <boost/geometry/srs/projections/constants.hpp>
0049 #include <boost/geometry/srs/projections/dpar.hpp>
0050 #include <boost/geometry/srs/projections/spar.hpp>
0051 
0052 
0053 namespace boost { namespace geometry { namespace projections
0054 {
0055 
0056 #ifndef DOXYGEN_NO_DETAIL
0057 namespace detail
0058 {
0059 
0060 /* datum_type values */
0061 enum datum_type
0062 {
0063     datum_unknown   = 0,
0064     datum_3param    = 1,
0065     datum_7param    = 2,
0066     datum_gridshift = 3,
0067     datum_wgs84     = 4  /* WGS84 (or anything considered equivelent) */
0068 };
0069 
0070 // Originally defined in proj_internal.h
0071 //enum pj_io_units {
0072 //    pj_io_units_whatever  = 0,  /* Doesn't matter (or depends on pipeline neighbours) */
0073 //    pj_io_units_classic   = 1,  /* Scaled meters (right), projected system */
0074 //    pj_io_units_projected = 2,  /* Meters, projected system */
0075 //    pj_io_units_cartesian = 3,  /* Meters, 3D cartesian system */
0076 //    pj_io_units_angular   = 4   /* Radians */
0077 //};
0078 
0079 // Originally defined in proj_internal.h
0080 /* Maximum latitudinal overshoot accepted */
0081 //static const double pj_epsilon_lat = 1e-12;
0082 
0083 template <typename T>
0084 struct pj_consts
0085 {
0086     // E L L I P S O I D     P A R A M E T E R S
0087 
0088     T a;                            /* semimajor axis (radius if eccentricity==0) */
0089     T ra;                           /* 1/a */
0090 
0091     T e;                            /* first  eccentricity */
0092     T es;                           /* first  eccentricity squared */
0093     T one_es;                       /* 1 - e^2 */
0094     T rone_es;                      /* 1/one_es */
0095 
0096     T es_orig, a_orig;              /* es and a before any +proj related adjustment */
0097 
0098     // C A R T O G R A P H I C       O F F S E T S
0099 
0100     T lam0, phi0;                   /* central longitude, latitude */
0101     T x0, y0/*, z0, t0*/;           /* false easting and northing (and height and time) */
0102 
0103     // S C A L I N G
0104 
0105     T k0;                           /* general scaling factor */
0106     T to_meter, fr_meter;           /* cartesian scaling */
0107     T vto_meter, vfr_meter;         /* Vertical scaling. Internal unit [m] */
0108 
0109     // D A T U M S   A N D   H E I G H T   S Y S T E M S
0110 
0111     T from_greenwich;               /* prime meridian offset (in radians) */
0112     T long_wrap_center;             /* 0.0 for -180 to 180, actually in radians*/
0113 
0114     srs::detail::towgs84<T> datum_params; /* Parameters for 3PARAM and 7PARAM */
0115     srs::detail::nadgrids nadgrids;       /* Names of horozontal grid files. */
0116     detail::datum_type datum_type;        /* PJD_UNKNOWN/3PARAM/7PARAM/GRIDSHIFT/WGS84 */
0117 
0118     bool is_long_wrap_set;
0119 
0120     // C O O R D I N A T E   H A N D L I N G
0121 
0122     bool over;                       /* over-range flag */
0123     bool geoc;                       /* geocentric latitude flag */
0124     bool is_latlong;                 /* proj=latlong ... not really a projection at all */
0125     bool is_geocent;                 /* proj=geocent ... not really a projection at all */
0126     //bool need_ellps;                 /* 0 for operations that are purely cartesian */
0127 
0128     //enum pj_io_units left;          /* Flags for input/output coordinate types */
0129     //enum pj_io_units right;
0130 
0131     srs::detail::axis axis;
0132     srs::detail::axis sign;
0133 
0134     // Initialize all variables
0135     pj_consts()
0136         : a(0), ra(0)
0137         , e(0), es(0), one_es(0), rone_es(0)
0138         , es_orig(0), a_orig(0)
0139         , lam0(0), phi0(0)
0140         , x0(0), y0(0)/*, z0(0), t0(0)*/
0141         , k0(0) , to_meter(0), fr_meter(0), vto_meter(0), vfr_meter(0)
0142         , from_greenwich(0), long_wrap_center(0)
0143         , datum_type(datum_unknown)
0144         , is_long_wrap_set(false)
0145         , over(false), geoc(false), is_latlong(false), is_geocent(false)
0146         , axis(0,1,2), sign(1,1,1) //the default east, northing, elevation
0147         //, need_ellps(true)
0148         //, left(PJ_IO_UNITS_ANGULAR), right(PJ_IO_UNITS_CLASSIC)
0149     {}
0150 };
0151 
0152 // PROJ4 complex. Might be replaced with std::complex
0153 template <typename T>
0154 struct pj_complex { T r, i; };
0155 
0156 } // namespace detail
0157 #endif // DOXYGEN_NO_DETAIL
0158 
0159 /*!
0160     \brief parameters, projection parameters
0161     \details This structure initializes all projections
0162     \ingroup projection
0163 */
0164 template <typename T>
0165 struct parameters : public detail::pj_consts<T>
0166 {
0167     typedef T type;
0168 
0169     struct proj_id
0170     {
0171         proj_id()
0172             : id(srs::dpar::proj_unknown)
0173         {}
0174 
0175         proj_id(srs::dpar::value_proj i)
0176             : id(i)
0177         {}
0178 
0179         proj_id(std::string const& s)
0180             : id(srs::dpar::proj_unknown)
0181             , name(s)
0182         {}
0183 
0184         bool is_unknown() const
0185         {
0186             return id == srs::dpar::proj_unknown && name.empty();
0187         }
0188 
0189         // Either one of these is set:
0190         srs::dpar::value_proj id; // id of projection
0191         std::string name; // name of projection
0192     };
0193 
0194     proj_id id;
0195 };
0196 
0197 }}} // namespace boost::geometry::projections
0198 #endif // BOOST_GEOMETRY_PROJECTIONS_IMPL_PROJECTS_HPP