diff --git a/.travis.yml b/.travis.yml index 57e2a46096cd5394605d34555e99f75278249c4a..ec99d4dea9a1ee15fcf3db29a8e2d6244e39ab90 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,10 +6,10 @@ dist: trusty compiler: - clang -addons: - apt: - packages: - - libboost-all-dev +# addons: +# apt: +# packages: +# - libboost-all-dev cache: ccache diff --git a/CMake/FindMuParserX.cmake b/CMake/FindMuParserX.cmake index 095aacc12f0d0f338685abd9dcba6f70f5d2dcf9..467d335d661d736aa86f6137c786b219c7466846 100644 --- a/CMake/FindMuParserX.cmake +++ b/CMake/FindMuParserX.cmake @@ -16,7 +16,7 @@ if( MUPARSERX_INCLUDE_DIR ) endif() find_path( MUPARSERX_INCLUDE_DIR mpParser.h - PATH_SUFFIXES mpParser ) + PATH_SUFFIXES mpParser muparserx) if(EXISTS "${MUPARSERX_INCLUDE_DIR}/mpDefines.h") file(READ "${MUPARSERX_INCLUDE_DIR}/mpDefines.h" _mpDefines_h_CONTENTS) diff --git a/CMake/OTBCheckCpp11Keywords.cmake b/CMake/OTBCheckCpp11Keywords.cmake index da3022688000b361e8f2a3d0d5fe44febfc96be2..8afdcf05b8ac77f258bad0593fcc7343894cb30a 100644 --- a/CMake/OTBCheckCpp11Keywords.cmake +++ b/CMake/OTBCheckCpp11Keywords.cmake @@ -1,6 +1,7 @@ include(CheckCXXSourceCompiles) -unset(OTB_HAS_CXX11 CACHE) +set(CMAKE_REQUIRED_FLAGS ${CMAKE_CXX_FLAGS}) + CHECK_CXX_SOURCE_COMPILES(" #ifdef _MSC_VER #if _MSC_VER <= 1700 @@ -20,7 +21,7 @@ int main(int argc, char *argv[]) " OTB_HAS_CXX11 ) -unset(OTB_CXX_HAS_UNIQUE_PTR CACHE) + CHECK_CXX_SOURCE_COMPILES(" #include <memory> struct Foo @@ -38,7 +39,6 @@ int main(int argc, char *argv[]) " OTB_CXX_HAS_UNIQUE_PTR ) -unset(OTB_CXX_HAS_OVERRIDE_SPECIFIER CACHE) CHECK_CXX_SOURCE_COMPILES(" struct A { @@ -64,7 +64,6 @@ int main(int argc, char *argv[]) " OTB_CXX_HAS_OVERRIDE_SPECIFIER ) -unset(OTB_CXX_HAS_NULLPTR CACHE) CHECK_CXX_SOURCE_COMPILES(" #include <cstddef> int main(int argc, char *argv[]) diff --git a/CMake/OTBConfig.cmake.in b/CMake/OTBConfig.cmake.in index 479674cc5c033c0f37b52b1803812423004e188c..1ecbbc5bf3e90332e9ca52aff1548d76d4f45c33 100644 --- a/CMake/OTBConfig.cmake.in +++ b/CMake/OTBConfig.cmake.in @@ -28,6 +28,8 @@ set(OTB_BUILD_SHARED "@BUILD_SHARED_LIBS@") # List of available OTB modules. set(OTB_MODULES_ENABLED "@OTB_CONFIG_MODULES_ENABLED@") +set(OTB_APPLICATION_PATH "@OTB_CONFIG_APPLICATION_PATH@") + # Import OTB targets. set(OTB_CONFIG_TARGETS_FILE "@OTB_CONFIG_TARGETS_FILE@") if(NOT OTB_TARGETS_IMPORTED@OTB_CONFIG_TARGETS_CONDITION@) diff --git a/CMake/UseOTB.cmake b/CMake/UseOTB.cmake index 5a891e450f5c925715a561f14df2a1e29cf5bef4..d09ea33fb9907391c83d8f7b67bcad2885eab244 100644 --- a/CMake/UseOTB.cmake +++ b/CMake/UseOTB.cmake @@ -27,3 +27,11 @@ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${ITK_REQUIRED_LINK_ set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${ITK_REQUIRED_LINK_FLAGS}") # OpenCV : no USE_FILE defined + +#PYTHONPATH + +if( OTB_PYTHONPATH ) + if(DEFINED ENV{PYTHONPATH}) + set(ENV{PYTHONPATH} "${OTB_PYTHONPATH};$ENV{PYTHONPATH}") + endif() +endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index b1d3e71a38e27d0160c67777c3880c76ee2d9a43..efb8aff8b37eeaa4855f4ab80b6b15d4a7e2d9ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -305,6 +305,12 @@ set(OTB_CONFIG_CODE " set(OTB_MODULES_DIR \"${OTB_MODULES_DIR}\")") set(OTB_CONFIG_CMAKE_DIR "${OTB_SOURCE_DIR}/CMake") set(OTB_USE_FILE "${OTB_CONFIG_CMAKE_DIR}/UseOTB.cmake") +if(OTB_WRAP_PYTHON) +set(OTB_CONFIG_CODE "${OTB_CONFIG_CODE} +set(OTB_PYTHONPATH \"${OTB_BINARY_DIR}/${OTB_INSTALL_PYTHON_DIR}\")") +endif() + +set(OTB_CONFIG_APPLICATION_PATH "${OTB_BINARY_DIR}/${OTB_INSTALL_APP_DIR}") set(OTB_CONFIG_TARGETS_CONDITION " AND NOT OTB_BINARY_DIR") set(OTB_CONFIG_TARGETS_FILE "${OTB_BINARY_DIR}/OTBTargets.cmake") set(OTB_CONFIG_MODULE_API_FILE "${OTB_SOURCE_DIR}/CMake/OTBModuleAPI.cmake") @@ -326,6 +332,11 @@ set(OTB_CONFIG_CODE "${OTB_CONFIG_CODE} set(OTB_MODULES_DIR \"\${OTB_INSTALL_PREFIX}/${OTB_INSTALL_PACKAGE_DIR}/Modules\")") set(OTB_USE_FILE "\${OTB_INSTALL_PREFIX}/${OTB_INSTALL_PACKAGE_DIR}/UseOTB.cmake") set(OTB_CONFIG_CMAKE_DIR "\${OTB_INSTALL_PREFIX}/${OTB_INSTALL_PACKAGE_DIR}") +if(OTB_WRAP_PYTHON) +set(OTB_CONFIG_CODE "${OTB_CONFIG_CODE} +set(OTB_PYTHONPATH \"\${OTB_INSTALL_PREFIX}/${OTB_INSTALL_PYTHON_DIR}\")") +endif() +set(OTB_CONFIG_APPLICATION_PATH "\${OTB_INSTALL_PREFIX}/${OTB_INSTALL_APP_DIR}") set(OTB_CONFIG_TARGETS_CONDITION "") set(OTB_CONFIG_TARGETS_FILE "\${OTB_INSTALL_PREFIX}/${OTB_INSTALL_PACKAGE_DIR}/OTBTargets.cmake") set(OTB_CONFIG_MODULE_API_FILE "\${OTB_INSTALL_PREFIX}/${OTB_INSTALL_PACKAGE_DIR}/OTBModuleAPI.cmake") diff --git a/Documentation/Cookbook/CMake/RunApplicationsRstGenerator.sh.cmake.in b/Documentation/Cookbook/CMake/RunApplicationsRstGenerator.sh.cmake.in index d5f17f1f07bc0822f83edadfcdfce58e47b67f7d..3c3a810ca20cd0987143828e74ee9e2d9d1771be 100644 --- a/Documentation/Cookbook/CMake/RunApplicationsRstGenerator.sh.cmake.in +++ b/Documentation/Cookbook/CMake/RunApplicationsRstGenerator.sh.cmake.in @@ -1,6 +1,6 @@ #!/bin/sh export LD_LIBRARY_PATH=@OTB_INSTALL_PREFIX@/lib:$LD_LIBRARY_PATH -export PYTHONPATH=@OTB_INSTALL_PREFIX@/lib:@OTB_PYTHONPATH@:$PYTHONPATH -export OTB_APPLICATION_PATH=@OTB_INSTALL_PREFIX@/lib/otb/applications -@PYTHON_EXECUTABLE@ @CMAKE_SOURCE_DIR@/Scripts/otbGenerateWrappersRstDoc.py +export PYTHONPATH=@OTB_PYTHONPATH@:$PYTHONPATH +export OTB_APPLICATION_PATH=@OTB_APPLICATION_PATH@ +@PYTHON_EXECUTABLE@ @CMAKE_SOURCE_DIR@/Scripts/otbGenerateWrappersRstDoc.py -o "$1" diff --git a/Documentation/Cookbook/CMakeLists.txt b/Documentation/Cookbook/CMakeLists.txt index 7228a6a1e4c5e60f2393baec4a1d91204870cf67..cd3eae702ae49a23e4f389cde7b891a3359bb22f 100644 --- a/Documentation/Cookbook/CMakeLists.txt +++ b/Documentation/Cookbook/CMakeLists.txt @@ -1,12 +1,20 @@ - set(OUT_OF_SOURCE_BUILD FALSE) if(NOT PROJECT_NAME) - cmake_minimum_required(VERSION 2.8) + cmake_minimum_required(VERSION 3.0) project(OTBCookBook) set(OUT_OF_SOURCE_BUILD TRUE) + option(BUILD_TESTING "Build the testing tree." ON) +endif() + +if(BUILD_TESTING) + enable_testing() + include(CTest) endif() +string(TIMESTAMP OTB_COPYRIGHT_YEAR "%Y") +set(OTB_COPYRIGHT_TEXT "${OTB_COPYRIGHT_YEAR}, OTB Team") + #find OTB find_package(OTB REQUIRED) @@ -18,153 +26,141 @@ else() return() endif() -set(OTB_PYTHONPATH) -if( EXISTS "${OTB_DIR}/CMakeCache.txt" ) - set(OTB_INSTALL_PREFIX ${OTB_DIR}) - set(OTB_PYTHONPATH "${OTB_INSTALL_PREFIX}/Modules/Wrappers/SWIG/src") -elseif( EXISTS "${OTB_DIR}/UseOTB.cmake" ) - get_filename_component(OTB_INSTALL_PREFIX ${OTB_DIR} PATH) - get_filename_component(OTB_INSTALL_PREFIX ${OTB_INSTALL_PREFIX} PATH) - get_filename_component(OTB_INSTALL_PREFIX ${OTB_INSTALL_PREFIX} PATH) - set(OTB_PYTHONPATH "${OTB_INSTALL_PREFIX}/lib/otb/python") -endif() +get_filename_component(OTB_INSTALL_PREFIX ${OTB_MODULES_DIR} PATH) +get_filename_component(OTB_INSTALL_PREFIX ${OTB_INSTALL_PREFIX} PATH) +get_filename_component(OTB_INSTALL_PREFIX ${OTB_INSTALL_PREFIX} PATH) +get_filename_component(OTB_INSTALL_PREFIX ${OTB_INSTALL_PREFIX} PATH) -#find Python -find_package(PythonInterp REQUIRED) +message(STATUS "OTB_PYTHONPATH = '${OTB_PYTHONPATH}'") +message(STATUS "OTB_APPLICATION_PATH = '${OTB_APPLICATION_PATH}'") +message(STATUS "OTB_INSTALL_PREFIX = '${OTB_INSTALL_PREFIX}'") -find_program(SH_INTERP sh) -if(NOT SH_INTERP) - message(FATAL_ERROR "'sh' program not found") +if(NOT OTB_PYTHONPATH) + message(FATAL_ERROR "OTB_PYTHONPATH empty") endif() -find_program(SPHINX_BUILD sphinx-build) +if(NOT OTB_APPLICATION_PATH) + message(FATAL_ERROR "OTB_APPLICATION_PATH empty") +endif() -if(NOT SPHINX_BUILD) - message(FATAL_ERROR "The 'sphinx-build' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the 'sphinx-build' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org") +if(NOT OTB_INSTALL_PREFIX) + message(FATAL_ERROR "OTB_INSTALL_PREFIX empty") endif() -string(TIMESTAMP OTB_COPYRIGHT_YEAR "%Y") -set(OTB_COPYRIGHT_TEXT "${OTB_COPYRIGHT_YEAR}, OTB Team") -set(RST_GENERATED_SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/rst) +macro(remove_and_make_directories) + foreach(dir in ${ARGV}) + execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ${dir}) + execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${dir}) + endforeach() +endmacro() -set(RST_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/_build") -set(RST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/rst) +#find Python +find_package(PythonInterp REQUIRED) -#make some directories -execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${RST_GENERATED_SOURCE_DIR}/Applications) -execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${RST_GENERATED_SOURCE_DIR}/recipes) -execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${RST_GENERATED_SOURCE_DIR}/Art) -execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${RST_GENERATED_SOURCE_DIR}/Art/MonteverdiImages) -execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${RST_GENERATED_SOURCE_DIR}/Art/ClassifImages) -execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${RST_GENERATED_SOURCE_DIR}/Art/QtImages) -execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${RST_GENERATED_SOURCE_DIR}/_static) -execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${RST_GENERATED_SOURCE_DIR}/_templates) +find_program(SH_INTERP sh) +mark_as_advanced(SH_INTERP) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMake/RunApplicationsRstGenerator.sh.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/RunApplicationsRstGenerator.sh - @ONLY) +find_program(LATEX_COMMAND NAMES latex) +mark_as_advanced(LATEX_COMMAND) -file(GLOB images ${CMAKE_CURRENT_SOURCE_DIR}/Art/*.*) -foreach(image ${images}) - get_filename_component(out_file ${image} NAME) - configure_file(${image} ${RST_GENERATED_SOURCE_DIR}/Art/${out_file} COPYONLY) -endforeach() +find_program(TAR_COMMAND NAMES tar) +mark_as_advanced(TAR_COMMAND) -file(GLOB mvd_images ${CMAKE_CURRENT_SOURCE_DIR}/Art/MonteverdiImages/*.*) -foreach(mvd_image ${mvd_images}) - get_filename_component(out_file ${mvd_image} NAME) - configure_file(${mvd_image} ${RST_GENERATED_SOURCE_DIR}/Art/MonteverdiImages/${out_file} COPYONLY) -endforeach() +find_program(SPHINX_BUILD NAMES sphinx-build) +mark_as_advanced(SPHINX_BUILD) -file(GLOB classif_images ${CMAKE_CURRENT_SOURCE_DIR}/Art/ClassifImages/*.*) -foreach(classif_image ${classif_images}) - get_filename_component(out_file ${classif_image} NAME) - configure_file(${classif_image} ${RST_GENERATED_SOURCE_DIR}/Art/ClassifImages/${out_file} COPYONLY) -endforeach() +find_program(PDFLATEX_COMMAND NAMES pdflatex ) +mark_as_advanced(PDFLATEX_COMMAND) -file(GLOB qt_images ${CMAKE_CURRENT_SOURCE_DIR}/Art/QtImages/*.png) -foreach(qt_image ${qt_images}) - get_filename_component(out_file ${qt_image} NAME) - configure_file(${qt_image} ${RST_GENERATED_SOURCE_DIR}/Art/QtImages/${out_file} COPYONLY) +foreach(cmd LATEX_COMMAND TAR_COMMAND PDFLATEX_COMMAND SPHINX_BUILD SH_INTERP) + if(NOT ${cmd}) + message(FATAL_ERROR "${cmd} not set. Cannot continue") + endif() endforeach() -file(GLOB sar_images ${CMAKE_CURRENT_SOURCE_DIR}/Art/SARImages/*.png) -foreach(sar_image ${sar_images}) - get_filename_component(out_file ${sar_image} NAME) - configure_file(${sar_image} ${RST_GENERATED_SOURCE_DIR}/Art/SARImages/${out_file} COPYONLY) -endforeach() +set(RST_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/rst) -file(GLOB rst_sources1 ${RST_SOURCES}/*.rst) -foreach(rst_file ${rst_sources1}) - get_filename_component(out_file ${rst_file} NAME) - configure_file(${rst_file} ${RST_GENERATED_SOURCE_DIR}/${out_file} COPYONLY) -endforeach() +set(RST_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/rst) +set(LATEX_DIR ${CMAKE_CURRENT_BINARY_DIR}/latex) +set(HTML_DIR ${CMAKE_CURRENT_BINARY_DIR}/html) -file(GLOB rst_sources2 ${RST_SOURCES}/recipes/*.rst) -foreach(rst_file ${rst_sources2}) - get_filename_component(out_file ${rst_file} NAME) - configure_file(${rst_file} ${RST_GENERATED_SOURCE_DIR}/recipes/${out_file} COPYONLY) -endforeach() -file(GLOB rst_sources3 ${RST_SOURCES}/Applications/*.rst) -foreach(rst_file ${rst_sources3}) - get_filename_component(out_file ${rst_file} NAME) - configure_file(${rst_file} ${RST_GENERATED_SOURCE_DIR}/Applications/${out_file} COPYONLY) -endforeach() +remove_and_make_directories( + ${HTML_DIR} + ${RST_BINARY_DIR} + ${RST_BINARY_DIR}/Applications/ + ${HTML_DIR} + ${LATEX_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/_static + ) -file(GLOB rst_sources4 ${RST_SOURCES}/*.txt) -foreach(rst_file ${rst_sources4}) - get_filename_component(out_file ${rst_file} NAME) - configure_file(${rst_file} ${RST_GENERATED_SOURCE_DIR}/${out_file} COPYONLY) -endforeach() +execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_BINARY_DIR}/RunApplicationsRstGenerator.sh) + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMake/RunApplicationsRstGenerator.sh.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/RunApplicationsRstGenerator.sh + @ONLY) + +file(COPY ${RST_SOURCE_DIR} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/Art DESTINATION ${RST_BINARY_DIR}) -configure_file(${RST_SOURCES}/conf.py.in ${RST_GENERATED_SOURCE_DIR}/conf.py @ONLY) -configure_file(${RST_SOURCES}/Makefile.in ${RST_GENERATED_SOURCE_DIR}/Makefile @ONLY) +set(SPHINX_CONF_DIR ${CMAKE_CURRENT_BINARY_DIR}) +configure_file(${RST_SOURCE_DIR}/conf.py.in ${SPHINX_CONF_DIR}/conf.py @ONLY) + +#configure_file(${RST_SOURCE_DIR}/Makefile.in ${RST_GENERATED_SOURCE_DIR}/Makefile.sphinx @ONLY) +# Internal variables. +# PAPEROPT_a4 = -D latex_paper_size=a4 +# PAPEROPT_letter = -D latex_paper_size=letter +# ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +# # the i18n builder cannot share the environment and doctrees with the others +# I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . add_custom_target(generate_otbapps_rst - ALL COMMAND ${SH_INTERP} ${CMAKE_CURRENT_BINARY_DIR}/RunApplicationsRstGenerator.sh - WORKING_DIRECTORY ${RST_GENERATED_SOURCE_DIR} + ${RST_BINARY_DIR} + WORKING_DIRECTORY ${RST_BINARY_DIR} COMMENT "Auto-generating Application Reference Documentation in RST" ) -add_custom_target(CookBookHTMLFromRST - ALL - COMMAND ${CMAKE_MAKE_PROGRAM} html - WORKING_DIRECTORY ${RST_GENERATED_SOURCE_DIR} +add_custom_target(CookBookHTML + COMMAND ${SPHINX_BUILD} + -b html + ${RST_BINARY_DIR} + ${HTML_DIR} + -W + -v + -c ${SPHINX_CONF_DIR} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DEPENDS generate_otbapps_rst COMMENT "Building RST documentation in html") -find_program(TAR_COMMAND - NAMES tar - PATHS /usr/bin -) -mark_as_advanced(TAR_COMMAND) - -if(TAR_COMMAND) - add_custom_target(CookBookArchive - ALL - COMMAND ${TAR_COMMAND} - --transform "s/^html/CookBook-${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}/" - -czf ${CMAKE_BINARY_DIR}/CookBook-${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}-html.tar.gz html - WORKING_DIRECTORY ${RST_BUILD_DIR} - DEPENDS CookBookHTMLFromRST - COMMENT "Creating archive for html CookBook") -endif() - -find_program(PDFLATEX_COMMAND - NAMES pdflatex - PATHS /usr/bin -) -mark_as_advanced(PDFLATEX_COMMAND) - -if(PDFLATEX_COMMAND) - add_custom_target(CookBookPDFFromRST - ALL - COMMAND ${CMAKE_MAKE_PROGRAM} latexpdf - WORKING_DIRECTORY ${RST_GENERATED_SOURCE_DIR} - DEPENDS generate_otbapps_rst - COMMENT "Building RST documentation in pdf") -endif() +add_custom_target(CookBookArchive + ALL + COMMAND ${TAR_COMMAND} + --transform "s/^html/CookBook-${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}/" + -czf ${CMAKE_BINARY_DIR}/CookBook-${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}-html.tar.gz html + WORKING_DIRECTORY ${RST_BUILD_DIR} + DEPENDS CookBookHTML + COMMENT "Creating archive for html CookBook") + + add_custom_target(CookBookTexFromRST + COMMAND ${SPHINX_BUILD} + -b latex + ${RST_BINARY_DIR} + ${LATEX_DIR} + -W + -v + -c ${SPHINX_CONF_DIR} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS CookBookHTML + COMMENT "Generating Tex files from rst" + VERBATIM) + + add_custom_target(CookBookPDF + ALL + COMMAND ${CMAKE_MAKE_PROGRAM} all-pdf + WORKING_DIRECTORY ${LATEX_DIR} + DEPENDS CookBookTexFromRST + COMMENT "Building RST documentation in pdf") diff --git a/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py b/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py index 3e306e23d29baa1be7f57db3e64c741714f0f63e..21c79fc446994da68d1b75ad38a304e2399538a5 100755 --- a/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py +++ b/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py @@ -430,7 +430,11 @@ def RstHeading(text, delimiter): def ApplicationToRst(appname): output = "" - app = otbApplication.Registry.CreateApplication(appname) + app = None + try: + app = otbApplication.Registry.CreateApplication(appname) + except e: + print e # TODO: remove this when bug 440 is fixed app.Init() output += RstHeading(app.GetDocName(), '^') @@ -487,74 +491,108 @@ def GetApplicationTags(appname): import shutil -def RstPageHeading(text): +def RstPageHeading(text, maxdepth): output = RstHeading(text, "=") + linesep output += ".. toctree::" + linesep - output += "\t:maxdepth: 2" + linesep + output += "\t:maxdepth: " + maxdepth + linesep output += linesep + linesep return output def GenerateRstForApplications(): out = "" - blackList = ["TestApplication", "Example"] - appIndexFile = open('Applications.rst', 'w') - appNames = [app for app in otbApplication.Registry.GetAvailableApplications() if app not in blackList] - if not appNames: - print 'No OTB applications available. Please check ITK_AUTOLOAD_PATH env variable' - sys.exit(1) - sectionTags = ["Image Manipulation","Vector Data Manipulation", "Calibration","Geometry", "Image Filtering","Feature Extraction","Stereo","Learning","Segmentation"] - appIndexFile.write(RstPageHeading("Applications")) - - for tag in sectionTags: - directory= "Applications/" + tag - if not os.path.exists(directory): - os.makedirs(directory) - tag_ = tag.replace(' ', '_') - appIndexFile.write('\tApplications/' + tag_ + '.rst' + linesep) - #chapterIndexFile = open('Applications/' + tag + '.rst', 'w') - #chapterIndexFile.write(RstPageHeading(tag)) - #print linesep + RstHeading(tag, '=') - appsRemoved = [] - for appName in appNames: - apptags = GetApplicationTags(appName) - - if apptags.count(tag) > 0: - print "Generating " + appName + ".rst" - #chapterIndexFile.write("\t" + tag + '/' + appName + linesep) - appFile = open('Applications/app_' + appName + '.rst', 'w') - out = ApplicationToRst(appName) - appFile.write(out) - appFile.close() - appsRemoved.append(appName) - for appName in appsRemoved: - appNames.remove(appName) - #chapterIndexFile.close() - - misctag = "Miscellaneous" #should this be Utilities - if not os.path.exists("Applications/" + misctag): - os.makedirs("Applications/" + misctag) - - appIndexFile.write('\tApplications/' + misctag + linesep) - appIndexFile.close() - #miscChapterIndexFile = open("Applications/" + misctag + '.rst', 'w') - #miscChapterIndexFile.write(RstPageHeading(misctag)) + blackList = ["TestApplication", "Example", "ApplicationExample"] + allApps = None + try: + allApps = otbApplication.Registry.GetAvailableApplications( ) + except e: + print 'error in otbApplication.Registry.GetAvailableApplications()' + sys.exit(1) + +# appNames = [app for app in otbApplication.Registry.GetAvailableApplications() if app not in blackList] + if not allApps: + print 'No OTB applications available. Please check OTB_APPLICATION_PATH env variable' + sys.exit(1) + + # sectionTags = ["Image Manipulation", + # "Vector Data Manipulation", + # "Calibration","Geometry", "Image Filtering","Feature Extraction", + # "Stereo","Learning","Segmentation", "Miscellaneous"] + # for tag in sectionTags: + # #directory= "Applications/" + tag + # # if not os.path.exists(directory): + # # os.makedirs(directory) + # appIndexFile.write('\tApplications/' + tag.replace(' ', '_') + '.rst' + linese) + # #chapterIndexFile = open('Applications/' + tag + '.rst', 'w') + # #chapterIndexFile.write(RstPageHeading(tag)) + # #print linesep + RstHeading(tag, '=') + + + #miscFile = open('Applications/Miscellaneous.rst', 'w') + # misctag = "Miscellaneous" #should this be Utilities + # if not os.path.exists("Applications/" + misctag): + # os.makedirs("Applications/" + misctag) + +# appIndexFile.write('\tApplications/' + misctag + linesep) + + + writtenTags = [] + appNames = [app for app in allApps if app not in blackList] + + print "All apps: %s" % (appNames,) + + appIndexFile = open(RST_DIR + '/Applications.rst', 'w') + appIndexFile.write(RstPageHeading("Applications", "2")) for appName in appNames: - print "Generating " + appName + ".rst" - appFile = open("Applications/app_" + appName + ".rst", 'w') + tags = GetApplicationTags(appName) + + if not tags: + print "No tags for application: " + appName + sys.exit(1) + + tag = tags[0] + + tag_ = tag + if tag.find(' '): + tag_ = tag.replace(' ', '_') + + if not tag_: + print 'empty tag found for ' + appName + + if not tag_ in writtenTags: + appIndexFile.write('\tApplications/' + tag_ + '.rst' + linesep) + writtenTags.append(tag_) + + tagFileName = RST_DIR + '/Applications/' + tag_ + '.rst' + if os.path.isfile(tagFileName): + tagFile = open(tagFileName, 'a') + tagFile.write("\tapp_" + appName + linesep) + tagFile.close() + else: + tagFile = open(tagFileName, 'w') + tagFile.write( RstPageHeading(tag, "1") ) + tagFile.write("\tapp_" + appName + linesep) + tagFile.close() + + print "Generating " + appName + ".rst" + " on tag " + tag_ + appFile = open(RST_DIR + '/Applications/app_' + appName + '.rst', 'w') out = ApplicationToRst(appName) appFile.write(out) appFile.close() - #miscChapterIndexFile.write('\t' + misctag + '/' + appName + linesep) - out = "" + + appIndexFile.close() + return out # Start parsing options -parser = OptionParser(usage="Export application(s) to tex or pdf file.") +parser = OptionParser(usage="Export application(s) to rst file.") parser.add_option("-a",dest="appname",help="Generate rst only for this application (eg: OrthoRectification)") parser.add_option("-m",dest="module",help="Generate rst only for this module (eg: Image Manipulation)") +parser.add_option("-o",dest="rstdir",help="directory where rst files are generated") (options, args) = parser.parse_args() +RST_DIR = options.rstdir + if not options.appname is None: out = ApplicationToRst(options.appname) #print out diff --git a/Documentation/Cookbook/rst/Applications/Calibration.rst b/Documentation/Cookbook/rst/Applications/Calibration.rst deleted file mode 100644 index 478a93b2bf1e22fdb3e695d82fa1b83ba465c73f..0000000000000000000000000000000000000000 --- a/Documentation/Cookbook/rst/Applications/Calibration.rst +++ /dev/null @@ -1,13 +0,0 @@ -Calibration -=========== - - -.. toctree:: - :maxdepth: 1 - - app_OpticalCalibration - app_SARCalibration - app_SARDecompositions - app_SARPolarMatrixConvert - app_SARPolarSynth - app_SarRadiometricCalibration diff --git a/Documentation/Cookbook/rst/Applications/Feature_Extraction.rst b/Documentation/Cookbook/rst/Applications/Feature_Extraction.rst deleted file mode 100644 index 3f551afaa133bb70ccda051e1dd4d2c6771a0e84..0000000000000000000000000000000000000000 --- a/Documentation/Cookbook/rst/Applications/Feature_Extraction.rst +++ /dev/null @@ -1,21 +0,0 @@ -Feature Extraction -================== - - -.. toctree:: - :maxdepth: 1 - - - app_BinaryMorphologicalOperation - app_ComputePolylineFeatureFromImage - app_DSFuzzyModelEstimation - app_EdgeExtraction - app_GrayScaleMorphologicalOperation - app_HaralickTextureExtraction - app_HomologousPointsExtraction - app_LineSegmentDetection - app_LocalStatisticExtraction - app_MultivariateAlterationDetector - app_RadiometricIndices - app_SFSTextureExtraction - app_VectorDataDSValidation diff --git a/Documentation/Cookbook/rst/Applications/Geometry.rst b/Documentation/Cookbook/rst/Applications/Geometry.rst deleted file mode 100644 index 1d23508af71e9e431b480a392a778cb6cc7ccda0..0000000000000000000000000000000000000000 --- a/Documentation/Cookbook/rst/Applications/Geometry.rst +++ /dev/null @@ -1,19 +0,0 @@ -Geometry -======== - - -.. toctree:: - :maxdepth: 1 - - app_BundleToPerfectSensor - app_ConvertCartoToGeoPoint - app_ConvertSensorToGeoPoint - app_GeneratePlyFile - app_GenerateRPCSensorModel - app_GridBasedImageResampling - app_ImageEnvelope - app_OrthoRectification - app_Pansharpening - app_RefineSensorModel - app_RigidTransformResample - app_Superimpose diff --git a/Documentation/Cookbook/rst/Applications/Image_Filtering.rst b/Documentation/Cookbook/rst/Applications/Image_Filtering.rst deleted file mode 100644 index 39300f14b757a175f25644f86946373f9eec8753..0000000000000000000000000000000000000000 --- a/Documentation/Cookbook/rst/Applications/Image_Filtering.rst +++ /dev/null @@ -1,12 +0,0 @@ -Image Filtering -=============== - - -.. toctree:: - :maxdepth: 1 - - - app_Despeckle - app_DimensionalityReduction - app_MeanShiftSmoothing - app_Smoothing diff --git a/Documentation/Cookbook/rst/Applications/Image_Manipulation.rst b/Documentation/Cookbook/rst/Applications/Image_Manipulation.rst deleted file mode 100644 index f1b1ca98c5973d68337b8dea027e392c49a6ed89..0000000000000000000000000000000000000000 --- a/Documentation/Cookbook/rst/Applications/Image_Manipulation.rst +++ /dev/null @@ -1,21 +0,0 @@ -Image Manipulation -================== - - -.. toctree:: - :maxdepth: 1 - - - app_ColorMapping - app_ConcatenateImages - app_Convert - app_DEMConvert - app_DownloadSRTMTiles - app_ExtractROI - app_ManageNoData - app_MultiResolutionPyramid - app_Quicklook - app_ReadImageInfo - app_Rescale - app_SplitImage - app_TileFusion diff --git a/Documentation/Cookbook/rst/Applications/Learning.rst b/Documentation/Cookbook/rst/Applications/Learning.rst deleted file mode 100644 index 836eb0a2258959719d6dd29bc0e64d435211ce63..0000000000000000000000000000000000000000 --- a/Documentation/Cookbook/rst/Applications/Learning.rst +++ /dev/null @@ -1,22 +0,0 @@ -Learning -======== - - -.. toctree:: - :maxdepth: 1 - - app_ClassificationMapRegularization - app_ComputeConfusionMatrix - app_ComputeImagesStatistics - app_FusionOfClassifications - app_ImageClassifier - app_KMeansClassification - app_MultiImageSamplingRate - app_PolygonClassStatistics - app_PredictRegression - app_SampleExtraction - app_SampleSelection - app_SOMClassification - app_TrainImagesClassifier - app_TrainRegression - app_TrainVectorClassifier diff --git a/Documentation/Cookbook/rst/Applications/Miscellaneous.rst b/Documentation/Cookbook/rst/Applications/Miscellaneous.rst deleted file mode 100644 index 67289bd885f30b4b5eeb247360a060d85c757125..0000000000000000000000000000000000000000 --- a/Documentation/Cookbook/rst/Applications/Miscellaneous.rst +++ /dev/null @@ -1,16 +0,0 @@ -Miscellaneous -============= - - -.. toctree:: - :maxdepth: 1 - - app_BandMath - app_BandMathX - app_CompareImages - app_HyperspectralUnmixing - app_KmzExport - app_OSMDownloader - app_ObtainUTMZoneFromGeoPoint - app_PixelValue - app_VertexComponentAnalysis diff --git a/Documentation/Cookbook/rst/Applications/Segmentation.rst b/Documentation/Cookbook/rst/Applications/Segmentation.rst deleted file mode 100644 index f9530fa784c50504037aa1ad64848b5d59ce80d6..0000000000000000000000000000000000000000 --- a/Documentation/Cookbook/rst/Applications/Segmentation.rst +++ /dev/null @@ -1,16 +0,0 @@ -Segmentation -============ - - -.. toctree:: - :maxdepth: 1 - - app_ComputeOGRLayersFeaturesStatistics - app_ConnectedComponentSegmentation - app_HooverCompareSegmentation - app_LSMSSegmentation - app_LSMSSmallRegionsMerging - app_LSMSVectorization - app_OGRLayerClassifier - app_Segmentation - app_TrainOGRLayersClassifier diff --git a/Documentation/Cookbook/rst/Applications/Stereo.rst b/Documentation/Cookbook/rst/Applications/Stereo.rst deleted file mode 100644 index feadf0508abcd751e1eb771cde429042d25aa41f..0000000000000000000000000000000000000000 --- a/Documentation/Cookbook/rst/Applications/Stereo.rst +++ /dev/null @@ -1,12 +0,0 @@ -Stereo -====== - - -.. toctree:: - :maxdepth: 1 - - app_BlockMatching - app_DisparityMapToElevationMap - app_FineRegistration - app_StereoFramework - app_StereoRectificationGridGenerator diff --git a/Documentation/Cookbook/rst/Applications/Vector_Data_Manipulation.rst b/Documentation/Cookbook/rst/Applications/Vector_Data_Manipulation.rst deleted file mode 100644 index 09f55741573142c04285c50fa5a454b3f5c48854..0000000000000000000000000000000000000000 --- a/Documentation/Cookbook/rst/Applications/Vector_Data_Manipulation.rst +++ /dev/null @@ -1,13 +0,0 @@ -Vector Data Manipulation -======================== - - -.. toctree:: - :maxdepth: 1 - - app_ConcatenateVectorData - app_Rasterization - app_VectorDataExtractROI - app_VectorDataReprojection - app_VectorDataSetField - app_VectorDataTransform diff --git a/Documentation/Cookbook/rst/Installation_Linux.txt b/Documentation/Cookbook/rst/Installation_Linux.txt index f86681bd63bad76344e1fea96780ac4cc3342953..0567d00c1ce372a8ddd323481dbd3b8595584bdd 100644 --- a/Documentation/Cookbook/rst/Installation_Linux.txt +++ b/Documentation/Cookbook/rst/Installation_Linux.txt @@ -49,6 +49,18 @@ The applications can be launched from the Mapla launcher. If you want to use the otbcli and otbgui launchers, you can initialize your environment with ``source otbenv.profile``. +Python bindings +--------------- +Starting from OTB 5.8.0, OTB python bindings are distributed with binary package. +currently only Python 2.x is supported. If no compatible python is found, installation +notify you about it. If everything works fine, you will be given information about +using python bindings. + +You must have python numpy bindings installed in your system. you can install it locally +without admin rights with "pip install --user numpy". This is to give users to choose +their own existing python installation rather than distributing one in OTB package + + Notes: - You must use monteverdi and mapla through ``mapla.sh`` and ``monteverdi.sh`` helper scripts in extracted directory. diff --git a/Documentation/Cookbook/rst/Installation_Macx.txt b/Documentation/Cookbook/rst/Installation_Macx.txt index 258548d1d47b9d92d5418861be43788361eed016..cf7f3f9bc462ef081facf3c93527c0c73b953d76 100644 --- a/Documentation/Cookbook/rst/Installation_Macx.txt +++ b/Documentation/Cookbook/rst/Installation_Macx.txt @@ -25,6 +25,17 @@ Contents of OTB-|release|-Darwin64 is briefly listed below: - ``share`` : A folder containing common resources and copyright mentions. +Python bindings +--------------- +Starting from OTB 5.8.0, OTB python bindings are distributed with binary package. +currently only Python 2.x is supported. If no compatible python is found, installation +notify you about it. If everything works fine, you will be given information about +using python bindings. + +You must have python numpy bindings installed in your system. you can install it locally +without admin rights with "pip install --user numpy". This is to give users to choose +their own existing python installation rather than distributing one in OTB package + Notes: - If you want to use the otbcli and otbgui launchers, you must access diff --git a/Documentation/Cookbook/rst/Installation_Windows.txt b/Documentation/Cookbook/rst/Installation_Windows.txt index 3c2884969a197f87b0dffb8dcf40358af5ccb589..f7a967190ee2f6b418753bac799cc7d31c18e37a 100644 --- a/Documentation/Cookbook/rst/Installation_Windows.txt +++ b/Documentation/Cookbook/rst/Installation_Windows.txt @@ -22,6 +22,17 @@ The applications can be launched from the Mapla launcher. If you want to use the otbcli and otbgui launchers, you can initialize a command prompt with ``otbenv.bat``. +Python bindings +--------------- +Starting from OTB 5.8.0, OTB python bindings are distributed with binary package. +currently only Python 2.x is supported. If no compatible python is found, installation +notify you about it. If everything works fine, you will be given information about +using python bindings. + +You must have python numpy bindings installed in your system. you can install it locally +without admin rights with "pip install --user numpy". This is to give users to choose +their own existing python installation rather than distributing one in OTB package + Notes: ~~~~~~ - You must have "Visual C++ Redistributable for Visual Studio 2015" installed for using this package. diff --git a/Documentation/Cookbook/rst/Makefile.in b/Documentation/Cookbook/rst/Makefile.in index 83ba8f3b2f8580bb6ff65d092a091e54f612cd3a..a2440433de3bd3894af3cfe43637021afff8153b 100644 --- a/Documentation/Cookbook/rst/Makefile.in +++ b/Documentation/Cookbook/rst/Makefile.in @@ -7,10 +7,6 @@ SPHINXBUILD = sphinx-build PAPER = BUILDDIR = @RST_BUILD_DIR@ -# User-friendly check for sphinx-build -ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) -$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) -endif # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 diff --git a/Documentation/Cookbook/rst/OTB-Applications.rst b/Documentation/Cookbook/rst/OTB-Applications.rst index a69fe4eff5f7f76ac336196bfd706a7529ce39f4..eea59f1a7291920ac8bee0b30ae1f689b6fedf21 100644 --- a/Documentation/Cookbook/rst/OTB-Applications.rst +++ b/Documentation/Cookbook/rst/OTB-Applications.rst @@ -31,7 +31,7 @@ entry points. The framework can be extended, but Orfeo Toolbox ships with the fo QGIS. The OTB Applications are now rich of more than 90 tools, which are -listed in the the applications reference documentation, presented in +listed in the applications reference documentation, presented in chapter [chap:apprefdoc], page. Running the applications @@ -40,7 +40,7 @@ Running the applications Common framework ~~~~~~~~~~~~~~~~ -All standard applications shared the same implementation and expose +All standard applications share the same implementation and expose automatically generated interfaces. Thus, the command-line interface is prefixed by ``otbcli_``, while the Qt interface is prefixed by ``otbgui_``. For instance, calling ``otbcli_Convert`` will launch the @@ -149,8 +149,6 @@ The graphical interface for the applications provides a useful interactive user interface to set the parameters, choose files, and monitor the execution progress. -This interface can be activated through the CMake option . - This launcher needs the same two arguments as the command line launcher : @@ -194,12 +192,12 @@ Using the Python interface ~~~~~~~~~~~~~~~~~~~~~~~~~~ The applications can also be accessed from Python, through a module -named ``otbApplication`` +named ``otbApplication``. -On Unix systems it is typically available in the ``/usr/lib/otb/python`` -directory. You may need to configure the environment variable -``PYTHONPATH`` to include this directory so that the module becomes -available from an Python shell. +On Unix systems, it is typically available in the ``/usr/lib/otb/python`` +directory. Depending on how you installed OTB, you may need to configure the +environment variable ``PYTHONPATH`` to include this directory so that the module +becomes available from Python. On Windows, you can install the ``otb-python`` package, and the module will be available from an OSGeo4W shell automatically. diff --git a/Documentation/Cookbook/rst/conf.py.in b/Documentation/Cookbook/rst/conf.py.in index 4c927cc3566189e398b34f42498815c6ffb2e520..30ce0dc728056846e6a2bdf192840a2beb1b0df6 100644 --- a/Documentation/Cookbook/rst/conf.py.in +++ b/Documentation/Cookbook/rst/conf.py.in @@ -14,7 +14,12 @@ import sys import os -import sphinx_rtd_theme +HAVE_RTD_THEME=False +try: + import sphinx_rtd_theme + HAVE_RTD_THEME=True +except: + pass # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -31,10 +36,12 @@ import sphinx_rtd_theme # ones. extensions = [ 'sphinx.ext.todo', - 'sphinx.ext.mathjax', + 'sphinx.ext.imgmath', 'sphinx.ext.viewcode', ] +imgmath_latex='@LATEX_COMMAND@' + # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -104,15 +111,17 @@ pygments_style = 'sphinx' # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'sphinx_rtd_theme' - +if HAVE_RTD_THEME: + html_theme = 'sphinx_rtd_theme' + # Add any paths that contain custom themes here, relative to this directory. + html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] + # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} -# Add any paths that contain custom themes here, relative to this directory. -html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] + # The name for this set of Sphinx documents. If None, it defaults to # "<project> v<release> documentation". @@ -123,7 +132,7 @@ html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] # The name of an image file (relative to this directory) to place at the top # of the sidebar. -html_logo = "Art/logo.png" +html_logo = "rst/Art/logo.png" # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 @@ -165,13 +174,13 @@ html_static_path = ['_static'] #html_split_index = False # If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True +html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True +html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True +html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a <link> tag referring to it. The value of this option must be the diff --git a/Documentation/Cookbook/rst/recipes/numpy.rst b/Documentation/Cookbook/rst/recipes/numpy.rst index 76df92daf470f3f9bee5e02d1a549c8e16a5eafd..4f9ef0e6d834d275b12f4fc56c947ab022ff568b 100644 --- a/Documentation/Cookbook/rst/recipes/numpy.rst +++ b/Documentation/Cookbook/rst/recipes/numpy.rst @@ -14,9 +14,10 @@ GIS/Image processing tools such as GDAL, GRASS GIS, OSSIM that can deal with num Below code reads an input image using python pillow (PIL) and convert it to numpy array. This numpy array is -used an input to the application set *SetImageFromNumpyArray(...)* method. -The application used in this example is `ExtractROI <../Applications/app_ExtractROI.html>`_. After extracting -a small area the output image is taken as numpy array with *GetImageFromNumpyArray(...)* method +used an input to the application via *SetImageFromNumpyArray(...)* method. +The application used in this example is ExtractROI. After extracting +a small area the output image is taken as numpy array with *GetImageFromNumpyArray(...)* method thus avoid wiriting +output to a temporary file. :: diff --git a/Documentation/Cookbook/rst/recipes/optpreproc.rst b/Documentation/Cookbook/rst/recipes/optpreproc.rst index 70fc1a0d4b9593f05c93aa92ec8fc47284468bd0..a88dceceeb7cc776f78666988b5b3985f6af31ce 100644 --- a/Documentation/Cookbook/rst/recipes/optpreproc.rst +++ b/Documentation/Cookbook/rst/recipes/optpreproc.rst @@ -333,9 +333,9 @@ model can’t be observed if the map projection is used. In order to perform an ortho-rectification on this type of product, the map projection has to be hidden from **Orfeo Toolbox** . -You can see if a product is an “ortho-ready†product by using tools such -as ``gdalinfo`` or `ReadImageInfo <../Applications/app_ReadImageInfo.html>`_, and check -if the product verifies the 2 following conditions : +You can see if a product is an “ortho-ready†product by using ``gdalinfo`` or +OTB ReadImageInfo application. +Check if your product verifies following two conditions : - The product is in raw geometry : you should expect the presence of RPC coefficients and a non-empty OSSIM keywordlist. diff --git a/Documentation/Cookbook/rst/recipes/pbclassif.rst b/Documentation/Cookbook/rst/recipes/pbclassif.rst index c537dad6f25737af36ccd6c843fdd90e35698754..8de90bce37a3cee246b18c9664f035268b394947 100644 --- a/Documentation/Cookbook/rst/recipes/pbclassif.rst +++ b/Documentation/Cookbook/rst/recipes/pbclassif.rst @@ -457,12 +457,19 @@ roofs. Data is available in the OTB-Data and this image is produced with the commands inside this `file <http://hg.orfeo-toolbox.org/OTB-Applications/file/3ce975605013/Testing/Classification/CMakeLists.txt>`_ . +.. |image_21| image:: ../Art/MonteverdiImages/classification_chain_inputimage.jpg +.. |image_22| image:: ../Art/MonteverdiImages/classification_chain_fancyclassif_fusion.jpg +.. |image_23| image:: ../Art/MonteverdiImages/classification_chain_fancyclassif.jpg -.. figure:: ../Art/MonteverdiImages/classification_chain_inputimage.jpg -.. figure:: ../Art/MonteverdiImages/classification_chain_fancyclassif_fusion.jpg -.. figure:: ../Art/MonteverdiImages/classification_chain_fancyclassif.jpg +.. _Figure2: + + ++---------------------------+---------------------------+---------------------------+ +| |image_21| | |image_22| | |image_23| | ++---------------------------+---------------------------+---------------------------+ + +Figure 2: From left to right: Original image, result image with fusion (with monteverdi viewer) of original image and fancy classification and input image with fancy color classification from labeled image. -Figure 2: From left to right: Original image, result image with fusion (with monteverdi viewer) of original image and fancy classification and input image with fancy color classification from labeled image. Fusion of classification maps ----------------------------- @@ -476,8 +483,7 @@ Classifications generates a single more robust and precise classification map which combines the information extracted from the input list of labeled images. -The *FusionOfClassifications* application has the following input -parameters : +The *FusionOfClassifications* application has the following input parameters: - ``-il`` list of input labeled classification images to fuse @@ -516,30 +522,45 @@ The application can be used like this: -out MVFusedClassificationMap.tif Let us consider 6 independent classification maps of the same input -image (Cf. left image in `Figure 1`) generated from 6 different SVM models. -The `Figure 2` represents them after a color mapping by the same LUT. +image (Cf. left image in Figure2_) generated from 6 different SVM models. +The Figure3_ represents them after a color mapping by the same LUT. Thus, 4 classes (water: blue, roads: gray,vegetation: green, buildings with red roofs: red) are observable on each of them. -.. figure:: ../Art/MonteverdiImages/QB_1_ortho_C1_CM.png -.. figure:: ../Art/MonteverdiImages/QB_1_ortho_C2_CM.png -.. figure:: ../Art/MonteverdiImages/QB_1_ortho_C3_CM.png -.. figure:: ../Art/MonteverdiImages/QB_1_ortho_C4_CM.png -.. figure:: ../Art/MonteverdiImages/QB_1_ortho_C5_CM.png -.. figure:: ../Art/MonteverdiImages/QB_1_ortho_C6_CM.png +.. |image_31| image:: ../Art/MonteverdiImages/QB_1_ortho_C1_CM.png +.. |image_32| image:: ../Art/MonteverdiImages/QB_1_ortho_C2_CM.png +.. |image_33| image:: ../Art/MonteverdiImages/QB_1_ortho_C3_CM.png +.. |image_34| image:: ../Art/MonteverdiImages/QB_1_ortho_C4_CM.png +.. |image_35| image:: ../Art/MonteverdiImages/QB_1_ortho_C5_CM.png +.. |image_36| image:: ../Art/MonteverdiImages/QB_1_ortho_C6_CM.png + +.. _Figure3: + ++---------------------------+---------------------------+---------------------------+ +| |image_31| | |image_32| | |image_33| | ++---------------------------+---------------------------+---------------------------+ +| |image_34| | |image_35| | |image_36| | ++---------------------------+---------------------------+---------------------------+ Figure 3: Six fancy colored classified images to be fused, generated from 6 different SVM models. + As an example of the *FusionOfClassifications* application by *majority voting*, the fusion of the six input classification maps represented in -`Figure 3` leads to the classification map illustrated on the right in `Figure 4`. +Figure3_ leads to the classification map illustrated on the right in Figure4_. Thus, it appears that this fusion highlights the more relevant classes among the six different input classifications. The white parts of the fused image correspond to the undecided class labels, i.e. to pixels for which there is not a unique majority voting. -.. figure:: ../Art/MonteverdiImages/classification_chain_inputimage.jpg -.. figure:: ../Art/MonteverdiImages/QB_1_ortho_MV_C123456_CM.png +.. |image_41| image:: ../Art/MonteverdiImages/classification_chain_inputimage.jpg +.. |image_42| image:: ../Art/MonteverdiImages/QB_1_ortho_MV_C123456_CM.png + +.. _Figure4: + ++------------------------------------------------+------------------------------------------------+ +| |image_41| | |image_42| | ++------------------------------------------------+------------------------------------------------+ Figure 4: From left to right: Original image, and fancy colored classified image obtained by a majority voting fusion of the 6 classification maps represented in Fig. 4.13 (water: blue, roads: gray, vegetation: green, buildings with red roofs: red, undecided: white) @@ -586,16 +607,23 @@ The application can be used like this: -out DSFusedClassificationMap.tif As an example of the *FusionOfClassifications* application by *Dempster -Shafer*, the fusion of the six input classification maps represented in -`Figure 3` leads to the classification map illustrated on the right in `Figure 5` -[fig:ClassificationMapFusionApplicationDS]. Thus, it appears that this -fusion gives access to a more precise and robust classification map +Shafer*, the fusion of the six input classification maps represented in Figure3_ +leads to the classification map illustrated on the right in Figure5_. +Thus, it appears that this fusion gives access to a more precise and robust classification map based on the confidence level in each classifier. -.. figure:: ../Art/MonteverdiImages/classification_chain_inputimage.jpg -.. figure:: ../Art/MonteverdiImages/QB_1_ortho_DS_V_P_C123456_CM.png -Figure 5: From left to right: Original image, and fancy colored classified image obtained by a Dempster-Shafer fusion of the 6 classification maps represented in Fig. 4.13 (water: blue, roads: gray, vegetation: green, buildings with red roofs: red, undecided: white). +.. |image_51| image:: ../Art/MonteverdiImages/classification_chain_inputimage.jpg +.. |image_52| image:: ../Art/MonteverdiImages/QB_1_ortho_DS_V_P_C123456_CM.png + +.. _Figure5: + ++------------------------------------------------+------------------------------------------------+ +| |image_51| | |image_52| | ++------------------------------------------------+------------------------------------------------+ + +Figure 5: From left to right: Original image, and fancy colored classified image obtained by a Dempster-Shafer fusion of the 6 classification maps represented in Figure3_ (water: blue, roads: gray, vegetation: green, buildings with red roofs: red, undecided: white). + Recommendations to properly use the fusion of classification maps ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -701,15 +729,14 @@ Example ~~~~~~~ Resulting from the application presented in section :ref:`fancy_classification_results` -and illustrated in Fig. [fig:MeanShiftVectorImageFilter], -the Fig.[fig:ClassificationMapRegularizationApplication] shows a regularization +and illustrated in Figure2_, the Figure6_ shows a regularization of a classification map composed of 4 classes: water, roads, vegetation and buildings with red roofs. The radius of the ball shaped structuring element is equal to 3 pixels, which corresponds to a ball included in a 7 x 7 pixels square. Pixels with more than one majority class keep their original labels. -|image| |image| |image| [fig:ClassificationMapRegularizationApplication] + Regression ---------- @@ -720,10 +747,17 @@ a class index) from an input predictor. The workflow is the same as classification. First, the regression model is trained, then it can be used to predict output values. The applications to do that are and . -.. figure:: ../Art/MonteverdiImages/classification_chain_inputimage.jpg -.. figure:: ../Art/MonteverdiImages/classification_chain_fancyclassif_CMR_input.png -.. figure:: ../Art/MonteverdiImages/classification_chain_fancyclassif_CMR_3.png +.. |image_61| image:: ../Art/MonteverdiImages/classification_chain_inputimage.jpg +.. |image_62| image:: ../Art/MonteverdiImages/classification_chain_fancyclassif_CMR_input.png +.. |image_63| image:: ../Art/MonteverdiImages/classification_chain_fancyclassif_CMR_3.png + + +.. _Figure6: ++---------------------------+---------------------------+---------------------------+ +| |image_61| | |image_62| | |image_63| | ++---------------------------+---------------------------+---------------------------+ + Figure 6: From left to right: Original image, fancy colored classified image and regularized classification map with radius equal to 3 pixels. The input data set for training must have the following structure : diff --git a/Documentation/SoftwareGuide/Latex/Installation.tex b/Documentation/SoftwareGuide/Latex/Installation.tex index 64d1da24cf74358c4ea3e14bf4850309a851cd5c..89a801fa95a5f672abb435cd709c32f580808117 100644 --- a/Documentation/SoftwareGuide/Latex/Installation.tex +++ b/Documentation/SoftwareGuide/Latex/Installation.tex @@ -118,7 +118,7 @@ See table \ref{tab:otb-dependencies} for the full list of dependencies. \hline \textbf{MuParser} & \url{http://www.muparser.sourceforge.net} & no & - \\ \hline -\textbf{MuParserX} & \url{http://muparserx.beltoforion.de} & no & 3.0.5 \\ +\textbf{MuParserX} & \url{http://muparserx.beltoforion.de} & no & 4.0.7 \\ \hline \textbf{OpenCV} & \url{http://opencv.org} & no & 2 \\ \hline diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h b/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h index 140520a3b6a4f618d4ce576e25bca948778f233d..87f19d40d22d1ec89798d916549b634ed1310d33 100644 --- a/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h +++ b/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h @@ -23,6 +23,16 @@ #include "otbConfigure.h" #include "itkMacro.h" +#if defined(_MSC_VER) +#pragma warning ( push ) +#pragma warning ( disable: 4251 ) +#include "ogr_core.h" // OGR enums +#pragma warning ( pop ) +#else +#include "ogr_core.h" // OGR enums +#endif + + #ifdef OTB_USE_GDAL_20 class GDALDataset; class GDALDriver; @@ -40,6 +50,12 @@ namespace ogr namespace version_proxy { +/** +* With Gdal >= 2.0, this function will test equality between type and +* OFTInteger64 enum. Otherwise, it returns false. +*/ +OTBGdalAdapters_EXPORT bool IsOFTInteger64(OGRFieldType type); + /** * This namespace holds proxy functions hiding interface changes in gdal 2.0 * diff --git a/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy1x.cxx b/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy1x.cxx index 8a21d09882a99b96a0c098b5a46181970f9f1717..b81eb37f2675a530fdcbf3a62dd2bb29f5f8c1f5 100644 --- a/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy1x.cxx +++ b/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy1x.cxx @@ -17,6 +17,8 @@ =========================================================================*/ #include "otbOGRVersionProxy.h" +#include "itkMacro.h" + #if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wshadow" @@ -33,6 +35,12 @@ namespace ogr namespace version_proxy { +OTBGdalAdapters_EXPORT bool IsOFTInteger64(OGRFieldType itkNotUsed(type)) +{ + return false; +} + + GDALDatasetType * Open(const char * filename, bool readOnly) { return OGRSFDriverRegistrar::Open(filename,!readOnly); diff --git a/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy2x.cxx b/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy2x.cxx index 81d0ff82b9753dc66673b38872fb0b63165473c3..1872586038f3c16511a7487faf1173260f2d59ee 100644 --- a/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy2x.cxx +++ b/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy2x.cxx @@ -34,6 +34,11 @@ namespace ogr namespace version_proxy { +OTBGdalAdapters_EXPORT bool IsOFTInteger64(OGRFieldType type) +{ + return type == OFTInteger64; +} + GDALDatasetType * Open(const char * filename, bool readOnly) { return (GDALDatasetType *)GDALOpenEx(filename, (readOnly? GDAL_OF_READONLY : GDAL_OF_UPDATE) | GDAL_OF_VECTOR,NULL,NULL,NULL); diff --git a/Modules/Applications/AppClassification/app/otbComputeConfusionMatrix.cxx b/Modules/Applications/AppClassification/app/otbComputeConfusionMatrix.cxx index f3205381dd9ef5e2cdb6b8e466a8e1f8ad99d39f..240e55dfb4bbe9ba285ad5311313ac1d42fddfa3 100644 --- a/Modules/Applications/AppClassification/app/otbComputeConfusionMatrix.cxx +++ b/Modules/Applications/AppClassification/app/otbComputeConfusionMatrix.cxx @@ -30,6 +30,11 @@ namespace otb { namespace Wrapper { +/** Utility function to negate std::isalnum */ +bool IsNotAlphaNum(char c) + { + return !std::isalnum(c); + } class ComputeConfusionMatrix : public Application { @@ -108,12 +113,10 @@ private: AddParameter(ParameterType_InputFilename,"ref.vector.in","Input reference vector data"); SetParameterDescription("ref.vector.in", "Input vector data of the ground truth"); - AddParameter(ParameterType_String,"ref.vector.field","Field name"); + AddParameter(ParameterType_ListView,"ref.vector.field","Field name"); SetParameterDescription("ref.vector.field","Field name containing the label values"); - SetParameterString("ref.vector.field","Class"); - MandatoryOff("ref.vector.field"); - DisableParameter("ref.vector.field"); - + SetListViewSingleSelectionMode("ref.vector.field",true); + AddParameter(ParameterType_Int,"nodatalabel","Value for nodata pixels"); SetParameterDescription("nodatalabel", "Label for the NoData class. Such input pixels will be discarded from the " "ground truth and from the input classification map. By default, 'nodatalabel = 0'."); @@ -134,7 +137,32 @@ private: void DoUpdateParameters() ITK_OVERRIDE { - // Nothing to do here : all parameters are independent + if ( HasValue("ref.vector.in") ) + { + std::string vectorFile = GetParameterString("ref.vector.in"); + ogr::DataSource::Pointer ogrDS = + ogr::DataSource::New(vectorFile, ogr::DataSource::Modes::Read); + ogr::Layer layer = ogrDS->GetLayer(0); + ogr::Feature feature = layer.ogr().GetNextFeature(); + + ClearChoices("ref.vector.field"); + + for(int iField=0; iField<feature.ogr().GetFieldCount(); iField++) + { + std::string key, item = feature.ogr().GetFieldDefnRef(iField)->GetNameRef(); + key = item; + std::string::iterator end = std::remove_if(key.begin(),key.end(),IsNotAlphaNum); + std::transform(key.begin(), end, key.begin(), tolower); + + OGRFieldType fieldType = feature.ogr().GetFieldDefnRef(iField)->GetType(); + + if(fieldType == OFTString || fieldType == OFTInteger || ogr::version_proxy::IsOFTInteger64(fieldType)) + { + std::string tmpKey="ref.vector.field."+key.substr(0, end - key.begin()); + AddChoice(tmpKey,item); + } + } + } } std::string LogConfusionMatrix(MapOfClassesType* mapOfClasses, ConfusionMatrixType* matrix) @@ -228,8 +256,18 @@ private: else { ogrRef = otb::ogr::DataSource::New(GetParameterString("ref.vector.in"), otb::ogr::DataSource::Modes::Read); - field = this->GetParameterString("ref.vector.field"); + // Get field name + std::vector<int> selectedCFieldIdx = GetSelectedItems("ref.vector.field"); + + if(selectedCFieldIdx.empty()) + { + otbAppLogFATAL(<<"No field has been selected for data labelling!"); + } + + std::vector<std::string> cFieldNames = GetChoiceNames("ref.vector.field"); + field = cFieldNames[selectedCFieldIdx.front()]; + rasterizeReference->AddOGRDataSource(ogrRef); rasterizeReference->SetOutputParametersFromImage(input); rasterizeReference->SetBackgroundValue(nodata); diff --git a/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx b/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx index e713cda0a8d193fb7231dba8cdb5c7c850b26c28..d83410e452ae8825bd799cd3219379024502c43d 100644 --- a/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx +++ b/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx @@ -175,8 +175,9 @@ private: SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); - AddDocTag(Tags::Segmentation); AddDocTag(Tags::Learning); + AddDocTag(Tags::Segmentation); + AddParameter(ParameterType_InputImage, "in", "Input Image"); SetParameterDescription("in", "Input image to classify."); AddParameter(ParameterType_OutputImage, "out", "Output Image"); diff --git a/Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx b/Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx index 75867dd16a2cea1fdbe82a1085a5c23364968586..d2272b5e07e58e2c4ee487e897d963200a02e8c9 100644 --- a/Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx +++ b/Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx @@ -29,6 +29,12 @@ namespace otb namespace Wrapper { +/** Utility function to negate std::isalnum */ +bool IsNotAlphaNum(char c) + { + return !std::isalnum(c); + } + class PolygonClassStatistics : public Application { public: @@ -96,10 +102,9 @@ private: AddParameter(ParameterType_OutputFilename, "out", "Output Statistics"); SetParameterDescription("out","Output file to store statistics (XML format)"); - AddParameter(ParameterType_String, "field", "Field Name"); + AddParameter(ParameterType_ListView, "field", "Field Name"); SetParameterDescription("field","Name of the field carrying the class name in the input vectors."); - MandatoryOff("field"); - SetParameterString("field", "class"); + SetListViewSingleSelectionMode("field",true); AddParameter(ParameterType_Int, "layer", "Layer Index"); SetParameterDescription("layer", "Layer index to read in the input vector file."); @@ -119,14 +124,49 @@ private: void DoUpdateParameters() ITK_OVERRIDE { - // Nothing to do + if ( HasValue("vec") ) + { + std::string vectorFile = GetParameterString("vec"); + ogr::DataSource::Pointer ogrDS = + ogr::DataSource::New(vectorFile, ogr::DataSource::Modes::Read); + ogr::Layer layer = ogrDS->GetLayer(this->GetParameterInt("layer")); + ogr::Feature feature = layer.ogr().GetNextFeature(); + + ClearChoices("field"); + + for(int iField=0; iField<feature.ogr().GetFieldCount(); iField++) + { + std::string key, item = feature.ogr().GetFieldDefnRef(iField)->GetNameRef(); + key = item; + std::string::iterator end = std::remove_if(key.begin(),key.end(),IsNotAlphaNum); + std::transform(key.begin(), end, key.begin(), tolower); + + OGRFieldType fieldType = feature.ogr().GetFieldDefnRef(iField)->GetType(); + + if(fieldType == OFTString || fieldType == OFTInteger || ogr::version_proxy::IsOFTInteger64(fieldType)) + { + std::string tmpKey="field."+key.substr(0, end - key.begin()); + AddChoice(tmpKey,item); + } + } + } } void DoExecute() ITK_OVERRIDE { otb::ogr::DataSource::Pointer vectors = otb::ogr::DataSource::New(this->GetParameterString("vec")); - std::string fieldName = this->GetParameterString("field"); + + // Retrieve the field name + std::vector<int> selectedCFieldIdx = GetSelectedItems("field"); + + if(selectedCFieldIdx.empty()) + { + otbAppLogFATAL(<<"No field has been selected for data labelling!"); + } + + std::vector<std::string> cFieldNames = GetChoiceNames("field"); + std::string fieldName = cFieldNames[selectedCFieldIdx.front()]; otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this,"elev"); diff --git a/Modules/Applications/AppClassification/app/otbSOMClassification.cxx b/Modules/Applications/AppClassification/app/otbSOMClassification.cxx index d7f90750fc158ea06ccab2de176fdca0290c1f46..64a288751037c38e20026396fb45b489f0ed3ba1 100644 --- a/Modules/Applications/AppClassification/app/otbSOMClassification.cxx +++ b/Modules/Applications/AppClassification/app/otbSOMClassification.cxx @@ -85,8 +85,8 @@ private: SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); + AddDocTag(Tags::Learning); AddDocTag(Tags::Segmentation); - AddDocTag(Tags::Learning); AddParameter(ParameterType_InputImage, "in", "InputImage"); SetParameterDescription("in", "Input image to classify."); diff --git a/Modules/Applications/AppClassification/app/otbSampleExtraction.cxx b/Modules/Applications/AppClassification/app/otbSampleExtraction.cxx index f1cc0f910231585c8b829e65c58e43200f852014..bd5f447ed718235410bb86804787918d19620ffd 100644 --- a/Modules/Applications/AppClassification/app/otbSampleExtraction.cxx +++ b/Modules/Applications/AppClassification/app/otbSampleExtraction.cxx @@ -24,6 +24,11 @@ namespace otb { namespace Wrapper { +/** Utility function to negate std::isalnum */ +bool IsNotAlphaNum(char c) + { + return !std::isalnum(c); + } class SampleExtraction : public Application { @@ -89,12 +94,10 @@ private: AddParameter(ParameterType_StringList, "outfield.list.names", "Output field names"); SetParameterDescription("outfield.list.names","Full list of output field names."); - AddParameter(ParameterType_String, "field", "Field Name"); - SetParameterDescription("field","Name of the field carrying the class" - "name in the input vectors. This field is copied to output."); - MandatoryOff("field"); - SetParameterString("field", "class"); - + AddParameter(ParameterType_ListView, "field", "Field Name"); + SetParameterDescription("field","Name of the field carrying the class name in the input vectors."); + SetListViewSingleSelectionMode("field",true); + AddParameter(ParameterType_Int, "layer", "Layer Index"); SetParameterDescription("layer", "Layer index to read in the input vector file."); MandatoryOff("layer"); @@ -113,7 +116,32 @@ private: void DoUpdateParameters() { - // Nothing to do + if ( HasValue("vec") ) + { + std::string vectorFile = GetParameterString("vec"); + ogr::DataSource::Pointer ogrDS = + ogr::DataSource::New(vectorFile, ogr::DataSource::Modes::Read); + ogr::Layer layer = ogrDS->GetLayer(this->GetParameterInt("layer")); + ogr::Feature feature = layer.ogr().GetNextFeature(); + + ClearChoices("field"); + + for(int iField=0; iField<feature.ogr().GetFieldCount(); iField++) + { + std::string key, item = feature.ogr().GetFieldDefnRef(iField)->GetNameRef(); + key = item; + std::string::iterator end = std::remove_if(key.begin(),key.end(),IsNotAlphaNum); + std::transform(key.begin(), end, key.begin(), tolower); + + OGRFieldType fieldType = feature.ogr().GetFieldDefnRef(iField)->GetType(); + + if(fieldType == OFTString || fieldType == OFTInteger || ogr::version_proxy::IsOFTInteger64(fieldType)) + { + std::string tmpKey="field."+key.substr(0, end - key.begin()); + AddChoice(tmpKey,item); + } + } + } } void DoExecute() @@ -134,6 +162,17 @@ private: output = vectors; } + // Retrieve the field name + std::vector<int> selectedCFieldIdx = GetSelectedItems("field"); + + if(selectedCFieldIdx.empty()) + { + otbAppLogFATAL(<<"No field has been selected for data labelling!"); + } + + std::vector<std::string> cFieldNames = GetChoiceNames("field"); + std::string fieldName = cFieldNames[selectedCFieldIdx.front()]; + std::vector<std::string> nameList; std::string namePrefix(""); if (this->GetParameterString("outfield").compare("prefix") == 0) @@ -155,7 +194,7 @@ private: filter->SetLayerIndex(this->GetParameterInt("layer")); filter->SetSamplePositions(vectors); filter->SetOutputSamples(output); - filter->SetClassFieldName(this->GetParameterString("field")); + filter->SetClassFieldName(fieldName); filter->SetOutputFieldPrefix(namePrefix); filter->SetOutputFieldNames(nameList); filter->GetStreamer()->SetAutomaticAdaptativeStreaming(GetParameterInt("ram")); diff --git a/Modules/Applications/AppClassification/app/otbSampleSelection.cxx b/Modules/Applications/AppClassification/app/otbSampleSelection.cxx index 260355880f34d7cb5248416bf24588cc2fe9468c..ef81a64d5fd8564197b0ffe21741f0b3b17ff20c 100644 --- a/Modules/Applications/AppClassification/app/otbSampleSelection.cxx +++ b/Modules/Applications/AppClassification/app/otbSampleSelection.cxx @@ -30,6 +30,12 @@ namespace otb namespace Wrapper { +/** Utility function to negate std::isalnum */ +bool IsNotAlphaNum(char c) + { + return !std::isalnum(c); + } + class SampleSelection : public Application { public: @@ -195,10 +201,9 @@ private: // Default strategy : smallest SetParameterString("strategy","smallest"); - AddParameter(ParameterType_String, "field", "Field Name"); + AddParameter(ParameterType_ListView, "field", "Field Name"); SetParameterDescription("field","Name of the field carrying the class name in the input vectors."); - MandatoryOff("field"); - SetParameterString("field", "class"); + SetListViewSingleSelectionMode("field",true); AddParameter(ParameterType_Int, "layer", "Layer Index"); SetParameterDescription("layer", "Layer index to read in the input vector file."); @@ -221,6 +226,32 @@ private: void DoUpdateParameters() { + if ( HasValue("vec") ) + { + std::string vectorFile = GetParameterString("vec"); + ogr::DataSource::Pointer ogrDS = + ogr::DataSource::New(vectorFile, ogr::DataSource::Modes::Read); + ogr::Layer layer = ogrDS->GetLayer(this->GetParameterInt("layer")); + ogr::Feature feature = layer.ogr().GetNextFeature(); + + ClearChoices("field"); + + for(int iField=0; iField<feature.ogr().GetFieldCount(); iField++) + { + std::string key, item = feature.ogr().GetFieldDefnRef(iField)->GetNameRef(); + key = item; + std::string::iterator end = std::remove_if(key.begin(),key.end(),IsNotAlphaNum); + std::transform(key.begin(), end, key.begin(), tolower); + + OGRFieldType fieldType = feature.ogr().GetFieldDefnRef(iField)->GetType(); + + if(fieldType == OFTString || fieldType == OFTInteger || ogr::version_proxy::IsOFTInteger64(fieldType)) + { + std::string tmpKey="field."+key.substr(0, end - key.begin()); + AddChoice(tmpKey,item); + } + } + } } void DoExecute() @@ -235,6 +266,17 @@ private: // Setup ram m_Periodic->GetStreamer()->SetAutomaticAdaptativeStreaming(GetParameterInt("ram")); m_Random->GetStreamer()->SetAutomaticAdaptativeStreaming(GetParameterInt("ram")); + + // Get field name + std::vector<int> selectedCFieldIdx = GetSelectedItems("field"); + + if(selectedCFieldIdx.empty()) + { + otbAppLogFATAL(<<"No field has been selected for data labelling!"); + } + + std::vector<std::string> cFieldNames = GetChoiceNames("field"); + std::string fieldName = cFieldNames[selectedCFieldIdx.front()]; m_ReaderStat->SetFileName(this->GetParameterString("instats")); ClassCountMapType classCount = m_ReaderStat->GetStatisticMapByName<ClassCountMapType>("samplesPerClass"); @@ -377,7 +419,7 @@ private: m_Periodic->SetInput(this->GetParameterImage("in")); m_Periodic->SetOGRData(reprojVector); m_Periodic->SetOutputPositionContainerAndRates(outputSamples, rates); - m_Periodic->SetFieldName(this->GetParameterString("field")); + m_Periodic->SetFieldName(fieldName); m_Periodic->SetLayerIndex(this->GetParameterInt("layer")); m_Periodic->SetSamplerParameters(param); if (IsParameterEnabled("mask") && HasValue("mask")) @@ -395,7 +437,7 @@ private: m_Random->SetInput(this->GetParameterImage("in")); m_Random->SetOGRData(reprojVector); m_Random->SetOutputPositionContainerAndRates(outputSamples, rates); - m_Random->SetFieldName(this->GetParameterString("field")); + m_Random->SetFieldName(fieldName); m_Random->SetLayerIndex(this->GetParameterInt("layer")); if (IsParameterEnabled("mask") && HasValue("mask")) { diff --git a/Modules/Applications/AppClassification/app/otbTrainVectorClassifier.cxx b/Modules/Applications/AppClassification/app/otbTrainVectorClassifier.cxx index 09edbc6cf385cb8397ca166d4c9394081e1f6019..7f92b72cc42b464394af17c548bc954710e85d83 100644 --- a/Modules/Applications/AppClassification/app/otbTrainVectorClassifier.cxx +++ b/Modules/Applications/AppClassification/app/otbTrainVectorClassifier.cxx @@ -109,11 +109,11 @@ private: AddParameter(ParameterType_ListView, "feat", "Field names for training features."); SetParameterDescription("feat","List of field names in the input vector data to be used as features for training."); - AddParameter(ParameterType_String,"cfield","Field containing the class id for supervision"); + AddParameter(ParameterType_ListView,"cfield","Field containing the class id for supervision"); SetParameterDescription("cfield","Field containing the class id for supervision. " "Only geometries with this field available will be taken into account."); - SetParameterString("cfield","class"); - + SetListViewSingleSelectionMode("cfield",true); + AddParameter(ParameterType_Int, "layer", "Layer Index"); SetParameterDescription("layer", "Index of the layer to use in the input vector file."); MandatoryOff("layer"); @@ -155,14 +155,27 @@ private: ogr::Feature feature = layer.ogr().GetNextFeature(); ClearChoices("feat"); + ClearChoices("cfield"); + for(int iField=0; iField<feature.ogr().GetFieldCount(); iField++) { std::string key, item = feature.ogr().GetFieldDefnRef(iField)->GetNameRef(); key = item; std::string::iterator end = std::remove_if(key.begin(),key.end(),IsNotAlphaNum); std::transform(key.begin(), end, key.begin(), tolower); - key="feat."+key.substr(0, end - key.begin()); - AddChoice(key,item); + + OGRFieldType fieldType = feature.ogr().GetFieldDefnRef(iField)->GetType(); + + if(fieldType == OFTInteger || ogr::version_proxy::IsOFTInteger64(fieldType) || fieldType == OFTReal) + { + std::string tmpKey="feat."+key.substr(0, end - key.begin()); + AddChoice(tmpKey,item); + } + if(fieldType == OFTString || fieldType == OFTInteger || ogr::version_proxy::IsOFTInteger64(fieldType)) + { + std::string tmpKey="cfield."+key.substr(0, end - key.begin()); + AddChoice(tmpKey,item); + } } } } @@ -248,13 +261,29 @@ void DoExecute() // Prepare selected field names (their position may change between two inputs) std::vector<int> selectedIdx = GetSelectedItems("feat"); + std::vector<int> selectedCFieldIdx = GetSelectedItems("cfield"); + + if(selectedIdx.empty()) + { + otbAppLogFATAL(<<"No features have been selected to train the classifier on!"); + } + + if(selectedCFieldIdx.empty()) + { + otbAppLogFATAL(<<"No field has been selected for data labelling!"); + } + const unsigned int nbFeatures = selectedIdx.size(); std::vector<std::string> fieldNames = GetChoiceNames("feat"); + std::vector<std::string> cFieldNames = GetChoiceNames("cfield"); std::vector<std::string> selectedNames(nbFeatures); for (unsigned int i=0 ; i<nbFeatures ; i++) { selectedNames[i] = fieldNames[selectedIdx[i]]; } + + std::string selectedCFieldName = cFieldNames[selectedCFieldIdx.front()]; + std::vector<int> featureFieldIndex(nbFeatures, -1); int cFieldIndex = -1; @@ -307,9 +336,9 @@ void DoExecute() // Check all needed fields are present : // - check class field - cFieldIndex = feature.ogr().GetFieldIndex(GetParameterString("cfield").c_str()); + cFieldIndex = feature.ogr().GetFieldIndex(selectedCFieldName.c_str()); if (cFieldIndex < 0) - otbAppLogFATAL("The field name for class label ("<<GetParameterString("cfield") + otbAppLogFATAL("The field name for class label ("<<selectedCFieldName <<") has not been found in the input vector file! Choices are "<< availableFields); // - check feature fields for (unsigned int i=0 ; i<nbFeatures ; i++) diff --git a/Modules/Applications/AppClassification/test/CMakeLists.txt b/Modules/Applications/AppClassification/test/CMakeLists.txt index 451c17e6392e61a2d40bc2044b208ee4ba3f5c8f..76715f8d20cd4a35dd144fbdd71f471bb149bed4 100644 --- a/Modules/Applications/AppClassification/test/CMakeLists.txt +++ b/Modules/Applications/AppClassification/test/CMakeLists.txt @@ -901,7 +901,7 @@ otb_test_application(NAME apTvClSampleExtraction APP SampleExtraction OPTIONS -in ${INPUTDATA}/Classification/QB_1_ortho.tif -vec ${INPUTDATA}/Classification/apTvClSampleSelectionOut.sqlite - -field Class + -field class -out ${TEMP}/apTvClSampleExtractionOut.sqlite VALID --compare-ogr ${NOTOL} ${OTBAPP_BASELINE_FILES}/apTvClSampleExtractionOut.sqlite diff --git a/Modules/Applications/AppDimensionalityReduction/app/otbDimensionalityReduction.cxx b/Modules/Applications/AppDimensionalityReduction/app/otbDimensionalityReduction.cxx index 2359b00bb607bffa6255433f345a1588c952e26a..dd9c450359f24d17d5389bc2172f728ae25d0bc8 100644 --- a/Modules/Applications/AppDimensionalityReduction/app/otbDimensionalityReduction.cxx +++ b/Modules/Applications/AppDimensionalityReduction/app/otbDimensionalityReduction.cxx @@ -97,8 +97,8 @@ private: SetDocSeeAlso( "\"Kernel maximum autocorrelation factor and minimum noise fraction transformations,\" IEEE Transactions on Image Processing, vol. 20, no. 3, pp. 612-624, (2011)"); - AddDocTag(Tags::DimensionReduction); AddDocTag(Tags::Filter); + AddDocTag(Tags::DimensionReduction); AddParameter(ParameterType_InputImage, "in", "Input Image"); SetParameterDescription("in", "The input image to apply dimensionality reduction."); diff --git a/Modules/Applications/AppEdge/app/otbEdgeExtraction.cxx b/Modules/Applications/AppEdge/app/otbEdgeExtraction.cxx index 444749182f0b0c937d2e3a7ee6f36bd7df1c0097..b2a5d319961e072f219aa3be28531593f3ff6df0 100644 --- a/Modules/Applications/AppEdge/app/otbEdgeExtraction.cxx +++ b/Modules/Applications/AppEdge/app/otbEdgeExtraction.cxx @@ -70,8 +70,8 @@ SetDocLimitations("None"); SetDocAuthors("OTB-Team"); SetDocSeeAlso("otb class"); -AddDocTag("Edge"); AddDocTag(Tags::FeatureExtraction); +AddDocTag("Edge"); AddParameter(ParameterType_InputImage, "in", "Input Image"); SetParameterDescription("in", "The input image to compute the features on."); diff --git a/Modules/Applications/AppFiltering/app/otbDespeckle.cxx b/Modules/Applications/AppFiltering/app/otbDespeckle.cxx index 0fde206f26a6a2577acfb4fa32bf37dae162631b..79a62586c9fa84d658256001c2d36036ab92618f 100644 --- a/Modules/Applications/AppFiltering/app/otbDespeckle.cxx +++ b/Modules/Applications/AppFiltering/app/otbDespeckle.cxx @@ -63,8 +63,8 @@ private: SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); - AddDocTag(Tags::SAR); AddDocTag(Tags::Filter); + AddDocTag(Tags::SAR); AddParameter(ParameterType_InputImage, "in", "Input Image"); SetParameterDescription("in", "Input image."); diff --git a/Modules/Applications/AppHyperspectral/app/otbHyperspectralUnmixing.cxx b/Modules/Applications/AppHyperspectral/app/otbHyperspectralUnmixing.cxx index 50c8c11dcaa5b2ccf27a0d123d2db9dcb0b3c08f..750dab500b013de237e0873ca42ee8829384dc2d 100644 --- a/Modules/Applications/AppHyperspectral/app/otbHyperspectralUnmixing.cxx +++ b/Modules/Applications/AppHyperspectral/app/otbHyperspectralUnmixing.cxx @@ -97,6 +97,7 @@ private: SetDocAuthors("OTB-Team"); SetDocSeeAlso("VertexComponentAnalysis"); + AddDocTag("Miscellaneous"); AddDocTag(Tags::Hyperspectral); AddParameter(ParameterType_InputImage, "in", "Input Image Filename"); diff --git a/Modules/Applications/AppHyperspectral/app/otbVertexComponentAnalysis.cxx b/Modules/Applications/AppHyperspectral/app/otbVertexComponentAnalysis.cxx index cc729585ce5ae1ec0a16af75048f930f15f12973..8191f40f6242d61e8d90f86e775c0778e614b91b 100644 --- a/Modules/Applications/AppHyperspectral/app/otbVertexComponentAnalysis.cxx +++ b/Modules/Applications/AppHyperspectral/app/otbVertexComponentAnalysis.cxx @@ -56,6 +56,7 @@ private: SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); + AddDocTag("Miscellaneous"); AddDocTag(Tags::Hyperspectral); AddDocTag(Tags::DimensionReduction); diff --git a/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx b/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx index d4968e35a4a331bb78ef6d169c39617bb91ca0ef..5be587709679b0ad3f70d7472b2c5a7a24244af6 100644 --- a/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx +++ b/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx @@ -265,10 +265,10 @@ private: SetDocAuthors("OTB-Team"); SetDocSeeAlso("ImageSVMClassifier"); - AddDocTag("Utilities"); AddDocTag(Tags::Manip); AddDocTag(Tags::Meta); AddDocTag(Tags::Learning); + AddDocTag("Utilities"); // Build lut map diff --git a/Modules/Applications/AppImageUtils/app/otbCompareImages.cxx b/Modules/Applications/AppImageUtils/app/otbCompareImages.cxx index f08ac34ae20f07aa8847b34de459cf277746e158..37210b5790277f47898c442b2b0576048fe9c877 100644 --- a/Modules/Applications/AppImageUtils/app/otbCompareImages.cxx +++ b/Modules/Applications/AppImageUtils/app/otbCompareImages.cxx @@ -58,7 +58,9 @@ private: SetDocAuthors("OTB-Team"); SetDocSeeAlso("BandMath application, ImageStatistics"); + AddDocTag("Miscellaneous"); AddDocTag("Statistics"); + AddDocTag(Tags::Manip); AddParameter(ParameterType_Group, "ref", "Reference image properties"); AddParameter(ParameterType_InputImage, "ref.in", "Reference image"); diff --git a/Modules/Applications/AppImageUtils/app/otbConvert.cxx b/Modules/Applications/AppImageUtils/app/otbConvert.cxx index 7f7d5651dc67b13dba29bed9d68bb99379c7e35a..c5ec7a20bc3a6fbd26880c2294a387024579640b 100644 --- a/Modules/Applications/AppImageUtils/app/otbConvert.cxx +++ b/Modules/Applications/AppImageUtils/app/otbConvert.cxx @@ -86,9 +86,10 @@ private: SetDocLimitations("None"); SetDocAuthors("OTB-Team"); SetDocSeeAlso("Rescale"); + + AddDocTag(Tags::Manip); AddDocTag("Conversion"); AddDocTag("Image Dynamic"); - AddDocTag(Tags::Manip); AddParameter(ParameterType_InputImage, "in", "Input image"); SetParameterDescription("in", "Input image"); diff --git a/Modules/Applications/AppImageUtils/app/otbDownloadSRTMTiles.cxx b/Modules/Applications/AppImageUtils/app/otbDownloadSRTMTiles.cxx index b036c0f8071f6775d29f0ed00c1d61923c8e29cf..3ea74d4b77ef14152cd76b37b4345f7f5a64497e 100644 --- a/Modules/Applications/AppImageUtils/app/otbDownloadSRTMTiles.cxx +++ b/Modules/Applications/AppImageUtils/app/otbDownloadSRTMTiles.cxx @@ -103,8 +103,8 @@ private: SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); - AddDocTag("Utilities"); AddDocTag(Tags::Manip); + AddDocTag("Utilities"); AddParameter(ParameterType_InputImageList, "il", "Input images list"); SetParameterDescription("il", "The list of images on which you want to determine corresponding SRTM tiles."); diff --git a/Modules/Applications/AppImageUtils/app/otbManageNoData.cxx b/Modules/Applications/AppImageUtils/app/otbManageNoData.cxx index ba5231c409bc9e8f05fdda3caf5a8a5f6f122653..03d98cf42bb1fd1577fd65be9731192b35155d82 100644 --- a/Modules/Applications/AppImageUtils/app/otbManageNoData.cxx +++ b/Modules/Applications/AppImageUtils/app/otbManageNoData.cxx @@ -64,10 +64,11 @@ private: SetDocLongDescription("This application has two modes. The first allows building a mask of no-data pixels from the no-data flags read from the image file. The second allows updating the change the no-data value of an image (pixels value and metadata). This last mode also allows replacing NaN in images with a proper no-data value. To do so, one should activate the NaN is no-data option."); SetDocLimitations("None"); SetDocAuthors("OTB-Team"); - SetDocSeeAlso("BanMath"); + SetDocSeeAlso("BandMath"); + + AddDocTag(Tags::Manip); AddDocTag("Conversion"); AddDocTag("Image Dynamic"); - AddDocTag(Tags::Manip); AddParameter(ParameterType_InputImage, "in", "Input image"); SetParameterDescription("in", "Input image"); diff --git a/Modules/Applications/AppImageUtils/app/otbMultiResolutionPyramid.cxx b/Modules/Applications/AppImageUtils/app/otbMultiResolutionPyramid.cxx index 4e7ce61476dd258c9a6e024504536165a7fddd82..9fd36595d32b18c24f100056df4b94997375edb4 100644 --- a/Modules/Applications/AppImageUtils/app/otbMultiResolutionPyramid.cxx +++ b/Modules/Applications/AppImageUtils/app/otbMultiResolutionPyramid.cxx @@ -67,8 +67,8 @@ private: SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); + AddDocTag(Tags::Manip); AddDocTag("Conversion"); - AddDocTag(Tags::Manip); AddDocTag(Tags::Multi); AddDocTag("Util"); diff --git a/Modules/Applications/AppImageUtils/app/otbPixelValue.cxx b/Modules/Applications/AppImageUtils/app/otbPixelValue.cxx index 35a860d0d4473d1962879d4bb9951ac36a229025..f616b678864604ba6c759d067ebe171cc580235b 100644 --- a/Modules/Applications/AppImageUtils/app/otbPixelValue.cxx +++ b/Modules/Applications/AppImageUtils/app/otbPixelValue.cxx @@ -55,6 +55,7 @@ private: SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); + AddDocTag("Miscellaneous"); AddDocTag("Utilities"); AddDocTag("Coordinates"); AddDocTag("Raster"); diff --git a/Modules/Applications/AppImageUtils/app/otbReadImageInfo.cxx b/Modules/Applications/AppImageUtils/app/otbReadImageInfo.cxx index 0bb1633de361d4487fa1b0d834a6c512cc9f545e..aaa1143fb52239e13ece0aed69ab33829a49280a 100644 --- a/Modules/Applications/AppImageUtils/app/otbReadImageInfo.cxx +++ b/Modules/Applications/AppImageUtils/app/otbReadImageInfo.cxx @@ -57,8 +57,8 @@ private: SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); - AddDocTag("Utilities"); AddDocTag(Tags::Manip); + AddDocTag("Utilities"); AddDocTag(Tags::Meta); AddParameter(ParameterType_InputImage, "in", "Input Image"); diff --git a/Modules/Applications/AppIndices/app/otbRadiometricIndices.cxx b/Modules/Applications/AppIndices/app/otbRadiometricIndices.cxx index 3c910f26e15995ebf50ba52d578572fa3791c709..3466d519131f521bc6fea30e7d30d2c66d1cf890 100644 --- a/Modules/Applications/AppIndices/app/otbRadiometricIndices.cxx +++ b/Modules/Applications/AppIndices/app/otbRadiometricIndices.cxx @@ -138,8 +138,8 @@ private: SetDocAuthors("OTB-Team"); SetDocSeeAlso("otbVegetationIndicesFunctor, otbWaterIndicesFunctor and otbSoilIndicesFunctor classes"); - AddDocTag("Radiometric Indices"); AddDocTag(Tags::FeatureExtraction); + AddDocTag("Radiometric Indices"); AddParameter(ParameterType_InputImage, "in", "Input Image"); SetParameterDescription("in", "Input image"); diff --git a/Modules/Applications/AppKMZ/app/otbKmzExport.cxx b/Modules/Applications/AppKMZ/app/otbKmzExport.cxx index e4156451bc87c17692475e0111599ff8c0ad355f..c0cc931a5854eae60ff9b9f67eb67131f0235963 100644 --- a/Modules/Applications/AppKMZ/app/otbKmzExport.cxx +++ b/Modules/Applications/AppKMZ/app/otbKmzExport.cxx @@ -53,6 +53,7 @@ private: SetDocAuthors("OTB-Team"); SetDocSeeAlso("Conversion"); + AddDocTag("Miscellaneous"); AddDocTag("KMZ"); AddDocTag("Export"); diff --git a/Modules/Applications/AppMathParser/app/otbBandMath.cxx b/Modules/Applications/AppMathParser/app/otbBandMath.cxx index ce71ca512c285e6de1bc0163f78deb065366c567..48868b6c575ffb600ecf2ec9bb32e6d891bb27cd 100644 --- a/Modules/Applications/AppMathParser/app/otbBandMath.cxx +++ b/Modules/Applications/AppMathParser/app/otbBandMath.cxx @@ -66,7 +66,7 @@ private: SetDocLimitations("None"); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); - AddDocTag("Util"); + AddDocTag("Miscellaneous"); AddParameter(ParameterType_InputImageList, "il", "Input image list"); SetParameterDescription("il", "Image list to perform computation on."); diff --git a/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx b/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx index 91d8c872e769092d9ddadfb584da319304e304c7..19ef784627e25fa05532510984377a1705074f75 100644 --- a/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx +++ b/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx @@ -141,7 +141,7 @@ private: "Separating expressions by semi-colons (; ) will concatenate their results into a unique multiband output image. "); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); - AddDocTag("Util"); + AddDocTag("Miscellaneous"); AddParameter(ParameterType_InputImageList, "il", "Input image list"); SetParameterDescription("il", "Image list to perform computation on."); diff --git a/Modules/Applications/AppMoments/app/otbLocalStatisticExtraction.cxx b/Modules/Applications/AppMoments/app/otbLocalStatisticExtraction.cxx index e60b4bb8e90a5212e4fe37f6a34845bd1d404547..ad4c0c43e81f09fe5402d068c63e2125353c5fe0 100644 --- a/Modules/Applications/AppMoments/app/otbLocalStatisticExtraction.cxx +++ b/Modules/Applications/AppMoments/app/otbLocalStatisticExtraction.cxx @@ -64,8 +64,8 @@ SetDocLimitations("None"); SetDocAuthors("OTB-Team"); SetDocSeeAlso("otbRadiometricMomentsImageFunction class"); -AddDocTag("Statistics"); AddDocTag(Tags::FeatureExtraction); +AddDocTag("Statistics"); AddParameter(ParameterType_InputImage, "in", "Input Image"); SetParameterDescription("in", "The input image to compute the features on."); diff --git a/Modules/Applications/AppMorphology/app/otbBinaryMorphologicalOperation.cxx b/Modules/Applications/AppMorphology/app/otbBinaryMorphologicalOperation.cxx index 9e5e121d5fd1a92cfc369c571f4300ee2f6f5b57..eeddd79f264e58edbc7b860b721520f759dac56f 100644 --- a/Modules/Applications/AppMorphology/app/otbBinaryMorphologicalOperation.cxx +++ b/Modules/Applications/AppMorphology/app/otbBinaryMorphologicalOperation.cxx @@ -85,8 +85,8 @@ SetDocLimitations("None"); SetDocAuthors("OTB-Team"); SetDocSeeAlso("itkBinaryDilateImageFilter, itkBinaryErodeImageFilter, itkBinaryMorphologicalOpeningImageFilter and itkBinaryMorphologicalClosingImageFilter classes"); -AddDocTag("MorphologicalOperations"); AddDocTag(Tags::FeatureExtraction); +AddDocTag("MorphologicalOperations"); AddParameter(ParameterType_InputImage, "in", "Input Image"); SetParameterDescription("in", "The input image to be filtered."); diff --git a/Modules/Applications/AppMorphology/app/otbGrayScaleMorphologicalOperation.cxx b/Modules/Applications/AppMorphology/app/otbGrayScaleMorphologicalOperation.cxx index ae025a22becff71995aff75d945151f80fe55103..bb816fc0b3c5d35f90cd490db57d3d1113994d3c 100644 --- a/Modules/Applications/AppMorphology/app/otbGrayScaleMorphologicalOperation.cxx +++ b/Modules/Applications/AppMorphology/app/otbGrayScaleMorphologicalOperation.cxx @@ -85,8 +85,8 @@ SetDocLimitations("None"); SetDocAuthors("OTB-Team"); SetDocSeeAlso("itkGrayscaleDilateImageFilter, itkGrayscaleErodeImageFilter, itkGrayscaleMorphologicalOpeningImageFilter and itkGrayscaleMorphologicalClosingImageFilter classes"); -AddDocTag("MorphologicalOperations"); AddDocTag(Tags::FeatureExtraction); +AddDocTag("MorphologicalOperations"); AddParameter(ParameterType_InputImage, "in", "Input Image"); SetParameterDescription("in", "The input image to be filtered."); diff --git a/Modules/Applications/AppProjection/app/otbConvertCartoToGeoPoint.cxx b/Modules/Applications/AppProjection/app/otbConvertCartoToGeoPoint.cxx index 5dd1cdd05d63216aee50d9375bb5a01c31c397d0..718d79168034d56ea72abadfa55c8aead3f81e1c 100644 --- a/Modules/Applications/AppProjection/app/otbConvertCartoToGeoPoint.cxx +++ b/Modules/Applications/AppProjection/app/otbConvertCartoToGeoPoint.cxx @@ -59,8 +59,8 @@ private: SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); - AddDocTag(Tags::Coordinates); AddDocTag(Tags::Geometry); + AddDocTag(Tags::Coordinates); AddParameter(ParameterType_Group, "carto", "Input cartographic coordinates"); AddParameter(ParameterType_Float, "carto.x", "X cartographic coordinates"); diff --git a/Modules/Applications/AppProjection/app/otbObtainUTMZoneFromGeoPoint.cxx b/Modules/Applications/AppProjection/app/otbObtainUTMZoneFromGeoPoint.cxx index e411fa356efded2277aa0a68015c988e456e5118..e31337346082e978c70673002df5074802f12500 100644 --- a/Modules/Applications/AppProjection/app/otbObtainUTMZoneFromGeoPoint.cxx +++ b/Modules/Applications/AppProjection/app/otbObtainUTMZoneFromGeoPoint.cxx @@ -61,6 +61,7 @@ private: SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); + AddDocTag("Miscellaneous"); AddDocTag(Tags::Coordinates); AddParameter(ParameterType_Float, "lat", "Latitude"); diff --git a/Modules/Applications/AppProjection/app/otbRigidTransformResample.cxx b/Modules/Applications/AppProjection/app/otbRigidTransformResample.cxx index 6afc8e4f9bc8733c91073c01a9af928a5cd01138..f7ec69e7efcab2ef79c9b71065bf38df2c0e25ca 100644 --- a/Modules/Applications/AppProjection/app/otbRigidTransformResample.cxx +++ b/Modules/Applications/AppProjection/app/otbRigidTransformResample.cxx @@ -89,8 +89,8 @@ private: SetDocAuthors("OTB-Team"); SetDocSeeAlso("Translation"); + AddDocTag(Tags::Geometry); AddDocTag("Conversion"); - AddDocTag(Tags::Geometry); AddParameter(ParameterType_InputImage, "in", "Input image"); SetParameterDescription("in","The input image to translate."); diff --git a/Modules/Applications/AppProjection/app/otbVectorDataReprojection.cxx b/Modules/Applications/AppProjection/app/otbVectorDataReprojection.cxx index 3b4cdde5d15d15b881fcc301ad9233c25bf02c3a..5b0992eb3447048001e3db37770b9e91518da0fd 100644 --- a/Modules/Applications/AppProjection/app/otbVectorDataReprojection.cxx +++ b/Modules/Applications/AppProjection/app/otbVectorDataReprojection.cxx @@ -75,8 +75,8 @@ private: SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); - AddDocTag(Tags::Geometry); AddDocTag(Tags::Vector); + AddDocTag(Tags::Geometry); AddDocTag(Tags::Coordinates); // Set the parameters diff --git a/Modules/Applications/AppSegmentation/app/otbConnectedComponentSegmentation.cxx b/Modules/Applications/AppSegmentation/app/otbConnectedComponentSegmentation.cxx index 1c4e3073a7657abcd6bc73e0f45fc773d845308d..d6bf04c7cb804f08cb1da1a4d101b2526b9ff1c9 100644 --- a/Modules/Applications/AppSegmentation/app/otbConnectedComponentSegmentation.cxx +++ b/Modules/Applications/AppSegmentation/app/otbConnectedComponentSegmentation.cxx @@ -76,8 +76,8 @@ private: SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); - AddDocTag(Tags::Analysis); AddDocTag(Tags::Segmentation); + AddDocTag(Tags::Analysis); AddParameter(ParameterType_InputImage, "in", "Input Image"); SetParameterDescription("in", "The image to segment."); diff --git a/Modules/Applications/AppTextures/app/otbHaralickTextureExtraction.cxx b/Modules/Applications/AppTextures/app/otbHaralickTextureExtraction.cxx index fa14c6dc8209bb748c16f62e55c7eeaef716db9b..ee0f645a14cc9a958510d5afc28f9a17c5e05960 100644 --- a/Modules/Applications/AppTextures/app/otbHaralickTextureExtraction.cxx +++ b/Modules/Applications/AppTextures/app/otbHaralickTextureExtraction.cxx @@ -76,8 +76,8 @@ SetDocLimitations("None"); SetDocAuthors("OTB-Team"); SetDocSeeAlso("otbScalarImageToTexturesFilter, otbScalarImageToAdvancedTexturesFilter and otbScalarImageToHigherOrderTexturesFilter classes"); -AddDocTag("Textures"); AddDocTag(Tags::FeatureExtraction); +AddDocTag("Textures"); AddParameter(ParameterType_InputImage, "in", "Input Image"); SetParameterDescription("in", "The input image to compute the features on."); diff --git a/Modules/Applications/AppTextures/app/otbSFSTextureExtraction.cxx b/Modules/Applications/AppTextures/app/otbSFSTextureExtraction.cxx index 3fe88a9897dfc0b58ab64b9d378be0a45397a926..a415efc6de4c6ae79b103f5815bde9e8a6f939b2 100644 --- a/Modules/Applications/AppTextures/app/otbSFSTextureExtraction.cxx +++ b/Modules/Applications/AppTextures/app/otbSFSTextureExtraction.cxx @@ -67,8 +67,8 @@ SetDocLimitations("None"); SetDocAuthors("OTB-Team"); SetDocSeeAlso("otbSFSTexturesImageFilter class"); -AddDocTag("Textures"); AddDocTag(Tags::FeatureExtraction); +AddDocTag("Textures"); AddParameter(ParameterType_InputImage, "in", "Input Image"); SetParameterDescription("in", "The input image to compute the features on."); diff --git a/Modules/Applications/AppVectorUtils/app/otbOSMDownloader.cxx b/Modules/Applications/AppVectorUtils/app/otbOSMDownloader.cxx index 3ff6ee10d1ec3047b183c11877000d4891aa63ae..c50b4bf44e4c91ca0429748a432699c68b801718 100644 --- a/Modules/Applications/AppVectorUtils/app/otbOSMDownloader.cxx +++ b/Modules/Applications/AppVectorUtils/app/otbOSMDownloader.cxx @@ -58,7 +58,9 @@ private: SetDocAuthors("OTB-Team"); SetDocSeeAlso("Conversion"); + AddDocTag("Miscellaneous"); AddDocTag(Tags::Meta); + AddDocTag(Tags::Vector); AddParameter(ParameterType_OutputVectorData, "out", "Output vector data"); SetParameterDescription("out", "Generated output vector data path"); diff --git a/Modules/Applications/AppVectorUtils/app/otbVectorDataExtractROI.cxx b/Modules/Applications/AppVectorUtils/app/otbVectorDataExtractROI.cxx index 95e1ef3968fa18f09215ef0b1dccc9512d050627..44676f632befdd0bc4a43caef90fabac916f654a 100644 --- a/Modules/Applications/AppVectorUtils/app/otbVectorDataExtractROI.cxx +++ b/Modules/Applications/AppVectorUtils/app/otbVectorDataExtractROI.cxx @@ -77,6 +77,7 @@ private: SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); + AddDocTag(Tags::Vector); AddDocTag(Tags::Vector); AddParameter(ParameterType_Group,"io","Input and output data"); diff --git a/Modules/Filtering/Wavelet/include/otbWaveletFilterBank.txx b/Modules/Filtering/Wavelet/include/otbWaveletFilterBank.txx index 7753842f4bc8ed7eaa45035ed706543d8dee0f6c..b03e0fbb8b1eb3765edf96581489f18be4693dd6 100644 --- a/Modules/Filtering/Wavelet/include/otbWaveletFilterBank.txx +++ b/Modules/Filtering/Wavelet/include/otbWaveletFilterBank.txx @@ -1178,6 +1178,7 @@ WaveletFilterBank<TInputImage, TOutputImage, TWaveletOperator, Wavelet::INVERSE> typename FilterType::Pointer overSampledLowPass = FilterType::New(); overSampledLowPass->SetInput(cropedLowPass); overSampledLowPass->SetSubsampleFactor(delta); + overSampledLowPass->SetNumberOfThreads(1); overSampledLowPass->Update(); InputImagePointerType cropedHighPass = InputImageType::New(); @@ -1196,6 +1197,7 @@ WaveletFilterBank<TInputImage, TOutputImage, TWaveletOperator, Wavelet::INVERSE> typename FilterType::Pointer overSampledHighPass = FilterType::New(); overSampledHighPass->SetInput(cropedHighPass); overSampledHighPass->SetSubsampleFactor(delta); + overSampledHighPass->SetNumberOfThreads(1); overSampledHighPass->Update(); InnerProductType innerProduct; diff --git a/Modules/Learning/Supervised/include/otbImageClassificationFilter.txx b/Modules/Learning/Supervised/include/otbImageClassificationFilter.txx index eb9e9b67bde62baa2f027ce1aa772504e35e8bb3..54656b1948811c9685eaa01d729bc706ab15e98b 100644 --- a/Modules/Learning/Supervised/include/otbImageClassificationFilter.txx +++ b/Modules/Learning/Supervised/include/otbImageClassificationFilter.txx @@ -260,8 +260,7 @@ ImageClassificationFilter<TInputImage, TOutputImage, TMaskImage> typename TargetListSampleType::ConstIterator labIt = labels->Begin(); maskIt.GoToBegin(); - for (outIt.GoToBegin(); labIt!=labels->End() && !outIt.IsAtEnd(); - ++outIt) + for (outIt.GoToBegin(); !outIt.IsAtEnd(); ++outIt) { double confidenceIndex = 0.0; TargetValueType labelValue(m_DefaultLabel); @@ -270,7 +269,7 @@ ImageClassificationFilter<TInputImage, TOutputImage, TMaskImage> validPoint = maskIt.Get() > 0; ++maskIt; } - if (validPoint) + if (validPoint && labIt!=labels->End()) { labelValue = labIt.GetMeasurementVector()[0]; diff --git a/Modules/Remote/otbFFSforGMM.remote.cmake b/Modules/Remote/otbFFSforGMM.remote.cmake index 74c3752db8fd365fc23b06b388e9da57a7672aaf..b7ae4ee086c7bdb040faabc2c4b4c5baa381631b 100644 --- a/Modules/Remote/otbFFSforGMM.remote.cmake +++ b/Modules/Remote/otbFFSforGMM.remote.cmake @@ -1,5 +1,5 @@ #Contact: Adrien Lagrange <adrien.lagrange@irit.fr> -otb_fetch_module(OTBFastFeaturesSelection +otb_fetch_module(OTBFFSforGMM "This module implements a method to perform a fast forward feature selection using a Gaussian Mixture Model. A more detailed description can be found on the project website: https://github.com/Laadr/otbFFSforGMM diff --git a/Modules/ThirdParty/GDAL/otb-module-init.cmake b/Modules/ThirdParty/GDAL/otb-module-init.cmake index ff2992ea9b326868652de6e74d20723007a2973d..be7cfb790f2142caec54ebbf94af3bc3490fe11f 100644 --- a/Modules/ThirdParty/GDAL/otb-module-init.cmake +++ b/Modules/ThirdParty/GDAL/otb-module-init.cmake @@ -8,7 +8,7 @@ if(NOT GDAL_FOUND) endif() #Check if GDAL is compatible with OTB using a bunch of cmake try_run and try_compile. (Default value is ON.) -set(GDAL_CONFIG_CHECKING ON CACHE BOOL "Tests to check gdal config." FORCE) +set(GDAL_CONFIG_CHECKING ON CACHE BOOL "Tests to check gdal config.") mark_as_advanced(GDAL_CONFIG_CHECKING) if(NOT GDAL_CONFIG_CHECKING) @@ -23,6 +23,13 @@ if(NOT EXISTS ${TEMP}) FILE(MAKE_DIRECTORY ${TEMP}) endif() +set(GDAL_CONFIG_CHECKING OFF CACHE BOOL "Tests to check gdal config." FORCE) + +macro(error_message m) + message("Setting GDAL_CONFIG_CHECKING to ON. (all GDAL tests will run again)") + set(GDAL_CONFIG_CHECKING ON CACHE BOOL "Tests to check gdal config." FORCE) + message(FATAL_ERROR "${m}") +endmacro(error_message) #------------------- Helper Macro --------------------- macro(gdal_try_run msg_type var source_file) @@ -37,7 +44,7 @@ ARGS ${ARGN} ) if(NOT COMPILE_${var}) - message(FATAL_ERROR "Compiling Test ${var} - Failed \n + error_message("Compiling Test ${var} - Failed \n COMPILE_OUTPUT_${var}: '${COMPILE_OUTPUT_${var}}'") endif() if(RUN_${var}) @@ -47,7 +54,7 @@ if(RUN_${var}) if("${msg_type}" STREQUAL "STATUS") message(${msg_type} "Performing Test ${var} - Failed") else() - message(${msg_type} "Performing Test ${var} - Failed \n + error_message("Performing Test ${var} - Failed \n Exit status: '${RUN_${var}}' \n RUN_OUTPUT_${var}: '${RUN_OUTPUT_${var}}'") endif() @@ -75,7 +82,7 @@ if(EXISTS "${TEMP}/gdalVersion.txt") endif() set(GDAL_VERSION_STRING "${_GDAL_VERSION_STRING}" CACHE INTERNAL "" FORCE) else() - message(FATAL_ERROR "${TEMP}/gdalVersion.txt does not exist. Cannot continue.") + error_message( "${TEMP}/gdalVersion.txt does not exist. Cannot continue.") endif() #check OGR @@ -86,7 +93,7 @@ CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-w" "-DLINK_LIBRAR OUTPUT_VARIABLE COMPILE_OUTPUT_GDAL_HAS_OGR ) if(NOT COMPILE_GDAL_HAS_OGR) - message(FATAL_ERROR "Performing Test COMPILE_GDAL_HAS_OGR - Failed\n COMPILE_OUTPUT:${COMPILE_OUTPUT_GDAL_HAS_OGR}\n") + error_message("Performing Test COMPILE_GDAL_HAS_OGR - Failed\n COMPILE_OUTPUT:${COMPILE_OUTPUT_GDAL_HAS_OGR}\n") else() message(STATUS "Performing Test COMPILE_GDAL_HAS_OGR - Success") endif() diff --git a/Modules/ThirdParty/MuParserX/CMakeLists.txt b/Modules/ThirdParty/MuParserX/CMakeLists.txt index 7aa22a8c87a76e9ccf440a7fbf260f1fb17cba2f..1d7891da04fe06837ee5244e74c049c08acbce31 100644 --- a/Modules/ThirdParty/MuParserX/CMakeLists.txt +++ b/Modules/ThirdParty/MuParserX/CMakeLists.txt @@ -2,13 +2,5 @@ project(OTBMuParserX) set(OTBMuParserX_SYSTEM_INCLUDE_DIRS ${MUPARSERX_INCLUDE_DIRS}) set(OTBMuParserX_LIBRARIES "${MUPARSERX_LIBRARIES}") -set(OTBMuParserX_INCLUDE_DIRS ${OTBMuParserX_BINARY_DIR}/src) - -configure_file( src/mpCompat.h.in src/mpCompat.h ) otb_module_impl() - -install(FILES ${OTBMuParserX_BINARY_DIR}/src/mpCompat.h - DESTINATION ${OTBMuParserX_INSTALL_INCLUDE_DIR} - COMPONENT Development - ) diff --git a/Modules/ThirdParty/MuParserX/otb-module.cmake b/Modules/ThirdParty/MuParserX/otb-module.cmake index b44f57f995243ee642873079101e53a59f06bddb..46b52ad5c2c685e82927b9f21ce7076acfc7dcb1 100644 --- a/Modules/ThirdParty/MuParserX/otb-module.cmake +++ b/Modules/ThirdParty/MuParserX/otb-module.cmake @@ -10,3 +10,5 @@ otb_module(OTBMuParserX ) otb_module_activation_option("Enable MuParserX dependent modules" OFF) + +otb_module_requires_cxx11() diff --git a/Modules/ThirdParty/MuParserX/src/mpCompat.h.in b/Modules/ThirdParty/MuParserX/src/mpCompat.h.in deleted file mode 100644 index 7ac031c6b821a0719bb681b53a384d42a56daaeb..0000000000000000000000000000000000000000 --- a/Modules/ThirdParty/MuParserX/src/mpCompat.h.in +++ /dev/null @@ -1,46 +0,0 @@ -/*========================================================================= - - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. - - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. - -=========================================================================*/ -#ifndef MUP_COMPAT_H -#define MUP_COMPAT_H - -/* defined if OTB_CXX_HAS_UNIQUE_PTR cmake check is OK. */ -/* See CMake/OTBCheckCpp11Keywords.cmake for more details */ -#cmakedefine OTB_CXX_HAS_UNIQUE_PTR - -#ifndef OTB_CXX_HAS_UNIQUE_PTR -#define unique_ptr auto_ptr -#endif - -/* defined if OTB_CXX_HAS_OVERRIDE_SPECIFIER cmake check is OK. */ -/* See CMake/OTBCheckCpp11Keywords.cmake for more details */ -#cmakedefine OTB_CXX_HAS_OVERRIDE_SPECIFIER - -#ifndef OTB_CXX_HAS_OVERRIDE_SPECIFIER -#define override -#endif - -/* defined if OTB_CXX_HAS_NULLPTR cmake check is OK. */ -/* See CMake/OTBCheckCpp11Keywords.cmake for more details */ -#cmakedefine OTB_CXX_HAS_NULLPTR - -#ifndef OTB_CXX_HAS_NULLPTR -#define nullptr NULL -#endif - - -#endif //MUP_COMPAT_H diff --git a/Modules/ThirdParty/OssimPlugins/test/CMakeLists.txt b/Modules/ThirdParty/OssimPlugins/test/CMakeLists.txt index f56748017eee2013f22f64970274d01f668be413..a1e1cf79974dad455c07c9c0da70a68479174035 100644 --- a/Modules/ThirdParty/OssimPlugins/test/CMakeLists.txt +++ b/Modules/ThirdParty/OssimPlugins/test/CMakeLists.txt @@ -7,21 +7,21 @@ otb_module_test() if (Boost_UNIT_TEST_FRAMEWORK_FOUND) #this test is failing on osx due to a bug in AppleClang stdc++ (Luc Hermitte) if(NOT APPLE) - add_executable(ossimStringUtilitiesTest ossimStringUtilitiesTest.cpp) - target_link_libraries(ossimStringUtilitiesTest + add_executable(OTBossimStringUtilitiesTest ossimStringUtilitiesTest.cpp) + target_link_libraries(OTBossimStringUtilitiesTest otbossimplugins ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) - otb_module_target_label(ossimStringUtilitiesTest) - otb_add_test(NAME ossimStringUtilitiesTest COMMAND ossimStringUtilitiesTest ) + otb_module_target_label(OTBossimStringUtilitiesTest) + otb_add_test(NAME TuossimStringUtilitiesTest COMMAND OTBossimStringUtilitiesTest ) endif() - add_executable(ossimTimeUtilitiesTest ossimTimeUtilitiesTest.cpp) - target_link_libraries(ossimTimeUtilitiesTest + add_executable(OTBossimTimeUtilitiesTest ossimTimeUtilitiesTest.cpp) + target_link_libraries(OTBossimTimeUtilitiesTest # ${OTBOssim_LIBRARIES} otbossimplugins ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) - otb_module_target_label(ossimTimeUtilitiesTest) - otb_add_test(NAME ossimTimeUtilitiesTest COMMAND ossimTimeUtilitiesTest ) + otb_module_target_label(OTBossimTimeUtilitiesTest) + otb_add_test(NAME TuossimTimeUtilitiesTest COMMAND OTBossimTimeUtilitiesTest ) else() message(STATUS "Boost unit test framework not found, ossimStringUtilitiesTest and ossimTimeUtilitiesTest will be skipped.") endif() @@ -30,42 +30,42 @@ endif() # (requires google.benchmark) find_package(GBenchmark) if (GBENCHMARK_FOUND) - add_executable(ossimTimeUtilitiesBench ossimTimeUtilitiesBench.cpp) - include_directories(${GBENCHMARK_INCLUDE_DIRS}) - target_link_libraries(ossimTimeUtilitiesBench - otbossimplugins - ${GBENCHMARK_LIBRARIES}) - otb_module_target_label(ossimTimeUtilitiesBench) -else() - message(STATUS "Google.benchmark not found, ossimTimeUtilitiesBench will be skipped.") + add_executable(OTBossimTimeUtilitiesBench ossimTimeUtilitiesBench.cpp) + include_directories(${GBENCHMARK_INCLUDE_DIRS}) + target_link_libraries(OTBossimTimeUtilitiesBench + otbossimplugins + ${GBENCHMARK_LIBRARIES}) + otb_module_target_label(OTBossimTimeUtilitiesBench) +# else() +# Even if GBenchmark is found, test is not launched because it is not added to ctest endif() #===== Domain tests #Test executables -add_executable(ossimSarSensorModelTest ossimSarSensorModelTest.cpp) -target_link_libraries(ossimSarSensorModelTest otbossimplugins) -otb_module_target_label(ossimSarSensorModelTest) +add_executable(OTBossimSarSensorModelTest ossimSarSensorModelTest.cpp) +target_link_libraries(OTBossimSarSensorModelTest otbossimplugins) +otb_module_target_label(OTBossimSarSensorModelTest) # S1 -add_executable(ossimSentinel1ModelTest ossimSentinel1ModelTest.cpp) -target_link_libraries(ossimSentinel1ModelTest otbossimplugins) -otb_module_target_label(ossimSentinel1ModelTest) +add_executable(OTBossimSentinel1ModelTest ossimSentinel1ModelTest.cpp) +target_link_libraries(OTBossimSentinel1ModelTest otbossimplugins) +otb_module_target_label(OTBossimSentinel1ModelTest) # TSX (old) -add_executable(ossimTerraSarXSarSensorModelTest ossimTerraSarXSarSensorModelTest.cpp) -target_link_libraries(ossimTerraSarXSarSensorModelTest otbossimplugins) -otb_module_target_label(ossimTerraSarXSarSensorModelTest) +add_executable(OTBossimTerraSarXSarSensorModelTest ossimTerraSarXSarSensorModelTest.cpp) +target_link_libraries(OTBossimTerraSarXSarSensorModelTest otbossimplugins) +otb_module_target_label(OTBossimTerraSarXSarSensorModelTest) -otb_add_test(NAME ossimSarSensorModelTest COMMAND ossimSarSensorModelTest ) +otb_add_test(NAME TuossimSarSensorModelTest COMMAND OTBossimSarSensorModelTest ) #S1 tests file(GLOB s1_files ${INPUTDATA}/ossimPlugins/s1/*.xml) #Loop over all S1 annotation files foreach(entry ${s1_files}) get_filename_component(name ${entry} NAME_WE) - otb_add_test( NAME s1_inverse_${name} COMMAND ossimSentinel1ModelTest 1 ${entry}) - otb_add_test( NAME s1_forward_${name} COMMAND ossimSentinel1ModelTest 0 ${entry}) + otb_add_test( NAME s1_inverse_${name} COMMAND OTBossimSentinel1ModelTest 1 ${entry}) + otb_add_test( NAME s1_forward_${name} COMMAND OTBossimSentinel1ModelTest 0 ${entry}) endforeach() # #TSX tests diff --git a/Modules/Visualization/Ice/include/otbStandardShader.h b/Modules/Visualization/Ice/include/otbStandardShader.h index 6077c36ee8de2f4c9a3558c83e136be9e3ccbb8a..e5755b592f80398021fb6e353d544b4aed45d7e1 100644 --- a/Modules/Visualization/Ice/include/otbStandardShader.h +++ b/Modules/Visualization/Ice/include/otbStandardShader.h @@ -33,7 +33,17 @@ typedef enum SHADER_ALPHA_GRID, SHADER_ALPHA_SLIDER, SHADER_SPECTRAL_ANGLE, - SHADER_GRADIENT + SHADER_GRADIENT, + SHADER_LUT_JET, + SHADER_LUT_LOCAL_JET, + SHADER_LUT_HOT, + SHADER_LUT_LOCAL_HOT, + SHADER_LUT_WINTER, + SHADER_LUT_LOCAL_WINTER, + SHADER_LUT_SUMMER, + SHADER_LUT_LOCAL_SUMMER, + SHADER_LUT_COOL, + SHADER_LUT_LOCAL_COOL } ShaderType; diff --git a/Modules/Visualization/Ice/src/otbStandardShader.cxx b/Modules/Visualization/Ice/src/otbStandardShader.cxx index 66e4817f56f9e2bbb84c897e298f5cfcf6aa73b1..6fd2676d02b318b2c664a0995708c38ca59af9b7 100644 --- a/Modules/Visualization/Ice/src/otbStandardShader.cxx +++ b/Modules/Visualization/Ice/src/otbStandardShader.cxx @@ -85,7 +85,8 @@ std::string StandardShader::GetSource() const "uniform int shader_vertical_slider_flag;\n" \ "void main (void) {\n" \ "vec4 p = texture2D(src, gl_TexCoord[0].xy);\n" \ - "gl_FragColor = pow( clamp( ( p+shader_b ) * shader_a, 0.0, 1.0 ), shader_gamma );\n" \ + "vec4 colors = pow( clamp( ( p+shader_b ) * shader_a, 0.0, 1.0 ), shader_gamma );\n" \ + "gl_FragColor = colors;\n" \ "gl_FragColor[3] = clamp(shader_alpha,0.0,1.0);\n" \ "if(shader_use_no_data > 0 && vec3(p) == vec3(shader_no_data)){\n" \ "gl_FragColor[3] = 0.;\n" \ @@ -128,6 +129,141 @@ std::string StandardShader::GetSource() const "gl_FragColor[2] = tmp[2];\n" \ "gl_FragColor[3] = alpha;\n" \ "}\n" \ + "}\n" \ + "else if(shader_type == 7)\n" \ + "{\n" \ + "float color = colors[0];\n" \ + "vec3 mapped;\n" \ + "mapped[0] = -abs( 3.95 * (color - 0.7460)) + 1.5;\n" \ + "mapped[1] = -abs( 3.95 * (color - 0.492)) + 1.5;\n" \ + "mapped[2] = -abs( 3.95 * (color - 0.2385)) + 1.5;\n" \ + "mapped = clamp(mapped,0.0,1.0);\n" \ + "gl_FragColor[0] = mapped[0];\n" \ + "gl_FragColor[1] = mapped[1];\n" \ + "gl_FragColor[2] = mapped[2];\n" \ + "}\n" \ + "else if(shader_type == 8)\n" \ + "{\n" \ + "if(dist < shader_radius)\n" \ + "{\n" \ + "float color=clamp((p[0]-shader_current[0]+shader_localc_range)/(2.*shader_localc_range),0.0,1.0);\n" \ + "vec3 mapped;\n" \ + "mapped[0] = -abs( 3.95 * (color - 0.7460)) + 1.5;\n" \ + "mapped[1] = -abs( 3.95 * (color - 0.492)) + 1.5;\n" \ + "mapped[2] = -abs( 3.95 * (color - 0.2385)) + 1.5;\n" \ + "mapped = clamp(mapped,0.0,1.0);\n" \ + "gl_FragColor[0] = mapped[0];\n" \ + "gl_FragColor[1] = mapped[1];\n" \ + "gl_FragColor[2] = mapped[2];\n" \ + "}\n" \ + "}\n" \ + "else if(shader_type == 9)\n" \ + "{\n" \ + "float color = colors[0];\n" \ + "vec3 mapped;\n" \ + "mapped[0] = 63.0 / 26.0 * color - 1.0 / 13.0;\n" \ + "mapped[1] = 63.0 / 26.0 * color - 11.0 / 13.0;\n" \ + "mapped[2] = 4.5 * color - 3.5;\n" \ + "mapped = clamp(mapped,0.0,1.0);\n" \ + "gl_FragColor[0] = mapped[0];\n" \ + "gl_FragColor[1] = mapped[1];\n" \ + "gl_FragColor[2] = mapped[2];\n" \ + "}\n" \ + "else if(shader_type == 10)\n" \ + "{\n" \ + "if(dist < shader_radius)\n" \ + "{\n" \ + "float color=clamp((p[0]-shader_current[0]+shader_localc_range)/(2.*shader_localc_range),0.0,1.0);\n" \ + "vec3 mapped;\n" \ + "mapped[0] = 63.0 / 26.0 * color - 1.0 / 13.0;\n" \ + "mapped[1] = 63.0 / 26.0 * color - 11.0 / 13.0;\n" \ + "mapped[2] = 4.5 * color - 3.5;\n" \ + "mapped = clamp(mapped,0.0,1.0);\n" \ + "gl_FragColor[0] = mapped[0];\n" \ + "gl_FragColor[1] = mapped[1];\n" \ + "gl_FragColor[2] = mapped[2];\n" \ + "}\n" \ + "}\n" \ + "else if(shader_type == 11)\n" \ + "{\n" \ + "float color = colors[0];\n" \ + "vec3 mapped;\n" \ + "mapped[0] = 0.0;\n" \ + "mapped[1] = color;\n" \ + "mapped[2] = 1.0 - 0.5 * color;\n" \ + "mapped = clamp(mapped,0.0,1.0);\n" \ + "gl_FragColor[0] = mapped[0];\n" \ + "gl_FragColor[1] = mapped[1];\n" \ + "gl_FragColor[2] = mapped[2];\n" \ + "}\n" \ + "else if(shader_type == 12)\n" \ + "{\n" \ + "if(dist < shader_radius)\n" \ + "{\n" \ + "float color=clamp((p[0]-shader_current[0]+shader_localc_range)/(2.*shader_localc_range),0.0,1.0);\n" \ + "vec3 mapped;\n" \ + "mapped[0] = 0.0;\n" \ + "mapped[1] = color;\n" \ + "mapped[2] = 1.0 - 0.5 * color;\n" \ + "mapped = clamp(mapped,0.0,1.0);\n" \ + "gl_FragColor[0] = mapped[0];\n" \ + "gl_FragColor[1] = mapped[1];\n" \ + "gl_FragColor[2] = mapped[2];\n" \ + "}\n" \ + "}\n" \ + "else if(shader_type == 13)\n" \ + "{\n" \ + "float color = colors[0];\n" \ + "vec3 mapped;\n" \ + "mapped[0] = color;\n" \ + "mapped[1] = 0.5*color+0.5;\n" \ + "mapped[2] = 0.4;\n" \ + "mapped = clamp(mapped,0.0,1.0);\n" \ + "gl_FragColor[0] = mapped[0];\n" \ + "gl_FragColor[1] = mapped[1];\n" \ + "gl_FragColor[2] = mapped[2];\n" \ + "}\n" \ + "else if(shader_type == 14)\n" \ + "{\n" \ + "if(dist < shader_radius)\n" \ + "{\n" \ + "float color=clamp((p[0]-shader_current[0]+shader_localc_range)/(2.*shader_localc_range),0.0,1.0);\n" \ + "vec3 mapped;\n" \ + "mapped[0] = color;\n" \ + "mapped[1] = 0.5*color+0.5;\n" \ + "mapped[2] = 0.4;\n" \ + "mapped = clamp(mapped,0.0,1.0);\n" \ + "gl_FragColor[0] = mapped[0];\n" \ + "gl_FragColor[1] = mapped[1];\n" \ + "gl_FragColor[2] = mapped[2];\n" \ + "}\n" \ + "}\n" \ + "else if(shader_type == 15)\n" \ + "{\n" \ + "float color = colors[0];\n" \ + "vec3 mapped;\n" \ + "mapped[0] = color;\n" \ + "mapped[1] = 1.0-color;\n" \ + "mapped[2] = 1.0;\n" \ + "mapped = clamp(mapped,0.0,1.0);\n" \ + "gl_FragColor[0] = mapped[0];\n" \ + "gl_FragColor[1] = mapped[1];\n" \ + "gl_FragColor[2] = mapped[2];\n" \ + "}\n" \ + "else if(shader_type == 16)\n" \ + "{\n" \ + "if(dist < shader_radius)\n" \ + "{\n" \ + "float color=clamp((p[0]-shader_current[0]+shader_localc_range)/(2.*shader_localc_range),0.0,1.0);\n" \ + "vec3 mapped;\n" \ + "mapped[0] = color;\n" \ + "mapped[1] = 1.0-color;\n" \ + "mapped[2] = 1.0;\n" \ + "mapped = clamp(mapped,0.0,1.0);\n" \ + "gl_FragColor[0] = mapped[0];\n" \ + "gl_FragColor[1] = mapped[1];\n" \ + "gl_FragColor[2] = mapped[2];\n" \ + "}\n" \ "}\n"; if(isGLSLS140Available) diff --git a/Modules/Visualization/IceViewer/src/otbIceViewer.cxx b/Modules/Visualization/IceViewer/src/otbIceViewer.cxx index 873317ba10f0aba1a464955502ffe20f7f22daed..bfc39e6d5574a95374fd61f32c31a8736add1fec 100644 --- a/Modules/Visualization/IceViewer/src/otbIceViewer.cxx +++ b/Modules/Visualization/IceViewer/src/otbIceViewer.cxx @@ -468,6 +468,36 @@ void IceViewer::DrawHud() case SHADER_GRADIENT: oss<<" gradient"; break; + case SHADER_LUT_JET: + oss<<"Jet LUT"<<std::endl; + break; + case SHADER_LUT_LOCAL_JET: + oss<<"Local Jet LUT"<<std::endl; + break; + case SHADER_LUT_HOT: + oss<<"Hot LUT"<<std::endl; + break; + case SHADER_LUT_LOCAL_HOT: + oss<<"Local Hot LUT"<<std::endl; + break; + case SHADER_LUT_WINTER: + oss<<"Winter LUT"<<std::endl; + break; + case SHADER_LUT_LOCAL_WINTER: + oss<<"Local Winter LUT"<<std::endl; + break; + case SHADER_LUT_SUMMER: + oss<<"Summer LUT"<<std::endl; + break; + case SHADER_LUT_LOCAL_SUMMER: + oss<<"Local Summer LUT"<<std::endl; + break; + case SHADER_LUT_COOL: + oss<<"Cool LUT"<<std::endl; + break; + case SHADER_LUT_LOCAL_COOL: + oss<<"Local Cool LUT"<<std::endl; + break; } } diff --git a/Modules/Visualization/Monteverdi/src/mvdMainWindow.cxx b/Modules/Visualization/Monteverdi/src/mvdMainWindow.cxx index 56bdd63d89d06cc464745b2215315cb36f8dd3d7..db0d976419d438eff52100102157c4611d75a0c6 100644 --- a/Modules/Visualization/Monteverdi/src/mvdMainWindow.cxx +++ b/Modules/Visualization/Monteverdi/src/mvdMainWindow.cxx @@ -542,7 +542,16 @@ MainWindow quicklookView, SLOT( OnApplyAllRequested() ) ); + + QObject::connect( + controller, + SIGNAL( ResetEffectsRequested() ), + // to: + m_ImageView, + SLOT( OnResetEffectsRequested() ) + ); } + } /*****************************************************************************/ diff --git a/Modules/Visualization/MonteverdiCore/include/mvdCore.h b/Modules/Visualization/MonteverdiCore/include/mvdCore.h index d0e2582253a3d5d754d5d6feb6c456b716043e10..29561da2fbf742101692057d3028c99fdf9805b6 100644 --- a/Modules/Visualization/MonteverdiCore/include/mvdCore.h +++ b/Modules/Visualization/MonteverdiCore/include/mvdCore.h @@ -130,9 +130,19 @@ enum Effect EFFECT_LOCAL_CONTRAST, EFFECT_LOCAL_TRANSLUCENCY, EFFECT_NORMAL, - EFFECT_SPECTRAL_ANGLE, EFFECT_SWIPE_H, EFFECT_SWIPE_V, + EFFECT_SPECTRAL_ANGLE, + EFFECT_LUT_JET, + EFFECT_LUT_LOCAL_JET, + EFFECT_LUT_HOT, + EFFECT_LUT_LOCAL_HOT, + EFFECT_LUT_WINTER, + EFFECT_LUT_LOCAL_WINTER, + EFFECT_LUT_SUMMER, + EFFECT_LUT_LOCAL_SUMMER, + EFFECT_LUT_COOL, + EFFECT_LUT_LOCAL_COOL, // EFFECT_COUNT }; diff --git a/Modules/Visualization/MonteverdiCore/include/mvdImageSettings.h b/Modules/Visualization/MonteverdiCore/include/mvdImageSettings.h index 1281624b976d166bd117d1fc06ff69dae4a9fb6f..4323187fec5cf4e99d7e978d78dadda1dc8accf4 100644 --- a/Modules/Visualization/MonteverdiCore/include/mvdImageSettings.h +++ b/Modules/Visualization/MonteverdiCore/include/mvdImageSettings.h @@ -347,7 +347,12 @@ ImageSettings m_Effect==EFFECT_GRADIENT || m_Effect==EFFECT_LOCAL_CONTRAST || m_Effect==EFFECT_LOCAL_TRANSLUCENCY || - m_Effect==EFFECT_SPECTRAL_ANGLE; + m_Effect==EFFECT_SPECTRAL_ANGLE || + m_Effect==EFFECT_LUT_LOCAL_JET || + m_Effect==EFFECT_LUT_LOCAL_HOT || + m_Effect==EFFECT_LUT_LOCAL_WINTER || + m_Effect==EFFECT_LUT_LOCAL_SUMMER || + m_Effect==EFFECT_LUT_LOCAL_COOL; } /*****************************************************************************/ @@ -358,7 +363,12 @@ ImageSettings { return m_Effect==EFFECT_LOCAL_CONTRAST || - m_Effect==EFFECT_SPECTRAL_ANGLE; + m_Effect==EFFECT_SPECTRAL_ANGLE || + m_Effect==EFFECT_LUT_LOCAL_JET || + m_Effect==EFFECT_LUT_LOCAL_HOT || + m_Effect==EFFECT_LUT_LOCAL_WINTER || + m_Effect==EFFECT_LUT_LOCAL_SUMMER || + m_Effect==EFFECT_LUT_LOCAL_COOL; } /*****************************************************************************/ diff --git a/Modules/Visualization/MonteverdiCore/include/mvdVectorImageSettings.h b/Modules/Visualization/MonteverdiCore/include/mvdVectorImageSettings.h index 8532f8a5705912ea2a9f70fbd52d65a630cd4753..478636b67fd5d2b86d8281d3a3bf5c010b26e404 100644 --- a/Modules/Visualization/MonteverdiCore/include/mvdVectorImageSettings.h +++ b/Modules/Visualization/MonteverdiCore/include/mvdVectorImageSettings.h @@ -550,6 +550,18 @@ VectorImageSettings { m_IsGrayscaleActivated = activated; + Effect effect = GetEffect(); + + if(activated + && effect == EFFECT_SPECTRAL_ANGLE) + { + SetEffect(EFFECT_NORMAL); + } + else if(!activated && effect >= EFFECT_LUT_LOCAL_JET) + { + SetEffect(EFFECT_NORMAL); + } + SetModified(); } diff --git a/Modules/Visualization/MonteverdiCore/src/mvdCore.cxx b/Modules/Visualization/MonteverdiCore/src/mvdCore.cxx index 041429170c1297f0019b4f6b9ac7053ef5239143..4995497710d75655340e4877e14c59dd9a53a745 100644 --- a/Modules/Visualization/MonteverdiCore/src/mvdCore.cxx +++ b/Modules/Visualization/MonteverdiCore/src/mvdCore.cxx @@ -87,9 +87,19 @@ EFFECT_NAMES[ EFFECT_COUNT ] = QT_TRANSLATE_NOOP( "mvd", "Local contrast" ), QT_TRANSLATE_NOOP( "mvd", "Local translucency" ), QT_TRANSLATE_NOOP( "mvd", "Normal" ), - QT_TRANSLATE_NOOP( "mvd", "Spectral angle" ), QT_TRANSLATE_NOOP( "mvd", "Swipe (horizontal)" ), QT_TRANSLATE_NOOP( "mvd", "Swipe (vertical)" ), + QT_TRANSLATE_NOOP( "mvd", "Spectral angle" ), + QT_TRANSLATE_NOOP( "mvd", "Lookup table (jet)" ), + QT_TRANSLATE_NOOP( "mvd", "Local lookup table (jet)" ), + QT_TRANSLATE_NOOP( "mvd", "Lookup table (hot)" ), + QT_TRANSLATE_NOOP( "mvd", "Local lookup table (hot)" ), + QT_TRANSLATE_NOOP( "mvd", "Lookup table (winter)" ), + QT_TRANSLATE_NOOP( "mvd", "Local lookup table (winter)" ), + QT_TRANSLATE_NOOP( "mvd", "Lookup table (summer)" ), + QT_TRANSLATE_NOOP( "mvd", "Local lookup table (summer)" ), + QT_TRANSLATE_NOOP( "mvd", "Lookup table (cool)" ), + QT_TRANSLATE_NOOP( "mvd", "Local lookup table (cool)" ) }; bool diff --git a/Modules/Visualization/MonteverdiCore/src/mvdImageSettings.cxx b/Modules/Visualization/MonteverdiCore/src/mvdImageSettings.cxx index cc8253438f1a636842be6161357a886d1c5bcc94..3fef0af1eb9bf3bf903f9492b722483132e799c4 100644 --- a/Modules/Visualization/MonteverdiCore/src/mvdImageSettings.cxx +++ b/Modules/Visualization/MonteverdiCore/src/mvdImageSettings.cxx @@ -130,6 +130,31 @@ ImageSettings return m_Angle; break; + case EFFECT_LUT_LOCAL_JET: + // qDebug() << "Range:" << m_Range; + return m_Range; + break; + + case EFFECT_LUT_LOCAL_HOT: + // qDebug() << "Range:" << m_Range; + return m_Range; + break; + + case EFFECT_LUT_LOCAL_WINTER: + // qDebug() << "Range:" << m_Range; + return m_Range; + break; + + case EFFECT_LUT_LOCAL_SUMMER: + // qDebug() << "Range:" << m_Range; + return m_Range; + break; + + case EFFECT_LUT_LOCAL_COOL: + // qDebug() << "Range:" << m_Range; + return m_Range; + break; + default: break; } @@ -154,6 +179,31 @@ ImageSettings m_Angle = value; break; + case EFFECT_LUT_LOCAL_JET: + // qDebug() << "Range = " << value; + m_Range = value; + break; + + case EFFECT_LUT_LOCAL_HOT: + // qDebug() << "Range = " << value; + m_Range = value; + break; + + case EFFECT_LUT_LOCAL_WINTER: + // qDebug() << "Range = " << value; + m_Range = value; + break; + + case EFFECT_LUT_LOCAL_SUMMER: + // qDebug() << "Range = " << value; + m_Range = value; + break; + + case EFFECT_LUT_LOCAL_COOL: + // qDebug() << "Range = " << value; + m_Range = value; + break; + default: break; } diff --git a/Modules/Visualization/MonteverdiCore/src/mvdStackedLayerModel.cxx b/Modules/Visualization/MonteverdiCore/src/mvdStackedLayerModel.cxx index 95dd12f7068a7bd3fae173f1cbbd84976780ff2d..7118fb34023ae2c973933a4e3e3d0702fa9e8a29 100644 --- a/Modules/Visualization/MonteverdiCore/src/mvdStackedLayerModel.cxx +++ b/Modules/Visualization/MonteverdiCore/src/mvdStackedLayerModel.cxx @@ -41,6 +41,8 @@ // Monteverdi includes (sorted by alphabetic order) #include "mvdAbstractLayerModel.h" #include "mvdAlgorithm.h" +#include "mvdVectorImageModel.h" +#include "mvdCore.h" namespace mvd { diff --git a/Modules/Visualization/MonteverdiGui/include/mvdImageViewWidget.h b/Modules/Visualization/MonteverdiGui/include/mvdImageViewWidget.h index add78b1cda507501b4a1eea6a4a5f33dfe63e2fb..61c4022c36bbdf6ee97e2c9239286c48f0fe03ef 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdImageViewWidget.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdImageViewWidget.h @@ -410,6 +410,7 @@ private slots: /** */ void OnApplyAllRequested(); + void OnResetEffectsRequested(); /** */ void OnSetReferenceRequested(); diff --git a/Modules/Visualization/MonteverdiGui/include/mvdLayerStackController.h b/Modules/Visualization/MonteverdiGui/include/mvdLayerStackController.h index 24b0cf5a7791a36fc0ad1ab25e1fc7dd47b5df57..e9dcfb77447eacfeeddec53335321351f13519c9 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdLayerStackController.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdLayerStackController.h @@ -107,6 +107,7 @@ signals: /** */ void ApplyAllRequested(); + void ResetEffectsRequested(); /*-[ PROTECTED SECTION ]---------------------------------------------------*/ diff --git a/Modules/Visualization/MonteverdiGui/include/mvdLayerStackWidget.h b/Modules/Visualization/MonteverdiGui/include/mvdLayerStackWidget.h index ae0a08d1ecc2f1c519e2c8030b74564e07e2bb85..b38e962d5f4f259525c0888a50821c9d115954af 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdLayerStackWidget.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdLayerStackWidget.h @@ -131,6 +131,8 @@ public: */ void SetReloadEnabled( bool ); + void SetResetEffectsEnabled( bool ); + /** */ void InstallEventFilter( QObject * filter ); @@ -188,6 +190,9 @@ signals: /** */ void ApplyButtonClicked(); + /** + */ + void ResetEffectsButtonClicked(); /** */ void CopyLayerRequested( const AbstractLayerModel * ); diff --git a/Modules/Visualization/MonteverdiGui/include/mvdShaderWidget.h b/Modules/Visualization/MonteverdiGui/include/mvdShaderWidget.h index 640131d74f778634e382588aca138f7e91f9d1ef..aae6425508f82d3e0fb2e709c22264bc0f779f0d 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdShaderWidget.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdShaderWidget.h @@ -23,7 +23,7 @@ // Configuration include. //// Included at first position before any other ones. #include "ConfigureMonteverdi.h" - +#include "mvdImageSettings.h" /*****************************************************************************/ /* INCLUDE SECTION */ @@ -114,6 +114,8 @@ public: // Public SLOTS. public slots: + void GrayscaleActivated(bool status); + /*-[ SIGNALS SECTION ]-----------------------------------------------------*/ // @@ -137,6 +139,8 @@ protected: // Private methods. private: + void SetEffectVisible(const Effect & effect, bool visible); + /** */ void virtual_SetSettings( ImageSettings * ) ITK_OVERRIDE; diff --git a/Modules/Visualization/MonteverdiGui/src/mvdIcons.qrc b/Modules/Visualization/MonteverdiGui/src/mvdIcons.qrc index 137b7dc137dbb589aca7461ded2c2b00c0b90bee..71dcbd6cc583cd95802a97770cd23af425261822 100644 --- a/Modules/Visualization/MonteverdiGui/src/mvdIcons.qrc +++ b/Modules/Visualization/MonteverdiGui/src/mvdIcons.qrc @@ -4,5 +4,6 @@ <file>../../../../Utilities/Data/Icons/locked.png</file> <file>../../../../Utilities/Data/Icons/unlocked.png</file> <file>../../../../Utilities/Data/Icons/view-refresh.png</file> + <file>../../../../Utilities/Data/Icons/edit-clear.png</file> </qresource> </RCC> diff --git a/Modules/Visualization/MonteverdiGui/src/mvdImageViewRenderer.cxx b/Modules/Visualization/MonteverdiGui/src/mvdImageViewRenderer.cxx index 76108244fcb01e4a4fac84d9c3f42f81d66623df..cc3cbf7af7187ce80886234eefd7cd4b21b5539d 100644 --- a/Modules/Visualization/MonteverdiGui/src/mvdImageViewRenderer.cxx +++ b/Modules/Visualization/MonteverdiGui/src/mvdImageViewRenderer.cxx @@ -789,6 +789,65 @@ ImageViewRenderer shader->SetVerticalSlider( true ); break; + case EFFECT_LUT_JET: + shader->SetShaderType(otb::SHADER_LUT_JET); + break; + + case EFFECT_LUT_LOCAL_JET: + shader->SetShaderType(otb::SHADER_LUT_LOCAL_JET); + shader->SetRadius( settings.GetSize() ); + shader->SetLocalContrastRange(settings.GetValue()); + + break; + + case EFFECT_LUT_HOT: + shader->SetShaderType(otb::SHADER_LUT_HOT); + break; + + case EFFECT_LUT_LOCAL_HOT: + shader->SetShaderType(otb::SHADER_LUT_LOCAL_HOT); + shader->SetRadius( settings.GetSize() ); + shader->SetLocalContrastRange(settings.GetValue()); + + break; + + case EFFECT_LUT_SUMMER: + shader->SetShaderType(otb::SHADER_LUT_SUMMER); + break; + + case EFFECT_LUT_LOCAL_SUMMER: + shader->SetShaderType(otb::SHADER_LUT_LOCAL_SUMMER); + shader->SetRadius( settings.GetSize() ); + shader->SetLocalContrastRange(settings.GetValue()); + + break; + + case EFFECT_LUT_WINTER: + shader->SetShaderType(otb::SHADER_LUT_WINTER); + break; + + case EFFECT_LUT_LOCAL_WINTER: + shader->SetShaderType(otb::SHADER_LUT_LOCAL_WINTER); + shader->SetRadius( settings.GetSize() ); + shader->SetLocalContrastRange(settings.GetValue()); + + break; + + case EFFECT_LUT_COOL: + shader->SetShaderType(otb::SHADER_LUT_COOL); + break; + + case EFFECT_LUT_LOCAL_COOL: + shader->SetShaderType(otb::SHADER_LUT_LOCAL_COOL); + shader->SetRadius( settings.GetSize() ); + shader->SetLocalContrastRange(settings.GetValue()); + + break; + + + + + default: assert( false && "Unhandled mvd::Effect value!" ); break; diff --git a/Modules/Visualization/MonteverdiGui/src/mvdImageViewWidget.cxx b/Modules/Visualization/MonteverdiGui/src/mvdImageViewWidget.cxx index 6acda526b30902f8559f7ad1215f5b9d88d81216..911ac1b8968f77256cac60fcc126ab97fab17cdd 100644 --- a/Modules/Visualization/MonteverdiGui/src/mvdImageViewWidget.cxx +++ b/Modules/Visualization/MonteverdiGui/src/mvdImageViewWidget.cxx @@ -1371,6 +1371,28 @@ ImageViewWidget } } +void ImageViewWidget +::OnResetEffectsRequested() +{ + StackedLayerModel * layerStack = m_Renderer->GetLayerStack(); + + for( StackedLayerModel::ConstIterator it( layerStack->Begin() ); + it!=layerStack->End(); + ++it ) + { + if( it->second->inherits( VectorImageModel::staticMetaObject.className() ) ) + { + VectorImageModel * imageModel = + qobject_cast< VectorImageModel * >( it->second ); + + VectorImageSettings & settings = imageModel->GetSettings(); + settings.SetEffect( EFFECT_NORMAL ); + } + } + + emit ModelUpdated(); +} + /******************************************************************************/ void ImageViewWidget diff --git a/Modules/Visualization/MonteverdiGui/src/mvdLayerStackController.cxx b/Modules/Visualization/MonteverdiGui/src/mvdLayerStackController.cxx index f5fe47211f4a4aa9b3b5c2f7d899f7b36117385b..be683a5dc8cac82855e5bf7f4759f005e993f74c 100644 --- a/Modules/Visualization/MonteverdiGui/src/mvdLayerStackController.cxx +++ b/Modules/Visualization/MonteverdiGui/src/mvdLayerStackController.cxx @@ -220,6 +220,14 @@ LayerStackController this, SIGNAL( ApplyAllRequested() ) ); + + QObject::connect( + widget, + SIGNAL( ResetEffectsButtonClicked() ), + // to: + this, + SIGNAL( ResetEffectsRequested() ) + ); } /*******************************************************************************/ @@ -351,6 +359,14 @@ LayerStackController this, SIGNAL( ApplyAllRequested() ) ); + + QObject::disconnect( + widget, + SIGNAL( ResetEffectsButtonClicked() ), + // to: + this, + SIGNAL( ResetEffectsRequested() ) + ); } /*******************************************************************************/ @@ -389,6 +405,8 @@ LayerStackController widget->SetMoveEnabled( model->GetCount()>1 ); widget->SetApplyEnabled( model->GetCount()>1 ); + + widget->SetResetEffectsEnabled( !model->IsEmpty() ); } /*******************************************************************************/ diff --git a/Modules/Visualization/MonteverdiGui/src/mvdLayerStackWidget.cxx b/Modules/Visualization/MonteverdiGui/src/mvdLayerStackWidget.cxx index c52a9fea19f5e326b5b14fd5dd399d54d81075d4..4e1e163f443c1692b291f3ef650f031d7862a47d 100644 --- a/Modules/Visualization/MonteverdiGui/src/mvdLayerStackWidget.cxx +++ b/Modules/Visualization/MonteverdiGui/src/mvdLayerStackWidget.cxx @@ -166,6 +166,14 @@ LayerStackWidget this, SIGNAL( ApplyButtonClicked() ) ); + + QObject::connect( + m_UI->resetEffectsButton, + SIGNAL( clicked() ), + // to: + this, + SIGNAL( ResetEffectsButtonClicked() ) + ); } /*******************************************************************************/ @@ -403,6 +411,18 @@ LayerStackWidget m_UI->reloadButton->setEnabled( enabled ); } +/*******************************************************************************/ +void +LayerStackWidget +::SetResetEffectsEnabled( bool enabled ) +{ + assert( m_UI!=NULL ); + + assert( m_UI->reloadButton!=NULL ); + + m_UI->resetEffectsButton->setEnabled( enabled ); +} + /*******************************************************************************/ /* SLOTS */ /*******************************************************************************/ diff --git a/Modules/Visualization/MonteverdiGui/src/mvdLayerStackWidget.ui b/Modules/Visualization/MonteverdiGui/src/mvdLayerStackWidget.ui index 3e769442f6ebe8436d66bc15d6310f253e7a24e9..0d4f254b2c3dfc05866bf8678938ad7bc57c90a1 100644 --- a/Modules/Visualization/MonteverdiGui/src/mvdLayerStackWidget.ui +++ b/Modules/Visualization/MonteverdiGui/src/mvdLayerStackWidget.ui @@ -56,7 +56,7 @@ <string/> </property> <property name="icon"> - <iconset resource="../../Application/Monteverdi/mvdMainWindow.qrc"> + <iconset> <normaloff>:/icons/action_LayerTop_Icon</normaloff>:/icons/action_LayerTop_Icon</iconset> </property> </widget> @@ -73,7 +73,7 @@ <string/> </property> <property name="icon"> - <iconset resource="../../Application/Monteverdi/mvdMainWindow.qrc"> + <iconset> <normaloff>:/icons/action_LayerUp_Icon</normaloff>:/icons/action_LayerUp_Icon</iconset> </property> </widget> @@ -90,7 +90,7 @@ <string/> </property> <property name="icon"> - <iconset resource="../../Application/Monteverdi/mvdMainWindow.qrc"> + <iconset> <normaloff>:/icons/action_LayerDown_Icon</normaloff>:/icons/action_LayerDown_Icon</iconset> </property> </widget> @@ -107,7 +107,7 @@ <string/> </property> <property name="icon"> - <iconset resource="../../Application/Monteverdi/mvdMainWindow.qrc"> + <iconset> <normaloff>:/icons/action_LayerBottom_Icon</normaloff>:/icons/action_LayerBottom_Icon</iconset> </property> </widget> @@ -124,7 +124,7 @@ <string/> </property> <property name="icon"> - <iconset resource="../../Application/Monteverdi/mvdMainWindow.qrc"> + <iconset> <normaloff>:/icons/action_LayerProjection_Icon</normaloff>:/icons/action_LayerProjection_Icon</iconset> </property> </widget> @@ -141,7 +141,7 @@ <string/> </property> <property name="icon"> - <iconset resource="../../Application/Monteverdi/mvdMainWindow.qrc"> + <iconset> <normaloff>:/icons/action_ApplyAll_Icon</normaloff>:/icons/action_ApplyAll_Icon</iconset> </property> </widget> @@ -158,7 +158,7 @@ <string/> </property> <property name="icon"> - <iconset resource="../../Application/Monteverdi/mvdMainWindow.qrc"> + <iconset> <normaloff>:/icons/action_Reload_Icon</normaloff>:/icons/action_Reload_Icon</iconset> </property> </widget> @@ -179,6 +179,20 @@ </property> </spacer> </item> + <item> + <widget class="QToolButton" name="resetEffectsButton"> + <property name="toolTip"> + <string>Reset all layer effects to Normal</string> + </property> + <property name="text"> + <string/> + </property> + <property name="icon"> + <iconset resource="mvdIcons.qrc"> + <normaloff>:/Utilities/Data/Icons/edit-clear.png</normaloff>:/Utilities/Data/Icons/edit-clear.png</iconset> + </property> + </widget> + </item> <item> <widget class="QToolButton" name="deleteAllButton"> <property name="toolTip"> @@ -191,7 +205,7 @@ <string/> </property> <property name="icon"> - <iconset resource="../../Application/Monteverdi/mvdMainWindow.qrc"> + <iconset> <normaloff>:/icons/action_LayerDeleteAll_Icon</normaloff>:/icons/action_LayerDeleteAll_Icon</iconset> </property> </widget> @@ -208,7 +222,7 @@ <string/> </property> <property name="icon"> - <iconset resource="../../Application/Monteverdi/mvdMainWindow.qrc"> + <iconset> <normaloff>:/icons/action_LayerDelete_Icon</normaloff>:/icons/action_LayerDelete_Icon</iconset> </property> </widget> @@ -219,6 +233,7 @@ </widget> <resources> <include location="../../Application/Monteverdi/mvdMainWindow.qrc"/> + <include location="mvdIcons.qrc"/> </resources> <connections/> </ui> diff --git a/Modules/Visualization/MonteverdiGui/src/mvdShaderWidget.cxx b/Modules/Visualization/MonteverdiGui/src/mvdShaderWidget.cxx index f7bfd139e7c2fefa0c4e54d8b393725544082f8d..706c6670690c105ec40ebb99e6c47e26e9bd21c5 100644 --- a/Modules/Visualization/MonteverdiGui/src/mvdShaderWidget.cxx +++ b/Modules/Visualization/MonteverdiGui/src/mvdShaderWidget.cxx @@ -40,8 +40,8 @@ // // Monteverdi includes (sorted by alphabetic order) #include "mvdAlgorithm.h" -#include "mvdImageSettings.h" #include "mvdGui.h" +#include "mvdVectorImageSettings.h" namespace mvd { @@ -117,18 +117,24 @@ ShaderWidget void ShaderWidget ::SetGLSL140Enabled( bool isGLSLEnabled ) +{ + SetEffectVisible(EFFECT_GRADIENT,isGLSLEnabled); +} + +void ShaderWidget +::SetEffectVisible(const Effect & effect, bool visible) { assert( qApp!=NULL ); int index = m_UI->effectComboBox->findText( - qApp->translate( "mvd", EFFECT_NAMES[ EFFECT_GRADIENT ] ) + qApp->translate( "mvd", EFFECT_NAMES[ effect ] ) ); - if( isGLSLEnabled ) + if( visible ) { if( index<0 ) - m_UI->effectComboBox->addItem( tr( "mvd", EFFECT_NAMES[ EFFECT_GRADIENT ] ) ); + m_UI->effectComboBox->addItem( qApp->translate( "mvd", EFFECT_NAMES[ effect ] ) ); } else if( index>=0 ) m_UI->effectComboBox->removeItem( index ); @@ -185,6 +191,14 @@ ShaderWidget ); m_UI->valueLineEdit->setCursorPosition( 0 ); } + + VectorImageSettings * vis = dynamic_cast<VectorImageSettings*>(settings); + + if(vis!=NULL) + { + GrayscaleActivated(vis->IsGrayscaleActivated()); + } + } /*******************************************************************************/ @@ -275,4 +289,21 @@ ShaderWidget emit SettingsChanged(); } + +void ShaderWidget +::GrayscaleActivated(bool status) +{ + SetEffectVisible(EFFECT_LUT_JET,status); + SetEffectVisible(EFFECT_LUT_LOCAL_JET,status); + SetEffectVisible(EFFECT_LUT_HOT,status); + SetEffectVisible(EFFECT_LUT_LOCAL_HOT,status); + SetEffectVisible(EFFECT_LUT_WINTER,status); + SetEffectVisible(EFFECT_LUT_LOCAL_WINTER,status); + SetEffectVisible(EFFECT_LUT_SUMMER,status); + SetEffectVisible(EFFECT_LUT_LOCAL_SUMMER,status); + SetEffectVisible(EFFECT_LUT_COOL,status); + SetEffectVisible(EFFECT_LUT_LOCAL_COOL,status); + SetEffectVisible(EFFECT_SPECTRAL_ANGLE,!status); +} + } // end namespace 'mvd' diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h index e534fabc63361dac54accd9ea8337fedb5325326..4402dbf028504c9187f6a47145131fec5fd99cbb 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h @@ -24,6 +24,7 @@ #include "otbWrapperParameterGroup.h" #include "itkLogger.h" +#include "itkTimeProbe.h" #include "otbWrapperMacros.h" #include "otbWrapperInputImageParameter.h" #include "otbWrapperInputImageListParameter.h" @@ -299,6 +300,16 @@ public: */ void SetMaximumParameterFloatValue(std::string parameter, float value); + + /** + * Enable single selection mode for list view if status in true + * (default is false). + * + * Can be called for types: + * \li ParameterType_ListView + */ + void SetListViewSingleSelectionMode(std::string parameter, bool status); + /* Set a string value * * Can be called for types : @@ -737,6 +748,8 @@ public: m_IsInXMLParsed = false; } + double GetLastExecutionTiming() const; + protected: /** Constructor */ Application(); @@ -898,6 +911,9 @@ private: /** Tags that define the application (ex : segmentation, OBIA).*/ std::vector<std::string> m_DocTags; + /** Chrono to measure execution time */ + itk::TimeProbe m_Chrono; + //rashad:: controls adding of -xml parameter. set to true by default bool m_HaveInXML; bool m_HaveOutXML; diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperListViewParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperListViewParameter.h index 5423377f05acedca711c639389b2bcd15fb18571..15f46725ac115104b92eb930623e95550199bae8 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperListViewParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperListViewParameter.h @@ -50,6 +50,10 @@ public: /** RTTI support */ itkTypeMacro(ListViewParameter, Parameter); + itkSetMacro(SingleSelection,bool); + itkGetMacro(SingleSelection,bool); + itkBooleanMacro(SingleSelection); + /** Add a value to the choice */ void AddChoice( std::string choicekey, std::string choiceName ); @@ -92,24 +96,10 @@ public: std::vector<int> GetSelectedItems() { - if( m_SelectedNames.size() != 0 ) - { - this->SetSelectedItemsByNames(); - } - else if( m_SelectedKeys.size() != 0 ) - { - this->SetSelectedItemsByKeys(); - } - return m_SelectedItems; } - void SetSelectedNames(std::vector<std::string> selectedNames) - { - m_SelectedNames = selectedNames; - m_SelectedItems.clear(); - m_SelectedKeys.clear(); - } + void SetSelectedNames(std::vector<std::string> selectedNames); std::vector<std::string> GetSelectedNames() { @@ -117,22 +107,21 @@ public: } - void SetSelectedKeys(std::vector<std::string> selectedKeys) - { - m_SelectedKeys = selectedKeys; - m_SelectedItems.clear(); - m_SelectedNames.clear(); - } + void SetSelectedKeys(std::vector<std::string> selectedKeys); std::vector<std::string> GetSelectedKeys() { return m_SelectedKeys; } - /** Set selected items using a lit of selected keys. */ - void SetSelectedItemsByKeys(); - /** Set selected items using a lit of selected names. */ - void SetSelectedItemsByNames(); + /** Set selected items using a lit of selected keys. + * OBSOLETE : this method is not needed anymore and does nothing. */ + void SetSelectedItemsByKeys(){} + + /** Set selected items using a lit of selected names. + * OBSOLETE : this method is not needed anymore and does nothing. */ + void SetSelectedItemsByNames(){} + void SetSelectedItems(std::vector<std::string> selectedItems) { std::vector<int> items; @@ -140,14 +129,22 @@ public: { items.push_back( atoi( selectedItems[i].c_str() ) ); } - m_SelectedItems = items; - m_SelectedNames.clear(); - m_SelectedKeys.clear(); + this->SetSelectedItems(items); } void SetSelectedItems(std::vector<int> selectedItems) { m_SelectedItems = selectedItems; + m_SelectedNames.clear(); + m_SelectedKeys.clear(); + // update selected names and keys + std::vector<std::string> names = this->GetChoiceNames(); + std::vector<std::string> keys = this->GetChoiceKeys(); + for (unsigned int i=0 ; i<m_SelectedItems.size() ; i++) + { + m_SelectedNames.push_back(names[m_SelectedItems[i]]); + m_SelectedKeys.push_back(keys[m_SelectedItems[i]]); + } } protected: @@ -171,6 +168,7 @@ protected: std::vector<int> m_SelectedItems; std::vector<std::string> m_SelectedKeys; std::vector<std::string> m_SelectedNames; + bool m_SingleSelection; private: ListViewParameter(const ListViewParameter &); //purposely not implemented diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputImageParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputImageParameter.h index 25eedebf631ce507c6c6b603ba7cee8bf3322db1..b4a8102db2110217aac752add482e783babc5e84 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputImageParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputImageParameter.h @@ -104,6 +104,8 @@ public: void InitializeWriters(); + std::string CheckFileName(bool fixMissingExtension = false); + protected: /** Constructor */ OutputImageParameter(); diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx index f24308291ed7a3f1804baf8a070fe143dcb0f202..4611450d2120cb31fdcd43d36e6fa9aae8252143 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx @@ -228,6 +228,9 @@ int Application::Execute() int Application::ExecuteAndWriteOutput() { + m_Chrono.Reset(); + m_Chrono.Start(); + int status = this->Execute(); if (status == 0) @@ -270,6 +273,11 @@ int Application::ExecuteAndWriteOutput() if(outputParam!=ITK_NULLPTR) { outputParam->InitializeWriters(); + std::string checkReturn = outputParam->CheckFileName(true); + if (!checkReturn.empty()) + { + otbAppLogWARNING("Check filename : "<<checkReturn); + } if (useRAM) { outputParam->SetRAMValue(ram); @@ -330,6 +338,7 @@ int Application::ExecuteAndWriteOutput() this->AfterExecuteAndWriteOutputs(); + m_Chrono.Stop(); return status; } @@ -735,6 +744,20 @@ void Application::SetMaximumParameterFloatValue(std::string parameter, float val } +void Application::SetListViewSingleSelectionMode(std::string parameter, bool status) +{ + Parameter* param = GetParameterByKey(parameter); + + if (dynamic_cast<ListViewParameter*>(param)) + { + ListViewParameter* paramListView = dynamic_cast<ListViewParameter*>(param); + paramListView->SetSingleSelection(status); + } + else + itkExceptionMacro(<<parameter << "parameter can't be casted to ListView"); + +} + void Application::SetParameterString(std::string parameter, std::string value) { @@ -1627,5 +1650,10 @@ std::string Application::GetProgressDescription() const return m_ProgressSourceDescription; } +double Application::GetLastExecutionTiming() const +{ + return m_Chrono.GetTotal(); +} + } } diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperChoiceParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperChoiceParameter.cxx index 851165ab74c6e9548665fea3b2796d421e570580..e823e002a302382cd16bc5ea84fadbd31345f2be 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperChoiceParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperChoiceParameter.cxx @@ -173,7 +173,10 @@ ChoiceParameter::SetValue(std::string choiceKey) ++i; } - itkExceptionMacro(<< "Cannot find " << choiceKey); + itkExceptionMacro(<< "Invalid parameter value '" + << choiceKey << "'" + << " given for parameter '-" + << this->GetKey() << "'"); } unsigned int diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperComplexOutputImageParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperComplexOutputImageParameter.cxx index 382d87a66780a9d15dba00c73b360fb35e51287c..597f1b8726c9eaa54d1de4d8cb5fec9cd7db1f06 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperComplexOutputImageParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperComplexOutputImageParameter.cxx @@ -210,8 +210,8 @@ ComplexOutputImageParameter::GetWriter() // 0 : image // 1 : VectorImage - if ( dynamic_cast<FloatVectorImageType*>( m_Image.GetPointer()) || - dynamic_cast<DoubleVectorImageType*>(m_Image.GetPointer())) + if ( dynamic_cast<ComplexFloatVectorImageType*>( m_Image.GetPointer()) || + dynamic_cast<ComplexDoubleVectorImageType*>(m_Image.GetPointer())) { type = 1; } diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperListViewParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperListViewParameter.cxx index 2d3fa76b12f676b618ea47795c11d0ccd69fbe34..b93660f4b862b052c1962eef75438f155e26b29e 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperListViewParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperListViewParameter.cxx @@ -23,7 +23,12 @@ namespace Wrapper { ListViewParameter::ListViewParameter() - : m_CurrentChoice(0) + : m_ChoiceList(), + m_CurrentChoice(0), + m_SelectedItems(), + m_SelectedKeys(), + m_SelectedNames(), + m_SingleSelection(false) { } @@ -145,14 +150,21 @@ ListViewParameter::ClearChoices() m_ChoiceList.clear(); } + void -ListViewParameter::SetSelectedItemsByNames() +ListViewParameter::SetSelectedNames(std::vector<std::string> selectedNames) { std::vector<int> selectedItems; std::vector<std::string> names = this->GetChoiceNames(); - for(unsigned int i=0; i<m_SelectedNames.size(); i++) + + if(m_SingleSelection && selectedNames.size() > 1) + { + itkExceptionMacro(<<"Single selection mode is on, but there are "<<selectedNames.size()<<" selected items"); + } + + for(unsigned int i=0; i<selectedNames.size(); i++) { - const std::string selectedName = m_SelectedNames[i]; + const std::string selectedName = selectedNames[i]; unsigned int j(0); for(; j<names.size(); j++) { @@ -182,13 +194,19 @@ ListViewParameter::SetSelectedItemsByNames() void -ListViewParameter::SetSelectedItemsByKeys() +ListViewParameter::SetSelectedKeys(std::vector<std::string> selectedKeys) { std::vector<int> selectedItems; std::vector<std::string> keys = this->GetChoiceKeys(); + +if(m_SingleSelection && m_SelectedKeys.size() > 1) + { + itkExceptionMacro(<<"Single selection mode is on, but there are "<<m_SelectedKeys.size()<<" selected items"); + } + for(unsigned int i=0; i<m_SelectedKeys.size(); i++) { - const std::string selectedKey = m_SelectedKeys[i]; + const std::string selectedKey = selectedKeys[i]; unsigned int j(0); std::ostringstream oss; for(; j<keys.size(); j++) diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputImageParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputImageParameter.cxx index 475e445d1012d63aaaba3122a94af70cf41f4171..b6bd4f94e5214019e0178012925559725c4424fd 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputImageParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputImageParameter.cxx @@ -18,6 +18,8 @@ #include "otbWrapperOutputImageParameter.h" #include "otbClampImageFilter.h" #include "otbClampVectorImageFilter.h" +#include "otbImageIOFactory.h" +#include "itksys/SystemTools.hxx" #ifdef OTB_USE_MPI @@ -557,5 +559,46 @@ OutputImageParameter::HasValue() const return !filename.empty(); } +std::string +OutputImageParameter::CheckFileName(bool fixMissingExtension) +{ + std::string ret(""); + // Check that there is an ImageIO capable of writing the file + otb::ExtendedFilenameToWriterOptions::Pointer filenameHelper = + otb::ExtendedFilenameToWriterOptions::New(); + filenameHelper->SetExtendedFileName(this->GetFileName()); + std::string simpleFilename = filenameHelper->GetSimpleFileName(); + // TODO : check if simpleFilename is empty + + otb::ImageIOBase::Pointer imageIO = + otb::ImageIOFactory::CreateImageIO(simpleFilename.c_str(), + otb::ImageIOFactory::WriteMode); + if(imageIO.IsNull()) + { + // check for missing extension + std::string outExt = itksys::SystemTools::GetFilenameLastExtension(simpleFilename); + if (outExt.empty()) + { + if (fixMissingExtension) + { + // try with .tif + std::string fullFileName(this->GetFileName()); + std::string extendedPart = fullFileName.substr(simpleFilename.size()); + this->SetFileName(simpleFilename+std::string(".tif")+extendedPart); + ret += std::string("no extension detected, using TIF as default."); + } + else + { + // TODO : call exception here? + } + } + else + { + // TODO : call exception here? + } + } + return ret; +} + } } diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperParameterGroup.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperParameterGroup.cxx index 199bb65f494267765a17f37ae064175d42e69c44..22f15036691ea9670056270231f84ce03f059966 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperParameterGroup.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperParameterGroup.cxx @@ -141,37 +141,27 @@ ParameterGroup::AddChoice(std::string paramKey, std::string paramName) void ParameterGroup::ClearChoices(std::string paramKey) { - ParameterKey pKey( paramKey ); - // Split the parameter name - std::vector<std::string> splitKey = pKey.Split(); - std::string parentkey; - Parameter::Pointer parentParam; + Parameter * param = GetParameterByKey(paramKey); - if (splitKey.size() > 1) - { - parentkey = pKey.GetRoot(); - parentParam = GetParameterByKey(parentkey); - } - else + if(!param) { - parentParam = GetParameterByKey(splitKey[0]); + itkExceptionMacro("Parameter "<<paramKey<<" not found"); } + + // param must be a choice, a listBox or this is an error + ListViewParameter* paramAsChoice = dynamic_cast<ListViewParameter*>(param); - // parentParam must be a choice, a listBox or this is an error - ListViewParameter* listBoxParentAsChoice = dynamic_cast<ListViewParameter*>(parentParam.GetPointer()); - - if (listBoxParentAsChoice) + if (paramAsChoice) { - listBoxParentAsChoice->ClearChoices(); + paramAsChoice->ClearChoices(); } else { - itkExceptionMacro(<<parentkey << " is not a ListView"); + itkExceptionMacro(<<paramKey << " is not a ListView"); } } - void ParameterGroup::AddOutXMLParameter() { Parameter::Pointer tmpParam; @@ -216,34 +206,25 @@ void ParameterGroup::AddInXMLParameter() std::vector<int> ParameterGroup::GetSelectedItems(std::string paramKey) { - std::vector<int> selectedItems; - ParameterKey pKey( paramKey ); - // Split the parameter name - std::vector<std::string> splitKey = pKey.Split(); + Parameter * param = GetParameterByKey(paramKey); - std::string parentkey; - Parameter::Pointer parentParam; - - if (splitKey.size() > 1) + if(!param) { - parentkey = pKey.GetRoot(); - parentParam = GetParameterByKey(parentkey); + itkExceptionMacro("Parameter "<<paramKey<<" not found"); } - else - { - parentParam = GetParameterByKey(splitKey[0]); - } - - // parentParam must be a choice, a listBox or this is an error - ListViewParameter* listBoxParentAsChoice = dynamic_cast<ListViewParameter*>(parentParam.GetPointer()); + + // param must be a choice, a listBox or this is an error + ListViewParameter* paramAsChoice = dynamic_cast<ListViewParameter*>(param); + + std::vector<int> selectedItems; - if (listBoxParentAsChoice) + if (paramAsChoice) { - selectedItems = listBoxParentAsChoice->GetSelectedItems(); + selectedItems = paramAsChoice->GetSelectedItems(); } else { - itkExceptionMacro(<<parentkey << " is not a ListView"); + itkExceptionMacro(<<paramKey << " is not a ListView"); } return selectedItems; diff --git a/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx b/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx index b69ef724c34ba6ac3a7ead16e7520172cedffad4..8fa88be9de329b084a1876b6c3a302cea2db70a0 100644 --- a/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx +++ b/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx @@ -494,7 +494,17 @@ CommandLineLauncher::ParamResultType CommandLineLauncher::LoadParameters() else if (type == ParameterType_ListView) { - dynamic_cast<ListViewParameter *> (param.GetPointer())->SetSelectedNames(values); + + ListViewParameter * tmpLV = dynamic_cast<ListViewParameter *>(param.GetPointer()); + + if(tmpLV->GetSingleSelection() && values.size() > 1) + { + std::cerr << "ERROR: Invalid number of value for: \"" << paramKey + << "\", invalid number of values " << values.size() << std::endl; + return INVALIDNUMBEROFVALUE; + } + + tmpLV->SetSelectedNames(values); } else if(values.size() != 1) @@ -750,6 +760,14 @@ std::string CommandLineLauncher::DisplayParameterHelp(const Parameter::Pointer & return ""; } + bool singleSelectionForListView = false; + + if(type == ParameterType_ListView) + { + ListViewParameter * tmp = static_cast<ListViewParameter *>(param.GetPointer()); + singleSelectionForListView = tmp->GetSingleSelection(); + } + std::ostringstream oss; // When a parameter is mandatory : @@ -822,7 +840,7 @@ std::string CommandLineLauncher::DisplayParameterHelp(const Parameter::Pointer & } else if (type == ParameterType_InputFilename || type == ParameterType_OutputFilename ||type == ParameterType_Directory || type == ParameterType_InputImage || type == ParameterType_OutputProcessXML || type == ParameterType_InputProcessXML || type == ParameterType_ComplexInputImage || type == ParameterType_InputVectorData || type == ParameterType_OutputVectorData || - type == ParameterType_String || type == ParameterType_Choice ) + type == ParameterType_String || type == ParameterType_Choice || (type == ParameterType_ListView && singleSelectionForListView)) { oss << "<string> "; } @@ -830,7 +848,7 @@ std::string CommandLineLauncher::DisplayParameterHelp(const Parameter::Pointer & { oss << "<string> [pixel]"; } - else if (type == ParameterType_Choice || type == ParameterType_ListView || type == ParameterType_InputImageList || + else if (type == ParameterType_Choice || (type == ParameterType_ListView && !singleSelectionForListView) || type == ParameterType_InputImageList || type == ParameterType_InputVectorDataList || type == ParameterType_InputFilenameList || type == ParameterType_StringList ) { diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetModel.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetModel.h index e08678a2bd36e359ba2be86f270e0d8a3c7d6cb8..856c2528238fbd10fe25ffac2d3f2d4dedfed462 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetModel.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetModel.h @@ -19,6 +19,7 @@ #define otbWrapperQtWidgetModel_h #include <QtGui> +#include <QTimer> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "otbWrapperApplication.h" #include "otbQtLogOutput.h" @@ -162,6 +163,8 @@ private slots: */ void OnApplicationExecutionDone( int status ); + void TimerDone(); + private: QtWidgetModel(const QtWidgetModel&); //purposely not implemented void operator=(const QtWidgetModel&); //purposely not implemented @@ -171,6 +174,8 @@ private: QtLogOutput::Pointer m_LogOutput; bool m_IsRunning; + + QTimer *m_Timer; }; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetView.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetView.h index e39f5d17de5bc5e226291cc0dfc6c28847002fa2..b4d69cc539b8492e5af2799f9d55c7bbf3b97fb0 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetView.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetView.h @@ -54,6 +54,7 @@ public slots: private slots: void UpdateMessageAfterExecuteClicked(); + void UpdateMessageAfterExecution(int status); void UpdateMessageAfterApplicationReady(bool val); signals: diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetListViewParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetListViewParameter.cxx index 9427927737d607479fdebfe7279d14831a925f5e..21c289468d34b2e0ffb65ca56369fb5427548840 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetListViewParameter.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetListViewParameter.cxx @@ -70,7 +70,15 @@ void QtWidgetListViewParameter::DoCreateWidget() { m_ListView = new QListWidget(); m_ListView->setToolTip(m_ListViewParam->GetDescription()); - m_ListView->setSelectionMode(QAbstractItemView::ExtendedSelection); + + if(m_ListViewParam->GetSingleSelection()) + { + m_ListView->setSelectionMode(QAbstractItemView::SingleSelection); + } + else + { + m_ListView->setSelectionMode(QAbstractItemView::ExtendedSelection); + } connect( m_ListView, SIGNAL(itemSelectionChanged()), this, SLOT(SelectedItems()) ); @@ -97,6 +105,10 @@ void QtWidgetListViewParameter::SelectedItems() } } m_ListViewParam->SetSelectedItems(m_SelectedItems); + + // make sure parameter is enabled + m_ListViewParam->SetActive(true); + m_ListViewParam->SetUserValue(true); } } diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetModel.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetModel.cxx index 73157927ab95baa74e73b252ca3e7ca9973c5f48..beba06a405edcc7a9bc18399b18c7989923e3d4e 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetModel.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetModel.cxx @@ -40,6 +40,16 @@ QtWidgetModel // Attach log output to the Application logger m_Application->GetLogger()->SetTimeStampFormat(itk::LoggerBase::HUMANREADABLE); m_Application->GetLogger()->AddLogOutput(m_LogOutput); + + m_Timer = new QTimer(this); + m_Timer->setSingleShot(true); + m_Timer->setInterval(1000); + QObject::connect( + m_Timer, + SIGNAL( timeout() ), + this, + SLOT( TimerDone() ) + ); } QtWidgetModel::~QtWidgetModel() @@ -89,26 +99,38 @@ QtWidgetModel SLOT( OnApplicationExecutionDone( int ) ) ); - taskAppli->Execute(); - // Tell the Progress Reporter to begin emit SetProgressReportBegin(); + + taskAppli->Execute(); } void QtWidgetModel ::OnApplicationExecutionDone( int status ) { - m_IsRunning = false; + // For the progressReport to close the Progress widget + // and the GUI to update message + emit SetProgressReportDone( status ); - // Require GUI update. - NotifyUpdate(); + if (status >= 0) + { + std::ostringstream oss; + oss << "Execution took "<< m_Application->GetLastExecutionTiming() << " sec"; + SendLogINFO(oss.str()); + } - // For the view to activate the button "Execute" - emit SetApplicationReady( true ); + // start timer + m_Timer->start(); +} - // For the progressReport to close the Progress widget - emit SetProgressReportDone( status ); +void +QtWidgetModel +::TimerDone() +{ + m_IsRunning = false; + // Require GUI update. + NotifyUpdate(); } void diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetSimpleProgressReport.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetSimpleProgressReport.cxx index 75fa895a602ec0abb835af4f8feda79da947ef9c..5aa25cc481d362dbb88b102b2983b7c67f47b392 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetSimpleProgressReport.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetSimpleProgressReport.cxx @@ -32,7 +32,6 @@ QtWidgetSimpleProgressReport::QtWidgetSimpleProgressReport(QtWidgetModel * model { m_Model = model; connect(model, SIGNAL(SetProgressReportBegin()), this, SLOT(show()) ); - connect(model, SIGNAL(SetProgressReportDone()), this, SLOT(close()) ); connect(model, SIGNAL(SetProgressReportDone()), this, SLOT(Init()) ); connect(this, SIGNAL(AddNewProcessToReport()), this, SLOT(ReportProcess()) ); @@ -90,7 +89,7 @@ void QtWidgetSimpleProgressReport::ReportProcess() void QtWidgetSimpleProgressReport::Init() { m_Bar->setValue(0); - m_Label->setText("No process yet..."); + m_Label->setText("No process"); } } diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetView.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetView.cxx index 9938c2fb82556b00132a64ee57dbe4851a96d46e..43f7472ca46f7466cbc081fdf698f9e581c5e05d 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetView.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetView.cxx @@ -61,6 +61,7 @@ void QtWidgetView::CreateGui() m_Message = new QLabel("<center><font color=\"#FF0000\">Select parameters</font></center>"); connect( m_Model, SIGNAL(SetApplicationReady(bool)), this, SLOT(UpdateMessageAfterApplicationReady(bool)) ); + connect( m_Model, SIGNAL(SetProgressReportDone(int)), this, SLOT(UpdateMessageAfterExecution(int)) ); mainLayout->addWidget(m_Message); QtWidgetSimpleProgressReport * progressReport = new QtWidgetSimpleProgressReport(m_Model); @@ -86,10 +87,22 @@ void QtWidgetView::UpdateMessageAfterExecuteClicked() m_Message->setText("<center><font color=\"#FF0000\">Running</font></center>"); } +void QtWidgetView::UpdateMessageAfterExecution(int status) +{ + if (status >= 0) + { + m_Message->setText("<center><font color=\"#00A000\">DONE</font></center>"); + } + else + { + m_Message->setText("<center><font color=\"#FF0000\">FAILED !</font></center>"); + } +} + void QtWidgetView::UpdateMessageAfterApplicationReady( bool val ) { if(val == true) - m_Message->setText("<center><font color=\"#00FF00\">Ready to run</font></center>"); + m_Message->setText("<center><font color=\"#00A000\">Ready to run</font></center>"); else m_Message->setText("<center><font color=\"#FF0000\">Select parameters</font></center>"); } diff --git a/Modules/Wrappers/SWIG/src/CMakeLists.txt b/Modules/Wrappers/SWIG/src/CMakeLists.txt index af424622ef8ff03ed7f4b925190781038ca03552..9126f98b2d9d21477f3f6cb2efc973f2b74eb6ad 100644 --- a/Modules/Wrappers/SWIG/src/CMakeLists.txt +++ b/Modules/Wrappers/SWIG/src/CMakeLists.txt @@ -28,7 +28,7 @@ if ( OTB_WRAP_PYTHON ) include_directories(${NUMPY_INCLUDE_DIRS}) list(APPEND CMAKE_SWIG_FLAGS "-DOTB_SWIGNUMPY=1") endif() - set(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_BINARY_DIR}) + set(CMAKE_SWIG_OUTDIR ${CMAKE_BINARY_DIR}/${OTB_INSTALL_PYTHON_DIR}) set(SWIG_MODULE_otbApplication_EXTRA_DEPS ${CMAKE_CURRENT_SOURCE_DIR}/Python.i ${CMAKE_CURRENT_SOURCE_DIR}/PyCommand.i @@ -36,6 +36,7 @@ if ( OTB_WRAP_PYTHON ) OTBApplicationEngine) SWIG_add_module( otbApplication python otbApplication.i otbApplicationPYTHON_wrap.cxx itkPyCommand.cxx ) SWIG_link_libraries( otbApplication ${PYTHON_LIBRARIES} OTBApplicationEngine ) + set_target_properties(_otbApplication PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SWIG_OUTDIR}) if(MSVC) set_source_files_properties( ${CMAKE_CURRENT_BINARY_DIR}/otbApplicationPYTHON_wrap.cxx COMPILE_FLAGS "/wd4005" ) else() @@ -47,7 +48,9 @@ if ( OTB_WRAP_PYTHON ) TARGET _otbApplication POST_BUILD COMMAND ${CMAKE_COMMAND} -E echo "Byte-compiling otbApplication.py" - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/CMake/PythonCompile.py otbApplication.py + COMMAND ${PYTHON_EXECUTABLE} + ${CMAKE_SOURCE_DIR}/CMake/PythonCompile.py + ${CMAKE_SWIG_OUTDIR}/otbApplication.py DEPENDS _otbApplication ) @@ -57,8 +60,8 @@ if ( OTB_WRAP_PYTHON ) DESTINATION ${OTB_INSTALL_PYTHON_DIR} COMPONENT RuntimeLibraries ) - install( FILES ${CMAKE_CURRENT_BINARY_DIR}/otbApplication.py - ${CMAKE_CURRENT_BINARY_DIR}/otbApplication.pyc + install( FILES ${CMAKE_SWIG_OUTDIR}/otbApplication.py + ${CMAKE_SWIG_OUTDIR}/otbApplication.pyc DESTINATION ${OTB_INSTALL_PYTHON_DIR} COMPONENT RuntimeLibraries ) diff --git a/SuperBuild/CMake/External_itk.cmake b/SuperBuild/CMake/External_itk.cmake index 203615e3227b1f5da56770d133656e68abeb3bc6..c33559d6e52ddab428bd976d45bf6fb05a2b2e2c 100644 --- a/SuperBuild/CMake/External_itk.cmake +++ b/SuperBuild/CMake/External_itk.cmake @@ -162,6 +162,20 @@ ExternalProject_Add(ITK CMAKE_COMMAND ${SB_CMAKE_COMMAND} ) -#set(ITK_DIFF_FILES ${CMAKE_SOURCE_DIR}/patches/ITK/itk-1-fftw-all.diff) -#SUPERBUILD_PATCH_SOURCE(ITK "" ${ITK_DIFF_FILES}) SUPERBUILD_PATCH_SOURCE(ITK) + +ExternalProject_Add_Step(ITK POST_INSTALL_2 + COMMAND ${CMAKE_COMMAND} + -DPATCH_DIR=${SB_INSTALL_PREFIX}/lib/cmake/ITK-4.10 + -DMATCH=${SB_INSTALL_PREFIX} + -DPATH_STRIP_COUNT=3 + -P ${CMAKE_SOURCE_DIR}/CMake/post_install.cmake + DEPENDEES install) + +ExternalProject_Add_Step(ITK POST_INSTALL_1 + COMMAND ${CMAKE_COMMAND} + -DPATCH_DIR=${SB_INSTALL_PREFIX}/lib/cmake/ITK-4.10/Modules + -DMATCH=${SB_INSTALL_PREFIX} + -DPATH_STRIP_COUNT=4 + -P ${CMAKE_SOURCE_DIR}/CMake/post_install.cmake + DEPENDEES install) diff --git a/SuperBuild/CMake/External_muparserx.cmake b/SuperBuild/CMake/External_muparserx.cmake index fe64272d9138f71270efd9940a784f046339c29e..19b9e164c1eef2e3f9192c283c122befaddb7c9f 100644 --- a/SuperBuild/CMake/External_muparserx.cmake +++ b/SuperBuild/CMake/External_muparserx.cmake @@ -2,33 +2,31 @@ INCLUDE_ONCE_MACRO(MUPARSERX) SETUP_SUPERBUILD(MUPARSERX) +package_require_cxx11(MUPARSERX) + +#Don't build muparserx examples set(MUPARSERX_FLAGS) -if(APPLE) - set(MUPARSERX_FLAGS "-DCMAKE_CXX_FLAGS:STRING=-std=c++0x") -endif() +list(APPEND MUPARSERX_FLAGS -DBUILD_EXAMPLES:BOOL=OFF) -# We provide a zip archive of last muparserx release (3.0.5) -# Archive was generated using commit sha on muparserx github page -# Commands to create source archive: -# wget https://github.com/beltoforion/muparserx/archive/2ace83b5411f1ab9940653c2bab0efa5140efb71.zip -# mv 2ace83b5411f1ab9940653c2bab0efa5140efb71.zip muparserx_v3_0_5.zip +if(MSVC AND BUILD_SHARED_LIBS) + list(APPEND MUPARSERX_FLAGS -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS:BOOL=ON) +endif() ExternalProject_Add(MUPARSERX PREFIX MUPARSERX - URL "https://www.orfeo-toolbox.org/packages/muparserx_v3_0_5.zip" - URL_MD5 ad86b88c159ab68f4bfc99d71166e3c5 + URL "https://github.com/beltoforion/muparserx/archive/v4.0.7.zip" + URL_MD5 67819fc478436ea8f647c804e6f2e1a2 BINARY_DIR ${MUPARSERX_SB_BUILD_DIR} INSTALL_DIR ${SB_INSTALL_PREFIX} DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - CMAKE_CACHE_ARGS ${SB_CMAKE_CACHE_ARGS} ${MUPARSERX_FLAGS} + CMAKE_CACHE_ARGS + ${SB_CMAKE_CACHE_ARGS} + ${MUPARSERX_FLAGS} CMAKE_COMMAND ${SB_CMAKE_COMMAND} DEPENDS ${MUPARSERX_DEPENDENCIES} - PATCH_COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_SOURCE_DIR}/patches/MUPARSERX/CMakeLists.txt - ${MUPARSERX_SB_SRC} - UPDATE_COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_SOURCE_DIR}/patches/MUPARSERX/mpParserMessageProvider.cpp - ${MUPARSERX_SB_SRC}/parser/ ) -SUPERBUILD_UPDATE_CMAKE_VARIABLES(MUPARSERX FALSE) \ No newline at end of file +#Patch mpParserMessageProvider.cpp. This patch is integrated upstream but not yet released (last release is 4.0.7) +SUPERBUILD_PATCH_SOURCE(MUPARSERX) + +SUPERBUILD_UPDATE_CMAKE_VARIABLES(MUPARSERX FALSE muparserx muparserx) diff --git a/SuperBuild/CMake/SuperBuild_Macro.cmake b/SuperBuild/CMake/SuperBuild_Macro.cmake index cabeeec69e7811f2b207b062b89f3e33b236163a..66438bd05befef7dbf82bd13c202ee0d70ffd1d5 100644 --- a/SuperBuild/CMake/SuperBuild_Macro.cmake +++ b/SuperBuild/CMake/SuperBuild_Macro.cmake @@ -148,16 +148,16 @@ endmacro(SUPERBUILD_PATCH_SOURCE) macro(SUPERBUILD_UPDATE_CMAKE_VARIABLES PROJECT with_prefix) - if("${ARGV3}" STREQUAL "") + if("${ARGV2}" STREQUAL "") string(TOLOWER ${PROJECT} lib_file_we) else() - set(lib_file_we "${ARGV3}") + set(lib_file_we "${ARGV2}") endif() - if("${ARGV4}" STREQUAL "") + if("${ARGV3}" STREQUAL "") set(include_dir "include") else() - set(include_dir "include/${ARGV4}") + set(include_dir "include/${ARGV3}") endif() if(WIN32) diff --git a/SuperBuild/CMake/post_install.cmake b/SuperBuild/CMake/post_install.cmake new file mode 100644 index 0000000000000000000000000000000000000000..d81b3004b5a4aac648a416648a2dd0db191e9e8e --- /dev/null +++ b/SuperBuild/CMake/post_install.cmake @@ -0,0 +1,22 @@ +set(file_list) +file(GLOB file_list "${PATCH_DIR}/*.cmake") +foreach(cmake_file ${file_list}) + file(STRINGS "${cmake_file}" MATCH_FOUND REGEX "${MATCH}") + if(MATCH_FOUND) + file(STRINGS "${cmake_file}" cmake_file_CONTENTS NEWLINE_CONSUME) + set(CODE_SNIPPET "get_filename_component(DEPS_INSTALL_DIR \"$${}{CMAKE_CURRENT_LIST_FILE}\" PATH)") + if (PATH_STRIP_COUNT LESS 1) + set(PATH_STRIP_COUNT 2) + endif() + foreach(loop_var RANGE 1 ${PATH_STRIP_COUNT}) + set(CODE_SNIPPET "${CODE_SNIPPET} \nget_filename_component(DEPS_INSTALL_DIR \"$${}{DEPS_INSTALL_DIR}\" PATH)" ) + endforeach() + string(REPLACE "${MATCH}" "$${}{DEPS_INSTALL_DIR}" cmake_file_CONTENTS_NEW ${cmake_file_CONTENTS}) + file(WRITE "${cmake_file}" "# This file is modified by OTB after installation. + \n# For example, see POST_INSTALL_* step in OTB/SuperBuild/CMake/External_itk.cmake + \n# BEGIN CODE BLOCK FROM OTB SUPERBUILD + \n${CODE_SNIPPET} + \n# END CODE BLOCK FROM OTB SUPERBUILD + \n${cmake_file_CONTENTS_NEW}") + endif() +endforeach() #foreach(cmake_file diff --git a/SuperBuild/Packaging/Files/linux_pkgsetup.in b/SuperBuild/Packaging/Files/linux_pkgsetup.in index 0204d79256e0f6deeae30d4bc8ddcc9c40d99b34..7b4b6b8237cf1b157957aeed5f026cd67db2c981 100644 --- a/SuperBuild/Packaging/Files/linux_pkgsetup.in +++ b/SuperBuild/Packaging/Files/linux_pkgsetup.in @@ -14,8 +14,8 @@ PATCH_ELF_EXE="$OUT_DIR/patchelf" LD_LIBRARY_PATH= echo "Configuring..." -#BINARY_FILES="@VAR_IN_PKGSETUP_CONFIGURE@" -BINARY_FILES=$(find $OUT_DIR/lib $OUT_DIR/lib/otb/applications $OUT_DIR/bin -maxdepth 1 -type f -exec file {} \; | grep -i elf|cut -f1 -d':') +#see next call below for otb applications +BINARY_FILES=$(find $OUT_DIR/lib $OUT_DIR/bin -maxdepth 1 -type f -exec file {} \; | grep -i elf|cut -f1 -d':') # run patchelf for bin_file in $BINARY_FILES; do @@ -27,11 +27,21 @@ done I_AM_XDK=@IS_XDK@ -if [ "$I_AM_XDK" = true ] ; then - sed -i "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@PKG_ITK_SB_VERSION@/Modules/ITKZLIB.cmake - sed -i "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@PKG_ITK_SB_VERSION@/ITKConfig.cmake - sed -i "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@PKG_ITK_SB_VERSION@/ITKTargets-release.cmake -else +# if [ "$I_AM_XDK" = true ] ; then +# sed -i "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@PKG_ITK_SB_VERSION@/Modules/ITKZLIB.cmake +# sed -i "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@PKG_ITK_SB_VERSION@/ITKConfig.cmake +# sed -i "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@PKG_ITK_SB_VERSION@/ITKTargets-release.cmake +# else + +if [ "$I_AM_XDK" = false ] ; then +OTB_APP_FILES=$(find $OUT_DIR/lib/otb/applications -maxdepth 1 -type f -exec file {} \; | grep -i elf|cut -f1 -d':') + # run patchelf +for app_file in $OTB_APP_FILES; do + #echo "adding rpath to $app_file" + if [ -f "$app_file" ]; then + "$PATCH_ELF_EXE" "--set-rpath" "$OUT_DIR/lib" "$app_file" + fi +done cat > "$OUT_DIR/monteverdi.sh" << EOF #!/bin/sh diff --git a/SuperBuild/Packaging/Files/macx_pkgsetup.in b/SuperBuild/Packaging/Files/macx_pkgsetup.in index 8c35f329a10151a2c41a11146490d7363b1e4017..cf06288424309db3e65925854854f55a7e7783c6 100755 --- a/SuperBuild/Packaging/Files/macx_pkgsetup.in +++ b/SuperBuild/Packaging/Files/macx_pkgsetup.in @@ -47,16 +47,16 @@ SHORT_VERSION_STRING=@Monteverdi_VERSION_MAJOR@.@Monteverdi_VERSION_MINOR@ I_AM_XDK=@IS_XDK@ -if [ "$I_AM_XDK" = true ] ; then - - sed -i "" "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@PKG_ITK_SB_VERSION@/Modules/ITKZLIB.cmake - sed -i "" "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@PKG_ITK_SB_VERSION@/ITKConfig.cmake - sed -i "" "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@PKG_ITK_SB_VERSION@/ITKTargets-release.cmake -else +# if [ "$I_AM_XDK" = true ] ; then +# sed -i "" "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@PKG_ITK_SB_VERSION@/Modules/ITKZLIB.cmake +# sed -i "" "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@PKG_ITK_SB_VERSION@/ITKConfig.cmake +# sed -i "" "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@PKG_ITK_SB_VERSION@/ITKTargets-release.cmake +# else +if [ "$I_AM_XDK" = false ] ; then rm -fr "Mapla.app" rm -fr "Monteveridi.app" - + mkdir -p "Mapla.app/Contents/MacOS" mkdir -p "Mapla.app/Contents/Resources" mkdir -p "Monteverdi.app/Contents/MacOS" diff --git a/SuperBuild/Packaging/InstallSupportFiles.cmake b/SuperBuild/Packaging/InstallSupportFiles.cmake index 68883e2b5b2bd0567a6d526a7022ad2dd6789f09..dab10f56ac31f1796e57804e79a6c2b669255971 100644 --- a/SuperBuild/Packaging/InstallSupportFiles.cmake +++ b/SuperBuild/Packaging/InstallSupportFiles.cmake @@ -47,45 +47,30 @@ function(func_install_xdk_files) endif() endforeach() - file(GLOB LIB_CMAKE_DIRS "${DEPENDENCIES_INSTALL_DIR}/lib/cmake/*") - foreach(LIB_CMAKE_DIR ${LIB_CMAKE_DIRS}) - get_filename_component(LIB_CMAKE_DIR_name_we ${LIB_CMAKE_DIR} NAME_WE) - if(NOT "${LIB_CMAKE_DIR_name_we}" MATCHES "OTB") - func_install_without_message("${LIB_CMAKE_DIR}" "lib/cmake") - endif() + file(GLOB ITK_CMAKE_DIRS "${DEPENDENCIES_INSTALL_DIR}/lib/cmake/ITK*") + foreach(ITK_CMAKE_DIR ${ITK_CMAKE_DIRS}) + func_install_without_message("${ITK_CMAKE_DIR}" "lib/cmake") endforeach() set(QT_REQ_DIRS) if(WIN32) #only affects windows due to regex on dll + #.lib are not taken when processing dependencies. + # We just get .dlls which is enough for binary package + # For XDK, we need .lib files when building OTB using xdk + # For Linux. we get .so.X.Y.Z by finding the 'target' + # of any .so file. So there is no need for such a copy on + # Linux and OSX if(MSVC) file(GLOB LIB_FILES "${DEPENDENCIES_INSTALL_DIR}/lib/*.lib") else() file(GLOB LIB_FILES "${DEPENDENCIES_INSTALL_DIR}/lib/*dll.*") endif() - #func_lisp(LIB_FILES ) foreach(LIB_FILE ${LIB_FILES}) pkg_install_rule(${LIB_FILE}) endforeach() - - ##install(FILES ${LIB_FILES} DESTINATION ${PKG_STAGE_DIR}/lib ) - - #file(GLOB ITK_EXTRA_DLL_FILES_1 "${DEPENDENCIES_INSTALL_DIR}/bin/libITK*.dll") - #install(FILES ${ITK_EXTRA_DLL_FILES_1} DESTINATION ${PKG_STAGE_DIR}/bin) - - #file(GLOB ITK_EXTRA_DLL_FILES_2 "${DEPENDENCIES_INSTALL_DIR}/bin/libitk*.dll") - #install(FILES ${ITK_EXTRA_DLL_FILES_2} DESTINATION ${PKG_STAGE_DIR}/bin) - - #file(GLOB OPENCV_EXTRA_DLL_FILES "${DEPENDENCIES_INSTALL_DIR}/bin/libopencv*.dll") - #install(FILES ${OPENCV_EXTRA_DLL_FILES} DESTINATION ${PKG_STAGE_DIR}/bin) - - #file(GLOB OPENCV_EXTRA_A_FILES "${DEPENDENCIES_INSTALL_DIR}/lib/libopencv*.a") - #install(FILES ${OPENCV_EXTRA_A_FILES} DESTINATION ${PKG_STAGE_DIR}/lib) - - #mxe installs qt in a separate directory under install prefix. So.. - set(QT_INSTALL_DIR "${DEPENDENCIES_INSTALL_DIR}/qt") - + #qt/bin is also a special case for mxe. file(GLOB QT_EXTRA_DLL_FILES "${DEPENDENCIES_INSTALL_DIR}/qt/bin/*.dll") install(FILES ${QT_EXTRA_DLL_FILES} DESTINATION ${PKG_STAGE_DIR}/bin) @@ -94,16 +79,13 @@ function(func_install_xdk_files) list(APPEND QT_REQ_DIRS include) list(APPEND QT_REQ_DIRS imports) + #mxe installs qt in a separate directory under install prefix. So.. + set(QT_INSTALL_DIR "${DEPENDENCIES_INSTALL_DIR}/qt") else() - set( - QT_INSTALL_DIR "${DEPENDENCIES_INSTALL_DIR}") + set(QT_INSTALL_DIR "${DEPENDENCIES_INSTALL_DIR}") endif(WIN32) - if(NOT QT_EXECUTABLES) - message(FATAL_ERROR "QT_EXECUTABLES not set") - endif() - list(APPEND QT_REQ_DIRS mkspecs) list(APPEND QT_REQ_DIRS plugins) list(APPEND QT_REQ_DIRS translations) diff --git a/SuperBuild/Packaging/PackageHelper.cmake b/SuperBuild/Packaging/PackageHelper.cmake index 98ef69549dd167ea50d5c739f208958e5dfdf81c..dcb07fd2cbd55c33347770739ebc0bde8d84bd40 100644 --- a/SuperBuild/Packaging/PackageHelper.cmake +++ b/SuperBuild/Packaging/PackageHelper.cmake @@ -52,6 +52,23 @@ macro(macro_super_package) include(GetPrerequisites) set(LOADER_PROGRAM_ARGS ${loader_program_args}) + + set(DEST_LIB_DIR lib) + set(DEST_BIN_DIR bin) + set(DEST_APP_DIR lib/otb/applications) + set(EXE_EXT "") + set(SCR_EXT ".sh") + set(LIB_EXT ".so") + set(PYMODULE_EXT ".so") + if(WIN32) + set(EXE_EXT ".exe") + set(LIB_EXT ".dll") + set(SCR_EXT ".bat") + set(PYMODULE_EXT ".pyd") + set(DEST_LIB_DIR bin) + elseif(APPLE) + set(LIB_EXT ".dylib") + endif() # find_loader_and_args(LOADER_PROGRAM LOADER_PROGRAM_ARGS) @@ -109,20 +126,14 @@ macro(macro_super_package) list(APPEND PKG_SEARCHDIRS "${OTB_APPLICATIONS_DIR}") #otb apps list(APPEND PKG_SEARCHDIRS "${OTB_INSTALL_DIR}/lib/otb/python") #otbApplication.py - set(EXE_SEARCHDIRS ${OTB_INSTALL_DIR}/bin) - list(APPEND EXE_SEARCHDIRS ${DEPENDENCIES_INSTALL_DIR}/bin) + if(PKG_GENERATE_XDK) + list(APPEND PKG_SEARCHDIRS ${OTB_BINARY_DIR}/bin) + endif() macro_empty_package_staging_directory() set(PKG_PEFILES) - set(QT_EXECUTABLES) - list(APPEND QT_EXECUTABLES "lrelease") - list(APPEND QT_EXECUTABLES "moc") - list(APPEND QT_EXECUTABLES "qmake") - list(APPEND QT_EXECUTABLES "rcc") - list(APPEND QT_EXECUTABLES "uic") - func_prepare_package() set(program_list) @@ -201,73 +212,70 @@ endmacro(macro_super_package) function(func_prepare_package) - set(DEST_LIB_DIR lib) - set(DEST_BIN_DIR bin) - set(DEST_APP_DIR lib/otb/applications) - set(EXE_EXT "") - set(SCR_EXT ".sh") - set(LIB_EXT ".so") - set(PYMODULE_EXT ".so") - if(WIN32) - set(EXE_EXT ".exe") - set(LIB_EXT ".dll") - set(SCR_EXT ".bat") - set(PYMODULE_EXT ".pyd") - set(DEST_LIB_DIR bin) - elseif(APPLE) - set(LIB_EXT ".dylib") - endif() + file(WRITE ${CMAKE_BINARY_DIR}/make_symlinks_temp "") #This must exist in any OTB Installation. minimal or full - set(PKG_PEFILES "${OTB_INSTALL_DIR}/bin/otbApplicationLauncherCommandLine${EXE_EXT}") + #set(PKG_PEFILES "${OTB_INSTALL_DIR}/bin/otbApplicationLauncherCommandLine${EXE_EXT}") if(NOT EXISTS "${OTB_INSTALL_DIR}/bin/otbApplicationLauncherCommandLine${EXE_EXT}") message( FATAL_ERROR "${OTB_INSTALL_DIR}/bin/otbApplicationLauncherCommandLine${EXE_EXT} not found.") endif() + + set(PKG_PEFILES "otbApplicationLauncherCommandLine${EXE_EXT}") - set(EXE_FILES) - list(APPEND EXE_FILES "otbApplicationLauncherQt") - list(APPEND EXE_FILES "iceViewer") - list(APPEND EXE_FILES "otbTestDriver") - + foreach(exe_file + "otbApplicationLauncherQt" "iceViewer" "otbTestDriver" "monteverdi" "mapla") + if(EXISTS "${OTB_INSTALL_DIR}/bin/${exe_file}${EXE_EXT}") + list(APPEND PKG_PEFILES "${exe_file}${EXE_EXT}") + else() + message(STATUS "${exe_file}${EXE_EXT} not found in ${OTB_INSTALL_DIR}/bin. (skipping)") + endif() + endforeach() + if(PKG_GENERATE_XDK) - #itk - list(APPEND EXE_FILES "itkTestDriver") #Qt stuff - list(APPEND EXE_FILES ${QT_EXECUTABLES}) + list(APPEND PKG_PEFILES "lrelease${EXE_EXT}") + list(APPEND PKG_PEFILES "moc${EXE_EXT}") + list(APPEND PKG_PEFILES "qmake${EXE_EXT}") + list(APPEND PKG_PEFILES "rcc${EXE_EXT}") + list(APPEND PKG_PEFILES "uic${EXE_EXT}") + list(APPEND PKG_PEFILES "sharkVersion${EXE_EXT}") + list(APPEND PKG_PEFILES "proj${EXE_EXT}") + list(APPEND PKG_PEFILES "cs2cs${EXE_EXT}") + + #RK: there is a bug in itk cmake files in install tree + #we workaround with below code + #start hack + file(GLOB itk_lib_files + "${DEPENDENCIES_INSTALL_DIR}/bin/itk*${LIB_EXT}" + "${DEPENDENCIES_INSTALL_DIR}/bin/ITK*${LIB_EXT}" + ) + foreach(itk_lib_file ${itk_lib_files}) + if(NOT EXISTS "${itk_lib_file}") + message(FATAL_ERROR "{itk_lib_file} does not exist") + endif() + list(APPEND PKG_PEFILES "${itk_lib_file}") + endforeach() + #end hack + + file(GLOB otb_test_exe_list + "${DEPENDENCIES_INSTALL_DIR}/bin/gdal*${EXE_EXT}" + "${OTB_BINARY_DIR}/bin/*Test*${EXE_EXT}" + ) + foreach(otb_test_exe ${otb_test_exe_list}) + get_filename_component(otb_test_exe_name ${otb_test_exe} NAME) + list(APPEND PKG_PEFILES ${otb_test_exe_name}) + endforeach() endif() - list(APPEND EXE_FILES "monteverdi") - list(APPEND EXE_FILES "mapla") - - foreach(EXE_FILE ${EXE_FILES}) - set(FOUND_${EXE_FILE} FALSE) - foreach(EXE_SEARCHDIR ${EXE_SEARCHDIRS}) - if(NOT FOUND_${EXE_FILE}) - if(EXISTS "${EXE_SEARCHDIR}/${EXE_FILE}${EXE_EXT}") - set(FOUND_${EXE_FILE} TRUE) - list(APPEND PKG_PEFILES "${EXE_SEARCHDIR}/${EXE_FILE}${EXE_EXT}") - endif() - endif() #(NOT FOUND_${EXE_FILE}) - endforeach() #EXE_SEARCH_DIR - endforeach() - # special case for msvc: ucrtbase.dll must be explicitly vetted. if(MSVC AND NOT PKG_GENERATE_XDK) list(APPEND PKG_PEFILES "ucrtbase.dll") endif() - #loop again to report if anything is not found - foreach( EXE_FILE ${EXE_FILES} ) - if(NOT FOUND_${EXE_FILE}) - message(STATUS "'${OTB_INSTALL_DIR}/bin/${EXE_FILE}${EXE_EXT}'(not found. skipping)") - endif() - endforeach() - - file(GLOB OTB_APPS_LIST "${OTB_APPLICATIONS_DIR}/otbapp_*${LIB_EXT}") # /lib/otb list(APPEND PKG_PEFILES ${OTB_APPS_LIST}) @@ -307,7 +315,6 @@ function(func_prepare_package) endfunction() #func_prepare_package function(func_process_deps input_file) - search_library(${input_file} PKG_SEARCHDIRS input_file_full_path) if(NOT input_file_full_path) message(FATAL_ERROR "${input_file} not found. searched in ${PKG_SEARCHDIRS}") @@ -455,9 +462,11 @@ function(pkg_install_rule src_file) message(FATAL_ERROR "unreachable code") endif() + set(SKIP_INSTALL FALSE) setif_value_in_list(is_gtk_lib "${src_file_NAME}" ALLOWED_SYSTEM_DLLS) if(is_gtk_lib) set(output_dir "lib/gtk") + set(SKIP_INSTALL TRUE) endif() #special case @@ -465,20 +474,17 @@ function(pkg_install_rule src_file) set(output_dir "lib/otb/applications") set(file_type PROGRAMS) endif() - - set(SKIP_INSTALL FALSE) + if(PKG_GENERATE_XDK) if ("${src_file_NAME}" MATCHES - "libOTB|libotb|otbApp|otbapp_|otbTest|libMonteverdi|monteverdi|mapla|iceViewer" + "([Oo][Tt][Bb])|([Mm]onteverdi)|mapla|iceViewer" ) set(SKIP_INSTALL TRUE) + + message("SKIP_INSTALL for ${src_file_NAME}") endif() - if(is_gtk_lib) - set(SKIP_INSTALL TRUE) - endif() - endif() if(NOT SKIP_INSTALL) diff --git a/SuperBuild/Packaging/PackageMacros.cmake b/SuperBuild/Packaging/PackageMacros.cmake index 9cd0783d2891b611cd5616683655d5ae5d100a1a..a2283f28807f9ef8f6b9ac45788ea8b2b5fef2f5 100755 --- a/SuperBuild/Packaging/PackageMacros.cmake +++ b/SuperBuild/Packaging/PackageMacros.cmake @@ -75,12 +75,32 @@ function(search_library input_file pkg_searchdirs result) endfunction() macro(add_to_symlink_list src_file target_file) + #TODO: avoid code duplication here and later in install_rule + + set(SKIP_INSTALL FALSE) + if(PKG_GENERATE_XDK) + get_filename_component(src_file_NAME ${src_file} NAME) + setif_value_in_list(is_gtk_lib "${src_file_NAME}" ALLOWED_SYSTEM_DLLS) + if ("${src_file_NAME}" + MATCHES + "libOTB|libotb|otbApp|otbapp_|otbTest|libMonteverdi|monteverdi|mapla|iceViewer" + ) + set(SKIP_INSTALL TRUE) + endif() + + if(is_gtk_lib) + set(SKIP_INSTALL TRUE) + endif() + + endif(PKG_GENERATE_XDK) # NOTE: $OUT_DIR is set actually in pkgsetup.in. So don't try # any pre-mature optimization on that variable names + if(NOT SKIP_INSTALL) file(APPEND ${CMAKE_BINARY_DIR}/make_symlinks_temp - "ln -sf $OUT_DIR/lib/${src_file} $OUT_DIR/lib/${target_file}\n" - ) + "if [ -f \"\$OUT_DIR/lib/${src_file}\" ]; then \n ln -sf \"$OUT_DIR/lib/${src_file}\" \"$OUT_DIR/lib/${target_file}\" \n fi;\n" + ) + endif() endmacro() function(check_for_gtk_libs input_file result) diff --git a/SuperBuild/patches/ITK/itk-2-fix_cmake-all.diff b/SuperBuild/patches/ITK/itk-2-fix_cmake-all.diff deleted file mode 100755 index a441101893ca4645f4b5397aee4d6e9e47fb50a6..0000000000000000000000000000000000000000 --- a/SuperBuild/patches/ITK/itk-2-fix_cmake-all.diff +++ /dev/null @@ -1,35 +0,0 @@ -diff -burN InsightToolkit-4.10.0.orig/Modules/ThirdParty/VNL/src/CMakeLists.txt InsightToolkit-4.10.0/Modules/ThirdParty/VNL/src/CMakeLists.txt ---- InsightToolkit-4.10.0.orig/Modules/ThirdParty/VNL/src/CMakeLists.txt 2016-11-23 15:59:11.409392257 +0100 -+++ InsightToolkit-4.10.0/Modules/ThirdParty/VNL/src/CMakeLists.txt 2016-11-23 16:26:47.185472392 +0100 -@@ -18,7 +18,7 @@ - # Retrive the variable type to CACHE. - set(BUILD_EXAMPLES ${BUILD_EXAMPLES} CACHE BOOL "Build the examples from the ITK Software Guide." FORCE) - --foreach(lib itkvcl itkv3p_netlib itktestlib itkvnl itkvnl_algo itknetlib) -+foreach(lib itkvcl itkv3p_netlib itkvnl itkvnl_algo itknetlib) - itk_module_target(${lib} NO_INSTALL) - endforeach() - -diff -burN InsightToolkit-4.10.0.orig/Modules/ThirdParty/ZLIB/CMakeLists.txt InsightToolkit-4.10.0/Modules/ThirdParty/ZLIB/CMakeLists.txt ---- InsightToolkit-4.10.0.orig/Modules/ThirdParty/ZLIB/CMakeLists.txt 2016-11-23 15:59:11.421392257 +0100 -+++ InsightToolkit-4.10.0/Modules/ThirdParty/ZLIB/CMakeLists.txt 2016-11-23 16:26:35.889471845 +0100 -@@ -6,14 +6,12 @@ - - if(ITK_USE_SYSTEM_ZLIB) - find_package(ZLIB REQUIRED) -- set(ITKZLIB_INCLUDE_DIRS -- ${ITKZLIB_BINARY_DIR}/src -- ) -- set(ITKZLIB_SYSTEM_INCLUDE_DIRS -- ${ZLIB_INCLUDE_DIRS} -- ) -- set(ITKZLIB_LIBRARIES "${ZLIB_LIBRARIES}") - set(ITKZLIB_NO_SRC 1) -+ set(ITKZLIB_EXPORT_CODE_BUILD -+"set(ITKZLIB_INCLUDE_DIRS \"${ITKZLIB_BINARY_DIR}/src;${ZLIB_INCLUDE_DIRS}\" ) -+set(ITKZLIB_LIBRARIES \"${ZLIB_LIBRARIES}\") -+") -+set(ITKZLIB_EXPORT_CODE_INSTALL "find_package(ZLIB REQUIRED)") - else() - set(ITKZLIB_INCLUDE_DIRS - ${ITKZLIB_BINARY_DIR}/src diff --git a/SuperBuild/patches/MUPARSERX/CMakeLists.txt b/SuperBuild/patches/MUPARSERX/CMakeLists.txt deleted file mode 100644 index 70ee71d29c7fddf6c64c1ba1c906fe8a39c98b75..0000000000000000000000000000000000000000 --- a/SuperBuild/patches/MUPARSERX/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -cmake_minimum_required(VERSION 2.8.3) - -project(muparserx) - -# Set a default build type if none was specified -if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - message(STATUS "Setting build type to 'Release' as none was specified.") - set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) - # Set the possible values of build type for cmake-gui - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") -endif() - -option(BUILD_SHARED_LIBS "Building shared libs. Default is ON" ON) - -if(MSVC AND BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -endif() - -file(GLOB MUPARSERX_SRCS "parser/*.cpp" ) -file(GLOB MUPARSERX_HEADERS "parser/*.h") -# avoid noxious mpCompat.h -list(REMOVE_ITEM MUPARSERX_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/parser/mpCompat.h") - - -add_library(muparserx ${MUPARSERX_SRCS}) - -option(BUILD_SAMPLES "Build sample executable" ON) -include_directories(parser) -add_executable(muparserx-sample sample/timer.cpp sample/example.cpp) -target_link_libraries(muparserx-sample muparserx) - -install(TARGETS muparserx - RUNTIME DESTINATION bin COMPONENT RuntimeLibraries - LIBRARY DESTINATION lib COMPONENT RuntimeLibraries - ARCHIVE DESTINATION lib COMPONENT Development) - -install(FILES ${MUPARSERX_HEADERS} - DESTINATION include - COMPONENT Development) diff --git a/SuperBuild/patches/MUPARSERX/mpParserMessageProvider.cpp b/SuperBuild/patches/MUPARSERX/mpParserMessageProvider.cpp deleted file mode 100644 index dbd442743a97a76782f8441f653d27141f2e63e5..0000000000000000000000000000000000000000 --- a/SuperBuild/patches/MUPARSERX/mpParserMessageProvider.cpp +++ /dev/null @@ -1,181 +0,0 @@ -#include "mpParserMessageProvider.h" -#include <cassert> -#include "mpError.h" - - -MUP_NAMESPACE_START - - //------------------------------------------------------------------------------------------------- - // - // class ParserMessageProviderBase - Base class for message providers - // - //------------------------------------------------------------------------------------------------- - - ParserMessageProviderBase::ParserMessageProviderBase() - :m_vErrMsg(0) - {} - - //----------------------------------------------------------------------------------------------- - ParserMessageProviderBase::~ParserMessageProviderBase() - {} - - //----------------------------------------------------------------------------------------------- - void ParserMessageProviderBase::Init() - { - InitErrorMessages(); - for (int i=0; i<ecCOUNT; ++i) - { - if (!m_vErrMsg[i].length()) - throw std::runtime_error("Incomplete translation (at least one error code missing)"); - } - } - - //--------------------------------------------------------------------------------------------- - string_type ParserMessageProviderBase::GetErrorMsg(EErrorCodes eError) const - { - int nError = (int)eError; - return (nError<(int)m_vErrMsg.size()) ? m_vErrMsg[nError] : string_type(); - } - - //----------------------------------------------------------------------------------------------- - // - // class ParserMessageProviderEnglish - English Parser Messages (default) - // - //----------------------------------------------------------------------------------------------- - - ParserMessageProviderEnglish::ParserMessageProviderEnglish() - :ParserMessageProviderBase() - {} - - //----------------------------------------------------------------------------------------------- - void ParserMessageProviderEnglish::InitErrorMessages() - { - m_vErrMsg.resize(ecCOUNT); - - m_vErrMsg[ecUNASSIGNABLE_TOKEN] = _T("Undefined token \"$IDENT$\" found at position $POS$."); - m_vErrMsg[ecINTERNAL_ERROR] = _T("Internal error."); - m_vErrMsg[ecUNKNOWN_ESCAPE_SEQUENCE] = _T("Unknown escape sequence."); - m_vErrMsg[ecINVALID_NAME] = _T("Invalid function, variable or constant name."); - m_vErrMsg[ecINVALID_FUN_PTR] = _T("Invalid pointer to callback function."); - m_vErrMsg[ecINVALID_VAR_PTR] = _T("Invalid pointer to variable."); - m_vErrMsg[ecUNEXPECTED_OPERATOR] = _T("Unexpected operator \"$IDENT$\" found at position $POS$."); - m_vErrMsg[ecUNEXPECTED_EOF] = _T("Unexpected end of expression found at position $POS$."); - m_vErrMsg[ecUNEXPECTED_COMMA] = _T("Unexpected comma found at position $POS$."); - m_vErrMsg[ecUNEXPECTED_PARENS] = _T("Unexpected parenthesis \"$IDENT$\" found at position $POS$."); - m_vErrMsg[ecUNEXPECTED_FUN] = _T("Unexpected function \"$IDENT$\" found at position $POS$."); - m_vErrMsg[ecUNEXPECTED_VAL] = _T("Unexpected value \"$IDENT$\" found at position $POS$."); - m_vErrMsg[ecUNEXPECTED_VAR] = _T("Unexpected variable \"$IDENT$\" found at position $POS$."); - m_vErrMsg[ecUNEXPECTED_STR] = _T("Unexpected string token found at position $POS$."); - m_vErrMsg[ecUNEXPECTED_CONDITIONAL] = _T("The \"$IDENT$\" operator must be preceded by a closing bracket."); - m_vErrMsg[ecUNEXPECTED_NEWLINE] = _T("Unexprected newline."); - m_vErrMsg[ecMISSING_PARENS] = _T("Missing parenthesis."); - m_vErrMsg[ecMISSING_ELSE_CLAUSE] = _T("If-then-else operator is missing an else clause."); - m_vErrMsg[ecMISPLACED_COLON] = _T("Misplaced colon at position $POS$."); - m_vErrMsg[ecTOO_MANY_PARAMS] = _T("Too many parameters passed to function \"$IDENT$\"."); - m_vErrMsg[ecTOO_FEW_PARAMS] = _T("Too few parameters passed to function \"$IDENT$\"."); - m_vErrMsg[ecDIV_BY_ZERO] = _T("Division by zero occurred."); - m_vErrMsg[ecDOMAIN_ERROR] = _T("The value passed as argument to function/operator \"$IDENT$\" is not part of its domain."); - m_vErrMsg[ecNAME_CONFLICT] = _T("Name conflict."); - m_vErrMsg[ecOPT_PRI] = _T("Invalid value for operator priority (must be greater or equal to zero)."); - m_vErrMsg[ecBUILTIN_OVERLOAD] = _T("Binary operator identifier conflicts with a built in operator."); - m_vErrMsg[ecUNTERMINATED_STRING] = _T("Unterminated string starting at position $POS$."); - m_vErrMsg[ecSTRING_EXPECTED] = _T("String function called with a non string type of argument."); - m_vErrMsg[ecVAL_EXPECTED] = _T("Numerical function called with a non value type of argument."); - m_vErrMsg[ecTYPE_CONFLICT] = _T("Value \"$IDENT$\" is of type '$TYPE1$'. There is no implicit conversion to type '$TYPE2$'."); - m_vErrMsg[ecTYPE_CONFLICT_FUN] = _T("Argument $ARG$ of function/operator \"$IDENT$\" is of type '$TYPE1$' whereas type '$TYPE2$' was expected."); - m_vErrMsg[ecTYPE_CONFLICT_IDX] = _T("Index to \"$IDENT$\" must be a positive integer value. '$TYPE1$' is not an acceptable type."); - m_vErrMsg[ecGENERIC] = _T("Parser error."); - m_vErrMsg[ecINVALID_TYPE] = _T("Invalid argument type."); - m_vErrMsg[ecINVALID_TYPECAST] = _T("Value type conversion from type '$TYPE1$' to '$TYPE2$' is not supported!"); - m_vErrMsg[ecARRAY_SIZE_MISMATCH] = _T("Array size mismatch."); - m_vErrMsg[ecNOT_AN_ARRAY] = _T("Using the index operator on the scalar variable \"$IDENT$\" is not allowed."); - m_vErrMsg[ecUNEXPECTED_SQR_BRACKET] = _T("Unexpected \"[]\"."); - m_vErrMsg[ecUNEXPECTED_CURLY_BRACKET] = _T("Unexpected \"{}\"."); - m_vErrMsg[ecINDEX_OUT_OF_BOUNDS] = _T("Index to variable \"$IDENT$\" is out of bounds."); - m_vErrMsg[ecINDEX_DIMENSION] = _T("Index operator dimension error."); - m_vErrMsg[ecMISSING_SQR_BRACKET] = _T("Missing \"]\"."); - m_vErrMsg[ecMISSING_CURLY_BRACKET] = _T("Missing \"}\"."); - m_vErrMsg[ecASSIGNEMENT_TO_VALUE] = _T("Assignment operator \"$IDENT$\" can't be used in this context."); - m_vErrMsg[ecEVAL] = _T("Can't evaluate function/operator \"$IDENT$\": $HINT$"); - m_vErrMsg[ecINVALID_PARAMETER] = _T("Parameter $ARG$ of function \"$IDENT$\" is invalid."); - m_vErrMsg[ecINVALID_NUMBER_OF_PARAMETERS] = _T("Invalid number of function arguments."); - m_vErrMsg[ecOVERFLOW] = _T("Possible arithmetic overflow occurred in function/operator \"$IDENT$\"."); - m_vErrMsg[ecMATRIX_DIMENSION_MISMATCH] = _T("Matrix dimension error."); - m_vErrMsg[ecVARIABLE_DEFINED] = _T("Variable \"$IDENT$\" is already defined."); - m_vErrMsg[ecCONSTANT_DEFINED] = _T("Constant \"$IDENT$\" is already defined."); - m_vErrMsg[ecFUNOPRT_DEFINED] = _T("Function/operator \"$IDENT$\" is already defined."); - } - -#if defined(_UNICODE) - - //------------------------------------------------------------------------------------------------- - // - // class ParserMessageProviderGerman - German translations of Parser Messages - // - //------------------------------------------------------------------------------------------------- - - ParserMessageProviderGerman::ParserMessageProviderGerman() - :ParserMessageProviderBase() - {} - - //----------------------------------------------------------------------------------------------- - void ParserMessageProviderGerman::InitErrorMessages() - { - m_vErrMsg.resize(ecCOUNT); - - m_vErrMsg[ecUNASSIGNABLE_TOKEN] = _T("Unbekanntes Token \"$IDENT$\" an Position $POS$ gefunden."); - m_vErrMsg[ecINTERNAL_ERROR] = _T("Interner Fehler."); - m_vErrMsg[ecUNKNOWN_ESCAPE_SEQUENCE] = _T("Unbekannte Escape-Sequenz."); - m_vErrMsg[ecINVALID_NAME] = _T("Ungültiger Funktions-, Variablen- oder Konstantenbezeichner."); - m_vErrMsg[ecINVALID_FUN_PTR] = _T("Ungültiger Zeiger auf eine Callback-Funktion."); - m_vErrMsg[ecINVALID_VAR_PTR] = _T("Ungültiger Variablenzeiger."); - m_vErrMsg[ecUNEXPECTED_OPERATOR] = _T("Unerwarteter Operator \"$IDENT$\" an Position $POS$."); - m_vErrMsg[ecUNEXPECTED_EOF] = _T("Unerwartetes Formelende an Position $POS$."); - m_vErrMsg[ecUNEXPECTED_COMMA] = _T("Unerwartetes Komma an Position $POS$."); - m_vErrMsg[ecUNEXPECTED_PARENS ] = _T("Unerwartete Klammer \"$IDENT$\" an Position $POS$ gefunden."); - m_vErrMsg[ecUNEXPECTED_FUN] = _T("Unerwartete Funktion \"$IDENT$\" an Position $POS$ gefunden."); - m_vErrMsg[ecUNEXPECTED_VAL] = _T("Unerwarteter Wert \"$IDENT$\" an Position $POS$ gefunden."); - m_vErrMsg[ecUNEXPECTED_VAR] = _T("Unerwartete Variable \"$IDENT$\" an Position $POS$ gefunden."); - m_vErrMsg[ecUNEXPECTED_STR] = _T("Unerwarteter Text an Position $POS$ gefunden."); - m_vErrMsg[ecUNEXPECTED_CONDITIONAL] = _T("Der Operator \"$IDENT$\" muss stets auf eine schließenden Klammer folgen."); - m_vErrMsg[ecUNEXPECTED_NEWLINE] = _T("Unerwarteter Zeilenumbruch."); - m_vErrMsg[ecMISSING_PARENS] = _T("Fehlende Klammer."); - m_vErrMsg[ecMISSING_ELSE_CLAUSE] = _T("\"If-then-else\" Operator ohne \"else\" Zweig verwendet."); - m_vErrMsg[ecMISPLACED_COLON] = _T("Komma an unerwarteter Position $POS$ gefunden."); - m_vErrMsg[ecTOO_MANY_PARAMS] = _T("Der Funktion \"$IDENT$\" wurden zu viele Argumente übergeben."); - m_vErrMsg[ecTOO_FEW_PARAMS] = _T("Der Funktion \"$IDENT$\" wurden nicht genug Argumente übergeben."); - m_vErrMsg[ecDIV_BY_ZERO] = _T("Division durch Null."); - m_vErrMsg[ecDOMAIN_ERROR] = _T("Der Parameter der Funktion \"$IDENT$\" hat einen Wert, der nicht Teil des Definitionsbereiches der Funktion ist."); - m_vErrMsg[ecNAME_CONFLICT] = _T("Namenskonflikt"); - m_vErrMsg[ecOPT_PRI] = _T("Ungültige Operatorpriorität (muss größer oder gleich Null sein)."); - m_vErrMsg[ecBUILTIN_OVERLOAD] = _T("Die Überladung für diesen Binäroperator steht im Widerspruch zu intern vorhanden operatoren."); - m_vErrMsg[ecUNTERMINATED_STRING] = _T("Die Zeichenkette an Position $POS$ wird nicht beendet."); - m_vErrMsg[ecSTRING_EXPECTED] = _T("Es wurde eine Zeichenkette als Funktionseingabewert erwartet."); - m_vErrMsg[ecVAL_EXPECTED] = _T("Numerische Funktionen können nicht mit nichtnumerischen Parametern aufgerufen werden."); - m_vErrMsg[ecTYPE_CONFLICT] = _T("Der Wert \"$IDENT$\" ist vom Typ '$TYPE1$' und es gibt keine passende Typkonversion in den erwarteten Typ '$TYPE2$'."); - m_vErrMsg[ecTYPE_CONFLICT_FUN] = _T("Das Argument $ARG$ der Funktion oder des Operators \"$IDENT$\" ist vom Typ '$TYPE1$', erwartet wurde Typ '$TYPE2$'."); - m_vErrMsg[ecTYPE_CONFLICT_IDX] = _T("Der Index der Variable \"$IDENT$\" muss ein positiver Ganzzahlwert sein. Der übergebene Indexwert ist vom Typ '$TYPE1$'."); - m_vErrMsg[ecGENERIC] = _T("Allgemeiner Parser Fehler."); - m_vErrMsg[ecINVALID_TYPE] = _T("Ungültiger Funktionsargumenttyp."); - m_vErrMsg[ecINVALID_TYPECAST] = _T("Umwandlungen vom Typ '$TYPE1$' in den Typ '$TYPE2$' werden nicht unterstützt!"); - m_vErrMsg[ecARRAY_SIZE_MISMATCH] = _T("Feldgrößen stimmen nicht überein."); - m_vErrMsg[ecNOT_AN_ARRAY] = _T("Der Indexoperator kann nicht auf die Skalarvariable \"$IDENT$\" angewandt werden."); - m_vErrMsg[ecUNEXPECTED_SQR_BRACKET] = _T("Eckige Klammern sind an dieser Position nicht erlaubt."); - m_vErrMsg[ecUNEXPECTED_CURLY_BRACKET] = _T("Geschweifte Klammern sind an dieser Position nicht erlaubt."); - m_vErrMsg[ecINDEX_OUT_OF_BOUNDS] = _T("Indexüberschreitung bei Variablenzugriff auf \"$IDENT$\"."); - m_vErrMsg[ecINDEX_DIMENSION] = _T("Die Operation kann nicht auf Felder angewandt werden, deren Größe unterschiedlich ist."); - m_vErrMsg[ecMISSING_SQR_BRACKET] = _T("Fehlendes \"]\"."); - m_vErrMsg[ecMISSING_CURLY_BRACKET] = _T("Fehlendes \"}\"."); - m_vErrMsg[ecASSIGNEMENT_TO_VALUE] = _T("Der Zuweisungsoperator \"$IDENT$\" kann in diesem Zusammenhang nicht verwendet werden."); - m_vErrMsg[ecEVAL] = _T("Die Funktion bzw. der Operator \"$IDENT$\" kann nicht berechnet werden: $HINT$"); - m_vErrMsg[ecINVALID_PARAMETER] = _T("Der Parameter $ARG$ der Funktion \"$IDENT$\" is ungültig."); - m_vErrMsg[ecINVALID_NUMBER_OF_PARAMETERS] = _T("Unzulässige Zahl an Funktionsparametern."); - m_vErrMsg[ecOVERFLOW] = _T("Ein arithmetische Überlauf wurde in Funktion/Operator \"$IDENT$\" entdeckt."); - m_vErrMsg[ecMATRIX_DIMENSION_MISMATCH] = _T("Matrixdimensionen stimmen nicht überein, Operation \"$IDENT$\" kann nicht ausgeführt werden."); - m_vErrMsg[ecVARIABLE_DEFINED] = _T("Die Variable \"$IDENT$\" is bereits definiert."); - m_vErrMsg[ecCONSTANT_DEFINED] = _T("Die Konstante \"$IDENT$\" is bereits definiert."); - m_vErrMsg[ecFUNOPRT_DEFINED] = _T("Ein Element mit der Bezeichnung \"$IDENT$\" ist bereits definiert."); - } -#endif // _UNICODE - -MUP_NAMESPACE_END diff --git a/SuperBuild/patches/MUPARSERX/muparserx-1-fixes-all.diff b/SuperBuild/patches/MUPARSERX/muparserx-1-fixes-all.diff new file mode 100644 index 0000000000000000000000000000000000000000..7fa0eb4e9ee5a21f52b3d47759390e056cd565b6 --- /dev/null +++ b/SuperBuild/patches/MUPARSERX/muparserx-1-fixes-all.diff @@ -0,0 +1,20 @@ +diff --git a/parser/mpParserMessageProvider.cpp b/parser/mpParserMessageProvider.cpp +index 22534e6..dbd4427 100644 +--- a/parser/mpParserMessageProvider.cpp ++++ b/parser/mpParserMessageProvider.cpp +@@ -1,5 +1,4 @@ +-#include "mpParserMessageProvider.h" +- ++#include "mpParserMessageProvider.h" + #include <cassert> + #include "mpError.h" + +@@ -111,7 +110,7 @@ MUP_NAMESPACE_START + + //------------------------------------------------------------------------------------------------- + // +- // class ParserMessageProviderGerman - German translations of Parser Messages ++ // class ParserMessageProviderGerman - German translations of Parser Messages + // + //------------------------------------------------------------------------------------------------- + diff --git a/SuperBuild/patches/MUPARSERX/muparserx-2-fixes-all.diff b/SuperBuild/patches/MUPARSERX/muparserx-2-fixes-all.diff new file mode 100644 index 0000000000000000000000000000000000000000..8d621bf29d5544be035671d8a6f32241cdf305e9 --- /dev/null +++ b/SuperBuild/patches/MUPARSERX/muparserx-2-fixes-all.diff @@ -0,0 +1,22 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9cd37d6..7964e22 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -18,7 +18,7 @@ set(MUPARSERX_VERSION ${CMAKE_MATCH_1}) + ######################################################################## + # Compiler specific flags + ######################################################################## +-if(CMAKE_COMPILER_IS_GNUCXX) ++if(CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) + + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") +@@ -33,7 +33,7 @@ if(CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") + endif() + +-endif(CMAKE_COMPILER_IS_GNUCXX) ++endif(CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) + + #enable c++11 extensions for OSX + if (APPLE) diff --git a/SuperBuild/patches/OSSIM/ossim-4-trac_2354-linux.diff b/SuperBuild/patches/OSSIM/ossim-4-trac_2354-linux.diff new file mode 100755 index 0000000000000000000000000000000000000000..b24dd823a006acb884d677fe3956224538f38619 --- /dev/null +++ b/SuperBuild/patches/OSSIM/ossim-4-trac_2354-linux.diff @@ -0,0 +1,51 @@ +Description: Fix build failure with GCC 6: no match for 'operator<<'. +Author: Rashad M <rashadkm@gmail.com> +Origin: https://trac.osgeo.org/ossim/attachment/ticket/2354/fix-ossim-trac-2354.diff +Bug-Debian: https://bugs.debian.org/811851 +Bug: https://trac.osgeo.org/ossim/ticket/2354 + +--- a/ossim/src/ossim/elevation/ossimElevManager.cpp ++++ b/ossim/src/ossim/elevation/ossimElevManager.cpp +@@ -643,14 +643,26 @@ std::ostream& ossimElevManager::print(os + << "\nm_useGeoidIfNullFlag = "<<m_useGeoidIfNullFlag + << "\nm_currentDatabaseIdx = "<<m_currentDatabaseIdx + << "\nm_dbRoundRobin.size = "<<m_dbRoundRobin.size(); ++ + for (ossim_uint32 i=0; i<m_dbRoundRobin.size(); ++i) + { + out<<"\nm_dbRoundRobin["<<i<<"].size = "<<m_dbRoundRobin[i].size()<<endl; + for (ossim_uint32 j=0; j<m_dbRoundRobin[i].size(); ++j) +- out<<"m_dbRoundRobin["<<i<<"]["<<j<<"] = "<<m_dbRoundRobin[i][j]->print(out)<<endl; ++ { ++ out<<"m_dbRoundRobin["<<i<<"]["<<j<<"] = "; ++ // GP: We have to separate this line. On MS it will not compile ++ // otherwise ++ m_dbRoundRobin[i][j]->print(out); ++ ++ } ++ out<<endl; + } +- cout<<"\n"<<ossimElevSource::print(cout); ++ out<<"\n"; ++ ossimElevSource::print(out); + return out; ++ ++ ++ + } + + +--- a/ossim/src/ossim/elevation/ossimElevSource.cpp ++++ b/ossim/src/ossim/elevation/ossimElevSource.cpp +@@ -269,8 +269,9 @@ std::ostream& ossimElevSource::print(std + << "\ntheMaxHeightAboveMSL = "<<theMaxHeightAboveMSL + << "\ntheNullHeightValue = "<<theNullHeightValue + << "\ntheSeaLevelValue = "<<theSeaLevelValue +- << "\ntheGroundRect = "<<theGroundRect +- << ossimSource::print(out); ++ << "\ntheGroundRect = "<<theGroundRect; ++ // GP: need this by itself. MS errors out ++ ossimSource::print(out); + return out; + } + diff --git a/SuperBuild/patches/QT4/qt4-3-force-std98-linux.diff b/SuperBuild/patches/QT4/qt4-3-force-std98-linux.diff new file mode 100755 index 0000000000000000000000000000000000000000..9baf1895663471b0671a44ee622f274259cc7603 --- /dev/null +++ b/SuperBuild/patches/QT4/qt4-3-force-std98-linux.diff @@ -0,0 +1,12 @@ +diff -burN qt-everywhere-opensource-src-4.8.7.orig/mkspecs/common/linux.conf qt-everywhere-opensource-src-4.8.7/mkspecs/common/linux.conf +--- qt-everywhere-opensource-src-4.8.7.orig/mkspecs/common/linux.conf 2016-12-07 11:19:59.964124979 +0100 ++++ qt-everywhere-opensource-src-4.8.7/mkspecs/common/linux.conf 2016-12-07 11:22:29.116132748 +0100 +@@ -1,7 +1,7 @@ + # + # qmake configuration for common linux + # +- ++QMAKE_CXXFLAGS += -w -std=c++98 + QMAKE_CFLAGS_THREAD += -D_REENTRANT + QMAKE_CXXFLAGS_THREAD += $$QMAKE_CFLAGS_THREAD + diff --git a/Utilities/Data/Icons/edit-clear.png b/Utilities/Data/Icons/edit-clear.png new file mode 100644 index 0000000000000000000000000000000000000000..e6c8e8b9f341cbf3a1795631ccaafd14b0e0c911 Binary files /dev/null and b/Utilities/Data/Icons/edit-clear.png differ diff --git a/Utilities/Maintenance/TravisBuild.cmake b/Utilities/Maintenance/TravisBuild.cmake index c0790ff2dde01f25af6d4c7f5cd7ff2b06892ed1..b5eab4f09366c725baf79bfd5a6f0aa6bae32fd5 100644 --- a/Utilities/Maintenance/TravisBuild.cmake +++ b/Utilities/Maintenance/TravisBuild.cmake @@ -57,17 +57,17 @@ OTB_USE_QT4:BOOL=ON OTB_USE_OPENGL:BOOL=ON OTB_USE_GLEW:BOOL=ON CMAKE_C_FLAGS:STRING=-Wextra -CMAKE_CXX_FLAGS:STRING=-Wextra -Wno-gnu-static-float-init -Wno-\\#warnings +CMAKE_CXX_FLAGS:STRING=-Wextra -Wno-gnu-static-float-init -Wno-\\#warnings -std=c++11 CMAKE_BUILD_TYPE=${CTEST_BUILD_CONFIGURATION} QT_INSTALL_TRANSLATIONS:PATH=${XDK_INSTALL_DIR}/translations QT_MOC_EXECUTABLE:FILEPATH=${XDK_INSTALL_DIR}/bin/moc QT_UIC_EXECUTABLE:FILEPATH=${XDK_INSTALL_DIR}/bin/uic QT_RCC_EXECUTABLE:FILEPATH=${XDK_INSTALL_DIR}/bin/rcc +QT_LRELEASE_EXECUTABLE:FILEPATH=${XDK_INSTALL_DIR}/bin/lrelease QT_INSTALL_PLUGINS:PATH=${XDK_INSTALL_DIR}/plugins QT_INSTALL_HEADERS:PATH=${XDK_INSTALL_DIR}/include QMAKE_MKSPECS:PATH=${XDK_INSTALL_DIR}/mkspecs " - ) file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" ${INITIAL_CACHE})