Skip to content

Commit

Permalink
Merge pull request #2484 from rouault/backport_7_2_split_coordinateop…
Browse files Browse the repository at this point in the history
…eration

[Backport 7.2] Split coordinateoperation.cpp and test_operation.cpp in several parts
  • Loading branch information
rouault authored Dec 14, 2020
2 parents 2803261 + b451382 commit cf43868
Show file tree
Hide file tree
Showing 32 changed files with 23,263 additions and 22,164 deletions.
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.

INPUT = src/iso19111 include/proj src/proj.h src/proj_experimental.h src/general_doc.dox src/filemanager.cpp src/networkfilemanager.cpp
INPUT = src/iso19111 src/iso19111/operation include/proj src/proj.h src/proj_experimental.h src/general_doc.dox src/filemanager.cpp src/networkfilemanager.cpp

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
Expand Down
3 changes: 0 additions & 3 deletions include/proj/internal/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
SUBDIRS = nlohmann

noinst_HEADERS = \
coordinateoperation_constants.hpp \
coordinateoperation_internal.hpp \
esri_projection_mappings.hpp \
coordinatesystem_internal.hpp \
internal.hpp \
io_internal.hpp \
Expand Down
60 changes: 46 additions & 14 deletions scripts/build_esri_projection_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -803,24 +815,22 @@ def generate_mapping(WKT2_name, esri_proj_name, Params, suffix=''):
* 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
""")

Expand All @@ -841,6 +851,7 @@ def generate_mapping(WKT2_name, esri_proj_name, Params, suffix=''):
count += 1
print('')


print('static const ESRIMethodMapping esriMappings[] = {')
for esri_proj_name, WKT2_name, c_name in all_projs:
if WKT2_name.startswith('EPSG_'):
Expand All @@ -852,11 +863,32 @@ def generate_mapping(WKT2_name, esri_proj_name, Params, suffix=''):
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
""")
2 changes: 1 addition & 1 deletion scripts/doxygen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ rm -rf docs/build/xml/
# Ugly hack to workaround a bug of Doxygen 1.8.17 that erroneously detect proj_network_get_header_value_cbk_type/ as a variable
sed "s/const char\* (\*proj_network_get_header_value_cbk_type/CONST_CHAR\* (\*proj_network_get_header_value_cbk_type/" < src/proj.h > docs/build/tmp_breathe/proj.h

(cat Doxyfile; printf "GENERATE_HTML=NO\nGENERATE_XML=YES\nINPUT= src/iso19111 include/proj docs/build/tmp_breathe/proj.h src/filemanager.cpp src/networkfilemanager.cpp docs/build/tmp_breathe/general_doc.dox.reworked.h") | doxygen - > docs/build/tmp_breathe/docs_log.txt 2>&1
(cat Doxyfile; printf "GENERATE_HTML=NO\nGENERATE_XML=YES\nINPUT= src/iso19111 src/iso19111/operation include/proj docs/build/tmp_breathe/proj.h src/filemanager.cpp src/networkfilemanager.cpp docs/build/tmp_breathe/general_doc.dox.reworked.h") | doxygen - > docs/build/tmp_breathe/docs_log.txt 2>&1
if grep -i warning docs/build/tmp_breathe/docs_log.txt; then
echo "Doxygen warnings found" && cat docs/build/tmp_breathe/docs_log.txt && /bin/false;
else
Expand Down
5 changes: 4 additions & 1 deletion scripts/reformat_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ esac
TOPDIR="$SCRIPT_DIR/.."

for i in "$TOPDIR"/include/proj/*.hpp "$TOPDIR"/include/proj/internal/*.hpp \
"$TOPDIR"/src/iso19111/*.cpp "$TOPDIR"/test/unit/*.cpp \
"$TOPDIR"/src/iso19111/*.cpp \
"$TOPDIR"/src/iso19111/operation/*.cpp \
"$TOPDIR"/src/iso19111/operation/*.hpp \
"$TOPDIR"/test/unit/*.cpp \
"$TOPDIR"/src/apps/projinfo.cpp "$TOPDIR"/src/apps/projsync.cpp \
"$TOPDIR"/src/tracing.cpp "$TOPDIR"/src/grids.hpp "$TOPDIR"/src/grids.cpp \
"$TOPDIR"/src/filemanager.hpp "$TOPDIR"/src/filemanager.cpp \
Expand Down
18 changes: 17 additions & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,23 @@ libproj_la_SOURCES = \
iso19111/crs.cpp \
iso19111/datum.cpp \
iso19111/coordinatesystem.cpp \
iso19111/coordinateoperation.cpp \
iso19111/operation/concatenatedoperation.cpp \
iso19111/operation/coordinateoperation_internal.hpp \
iso19111/operation/coordinateoperation_private.hpp \
iso19111/operation/coordinateoperationfactory.cpp \
iso19111/operation/conversion.cpp \
iso19111/operation/esriparammappings.hpp \
iso19111/operation/esriparammappings.cpp \
iso19111/operation/operationmethod_private.hpp \
iso19111/operation/oputils.hpp \
iso19111/operation/oputils.cpp \
iso19111/operation/parammappings.hpp \
iso19111/operation/parammappings.cpp \
iso19111/operation/projbasedoperation.cpp \
iso19111/operation/singleoperation.cpp \
iso19111/operation/transformation.cpp \
iso19111/operation/vectorofvaluesparams.hpp \
iso19111/operation/vectorofvaluesparams.cpp \
iso19111/io.cpp \
iso19111/internal.cpp \
iso19111/factory.cpp \
Expand Down
Loading

0 comments on commit cf43868

Please sign in to comment.