diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 14447a38dc8eacbe4120bcdc5930ad6f491e124f..6ad790bddcad7d8dde0d33f32750ccac23e38e96 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -54,11 +54,11 @@ stages: paths: - build/*/*.log #CMake log - log/*.txt # Others - - build/CookBook-*-html.tar.gz - - build/Documentation/Cookbook/latex/CookBook-*.pdf - - build/Documentation/Doxygen/OTB-Doxygen-*.tar.bz2 - - build_packages/OTB-*.run - - build_packages/OTB-*.zip + - CookBook-*-html.tar.gz + - CookBook-*.pdf + - OTB-Doxygen-*.tar.bz2 + - OTB-*.run + - OTB-*.zip - build/compile_commands.json - build/ctest_report.xml - build/cppcheck_report.xml @@ -111,12 +111,16 @@ ubuntu-xdk-prepare: script: - ctest -VV -S CI/prepare_superbuild.cmake -DIMAGE_NAME:string=otb-ubuntu-superbuild-base -ubuntu-xdk-build: +ubuntu-xdk-build-doc: extends: .common-build image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-base:18.04 script: - xvfb-run -a -n 1 -s "-screen 0 1024x768x24 -dpi 96" ctest -V -S CI/main_superbuild.cmake -DIMAGE_NAME:string=ubuntu-18.04-llvm-xdk + - mv build/CookBook-*-html.tar.gz . || true + - mv build/Documentation/Cookbook/latex/CookBook-*.pdf . || true + - mv build/Documentation/Doxygen/OTB-Doxygen-*.tar.bz2 . || true - xvfb-run -a -n 1 -s "-screen 0 1024x768x24 -dpi 96" ctest -V -S CI/main_packages.cmake -DIMAGE_NAME:string=otb-ubuntu-superbuild-base -DNAME_SUFFIX:string=-glibc-2.27 + - mv build_packages/OTB-*.run . || true dependencies: - ubuntu-xdk-prepare @@ -133,6 +137,7 @@ centos-xdk-build: script: - xvfb-run -a -n 1 -s "-screen 0 1024x768x24 -dpi 96" ctest -V -S CI/main_superbuild.cmake -DIMAGE_NAME:string=otb-centos-superbuild-base - xvfb-run -a -n 1 -s "-screen 0 1024x768x24 -dpi 96" ctest -V -S CI/main_packages.cmake -DIMAGE_NAME:string=otb-centos-superbuild-base + - mv build_packages/OTB-*.run . || true dependencies: - centos-xdk-prepare @@ -151,6 +156,7 @@ macos-xdk-build: script: - ctest -V -S CI/main_superbuild.cmake -DIMAGE_NAME:string=otb-macos-superbuild - ctest -V -S CI/main_packages.cmake -DIMAGE_NAME:string=otb-macos-superbuild + - mv build_packages/OTB-*.run . || true dependencies: - macos-xdk-prepare @@ -190,6 +196,7 @@ windows-10-build: - ctest -V -S CI/main_superbuild.cmake - clcache.exe -s - ctest -V -S CI/main_packages.cmake + - move "build_packages\OTB-*.zip" . || dir build_packages dependencies: - windows-10-prepare @@ -214,6 +221,7 @@ windows-8-build: - ctest -V -S CI/main_superbuild.cmake - clcache.exe -s - ctest -V -S CI/main_packages.cmake + - move "build_packages\OTB-*.zip" . || dir build_packages dependencies: - windows-8-prepare @@ -305,7 +313,7 @@ deploy: script: - ./CI/deploy.sh $CI_COMMIT_REF_NAME $RC_NUMBER dependencies: - - ubuntu-xdk-build + - ubuntu-xdk-build-doc - centos-xdk-build - macos-xdk-build - windows-8-build diff --git a/CI/Dockerfile.nat b/CI/Dockerfile.nat deleted file mode 100644 index 191c5eeb7c1d82041773c58b7baac49a73a1c051..0000000000000000000000000000000000000000 --- a/CI/Dockerfile.nat +++ /dev/null @@ -1,78 +0,0 @@ -FROM ubuntu:18.04 -MAINTAINER Sebastien Dinot <sebastien.dinot@c-s.fr> - -ENV DEBIAN_FRONTEND noninteractive - -RUN echo "Europe/Paris" > /etc/timezone - -# ---------------------------------------------------------------------------- -# First stage : install tools (they rarely evolve) -# ---------------------------------------------------------------------------- -RUN apt-get update -y \ - && apt-get upgrade -y \ - && apt-get install -y --no-install-recommends \ - ca-certificates \ - curl \ - make \ - cmake \ - ninja-build \ - g++ \ - gcc \ - clang \ - clang-tidy \ - clang-format \ - ccache \ - git \ - libtool \ - swig \ - xvfb \ - && rm -rf /var/lib/apt/lists/* - -# ---------------------------------------------------------------------------- -# Second stage : dependencies (they evolve more often) -# ---------------------------------------------------------------------------- -RUN apt-get update -y \ - && apt-get upgrade -y \ - && apt-get install -y --no-install-recommends \ - freeglut3-dev \ - libboost-date-time-dev \ - libboost-filesystem-dev \ - libboost-graph-dev \ - libboost-program-options-dev \ - libboost-system-dev \ - libboost-thread-dev \ - libcurl4-gnutls-dev \ - libexpat1-dev \ - libfftw3-dev \ - libgdal-dev \ - libgeotiff-dev \ - libglew-dev \ - libglfw3-dev \ - libgsl-dev \ - libinsighttoolkit4-dev \ - libkml-dev \ - libmuparser-dev \ - libmuparserx-dev \ - libopencv-core-dev \ - libopencv-ml-dev \ - libopenmpi-dev \ - libopenthreads-dev \ - libossim-dev \ - libpng-dev \ - libqt5opengl5-dev \ - libqwt-qt5-dev \ - libsvm-dev \ - libtinyxml-dev \ - qtbase5-dev \ - qttools5-dev \ - default-jdk \ - python-dev \ - python-numpy \ - python-gdal \ - python3-dev \ - python3-numpy \ - python3-gdal \ - && rm -rf /var/lib/apt/lists/* - -ENV PATH /usr/lib/ccache:$PATH -ENV OTB_USE_SHARK OFF diff --git a/CI/Dockerfile.shark3.1.4 b/CI/Dockerfile.shark3.1.4 deleted file mode 100644 index 96f52716c097c5f1ca36fa0de85710a2b619e7d8..0000000000000000000000000000000000000000 --- a/CI/Dockerfile.shark3.1.4 +++ /dev/null @@ -1,126 +0,0 @@ -FROM ubuntu:18.04 as shark-provider -MAINTAINER OrfeoToolbox Core Team - -ENV DEBIAN_FRONTEND noninteractive - -# ---------------------------------------------------------------------------- -# First stage : install tools -# (based on https://github.com/Shark-ML/Shark/blob/master/.travis.yml) -# ---------------------------------------------------------------------------- - -RUN apt-get update -y \ - && apt-get upgrade -y \ - && apt-get install -y --no-install-recommends \ - ca-certificates \ - g++ \ - make \ - cmake \ - libboost-date-time-dev \ - libboost-filesystem-dev \ - libboost-graph-dev \ - libboost-program-options-dev \ - libboost-system-dev \ - libboost-thread-dev \ - libcurl4-gnutls-dev \ - curl \ - && rm -rf /var/lib/apt/lists/* - -RUN cd \tmp \ - && curl -o shark.tar.gz https://codeload.github.com/Shark-ML/Shark/tar.gz/v3.1.4 \ - && tar xzf shark.tar.gz \ - && cd Shark-3.1.4\ - && mkdir build \ - && cd build \ - && cmake -DBUILD_EXAMPLES:BOOL=OFF \ - -DBUILD_TESTING:BOOL=OFF \ - -DENABLE_HDF5:BOOL=OFF \ - -DBUILD_SHARED_LIBS=ON \ - -DENABLE_CBLAS:BOOL=OFF \ - -DENABLE_OPENMP:BOOL=OFF \ - ../. \ - && make install - -FROM ubuntu:18.04 -MAINTAINER Sebastien Dinot <sebastien.dinot@c-s.fr> - -ENV DEBIAN_FRONTEND noninteractive - -RUN echo "Europe/Paris" > /etc/timezone - -# ---------------------------------------------------------------------------- -# First stage : install tools (they rarely evolve) -# ---------------------------------------------------------------------------- -RUN apt-get update -y \ - && apt-get upgrade -y \ - && apt-get install -y --no-install-recommends \ - ca-certificates \ - curl \ - make \ - cmake \ - ninja-build \ - g++ \ - gcc \ - clang \ - clang-tidy \ - clang-format \ - ccache \ - git \ - libtool \ - swig \ - xvfb \ - && rm -rf /var/lib/apt/lists/* - -# ---------------------------------------------------------------------------- -# Second stage : dependencies (they evolve more often) -# ---------------------------------------------------------------------------- - -RUN apt-get update -y \ - && apt-get upgrade -y \ - && apt-get install -y --no-install-recommends \ - freeglut3-dev \ - libboost-date-time-dev \ - libboost-filesystem-dev \ - libboost-graph-dev \ - libboost-program-options-dev \ - libboost-system-dev \ - libboost-thread-dev \ - libcurl4-gnutls-dev \ - libexpat1-dev \ - libfftw3-dev \ - libgdal-dev \ - libgeotiff-dev \ - libglew-dev \ - libglfw3-dev \ - libgsl-dev \ - libinsighttoolkit4-dev \ - libkml-dev \ - libmuparser-dev \ - libmuparserx-dev \ - libopencv-core-dev \ - libopencv-ml-dev \ - libopenmpi-dev \ - libopenthreads-dev \ - libossim-dev \ - libpng-dev \ - libqt5opengl5-dev \ - libqwt-qt5-dev \ - libsvm-dev \ - libtinyxml-dev \ - qtbase5-dev \ - qttools5-dev \ - default-jdk \ - python-dev \ - python-numpy \ - python-gdal \ - python3-dev \ - python3-numpy \ - python3-gdal \ - && rm -rf /var/lib/apt/lists/* - -COPY --from=shark-provider /usr/local/include/shark/* /usr/include/shark/ -COPY --from=shark-provider /usr/local/lib/libshark* /usr/lib/ -COPY --from=shark-provider /usr/local/bin/SharkVersion /usr/bin/ -COPY --from=shark-provider /usr/local/lib/cmake/ /usr/lib/cmake/ - -ENV PATH /usr/lib/ccache:$PATH -ENV OTB_USE_SHARK ON diff --git a/CI/deploy.sh b/CI/deploy.sh index d3b0385f05c70847526854123d27c4640956042c..e3621361d210e7d5a1f2e3081ed981768db5025d 100755 --- a/CI/deploy.sh +++ b/CI/deploy.sh @@ -37,27 +37,17 @@ else # On release fi # Push package -ls -all build_packages/ echo "Renaming binary packages" -# find build_packages/. -name "*.run" \ -# -exec sh -c 'mv "$1" "${1%.run}${pack_suffix}.run"' _ {} \; -for name in $(find build_packages/. -name "OTB-*.*") - do +for name in $(find . -regex "./OTB-.*\(run\|zip\)"); do len=(${#name}) mv "$name" "${name:0:$len-4}${pack_suffix}${name:$len-4}" done -# TO REMOVE -########### -ls -all build_packages/ -########### echo "Pushing binary packages" -scp build_packages/OTB-*.{run,zip} otbpush@otb5-vm2.orfeo-toolbox.org:${jobs_directory}/. +scp OTB-*.{run,zip} otbpush@otb5-vm2.orfeo-toolbox.org:${jobs_directory}/. # Push doc echo "Pushing documentation" -scp build/{CookBook-*-html.tar.gz,\ -/Documentation/{Cookbook/latex/CookBook-*.pdf,Doxygen/OTB-Doxygen-*.tar.bz2}} \ -otbpush@otb5-vm2.orfeo-toolbox.org:${jobs_directory}/. +scp {CookBook-*-html.tar.gz,CookBook-*.pdf,OTB-Doxygen-*.tar.bz2} otbpush@otb5-vm2.orfeo-toolbox.org:${jobs_directory}/. # Create zip, tar.gz and tar.xy source echo "Creating source tarball and zip" @@ -75,4 +65,4 @@ echo "Pushing new sources" scp OTB-sources-$CI_COMMIT_SHORT_SHA.* \ otbpush@otb5-vm2.orfeo-toolbox.org:${jobs_directory}/ - \ No newline at end of file + diff --git a/Modules/Remote/diapotb.remote.cmake b/Modules/Remote/diapotb.remote.cmake index c679c41bdabb67ad4218279bc93b331d49387e3f..cc771e7f1d620088b347badb112eb4572b23719d 100644 --- a/Modules/Remote/diapotb.remote.cmake +++ b/Modules/Remote/diapotb.remote.cmake @@ -2,5 +2,5 @@ otb_fetch_module(DiapOTBModule "OTB module for SAR processing in Diapason." GIT_REPOSITORY https://gitlab.orfeo-toolbox.org/remote_modules/diapotb.git - GIT_TAG master + GIT_TAG d38457a019d2ef15a47d04c21f235c9e9fe4acd5 ) diff --git a/Modules/Wrappers/QGIS/src/otbQgisDescriptor.cxx b/Modules/Wrappers/QGIS/src/otbQgisDescriptor.cxx index 609a8e658750f459382830d6c818eee13315ab2f..0f46c783e090d1572dc18de4987ad6782e489eb7 100644 --- a/Modules/Wrappers/QGIS/src/otbQgisDescriptor.cxx +++ b/Modules/Wrappers/QGIS/src/otbQgisDescriptor.cxx @@ -91,7 +91,7 @@ int main(int argc, char* argv[]) std::string output_file = module + ".txt"; std::string algs_txt = "algs.txt"; - if (argc > 3) + if ( argc > 3 ) { output_file = std::string(argv[3]) + module + ".txt"; algs_txt = std::string(argv[3]) + "algs.txt"; @@ -102,12 +102,12 @@ int main(int argc, char* argv[]) std::string output_parameter_name; bool hasRasterOutput = false; { - for (unsigned int i = 0; i < nbOfParam; i++) + for ( unsigned int i = 0; i < nbOfParam; i++ ) { - Parameter::Pointer param = appli->GetParameterByKey(appKeyList[i]); - if (param->GetMandatory()) + Parameter::Pointer param = appli->GetParameterByKey( appKeyList[i] ); + if ( param->GetMandatory() ) { - if (appli->GetParameterType(appKeyList[i]) == ParameterType_OutputImage) + if ( appli->GetParameterType( appKeyList[i] ) == ParameterType_OutputImage ) { output_parameter_name = appKeyList[i]; hasRasterOutput = true; @@ -116,15 +116,24 @@ int main(int argc, char* argv[]) } } - if(output_parameter_name.empty()) + if( output_parameter_name.empty() ) dFile << module << std::endl; else dFile << module << "|" << output_parameter_name << std::endl; dFile << appli->GetDescription() << std::endl; dFile << group << std::endl; + + /* + From here onwards each line appended to dFile is passed to QgsProcessingParameter* class constructor. + dFile is nothing but a csv (with a .txt) with "|" as delimiter character. + First field is the name of Qgis parameter class and rest of it are extracted as list and passed to class constructor. + Parsing and calling of paramater classes are done by python. + source available : qgis/python/plugins/processing/core/parameters.py + source code of qgis parameter is available at: qgis/src/core/processing/qgsprocessingparameters.cpp + */ - for (unsigned int i = 0; i < nbOfParam; i++) + for ( unsigned int i = 0; i < nbOfParam; i++ ) { const std::string name = appKeyList[i]; const Parameter::Pointer param = appli->GetParameterByKey(name); @@ -166,15 +175,14 @@ int main(int argc, char* argv[]) } #endif - bool isDestination = false; bool isEpsgCode = false; // use QgsProcessingParameterCrs if required. // TODO: do a regex on name to match ==epsg || *\.epsg.\* if ( name == "epsg" - || name == "map.epsg.code" - || name == "mapproj.epsg.code" - || name == "mode.epsg.code") + || name == "map.epsg.code" + || name == "mapproj.epsg.code" + || name == "mode.epsg.code" ) { qgis_type = "QgsProcessingParameterCrs"; isEpsgCode = true; @@ -183,9 +191,9 @@ int main(int argc, char* argv[]) dFile << qgis_type << "|" << name << "|" << description; std::string default_value = "None"; - if (type == ParameterType_Int) + if ( type == ParameterType_Int ) { - if (isEpsgCode) + if ( isEpsgCode ) { if (param->HasValue() && appli->GetParameterInt(name) < 1) default_value = "EPSG: " + appli->GetParameterAsString(name); @@ -198,43 +206,41 @@ int main(int argc, char* argv[]) default_value = param->HasValue() ? appli->GetParameterAsString(name): "0"; } } - else if (type == ParameterType_Float) + else if ( type == ParameterType_Float ) { dFile << "|QgsProcessingParameterNumber.Double"; default_value = param->HasValue() ? appli->GetParameterAsString(name): "0"; } - else if (type == ParameterType_Radius) + else if ( type == ParameterType_Radius ) { dFile << "|QgsProcessingParameterNumber.Integer"; default_value = param->HasValue() ? appli->GetParameterAsString(name): "0"; } - else if(type == ParameterType_InputFilename) + else if ( type == ParameterType_InputFilename ) { // TODO: if parameter InputFilename can give supported extensions // we can use it gitlab #1559 dFile << "|QgsProcessingParameterFile.File|None"; } - else if(type == ParameterType_Directory) + else if( type == ParameterType_Directory ) { dFile << "|QgsProcessingParameterFile.Folder|False"; } - else if (type == ParameterType_InputImageList) + else if ( type == ParameterType_InputImageList ) { dFile << "|3"; //QgsProcessing.TypeRaster } - else if (type == ParameterType_InputVectorDataList) + else if ( type == ParameterType_InputVectorDataList + || type == ParameterType_InputVectorData + || type == ParameterType_OutputVectorData ) { dFile << "|-1"; //QgsProcessing.TypeVectorAnyGeometry } - else if (type == ParameterType_InputVectorData) - { - dFile << "|-1"; //QgsProcessing.TypeVectorAnyGeometry - } - else if(type == ParameterType_InputFilenameList) + else if ( type == ParameterType_InputFilenameList ) { dFile << "|4"; //QgsProcessing.TypeFile" } - else if(type == ParameterType_String) + else if ( type == ParameterType_String ) { // Below line is interpreted in qgis processing as // 1. default_value = None @@ -253,10 +259,16 @@ int main(int argc, char* argv[]) // setting default_value this way is an exception for ParameterType_StringList and ParameterType_String default_value = "None|True"; } - else if (type == ParameterType_InputImage) + else if (type == ParameterType_InputImage || type == ParameterType_OutputImage) { // default is None and nothing to add to dFile } + else if (type == ParameterType_OutputFilename) + { + // fileFilter and defaultValue is None + // OTB does not have any implementation for file extension. + default_value = "None|None"; + } else if(type == ParameterType_ListView) { // default is None and nothing to add to dFile @@ -277,38 +289,27 @@ int main(int argc, char* argv[]) ChoiceParameter *cparam = dynamic_cast<ChoiceParameter*>(param.GetPointer()); default_value = std::to_string(cparam->GetValue()); } - else if(type == ParameterType_OutputVectorData || - type == ParameterType_OutputImage || - type == ParameterType_OutputFilename) - { - // No need for default_value, optional and extra fields in dFile. - // If parameter is a destination type. qgis_type|name|description is enough. - // So we simply set isDestination to true and skip to end to append a new line. - isDestination = true; - } else { std::cout << "ERROR: default_value is empty for '" << name << "' type='" << qgis_type << "'" << std::endl; return EXIT_FAILURE; } - if (!isDestination) + std::string optional; + if ( param->GetMandatory() ) { - std::string optional; - if (param->GetMandatory()) - { - // TODO: avoid workaround for stringlist types (fix appengine) - // type == ParameterType_StringList check is needed because: - // If parameter is mandatory it can have no value - // It is accepted in OTB that, string list could be generated dynamically - // qgis has no such option to handle dynamic values yet.. - // So mandatory parameters whose type is StringList is considered optional - optional = param->HasValue() || type == ParameterType_StringList ? "True" : "False"; - } - else - { - optional = "True"; - } + // TODO: avoid workaround for stringlist types (fix appengine) + // type == ParameterType_StringList check is needed because: + // If parameter is mandatory it can have no value + // It is accepted in OTB that, string list could be generated dynamically + // qgis has no such option to handle dynamic values yet.. + // So mandatory parameters whose type is StringList is considered optional + optional = param->HasValue() || type == ParameterType_StringList ? "True" : "False"; + } + else + { + optional = "True"; + } #if 0 std::cerr << name; std::cerr << " mandatory=" << param->GetMandatory(); @@ -316,8 +317,7 @@ int main(int argc, char* argv[]) std::cerr << " qgis_type=" << qgis_type; std::cerr << " optional=" << optional << std::endl; #endif - dFile << "|" << default_value << "|" << optional; - } + dFile << "|" << default_value << "|" << optional; dFile << std::endl; }