diff --git a/CMake/FindNumpy.cmake b/CMake/FindNumpy.cmake index 9022fb0d43d0b8f2389f65600f78eaa43bef985c..f308db88b98cd566e12637bde8c9f1051fa56f65 100644 --- a/CMake/FindNumpy.cmake +++ b/CMake/FindNumpy.cmake @@ -24,10 +24,10 @@ # NUMPY_FOUND - True if Numpy headers are found. # NUMPY_INCLUDE_DIR - where to find numpy/arrayobject.h, etc. -EXEC_PROGRAM ("${PYTHON_EXECUTABLE}" - ARGS "${CMAKE_SOURCE_DIR}/CMake/otbTestNumpy.py" +execute_process( + COMMAND "${PYTHON_EXECUTABLE}" -c "import sys, numpy; sys.stdout.write(numpy.get_include())" OUTPUT_VARIABLE NUMPY_INCLUDE_DIR - RETURN_VALUE NUMPY_NOT_FOUND) + RESULT_VARIABLE NUMPY_NOT_FOUND) if( NUMPY_INCLUDE_DIR MATCHES "Traceback" ) # Did not successfully include numpy diff --git a/CMake/OTBStandaloneModuleMacros.cmake b/CMake/OTBStandaloneModuleMacros.cmake index e877a15ceb405951e27bddf2e55f914b5ad2d980..5771498ab5f0b4040fa02a1a0d40d82532514c8b 100644 --- a/CMake/OTBStandaloneModuleMacros.cmake +++ b/CMake/OTBStandaloneModuleMacros.cmake @@ -23,6 +23,8 @@ # OTB before including OTBModuleMacros. This is the preferred way to build an # OTB module outside of the OTB source tree. +include(GenerateExportHeaderCustom) + macro(otb_module_test) include(../otb-module.cmake) # Load module meta-data set(${otb-module-test}_LIBRARIES "") diff --git a/CMake/UseSWIGLocal.cmake b/CMake/UseSWIGLocal.cmake deleted file mode 100644 index 3f7b7984b6a30472e7412e7aaba2321d9ff66358..0000000000000000000000000000000000000000 --- a/CMake/UseSWIGLocal.cmake +++ /dev/null @@ -1,264 +0,0 @@ -# - SWIG module for CMake -# Defines the following macros: -# SWIG_ADD_MODULE(name language [ files ]) -# - Define swig module with given name and specified language -# SWIG_LINK_LIBRARIES(name [ libraries ]) -# - Link libraries to swig module -# All other macros are for internal use only. -# To get the actual name of the swig module, -# use: ${SWIG_MODULE_${name}_REAL_NAME}. -# Set Source files properties such as CPLUSPLUS and SWIG_FLAGS to specify -# special behavior of SWIG. Also global CMAKE_SWIG_FLAGS can be used to add -# special flags to all swig calls. -# Another special variable is CMAKE_SWIG_OUTDIR, it allows one to specify -# where to write all the swig generated module (swig -outdir option) -# The name-specific variable SWIG_MODULE_<name>_EXTRA_DEPS may be used -# to specify extra dependencies for the generated modules. -# If the source file generated by swig need some special flag you can use -# set_source_files_properties( ${swig_generated_file_fullname} -# PROPERTIES COMPILE_FLAGS "-bla") - - -#============================================================================= -# Copyright 2004-2009 Kitware, Inc. -# Copyright 2009 Mathieu Malaterre <mathieu.malaterre@gmail.com> -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.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 License for more information. -#============================================================================= -# (To distributed this file outside of CMake, substitute the full -# License text for the above reference.) - -set(SWIG_CXX_EXTENSION "cxx") -set(SWIG_EXTRA_LIBRARIES "") - -set(SWIG_PYTHON_EXTRA_FILE_EXTENSION "py") - -# -# For given swig module initialize variables associated with it -# -macro(SWIG_MODULE_INITIALIZE name language) - string(TOUPPER "${language}" swig_uppercase_language) - string(TOLOWER "${language}" swig_lowercase_language) - set(SWIG_MODULE_${name}_LANGUAGE "${swig_uppercase_language}") - set(SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG "${swig_lowercase_language}") - - if("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xUNKNOWNx$") - message(FATAL_ERROR "SWIG Error: Language \"${language}\" not found") - endif() - - set(SWIG_MODULE_${name}_REAL_NAME "${name}") - if("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xPYTHONx$") - # when swig is used without the -interface it will produce in the module.py - # a 'import _modulename' statement, which implies having a corresponding - # _modulename.so (*NIX), _modulename.pyd (Win32). - set(SWIG_MODULE_${name}_REAL_NAME "_${name}") - endif() - if("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xRUBYx$") - string(TOLOWER "${name}" ruby_module_name) - set(SWIG_MODULE_${name}_REAL_NAME "${ruby_module_name}") - endif() - if("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xPERLx$") - set(SWIG_MODULE_${name}_EXTRA_FLAGS "-shadow") - endif() -endmacro() - -# -# For a given language, input file, and output file, determine extra files that -# will be generated. This is internal swig macro. -# - -macro(SWIG_GET_EXTRA_OUTPUT_FILES language outfiles generatedpath infile) - get_source_file_property(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename - ${infile} SWIG_MODULE_NAME) - if(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename STREQUAL "NOTFOUND") - get_filename_component(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename "${infile}" NAME_WE) - endif() - foreach(it ${SWIG_${language}_EXTRA_FILE_EXTENSION}) - set(${outfiles} ${${outfiles}} - "${generatedpath}/${SWIG_GET_EXTRA_OUTPUT_FILES_module_basename}.${it}") - endforeach() -endmacro() - -# -# Take swig (*.i) file and add proper custom commands for it -# -macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) - set(swig_full_infile ${infile}) - get_filename_component(swig_source_file_path "${infile}" PATH) - get_filename_component(swig_source_file_name_we "${infile}" NAME_WE) - get_source_file_property(swig_source_file_generated ${infile} GENERATED) - get_source_file_property(swig_source_file_cplusplus ${infile} CPLUSPLUS) - get_source_file_property(swig_source_file_flags ${infile} SWIG_FLAGS) - if("${swig_source_file_flags}" STREQUAL "NOTFOUND") - set(swig_source_file_flags "") - endif() - set(swig_source_file_fullname "${infile}") - if(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_SOURCE_DIR}") - string(REGEX REPLACE - "^${CMAKE_CURRENT_SOURCE_DIR}" "" - swig_source_file_relative_path - "${swig_source_file_path}") - else() - if(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_BINARY_DIR}") - string(REGEX REPLACE - "^${CMAKE_CURRENT_BINARY_DIR}" "" - swig_source_file_relative_path - "${swig_source_file_path}") - set(swig_source_file_generated 1) - else() - set(swig_source_file_relative_path "${swig_source_file_path}") - if(swig_source_file_generated) - set(swig_source_file_fullname "${CMAKE_CURRENT_BINARY_DIR}/${infile}") - else() - set(swig_source_file_fullname "${CMAKE_CURRENT_SOURCE_DIR}/${infile}") - endif() - endif() - endif() - - set(swig_generated_file_fullname - "${CMAKE_CURRENT_BINARY_DIR}") - # If CMAKE_SWIG_OUTDIR was specified then pass it to -outdir - if(CMAKE_SWIG_OUTDIR) - set(swig_outdir ${CMAKE_SWIG_OUTDIR}) - # it may not exist, so create it: - file(MAKE_DIRECTORY ${CMAKE_SWIG_OUTDIR}) - else() - set(swig_outdir ${CMAKE_CURRENT_BINARY_DIR}) - endif() - # cleanup swig_extra_generated_files content for multi-langage wrapping support - set(swig_extra_generated_files) - SWIG_GET_EXTRA_OUTPUT_FILES(${SWIG_MODULE_${name}_LANGUAGE} - swig_extra_generated_files - "${swig_outdir}" - "${infile}") - set(swig_generated_file_fullname - "${swig_generated_file_fullname}/${swig_source_file_name_we}") - # add the language into the name of the file (i.e. TCL_wrap) - # this allows for the same .i file to be wrapped into different languages - set(swig_generated_file_fullname - "${swig_generated_file_fullname}${SWIG_MODULE_${name}_LANGUAGE}_wrap") - - if(swig_source_file_cplusplus) - set(swig_generated_file_fullname - "${swig_generated_file_fullname}.${SWIG_CXX_EXTENSION}") - else() - set(swig_generated_file_fullname - "${swig_generated_file_fullname}.c") - endif() - - #message("Full path to source file: ${swig_source_file_fullname}") - #message("Full path to the output file: ${swig_generated_file_fullname}") - get_directory_property(cmake_include_directories INCLUDE_DIRECTORIES) - set(swig_include_dirs) - foreach(it ${cmake_include_directories}) - set(swig_include_dirs ${swig_include_dirs} "-I${it}") - endforeach() - - set(swig_special_flags) - # default is c, so add c++ flag if it is c++ - if(swig_source_file_cplusplus) - set(swig_special_flags ${swig_special_flags} "-c++") - endif() - set(swig_extra_flags) - if(SWIG_MODULE_${name}_EXTRA_FLAGS) - set(swig_extra_flags ${swig_extra_flags} ${SWIG_MODULE_${name}_EXTRA_FLAGS}) - endif() - add_custom_command( - OUTPUT "${swig_generated_file_fullname}" ${swig_extra_generated_files} - COMMAND "${SWIG_EXECUTABLE}" - ARGS "-${SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG}" - ${swig_source_file_flags} - ${CMAKE_SWIG_FLAGS} - -outdir ${swig_outdir} - ${swig_special_flags} - ${swig_extra_flags} - ${swig_include_dirs} - -o "${swig_generated_file_fullname}" - "${swig_source_file_fullname}" - MAIN_DEPENDENCY "${swig_source_file_fullname}" - DEPENDS ${SWIG_MODULE_${name}_EXTRA_DEPS} - COMMENT "Swig source to generate ${SWIG_MODULE_${name}_LANGUAGE} wrapping") - set_source_files_properties("${swig_generated_file_fullname}" ${swig_extra_generated_files} - PROPERTIES GENERATED 1) - set(${outfiles} "${swig_generated_file_fullname}" ${swig_extra_generated_files}) -endmacro() - -# -# Create Swig module -# -macro(SWIG_ADD_MODULE name language) - SWIG_MODULE_INITIALIZE(${name} ${language}) - set(swig_dot_i_sources) - set(swig_other_sources) - foreach(it ${ARGN}) - if(${it} MATCHES ".*\\.i$") - set(swig_dot_i_sources ${swig_dot_i_sources} "${it}") - else() - set(swig_other_sources ${swig_other_sources} "${it}") - endif() - endforeach() - - set(swig_generated_sources) - foreach(it ${swig_dot_i_sources}) - SWIG_ADD_SOURCE_TO_MODULE(${name} swig_generated_source ${it}) - set(swig_generated_sources ${swig_generated_sources} "${swig_generated_source}") - endforeach() - get_directory_property(swig_extra_clean_files ADDITIONAL_MAKE_CLEAN_FILES) - set_directory_properties(PROPERTIES - ADDITIONAL_MAKE_CLEAN_FILES "${swig_extra_clean_files};${swig_generated_sources}") - add_library(${SWIG_MODULE_${name}_REAL_NAME} - MODULE - ${swig_generated_sources} - ${swig_other_sources}) - string(TOLOWER "${language}" swig_lowercase_language) - if("${swig_lowercase_language}" STREQUAL "java") - if(APPLE) - # In java you want: - # System.loadLibrary("LIBRARY"); - # then JNI will look for a library whose name is platform dependent, namely - # MacOS : libLIBRARY.jnilib - # Windows: LIBRARY.dll - # Linux : libLIBRARY.so - set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".jnilib") - endif() - endif() - if("${swig_lowercase_language}" STREQUAL "python") - # this is only needed for the python case where a _modulename.so is generated - set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "") - # Python extension modules on Windows must have the extension ".pyd" - # instead of ".dll" as of Python 2.5. Older python versions do support - # this suffix. - # http://docs.python.org/whatsnew/ports.html#SECTION0001510000000000000000 - # <quote> - # Windows: .dll is no longer supported as a filename extension for extension modules. - # .pyd is now the only filename extension that will be searched for. - # </quote> - if(WIN32 AND NOT CYGWIN) - set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".pyd") - endif() - endif() - if("${swig_lowercase_language}" STREQUAL "ruby") - set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "") - if(APPLE) - set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".bundle") - set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES COMPILE_FLAGS "-bundle") - endif() - endif() -endmacro() - -# -# Like TARGET_LINK_LIBRARIES but for swig modules -# -macro(SWIG_LINK_LIBRARIES name) - if(SWIG_MODULE_${name}_REAL_NAME) - target_link_libraries(${SWIG_MODULE_${name}_REAL_NAME} ${ARGN}) - else() - message(SEND_ERROR "Cannot find Swig library \"${name}\".") - endif() -endmacro() - diff --git a/CMake/otbTestNumpy.py b/CMake/otbTestNumpy.py deleted file mode 100644 index 767bbbab113c4106abb0665492a43545bb1c7c8b..0000000000000000000000000000000000000000 --- a/CMake/otbTestNumpy.py +++ /dev/null @@ -1,2 +0,0 @@ -import numpy -print(numpy.get_include()) diff --git a/CMakeLists.txt b/CMakeLists.txt index f2f57de38427ab52b54e3ebf48a777d332253954..df298c16d3902a6f2ff8a6a73fe5b7c6a418ba4a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,8 @@ cmake_minimum_required(VERSION 3.10.2) foreach(p CMP0072 # CMake 3.11 + CMP0078 # CMake 3.13 + CMP0086 # CMake 3.14 ) if(POLICY ${p}) cmake_policy(SET ${p} NEW) @@ -105,7 +107,7 @@ set ( Python_ADDITIONAL_VERSIONS "3;2" ) set ( PythonInterp_FIND_REQUIRED ${OTB_WRAP_PYTHON} ) set ( PythonLibs_FIND_REQUIRED ${OTB_WRAP_PYTHON} ) find_package( PythonInterp ) -if ( OTB_WRAP_PYTHON AND ( ${PYTHON_VERSION_MAJOR} EQUAL 2 ) ) +if ( OTB_WRAP_PYTHON AND ( "x${PYTHON_VERSION_MAJOR}" STREQUAL "x2" ) ) message (WARNING "Python3 not found. There is no longer support of \ wrapping in python2 in OTB, but it can still be used.") endif() @@ -399,6 +401,8 @@ install(FILES ${OTB_BINARY_DIR}/CMakeFiles/OTBConfig.cmake CMake/OTBStandaloneModuleMacros.cmake CMake/OTBModuleExternal.cmake CMake/UseOTB.cmake + CMake/GenerateExportHeaderCustom.cmake + CMake/exportheader.cmake.in DESTINATION ${OTB_INSTALL_PACKAGE_DIR} COMPONENT Development) get_property(OTBTargets_MODULES GLOBAL PROPERTY OTBTargets_MODULES) diff --git a/Data/Baseline/OTB/Images/apTvHyHyperspectralUnmixing_NCLS.tif b/Data/Baseline/OTB/Images/apTvHyHyperspectralUnmixing_NCLS.tif deleted file mode 100644 index 6d556a35f322dadf76eb3eb3a6ce864707fea9d9..0000000000000000000000000000000000000000 --- a/Data/Baseline/OTB/Images/apTvHyHyperspectralUnmixing_NCLS.tif +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:132f26d65cfc0cc72b6a465a915fd22c2852f30b08151c1ade9994e27e665745 -size 13008 diff --git a/Data/Baseline/OTB/Images/hyTvNCLSImageFilterTest.tif b/Data/Baseline/OTB/Images/hyTvNCLSImageFilterTest.tif deleted file mode 100644 index a137c07799294ab1909c86fc4ce909e43d4cb315..0000000000000000000000000000000000000000 --- a/Data/Baseline/OTB/Images/hyTvNCLSImageFilterTest.tif +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2df167f402a5e001ddfd2821a2859483bf8f15f3b4789a650a992b56ca7655e2 -size 13025 diff --git a/Data/Input/apTvUtExportBandMathX.txt b/Data/Input/apTvUtExportBandMathX.txt index baa6a64fc44bd2084a44a5b4ff0044f7b0e3fa21..774aca47ddf40b5931ef58ec124c5394bbb4a511 100644 --- a/Data/Input/apTvUtExportBandMathX.txt +++ b/Data/Input/apTvUtExportBandMathX.txt @@ -1,2 +1,3 @@ -#E cos(im1b1)+im2b1*im3b1-im3b2+ndvi(im3b3,im3b4) +#F val 1 +#E im1b1 + 2*val + im2b1 diff --git a/Documentation/Cookbook/rst/QGISInterface.rst b/Documentation/Cookbook/rst/QGISInterface.rst index eb075ef35dd151285236881f80bced5a7e9d3c7e..df569c32bee87dac7c38da88ca21bdf807146bd2 100644 --- a/Documentation/Cookbook/rst/QGISInterface.rst +++ b/Documentation/Cookbook/rst/QGISInterface.rst @@ -1,36 +1,14 @@ QGIS interface ============== -The QGIS-OTB plugin (requires QGIS > 3.0) +The QGIS-OTB plugin (requires QGIS > 3.2) ----------------------------------------- -With QGIS 3.0.2 or later, you will need to manually install the plugin. -Clone qgis-otb-plugin repository and set ``QGIS_PLUGINPATH``: +With QGIS < 3.8 you will need to manually install the plugin. +You can follow the instruction here: https://gitlab.orfeo-toolbox.org/orfeotoolbox/qgis-otb-plugin#otb-provider-for-qgis-processing -For Linux/Unix/MacOSX -^^^^^^^^^^^^^^^^^^^^^ -:: - - mkdir $HOME/projects; cd $HOME/projects - git clone https://gitlab.orfeo-toolbox.org/orfeotoolbox/qgis-otb-plugin - export QGIS_PLUGINPATH=$HOME/projects/qgis-otb-plugin - -For Windows -^^^^^^^^^^^ - -Clone qgis-otb-plugin repository to ``C:\qgis-plugins\qgis-otb-plugin`` - -:: - - git clone https://gitlab.orfeo-toolbox.org/orfeotoolbox/qgis-otb-plugin - -Then set the ``QGIS_PLUGINPATH`` variable: - -* System properties (``Windows Key + R -> sysdm.cpl`` ) -* Select Advanced Tab -> Environment variables. -* Under "user variables for " -* Add or Edit variable ``QGIS_PLUGINPATH`` and set value to ``C:\qgis-plugins\qgis-otb-plugin`` +With QGIS > 3.8, the plugin is in the QGIS core. So you just need install OTB and set the plugin up. Download and Install OTB ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -59,27 +37,6 @@ You can see OTB under "Providers": * Set OTB application folder. This is location of your OTB applications. ``<OTB_FOLDER>/lib/otb/applications`` * Click "ok" to save settings and close dialog. If settings are correct, you will have OTB algorithms loaded in Processing toolbox -Using the processing toolbox (for QGIS < 3.0) ---------------------------------------------- - -In older QGIS version (3.0 or before), OTB applications are available from QGIS. -Use them from the processing toolbox, which is accessible under `Processing --> ToolBox`. Switch to “advanced interface†in the bottom of the -application widget and OTB applications will be there. - -.. figure:: Art/QtImages/qgis-otb.png - -Using a custom OTB -^^^^^^^^^^^^^^^^^^ - -If QGIS cannot find OTB, the “applications folder†and “binaries folder†-can be set from the settings found under Processing :math:`\rightarrow` -Settings :math:`\rightarrow` “service providerâ€. - -.. figure:: Art/QtImages/qgis-otb-settings.png - -On some versions of QGIS, if an existing OTB installation is found, the -textfield settings will not be shown. To use a custom OTB instead of the -existing one, you will need to replace the otbcli, otbgui and library -files in QGIS installation directly. - +Troubleshoot +------------ +As of QGIS 3.8 the otb plugin is in the core. It might get messy if you have a previously installed plugin. Try to remove the old plugin before launching QGIS. diff --git a/Modules/Applications/AppClassification/include/otbTrainDecisionTree.hxx b/Modules/Applications/AppClassification/include/otbTrainDecisionTree.hxx index 0d980c9d7afc0d69223d14cbeafe41defca64190..341cd858252512d8677e59dafd6a7e736d42a2ef 100644 --- a/Modules/Applications/AppClassification/include/otbTrainDecisionTree.hxx +++ b/Modules/Applications/AppClassification/include/otbTrainDecisionTree.hxx @@ -75,17 +75,15 @@ LearningApplicationBase<TInputValue,TOutputValue> "Cluster possible values of a categorical variable into K <= cat clusters to find a " "suboptimal split."); - //CVFolds + + //CVFolds: only exposed for OPENCV 2 because it crashes in OpenCV 3 +#ifndef OTB_OPENCV_3 AddParameter(ParameterType_Int, "classifier.dt.f", "K-fold cross-validations"); -#ifdef OTB_OPENCV_3 - // disable cross validation by default (crash in opencv 3.2) - SetParameterInt("classifier.dt.f",0); -#else SetParameterInt("classifier.dt.f",10); -#endif SetParameterDescription("classifier.dt.f", "If cv_folds > 1, then it prunes a tree with K-fold cross-validation where K " "is equal to cv_folds."); +#endif //Use1seRule AddParameter(ParameterType_Bool, "classifier.dt.r", "Set Use1seRule flag to false"); @@ -118,7 +116,10 @@ LearningApplicationBase<TInputValue,TOutputValue> classifier->SetMinSampleCount(GetParameterInt("classifier.dt.min")); classifier->SetRegressionAccuracy(GetParameterFloat("classifier.dt.ra")); classifier->SetMaxCategories(GetParameterInt("classifier.dt.cat")); + //CVFolds is only exposed for OPENCV 2 because it crashes in OpenCV 3 +#ifndef OTB_OPENCV_3 classifier->SetCVFolds(GetParameterInt("classifier.dt.f")); +#endif if (GetParameterInt("classifier.dt.r")) { classifier->SetUse1seRule(false); diff --git a/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx b/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx index 4ea775fdb56ca5db88271e0918e90a39da46dcb8..95a859ebbecede54dad37cc8cbc1587330bd6b91 100644 --- a/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx +++ b/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx @@ -246,54 +246,42 @@ private: void DoUpdateParameters() override { // check if input context should be used - bool useContext = this->ContextCheck(); + bool context_exists = this->ContextCheck(); // Check if the expression is correctly set - if (HasValue("il") && HasValue("exp")) - { - this->LiveCheck(useContext); - } + BandMathImageFilterType::Pointer math_filter = BandMathImageFilterType::New(); + math_filter->SetManyExpressions(false); + // first thing, load context if there is one + if (context_exists) + math_filter->ImportContext(GetParameterString("incontext")); + // Only one expression is allowed '-exp'>'-incontext' + if ( !HasValue("exp") ) + SetParameterString("exp", math_filter->GetExpression(0)); + if ( HasValue("il") && HasValue("exp") ) + { + math_filter->ClearExpression(); // remove expression set by context + math_filter->SetExpression(GetParameterString("exp")); //set expression + LiveCheck(math_filter); + } } + // Check if the given filename is valid bool ContextCheck(void) - { - bool useContext = false; + { + bool context_exists = false; if (IsParameterEnabled("incontext") && HasValue("incontext")) - { + { std::string contextPath = GetParameterString("incontext"); // check that file exists if (itksys::SystemTools::FileExists(contextPath,true)) - { - BandMathImageFilterType::Pointer dummyFilter = - BandMathImageFilterType::New(); - dummyFilter->SetManyExpressions(false); - try - { - dummyFilter->ImportContext(contextPath); - useContext = true; - } - catch(itk::ExceptionObject& err) - { - //trick to prevent unreferenced local variable warning on MSVC - (void)err; - // silent catch - useContext = false; - } - if (useContext) - { - // only set the first expression, 'ManyExpression' is disabled. - this->SetParameterString("exp",dummyFilter->GetExpression(0)); - } - } + { + context_exists = true; } - return useContext; } + return context_exists; + } - void LiveCheck(bool useContext=false) + void LiveCheck( BandMathImageFilterType::Pointer math_filter ) { - BandMathImageFilterType::Pointer dummyFilter = - BandMathImageFilterType::New(); - dummyFilter->SetManyExpressions(false); - std::vector<MultiChannelExtractorType::Pointer> extractors; FloatVectorImageListType::Pointer inList = GetParameterImageList("il"); for (unsigned int i = 0; i < inList->Size(); i++) @@ -314,19 +302,11 @@ private: { extract->SetChannel(j+1); } - dummyFilter->SetNthInput(i,extract->GetOutput()); - } - if (useContext) - { - dummyFilter->ImportContext(GetParameterString("incontext")); - } - else - { - dummyFilter->SetExpression(GetParameterString("exp")); + math_filter->SetNthInput(i,extract->GetOutput()); } try { - dummyFilter->UpdateOutputInformation(); + math_filter->UpdateOutputInformation(); SetParameterDescription("exp", "Valid expression"); } catch(itk::ExceptionObject& err) @@ -334,8 +314,15 @@ private: // Change the parameter description to be able to have the // parser errors in the tooltip SetParameterDescription("exp", err.GetDescription()); + // std::string error_string(err.GetDescription()); + // otbAppLogINFO("There was an error while parsing the expression given " + // "its input:" + error_string ); } + catch(...) + { + SetParameterDescription("exp", "Other exception catched"); } + } void DoExecute() override { @@ -352,11 +339,11 @@ private: if ( (!IsParameterEnabled("exp")) && (!IsParameterEnabled("incontext")) ) { - itkExceptionMacro("No expression set...; please set and enable at least one one expression"); + itkExceptionMacro("No expression set...; please set and enable at least one expression"); } - m_Filter = BandMathImageFilterType::New(); - m_Filter->SetManyExpressions(false); + BandMathImageFilterType::Pointer math_filter = BandMathImageFilterType::New(); + math_filter->SetManyExpressions(false); for (unsigned int i = 0; i < nbImages; i++) { @@ -367,31 +354,33 @@ private: << currentImage->GetNumberOfComponentsPerPixel() << " components"); - m_Filter->SetNthInput(i,currentImage); + math_filter->SetNthInput(i,currentImage); } - bool useContext = this->ContextCheck(); + bool context_exists = this->ContextCheck(); + // first thing, load context if there is one + if (context_exists) + { + std::string context_string = GetParameterString("incontext"); + math_filter->ImportContext(context_string); + otbAppLogINFO("Using Context: " << context_string + << " for variables (and expression if no parameter -exp has been given)." ); + } + // Only one expression is allowed '-exp'>'-incontext' + math_filter->ClearExpression(); // remove expression set by context std::string expStr = GetParameterString("exp"); - if (useContext) - { - otbAppLogINFO("Using input context: " << expStr ); - m_Filter->ImportContext(GetParameterString("incontext")); - } - else - { - otbAppLogINFO("Using expression: " << expStr ); - m_Filter->SetExpression(expStr); - } + otbAppLogINFO("Using expression: " << expStr ); + math_filter->SetExpression(expStr); if ( IsParameterEnabled("outcontext") && HasValue("outcontext") ) - m_Filter->ExportContext(GetParameterString("outcontext")); + math_filter->ExportContext(GetParameterString("outcontext")); // Set the output image - SetParameterOutputImage("out", m_Filter->GetOutput()); + SetParameterOutputImage("out", math_filter->GetOutput()); + RegisterPipeline(); } - BandMathImageFilterType::Pointer m_Filter; }; } // namespace Wrapper diff --git a/Modules/Applications/AppMathParserX/otb-module.cmake b/Modules/Applications/AppMathParserX/otb-module.cmake index 54b1fc571ac6aedc6cdfa26f7c1c4949ce4c3baa..eda0082072a811e8947f5962ccacd390f71e8af5 100644 --- a/Modules/Applications/AppMathParserX/otb-module.cmake +++ b/Modules/Applications/AppMathParserX/otb-module.cmake @@ -26,6 +26,9 @@ otb_module(OTBAppMathParserX OTBMathParserX OTBObjectList + TEST_DEPENDS + OTBTestKernel + DESCRIPTION "${DOCUMENTATION}" ) diff --git a/Modules/Applications/AppMathParserX/test/CMakeLists.txt b/Modules/Applications/AppMathParserX/test/CMakeLists.txt index b5d584699738fa153a1a7a5c93a80138bd52c904..65e464ffec60931c951646d2e77d2a31575c841f 100644 --- a/Modules/Applications/AppMathParserX/test/CMakeLists.txt +++ b/Modules/Applications/AppMathParserX/test/CMakeLists.txt @@ -20,15 +20,15 @@ otb_module_test() -#----------- BandMathX TESTS ---------------- -otb_test_application(NAME apTvUtBandMathX - APP BandMathX - OPTIONS -il ${INPUTDATA}/poupees_sub_c1.png - ${INPUTDATA}/poupees_sub_c2.png - ${INPUTDATA}/poupees_sub.png - -out ${TEMP}/apTvUtBandMathXOutput.tif - -incontext ${INPUTDATA}/apTvUtExportBandMathX.txt - VALID --compare-image ${NOTOL} - ${INPUTDATA}/apTvUtBandMathOutput.tif - ${TEMP}/apTvUtBandMathXOutput.tif) +set(OTBBandMathXAppTest +otbBandMathXAppTests.cxx +) +add_executable(OTBBandMathXAppTest ${OTBBandMathXAppTest}) +target_link_libraries(OTBBandMathXAppTest ${OTBAppMathParserX-Test_LIBRARIES}) +otb_module_target_label(OTBBandMathXAppTest) + +otb_add_test(NAME apTvUtBandMathX COMMAND OTBBandMathXAppTest + $<TARGET_FILE_DIR:otbapp_BandMathX> + ${INPUTDATA}/apTvUtExportBandMathX.txt + ) \ No newline at end of file diff --git a/Modules/Applications/AppMathParserX/test/otbBandMathXAppTests.cxx b/Modules/Applications/AppMathParserX/test/otbBandMathXAppTests.cxx new file mode 100644 index 0000000000000000000000000000000000000000..b2d425fc0632ff9f3c4cd85adb3572160bcfee87 --- /dev/null +++ b/Modules/Applications/AppMathParserX/test/otbBandMathXAppTests.cxx @@ -0,0 +1,175 @@ +/* + * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) + * + * This file is part of Orfeo Toolbox + * + * https://www.orfeo-toolbox.org/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "otbVectorImage.h" +#include "otbWrapperApplicationRegistry.h" +#include "otbWrapperTypes.h" +#include <string> + +typedef otb::VectorImage<unsigned char> VectorImageType; +typedef VectorImageType::PixelType PixelType; + +/* This function is creating and filling a vector image */ +VectorImageType::Pointer create_vector_image( int pxl_s , int nb_comp , unsigned char value ) +{ + VectorImageType::SizeType size; + size.Fill(pxl_s); + VectorImageType::IndexType index; + index.Fill(0); + VectorImageType::RegionType region; + region.SetSize(size); + region.SetIndex(index); + + VectorImageType::Pointer image = VectorImageType::New(); + + image->SetLargestPossibleRegion( region ); + image->SetBufferedRegion( region ); + image->SetRequestedRegion( region ); + image->SetNumberOfComponentsPerPixel(nb_comp); + image->Allocate(); + PixelType val(nb_comp); + val.Fill(value); + image->FillBuffer(val); + return image; +} + +#define dyn_cast( im_base , vect_im ) \ +{ \ + vect_im = dynamic_cast<otb::VectorImage<float> *>(im_base); \ + if( ! vect_im ) \ + { \ + std::cout<<"Not the right conversion, cannot retrieve the output"<<std::endl; \ + return EXIT_FAILURE ; \ + } \ +} + +int main(int , char * argv[] ) +{ + std::cout<<"Begin bandMathX Test"<<std::endl; + int return_val = 0; + auto img1 = create_vector_image(5,2,1); + auto img2 = create_vector_image(5,1,2); + VectorImageType::IndexType index; + index.Fill(3); // Center of the images + std::cout<<"Create application"<<std::endl; + otb::Wrapper::ApplicationRegistry::SetApplicationPath(argv[1]); + auto app = otb::Wrapper::ApplicationRegistry::CreateApplication("BandMathX"); + app->AddImageToParameterInputImageList("il", img1); + app->UpdateParameters(); + app->AddImageToParameterInputImageList("il", img2); + app->UpdateParameters(); + std::cout<<"Inputs are set"<<std::endl; + + // Case one: only expression + app->SetParameterString("exp", "im1b1+im2b1"); + app->UpdateParameters(); + app->SetParameterOutputImagePixelType("out", otb::Wrapper::ImagePixelType::ImagePixelType_uint8); + std::cout<<"Case one: parameter exp is set"<<std::endl; + app->Execute(); + auto output = app->GetParameterImageBase("out"); + output->Update(); + float im_val = 0; + // We need to be carefull as we are taking the direct output of the underlying + // filter in the application + otb::VectorImage<float> * output_int = nullptr; + dyn_cast( output , output_int ) + im_val = output_int->GetPixel(index).GetElement(0); + if ( im_val != 3 ) + { + std::cout<<"Wrong value in test, was expecting 3, got "<<im_val<<std::endl; + return_val++; + } + else + { + std::cout<<"Case one passed"<<std::endl; + } + + // Case two: expression and context + app->SetParameterString("exp", "im1b1+val-im2b1"); + app->UpdateParameters(); + std::cout<<"Case two: use context to define a constant"<<std::endl; + auto desc = app->GetParameterDescription("exp"); + if (desc.find("Following variables not allowed : val") == std::string::npos) + { + std::cout<<"Cannot find usual value in the parameter description."<<std::endl; + std::cout<<"The test was looking for \"Following variables not allowed : val\"" + <<" in the parameter description and got \""<<desc<<"\" instead."<<std::endl; + return_val++; + } + + app->SetParameterString("incontext",argv[2]); + // val is set in the context to 1 + app->UpdateParameters(); + desc = app->GetParameterDescription("exp"); + if (desc.find("Valid expression") == std::string::npos ) + { + std::cout<<"Cannot find usual value in the parameter description."<<std::endl; + std::cout<<"The test was looking for \"Valid expression\"" + <<" in the parameter description and got \""<<desc<<"\" instead."<<std::endl; + return_val++; + } + + app->Execute(); + output = app->GetParameterImageBase("out"); + output->Update(); + // We need to be carefull as we are taking the direct output of the underlying + // filter in the application + dyn_cast( output , output_int ) + im_val = output_int->GetPixel(index).GetElement(0); + if ( im_val != 0 ) + { + std::cout<<"Wrong value in test, was expecting 0, got "<<im_val<<std::endl; + return_val++; + } + else + { + std::cout<<"Case two passed"<<std::endl; + } + + // Case three: no expression and context + app->SetParameterString("exp", ""); + app->UpdateParameters(); + std::cout<<"Case three: no parameter exp"<<std::endl; + auto exp = app->GetParameterString("exp"); + if (exp.find("im1b1 + 2*val + im2b1") == std::string::npos ) + { + std::cout<<"The expression value is not set correctly."<<std::endl; + std::cout<<"The test was looking for \"im1b1 + 2*val + im2b1\"" + <<" in the parameter value and got \""<<exp<<"\" instead."<<std::endl; + return_val++; + } + app->Execute(); + output = app->GetParameterImageBase("out"); + output->Update(); + // We need to be carefull as we are taking the direct output of the underlying + // filter in the application + dyn_cast( output , output_int ) + im_val = output_int->GetPixel(index).GetElement(0); + if (im_val != 5 ) + { + std::cout<<"Wrong value in test, was expecting 5, got "<<im_val<<std::endl; + return_val++; + } + else + { + std::cout<<"Case three passed"<<std::endl; + } + return return_val; +} \ No newline at end of file diff --git a/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.h b/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.h index 9822cd6ab731a520109484ec9e4bd32947f65468..ce76dd8e44ded0f672a328bb72bcabdf6566dced 100644 --- a/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.h +++ b/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.h @@ -112,8 +112,8 @@ public: /** Set an expression to be parsed */ void SetExpression(const std::string& expression); - /** Return the nth expression to be parsed */ - std::string GetExpression(int) const; + /** Return the nth expression to be parsed*/ + std::string GetExpression(unsigned int IDExpression) const; /** Set a matrix (or a vector) */ void SetMatrix(const std::string& name, const std::string& definition); @@ -127,9 +127,15 @@ public: /** Import constants and expressions from a given filename */ void ImportContext(const std::string& filename); + /** Clear all previously set expression*/ + void ClearExpression(); /** Return the variable and constant names */ std::vector<std::string> GetVarNames() const; + bool GlobalStatsDetected() const + { + return !m_StatsVarDetected.empty(); + } protected : BandMathXImageFilter(); @@ -145,11 +151,6 @@ protected : private : - bool globalStatsDetected() const - { - return (m_StatsVarDetected.size()>0); - } - typedef struct { std::string name; ValueType value; diff --git a/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.hxx b/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.hxx index 6092926c7d22d861d0a88a811de26f9f537d016c..44cde5bed777f89ebfada6a1e1c24de73a2802d1 100644 --- a/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.hxx +++ b/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.hxx @@ -261,7 +261,13 @@ void BandMathXImageFilter<TImage> this->Modified(); } - +template< typename TImage > +void BandMathXImageFilter<TImage> +::ClearExpression() +{ + m_Expression.clear(); + this->Modified(); +} template< typename TImage > void BandMathXImageFilter<TImage> ::SetMatrix(const std::string& name, const std::string& definition) @@ -517,9 +523,11 @@ void BandMathXImageFilter<TImage> template< typename TImage > std::string BandMathXImageFilter<TImage> -::GetExpression(int IDExpression) const +::GetExpression(unsigned int IDExpression) const { - return m_Expression[IDExpression]; + if ( IDExpression < m_Expression.size() ) + return m_Expression[IDExpression]; + return ""; } @@ -913,7 +921,7 @@ void BandMathXImageFilter< TImage > CheckImageDimensions(); PrepareParsers(); - if (globalStatsDetected()) + if (GlobalStatsDetected()) PrepareParsersGlobStats(); OutputsDimensions(); diff --git a/Modules/ThirdParty/OssimPlugins/src/gdal/ossimOgcWktTranslator.cpp b/Modules/ThirdParty/OssimPlugins/src/gdal/ossimOgcWktTranslator.cpp index 6f2f0289ca28962cf3d8c93dc358b8cd8665f724..91f433d65752a83ec1736eb915543e7c14953b96 100644 --- a/Modules/ThirdParty/OssimPlugins/src/gdal/ossimOgcWktTranslator.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/gdal/ossimOgcWktTranslator.cpp @@ -128,7 +128,7 @@ ossimString ossimOgcWktTranslator::fromOssimKwl(const ossimKeywordlist &kwl, << ": " << ( ossimUnitTypeLut::instance()-> getEntryString(units).c_str() ) - << endl; + << std::endl; break; } } // End of switch (units) @@ -491,11 +491,11 @@ ossimString ossimOgcWktTranslator::fromOssimKwl(const ossimKeywordlist &kwl, } else { - cerr << "ossimOgcWktTranslator::fromOssimKwl:\n" + std::cerr << "ossimOgcWktTranslator::fromOssimKwl:\n" << "Projection translation for " << projType << " not supported " - << endl; + << std::endl; } if(pcsCodeVal >= EPSG_CODE_MAX) @@ -532,10 +532,10 @@ ossimString ossimOgcWktTranslator::fromOssimKwl(const ossimKeywordlist &kwl, } else { - cerr << "ossimOgcWktTranslator::fromOssimKwl: Datum translation for " + std::cerr << "ossimOgcWktTranslator::fromOssimKwl: Datum translation for " << datumType <<" not supported" - << endl; + << std::endl; } } @@ -700,7 +700,7 @@ bool ossimOgcWktTranslator::toOssimKwl( const ossimString& wktString, { ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << "DEBUG:" - << "\nossimProj = " << ossimProj << endl; + << "\nossimProj = " << ossimProj << std::endl; } kwl.add(prefix, ossimKeywordNames::TYPE_KW, ossimProj.c_str(), true); @@ -916,7 +916,7 @@ bool ossimOgcWktTranslator::toOssimKwl( const ossimString& wktString, << "Projection conversion to OSSIM not supported !!!!!!!!!\n" << "Please send the following string to the development staff\n" << "to be added to the transaltion to OSSIM\n" - << wkt << endl; + << wkt << std::endl; } return false; } @@ -1055,7 +1055,7 @@ ossimString ossimOgcWktTranslator::wktToOssimDatum(const ossimString& datum)cons ossimString ossimOgcWktTranslator::ossimToWktDatum(const ossimString& datum)const { ossimString result; - map<std::string, std::string>::const_iterator i = theOssimToWktDatumTranslation.find(datum); + std::map<std::string, std::string>::const_iterator i = theOssimToWktDatumTranslation.find(datum); if(i != theOssimToWktDatumTranslation.end()) { result = (*i).second; @@ -1066,7 +1066,7 @@ ossimString ossimOgcWktTranslator::ossimToWktDatum(const ossimString& datum)cons ossimString ossimOgcWktTranslator::wktToOssimProjection(const ossimString& datum)const { std::string result; - map<std::string, std::string>::const_iterator i = + std::map<std::string, std::string>::const_iterator i = theWktToOssimProjectionTranslation.find(datum); if(i != theWktToOssimProjectionTranslation.end()) { @@ -1078,7 +1078,7 @@ ossimString ossimOgcWktTranslator::wktToOssimProjection(const ossimString& datum ossimString ossimOgcWktTranslator::ossimToWktProjection(const ossimString& datum)const { ossimString result; - map<std::string, std::string>::const_iterator i = + std::map<std::string, std::string>::const_iterator i = theOssimToWktProjectionTranslation.find(datum); if(i != theOssimToWktProjectionTranslation.end()) { diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimAlosPalsarModel.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimAlosPalsarModel.cpp index 215d10d7ee059b9845eeec03f19d3add0011d087..b9986ffb17898d70e6179304b461209fd830da44 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimAlosPalsarModel.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimAlosPalsarModel.cpp @@ -217,7 +217,7 @@ namespace ossimplugins /* * Leader file data reading */ - std::ifstream leaderFile(leaFilename.c_str(), ios::in | ios::binary); + std::ifstream leaderFile(leaFilename.c_str(), std::ios::in | std::ios::binary); leaderFile >> *theAlosPalsarLeader; leaderFile.close(); @@ -241,7 +241,7 @@ namespace ossimplugins /* * Read header of data file for image size info */ - std::ifstream dataFile(datFilename.c_str(), ios::in | ios::binary); + std::ifstream dataFile(datFilename.c_str(), std::ios::in | std::ios::binary); dataFile >> *theAlosPalsarData; dataFile.close(); @@ -682,7 +682,7 @@ namespace ossimplugins bool ossimAlosPalsarModel::isAlosPalsarLeader(const ossimFilename& file) const { - std::ifstream candidate(file.c_str(), ios::in | ios::binary); + std::ifstream candidate(file.c_str(), std::ios::in | std::ios::binary); char alosFileName[16]; candidate.seekg(48); @@ -745,7 +745,7 @@ namespace ossimplugins bool ossimAlosPalsarModel::isAlosPalsarData(const ossimFilename& file) const { - std::ifstream candidate(file.c_str(), ios::in | ios::binary); + std::ifstream candidate(file.c_str(), std::ios::in | std::ios::binary); char alosFileName[16]; candidate.seekg(48); diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimCosmoSkymedModel.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimCosmoSkymedModel.cpp index b11d6dc1fda61880c96f2196d9aeb68ede39b38e..ca9d72ece58a9fa1152c685af6d5c9fad184afd1 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimCosmoSkymedModel.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimCosmoSkymedModel.cpp @@ -119,14 +119,14 @@ namespace ossimplugins // Capture stream flags since we are going to mess with them. std::ios_base::fmtflags f = out.flags(); - out << "\nDump of ossimCosmoSkymedModel at address " << hex << this - << dec + out << "\nDump of ossimCosmoSkymedModel at address " << std::hex << this + << std::dec << "\n------------------------------------------------" << "\n theImageID = " << theImageID << "\n theImageSize = " << theImageSize << "\n------------------------------------------------" - << "\n " << endl; + << "\n " << std::endl; // Set the flags back. out.flags(f); diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimEnvisatAsarModel.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimEnvisatAsarModel.cpp index a2b8c4c5e7f12fe109d910c32a8c3b3ca13b1d8b..d04f06725eb857cf89b91f7c5da8c20cd5c20211 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimEnvisatAsarModel.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimEnvisatAsarModel.cpp @@ -125,7 +125,7 @@ namespace ossimplugins * Opening and test of the file */ ossimFilename Filename = file; - ifstream dataFile(Filename.c_str(), ios::in | ios::binary); + std::ifstream dataFile(Filename.c_str(), std::ios::in | std::ios::binary); if (dataFile.eof()) { dataFile.close(); @@ -368,7 +368,7 @@ namespace ossimplugins // Capture the original flags. std::ios_base::fmtflags f = out.flags(); - out << setprecision(15) << setiosflags(ios::fixed) + out << std::setprecision(15) << std::setiosflags(std::ios::fixed) << "\nossimEnvisatAsarModel data members:\n" << "_pixel_spacing: " << _pixel_spacing << "\n" << "_n_srgr: " << _n_srgr << "\n"; diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimErsSarModel.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimErsSarModel.cpp index d781754df838192dd61615cb7c2a6c8a83796843..446f09d4151c51cde941d47267314b82745ceeff 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimErsSarModel.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimErsSarModel.cpp @@ -195,7 +195,7 @@ namespace ossimplugins /* * Leader file data reading */ - std::ifstream leaderFile(leaFilename.c_str(), ios::in | ios::binary); + std::ifstream leaderFile(leaFilename.c_str(), std::ios::in | std::ios::binary); leaderFile >> *theErsSarleader; leaderFile.close(); @@ -613,8 +613,8 @@ namespace ossimplugins ossimString filename(kwl.find("filename")); filename.upcase(); //std::transform(filename.begin(), filename.end(), filename.begin(), toupper); - string::size_type loc = filename.find("PRI"); - if (loc != string::npos) + std::string::size_type loc = filename.find("PRI"); + if (loc != std::string::npos) { _isProductGeoreferenced = true; } @@ -646,7 +646,7 @@ namespace ossimplugins bool ossimErsSarModel::isErsLeader(const ossimFilename& file) const { - std::ifstream candidate(file.c_str(), ios::in | ios::binary); + std::ifstream candidate(file.c_str(), std::ios::in | std::ios::binary); char ersFileName[16]; candidate.seekg(48); diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimFormosatDimapSupportData.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimFormosatDimapSupportData.cpp index 43ae793f91c706c72f44a184cdbde251571a58bd..0aab7c5bc214fcf77986d220ad75708359977ac2 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimFormosatDimapSupportData.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimFormosatDimapSupportData.cpp @@ -326,7 +326,7 @@ bool ossimFormosatDimapSupportData::loadXmlFile(const ossimFilename& file) //--- // Check that it is a FORMOSAT DIMAP file format //--- - vector<ossimRefPtr<ossimXmlNode> > xml_nodes; + std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes; xml_nodes.clear(); ossimString xpath = "/Dimap_Document/Dataset_Sources/Source_Information/Scene_Source/MISSION"; xmlDocument->findNodes(xpath, xml_nodes); @@ -803,7 +803,7 @@ void ossimFormosatDimapSupportData::getGeoPosPoint (ossim_uint32 point, } } -void ossimFormosatDimapSupportData::printInfo(ostream& os) const +void ossimFormosatDimapSupportData::printInfo(std::ostream& os) const { ossimString corr_att = "NO"; if (theStarTrackerUsed) @@ -1522,7 +1522,7 @@ bool ossimFormosatDimapSupportData::parsePart1( static const char MODULE[] = "ossimFormosatDimapSupportData::parsePart1"; ossimString xpath; - vector<ossimRefPtr<ossimXmlNode> > xml_nodes; + std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes; //--- // Fetch the ImageSize: @@ -2351,7 +2351,7 @@ bool ossimFormosatDimapSupportData::initMetadataVersion(ossimRefPtr<ossimXmlDocu { ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG:\nCould not find: " << xpath - << endl; + << std::endl; } return false; } @@ -2386,7 +2386,7 @@ bool ossimFormosatDimapSupportData::initImageId( ossimRefPtr<ossimXmlDocument> xmlDocument) { ossimString xpath; - vector<ossimRefPtr<ossimXmlNode> > xml_nodes; + std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes; //--- // Fetch the Image ID: @@ -2400,7 +2400,7 @@ bool ossimFormosatDimapSupportData::initImageId( { ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG:\nCould not find: " << xpath - << endl; + << std::endl; } return false; } @@ -2412,7 +2412,7 @@ bool ossimFormosatDimapSupportData::initSceneSource( ossimRefPtr<ossimXmlDocument> xmlDocument) { ossimString xpath; - vector<ossimRefPtr<ossimXmlNode> > xml_nodes; + std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes; //--- // Fetch the mission index (Formosat 1 or 2): @@ -2591,7 +2591,7 @@ bool ossimFormosatDimapSupportData::initFramePoints( ossimRefPtr<ossimXmlDocument> xmlDocument) { ossimString xpath; - vector<ossimRefPtr<ossimXmlNode> > xml_nodes; + std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes; //--- // Corner points: diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimFormosatDimapSupportData.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimFormosatDimapSupportData.h index c8146ba259b8a9cffa7387f5bf2fde426e6611a2..a63dfc7da6278429303a0f105e3602ef782927f8 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimFormosatDimapSupportData.h +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimFormosatDimapSupportData.h @@ -162,7 +162,7 @@ public: //--- // Convenient method to print important image info: //--- - void printInfo (ostream& os) const; + void printInfo (std::ostream& os) const; virtual bool saveState(ossimKeywordlist& kwl, const char* prefix = 0)const; diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimFormosatModel.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimFormosatModel.cpp index c6aa8a24157333efa1d7d565ae4bc6b4007262e8..212fd1e5b3f76933705e7e58504a7a20d5d0cc7b 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimFormosatModel.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimFormosatModel.cpp @@ -472,8 +472,8 @@ std::ostream& ossimplugins::ossimFormosatModel::print(std::ostream& out) const // Capture stream flags since we are going to mess with them. std::ios_base::fmtflags f = out.flags(); - out << "\nDump of ossimFormosatModel at address " << (hex) << this - << (dec) + out << "\nDump of ossimFormosatModel at address " << (std::hex) << this + << (std::dec) << "\n------------------------------------------------" << "\n theImageID = " << theImageID << "\n theMetadataFile = " << theMetaDataFile @@ -495,7 +495,7 @@ std::ostream& ossimplugins::ossimFormosatModel::print(std::ostream& out) const << "\n theYawRate = " << theYawRate << "\n theFocalLenOffset = " << theFocalLenOffset << "\n------------------------------------------------" - << "\n " << endl; + << "\n " << std::endl; // Set the flags back. out.flags(f); @@ -596,14 +596,14 @@ void ossimplugins::ossimFormosatModel::imagingRay(const ossimDpt& image_point, { ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG:\n\t Psi_x = " << Psi_x - << "\n\t Psi_y = " << Psi_y << endl; + << "\n\t Psi_y = " << Psi_y << std::endl; } ossimColumnVector3d u_sat (-tan(Psi_y), tan(Psi_x), -(1.0 + theFocalLenOffset)); if (traceDebug() || runtime_dbflag) { ossimNotify(ossimNotifyLevel_DEBUG) - << "DEBUG \n\t u_sat = " << u_sat << endl; + << "DEBUG \n\t u_sat = " << u_sat << std::endl; } // @@ -617,7 +617,7 @@ void ossimplugins::ossimFormosatModel::imagingRay(const ossimDpt& image_point, { ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG:\n\t theSatToOrbRotation = " << satToOrbit - << "\n\t u_orb = " << u_orb << endl; + << "\n\t u_orb = " << u_orb << std::endl; } // @@ -648,7 +648,7 @@ void ossimplugins::ossimFormosatModel::imagingRay(const ossimDpt& image_point, { ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG:\n\t orbToEcfRotation = " << orbToEcfRotation - << "\n\t u_ecf = " << u_ecf << endl; + << "\n\t u_ecf = " << u_ecf << std::endl; } // diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimFormosatModel.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimFormosatModel.h index e2b335345db7d5762efc4dbe49bb4ddeeb9a7fd1..d080c7524dd3c631ed0e6cf90f01c2d823205173 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimFormosatModel.h +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimFormosatModel.h @@ -94,7 +94,7 @@ public: * Writes a template of geom keywords processed by loadState and saveState * to output stream. */ - static void writeGeomTemplate(ostream& os); + static void writeGeomTemplate(std::ostream& os); /*! * Given an image point and height, initializes worldPoint. diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimGeometricSarSensorModel.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimGeometricSarSensorModel.cpp index 5b1d2d08e13aaa840a92854f6b0b0c64c37adb58..73632e755f4910aca7b1aba7ef47c552c0db4986 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimGeometricSarSensorModel.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimGeometricSarSensorModel.cpp @@ -133,7 +133,7 @@ namespace ossimplugins return time; } - bool ossimGeometricSarSensorModel::getPlatformPositionAtLine(double line, vector<double>& position, vector<double>& speed) + bool ossimGeometricSarSensorModel::getPlatformPositionAtLine(double line, std::vector<double>& position, std::vector<double>& speed) { JSDDateTime time = getTime(line); return _platformPosition->getPlatformPositionAtTime(time,position,speed); @@ -532,13 +532,13 @@ namespace ossimplugins // if (result) // { // ossimNotify(ossimNotifyLevel_DEBUG) -// << "calling saveState to verify loadState..." << endl; +// << "calling saveState to verify loadState..." << std::endl; // ossimKeywordlist kwl2; // saveState(kwl2, 0); // ossimNotify(ossimNotifyLevel_DEBUG) -// << "saveState result after loadState:" << kwl2 << endl; +// << "saveState result after loadState:" << kwl2 << std::endl; // } if (traceDebug()) @@ -574,7 +574,7 @@ namespace ossimplugins std::ostream& ossimGeometricSarSensorModel::print(std::ostream& out) const { - out << setprecision(15) << setiosflags(ios::fixed) + out << std::setprecision(15) << std::setiosflags(std::ios::fixed) << "\nossimGeometricSarSensorModel class data members:\n"; const char* prefix = 0; @@ -631,7 +631,7 @@ bool ossimGeometricSarSensorModel::createReplacementOCG() if (traceDebug()) { - ossimNotify(ossimNotifyLevel_NOTICE)<<"\nComputing coarse grid..."<<endl; + ossimNotify(ossimNotifyLevel_NOTICE)<<"\nComputing coarse grid..."<<std::endl; } _replacementOcgModel->buildGrid(theImageClipRect, this, 500.00, true, false); diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimGeometricSarSensorModel.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimGeometricSarSensorModel.h index 40f33c522a99623027be72c0394cdb7c419f4dfa..967b289e95c4d8949b33643e949fa7d37dcaa1f6 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimGeometricSarSensorModel.h +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimGeometricSarSensorModel.h @@ -118,7 +118,7 @@ public: * @param position Position of the sensor at line line * @param speed Speed of the sensor at line line */ - virtual bool getPlatformPositionAtLine(double line, vector<double>& position, vector<double>& speed); + virtual bool getPlatformPositionAtLine(double line, std::vector<double>& position, std::vector<double>& speed); /** * @brief This function is able to convert image coordinates into world diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPleiadesDimapSupportData.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPleiadesDimapSupportData.cpp index aa0691d81010e5d1e0499884aff5e2056c6dfe8c..fe0de3e05b90e5fd53f43a85aef92196ec599683 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPleiadesDimapSupportData.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPleiadesDimapSupportData.cpp @@ -99,7 +99,7 @@ namespace ossimplugins ossimString xpath, ossimString& nodeValue) { - vector<ossimRefPtr<ossimXmlNode> > xml_nodes; + std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes; xmlDocument->findNodes(xpath, xml_nodes); if (xml_nodes.size() == 0) @@ -286,7 +286,7 @@ namespace ossimplugins theSwathLastCol = 0; } - void ossimPleiadesDimapSupportData::printInfo(ostream& os) const + void ossimPleiadesDimapSupportData::printInfo(std::ostream& os) const { os << "\n----------------- Info on Pleiades Image -------------------" @@ -1249,7 +1249,7 @@ namespace ossimplugins ossimRefPtr<ossimXmlDocument> xmlDocument) { ossimString xpath; - vector<ossimRefPtr<ossimXmlNode> > xml_nodes; + std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes; //--- // Fetch the Image ID: @@ -1292,7 +1292,7 @@ namespace ossimplugins ossimRefPtr<ossimXmlDocument> xmlDocument) { ossimString xpath, nodeValue; - vector<ossimRefPtr<ossimXmlNode> > xml_nodes; + std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes; //--- // Corner points: @@ -1574,7 +1574,7 @@ namespace ossimplugins { static const char MODULE[] = "ossimPleiadesDimapSupportData::parseRPCMetadata"; ossimString xpath, nodeValue; - vector<ossimRefPtr<ossimXmlNode> > xml_nodes; + std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes; //--- // Fetch the Global RFM - Direct Model - Bias: @@ -1919,7 +1919,7 @@ namespace ossimplugins { // static const char MODULE[] = "ossimPleiadesDimapSupportData::parseMetadataIdentification"; - vector<ossimRefPtr<ossimXmlNode> > xml_nodes; + std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes; ossimString xpath, nodeValue; theXmlDocumentRoot = "/PHR_Dimap_Document"; @@ -1971,7 +1971,7 @@ namespace ossimplugins { // static const char MODULE[] = "ossimPleiadesDimapSupportData::parseMetadataIdentification"; - vector<ossimRefPtr<ossimXmlNode> > xml_nodes; + std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes; ossimString xpath, nodeValue; theXmlDocumentRoot = "/DIMAP_Document"; @@ -1990,7 +1990,7 @@ namespace ossimplugins theXmlDocumentRoot = "/PHR_DIMAP_Document"; if (traceDebug()) { - ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG:\nTry to use the old root: " << theXmlDocumentRoot << endl; + ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG:\nTry to use the old root: " << theXmlDocumentRoot << std::endl; } xml_nodes.clear(); @@ -2005,7 +2005,7 @@ namespace ossimplugins theXmlDocumentRoot = "/Dimap_Document"; if (traceDebug()) { - ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG:\nTry to use the new root: " << theXmlDocumentRoot << endl; + ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG:\nTry to use the new root: " << theXmlDocumentRoot << std::endl; } xml_nodes.clear(); @@ -2017,7 +2017,7 @@ namespace ossimplugins setErrorStatus(); if (traceDebug()) { - ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG:\nCould not find: " << xpath << endl; + ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG:\nCould not find: " << xpath << std::endl; } return false; } @@ -2113,7 +2113,7 @@ namespace ossimplugins { // static const char MODULE[] = "ossimPleiadesDimapSupportData::parseProcessingInformation"; - vector<ossimRefPtr<ossimXmlNode> > xml_nodes; + std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes; ossimString xpath, nodeValue; //--- @@ -2156,7 +2156,7 @@ namespace ossimplugins bool ossimPleiadesDimapSupportData::parseRasterData(ossimRefPtr<ossimXmlDocument> xmlDocument) { static const char MODULE[] = "ossimPleiadesDimapSupportData::parseRasterData"; - vector<ossimRefPtr<ossimXmlNode> > xml_nodes; + std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes; ossimString xpath, nodeValue; //--- // Fetch if the product file is linked to one or many JP2 files: @@ -2471,7 +2471,7 @@ namespace ossimplugins bool ossimPleiadesDimapSupportData::parseGeometricData(ossimRefPtr<ossimXmlDocument> xmlDocument) { ossimString xpath, nodeValue; - vector<ossimRefPtr<ossimXmlNode> > xml_nodes; + std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes; xml_nodes.clear(); if (theDIMAPVersion == OSSIM_PLEIADES_DIMAPv1) @@ -2760,7 +2760,7 @@ namespace ossimplugins { // static const char MODULE[] = "ossimPleiadesDimapSupportData::parseDatasetSources"; ossimString xpath, nodeValue; - vector<ossimRefPtr<ossimXmlNode> > xml_nodes; + std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes; //--- // Fetch the mission index (1A or 1B) ? diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPleiadesDimapSupportData.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPleiadesDimapSupportData.h index 0eb9e3fb1c0ab7a31e8088f450d8055efb987f0b..a58259fe617cde9b5fa6530b54687d1fd5c4ec84 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPleiadesDimapSupportData.h +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPleiadesDimapSupportData.h @@ -82,7 +82,7 @@ namespace ossimplugins //--- // Convenient method to print important image info: //--- - void printInfo (ostream& os) const; + void printInfo (std::ostream& os) const; /** * Method to save the state of the object to a keyword list. diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPleiadesModel.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPleiadesModel.cpp index 0515c186c6486272f7ac58b5befb6d6274a72359..de1148fcdbc42f78de5dddf01037d1a35e7429fd 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPleiadesModel.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPleiadesModel.cpp @@ -107,8 +107,8 @@ namespace ossimplugins // Capture stream flags since we are going to mess with them. std::ios_base::fmtflags f = out.flags(); - out << "\nDump of ossimPleiadesModel at address " << (hex) << this - << (dec) + out << "\nDump of ossimPleiadesModel at address " << (std::hex) << this + << (std::dec) << "\n------------------------------------------------" << "\n theImageID = " << theImageID << "\n theImageSize = " << theImageSize @@ -116,7 +116,7 @@ namespace ossimplugins << "\n theRefImgPt = " << theRefImgPt << "\n theProcessingLevel = " << theSupportData->getProcessingLevel() << "\n------------------------------------------------" - << "\n " << endl; + << "\n " << std::endl; // Set the flags back. out.flags(f); diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2Model.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2Model.cpp index c004e4231222942d79431bc84b9db74a9f150f13..a1c313364f5568e6b3c0e63355646edcf551154f 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2Model.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2Model.cpp @@ -115,7 +115,7 @@ double ossimRadarSat2Model::getSlantRangeFromGeoreferenced(double col) const << "\n(col-_refPoint->get_pix_col()) " << (col-_refPoint->get_pix_col()) << "\n_refPoint->get_pix_col() : " << _refPoint->get_pix_col() - << "\n relativeGroundRange : " << relativeGroundRange << endl; + << "\n relativeGroundRange : " << relativeGroundRange << std::endl; } int numSet = FindSRGRSetNumber((_refPoint->get_ephemeris())->get_date()) ; @@ -303,7 +303,7 @@ bool ossimRadarSat2Model::open(const ossimFilename& file) ossimNotify(ossimNotifyLevel_DEBUG) << "theImageClipRect : " << theImageClipRect << "ul, ur, lr, ll " << ul << ", " << ur - << ", " << lr << " , " << ll << endl; + << ", " << lr << " , " << ll << std::endl; } setGroundRect(ul, ur, lr, ll); // ossimSensorModel method. @@ -328,7 +328,7 @@ std::ostream& ossimRadarSat2Model::print(std::ostream& out) const // Capture the original flags. std::ios_base::fmtflags f = out.flags(); - out << setprecision(15) << setiosflags(ios::fixed) + out << std::setprecision(15) << std::setiosflags(std::ios::fixed) << "\nossimRadarSat2Model class data members:\n" << "_n_srgr: " << _n_srgr << "\n"; diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2ProductDoc.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2ProductDoc.cpp index 6e857e58e801ce2f1cd66053ff65547c1552ace5..02a67f4d50d25f9d799f787af3939b69666727b7 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2ProductDoc.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2ProductDoc.cpp @@ -711,10 +711,10 @@ RPCModel ossimRadarSat2ProductDoc::getRpcData(const ossimXmlDocument* xdoc) cons double longitudeScale = 0; double heightScale = 0; - vector<double> lineNumeratorCoefficients = vector<double>(20,0); - vector<double> lineDenominatorCoefficients = vector<double>(20,0); - vector<double> pixelNumeratorCoefficients = vector<double>(20,0); - vector<double> pixelDenominatorCoefficients = vector<double>(20,0); + std::vector<double> lineNumeratorCoefficients = std::vector<double>(20,0); + std::vector<double> lineDenominatorCoefficients = std::vector<double>(20,0); + std::vector<double> pixelNumeratorCoefficients = std::vector<double>(20,0); + std::vector<double> pixelDenominatorCoefficients = std::vector<double>(20,0); //the final string outputs to the text file @@ -724,66 +724,66 @@ RPCModel ossimRadarSat2ProductDoc::getRpcData(const ossimXmlDocument* xdoc) cons if (rs2Check) { if (!ossim::getPath(searchbiasError, xdoc, biasErrorStr)) - ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << endl; + ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << std::endl; biasError = biasErrorStr.toDouble(); if (!ossim::getPath(searchrandomError, xdoc, randomErrorStr)) - ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << endl; + ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << std::endl; randomError = randomErrorStr.toDouble(); if (!ossim::getPath(searchlineFitQuality, xdoc, lineFitQualityStr)) - ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << endl; + ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << std::endl; lineFitQuality = lineFitQualityStr.toDouble(); if (!ossim::getPath(searchpixelFitQuality, xdoc, pixelFitQualityStr)) - ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << endl; + ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << std::endl; pixelFitQuality = pixelFitQualityStr.toDouble(); if (!ossim::getPath(searchlineOffset, xdoc, lineOffsetStr)) - ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << endl; + ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << std::endl; lineOffset = lineOffsetStr.toDouble(); if (!ossim::getPath(searchpixelOffset, xdoc, pixelOffsetStr)) - ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << endl; + ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << std::endl; pixelOffset = pixelOffsetStr.toDouble(); if (!ossim::getPath(searchlatitudeOffset, xdoc, latitudeOffsetStr)) - ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << endl; + ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << std::endl; latitudeOffset = latitudeOffsetStr.toDouble(); if (!ossim::getPath(searchlongitudeOffset, xdoc, longitudeOffsetStr)) - ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << endl; + ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << std::endl; longitudeOffset = longitudeOffsetStr.toDouble(); if (!ossim::getPath(searchheightOffset, xdoc, heightOffsetStr)) - ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << endl; + ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << std::endl; heightOffset = heightOffsetStr.toDouble(); // -------------- if (!ossim::getPath(searchlineScale, xdoc, lineScaleStr)) - ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << endl; + ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << std::endl; lineScale = lineScaleStr.toDouble(); if (!ossim::getPath(searchpixelScale, xdoc, pixelScaleStr)) - ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << endl; + ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << std::endl; pixelScale = pixelScaleStr.toDouble(); if (!ossim::getPath(searchlatitudeScale, xdoc, latitudeScaleStr)) - ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << endl; + ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << std::endl; latitudeScale = latitudeScaleStr.toDouble(); // ----------------------- if (!ossim::getPath(searchlongitudeScale, xdoc, longitudeScaleStr)) - ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << endl; + ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << std::endl; longitudeScale = longitudeScaleStr.toDouble(); if (!ossim::getPath(searchheightScale, xdoc, heightScaleStr)) - ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << endl; + ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << std::endl; heightScale = heightScaleStr.toDouble(); // ---- parameters for reading in coeefs ------------ @@ -794,7 +794,7 @@ RPCModel ossimRadarSat2ProductDoc::getRpcData(const ossimXmlDocument* xdoc) cons if (!ossim::getPath(searchlineNumeratorCoefficients, xdoc, lineNumeratorCoefficientsStr)) - ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << endl; + ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << std::endl; string lineNumeratorCoefficientsStr_N = lineNumeratorCoefficientsStr[0]; @@ -810,7 +810,7 @@ RPCModel ossimRadarSat2ProductDoc::getRpcData(const ossimXmlDocument* xdoc) cons // ------------------ if (!ossim::getPath(searchlineDenominatorCoefficients, xdoc, lineDenominatorCoefficientsStr)) - ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << endl; + ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << std::endl; string lineDenominatorCoefficientsStr_N = lineDenominatorCoefficientsStr[0]; @@ -827,7 +827,7 @@ RPCModel ossimRadarSat2ProductDoc::getRpcData(const ossimXmlDocument* xdoc) cons // ------------------ if (!ossim::getPath(searchpixelNumeratorCoefficients, xdoc, pixelNumeratorCoefficientsStr)) - ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << endl; + ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << std::endl; string pixelNumeratorCoefficientsStr_N = pixelNumeratorCoefficientsStr[0]; @@ -843,7 +843,7 @@ RPCModel ossimRadarSat2ProductDoc::getRpcData(const ossimXmlDocument* xdoc) cons // ------------------ if (!ossim::getPath(searchpixelDenominatorCoefficients, xdoc, pixelDenominatorCoefficientsStr)) - ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << endl; + ossimNotify(ossimNotifyLevel_WARN) << "ERROR: UNABLE TO FIND RS2 RPC COEFFICIENT INFORMATION" << std::endl; string pixelDenominatorCoefficientsStr_N = pixelDenominatorCoefficientsStr[0]; diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSatModel.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSatModel.cpp index c859a162ecb694ae48b0fff4c5cf6595be8f305c..a8199355737f96100976c9f97d510312b7af12d1 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSatModel.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSatModel.cpp @@ -158,24 +158,24 @@ bool ossimRadarSatModel::open(const ossimFilename& file) ossimFilename dataFilePath; ossimFilename volumeDirectoryFilePath; std::string input_file = file; - string::size_type loc_DAT = input_file.find( "DAT_01", 0 ); - string::size_type loc_dat = input_file.find( "dat_01", 0 ); - if ( (loc_DAT != string::npos ) || ( loc_dat != string::npos ) ) + std::string::size_type loc_DAT = input_file.find( "DAT_01", 0 ); + std::string::size_type loc_dat = input_file.find( "dat_01", 0 ); + if ( (loc_DAT != std::string::npos ) || ( loc_dat != std::string::npos ) ) { dataFilePath = input_file.c_str(); - if (loc_DAT != string::npos ) input_file.replace(loc_DAT, 6, "VDF_DAT"); - if (loc_dat != string::npos ) input_file.replace(loc_dat, 6, "vdf_dat"); + if (loc_DAT != std::string::npos ) input_file.replace(loc_DAT, 6, "VDF_DAT"); + if (loc_dat != std::string::npos ) input_file.replace(loc_dat, 6, "vdf_dat"); volumeDirectoryFilePath = input_file.c_str(); } else { - string::size_type loc_VDF = input_file.find( "VDF_DAT", 0 ); - string::size_type loc_vdf = input_file.find( "vdf_dat", 0 ); - if ( (loc_VDF != string::npos ) || ( loc_vdf != string::npos ) ) + std::string::size_type loc_VDF = input_file.find( "VDF_DAT", 0 ); + std::string::size_type loc_vdf = input_file.find( "vdf_dat", 0 ); + if ( (loc_VDF != std::string::npos ) || ( loc_vdf != std::string::npos ) ) { volumeDirectoryFilePath = input_file.c_str(); - if (loc_VDF != string::npos ) input_file.replace(loc_VDF, 7, "DAT_01"); - if (loc_vdf != string::npos ) input_file.replace(loc_vdf, 7, "dat_01"); + if (loc_VDF != std::string::npos ) input_file.replace(loc_VDF, 7, "DAT_01"); + if (loc_vdf != std::string::npos ) input_file.replace(loc_vdf, 7, "dat_01"); dataFilePath = input_file.c_str(); } else @@ -224,7 +224,7 @@ bool ossimRadarSatModel::open(const ossimFilename& file) RadarSatRecordHeader headerVDF; VolumeDirFactory factoryVDF; - ifstream volumeDirFile (volumeDirectoryFilePath.c_str(), ios::in|ios::binary); + std::ifstream volumeDirFile (volumeDirectoryFilePath.c_str(), std::ios::in|std::ios::binary); volumeDirFile>>headerVDF; if(volumeDirFile.eof()) { @@ -269,7 +269,7 @@ bool ossimRadarSatModel::open(const ossimFilename& file) //Reading of the remaining of the volume directory file volumeDirFile.close(); - volumeDirFile.open(volumeDirectoryFilePath.c_str(), ios::in | ios::binary); + volumeDirFile.open(volumeDirectoryFilePath.c_str(), std::ios::in | std::ios::binary); volumeDirFile >> *_volumeDir; volumeDirFile.close(); @@ -280,7 +280,7 @@ bool ossimRadarSatModel::open(const ossimFilename& file) RadarSatRecordHeader headerDAT; DataFactory factoryDAT; - ifstream dataFile (dataFilePath.c_str(), ios::in|ios::binary); + std::ifstream dataFile (dataFilePath.c_str(), std::ios::in|std::ios::binary); dataFile>>headerDAT; if(dataFile.eof()) { @@ -302,7 +302,7 @@ bool ossimRadarSatModel::open(const ossimFilename& file) /* * Reading the remaining of the data file */ - dataFile.open(dataFilePath.c_str(), ios::in|ios::binary); + dataFile.open(dataFilePath.c_str(), std::ios::in|std::ios::binary); dataFile>>*_data; dataFile.close(); @@ -329,12 +329,12 @@ bool ossimRadarSatModel::open(const ossimFilename& file) * Warning : the filename case has to be homogenous */ std::string leader_file = dataFilePath; - string::size_type loc = leader_file.find( "DAT_01", 0 ); - if( loc != string::npos ) leader_file.replace(loc, 6, "LEA_01" ); // upper case test + std::string::size_type loc = leader_file.find( "DAT_01", 0 ); + if( loc != std::string::npos ) leader_file.replace(loc, 6, "LEA_01" ); // upper case test else { loc = leader_file.find( "dat_01", 0 ); - if( loc != string::npos ) leader_file.replace(loc, 6, "lea_01" ); // lower case test + if( loc != std::string::npos ) leader_file.replace(loc, 6, "lea_01" ); // lower case test else { ossimNotify(ossimNotifyLevel_DEBUG) << "File Name not coherent (searching for *DAT_01* or *dat_01*) : " << file << std::endl; @@ -355,7 +355,7 @@ bool ossimRadarSatModel::open(const ossimFilename& file) /* * Leader file data reading */ - ifstream leaderFile (leaderFilePath.c_str(), ios::in|ios::binary); + std::ifstream leaderFile (leaderFilePath.c_str(), std::ios::in|std::ios::binary); leaderFile>>*_leader; leaderFile.close(); if(traceDebug()) @@ -370,11 +370,11 @@ bool ossimRadarSatModel::open(const ossimFilename& file) */ std::string trailer_file = dataFilePath; loc = trailer_file.find( "DAT_01", 0 ); - if( loc != string::npos ) trailer_file.replace(loc, 6, "TRA_01" ); // upper case test + if( loc != std::string::npos ) trailer_file.replace(loc, 6, "TRA_01" ); // upper case test else { loc = trailer_file.find( "dat_01", 0 ); - if( loc != string::npos ) trailer_file.replace(loc, 6, "tra_01" ); // lower case test + if( loc != std::string::npos ) trailer_file.replace(loc, 6, "tra_01" ); // lower case test else { ossimNotify(ossimNotifyLevel_DEBUG) << "File Name not coherent (searching for *DAT_01* or *dat_01*) : " << file << std::endl; @@ -395,7 +395,7 @@ bool ossimRadarSatModel::open(const ossimFilename& file) /* * Trailer file data reading */ - ifstream trailerFile (trailerFilePath.c_str(), ios::in|ios::binary); + std::ifstream trailerFile (trailerFilePath.c_str(), std::ios::in|std::ios::binary); trailerFile>>*_trailer; trailerFile.close(); if(traceDebug()) diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1Model.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1Model.cpp index 3832701fe39a34a17079a43d8ff1a38a85aa6877..caad19359c90da6c982376cfb2230887e9dfd28d 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1Model.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1Model.cpp @@ -116,14 +116,14 @@ namespace ossimplugins // Capture stream flags since we are going to mess with them. std::ios_base::fmtflags f = out.flags(); - out << "\nDump of ossimSentinel1Model at address " << hex << this - << dec + out << "\nDump of ossimSentinel1Model at address " << std::hex << this + << std::dec << "\n------------------------------------------------" << "\n theImageID = " << theImageID << "\n theImageSize = " << theImageSize << "\n------------------------------------------------" - << "\n " << endl; + << "\n " << std::endl; // Set the flags back. out.flags(f); @@ -377,7 +377,7 @@ namespace ossimplugins const ossimString prefix = "support_data."; const ossimString xpath = "/xfdu:XFDU/dataObjectSection/dataObject"; - vector<ossimRefPtr<ossimXmlNode> > xml_nodes; + std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes; theManifestDoc->findNodes(xpath, xml_nodes); @@ -1264,9 +1264,9 @@ namespace ossimplugins double ossimSentinel1Model::getBandTerrainHeight(ossimXmlDocument const& productXmlDocument) { double heightSum = 0.0; - vector< ossimXmlNodePtr > heightList; + std::vector< ossimXmlNodePtr > heightList; productXmlDocument.findNodes("/product/generalAnnotation/terrainHeightList/terrainHeight", heightList); - vector<ossimXmlNodePtr >::const_iterator it = heightList.begin(); + std::vector<ossimXmlNodePtr >::const_iterator it = heightList.begin(); for ( ; it != heightList.end() ; ++it) { heightSum += getOptionalTextFromFirstNode(**it, "value").toFloat64(); diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSpot6DimapSupportData.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSpot6DimapSupportData.cpp index 185f29d37c715f6ba75cb4d45dabcab0a01adb37..e8b44481840f91a0e753699ec9c39df62176a895 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSpot6DimapSupportData.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSpot6DimapSupportData.cpp @@ -99,7 +99,7 @@ namespace ossimplugins ossimString xpath, ossimString& nodeValue) { - vector<ossimRefPtr<ossimXmlNode> > xml_nodes; + std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes; xmlDocument->findNodes(xpath, xml_nodes); if (xml_nodes.size() == 0) @@ -269,7 +269,7 @@ namespace ossimplugins theSpecId = ""; } - void ossimSpot6DimapSupportData::printInfo(ostream& os) const + void ossimSpot6DimapSupportData::printInfo(std::ostream& os) const { os << "\n----------------- Info on Spot6 Image -------------------" @@ -1110,7 +1110,7 @@ namespace ossimplugins ossimRefPtr<ossimXmlDocument> xmlDocument) { ossimString xpath; - vector<ossimRefPtr<ossimXmlNode> > xml_nodes; + std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes; //--- // Fetch the Image ID: @@ -1139,7 +1139,7 @@ namespace ossimplugins ossimRefPtr<ossimXmlDocument> xmlDocument) { ossimString xpath, nodeValue; - vector<ossimRefPtr<ossimXmlNode> > xml_nodes; + std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes; //--- // Corner points: @@ -1401,7 +1401,7 @@ namespace ossimplugins { static const char MODULE[] = "ossimSpot6DimapSupportData::parseRPCMetadata"; ossimString xpath, nodeValue; - vector<ossimRefPtr<ossimXmlNode> > xml_nodes; + std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes; //--- // Fetch the Global RFM - Direct Model - Bias: @@ -1612,7 +1612,7 @@ namespace ossimplugins { static const char MODULE[] = "ossimSpot6DimapSupportData::parseMetadataIdentification"; - vector<ossimRefPtr<ossimXmlNode> > xml_nodes; + std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes; ossimString xpath, nodeValue; theXmlDocumentRoot = "/DIMAP_Document"; @@ -1632,7 +1632,7 @@ namespace ossimplugins theXmlDocumentRoot = "/SPOT_DIMAP_Document"; if (traceDebug()) { - ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG:\nTry to use the old root: " << theXmlDocumentRoot << endl; + ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG:\nTry to use the old root: " << theXmlDocumentRoot << std::endl; } xml_nodes.clear(); @@ -1647,7 +1647,7 @@ namespace ossimplugins theXmlDocumentRoot = "/Dimap_Document"; if (traceDebug()) { - ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG:\nTry to use the new root: " << theXmlDocumentRoot << endl; + ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG:\nTry to use the new root: " << theXmlDocumentRoot << std::endl; } xml_nodes.clear(); @@ -1659,7 +1659,7 @@ namespace ossimplugins setErrorStatus(); if (traceDebug()) { - ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG:\nCould not find: " << xpath << endl; + ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG:\nCould not find: " << xpath << std::endl; } return false; } @@ -1758,7 +1758,7 @@ namespace ossimplugins { static const char MODULE[] = "ossimSpot6DimapSupportData::parseProcessingInformation"; - vector<ossimRefPtr<ossimXmlNode> > xml_nodes; + std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes; ossimString xpath, nodeValue; //--- @@ -1787,7 +1787,7 @@ namespace ossimplugins bool ossimSpot6DimapSupportData::parseRasterData(ossimRefPtr<ossimXmlDocument> xmlDocument) { static const char MODULE[] = "ossimSpot6DimapSupportData::parseRasterData"; - vector<ossimRefPtr<ossimXmlNode> > xml_nodes; + std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes; ossimString xpath, nodeValue; //--- // Fetch if the product file is linked to one or many JP2 files: @@ -2005,7 +2005,7 @@ namespace ossimplugins bool ossimSpot6DimapSupportData::parseGeometricData(ossimRefPtr<ossimXmlDocument> xmlDocument) { ossimString xpath; - vector<ossimRefPtr<ossimXmlNode> > xml_nodes; + std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes; xml_nodes.clear(); xpath = "/Geometric_Data/Use_Area/Located_Geometric_Values"; //DIMAPv2 @@ -2125,7 +2125,7 @@ namespace ossimplugins { static const char MODULE[] = "ossimSpot6DimapSupportData::parseDatasetSources"; ossimString xpath, nodeValue; - vector<ossimRefPtr<ossimXmlNode> > xml_nodes; + std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes; //--- // Fetch the mission index (1A or 1B) ? diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSpot6DimapSupportData.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSpot6DimapSupportData.h index 1431d0d2053c92a4270240b556052388483ba8d2..f0860ce8e02ec984333ae3aba377a259a09c93f6 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSpot6DimapSupportData.h +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSpot6DimapSupportData.h @@ -81,7 +81,7 @@ namespace ossimplugins //--- // Convenient method to print important image info: //--- - void printInfo (ostream& os) const; + void printInfo (std::ostream& os) const; /** * Method to save the state of the object to a keyword list. diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSpot6Model.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSpot6Model.cpp index ba5725b4ee465cf9303b53b6a47d8aff24858c43..76caf5a0c97357a5991b179228ab82b58f5ea6c7 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSpot6Model.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSpot6Model.cpp @@ -107,8 +107,8 @@ namespace ossimplugins // Capture stream flags since we are going to mess with them. std::ios_base::fmtflags f = out.flags(); - out << "\nDump of ossimSpot6Model at address " << (hex) << this - << (dec) + out << "\nDump of ossimSpot6Model at address " << (std::hex) << this + << (std::dec) << "\n------------------------------------------------" << "\n theImageID = " << theImageID << "\n theImageSize = " << theImageSize @@ -116,7 +116,7 @@ namespace ossimplugins << "\n theRefImgPt = " << theRefImgPt << "\n theProcessingLevel = " << theSupportData->getProcessingLevel() << "\n------------------------------------------------" - << "\n " << endl; + << "\n " << std::endl; // Set the flags back. out.flags(f); diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarModel.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarModel.cpp index 85896683028bc4a29f4e4a3d0ab8d828cfee64f3..215572c815b1a3ffe8f56b357d7b015f44197992 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarModel.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarModel.cpp @@ -856,7 +856,7 @@ std::ostream& ossimplugins::ossimTerraSarModel::print(std::ostream& out) const // Capture the original flags. std::ios_base::fmtflags f = out.flags(); - out << setprecision(15) << setiosflags(ios::fixed) + out << std::setprecision(15) << std::setiosflags(std::ios::fixed) << "\nossimTerraSarModelclass data members:\n" << SR_GR_R0_KW << _SrToGr_R0 << "\n"; @@ -1546,7 +1546,7 @@ bool ossimplugins::ossimTerraSarModel::initSensorParams(const ossimXmlDocument* if (traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) - << "result for tsDoc.initSensorParams " << result << endl; + << "result for tsDoc.initSensorParams " << result << std::endl; } if (!result) @@ -2436,7 +2436,7 @@ bool ossimplugins::ossimTerraSarModel::findTSXLeader(const ossimFilename& file, } -void ossimplugins::ossimTerraSarModel::printInfo(ostream& os) const +void ossimplugins::ossimTerraSarModel::printInfo(std::ostream& os) const { os << "\n----------------- General Info on TSX-1 Image -------------------" << "\n " diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarModel.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarModel.h index de847a3868071303f70899e7e14cd4f84487c6c0..46715aa3cb64552bc9c5722526daed694bdde4cf 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarModel.h +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarModel.h @@ -118,7 +118,7 @@ namespace ossimplugins //--- // Convenient method to print important image info: //--- - void printInfo (ostream& os) const; + void printInfo (std::ostream& os) const; private: diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTileMapModel.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTileMapModel.cpp index 6d887e7f905344c18ed6f05513dc9baa4fed8100..f568252889aeeb34fd4d3a1464bf6a8f1a79b1d8 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTileMapModel.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTileMapModel.cpp @@ -184,7 +184,7 @@ namespace ossimplugins std::ostream& ossimTileMapModel::print(std::ostream& os) const { os << "\nDump of ossimTileMapModel object at " - << hex << this << ":\n" + << std::hex << this << ":\n" << "\nTileMapModel -- Dump of all data members: " << "\n theImageID: " << theImageID.chars() << "\n theImageSize: " << theImageSize @@ -193,7 +193,7 @@ namespace ossimplugins << "\n theGSD.line: " << theGSD.line << "\n theGSD.samp: " << theGSD.samp << "\n qDepth: " << qDepth - << endl; + << std::endl; return ossimSensorModel::print(os); } @@ -282,7 +282,7 @@ namespace ossimplugins // Writes a sample kwl to output stream. // //***************************************************************************** - void ossimTileMapModel::writeGeomTemplate(ostream& os) + void ossimTileMapModel::writeGeomTemplate(std::ostream& os) { if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimTileMapModel::writeGeomTemplate: entering..." << std::endl; @@ -290,7 +290,7 @@ namespace ossimplugins "//**************************************************************\n" "// Template for TileMap model keywordlist\n" "//**************************************************************\n" - << ossimKeywordNames::TYPE_KW << ": " << "ossimTileMapModel" << endl; + << ossimKeywordNames::TYPE_KW << ": " << "ossimTileMapModel" << std::endl; if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimTileMapModel::writeGeomTemplate: returning..." << std::endl; diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTileMapModel.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTileMapModel.h index 33d9f30748c9eb85b090cf75fe1646e970ee390a..8d98e2e987e3ad75160730fff5affc6af5c2aa54 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTileMapModel.h +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTileMapModel.h @@ -95,7 +95,7 @@ public: * Writes a template of geom keywords processed by loadState and saveState * to output stream. */ - static void writeGeomTemplate(ostream& os); + static void writeGeomTemplate(std::ostream& os); //*** // Overrides base class pure virtual. diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/otb/IncidenceAngles.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/otb/IncidenceAngles.cpp index 8dc860f17f33c06b1a34b24777af9e46c566106b..d030d025fe7d757cdb3675c48f22e1de6467b9a7 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/otb/IncidenceAngles.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/otb/IncidenceAngles.cpp @@ -148,7 +148,7 @@ bool IncidenceAngles::loadState(const ossimKeywordlist& kwl, const char* prefix) std::ostream& IncidenceAngles::print(std::ostream& out) const { - out << setprecision(15) << setiosflags(ios::fixed) + out << std::setprecision(15) << std::setiosflags(std::ios::fixed) << "\n IncidentAngles class data members:\n"; const char* prefix = 0; diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/otb/Noise.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/otb/Noise.cpp index dfa8168b253687d44598826227bfe402eadf3c53..7b9ca1c5274ba71b7d16489f8aefa643754c5332 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/otb/Noise.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/otb/Noise.cpp @@ -149,7 +149,7 @@ bool Noise::loadState(const ossimKeywordlist& kwl, const char* prefix) std::ostream& Noise::print(std::ostream& out) const { - out << setprecision(15) << setiosflags(ios::fixed) + out << std::setprecision(15) << std::setiosflags(std::ios::fixed) << "\n Noise class data members:\n"; const char* prefix = 0; diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/otb/RadarSat2NoiseLevel.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/otb/RadarSat2NoiseLevel.cpp index 2742fcdd785030bbb6f38ddfa6cf7df5d4360c00..f2f64cb48db94fa4ca8f7df80a9df7af8a141220 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/otb/RadarSat2NoiseLevel.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/otb/RadarSat2NoiseLevel.cpp @@ -313,7 +313,7 @@ bool RadarSat2NoiseLevel::loadState(const ossimKeywordlist& kwl, const char* pre std::ostream& RadarSat2NoiseLevel::print(std::ostream& out) const { - out << setprecision(15) << setiosflags(ios::fixed) + out << std::setprecision(15) << std::setiosflags(std::ios::fixed) << "\n RadarSat2NoiseLevel class data members:\n"; //const char* prefix = 0; diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/otb/SceneCoord.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/otb/SceneCoord.cpp index 8eacd1c958dfe01ba7f0776b8bff018e6d249c70..1bbc15c7d6224a612c2e15c07200e32bfd0d181d 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/otb/SceneCoord.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/otb/SceneCoord.cpp @@ -152,7 +152,7 @@ bool SceneCoord::loadState(const ossimKeywordlist& kwl, const char* prefix) std::ostream& SceneCoord::print(std::ostream& out) const { - out << setprecision(15) << setiosflags(ios::fixed) + out << std::setprecision(15) << std::setiosflags(std::ios::fixed) << "\n SceneCoord class data members:\n"; const char* prefix = 0; diff --git a/Modules/Wrappers/SWIG/src/CMakeLists.txt b/Modules/Wrappers/SWIG/src/CMakeLists.txt index ebae699688ad14b987db947246cb24dd719da0fa..ec5b62ad216cedb687ede6461d1ab08e33ff4cca 100644 --- a/Modules/Wrappers/SWIG/src/CMakeLists.txt +++ b/Modules/Wrappers/SWIG/src/CMakeLists.txt @@ -18,18 +18,10 @@ # limitations under the License. # -if ( OTB_WRAP_PYTHON ) - include ( UseSWIGLocal ) - list(APPEND SWIG_EXTRA_DEPS - otbWrapperSWIGIncludes.h - itkBase.includes - ${CMAKE_CURRENT_SOURCE_DIR}/itkBase.i - ${CMAKE_CURRENT_SOURCE_DIR}/itkMacro.i - ) - include_directories ( ${CMAKE_CURRENT_SOURCE_DIR} ) -endif() +include(UseSWIG) +include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ) # Python SWIG configuration if ( OTB_WRAP_PYTHON ) add_subdirectory(python) -endif() \ No newline at end of file +endif() diff --git a/Modules/Wrappers/SWIG/src/otbApplication.i b/Modules/Wrappers/SWIG/src/otbApplication.i index 3cf79c5d8991ba6e59eeb21ea75b39f6775b60f5..2f4139254868b91935628529664031ff5fff91e1 100644 --- a/Modules/Wrappers/SWIG/src/otbApplication.i +++ b/Modules/Wrappers/SWIG/src/otbApplication.i @@ -271,8 +271,10 @@ public: logger = self.GetLogger() logger.AddLogOutput(_libraryLogOutput.GetPointer()) + self.progressReportManager = ProgressReporterManager_New() + self.progressReportManager.SetLogOutputCallback(_libraryLogCallback) self.AddObserver(AddProcessToWatchEvent(), - _libraryProgressReportManager.GetAddProcessCommand() + self.progressReportManager.GetAddProcessCommand() ) } } @@ -605,146 +607,149 @@ class ApplicationProxy(object): %pythoncode { - def GetParameterTypeAsString(self, parameter_type): - return { - ParameterType_String : 'ParameterType_String', - ParameterType_InputFilename : 'ParameterType_InputFilename', - ParameterType_OutputImage : 'ParameterType_OutputImage', - ParameterType_OutputVectorData : 'ParameterType_OutputVectorData', - ParameterType_OutputFilename : 'ParameterType_OutputFilename', - ParameterType_Directory : 'ParameterType_Directory', - ParameterType_InputImage : 'ParameterType_InputImage', - ParameterType_InputVectorData : 'ParameterType_InputVectorData', - ParameterType_InputImageList : 'ParameterType_InputImageList', - ParameterType_InputVectorDataList : 'ParameterType_InputImageList', - ParameterType_InputFilenameList : 'ParameterType_InputFilenameList', - ParameterType_StringList : 'ParameterType_StringList', - ParameterType_ListView : 'ParameterType_ListView', - ParameterType_Int : 'ParameterType_Int', - ParameterType_Radius : 'ParameterType_Radius', - ParameterType_RAM : 'ParameterType_RAM', - ParameterType_Float : 'ParameterType_Float', - ParameterType_Choice : 'ParameterType_Choice', - ParameterType_Group : 'ParameterType_Group', - ParameterType_Bool : 'ParameterType_Bool' - }.get(parameter_type, 'ParameterType_UNKNOWN') - - def __str__(self): - s = self.GetName() - s += '\n' - s += self.GetDocLongDescription() - return s - - def SetParameters(self, dict_params): - for param_key, param_value in dict_params.items(): - self.SetParameterValue(param_key, param_value) - - def SetParameterValue(self, paramKey, value): - paramType = self.GetParameterType(paramKey) - if paramType in [ParameterType_RAM, - ParameterType_String, ParameterType_InputFilename, - ParameterType_OutputImage, ParameterType_OutputVectorData, - ParameterType_OutputFilename, - ParameterType_Directory, ParameterType_InputImage, - ParameterType_InputVectorData]: - return self.SetParameterString(paramKey, value) - elif paramType in [ParameterType_InputImageList, ParameterType_InputVectorDataList, - ParameterType_InputFilenameList, ParameterType_StringList, - ParameterType_ListView]: - return self.SetParameterStringList(paramKey, value) - elif paramType in [ParameterType_Int, ParameterType_Radius]: - return self.SetParameterInt(paramKey, value) - elif paramType in [ParameterType_Float]: - return self.SetParameterFloat(paramKey, value) - elif paramType in [ParameterType_Bool]: - return self.SetParameterString(paramKey, str(value) ) - elif paramType in [ParameterType_Group]: - return ApplicationProxy(self, paramKey) - elif paramType in [ParameterType_Choice]: - return ApplicationProxy(self, paramKey, value) - else: - print ("Unsupported parameter type '%s' with key '%s'" %(self.GetParameterTypeAsString(paramType) ,paramKey)) - return - - def GetParameters(self): - ret = {} - for key in self.GetParametersKeys(): - if self.HasValue(key) and self.IsParameterEnabled(key) and self.GetParameterRole(key) == 0: - ret[key] = self.GetParameterValue(key) - return ret - - def GetParameterValue(self, paramKey): - paramType = self.GetParameterType(paramKey) - if paramType in [ - ParameterType_String, ParameterType_InputFilename, - ParameterType_OutputImage, ParameterType_OutputVectorData, - ParameterType_OutputFilename, - ParameterType_Directory, ParameterType_InputImage, - ParameterType_InputVectorData]: - return self.GetParameterString(paramKey) - elif paramType in [ParameterType_InputImageList, ParameterType_InputVectorDataList, - ParameterType_InputFilenameList, ParameterType_StringList, - ParameterType_ListView]: - return self.GetParameterStringList(paramKey) - elif paramType in [ParameterType_Int, ParameterType_Radius, ParameterType_RAM]: - return self.GetParameterInt(paramKey) - elif paramType in [ParameterType_Float]: - return self.GetParameterFloat(paramKey) - elif paramType in [ParameterType_Bool]: - return bool(self.GetParameterInt(paramKey)) - elif paramType in [ParameterType_Group, ParameterType_Choice]: - return ApplicationProxy(self, paramKey) - else: - print ("Unsupported parameter type '%s' with key '%s'" %(self.GetParameterTypeAsString(paramType) ,paramKey)) - return None - - def __getattr__(self,name): - """ - __get_attribute__ is called whenever an instance request an attribute. - eg: App.SetParameterString(), App.GetName() .. - __getattr__ is only called if the attribute is not found by __get_attribute__ call - So we keep hide the GetParameter** calls within this method so that it seems like - an obivous call for users. App.IN , App.OUT , where 'in' and 'out' are - parameters in the 'otb application' with instance App - Since SWIG also uses this function, we have to copy their code before - using custom OTB behaviour - """ - if (name == "thisown"): - return self.this.own() - method = Application.__swig_getmethods__.get(name, None) - if method: - return method(self) - key_list = [k.upper() for k in self.GetParametersKeys(True)] - if name in key_list: - return self.GetParameterValue(name.lower()) - raise AttributeError("'%s' object has no attribute '%s'" % (Application.__name__, name)) - - def __setattr__(self, name, value): - """ - __setattr__ is called if the attribute requested is not found in the attribute list. - So these attributes are supposed to be 'key' of parameters used. Here we - keep hide the SetParameter** calls within this method so that it seems like - an obivous call for users. App.IN='my-input-file-name' , App.OUT='my-output-file-name'w - here 'in' and 'out' are parameters in the 'otb application' with instance App - Ofcourse, we don't blindly accept any attributes as python, we check them against - list of existing parameters for application with 'self.GetParametersKeys(True)' - Since SWIG also uses this function, we have to copy their code before - using custom OTB behaviour - """ - if (name == "thisown"): - return self.this.own(value) - if (name == "this"): - if type(value).__name__ == 'SwigPyObject': - self.__dict__[name] = value - return - method = Application.__swig_setmethods__.get(name, None) - if method: - return method(self, value) - key_list = [k.upper() for k in self.GetParametersKeys(True)] - if name in key_list: - self.SetParameterValue(name.lower(), value) - else: - raise AttributeError("You cannot add attributes to %s" % self) + def GetParameterTypeAsString(self, parameter_type): + return { + ParameterType_String : 'ParameterType_String', + ParameterType_InputFilename : 'ParameterType_InputFilename', + ParameterType_OutputImage : 'ParameterType_OutputImage', + ParameterType_OutputVectorData : 'ParameterType_OutputVectorData', + ParameterType_OutputFilename : 'ParameterType_OutputFilename', + ParameterType_Directory : 'ParameterType_Directory', + ParameterType_InputImage : 'ParameterType_InputImage', + ParameterType_InputVectorData : 'ParameterType_InputVectorData', + ParameterType_InputImageList : 'ParameterType_InputImageList', + ParameterType_InputVectorDataList : 'ParameterType_InputImageList', + ParameterType_InputFilenameList : 'ParameterType_InputFilenameList', + ParameterType_StringList : 'ParameterType_StringList', + ParameterType_ListView : 'ParameterType_ListView', + ParameterType_Int : 'ParameterType_Int', + ParameterType_Radius : 'ParameterType_Radius', + ParameterType_RAM : 'ParameterType_RAM', + ParameterType_Float : 'ParameterType_Float', + ParameterType_Choice : 'ParameterType_Choice', + ParameterType_Group : 'ParameterType_Group', + ParameterType_Bool : 'ParameterType_Bool' + }.get(parameter_type, 'ParameterType_UNKNOWN') + + def __str__(self): + s = self.GetName() + s += '\n' + s += self.GetDocLongDescription() + return s + + def SetParameters(self, dict_params): + for param_key, param_value in dict_params.items(): + self.SetParameterValue(param_key, param_value) + + def SetParameterValue(self, paramKey, value): + paramType = self.GetParameterType(paramKey) + if paramType in [ParameterType_RAM, + ParameterType_String, ParameterType_InputFilename, + ParameterType_OutputImage, ParameterType_OutputVectorData, + ParameterType_OutputFilename, + ParameterType_Directory, ParameterType_InputImage, + ParameterType_InputVectorData]: + return self.SetParameterString(paramKey, value) + elif paramType in [ParameterType_InputImageList, ParameterType_InputVectorDataList, + ParameterType_InputFilenameList, ParameterType_StringList, + ParameterType_ListView]: + return self.SetParameterStringList(paramKey, value) + elif paramType in [ParameterType_Int, ParameterType_Radius]: + return self.SetParameterInt(paramKey, value) + elif paramType in [ParameterType_Float]: + return self.SetParameterFloat(paramKey, value) + elif paramType in [ParameterType_Bool]: + return self.SetParameterString(paramKey, str(value) ) + elif paramType in [ParameterType_Group]: + return ApplicationProxy(self, paramKey) + elif paramType in [ParameterType_Choice]: + return ApplicationProxy(self, paramKey, value) + else: + print ("Unsupported parameter type '%s' with key '%s'" %(self.GetParameterTypeAsString(paramType) ,paramKey)) + return + + def GetParameters(self): + ret = {} + for key in self.GetParametersKeys(): + if self.HasValue(key) and self.IsParameterEnabled(key) and self.GetParameterRole(key) == 0: + ret[key] = self.GetParameterValue(key) + return ret + + def GetParameterValue(self, paramKey): + paramType = self.GetParameterType(paramKey) + if paramType in [ + ParameterType_String, ParameterType_InputFilename, + ParameterType_OutputImage, ParameterType_OutputVectorData, + ParameterType_OutputFilename, + ParameterType_Directory, ParameterType_InputImage, + ParameterType_InputVectorData]: + return self.GetParameterString(paramKey) + elif paramType in [ParameterType_InputImageList, ParameterType_InputVectorDataList, + ParameterType_InputFilenameList, ParameterType_StringList, + ParameterType_ListView]: + return self.GetParameterStringList(paramKey) + elif paramType in [ParameterType_Int, ParameterType_Radius, ParameterType_RAM]: + return self.GetParameterInt(paramKey) + elif paramType in [ParameterType_Float]: + return self.GetParameterFloat(paramKey) + elif paramType in [ParameterType_Bool]: + return bool(self.GetParameterInt(paramKey)) + elif paramType in [ParameterType_Group, ParameterType_Choice]: + return ApplicationProxy(self, paramKey) + else: + print ("Unsupported parameter type '%s' with key '%s'" %(self.GetParameterTypeAsString(paramType) ,paramKey)) + return None + + def __getattr__(self,name): + """ + __get_attribute__ is called whenever an instance request an attribute. + eg: App.SetParameterString(), App.GetName() .. + __getattr__ is only called if the attribute is not found by __get_attribute__ call + So we keep hide the GetParameter** calls within this method so that it seems like + an obivous call for users. App.IN , App.OUT , where 'in' and 'out' are + parameters in the 'otb application' with instance App + Since SWIG also uses this function, we have to copy their code before + using custom OTB behaviour + """ + if (name == "thisown"): + return self.this.own() + method = Application.__swig_getmethods__.get(name, None) + if method: + return method(self) + key_list = [k.upper() for k in self.GetParametersKeys(True)] + if name in key_list: + return self.GetParameterValue(name.lower()) + raise AttributeError("'%s' object has no attribute '%s'" % (Application.__name__, name)) + + def __setattr__(self, name, value): + """ + __setattr__ is called if the attribute requested is not found in the attribute list. + So these attributes are supposed to be 'key' of parameters used. Here we + keep hide the SetParameter** calls within this method so that it seems like + an obivous call for users. App.IN='my-input-file-name' , App.OUT='my-output-file-name'w + here 'in' and 'out' are parameters in the 'otb application' with instance App + Ofcourse, we don't blindly accept any attributes as python, we check them against + list of existing parameters for application with 'self.GetParametersKeys(True)' + Since SWIG also uses this function, we have to copy their code before + using custom OTB behaviour + """ + if (name == "thisown"): + return self.this.own(value) + if (name == "this"): + if type(value).__name__ == 'SwigPyObject': + self.__dict__[name] = value + return + if (name == "progressReportManager"): + super().__setattr__(name, value) + return + method = Application.__swig_setmethods__.get(name, None) + if method: + return method(self, value) + key_list = [k.upper() for k in self.GetParametersKeys(True)] + if name in key_list: + self.SetParameterValue(name.lower(), value) + else: + raise AttributeError("You cannot add attributes to %s" % self) } } diff --git a/Modules/Wrappers/SWIG/src/otbPythonLogOutput.i b/Modules/Wrappers/SWIG/src/otbPythonLogOutput.i index 748c8bfef4820b6bd9a04c6d19d8c57f61ca7a84..044942d56dfef11fef66bcc2d40fb5595097948d 100644 --- a/Modules/Wrappers/SWIG/src/otbPythonLogOutput.i +++ b/Modules/Wrappers/SWIG/src/otbPythonLogOutput.i @@ -91,9 +91,7 @@ class ProgressReporterManager: public itkObject { public: /** Default constructor */ - static ProgressReporterManager_Pointer New(); - virtual void Delete(); void DeleteWatcherList(); void SetLogOutputCallback(otb::SwigPrintCallback* callback); itkCommand* GetAddProcessCommand(); @@ -109,14 +107,10 @@ DECLARE_REF_COUNT_CLASS( ProgressReporterManager ) %pythoncode { _libraryLogOutput = PythonLogOutput_New() _libraryLogCallback = PythonPrintCallback() - _libraryProgressReportManager = ProgressReporterManager_New() - + Logger.Instance().ResetOutputs() _libraryLogOutput.SetCallback(_libraryLogCallback) Logger.Instance().AddLogOutput(_libraryLogOutput.GetPointer()) - - _libraryProgressReportManager.SetLogOutputCallback(_libraryLogCallback) - } #endif diff --git a/Modules/Wrappers/SWIG/src/python/CMakeLists.txt b/Modules/Wrappers/SWIG/src/python/CMakeLists.txt index 6a7b288b5cb9ea944662a3fccaf88c4b1181be0c..de676f70272dadc3fd7b5678f675560cd89d437c 100644 --- a/Modules/Wrappers/SWIG/src/python/CMakeLists.txt +++ b/Modules/Wrappers/SWIG/src/python/CMakeLists.txt @@ -21,6 +21,14 @@ include_directories ( ${PYTHON_INCLUDE_DIR} ) include_directories ( ${CMAKE_CURRENT_SOURCE_DIR}) set_source_files_properties ( ../otbApplication.i PROPERTIES CPLUSPLUS ON ) +# Get target name +set(extension_target _otbApplication) +if(POLICY CMP0078) + cmake_policy(GET CMP0078 swig_target_name_policy) + if (swig_target_name_policy STREQUAL "NEW") + set(extension_target otbApplication) + endif() +endif() # Run swig set(CMAKE_SWIG_FLAGS ${CMAKE_SWIG_GLOBAL_FLAGS}) if(NUMPY_FOUND) @@ -36,34 +44,35 @@ set(SWIG_MODULE_otbApplication_EXTRA_DEPS otbPythonLogOutput.h otbProgressReporterManager.h OTBApplicationEngine) -SWIG_add_module( otbApplication python ../otbApplication.i - otbApplicationPYTHON_wrap.cxx - itkPyCommand.cxx - ../python/otbPythonLogOutput.cxx - ../python/otbProgressReporterManager.cxx) -SWIG_link_libraries( otbApplication ${PYTHON_LIBRARIES} OTBApplicationEngine ) -set_target_properties(_otbApplication PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SWIG_OUTDIR}) +swig_add_library( otbApplication + LANGUAGE python + SOURCES ../otbApplication.i + itkPyCommand.cxx + otbPythonLogOutput.cxx + otbProgressReporterManager.cxx) +swig_link_libraries( otbApplication ${PYTHON_LIBRARIES} OTBApplicationEngine ) +set_target_properties(${extension_target} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SWIG_OUTDIR}) if(MSVC) - set_source_files_properties( ${CMAKE_CURRENT_BINARY_DIR}/otbApplicationPYTHON_wrap.cxx COMPILE_FLAGS "/wd4005" ) + set_source_files_properties( ${CMAKE_SWIG_OUTDIR}/otbApplicationPYTHON_wrap.cxx COMPILE_FLAGS "/wd4005" ) else() - set_source_files_properties( ${CMAKE_CURRENT_BINARY_DIR}/otbApplicationPYTHON_wrap.cxx COMPILE_FLAGS "-w" ) + set_source_files_properties( ${CMAKE_SWIG_OUTDIR}/otbApplicationPYTHON_wrap.cxx COMPILE_FLAGS "-w" ) endif() # byte-compile the resulting python file add_custom_command( - TARGET _otbApplication + TARGET ${extension_target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E echo "Byte-compiling otbApplication.py" COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/CMake/PythonCompile.py ${CMAKE_SWIG_OUTDIR}/otbApplication.py - DEPENDS _otbApplication + DEPENDS ${extension_target} ) -otb_module_target_label( _otbApplication ) +otb_module_target_label( ${extension_target} ) -install( TARGETS _otbApplication +install( TARGETS ${extension_target} DESTINATION ${OTB_INSTALL_PYTHON_DIR} COMPONENT RuntimeLibraries ) @@ -78,3 +87,20 @@ if(PYTHON_VERSION_STRING VERSION_LESS "3.2.0") else() # TODO : pyc file is in a subfolder. endif() + +configure_file(StandaloneWrapper.in CMakeLists.txt @ONLY) + +install( FILES ${CMAKE_SWIG_OUTDIR}/otbApplicationPYTHON_wrap.cxx + ${CMAKE_SWIG_OUTDIR}/otbApplicationPYTHON_wrap.h + itkPyCommand.cxx + itkPyCommand.h + otbPythonLogOutput.cxx + otbPythonLogOutput.h + otbSwigPrintCallback.h + otbProgressReporterManager.cxx + otbProgressReporterManager.h + ../itkBase.includes + ../otbWrapperSWIGIncludes.h + ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt + DESTINATION ${OTB_INSTALL_DATA_DIR}/swig + COMPONENT Resources ) diff --git a/Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in b/Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in new file mode 100644 index 0000000000000000000000000000000000000000..a0b9e362917c8aa87c0552b3e8076bad27006385 --- /dev/null +++ b/Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in @@ -0,0 +1,81 @@ +# +# Copyright (C) 2005-2019 CS Systemes d'Information (CS SI) +# +# This file is part of Orfeo Toolbox +# +# https://www.orfeo-toolbox.org/ +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +cmake_minimum_required(VERSION 3.10.1) +project(OTBPythonWrappers) + +if(POLICY CMP0072) + cmake_policy(SET CMP0072 NEW) +endif() + +get_filename_component(PKG_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}" PATH) +get_filename_component(PKG_PREFIX "${PKG_PREFIX}" PATH) +get_filename_component(PKG_PREFIX "${PKG_PREFIX}" PATH) + +find_package(OTB REQUIRED HINTS ${PKG_PREFIX}/@OTB_INSTALL_PACKAGE_DIR@) +list(APPEND CMAKE_MODULE_PATH ${OTB_CMAKE_DIR}) +include(${OTB_USE_FILE}) + +set ( Python_ADDITIONAL_VERSIONS "3;2" ) +set ( PythonInterp_FIND_REQUIRED ${OTB_WRAP_PYTHON} ) +set ( PythonLibs_FIND_REQUIRED ${OTB_WRAP_PYTHON} ) +find_package( PythonInterp ) +if ( OTB_WRAP_PYTHON AND ( ${PYTHON_VERSION_MAJOR} EQUAL 2 ) ) + message (WARNING "Python3 not found. There is no longer support of \ + wrapping in python2 in OTB, but it can still be used.") +endif() +# Now that we have a python version the addditional versions should only +# contain the version we have to get the corresponding libs +set (Python_ADDITIONAL_VERSIONS "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}") +find_package ( PythonLibs ) +include_directories(${PYTHON_INCLUDE_DIR}) + +find_package(Numpy) +if ( NUMPY_FOUND ) + include_directories(${NUMPY_INCLUDE_DIRS}) +else() + message( WARNING + "OTB wrappers will be done without support for NumPy (not found).") +endif() + +include_directories("${CMAKE_CURRENT_SOURCE_DIR}") + +file(GLOB OTBPythonWrappers_SOURCES "*.cxx") + +# declare the python wrapper library +add_library(PythonWrapperLib MODULE ${OTBPythonWrappers_SOURCES}) +target_link_libraries(PythonWrapperLib ${PYTHON_LIBRARIES} OTBApplicationEngine) + +set_target_properties(PythonWrapperLib PROPERTIES + OUTPUT_NAME "_otbApplication" + NO_SONAME ON + PREFIX "") + +if(WIN32 AND NOT CYGWIN) + set_target_properties(PythonWrapperLib PROPERTIES SUFFIX ".pyd") +endif() + +if(NUMPY_FOUND) + add_definitions(-DOTB_SWIGNUMPY=1) +endif() + +install(TARGETS PythonWrapperLib + DESTINATION lib/python + COMPONENT RuntimeLibraries ) diff --git a/Modules/Wrappers/SWIG/src/python/otbProgressReporterManager.cxx b/Modules/Wrappers/SWIG/src/python/otbProgressReporterManager.cxx index e3a6ac541739b337fea15b1597a186b559031042..ff53453bbeac70dbf42b17a5d8c091bbe0d1e55c 100644 --- a/Modules/Wrappers/SWIG/src/python/otbProgressReporterManager.cxx +++ b/Modules/Wrappers/SWIG/src/python/otbProgressReporterManager.cxx @@ -38,11 +38,6 @@ ProgressReporterManager::~ProgressReporterManager() void ProgressReporterManager::DeleteWatcherList() { - //Delete all stored progress reporter - for (auto watcher: m_WatcherList) - { - delete watcher; - } m_WatcherList.clear(); } @@ -52,9 +47,9 @@ void ProgressReporterManager::LinkWatchers(itk::Object* itkNotUsed(caller), cons { const Wrapper::AddProcessToWatchEvent* eventToWatch = dynamic_cast<const Wrapper::AddProcessToWatchEvent*>(&event); - auto watch = new WatcherType(eventToWatch->GetProcess(), eventToWatch->GetProcessDescription()); + auto watch = std::make_unique< WatcherType>(eventToWatch->GetProcess(), eventToWatch->GetProcessDescription()); watch->SetCallback(m_Callback); - m_WatcherList.push_back(watch); + m_WatcherList.push_back(std::move(watch)); } } } diff --git a/Modules/Wrappers/SWIG/src/python/otbProgressReporterManager.h b/Modules/Wrappers/SWIG/src/python/otbProgressReporterManager.h index ec15926fd20ad0b91ac238f0fbc1b7e61b0e4c1b..59d0cafd26b5ad962290553f9f2d9d013dd5cbad 100644 --- a/Modules/Wrappers/SWIG/src/python/otbProgressReporterManager.h +++ b/Modules/Wrappers/SWIG/src/python/otbProgressReporterManager.h @@ -27,6 +27,8 @@ #include "otbSwigPrintCallback.h" #include "otbStandardOneLineFilterWatcher.h" +#include <memory> + namespace otb { @@ -54,7 +56,7 @@ public: typedef StandardOneLineFilterWatcher<CallbackType> WatcherType; /** Filter watcher list type */ - typedef std::vector<WatcherType *> WatcherListType; + typedef std::vector<std::unique_ptr <WatcherType> > WatcherListType; /** Command Member */ typedef itk::MemberCommand<Self> AddProcessCommandType; diff --git a/Modules/Wrappers/SWIG/test/python/CMakeLists.txt b/Modules/Wrappers/SWIG/test/python/CMakeLists.txt index 7b0bd59465dd896e922622afa59427da408eca88..968ec181ea4270726f16075ba05e2bcdedbb3d6b 100644 --- a/Modules/Wrappers/SWIG/test/python/CMakeLists.txt +++ b/Modules/Wrappers/SWIG/test/python/CMakeLists.txt @@ -19,7 +19,7 @@ # set(TEST_DRIVER otbTestDriver - --add-before-env PYTHONPATH $<TARGET_FILE_DIR:_otbApplication> + --add-before-env PYTHONPATH ${CMAKE_BINARY_DIR}/${OTB_INSTALL_PYTHON_DIR} --add-before-env OTB_APPLICATION_PATH $<TARGET_FILE_DIR:otbapp_Smoothing> ) if(WIN32) diff --git a/PSC.md b/PSC.md index c0692bf8d7c113c30ad624683153b2d4de44a74f..8e8d4d516bc722ebc91f9033742d26ddf9cff3bf 100644 --- a/PSC.md +++ b/PSC.md @@ -212,6 +212,7 @@ establishing a fully functioning PSC. PSC has now 4 members. **Name** | **Affiliation** | **Email** | **Role** | ----------------------------|------------------|----------------------------------|--------------------------------------------| +Agustin Lobo | ICTJA-CSIC | Agustin DOT Lobo AT ictja.csic.es| User perspective, documentation | Julien Radoux | UCLouvain | jradoux AT hotmail DOT com | User perpsective, documentation | Rémi Cresson | IRSTEA | cresson.r AT gmail DOT com | Release Manager for release 5.2 | Guillaume Pasero | CS-SI | guillaume.pasero AT c-s DOT fr | release planner | diff --git a/Packaging/Files/build_wrapping.cmake b/Packaging/Files/build_wrapping.cmake new file mode 100644 index 0000000000000000000000000000000000000000..3cbce611896581e1ea533b6f342c14767a324650 --- /dev/null +++ b/Packaging/Files/build_wrapping.cmake @@ -0,0 +1,49 @@ +# +# Copyright (C) 2005-2019 CS Systemes d'Information (CS SI) +# +# This file is part of Orfeo Toolbox +# +# https://www.orfeo-toolbox.org/ +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +get_filename_component(PKG_PREFIX "${CTEST_SCRIPT_DIRECTORY}" PATH) +get_filename_component(PKG_PREFIX "${PKG_PREFIX}" PATH) +get_filename_component(PKG_PREFIX "${PKG_PREFIX}" PATH) + +set(CTEST_PROJECT_NAME OTBPythonWrappers) +set(CTEST_SOURCE_DIRECTORY ${CTEST_SCRIPT_DIRECTORY}) +set(CTEST_BINARY_DIRECTORY ${CTEST_SCRIPT_DIRECTORY}/build) +if(WIN32) + set(CTEST_CMAKE_GENERATOR "NMake Makefiles") +else() + set(CTEST_CMAKE_GENERATOR "Unix Makefiles") +endif() +set(CTEST_BUILD_CONFIGURATION "Release") + +if(IS_DIRECTORY "${CTEST_BINARY_DIRECTORY}") + file(REMOVE_RECURSE "${CTEST_BINARY_DIRECTORY}") +endif() + +set(CONFIGURE_OPTIONS + "-DCMAKE_INSTALL_PREFIX=${PKG_PREFIX}" + "-DCMAKE_INSTALL_RPATH=${PKG_PREFIX}/lib" + "-DCMAKE_BUILD_TYPE=Release") +if(PYTHON_EXECUTABLE) + list(APPEND CONFIGURE_OPTIONS "-DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}") +endif() + +ctest_start(Experimental) +ctest_configure(OPTIONS "${CONFIGURE_OPTIONS}") +ctest_build(TARGET install) diff --git a/Packaging/Files/build_wrapping.md b/Packaging/Files/build_wrapping.md new file mode 100644 index 0000000000000000000000000000000000000000..3fe735393fb39ccda30a6ccbd110135fe799244e --- /dev/null +++ b/Packaging/Files/build_wrapping.md @@ -0,0 +1,47 @@ +# How to recompile OTB Python bindings with your Python version? + +The OTB Python bindings are made of: + +* a Python module `otbApplication.py` +* a Python C++ extension `_otbApplication.so` (or `_otbApplication.pyd` on Windows) + +The Python module should be independent from the Python version you are using, +but the compiled C++ extension is linked to a specific Python library. If this +library is not present on your system, you can recompile the extension to use +your Python version. + +The procedure is simple, once you have the following prerequisite: + +* A C++ compiler: + * On Linux: GCC >= 5.0 + * On macos: XCode + * On Windows: either Visual Studio >= 2015 with the desktop C++ workload, + or just the MSVC Build Tools. +* CMake >= 3.10 +* Python library and headers for your Python version + * On macos and Windows: they are usually supplied with installers from + official website + * On Linux packages: you should look for a `python-dev` package matching + your Python interpreter version. +* Numpy module for your Python version + +The compilation and installation of the C++ extension can be launched from the +command line (on Windows you can use `cmd.exe`): + +``` +ctest -S build_wrapping.cmake +``` + +If you want to use a specific Python interpreter: + +``` +ctest -DPYTHON_EXECUTABLE=/my/own/python -S build_wrapping.cmake +``` + +Note: on Windows, you have to setup MSVC compiler before calling `ctest`. Use +the `vcvarsall.bat` script with the right architecture (x32 or x64). For +instance: + +``` +call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64 +``` diff --git a/Packaging/Files/otbenv.bash b/Packaging/Files/otbenv.bash index 4102c5b50d73bc7cbfeae495d91f291320224226..a2a7906ca45cbfdcea25fedb6fddd59e993f9d3a 100644 --- a/Packaging/Files/otbenv.bash +++ b/Packaging/Files/otbenv.bash @@ -18,6 +18,22 @@ # limitations under the License. # +cat_path() +{ + if [ $# -eq 0 ]; then exit 0; fi + if [ $# -eq 1 ]; then echo "$1"; exit 0; fi + cur="$1" + shift 1 + next=$(cat_path "$@") + if [ -z "$cur" ]; then + echo "$next" + elif [ -z "$next" ]; then + echo "$cur" + else + echo "$cur:$next" + fi +} + # The below environment variables only affect current shell # So if you run again from a terminal. you need to run the script again # see how this is sourced in monteverdi.sh and mapla.sh @@ -26,11 +42,11 @@ CURRENT_DIR=$(cd -P -- "$(dirname -- "$BASH_SOURCE")" && printf '%s\n' "$(pwd -P unset LD_LIBRARY_PATH -PATH=$CURRENT_DIR/bin:$PATH +PATH=$(cat_path "$CURRENT_DIR/bin" "$PATH") GDAL_DATA=$CURRENT_DIR/share/data GEOTIFF_CSV=$CURRENT_DIR/share/epsg_csv -PYTHONPATH=$CURRENT_DIR/lib/python:$PYTHONPATH -OTB_APPLICATION_PATH=$CURRENT_DIR/lib/otb/applications +PYTHONPATH=$(cat_path "$CURRENT_DIR/lib/python" "$PYTHONPATH") +OTB_APPLICATION_PATH=$(cat_path "$CURRENT_DIR/lib/otb/applications" "$OTB_APPLICATION_PATH") GDAL_DRIVER_PATH="disable" LC_NUMERIC=C diff --git a/Packaging/Files/otbenv.bat b/Packaging/Files/otbenv.bat index 615271ecd6104cf6e4bc70651ce2bd0aaeada606..6b4efefb227c0767592e1210f801f62212a7aded 100644 --- a/Packaging/Files/otbenv.bat +++ b/Packaging/Files/otbenv.bat @@ -16,15 +16,31 @@ :: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. :: See the License for the specific language governing permissions and :: limitations under the License. - +@echo off :: Setup environment for OTB package set CURRENT_SCRIPT_DIR=%~dp0 -set PATH=%CURRENT_SCRIPT_DIR%bin;%PATH% +call :prefix_path PATH "%CURRENT_SCRIPT_DIR%bin" +call :prefix_path PYTHONPATH "%CURRENT_SCRIPT_DIR%lib\python" +call :prefix_path OTB_APPLICATION_PATH "%CURRENT_SCRIPT_DIR%lib\otb\applications" + set GDAL_DATA=%CURRENT_SCRIPT_DIR%share\data set GEOTIFF_CSV=%CURRENT_SCRIPT_DIR%share\epsg_csv -set PYTHONPATH=%CURRENT_SCRIPT_DIR%lib\python;%PYTHONPATH% -set OTB_APPLICATION_PATH=%CURRENT_SCRIPT_DIR%lib\otb\applications set GDAL_DRIVER_PATH=disable :: Set numeric locale to C set LC_NUMERIC=C +goto :eof + +:prefix_path +setlocal enabledelayedexpansion +set output=%~2 +set var=%1 +set content= +if not defined %var% ( goto :prefix_path_testcontent ) +set content=!%var%! +:prefix_path_testcontent +if "%content%" == "" ( goto :prefix_path_end ) +set output=%output%;%content% +:prefix_path_end +endlocal & set %1=%output% +goto :eof diff --git a/Packaging/Files/otbenv.profile b/Packaging/Files/otbenv.profile index 1e147d1c0528dbe4a16d99e76ac040989773aaf8..f46ab79bf77b65b795ca37d26e8b4c1d66c4bde3 100644 --- a/Packaging/Files/otbenv.profile +++ b/Packaging/Files/otbenv.profile @@ -19,6 +19,22 @@ # limitations under the License. # +cat_path() +{ + if [ $# -eq 0 ]; then exit 0; fi + if [ $# -eq 1 ]; then echo "$1"; exit 0; fi + cur="$1" + shift 1 + next=$(cat_path "$@") + if [ -z "$cur" ]; then + echo "$next" + elif [ -z "$next" ]; then + echo "$cur" + else + echo "$cur:$next" + fi +} + # The below environment variables only affect current shell # So if you run again from a terminal. you need to run the script again # see how this is sourced in monteverdi.sh and mapla.sh @@ -27,17 +43,13 @@ CMAKE_PREFIX_PATH=OUT_DIR export CMAKE_PREFIX_PATH # check and set OTB_APPLICATION_PATH -if [ -z "$OTB_APPLICATION_PATH" ] || [ "$OTB_APPLICATION_PATH" = "" ]; then - OTB_APPLICATION_PATH=OUT_DIR/lib/otb/applications -else - OTB_APPLICATION_PATH=OUT_DIR/lib/otb/applications:$OTB_APPLICATION_PATH -fi +OTB_APPLICATION_PATH=$(cat_path "OUT_DIR/lib/otb/applications" "$OTB_APPLICATION_PATH") # Add bin direcotory to system PATH -PATH=OUT_DIR/bin:$PATH +PATH=$(cat_path "OUT_DIR/bin" "$PATH") # export PYTHONPATH to import otbApplication.py -PYTHONPATH=OUT_DIR/lib/python:$PYTHONPATH +PYTHONPATH=$(cat_path "OUT_DIR/lib/python" "$PYTHONPATH") # set numeric locale to C LC_NUMERIC=C diff --git a/Packaging/install_python_bindings.cmake b/Packaging/install_python_bindings.cmake index 754986de0a96b845f761ca02143a73ac839ee843..5de31587c0655ed1a686c5629b2e9e334084ca3e 100644 --- a/Packaging/install_python_bindings.cmake +++ b/Packaging/install_python_bindings.cmake @@ -24,6 +24,14 @@ function(install_python_bindings) PATTERN "*.pyc" EXCLUDE PATTERN "__pycache__" EXCLUDE ) + install(DIRECTORY ${SUPERBUILD_INSTALL_DIR}/share/otb/swig + DESTINATION ${PKG_STAGE_DIR}/share/otb + ) + install(FILES Files/build_wrapping.cmake + DESTINATION ${PKG_STAGE_DIR}/share/otb/swig) + install(FILES Files/build_wrapping.md + DESTINATION ${PKG_STAGE_DIR}/share/otb/swig + RENAME README.md) endif() # Handle GDAL python bindings file(GLOB gdal_python_scripts "${SUPERBUILD_INSTALL_DIR}/bin/gdal*.py") diff --git a/SuperBuild/CMake/External_gdal.cmake b/SuperBuild/CMake/External_gdal.cmake index 418c9e6de361772b61d38b3172c31c49e1f9fcac..30d0010ec89582d2dd8c47c159d7acf1e860f1f2 100644 --- a/SuperBuild/CMake/External_gdal.cmake +++ b/SuperBuild/CMake/External_gdal.cmake @@ -105,6 +105,7 @@ if(UNIX) --with-webp=no --with-threads=yes --with-freexl=no + --with-proj=yes --with-libjson-c=internal ${GDAL_SB_CONFIG} ${GDAL_SB_EXTRA_OPTIONS} diff --git a/SuperBuild/CMakeLists.txt b/SuperBuild/CMakeLists.txt index fbcf788525b1f568d87a3b913eaaf2e0c77f72fd..f4a9ffd6c0077e5be3a0c9e6faf017cf4b6ca995 100644 --- a/SuperBuild/CMakeLists.txt +++ b/SuperBuild/CMakeLists.txt @@ -385,7 +385,7 @@ set ( Python_ADDITIONAL_VERSIONS "3;2" ) set ( PythonInterp_FIND_REQUIRED ${OTB_WRAP_PYTHON} ) set ( PythonLibs_FIND_REQUIRED ${OTB_WRAP_PYTHON} ) find_package( PythonInterp ) -if ( OTB_WRAP_PYTHON AND ( ${PYTHON_VERSION_MAJOR} EQUAL 2 ) ) +if ( OTB_WRAP_PYTHON AND ( "x${PYTHON_VERSION_MAJOR}" STREQUAL "x2" ) ) message (WARNING "Python3 not found. There is no longer support of \ wrapping in python2 in OTB, but it can still be used.") endif() diff --git a/SuperBuild/patches/GDAL/nmake_gdal_extra.opt.in b/SuperBuild/patches/GDAL/nmake_gdal_extra.opt.in index 8a03873073d1505ea3680959f40185526e0689a8..c57c8966769a9f770b9c653746b4922b9dd1acda 100644 --- a/SuperBuild/patches/GDAL/nmake_gdal_extra.opt.in +++ b/SuperBuild/patches/GDAL/nmake_gdal_extra.opt.in @@ -44,6 +44,7 @@ SQLITE_LIB=@SB_INSTALL_PREFIX_NATIVE@\lib\sqlite3.lib SQLITE_HAS_COLUMN_METADATA=yes # PROJ.4 stuff +PROJ_FLAGS = -DPROJ_STATIC -DPROJ_VERSION=4 PROJ_INCLUDE = -I@SB_INSTALL_PREFIX_NATIVE@\include PROJ_LIBRARY = @SB_INSTALL_PREFIX_NATIVE@\lib\proj.lib