diff options
| -rw-r--r-- | .travis.yml | 20 | ||||
| -rw-r--r-- | docs/source/apps/projinfo.rst | 2 | ||||
| -rw-r--r-- | man/man1/projinfo.1 | 2 | ||||
| -rw-r--r-- | src/iso19111/coordinateoperation.cpp | 85 | ||||
| -rw-r--r-- | src/jniproj.cpp | 2 | ||||
| -rw-r--r-- | test/cli/Makefile.am | 20 | ||||
| -rwxr-xr-x | test/cli/test27 | 7 | ||||
| -rwxr-xr-x | test/cli/test83 | 7 | ||||
| -rwxr-xr-x | test/cli/testIGNF | 3 | ||||
| -rwxr-xr-x | test/cli/testcct | 1 | ||||
| -rwxr-xr-x | test/cli/testdatumfile | 1 | ||||
| -rwxr-xr-x | test/cli/testflaky | 1 | ||||
| -rwxr-xr-x | test/cli/testntv2 | 1 | ||||
| -rwxr-xr-x | test/cli/testprojinfo | 1 | ||||
| -rwxr-xr-x | test/cli/testvarious | 3 | ||||
| -rwxr-xr-x | travis/install.sh | 2 | ||||
| -rwxr-xr-x | travis/linux_gcc7/after_success.sh | 5 | ||||
| -rwxr-xr-x | travis/linux_gcc7/before_install.sh | 20 | ||||
| -rwxr-xr-x | travis/linux_gcc7/install.sh | 7 |
19 files changed, 122 insertions, 68 deletions
diff --git a/.travis.yml b/.travis.yml index 137e9afb..bc7e685f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,6 +19,24 @@ matrix: env: - BUILD_NAME=linux_gcc - DETAILS="linux, gcc" + + - os: linux + dist: trusty + sudo: required + services: + - docker + env: + - BUILD_NAME=linux_gcc7 + - DETAILS="linux, gcc7" + - CC=gcc-7 + - CXX=g++-7 + - CXXFLAGS='-g -D_GLIBCXX_ASSERTIONS' + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: ['g++-7','make','autoconf','automake'] + - os: linux dist: trusty compiler: clang @@ -29,11 +47,13 @@ matrix: env: - BUILD_NAME=linux_clang - DETAILS="linux, clang" + - os: osx language: cpp env: - BUILD_NAME=osx - DETAILS="osx" + - os: linux dist: trusty compiler: gcc diff --git a/docs/source/apps/projinfo.rst b/docs/source/apps/projinfo.rst index af9ed171..fb17e480 100644 --- a/docs/source/apps/projinfo.rst +++ b/docs/source/apps/projinfo.rst @@ -103,7 +103,7 @@ The following control parameters can appear in any order: .. option:: --spatial-test contains|intersects Specify how the area of use of coordinate operations found in the database - are compared to the area of use specfied explicitly with :option:`--area` or :option:`--bbox`, + are compared to the area of use specified explicitly with :option:`--area` or :option:`--bbox`, or derivedi implictly from the area of use of the source and target CRS. By default, projinfo will only keep coordinate operations whose are of use is strictly within the area of interest (``contains`` strategy). diff --git a/man/man1/projinfo.1 b/man/man1/projinfo.1 index fcfe3345..eb15ebc4 100644 --- a/man/man1/projinfo.1 +++ b/man/man1/projinfo.1 @@ -144,7 +144,7 @@ only used for coordinate operation computation .TP .B \-\-spatial\-test contains|intersects Specify how the area of use of coordinate operations found in the database -are compared to the area of use specfied explicitly with \fI\%\-\-area\fP or \fI\%\-\-bbox\fP, +are compared to the area of use specified explicitly with \fI\%\-\-area\fP or \fI\%\-\-bbox\fP, or derivedi implictly from the area of use of the source and target CRS. By default, projinfo will only keep coordinate operations whose are of use is strictly within the area of interest (\fBcontains\fP strategy). diff --git a/src/iso19111/coordinateoperation.cpp b/src/iso19111/coordinateoperation.cpp index 7b0adc6f..fbb67e6b 100644 --- a/src/iso19111/coordinateoperation.cpp +++ b/src/iso19111/coordinateoperation.cpp @@ -2156,52 +2156,55 @@ void ParameterValue::_exportToWKT(io::WKTFormatter *formatter) const { const bool isWKT2 = formatter->version() == io::WKTFormatter::Version::WKT2; const auto &l_type = type(); - const auto &l_value = value(); - if (formatter->abridgedTransformation() && l_type == Type::MEASURE) { - const auto &unit = l_value.unit(); - const auto &unitType = unit.type(); - if (unitType == common::UnitOfMeasure::Type::LINEAR) { - formatter->add(l_value.getSIValue()); - } else if (unitType == common::UnitOfMeasure::Type::ANGULAR) { - formatter->add( - l_value.convertToUnit(common::UnitOfMeasure::ARC_SECOND)); - } else if (unit == common::UnitOfMeasure::PARTS_PER_MILLION) { - formatter->add(1.0 + l_value.value() * 1e-6); - } else { - formatter->add(l_value.value()); - } - } else if (l_type == Type::MEASURE) { - const auto &unit = l_value.unit(); - if (isWKT2) { - formatter->add(l_value.value()); - } else { - // In WKT1, as we don't output the natural unit, output to the - // registered linear / angular unit. + if (l_type == Type::MEASURE) { + const auto &l_value = value(); + if (formatter->abridgedTransformation()) { + const auto &unit = l_value.unit(); const auto &unitType = unit.type(); if (unitType == common::UnitOfMeasure::Type::LINEAR) { - const auto &targetUnit = *(formatter->axisLinearUnit()); - if (targetUnit.conversionToSI() == 0.0) { - throw io::FormattingException( - "cannot convert value to target linear unit"); - } - formatter->add(l_value.convertToUnit(targetUnit)); + formatter->add(l_value.getSIValue()); } else if (unitType == common::UnitOfMeasure::Type::ANGULAR) { - const auto &targetUnit = *(formatter->axisAngularUnit()); - if (targetUnit.conversionToSI() == 0.0) { - throw io::FormattingException( - "cannot convert value to target angular unit"); - } - formatter->add(l_value.convertToUnit(targetUnit)); + formatter->add( + l_value.convertToUnit(common::UnitOfMeasure::ARC_SECOND)); + } else if (unit == common::UnitOfMeasure::PARTS_PER_MILLION) { + formatter->add(1.0 + l_value.value() * 1e-6); } else { - formatter->add(l_value.getSIValue()); + formatter->add(l_value.value()); } - } - if (isWKT2 && unit != common::UnitOfMeasure::NONE) { - if (!formatter->primeMeridianOrParameterUnitOmittedIfSameAsAxis() || - (unit != common::UnitOfMeasure::SCALE_UNITY && - unit != *(formatter->axisLinearUnit()) && - unit != *(formatter->axisAngularUnit()))) { - unit._exportToWKT(formatter); + } else { + const auto &unit = l_value.unit(); + if (isWKT2) { + formatter->add(l_value.value()); + } else { + // In WKT1, as we don't output the natural unit, output to the + // registered linear / angular unit. + const auto &unitType = unit.type(); + if (unitType == common::UnitOfMeasure::Type::LINEAR) { + const auto &targetUnit = *(formatter->axisLinearUnit()); + if (targetUnit.conversionToSI() == 0.0) { + throw io::FormattingException( + "cannot convert value to target linear unit"); + } + formatter->add(l_value.convertToUnit(targetUnit)); + } else if (unitType == common::UnitOfMeasure::Type::ANGULAR) { + const auto &targetUnit = *(formatter->axisAngularUnit()); + if (targetUnit.conversionToSI() == 0.0) { + throw io::FormattingException( + "cannot convert value to target angular unit"); + } + formatter->add(l_value.convertToUnit(targetUnit)); + } else { + formatter->add(l_value.getSIValue()); + } + } + if (isWKT2 && unit != common::UnitOfMeasure::NONE) { + if (!formatter + ->primeMeridianOrParameterUnitOmittedIfSameAsAxis() || + (unit != common::UnitOfMeasure::SCALE_UNITY && + unit != *(formatter->axisLinearUnit()) && + unit != *(formatter->axisAngularUnit()))) { + unit._exportToWKT(formatter); + } } } } else if (l_type == Type::STRING || l_type == Type::FILENAME) { diff --git a/src/jniproj.cpp b/src/jniproj.cpp index 59b5b2a0..6f441529 100644 --- a/src/jniproj.cpp +++ b/src/jniproj.cpp @@ -279,7 +279,7 @@ JNIEXPORT jcharArray JNICALL Java_org_proj4_PJ_getAxisDirections { PJ *pj = getPJ(env, object); if (pj) { - int length = strlen(pj->axis); + int length = static_cast<int>(strlen(pj->axis)); jcharArray array = env->NewCharArray(length); if (array) { jchar* axis = env->GetCharArrayElements(array, nullptr); diff --git a/test/cli/Makefile.am b/test/cli/Makefile.am index c0bc0871..47cb1e7f 100644 --- a/test/cli/Makefile.am +++ b/test/cli/Makefile.am @@ -1,5 +1,5 @@ # Executables paths passed to test scripts -DATAPATH = ../../data +PROJ_LIB ?= ../../data THIS_DIR = $(top_srcdir)/test/cli EXEPATH = ../../src PROJEXE = $(EXEPATH)/proj @@ -27,7 +27,7 @@ EXTRA_DIST = pj_out27.dist pj_out83.dist td_out.dist \ CMakeLists.txt testprojinfo-check: - PROJ_LIB=$(DATAPATH) $(TESTPROJINFO) $(PROJINFOEXE) + PROJ_LIB=$(PROJ_LIB) $(TESTPROJINFO) $(PROJINFOEXE) test27-check: $(TEST27) $(PROJEXE) @@ -36,24 +36,24 @@ test83-check: $(TEST83) $(PROJEXE) testvarious-check: - PROJ_LIB=$(DATAPATH) $(TESTVARIOUS) $(CS2CSEXE) + PROJ_LIB=$(PROJ_LIB) $(TESTVARIOUS) $(CS2CSEXE) testdatumfile-check: - @if [ -f $(DATAPATH)/conus -a -f $(DATAPATH)/ntv1_can.dat -a -f $(DATAPATH)/MD -a -f $(DATAPATH)/ntf_r93.gsb ]; then \ - PROJ_LIB=$(DATAPATH) $(TESTDATUMFILE) $(CS2CSEXE) ; \ + @if [ -f $(PROJ_LIB)/conus -a -f $(PROJ_LIB)/ntv1_can.dat -a -f $(PROJ_LIB)/MD -a -f $(PROJ_LIB)/ntf_r93.gsb ]; then \ + PROJ_LIB=$(PROJ_LIB) $(TESTDATUMFILE) $(CS2CSEXE) ; \ fi testign-check: - @if [ -f $(DATAPATH)/ntf_r93.gsb ] ; then \ - PROJ_LIB=$(DATAPATH) $(TESTIGN) $(CS2CSEXE) ; \ + @if [ -f $(PROJ_LIB)/ntf_r93.gsb ] ; then \ + PROJ_LIB=$(PROJ_LIB) $(TESTIGN) $(CS2CSEXE) ; \ fi testntv2-check: - @if [ -f $(DATAPATH)/ntv2_0.gsb ] ; then \ - PROJ_LIB=$(DATAPATH) $(TESTNTV2) $(CS2CSEXE) ; \ + @if [ -f $(PROJ_LIB)/ntv2_0.gsb ] ; then \ + PROJ_LIB=$(PROJ_LIB) $(TESTNTV2) $(CS2CSEXE) ; \ fi testcct-check: - PROJ_LIB=$(DATAPATH) $(TESTCCT) $(CCTEXE) + PROJ_LIB=$(PROJ_LIB) $(TESTCCT) $(CCTEXE) check-local: testprojinfo-check test27-check test83-check testvarious-check testdatumfile-check testign-check testntv2-check testcct-check diff --git a/test/cli/test27 b/test/cli/test27 index 43c060d8..421f9044 100755 --- a/test/cli/test27 +++ b/test/cli/test27 @@ -7,7 +7,6 @@ # Mercator due to greater precision of meridional distance function. # TEST_CLI_DIR=`dirname $0` -DATA_DIR=`dirname $0`/../../data EXE=$1 usage() @@ -26,12 +25,16 @@ if test ! -x ${EXE}; then exit 1 fi +if test -z "${PROJ_LIB}"; then + export PROJ_LIB="`dirname $0`/../../data" +fi + echo "============================================" echo "Running ${0} using ${EXE}:" echo "============================================" OUT=proj_out27 -INIT_FILE=${DATA_DIR}/nad27 +INIT_FILE=${PROJ_LIB}/nad27 # echo "doing tests into file ${OUT}, please wait" # diff --git a/test/cli/test83 b/test/cli/test83 index 82b491a7..59793870 100755 --- a/test/cli/test83 +++ b/test/cli/test83 @@ -8,7 +8,6 @@ # Mercator due to greater precision of meridional distance function. # TEST_CLI_DIR=`dirname $0` -DATA_DIR=`dirname $0`/../../data EXE=$1 usage() @@ -27,12 +26,16 @@ if test ! -x ${EXE}; then exit 1 fi +if test -z "${PROJ_LIB}"; then + export PROJ_LIB="`dirname $0`/../../data" +fi + echo "============================================" echo "Running ${0} using ${EXE}:" echo "============================================" OUT=proj_out83 -INIT_FILE=${DATA_DIR}/nad83 +INIT_FILE=${PROJ_LIB}/nad83 # echo "doing tests into file ${OUT}, please wait" # diff --git a/test/cli/testIGNF b/test/cli/testIGNF index 0fa04e84..2b2d5a57 100755 --- a/test/cli/testIGNF +++ b/test/cli/testIGNF @@ -12,7 +12,6 @@ # the gsb grid is still ok TEST_CLI_DIR=`dirname $0` -DATA_DIR=`dirname $0`/../../data EXE=$1 usage() @@ -32,7 +31,7 @@ if test ! -x ${EXE}; then fi if test -z "${PROJ_LIB}"; then - export PROJ_LIB=${DATA_DIR} + export PROJ_LIB="`dirname $0`/../../data" fi echo "============================================" diff --git a/test/cli/testcct b/test/cli/testcct index 93749052..3fb0dd95 100755 --- a/test/cli/testcct +++ b/test/cli/testcct @@ -2,7 +2,6 @@ # Test cct TEST_CLI_DIR=`dirname $0` -DATA_DIR=`dirname $0`/../../data EXE=$1 usage() diff --git a/test/cli/testdatumfile b/test/cli/testdatumfile index e8995150..27c39840 100755 --- a/test/cli/testdatumfile +++ b/test/cli/testdatumfile @@ -4,7 +4,6 @@ # # TEST_CLI_DIR=`dirname $0` -DATA_DIR=`dirname $0`/../../data EXE=$1 usage() diff --git a/test/cli/testflaky b/test/cli/testflaky index af56a9cd..0b823cf6 100755 --- a/test/cli/testflaky +++ b/test/cli/testflaky @@ -4,7 +4,6 @@ # # TEST_CLI_DIR=`dirname $0` -DATA_DIR=`dirname $0`/../../data EXE=$1 usage() diff --git a/test/cli/testntv2 b/test/cli/testntv2 index e82026fc..50b5d0ca 100755 --- a/test/cli/testntv2 +++ b/test/cli/testntv2 @@ -4,7 +4,6 @@ # # TEST_CLI_DIR=`dirname $0` -DATA_DIR=`dirname $0`/../../data EXE=$1 usage() diff --git a/test/cli/testprojinfo b/test/cli/testprojinfo index 08ec9ce4..244e1bd5 100755 --- a/test/cli/testprojinfo +++ b/test/cli/testprojinfo @@ -2,7 +2,6 @@ # Test projinfo TEST_CLI_DIR=`dirname $0` -DATA_DIR=`dirname $0`/../../data EXE=$1 usage() diff --git a/test/cli/testvarious b/test/cli/testvarious index c1fa61df..43b1f63c 100755 --- a/test/cli/testvarious +++ b/test/cli/testvarious @@ -4,7 +4,6 @@ # # TEST_CLI_DIR=`dirname $0` -DATA_DIR=`dirname $0`/../../data EXE=$1 usage() @@ -24,7 +23,7 @@ if test ! -x ${EXE}; then fi if test -z "${PROJ_LIB}"; then - export PROJ_LIB=$DATA_DIR + export PROJ_LIB="`dirname $0`/../../data" fi # Would be great to have a universale way of selecting a locale with diff --git a/travis/install.sh b/travis/install.sh index 2013a610..f5fa7d08 100755 --- a/travis/install.sh +++ b/travis/install.sh @@ -23,7 +23,7 @@ cd $TAR_DIRECTORY mkdir build_autoconf cd build_autoconf if [ -f /usr/lib/jvm/java-7-openjdk-amd64/include/jni.h ]; then - CXXFLAGS="-I/usr/lib/jvm/java-7-openjdk-amd64/include -I/usr/lib/jvm/java-7-openjdk-amd64/include/linux" ../configure --prefix=/tmp/proj_autoconf_install_from_dist_all --with-jni + CXXFLAGS="-I/usr/lib/jvm/java-7-openjdk-amd64/include -I/usr/lib/jvm/java-7-openjdk-amd64/include/linux $CXXFLAGS" ../configure --prefix=/tmp/proj_autoconf_install_from_dist_all --with-jni else ../configure --prefix=/tmp/proj_autoconf_install_from_dist_all fi diff --git a/travis/linux_gcc7/after_success.sh b/travis/linux_gcc7/after_success.sh new file mode 100755 index 00000000..70c6f5cb --- /dev/null +++ b/travis/linux_gcc7/after_success.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +set -e + +#./travis/after_success.sh diff --git a/travis/linux_gcc7/before_install.sh b/travis/linux_gcc7/before_install.sh new file mode 100755 index 00000000..25c7483f --- /dev/null +++ b/travis/linux_gcc7/before_install.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -e + +./travis/before_install.sh + +sudo apt-get update -qq +sudo apt-get install -y cppcheck +sudo apt-get install -qq lcov +sudo apt-get install -qq doxygen graphviz +sudo apt-get install -qq sqlite3 libsqlite3-dev +sudo apt-get install -qq openjdk-7-jdk + +#scripts/cppcheck.sh +#scripts/doxygen.sh + +#pip install --user sphinxcontrib-bibtex +#pip install --user cpp-coveralls + +#./travis/docker.sh diff --git a/travis/linux_gcc7/install.sh b/travis/linux_gcc7/install.sh new file mode 100755 index 00000000..b957b927 --- /dev/null +++ b/travis/linux_gcc7/install.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e + +export CCACHE_CPP2=yes + +CC="ccache $CC" CXX="ccache $CXX" CFLAGS="-std=c89 -Werror $CFLAGS" CXXFLAGS="-Werror $CXXFLAGS" ./travis/install.sh |
