diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-12-12 22:09:11 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2020-12-12 22:23:28 +0100 |
| commit | 4bc3fec94ae0c27c6327e163ea35098347bac0f1 (patch) | |
| tree | f54d2b42f20e9a3e34cc6bdd9728b8f8ebc53f4b /scripts/build_esri_projection_mapping.py | |
| parent | 6857d1a4a8eb6fcb7b88b0339413913ba2c3351a (diff) | |
| download | PROJ-4bc3fec94ae0c27c6327e163ea35098347bac0f1.tar.gz PROJ-4bc3fec94ae0c27c6327e163ea35098347bac0f1.zip | |
Split coordinateoperation.cpp in many files in iso19111/operation directory
The big size of coordinateoperation.cpp could require significant amount
of RAM to build it with -O2 level, and cause compiler crashes in some
environments.
Diffstat (limited to 'scripts/build_esri_projection_mapping.py')
| -rw-r--r-- | scripts/build_esri_projection_mapping.py | 60 |
1 files changed, 46 insertions, 14 deletions
diff --git a/scripts/build_esri_projection_mapping.py b/scripts/build_esri_projection_mapping.py index 00a49c68..752f9850 100644 --- a/scripts/build_esri_projection_mapping.py +++ b/scripts/build_esri_projection_mapping.py @@ -751,7 +751,19 @@ def generate_mapping(WKT2_name, esri_proj_name, Params, suffix=''): all_projs.append([esri_proj_name, WKT2_name_s, c_name]) else: all_projs.append([esri_proj_name, WKT2_name, c_name]) - print('static const ESRIParamMapping %s[] = { ' % c_name) + + qualifier = 'static ' + if c_name in ('paramsESRI_Plate_Carree', + 'paramsESRI_Equidistant_Cylindrical', + 'paramsESRI_Gauss_Kruger', + 'paramsESRI_Transverse_Mercator', + 'paramsESRI_Hotine_Oblique_Mercator_Azimuth_Natural_Origin', + 'paramsESRI_Rectified_Skew_Orthomorphic_Natural_Origin', + 'paramsESRI_Hotine_Oblique_Mercator_Azimuth_Center', + 'paramsESRI_Rectified_Skew_Orthomorphic_Center'): + qualifier = '' + + print(qualifier + 'const ESRIParamMapping %s[] = { ' % c_name) for param in Params: for param_name in param: param_value = param[param_name] @@ -803,24 +815,22 @@ print(""" * DEALINGS IN THE SOFTWARE. ****************************************************************************/ -#ifndef FROM_COORDINATE_OPERATION_CPP -#error This file should only be included from coordinateoperation.cpp +#ifndef FROM_PROJ_CPP +#define FROM_PROJ_CPP #endif -#ifndef ESRI_PROJECTION_MAPPINGS_HH_INCLUDED -#define ESRI_PROJECTION_MAPPINGS_HH_INCLUDED +#include "esriparammappings.hpp" +#include "proj_constants.h" -#include "coordinateoperation_internal.hpp" +#include "proj/internal/internal.hpp" -//! @cond Doxygen_Suppress +NS_PROJ_START -// --------------------------------------------------------------------------- +using namespace internal; -// anonymous namespace -namespace { +namespace operation { -using namespace ::NS_PROJ; -using namespace ::NS_PROJ::operation; +//! @cond Doxygen_Suppress """) @@ -841,6 +851,7 @@ for item in config: count += 1 print('') + print('static const ESRIMethodMapping esriMappings[] = {') for esri_proj_name, WKT2_name, c_name in all_projs: if WKT2_name.startswith('EPSG_'): @@ -852,11 +863,32 @@ for esri_proj_name, WKT2_name, c_name in all_projs: print('};') print(""" + // --------------------------------------------------------------------------- -} // namespace { +const ESRIMethodMapping *getEsriMappings(size_t &nElts) { + nElts = sizeof(esriMappings) / sizeof(esriMappings[0]); + return esriMappings; +} + +// --------------------------------------------------------------------------- + +std::vector<const ESRIMethodMapping *> +getMappingsFromESRI(const std::string &esri_name) { + std::vector<const ESRIMethodMapping *> res; + for (const auto &mapping : esriMappings) { + if (ci_equal(esri_name, mapping.esri_name)) { + res.push_back(&mapping); + } + } + return res; +} //! @endcond -#endif // ESRI_PROJECTION_MAPPINGS_HH_INCLUDED +// --------------------------------------------------------------------------- + +} // namespace operation +NS_PROJ_END + """) |
