diff --git a/CMake/FindGBenchmark.cmake b/CMake/FindGBenchmark.cmake index ed2a3674dcba34c43edf2bac0f7025ba585587fa..72d79260fb289a583396214a29e002539835328e 100644 --- a/CMake/FindGBenchmark.cmake +++ b/CMake/FindGBenchmark.cmake @@ -4,10 +4,11 @@ # GBENCHMARK_LIBRARY - gbenchmark library file # GBENCHMARK_FOUND - TRUE if gbenchmark is found -if (GBENCHMARK_INCLUDE_DIR) - #check cache - set(GBENCHMARK_FIND_QUIETLY TRUE) -endif () +set(GBENCHMARK_FIND_QUIETLY TRUE) +# if (GBENCHMARK_INCLUDE_DIR) +# #check cache +# set(GBENCHMARK_FIND_QUIETLY TRUE) +# endif () if (NOT GBENCHMARK_INCLUDE_DIR) find_path(GBENCHMARK_INCLUDE_DIR NAMES benchmark.h PATH_SUFFIXES benchmark) 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/Documentation/SoftwareGuide/Latex/Installation.tex b/Documentation/SoftwareGuide/Latex/Installation.tex index 89a801fa95a5f672abb435cd709c32f580808117..52136bbe04b2f4c93b379924d8b27c02a5060e9e 100644 --- a/Documentation/SoftwareGuide/Latex/Installation.tex +++ b/Documentation/SoftwareGuide/Latex/Installation.tex @@ -251,25 +251,22 @@ Therefore this directory will be used even if you don't use make install target. In fact there is no make install target for the SuperBuild. By default, SuperBuild will not use any of libraries installed on -system. All \texttt{USE\_SYSTEM\_\textit{XXX}} are are set to FALSE. This is our +system. All \texttt{USE\_SYSTEM\_\textit{XXX}} are set to FALSE. This is our recommended way of using SuperBuild. You are however free to use a system library if you want!. You must be very much aware of dependencies of those libraries you use from system. For example, if libjpeg is not used from -superbuild using \texttt{USE\_SYSTEM\_JPEG=TRUE} then you should not use zlib -from superbuild because zlib is a dependency of libjpeg. Here SuperBuild will -not automagically set \texttt{USE\_SYSTEM\_ZLIB=FALSE}. You must do it -yourself. The example of libjpeg - zlib dependency chain is so simple. Imagine -the same case for GDAL which depends on zlib, libjpeg, libtiff(with big tiff +superbuild then you should not use zlib from superbuild because zlib is a dependency of libjpeg. +Here SuperBuild will NOT set \texttt{USE\_SYSTEM\_ZLIB=FALSE}. One must re-run cmake +with \texttt{-DUSE\_SYSTEM\_ZLIB=FALSE}. +Above example of libjpeg-zlib dependency is so simple. Imagine +the case for GDAL which depends on zlib, libjpeg, libtiff(with big tiff support), geotiff, sqlite, curl, geos, libkml, openjpeg. This is one of the -reasons we recommend to use SuperBuild exclusively or not. +reasons we recommend to use SuperBuild exclusively. All dependencies are configured and built in a way that help us to get an efficient build OTB. So we enable geotiff (with proj4 support), openjpeg, geos in GDAL build. -It is also important to note that SuperBuild is tested daily on all three -platforms. It simply works! - (see table~\ref{tab:installation-cmake-variables}). SuperBuild downloads dependencies into the \texttt{DOWNLOAD\_LOCATION} @@ -285,6 +282,20 @@ want to build) : \url{https://www.orfeo-toolbox.org/packages} \end{center} +Qt library: Unlike other dependencies building Qt4 on all platform is not trivial task but +OTB SuperBuild makes best effort to make it easier for you. So there is still +some additional package installation, one has to do as a pre-requistie for SuperBuild +On a GNU/Linux you must have Qt X11 dependencies installed. +See Qt 4.8 documentation for list of packages that needs to be installed +before starting superbuild. http://doc.qt.io/qt-4.8/requirements-x11.html +For a debian 8.1 systeme, I installed all Qt4 dependencies with below 'apt-get install' +\texttt{apt-get install libx11-dev libxext-dev libxt-dev libxi-dev libxrandr-dev libgl-dev libglu-dev} + +You can also deactivate QT4 and skip this by passing \texttt{-DOTB\_USE\_QT4=OFF} to cmake. +This will give you OTB install without monteverdi, mapla and gui application launchers. + +For Mac OSX you need to install XCode and Windows 7,8.1,10 requires MSVC 2015 or higher. + You are now ready to compile OTB! Simply use the make command (other targets can be generated with CMake's \texttt{-G} option): \begin{verbatim} diff --git a/Modules/Applications/AppSegmentation/app/otbMeanShiftSmoothing.cxx b/Modules/Applications/AppSegmentation/app/otbMeanShiftSmoothing.cxx index c69ec3f1475c44852e8165140fb040a7863ed28b..fc92d2c17e1e9ff19bceacae246f80a272916c75 100644 --- a/Modules/Applications/AppSegmentation/app/otbMeanShiftSmoothing.cxx +++ b/Modules/Applications/AppSegmentation/app/otbMeanShiftSmoothing.cxx @@ -101,7 +101,7 @@ private: AddParameter(ParameterType_Empty, "modesearch", "Mode search."); SetParameterDescription("modesearch", "If activated pixel iterative convergence is stopped if the path crosses an already converged pixel. Be careful, with this option, the result will slightly depend on thread number"); - EnableParameter("modesearch"); + DisableParameter("modesearch"); // Doc example parameter settings diff --git a/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.txx b/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.txx index 50d39f72857d3ee05bd69be74d6e488b16295677..aa3dbe452d340d63e6113b8fda1f5b3fa05dc192 100644 --- a/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.txx +++ b/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.txx @@ -38,7 +38,7 @@ MeanShiftSmoothingImageFilter<TInputImage, TOutputImage, TKernel, TOutputIterati , m_NumberOfComponentsPerPixel(0) // , m_JointImage(0) // , m_ModeTable(0) - , m_ModeSearch(true) + , m_ModeSearch(false) , m_ThreadIdNumberOfBits(0) #if 0 , m_BucketOptimization(false) diff --git a/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.txx b/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.txx index 9c4de263463dfb2ace173423bc4bc19dd5c05253..85785e1399880f4b103060d10040e4e69aaa665a 100644 --- a/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.txx +++ b/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.txx @@ -115,15 +115,25 @@ NeighborhoodMajorityVotingImageFilter<TInputImage, TOutputImage, histoNeigh[label] += 1; } } - HistoAsVectorType histoNeighVec(histoNeigh.begin(), histoNeigh.end()); - //Sort the 2 max elements to the beginning - std::nth_element(histoNeighVec.begin(), histoNeighVec.begin()+1, - histoNeighVec.end(), CompareHistoFequencies()); typename NeighborhoodMajorityVotingImageFilter<TInputImage, TOutputImage, TKernel>::HistoSummary result; - result.freqCenterLabel = histoNeigh[nit.GetCenterPixel()]; - result.majorityLabel = histoNeighVec[0].first; - result.majorityUnique = (histoNeighVec[0].second != histoNeighVec[1].second); + assert(!histoNeigh.empty()); + if (histoNeigh.size() == 1) + { + result.freqCenterLabel = histoNeigh.begin()->second; + result.majorityLabel = histoNeigh.begin()->first; + result.majorityUnique = true; + } + else + { + HistoAsVectorType histoNeighVec(histoNeigh.begin(), histoNeigh.end()); + //Sort the 2 max elements to the beginning + std::nth_element(histoNeighVec.begin(), histoNeighVec.begin()+1, + histoNeighVec.end(), CompareHistoFequencies()); + result.freqCenterLabel = histoNeigh[nit.GetCenterPixel()]; + result.majorityLabel = histoNeighVec[0].first; + result.majorityUnique = (histoNeighVec[0].second != histoNeighVec[1].second); + } return result; } 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/OpenGL/CMakeLists.txt b/Modules/ThirdParty/OpenGL/CMakeLists.txt index 229a923888aabf9f36c6ee8a7db0688c36e973c7..2f1a2c799ffb50f502cc7b5dc346ea2cc1cf33a4 100644 --- a/Modules/ThirdParty/OpenGL/CMakeLists.txt +++ b/Modules/ThirdParty/OpenGL/CMakeLists.txt @@ -2,6 +2,6 @@ project(OTBOpenGL) set(OTBOpenGL_THIRD_PARTY 1) set(OTBOpenGL_SYSTEM_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR}) -set(OTBOpenGL_LIBRARIES ${OPENGL_LIBRARY}) +set(OTBOpenGL_LIBRARIES ${OPENGL_LIBRARIES}) otb_module_impl() diff --git a/Modules/ThirdParty/OpenGL/otb-module-init.cmake b/Modules/ThirdParty/OpenGL/otb-module-init.cmake index b3819dad16edeffe7e74c1ee3f54348af7715ac9..32cb2d0e985ec2d3bdc569b0c3d8e6012fb93112 100644 --- a/Modules/ThirdParty/OpenGL/otb-module-init.cmake +++ b/Modules/ThirdParty/OpenGL/otb-module-init.cmake @@ -1,7 +1,18 @@ #detection of OpenGL is apply is bit tricy as we deactivate #framework on OSX globally. see mantis #1193 if(APPLE) - set(OPENGL_FOUND FALSE) + set( OPENGL_FOUND FALSE ) + set( OPENGL_GLU_FOUND FALSE) + + set( OPENGL_INCLUDE_DIR) + set( OPENGL_LIBRARIES) + + find_path( + OPENGL_INCLUDE_DIR OpenGL/gl.h + PATHS "/System/Library/Frameworks/" + DOC "Include for OpenGL on OSX" + ) + find_library( OPENGL_gl_LIBRARY OpenGL PATHS "/System/Library/Frameworks/" @@ -14,44 +25,39 @@ if(APPLE) DOC "AGL lib for OSX" ) - find_path( - OPENGL_INCLUDE_DIR OpenGL/gl.h - PATHS "/System/Library/Frameworks/" - DOC "Include for OpenGL on OSX" - ) - - if(OPENGL_gl_LIBRARY) - set( OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY} ${OPENGL_LIBRARIES}) - if(OPENGL_glu_LIBRARY) - set( OPENGL_GLU_FOUND "YES" ) - set( OPENGL_LIBRARIES ${OPENGL_glu_LIBRARY} ${OPENGL_LIBRARIES} ) - else() - set( OPENGL_GLU_FOUND "NO" ) - endif() - # This deprecated setting is for backward compatibility with CMake1.4 - set (OPENGL_LIBRARY ${OPENGL_LIBRARIES}) + if( OPENGL_gl_LIBRARY ) + set( OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY}) + set( OPENGL_FOUND TRUE ) + endif() + if( OPENGL_glu_LIBRARY ) + set( OPENGL_GLU_FOUND TRUE) + set( OPENGL_LIBRARIES ${OPENGL_LIBRARIES} ${OPENGL_glu_LIBRARY} ) endif() - # This deprecated setting is for backward compatibility with CMake1.4 - set(OPENGL_INCLUDE_PATH ${OPENGL_INCLUDE_DIR}) mark_as_advanced( OPENGL_INCLUDE_DIR - OPENGL_LIBRARY + OPENGL_LIBRARIES OPENGL_glu_LIBRARY OPENGL_gl_LIBRARY ) - if(NOT OPENGL_LIBRARY OR NOT OPENGL_INCLUDE_DIR) - message(FATAL_ERROR "Cannot find OpenGL. Set OPENGL_INCLUDE_DIR and OPENGL_LIBRARY") - else() - message(STATUS "Found OpenGL framework: ${OPENGL_INCLUDE_DIR}") - endif() - - set(OPENGL_FOUND TRUE) else(APPLE) find_package(OpenGL REQUIRED) mark_as_advanced(OPENGL_INCLUDE_DIR) - mark_as_advanced(OPENGL_LIBRARY) - if(NOT OPENGL_FOUND) - message(FATAL_ERROR "Cannot find OpenGL. Set OPENGL_INCLUDE_DIR and OPENGL_LIBRARY") - endif() + mark_as_advanced(OPENGL_LIBRARIES) endif(APPLE) + + +if(NOT OPENGL_INCLUDE_DIR) + if(NOT WIN32) + message(FATAL_ERROR "Could not find OpenGL (missing: OPENGL_INCLUDE_DIR") + endif() +endif() + +if(NOT OPENGL_gl_LIBRARY) + message(FATAL_ERROR "Could not find OpenGL (missing: OPENGL_gl_LIBRARY") +endif() + +if(NOT OPENGL_glu_LIBRARY) + message(FATAL_ERROR "Could not find OpenGL (missing: OPENGL_glu_LIBRARY") +endif() + 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/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/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/mvdColorDynamicsWidget.h b/Modules/Visualization/MonteverdiGui/include/mvdColorDynamicsWidget.h index 3182a3ed839a5e3929f5c7679705d97fe368b3d0..fe9d894eb960c5876b52158eeb5cfa2e5d302b37 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdColorDynamicsWidget.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdColorDynamicsWidget.h @@ -323,6 +323,8 @@ private slots: /** */ void on_gammaSlider_valueChanged( int gamma ); + + void on_gammaResetButton_clicked(); }; } // end 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/src/CMakeLists.txt b/Modules/Visualization/MonteverdiGui/src/CMakeLists.txt index b61d29567f45f623bba298c9b47424a6f5664589..99b784c31cde245689d7ff2ed7f1e46aefaa256e 100644 --- a/Modules/Visualization/MonteverdiGui/src/CMakeLists.txt +++ b/Modules/Visualization/MonteverdiGui/src/CMakeLists.txt @@ -120,7 +120,7 @@ set( OTBMonteverdiGUI_FORMS ############################################################################# set( OTBMonteverdiGUI_RESOURCES - # mvdIcons.qrc + mvdIcons.qrc ) ############################################################################# diff --git a/Modules/Visualization/MonteverdiGui/src/mvdColorDynamicsWidget.cxx b/Modules/Visualization/MonteverdiGui/src/mvdColorDynamicsWidget.cxx index 4b3c384fb828d2cbbeabf33d552d3f7ac3d58f6f..0e0daa80227a1d5ccd49e004029d1a79ec0c5c30 100644 --- a/Modules/Visualization/MonteverdiGui/src/mvdColorDynamicsWidget.cxx +++ b/Modules/Visualization/MonteverdiGui/src/mvdColorDynamicsWidget.cxx @@ -454,4 +454,11 @@ ColorDynamicsWidget QToolTip::showText(mapToGlobal(m_UI->gammaSlider->pos()),tr("Gamma: ") % QString::number(GetGamma()) ); } +void +ColorDynamicsWidget +::on_gammaResetButton_clicked() +{ + this->SetGamma(1.0); +} + } // end namespace 'mvd' diff --git a/Modules/Visualization/MonteverdiGui/src/mvdColorDynamicsWidget.ui b/Modules/Visualization/MonteverdiGui/src/mvdColorDynamicsWidget.ui index be9da912997b37ba6f8daf33d82df399ee04060b..f09efce079e9c67f448d3329bff418abe4c5628a 100644 --- a/Modules/Visualization/MonteverdiGui/src/mvdColorDynamicsWidget.ui +++ b/Modules/Visualization/MonteverdiGui/src/mvdColorDynamicsWidget.ui @@ -158,6 +158,17 @@ </property> </widget> </item> + <item> + <widget class="QToolButton" name="gammaResetButton"> + <property name="toolTip"> + <string>Reset value to 1.</string> + </property> + <property name="icon"> + <iconset resource="mvdIcons.qrc"> + <normaloff>:/Utilities/Data/Icons/view-refresh.png</normaloff>:/Utilities/Data/Icons/view-refresh.png</iconset> + </property> + </widget> + </item> </layout> </widget> </item> @@ -307,23 +318,8 @@ <tabstop>noDataLineEdit</tabstop> <tabstop>noDataButton</tabstop> </tabstops> - <resources/> - <connections> - <connection> - <sender>noDataCheckBox</sender> - <signal>toggled(bool)</signal> - <receiver>noDataLineEdit</receiver> - <slot>setEnabled(bool)</slot> - <hints> - <hint type="sourcelabel"> - <x>49</x> - <y>23</y> - </hint> - <hint type="destinationlabel"> - <x>100</x> - <y>24</y> - </hint> - </hints> - </connection> - </connections> + <resources> + <include location="mvdIcons.qrc"/> + </resources> + <connections/> </ui> diff --git a/Modules/Visualization/MonteverdiGui/src/mvdIcons.qrc b/Modules/Visualization/MonteverdiGui/src/mvdIcons.qrc index 835ed7133726a2cc2d89f0f6b2f5cba01b3c3314..71dcbd6cc583cd95802a97770cd23af425261822 100644 --- a/Modules/Visualization/MonteverdiGui/src/mvdIcons.qrc +++ b/Modules/Visualization/MonteverdiGui/src/mvdIcons.qrc @@ -3,5 +3,7 @@ <file>../../../../Utilities/Data/Icons/execute.png</file> <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/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/Wrappers/ApplicationEngine/include/otbWrapperApplication.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h index 30c94b15ead947d1467caa8021fe8fb359b8121e..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" @@ -747,6 +748,8 @@ public: m_IsInXMLParsed = false; } + double GetLastExecutionTiming() const; + protected: /** Constructor */ Application(); @@ -908,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/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 4079584493c50f6e473f5a04d92b5329d88913be..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; } @@ -1641,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/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/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/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/otbWrapperQtWidgetParameterLabel.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterLabel.cxx index 5ca4d2595d7b282f584df8790df03c498f5a3a91..13eb52a04e55b8d9a38b665be0c5828b876abc2c 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterLabel.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterLabel.cxx @@ -28,7 +28,7 @@ QtWidgetParameterLabel::QtWidgetParameterLabel(Parameter* param) QLabel *label = new QLabel; label->setText(param->GetName()); - label->setToolTip(param->GetName()); + label->setToolTip(param->GetKey()); QVBoxLayout *labelLayout = new QVBoxLayout; labelLayout->setSpacing(0); 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 eeb4890698dbd497d8a6688f0aba797bd7df4c78..3656406966aac86f476e10b1b9bcfd9b6d937136 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/SuperBuild/CMake/External_itk.cmake b/SuperBuild/CMake/External_itk.cmake index 203615e3227b1f5da56770d133656e68abeb3bc6..8f0c9e404ab39d46206ccc2d57e23b3f7f79c893 100644 --- a/SuperBuild/CMake/External_itk.cmake +++ b/SuperBuild/CMake/External_itk.cmake @@ -162,6 +162,13 @@ 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) + +set(DIR_LIST "${SB_INSTALL_PREFIX}/lib/cmake/ITK-4.10|${SB_INSTALL_PREFIX}/lib/cmake/ITK-4.10/Modules") +ExternalProject_Add_Step(ITK POST_INSTALL + COMMAND ${CMAKE_COMMAND} + -DP_DIRS=${DIR_LIST} + -DP_MATCH=${SB_INSTALL_PREFIX} + -DP_REPLACE=ITK_INSTALL_PREFIX + -P ${CMAKE_SOURCE_DIR}/CMake/post_install.cmake + DEPENDEES install) diff --git a/SuperBuild/CMake/External_libsvm.cmake b/SuperBuild/CMake/External_libsvm.cmake index 3c81b65c05365a8c8520e22e17ec2bc31bcf3e34..e385aa3c640a72aee6f0ca2637231982259c2628 100644 --- a/SuperBuild/CMake/External_libsvm.cmake +++ b/SuperBuild/CMake/External_libsvm.cmake @@ -4,8 +4,8 @@ SETUP_SUPERBUILD(LIBSVM) ExternalProject_Add(LIBSVM PREFIX LIBSVM - URL "http://www.csie.ntu.edu.tw/~cjlin/libsvm/libsvm-3.20.tar.gz" - URL_MD5 5f088e5f89da1c65b642300c9c5ea772 + URL "https://github.com/cjlin1/libsvm/archive/v320.tar.gz" + URL_MD5 b735fce96fc634f1d7e26b586181e1a4 BINARY_DIR ${LIBSVM_SB_BUILD_DIR} DOWNLOAD_DIR ${DOWNLOAD_LOCATION} INSTALL_DIR ${SB_INSTALL_PREFIX} diff --git a/SuperBuild/CMake/External_otb.cmake b/SuperBuild/CMake/External_otb.cmake index 12dc7ef53fec27ac738614b88b535849d24942cf..6720cf30b02a00b8f87fef34d7e66df36f901c97 100644 --- a/SuperBuild/CMake/External_otb.cmake +++ b/SuperBuild/CMake/External_otb.cmake @@ -201,6 +201,7 @@ ExternalProject_Add(OTB ${OTB_ADDITIONAL_CACHE} CMAKE_ARGS ${OTB_SB_CONFIG} CMAKE_COMMAND ${SB_CMAKE_COMMAND} + LOG_CONFIGURE 1 ) diff --git a/SuperBuild/CMake/External_proj.cmake b/SuperBuild/CMake/External_proj.cmake index ff30d40bb0db554c8f508c205690124d75f07640..032a58d986a3d948f5ed21451955915550133df8 100644 --- a/SuperBuild/CMake/External_proj.cmake +++ b/SuperBuild/CMake/External_proj.cmake @@ -18,6 +18,12 @@ if(MSVC) else() + if(APPLE) + set(PROJ_SB_ENV_CONFIGURE_CMD ${SB_ENV_CONFIGURE_CMD} LDFLAGS=-headerpad_max_install_names) + else() + set(PROJ_SB_ENV_CONFIGURE_CMD ${SB_ENV_CONFIGURE_CMD}) + endif() + ExternalProject_Add(PROJ PREFIX PROJ URL "http://download.osgeo.org/proj/proj-4.8.0.tar.gz" diff --git a/SuperBuild/CMake/post_install.cmake b/SuperBuild/CMake/post_install.cmake new file mode 100644 index 0000000000000000000000000000000000000000..e211e653fdbdc1cd8547569ff119dd4cc35d76b0 --- /dev/null +++ b/SuperBuild/CMake/post_install.cmake @@ -0,0 +1,15 @@ +string(REPLACE "|" ";" P_DIRS ${P_DIRS}) + +foreach( p_dir ${P_DIRS} ) +set(file_list) +file( GLOB file_list "${p_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) + string(REPLACE "${P_MATCH}" "$${}{${P_REPLACE}}" cmake_file_CONTENTS ${cmake_file_CONTENTS}) + file(WRITE "${cmake_file}" "# This file is modified by OTB after installation. + \n${cmake_file_CONTENTS}") + endif() +endforeach() # foreach( cmake_file +endforeach() # foreach( p_dir diff --git a/SuperBuild/Packaging/Files/linux_pkgsetup.in b/SuperBuild/Packaging/Files/linux_pkgsetup.in index eb98b9d2040269347df982650e1bcaaabae0b64b..7b4b6b8237cf1b157957aeed5f026cd67db2c981 100644 --- a/SuperBuild/Packaging/Files/linux_pkgsetup.in +++ b/SuperBuild/Packaging/Files/linux_pkgsetup.in @@ -27,12 +27,13 @@ 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 diff --git a/SuperBuild/Packaging/Files/macx_pkgsetup.in b/SuperBuild/Packaging/Files/macx_pkgsetup.in index 8c35f329a10151a2c41a11146490d7363b1e4017..2fda1e5436ae0b679ff868a8867b120927750f80 100755 --- a/SuperBuild/Packaging/Files/macx_pkgsetup.in +++ b/SuperBuild/Packaging/Files/macx_pkgsetup.in @@ -21,18 +21,10 @@ DYLD_LIBRARY_PATH= DYLD_FALLBACK_LIBRARY_PATH= echo "Configuring..." -# #BINARY_FILES="@VAR_IN_PKGSETUP_CONFIGURE@" -# # #add rpath to LC_RPATH using install_name_tool -# for bin_file in $BINARY_FILES; do -# #echo "adding rpath to $OUT_DIR/$bin_file" -# if [ -f "$OUT_DIR/$bin_file" ]; then -# $INSTALL_NAME_TOOL "-add_rpath" "$OUT_DIR/lib" "$OUT_DIR/$bin_file" -# fi -# done - -LIBRARY_FILES=$(find "$OUT_DIR/lib/otb/applications" "$OUT_DIR/lib" -maxdepth 1 -type f) + +LIBRARY_FILES=$(find "$OUT_DIR/lib" -maxdepth 1 -type f) EXE_FILES=$(find "$OUT_DIR/bin" -type f -exec file {} \; | grep -i "Mach-O*.*executable"|cut -d ':' -f1) -# run patchelf +# run install_name_tool for lib_file in $LIBRARY_FILES $EXE_FILES; do #echo "adding rpath to $OUT_DIR/$lib_file" if [ -f "$lib_file" ]; then @@ -47,16 +39,26 @@ 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 + OTB_APP_FILES=$(find "$OUT_DIR/lib/otb/applications" -maxdepth 1 -type f) + # run install_name_tool + for app_file in $OTB_APP_FILES; do + #echo "adding rpath to $app_file" + if [ -f "$app_file" ]; then + $INSTALL_NAME_TOOL "-add_rpath" "$OUT_DIR/lib" "$app_file" + fi + done + 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 c8dca6dc9b1a1b8b5195413df6be1c99eaf1f98b..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/itk*.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 0432a6d4379f54d955b73d57e1e751d42658768a..f6e670522f2c4aec213eacd7f0e86b216a7149c5 100644 --- a/SuperBuild/Packaging/PackageHelper.cmake +++ b/SuperBuild/Packaging/PackageHelper.cmake @@ -53,6 +53,26 @@ macro(macro_super_package) set(LOADER_PROGRAM_ARGS ${loader_program_args}) + set(DEST_BIN_DIR bin) + set(DEST_APP_DIR lib/otb/applications) + + set(LIB_PREFIX lib) + set(DEST_LIB_DIR lib) + set(EXE_EXT "") + set(SCR_EXT ".sh") + set(LIB_EXT ".so") + set(PYMODULE_EXT ".so") + if(WIN32) + set(LIB_PREFIX) + set(DEST_LIB_DIR bin) + set(EXE_EXT ".exe") + set(LIB_EXT ".dll") + set(SCR_EXT ".bat") + set(PYMODULE_EXT ".pyd") + elseif(APPLE) + set(LIB_EXT ".dylib") + endif() + # find_loader_and_args(LOADER_PROGRAM LOADER_PROGRAM_ARGS) find_python_soname(python_INSTALLED_SONAME) @@ -109,20 +129,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 +215,75 @@ 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 "proj${EXE_EXT}") + list(APPEND PKG_PEFILES "cs2cs${EXE_EXT}") + + #shark is optional + if(EXISTS "${DEPENDENCIES_INSTALL_DIR}/bin/sharkVersion${EXE_EXT}") + list(APPEND PKG_PEFILES "sharkVersion${EXE_EXT}") + endif() + + #RK: there is a bug in itk cmake files in install tree + #we workaround with below code + #start hack + file(GLOB itk_all_lib_files + "${DEPENDENCIES_INSTALL_DIR}/${DEST_LIB_DIR}/${LIB_PREFIX}itk*${LIB_EXT}*" + "${DEPENDENCIES_INSTALL_DIR}/${DEST_LIB_DIR}/${LIB_PREFIX}ITK*${LIB_EXT}*" + ) + + foreach(itk_lib_file ${itk_all_lib_files}) + func_is_file_a_symbolic_link("${itk_lib_file}" a_symlink itk_lib_file_target) + if(NOT a_symlink) + list(APPEND PKG_PEFILES "${itk_lib_file}") + endif() + 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}) @@ -313,46 +329,48 @@ function(func_process_deps input_file) endif() message("Processing ${input_file_full_path}") - - is_file_executable("${input_file_full_path}" is_executable) - if(is_executable) - file(APPEND ${CMAKE_BINARY_DIR}/install_to_${DEST_BIN_DIR} "${input_file_full_path}\n") - else(is_executable) + + set(is_executable FALSE) + is_file_executable2("${input_file_full_path}" is_executable) + if(NOT is_executable) + pkg_install_rule(${input_file_full_path}) + message("not is_executable ${input_file_full_path}") + return() + endif() #NOT is_executable + + if(UNIX) + # Deal with symlinks. + # For any valid symlinks, (see 'not_valid' below) + # we append ln -s source target commands to a file + # That file is executed during installation. + get_filename_component(bn_we ${input_file_full_path} NAME_WE) + get_filename_component(bn_path ${input_file_full_path} PATH) - if(UNIX) - # Deal with symlinks. - # For any valid symlinks, (see 'not_valid' below) - # we append ln -s source target commands to a file - # That file is executed during installation. - get_filename_component(bn_we ${input_file_full_path} NAME_WE) - get_filename_component(bn_path ${input_file_full_path} PATH) + file(GLOB sofiles "${bn_path}/${bn_we}*") + foreach(sofile ${sofiles}) + get_filename_component(basename_of_sofile ${sofile} NAME) + get_filename_component(sofile_ext ${sofile} EXT) + set(not_valid FALSE) + if( "${sofile_ext}" MATCHES ".la" + OR "${sofile_ext}" MATCHES ".prl" + OR "${sofile_ext}" MATCHES ".a" + OR IS_DIRECTORY "${sofile}" ) + set(not_valid TRUE) + endif() - file(GLOB sofiles "${bn_path}/${bn_we}*") - foreach(sofile ${sofiles}) - get_filename_component(basename_of_sofile ${sofile} NAME) - get_filename_component(sofile_ext ${sofile} EXT) - set(not_valid FALSE) - if( "${sofile_ext}" MATCHES ".la" - OR "${sofile_ext}" MATCHES ".prl" - OR "${sofile_ext}" MATCHES ".a" - OR IS_DIRECTORY "${sofile}" ) - set(not_valid TRUE) - endif() - - if(not_valid) - continue() - endif() - - func_is_file_a_symbolic_link("${sofile}" is_symlink linked_to_file) - - if(is_symlink) - add_to_symlink_list("${linked_to_file}" "${basename_of_sofile}") - endif() # is_symlink - - endforeach() + if(not_valid) + continue() + endif() + + func_is_file_a_symbolic_link("${sofile}" is_symlink linked_to_file) + + if(is_symlink) + add_to_symlink_list("${linked_to_file}" "${basename_of_sofile}") + endif() # is_symlink + + endforeach() - endif(UNIX) - endif(is_executable) + endif(UNIX) set(raw_items) @@ -474,11 +492,9 @@ function(pkg_install_rule src_file) ) set(SKIP_INSTALL TRUE) -message("SKIP_INSTALL for ${src_file_NAME}") + message("SKIP_INSTALL for ${src_file_NAME}") endif() - - endif() if(NOT SKIP_INSTALL) diff --git a/SuperBuild/Packaging/PackageMacros.cmake b/SuperBuild/Packaging/PackageMacros.cmake index a2283f28807f9ef8f6b9ac45788ea8b2b5fef2f5..a04a4bb0a4c8a0e4ca4b498c6f19472bb321f6be 100755 --- a/SuperBuild/Packaging/PackageMacros.cmake +++ b/SuperBuild/Packaging/PackageMacros.cmake @@ -98,7 +98,7 @@ macro(add_to_symlink_list src_file target_file) if(NOT SKIP_INSTALL) file(APPEND ${CMAKE_BINARY_DIR}/make_symlinks_temp - "if [ -f \"\$OUT_DIR/lib/${src_file}\" ]; then \n ln -sf \"$OUT_DIR/lib/${src_file}\" \"$OUT_DIR/lib/${target_file}\" \n fi;\n" + "ln -sf \"$OUT_DIR/lib/${src_file}\" \"$OUT_DIR/lib/${target_file}\" \n" ) endif() endmacro() @@ -131,6 +131,129 @@ function(check_for_gtk_libs input_file result) endfunction() +function(is_file_executable2 file result_var) + # + # A file is not executable until proven otherwise: + # + set(${result_var} 0 PARENT_SCOPE) + + get_filename_component(file_full "${file}" ABSOLUTE) + string(TOLOWER "${file_full}" file_full_lower) + + # If file name ends in .exe on Windows, *assume* executable: + # + if(WIN32 AND NOT UNIX) + if("${file_full_lower}" MATCHES "(\\.exe|\\.dll)$") + set(${result_var} 1 PARENT_SCOPE) + return() + endif() + + # A clause could be added here that uses output or return value of dumpbin + # to determine ${result_var}. In 99%+? practical cases, the exe name + # match will be sufficient... + # + endif() + + # Use the information returned from the Unix shell command "file" to + # determine if ${file_full} should be considered an executable file... + # + # If the file command's output contains "executable" and does *not* contain + # "text" then it is likely an executable suitable for prerequisite analysis + # via the get_prerequisites macro. + # + if(UNIX) + if(NOT file_cmd) + find_program(file_cmd "file") + mark_as_advanced(file_cmd) + endif() + + if(file_cmd) + execute_process(COMMAND "${file_cmd}" "${file_full}" + RESULT_VARIABLE file_rv + OUTPUT_VARIABLE file_ov + ERROR_VARIABLE file_ev + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(NOT file_rv STREQUAL "0") + message(FATAL_ERROR "${file_cmd} failed: ${file_rv}\n${file_ev}") + endif() + + # Replace the name of the file in the output with a placeholder token + # (the string " _file_full_ ") so that just in case the path name of + # the file contains the word "text" or "executable" we are not fooled + # into thinking "the wrong thing" because the file name matches the + # other 'file' command output we are looking for... + # + string(REPLACE "${file_full}" " _file_full_ " file_ov "${file_ov}") + string(TOLOWER "${file_ov}" file_ov) + + #message(STATUS "file_ov='${file_ov}'") + #below executable check works for both mac osx and linux + if("${file_ov}" MATCHES "executable") + #message(STATUS "executable!") + if("${file_ov}" MATCHES "text") + set(${result_var} 0 PARENT_SCOPE) + #message(FATAL_ERROR "but text, so *not* a binary executable!") + else() + set(${result_var} 1 PARENT_SCOPE) + return() + endif() + endif() + + # Also detect position independent executables on Linux, + # where "file" gives "dynamically linked (uses shared libraries)" + if("${file_ov}" MATCHES "dynamically linked.*\(uses shared libs\)") + set(${result_var} 1 PARENT_SCOPE) + return() + endif() + + # Also detect position independent executables on Linux, + # where "file" gives "shared object ... (uses shared libraries)" + if("${file_ov}" MATCHES "shared object.*\(uses shared libs\)") + set(${result_var} 1 PARENT_SCOPE) + return() + endif() + + # Also detect shared libraries on Linux, + # where "file" gives "ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped" + if("${file_ov}" MATCHES "elf.*shared object.*version") + set(${result_var} 1 PARENT_SCOPE) + return() + endif() + + # "file" version 5.22 does not print "(used shared libraries)" + # but uses "interpreter" + if("${file_ov}" MATCHES "shared object.*interpreter") + set(${result_var} 1 PARENT_SCOPE) + return() + endif() + + if(APPLE) + # detect shared libraries on Mac OSX + # where "file" gives "Mach-O 64-bit x86_64 dynamically linked shared library" + if("${file_ov}" MATCHES "mach-o.*dynamically linked shared library") + set(${result_var} 1 PARENT_SCOPE) + return() + endif() + + + #below check is redundant. + # detect executables on Mac OSX + # where "file" gives "Mach-O 64-bit x86_64 executable" + if("${file_ov}" MATCHES "mach-o.*executable") + set(${result_var} 1 PARENT_SCOPE) + return() + endif() + + endif(APPLE) + + else() + message(STATUS "warning: No 'file' command, skipping execute_process...") + endif() + endif() +endfunction() + + # The below function is modified from GetPrerequisities.cmake # which is distributed with CMake. function(func_is_file_a_symbolic_link file result_var1 result_var2) @@ -195,7 +318,6 @@ function(func_is_file_a_symbolic_link file result_var1 result_var2) #message(FATAL_ERROR "file_ov='${file_ov}'") if("${file_ov_lower}" MATCHES "symbolic link") - #message(STATUS "symbolic link!") set(${result_var1} 1 PARENT_SCOPE) #Now find where the symlink is linked to. #Do a regex replace 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/ITK/itk-3-vnl_fixes-all.diff b/SuperBuild/patches/ITK/itk-3-vnl_fixes-all.diff deleted file mode 100755 index baebbecf147abc98b5b23cc4b787a6282e107e1f..0000000000000000000000000000000000000000 --- a/SuperBuild/patches/ITK/itk-3-vnl_fixes-all.diff +++ /dev/null @@ -1,14 +0,0 @@ -diff -burN InsightToolkit-4.10.0.orig/Modules/ThirdParty/VNL/src/vxl/core/CMakeLists.txt InsightToolkit-4.10.0/Modules/ThirdParty/VNL/src/vxl/core/CMakeLists.txt ---- InsightToolkit-4.10.0.orig/Modules/ThirdParty/VNL/src/vxl/core/CMakeLists.txt 2016-12-06 16:03:06.000000000 +0100 -+++ InsightToolkit-4.10.0/Modules/ThirdParty/VNL/src/vxl/core/CMakeLists.txt 2016-12-06 16:03:44.000000000 +0100 -@@ -131,8 +131,10 @@ - set(CORE_VIDEO_FOUND OFF CACHE INTERNAL "VXL core video libraries built") - endif () - -+if(BUILD_TESTING) - # common test executable - add_subdirectory(testlib) -+endif() - - # Tests that check and output the vxl configuration - # NOTE: some external projects remove the tests directory (aka ITK) 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/Data/Icons/view-refresh.png b/Utilities/Data/Icons/view-refresh.png new file mode 100644 index 0000000000000000000000000000000000000000..3fd71d6e5929ba0c40db1960e36e9acba9d7e525 Binary files /dev/null and b/Utilities/Data/Icons/view-refresh.png differ diff --git a/Utilities/Data/monteverdi.desktop b/Utilities/Data/monteverdi.desktop index 7664bb14d18e53ea542fea354b211cee19477e1a..2e791673b964a8fac739bdafbf2ca275a2a6e64e 100644 --- a/Utilities/Data/monteverdi.desktop +++ b/Utilities/Data/monteverdi.desktop @@ -11,3 +11,4 @@ StartupNotify=false Icon=monteverdi Categories=Education;Science;ImageProcessing;Geography;Qt; MimeType=image/tiff;image/jpeg;image/jp2;application/x-esri-shape; +Keywords=otb;orfeo;toolbox;osgeo;