diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b688cca53ca5b6999c507273e6435f31b3ca58da..c4bc8861686dde8870ef66d00c91e95973702b12 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -119,7 +119,10 @@ fast-build:
legal-check:
extends: .common
- only: [merge_requests, develop, headers_check]
+ only:
+ - merge_requests
+ - develop
+ - /^release-[0-9]+\.[0-9]+$/
stage: precheck
image: $BUILD_IMAGE_REGISTRY/otb-alpine:3.7
variables:
diff --git a/CI/cdash_handler.py b/CI/cdash_handler.py
index 479bc7ba722dea0395d5332859cb6aad2e8af848..f5662a0d00cd1c42bee04a37d8a5290bde0b3192 100644
--- a/CI/cdash_handler.py
+++ b/CI/cdash_handler.py
@@ -237,7 +237,7 @@ class Handler:
K8S_SECRET_API_TOKEN -> Token for Gitlab API
CI_MERGE_REQUEST_REF_PATH -> Ref name to push the status (only for merge request pipeline)
CI_COMMIT_REF_NAME -> Ref name to push the status
- They can be overriden by a full command line :
+ They can be overridden by a full command line :
cdash_handler.py commit_sha1 project_id project_directory token ref_name
"""
if __name__ == "__main__":
diff --git a/CI/check_twin_pipelines.py b/CI/check_twin_pipelines.py
index 76e21a9abc80099e1bd8ce22025e0f202b129029..6276ec1bab40ed0314937530238a198e6bb6e3f5 100644
--- a/CI/check_twin_pipelines.py
+++ b/CI/check_twin_pipelines.py
@@ -66,7 +66,7 @@ if __name__ == "__main__":
# are we in a merge_request pipeline ?
if 'CI_MERGE_REQUEST_IID' in env.keys():
if not CheckEnvParameters(['K8S_SECRET_API_TOKEN']):
- print("WARNING: Make sure you have set a valid acces token for Gitlab API." \
+ print("WARNING: Make sure you have set a valid access token for Gitlab API." \
+ "The K8S_SECRET_API_TOKEN environment variable should be set in 'Settings -> CI/CD -> Variables'" \
+ "Without this token, some feature of the CI platform will be disabled.")
sys.exit(0)
diff --git a/CI/configure_options.cmake b/CI/configure_options.cmake
index 794105f5b9fbc94bdeda824934b64a73e2201101..2de6844a26661c6349875dfa7d1a37322e87e92e 100644
--- a/CI/configure_options.cmake
+++ b/CI/configure_options.cmake
@@ -56,7 +56,7 @@ OTB_USE_SIFTFAST:BOOL=ON
OTB_USE_SPTW:BOOL=ON
OTB_USE_SSE_FLAGS:BOOL=ON")
-# Usefull if MPI is ON : OTB_MPIEXEC_OPT:STRING=--allow-run-as-root
+# Useful if MPI is ON : OTB_MPIEXEC_OPT:STRING=--allow-run-as-root
set (otb_wrap_option
"OTB_WRAP_PYTHON:BOOL=ON")
@@ -70,7 +70,7 @@ if(XDK_PATH)
set(cmake_configure_option
"${cmake_configure_option}
CMAKE_PREFIX_PATH=${XDK_PATH}")
-foreach(remote_module OTBTemporalGapFilling SertitObject DiapOTBModule)#otbGRM
+foreach(remote_module OTBTemporalGapFilling SertitObject otbGRM DiapOTBModule)
set(cmake_configure_option
"${cmake_configure_option}
Module_${remote_module}:BOOL=ON")
diff --git a/CI/contributors_check.sh b/CI/contributors_check.sh
index d9a6328d4609b8485825ef5b0799eacb4416388b..70c3e8f5c41b3f24405bd7dae2186e42b5ad758e 100755
--- a/CI/contributors_check.sh
+++ b/CI/contributors_check.sh
@@ -38,8 +38,8 @@ git shortlog -es HEAD | cut -f 2- \
curl -s ${GITLAB_PROJECT_URL}/raw/master/CI/contributors/known-contributors.txt \
| sort -u > ${KNOWN_CONTRIBUTORS}
-diff ${KNOWN_CONTRIBUTORS} ${GIT_CONTRIBUTORS} > ${UNKNOWN_CONTRIBUTORS}
-if [ "$?" -ne "0" ] ; then
+diff ${KNOWN_CONTRIBUTORS} ${GIT_CONTRIBUTORS} | grep '^>' > ${UNKNOWN_CONTRIBUTORS}
+if [ -s "${UNKNOWN_CONTRIBUTORS}" ] ; then
echo ""
echo "WARNING: ***************************************************************"
echo "WARNING: Unknown contributors found:"
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7bb9e347ddab2506b2e370b5096d06f98316f9cd..778003cf48049248d01d3b29fc16635caba153ef 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -102,7 +102,7 @@ reset_qt_i18n_sources()
repository_status(${PROJECT_SOURCE_DIR} OTB_GIT_STATUS_MESSAGE)
# Find python stuff
-# Version 3 is prefered before 2
+# Version 3 is preferred before 2
set ( Python_ADDITIONAL_VERSIONS "3;2" )
set ( PythonInterp_FIND_REQUIRED ${OTB_WRAP_PYTHON} )
set ( PythonLibs_FIND_REQUIRED ${OTB_WRAP_PYTHON} )
@@ -132,8 +132,8 @@ set(main_project_name ${_OTBModuleMacros_DEFAULT_LABEL})
#-----------------------------------------------------------------------------
# OTB version number.
-set(OTB_VERSION_MAJOR "6")
-set(OTB_VERSION_MINOR "7")
+set(OTB_VERSION_MAJOR "7")
+set(OTB_VERSION_MINOR "0")
set(OTB_VERSION_PATCH "0")
set(OTB_VERSION_STRING "${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}.${OTB_VERSION_PATCH}")
diff --git a/Data/Input/apTvPrOrthorectifTest_UTM_OutXML1.xml b/Data/Input/apTvPrOrthorectifTest_UTM_OutXML1.xml
index 02a6df6f8d9109f886d5ae9de8d47d9c22d39de4..19e9433dc81b851a64bcb02fc45b47d3060126e2 100644
--- a/Data/Input/apTvPrOrthorectifTest_UTM_OutXML1.xml
+++ b/Data/Input/apTvPrOrthorectifTest_UTM_OutXML1.xml
@@ -5,7 +5,7 @@
Linux
OrthoRectification
- This application allows to ortho-rectify optical images from supported sensors.
+ This application allows ortho-rectifying optical images from supported sensors.
Ortho-rectification
An inverse sensor model is built from the input image metadata to convert geographical to raw geometry coordinates. This inverse sensor model is then combined with the chosen map projection to build a global coordinate mapping grid. Last, this grid is used to resample using the chosen interpolation algorithm. A Digital Elevation Model can be specified to account for terrain deformations.
In case of SPOT5 images, the sensor model can be approximated by an RPC model in order to speed-up computation.
diff --git a/Documentation/Cookbook/_static/html/versions.html b/Documentation/Cookbook/_static/html/versions.html
index 1b3fb09d137abf6ffc984f562383865f0e86742f..0900284559d1bb7ea472f430ea9a09df67e0dc9b 100644
--- a/Documentation/Cookbook/_static/html/versions.html
+++ b/Documentation/Cookbook/_static/html/versions.html
@@ -10,6 +10,7 @@
6.2.0
6.4.0
6.6.1
+ 7.0.0
develop
diff --git a/Documentation/Cookbook/rst/C++/FunctorImageFilter.rst b/Documentation/Cookbook/rst/C++/FunctorImageFilter.rst
index 9a9e736f0043e6d20befadd75ff595261629d6ec..8d79e59a57925fb893d7301fc5770124d62f9974 100644
--- a/Documentation/Cookbook/rst/C++/FunctorImageFilter.rst
+++ b/Documentation/Cookbook/rst/C++/FunctorImageFilter.rst
@@ -116,7 +116,7 @@ Alternative prototype for performance
Automatic type deduction will also work with the following signature:
``void (const R&, T1 t1, T2 t2 ..., TN tn)``
-This will be more efficient when ``R`` is of type ``itk::VariableLengthVector`` and should be prefered in this case.
+This will be more efficient when ``R`` is of type ``itk::VariableLengthVector`` and should be preferred in this case.
Automatic type deduction examples
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -125,7 +125,7 @@ Consider the following free function:
.. code-block:: cpp
- itk::VariableLenghtVector myFreeFunction(unsigned char a,
+ itk::VariableLengthVector myFreeFunction(unsigned char a,
const std::complex& b,
const itk::VariableLengthVector& c,
const itk::ConstNeighborhoodIterator>& d) {...}
diff --git a/Documentation/Cookbook/rst/PythonAPI.rst b/Documentation/Cookbook/rst/PythonAPI.rst
index b299082dd861557999a75038a089c99cb38077a4..f417ff4a40eb3b6b8275af14ff179502d130f94a 100644
--- a/Documentation/Cookbook/rst/PythonAPI.rst
+++ b/Documentation/Cookbook/rst/PythonAPI.rst
@@ -224,7 +224,7 @@ Mixed in-memory / on-disk connection
As an extension to the connection of OTB Applications (described in previous
section), a mixed mode is also available to easily switch between:
-- **in-memory**: if you want to avoid unecessary I/O between applications
+- **in-memory**: if you want to avoid unnecessary I/O between applications
- **on-disk**: if you want intermediate outputs on disk
This mixed mode is based on the ``Application::ConnectImage()`` function. This
diff --git a/Documentation/Cookbook/rst/QGISInterface.rst b/Documentation/Cookbook/rst/QGISInterface.rst
index df569c32bee87dac7c38da88ca21bdf807146bd2..61c3765b9978ce0b6cf58101f2dcae3a56754844 100644
--- a/Documentation/Cookbook/rst/QGISInterface.rst
+++ b/Documentation/Cookbook/rst/QGISInterface.rst
@@ -13,7 +13,7 @@ With QGIS > 3.8, the plugin is in the QGIS core. So you just need install OTB an
Download and Install OTB
^^^^^^^^^^^^^^^^^^^^^^^^
-OTB is not distributed with qgis-otb-plugin. It is a seperate project and has its own git repository.
+OTB is not distributed with qgis-otb-plugin. It is a separate project and has its own git repository.
Download latest OTB version: https://www.orfeo-toolbox.org/download/.
Configure plugin in QGIS
diff --git a/Modules/Adapters/GdalAdapters/include/otbSpatialReference.h b/Modules/Adapters/GdalAdapters/include/otbSpatialReference.h
index aa3e94552c9fc9df633838899b8faf396f0017f9..2605ad12f08900c271cc0d49ce6bc20666964a98 100644
--- a/Modules/Adapters/GdalAdapters/include/otbSpatialReference.h
+++ b/Modules/Adapters/GdalAdapters/include/otbSpatialReference.h
@@ -67,7 +67,7 @@ OTBGdalAdapters_EXPORT bool operator!=(const SpatialReference& sr1, const Spatia
* either they fail or they provide a definitive, valid object.
*
* Building a SpatialReference requires to call one of the From*()
- * method. There are no public constructors (appart from copy and
+ * method. There are no public constructors (apart from copy and
* assignment)
*
* \ingroup OTBGdalAdapters
@@ -167,7 +167,7 @@ public:
* \pre -180<=lon<=180
* \pre -90<=lat<=90
* \param lon Point longitude
- * \param lat Point lattitude
+ * \param lat Point latitude
* \param zone Output UTM zone
* \param hem output hemisphere
*/
diff --git a/Modules/Applications/AppClassification/app/otbTrainImagesClassifier.cxx b/Modules/Applications/AppClassification/app/otbTrainImagesClassifier.cxx
index 573e3c7fbf575c1eb0dff0d9996b153bd868b50a..67ca2c21e28ea19b932963653d7d343dcdc6692b 100644
--- a/Modules/Applications/AppClassification/app/otbTrainImagesClassifier.cxx
+++ b/Modules/Applications/AppClassification/app/otbTrainImagesClassifier.cxx
@@ -48,7 +48,7 @@ public:
"The training vector data must contain polygons with a positive integer field "
"representing the class label. The name of this field can be set using the *Class label field* parameter.\n\n"
- "Training and validation sample lists are built such that each class is equally represented in both lists. One parameter controlls the ratio "
+ "Training and validation sample lists are built such that each class is equally represented in both lists. One parameter controls the ratio "
"between the number of samples in training and validation sets. Two parameters manage the size of the training and "
"validation sets per class and per image.\n\n"
diff --git a/Modules/Applications/AppClassification/app/otbZonalStatistics.cxx b/Modules/Applications/AppClassification/app/otbZonalStatistics.cxx
index 5715746e7d20633225ace85bd48289336becdb5b..d8e29fb346f9db986755c279bcfb63a694e09337 100644
--- a/Modules/Applications/AppClassification/app/otbZonalStatistics.cxx
+++ b/Modules/Applications/AppClassification/app/otbZonalStatistics.cxx
@@ -452,15 +452,30 @@ public:
RemoveNoDataEntry();
// Generate output
if (GetParameterAsString("out") == "xml")
+ {
+ DisableParameter("out.vector.filename");
+ DisableParameter("out.raster.filename");
+ EnableParameter("out.xml.filename");
WriteXMLStatsFile();
+ }
else // vector or raster
{
if (m_FromLabelImage)
GenerateVectorDataFromLabelImage();
if (GetParameterAsString("out") == "vector")
+ {
+ EnableParameter("out.vector.filename");
+ DisableParameter("out.raster.filename");
+ DisableParameter("out.xml.filename");
WriteVectorData();
+ }
else if (GetParameterAsString("out") == "raster")
+ {
+ DisableParameter("out.vector.filename");
+ EnableParameter("out.raster.filename");
+ DisableParameter("out.xml.filename");
WriteRasterData();
+ }
else
otbAppLogFATAL("Unknown output mode");
}
diff --git a/Modules/Applications/AppClassification/include/otbTrainSharkKMeans.hxx b/Modules/Applications/AppClassification/include/otbTrainSharkKMeans.hxx
index 69a4e9106c96d9cfe65e2928b5527ece074a3a70..91347c7f7b07f83416de32622418eacbada25544 100644
--- a/Modules/Applications/AppClassification/include/otbTrainSharkKMeans.hxx
+++ b/Modules/Applications/AppClassification/include/otbTrainSharkKMeans.hxx
@@ -107,7 +107,7 @@ void LearningApplicationBase::TrainSharkKMeans(typena
for (unsigned int i = 0; i < meanMeasurementVector.Size(); ++i)
{
scaleRV[i] = 1 / stddevMeasurementVector[i];
- // Substract the normalized mean
+ // Subtract the normalized mean
offsetRV[i] = -meanMeasurementVector[i] / stddevMeasurementVector[i];
}
diff --git a/Modules/Applications/AppImageUtils/app/otbMosaic.cxx b/Modules/Applications/AppImageUtils/app/otbMosaic.cxx
index ea99fef7759490dd294199fb0dd558189fe0ebdb..ba3e400800f19e5ced45ba005f4d3c25f88fdc3f 100644
--- a/Modules/Applications/AppImageUtils/app/otbMosaic.cxx
+++ b/Modules/Applications/AppImageUtils/app/otbMosaic.cxx
@@ -276,11 +276,11 @@ private:
SetMinimumParameterFloatValue("comp.feather.slim.exponent", 0);
MandatoryOff("comp.feather.slim.exponent");
- // comp.feather.slim.lenght (i.e. blending lenght)
- AddParameter(ParameterType_Float, "comp.feather.slim.lenght", "Transition length (In cartographic units)");
- MandatoryOn("comp.feather.slim.lenght");
- SetMinimumParameterFloatValue("comp.feather.slim.lenght", 0);
- MandatoryOff("comp.feather.slim.lenght");
+ // comp.feather.slim.length (i.e. blending length)
+ AddParameter(ParameterType_Float, "comp.feather.slim.length", "Transition length (In cartographic units)");
+ MandatoryOn("comp.feather.slim.length");
+ SetMinimumParameterFloatValue("comp.feather.slim.length", 0);
+ MandatoryOff("comp.feather.slim.length");
// harmo (harmonization)
AddParameter(ParameterType_Group, "harmo", "Spectral bands harmonization mode");
@@ -315,7 +315,7 @@ private:
// Interpolators
AddParameter(ParameterType_Choice, "interpolator", "Interpolation");
- SetParameterDescription("interpolator", "This group of parameters allows to define how the input image will be interpolated during resampling.");
+ SetParameterDescription("interpolator", "This group of parameters allows defining how the input image will be interpolated during resampling.");
MandatoryOff("interpolator");
// NN
@@ -969,7 +969,7 @@ private:
ComputeDistanceOffset(m_SlimFeatherMosaicFilter);
// Set transition length and smoothness
- m_SlimFeatherMosaicFilter->SetFeatheringTransitionDistance(GetParameterFloat("comp.feather.slim.lenght"));
+ m_SlimFeatherMosaicFilter->SetFeatheringTransitionDistance(GetParameterFloat("comp.feather.slim.length"));
m_SlimFeatherMosaicFilter->SetFeatheringSmoothness(GetParameterFloat("comp.feather.slim.exponent"));
mosaicFilter = static_cast(m_SlimFeatherMosaicFilter);
diff --git a/Modules/Applications/AppImageUtils/test/CMakeLists.txt b/Modules/Applications/AppImageUtils/test/CMakeLists.txt
index 052a21d063f1c1d21807e09e4eeafa1fe73db0b1..19c2f257fb1cd676baff27f62ab3c8091e8a83ef 100644
--- a/Modules/Applications/AppImageUtils/test/CMakeLists.txt
+++ b/Modules/Applications/AppImageUtils/test/CMakeLists.txt
@@ -472,7 +472,7 @@ otb_test_application(NAME MosaicTestSlimFeathering
OPTIONS -il ${INPUTDATA}/SP67_FR_subset_1.tif ${INPUTDATA}/SP67_FR_subset_2.tif
-out ${TEMP}/apTvMosaicTestSlimFeathering.tif uint8
-comp.feather slim
- -comp.feather.slim.lenght 100
+ -comp.feather.slim.length 100
VALID --compare-image ${EPSILON_8}
${BASELINE}/apTvMosaicTestSlimFeathering.tif
${TEMP}/apTvMosaicTestSlimFeathering.tif)
diff --git a/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx b/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx
index 31625f85a2488e7cea540f9a191a8b2b5d1efa83..b4354037a387f9cc82cff3d1827c80ce9d94f379 100644
--- a/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx
+++ b/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx
@@ -302,7 +302,7 @@ private:
}
catch (...)
{
- SetParameterDescription("exp", "Other exception catched");
+ SetParameterDescription("exp", "Other exception caught");
}
}
diff --git a/Modules/Applications/AppMathParserX/test/otbBandMathXAppTests.cxx b/Modules/Applications/AppMathParserX/test/otbBandMathXAppTests.cxx
index 2f0fdfe725a1f4e9fd7fb4f8069a3cc7c2deeb62..0ebb533ac1c68315026bbf6a6c5802d701d42563 100644
--- a/Modules/Applications/AppMathParserX/test/otbBandMathXAppTests.cxx
+++ b/Modules/Applications/AppMathParserX/test/otbBandMathXAppTests.cxx
@@ -86,7 +86,7 @@ int main(int, char* argv[])
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
+ // We need to be careful as we are taking the direct output of the underlying
// filter in the application
otb::VectorImage* output_int = nullptr;
dyn_cast(output, output_int) im_val = output_int->GetPixel(index).GetElement(0);
@@ -128,7 +128,7 @@ int main(int, char* argv[])
app->Execute();
output = app->GetParameterImageBase("out");
output->Update();
- // We need to be carefull as we are taking the direct output of the underlying
+ // We need to be careful 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)
@@ -156,7 +156,7 @@ int main(int, char* argv[])
app->Execute();
output = app->GetParameterImageBase("out");
output->Update();
- // We need to be carefull as we are taking the direct output of the underlying
+ // We need to be careful 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)
diff --git a/Modules/Applications/AppStereo/app/otbFineRegistration.cxx b/Modules/Applications/AppStereo/app/otbFineRegistration.cxx
index 8ff49766c3d7cf0e044ed9096ee2e04f8a91d50d..03d3c70364a4be31785a02e1da01e1fa7b98e304 100644
--- a/Modules/Applications/AppStereo/app/otbFineRegistration.cxx
+++ b/Modules/Applications/AppStereo/app/otbFineRegistration.cxx
@@ -488,7 +488,7 @@ private:
// in this case, the pipeline cannot be resolved : the output image (wo)
// won't be computed and a segfault can occur.
otbAppLogFATAL(
- "w option has not been set : the ouput image cannot be produced."
+ "w option has not been set : the output image cannot be produced."
"Stop execution because the pipeline cannot be resolved");
}
diff --git a/Modules/Core/Functor/include/otbFunctorImageFilter.h b/Modules/Core/Functor/include/otbFunctorImageFilter.h
index 842f48cb13fad531847b2c8c4e2f7a532efcee5c..052d8a4431d3cf309b263c3424dd5efd30b183bc 100644
--- a/Modules/Core/Functor/include/otbFunctorImageFilter.h
+++ b/Modules/Core/Functor/include/otbFunctorImageFilter.h
@@ -179,7 +179,7 @@ struct RetrieveOperator
*
* Provides the following:
* - OutputImageType : type of the output image
-* - FilterType : correct instanciation of VariadicInputsImageFilter from
+* - FilterType : correct instantiation of VariadicInputsImageFilter from
* - the operator() prototype
* - InputHasNeighborhood a tuple of N false_type or true_type to denote
* - if Ith arg of operator() expects a neighborhood.
@@ -440,10 +440,10 @@ auto NewFunctorFilter(Functor f, itk::Size<2> radius)
/**
* \struct NumberOfOutputBandsDecorator
- * \brief This struct allows to forward the operator of template
+ * \brief This struct allows forwarding the operator of template
* parameter, while adding number of ouptut components service.
*
- * Its purpose is to enable the use of lambda or functor witht
+ * Its purpose is to enable the use of lambda or functor with
* Outputsize() method with FunctorImageFilter.
*
* It is used internally in NewFunctorFilter version with
diff --git a/Modules/Core/Functor/include/otbVariadicNamedInputsImageFilter.h b/Modules/Core/Functor/include/otbVariadicNamedInputsImageFilter.h
index 7ecdf36222de5186e1ee49bde46670ef23ad5e9d..27dfaea0d06a47c00ba491cc6365fca4c8ccbaaf 100644
--- a/Modules/Core/Functor/include/otbVariadicNamedInputsImageFilter.h
+++ b/Modules/Core/Functor/include/otbVariadicNamedInputsImageFilter.h
@@ -33,7 +33,7 @@ namespace internal
* \struct tuple_index
* \brief retrieve index of a type in tuple if exists
*
- * This struct allows to retrieve the index of the first occurence of type
+ * This struct allows to retrieve the index of the first occurrence of type
* Arg in tuple Tuple. If type Arg can not be found, compilation will
* end with a static_assert failing.
*
@@ -67,7 +67,7 @@ struct tuple_index>
* used as a tag to set/get the corresponding input and thus should be
* unique in tuple.
*
- * This allows to add semantic to inputs and remove the need for the
+ * This allows adding semantic to inputs and remove the need for the
* user to know input orders and set them by their index.
*
* Example of use:
diff --git a/Modules/Core/Functor/test/otbFunctorImageFilter.cxx b/Modules/Core/Functor/test/otbFunctorImageFilter.cxx
index d94d5226ebfee3615003f0e1b7089e3f2acbdf48..b0fcf645f4425a74bf1ab6f403238d3524c84485 100644
--- a/Modules/Core/Functor/test/otbFunctorImageFilter.cxx
+++ b/Modules/Core/Functor/test/otbFunctorImageFilter.cxx
@@ -424,7 +424,7 @@ int otbFunctorImageFilter(int itkNotUsed(argc), char* itkNotUsed(argv)[])
return out;
};
- // In this case, we use the helper function which allows to specify
+ // In this case, we use the helper function which allows specifying
// the number of outputs
auto filterLambda2 = NewFunctorFilter(Lambda2, vimage->GetNumberOfComponentsPerPixel(), {{3, 3}});
filterLambda2->SetInputs(image);
diff --git a/Modules/Core/ImageBase/include/otbImage.h b/Modules/Core/ImageBase/include/otbImage.h
index 0e4f765e93cf42e01000ac172112cbda03154637..29a338f3de5d3d332e2a9436aca125bdcfc0927a 100644
--- a/Modules/Core/ImageBase/include/otbImage.h
+++ b/Modules/Core/ImageBase/include/otbImage.h
@@ -280,7 +280,7 @@ private:
namespace otb
{
-// Prevent implicit instanciation of common types to improve build performance
+// Prevent implicit instantiation of common types to improve build performance
// Explicit instanciations are provided in the .cxx
extern template class OTBImageBase_EXPORT_TEMPLATE Image;
extern template class OTBImageBase_EXPORT_TEMPLATE Image;
diff --git a/Modules/Core/ImageBase/include/otbVectorImage.h b/Modules/Core/ImageBase/include/otbVectorImage.h
index 482b7983dfed4a159cdfb08cbe72468fe857f404..cd771f7924c7f86cb250794d2abd2bf4b92288c1 100644
--- a/Modules/Core/ImageBase/include/otbVectorImage.h
+++ b/Modules/Core/ImageBase/include/otbVectorImage.h
@@ -221,7 +221,7 @@ private:
namespace otb
{
-// Prevent implicit instanciation of common types to improve build performance
+// Prevent implicit instantiation of common types to improve build performance
// Explicit instanciations are provided in the .cxx
extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage;
extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage;
diff --git a/Modules/Core/ImageBase/src/otbImage.cxx b/Modules/Core/ImageBase/src/otbImage.cxx
index eef3a2a70f8351366da599318b0579324fa3db83..f28a3170f9956f601c335377edec0ea0874cd9a3 100644
--- a/Modules/Core/ImageBase/src/otbImage.cxx
+++ b/Modules/Core/ImageBase/src/otbImage.cxx
@@ -23,7 +23,7 @@
namespace otb
{
-// Explicit instanciation of common types
+// Explicit instantiation of common types
template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE Image;
template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE Image;
template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE Image;
diff --git a/Modules/Core/ImageBase/src/otbVectorImage.cxx b/Modules/Core/ImageBase/src/otbVectorImage.cxx
index 92fc817d8196b46bbfc39207f3074404a9146bd6..0673b295ab5f65d99d2ef5a5e144ba08e9b5dc68 100644
--- a/Modules/Core/ImageBase/src/otbVectorImage.cxx
+++ b/Modules/Core/ImageBase/src/otbVectorImage.cxx
@@ -23,7 +23,7 @@
namespace otb
{
-// Explicit instanciation of common types
+// Explicit instantiation of common types
template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE VectorImage;
template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE VectorImage;
template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE VectorImage;
diff --git a/Modules/Feature/Descriptors/test/otbKeyPointsAlgorithmsTest.cxx b/Modules/Feature/Descriptors/test/otbKeyPointsAlgorithmsTest.cxx
index 1803436fd320eb405eeb22842ae150005b39d400..fca23e0fc2679434a979591220febbbd48d697ed 100644
--- a/Modules/Feature/Descriptors/test/otbKeyPointsAlgorithmsTest.cxx
+++ b/Modules/Feature/Descriptors/test/otbKeyPointsAlgorithmsTest.cxx
@@ -159,7 +159,7 @@ bool testMatchingFilter()
}
-/** Generate a pair of images, one beeing slightly warped wrt the
+/** Generate a pair of images, one being slightly warped wrt the
* other */
auto generateImagePair(const std::string& infname, double rotation, double scaling)
{
diff --git a/Modules/Filtering/Mosaic/include/otbQuadraticallyConstrainedSimpleSolver.h b/Modules/Filtering/Mosaic/include/otbQuadraticallyConstrainedSimpleSolver.h
index f51a180e00826d64c4f4dac162788dde8e6f637e..4f370338b4a67cdb88cacebbe4336868bc1f8c65 100644
--- a/Modules/Filtering/Mosaic/include/otbQuadraticallyConstrainedSimpleSolver.h
+++ b/Modules/Filtering/Mosaic/include/otbQuadraticallyConstrainedSimpleSolver.h
@@ -206,7 +206,7 @@ private:
// Output correction models
RealVectorType m_OutputCorrectionModel;
- // objective funciton type (enum)
+ // objective function type (enum)
ObjectiveFunctionType oft;
};
diff --git a/Modules/Filtering/Mosaic/include/otbStreamingMosaicFilterBase.h b/Modules/Filtering/Mosaic/include/otbStreamingMosaicFilterBase.h
index 0521f0c26d95f3299a560aafd84160b894165e08..82903b5e05f3eef82d5fa3b51837281e4403e2ab 100644
--- a/Modules/Filtering/Mosaic/include/otbStreamingMosaicFilterBase.h
+++ b/Modules/Filtering/Mosaic/include/otbStreamingMosaicFilterBase.h
@@ -39,9 +39,9 @@ namespace otb
* The otb::StreamingMosaicFilterBase allows to compute what the final
* mosaic of multiple input of otb::VectorImage is, and provide the requested
* regions of input images. There is a shift-scale mode which allows
- * to shift-scale input images, which can be usefull e.g. color or
+ * to shift-scale input images, which can be useful e.g. color or
* radiometric harmonization of input set of images. The output
- * spacing (SetOuputSpacing()), the start index (SetOutputIndex()) and
+ * spacing (SetOutputSpacing()), the start index (SetOutputIndex()) and
* the interpolator (SetInterpolator()) and the origin (SetOrigin())
* can be set using the method between brackets.
*
diff --git a/Modules/Filtering/Mosaic/include/otbStreamingMosaicFilterWithBlendingBase.h b/Modules/Filtering/Mosaic/include/otbStreamingMosaicFilterWithBlendingBase.h
index 7b3a47c989a1f0ef54ccc0cec2a619176f0bbe92..5f78bc120beef283e049a0d966d387ce618eda66 100644
--- a/Modules/Filtering/Mosaic/include/otbStreamingMosaicFilterWithBlendingBase.h
+++ b/Modules/Filtering/Mosaic/include/otbStreamingMosaicFilterWithBlendingBase.h
@@ -38,7 +38,7 @@ namespace otb
* Two parameters can be set:
* -Distance image interpolator: explicit
* -Distance image offset: this value is added to the interpolated distance image
- * value, which allows to create a margin around the edges
+ * value, which allows creating a margin around the edges
* of the image (i.e. around the 0-value distance image contour)
*
* Support streaming
diff --git a/Modules/Filtering/Mosaic/include/otbStreamingMultibandFeatherMosaicFilter.h b/Modules/Filtering/Mosaic/include/otbStreamingMultibandFeatherMosaicFilter.h
index 42e7ade7b3f35537cfcb2d833adbe7bd574e15b5..85bae423652c66e9b80e0af6fd4efdc3f050bdd5 100644
--- a/Modules/Filtering/Mosaic/include/otbStreamingMultibandFeatherMosaicFilter.h
+++ b/Modules/Filtering/Mosaic/include/otbStreamingMultibandFeatherMosaicFilter.h
@@ -42,7 +42,7 @@ namespace otb
*
* The filter implements the multiband blending strategy. Laplacian
* of input images is computed, then each frequency is mosaiced using
- * a StreamingFeatherMosaicFilter. Finaly the summing of all frequencies
+ * a StreamingFeatherMosaicFilter. Finally the summing of all frequencies
* is performed to get the final mosaic image.
*
* Mandatory inputs : images to mosaic + alpha channels
diff --git a/Modules/Filtering/Statistics/include/otbStreamingStatisticsMapFromLabelImageFilter.h b/Modules/Filtering/Statistics/include/otbStreamingStatisticsMapFromLabelImageFilter.h
index 8e6a6e4049c28337a713783b627ff5d03dbb9927..da21bc99b1d3676b3c890703d38271c593494ebb 100644
--- a/Modules/Filtering/Statistics/include/otbStreamingStatisticsMapFromLabelImageFilter.h
+++ b/Modules/Filtering/Statistics/include/otbStreamingStatisticsMapFromLabelImageFilter.h
@@ -97,8 +97,11 @@ public:
const RealValueType value = pixel[band];
const RealValueType sqValue = value * value;
- UpdateValues(!m_UseNoDataValue || value != m_NoDataValue, value, sqValue, value, value, m_BandCount[band], m_Sum[band], m_SqSum[band], m_Min[band],
+ if(!m_UseNoDataValue || value != m_NoDataValue)
+ {
+ UpdateValues(1, value, sqValue, value, value, m_BandCount[band], m_Sum[band], m_SqSum[band], m_Min[band],
m_Max[band]);
+ }
}
}
diff --git a/Modules/Filtering/Statistics/include/otbStreamingStatisticsMapFromLabelImageFilter.hxx b/Modules/Filtering/Statistics/include/otbStreamingStatisticsMapFromLabelImageFilter.hxx
index 17c4b1f1caec951e81daa6ed3417e31402999e44..69487ec76edaa0f0eb6e7fe809f5826ea20524ce 100644
--- a/Modules/Filtering/Statistics/include/otbStreamingStatisticsMapFromLabelImageFilter.hxx
+++ b/Modules/Filtering/Statistics/include/otbStreamingStatisticsMapFromLabelImageFilter.hxx
@@ -175,7 +175,7 @@ void PersistentStreamingStatisticsMapFromLabelImageFilter>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader>;
diff --git a/Modules/IO/ImageIO/include/otbImageFileWriter.h b/Modules/IO/ImageIO/include/otbImageFileWriter.h
index ca32f531f6ce9da2c3a4ce10cdc0e4ff1f615334..c1e5fffbdadaf29a74b66c0aa38b6567414360b2 100644
--- a/Modules/IO/ImageIO/include/otbImageFileWriter.h
+++ b/Modules/IO/ImageIO/include/otbImageFileWriter.h
@@ -297,7 +297,7 @@ private:
namespace otb
{
-// Prevent implicit instanciation of common types to improve build performance
+// Prevent implicit instantiation of common types to improve build performance
// Explicit instanciations are provided in the .cxx
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter>;
diff --git a/Modules/IO/ImageIO/src/otbImageFileReader.cxx b/Modules/IO/ImageIO/src/otbImageFileReader.cxx
index b65c2902c1750bbbb0951c97382523f486b25e6c..465d8607bdc6ca72220cf3e38eb675dd4d58ef71 100644
--- a/Modules/IO/ImageIO/src/otbImageFileReader.cxx
+++ b/Modules/IO/ImageIO/src/otbImageFileReader.cxx
@@ -23,7 +23,7 @@
namespace otb
{
-// Explicit instanciation of common types
+// Explicit instantiation of common types
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader>;
diff --git a/Modules/IO/ImageIO/src/otbImageFileWriter.cxx b/Modules/IO/ImageIO/src/otbImageFileWriter.cxx
index 9b83c31ea35b07da369afffc435a1f386835d0ef..763f4c1567b09fbeab941097e7b3827394d454e6 100644
--- a/Modules/IO/ImageIO/src/otbImageFileWriter.cxx
+++ b/Modules/IO/ImageIO/src/otbImageFileWriter.cxx
@@ -23,7 +23,7 @@
namespace otb
{
-// Explicit instanciation of common types
+// Explicit instantiation of common types
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter>;
diff --git a/Modules/Remote/diapotb.remote.cmake b/Modules/Remote/diapotb.remote.cmake
index 71cc6f2d5c094e92a5e7ec0c5999c7d622cabd7a..f4b1e540256f1e6ec472ef8cd77a22ee25144d5e 100644
--- a/Modules/Remote/diapotb.remote.cmake
+++ b/Modules/Remote/diapotb.remote.cmake
@@ -22,5 +22,5 @@
otb_fetch_module(DiapOTBModule
"OTB module for SAR processing in Diapason."
GIT_REPOSITORY https://gitlab.orfeo-toolbox.org/remote_modules/diapotb.git
- GIT_TAG d38457a019d2ef15a47d04c21f235c9e9fe4acd5
+ GIT_TAG ec5970752f44dc0b2e7357d1b223f5825d1ec5ab
)
diff --git a/Modules/Remote/otbGRM.remote.cmake b/Modules/Remote/otbGRM.remote.cmake
index 5224df15d1fd21f8f75d459cc8f2bbedab8322e2..20da8b03323d8bf8bad9a207fb4e46dbd7ad99ca 100644
--- a/Modules/Remote/otbGRM.remote.cmake
+++ b/Modules/Remote/otbGRM.remote.cmake
@@ -32,5 +32,5 @@ A more detailed description can be found on the project website:
http://tully.ups-tlse.fr/lassallep/grm
"
GIT_REPOSITORY https://github.com/orfeotoolbox/GRM
- GIT_TAG 209161cc0b3fadad7999e80b83838868f430289e
+ GIT_TAG 043c523df522dd31fb2dfc460ef292e6a679a81f
)
diff --git a/Modules/Segmentation/Conversion/include/otbLabelImageSmallRegionMergingFilter.h b/Modules/Segmentation/Conversion/include/otbLabelImageSmallRegionMergingFilter.h
index c5c54650745b94fa5cf34f428f0988647d5ff298..e65e88369d3a2dccf984342b2885335bfda1f921 100644
--- a/Modules/Segmentation/Conversion/include/otbLabelImageSmallRegionMergingFilter.h
+++ b/Modules/Segmentation/Conversion/include/otbLabelImageSmallRegionMergingFilter.h
@@ -102,7 +102,7 @@ public:
protected:
/** The input requested region should be padded by a radius of 1 to use the
- * neigbourhood iterator */
+ * neighbourhood iterator */
void GenerateInputRequestedRegion() override;
/** Threaded Generate Data : find the neighbours of each segments of size
@@ -136,7 +136,7 @@ private:
/** Map containing at key i the mean of element of the segment labelled i */
LabelStatisticType m_LabelStatistic;
- /** Neigbours maps for each thread */
+ /** Neighbours maps for each thread */
std::vector m_NeighboursMapsTmp;
/** LUT giving correspondance between labels in the original segmentation
diff --git a/Modules/Visualization/Ice/include/otbGlActor.h b/Modules/Visualization/Ice/include/otbGlActor.h
index 7cfbf67a56ebbd232515cf9aec0bd9cfe022b989..55aa76084f740c0b19199fb4859421a025ddbc4d 100644
--- a/Modules/Visualization/Ice/include/otbGlActor.h
+++ b/Modules/Visualization/Ice/include/otbGlActor.h
@@ -24,13 +24,14 @@
#include
#include "otbViewSettings.h"
+#include "otbShader.h"
#include "OTBIceExport.h"
#include
namespace otb
{
-class OTBIce_EXPORT GlActor
+class OTBIce_EXPORT GlActor
: public itk::Object
{
public:
@@ -42,7 +43,7 @@ public:
itkSetObjectMacro(Settings,ViewSettings);
itkGetObjectMacro(Settings,ViewSettings);
itkGetConstObjectMacro(Settings,ViewSettings);
-
+
itkSetMacro(Visible,bool);
itkGetMacro(Visible,bool);
itkBooleanMacro(Visible);
@@ -58,6 +59,9 @@ public:
itkGetMacro( Overlay, bool );
itkBooleanMacro( Overlay );
+ itkGetObjectMacro( Shader, Shader );
+ itkSetObjectMacro( Shader, Shader );
+
// Retrieve the full extent of the actor
virtual void GetExtent(double & ulx, double & uly, double & lrx, double & lry) const = 0;
@@ -70,15 +74,20 @@ public:
// Gl rendering of current state
virtual void Render() = 0;
+ /** create the shader (no shader created by default) */
+ virtual void CreateShader();
+
protected:
GlActor();
~GlActor() override;
+ Shader::Pointer m_Shader;
+
private:
// prevent implementation
- GlActor(const Self&);
- void operator=(const Self&);
+ GlActor( const Self & ) = delete;
+ void operator=( const Self & ) = delete;
ViewSettings::Pointer m_Settings;
diff --git a/Modules/Visualization/Ice/include/otbGlBufferObject.h b/Modules/Visualization/Ice/include/otbGlBufferObject.h
new file mode 100644
index 0000000000000000000000000000000000000000..74cf7ca310950d3659a75894bb6d5aa775f87323
--- /dev/null
+++ b/Modules/Visualization/Ice/include/otbGlBufferObject.h
@@ -0,0 +1,173 @@
+/*
+ * 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.
+ */
+
+#ifndef otb_GlBufferObject_h
+#define otb_GlBufferObject_h
+
+#include "OTBIceExport.h"
+
+
+#include "otbGlHandle.h"
+#include "otbGlTypeTraits.h"
+
+
+namespace otb { namespace gl {
+
+
+/** OpenGL element-type of buffer-object.
+ */
+enum class element : GLenum
+{
+ vertex = GL_ARRAY_BUFFER,
+ index = GL_ELEMENT_ARRAY_BUFFER,
+};
+
+
+/**
+ */
+template< element E >
+struct BufferObjectPolicy
+{
+ static
+ void
+ Generate( Id_t & id )
+ {
+ glGenBuffers( 1, &id );
+ }
+
+ static
+ void
+ Bind( Id_t id )
+ {
+ glBindBuffer( static_cast< GLenum >( E ), id );
+ }
+
+ static
+ void
+ Release( Id_t & id )
+ {
+ glDeleteBuffers( 1, &id );
+ }
+};
+
+
+/**
+ * @class OpenGL object.
+ */
+template< element E >
+struct BufferObject
+{
+ /** Buffer identifier type. */
+ using Id_t = otb::gl::Id_t;
+
+ /** @return element type. */
+ static constexpr
+ element
+ Element() noexcept
+ {
+ return E;
+ }
+
+ /** Default constructor. */
+ BufferObject() = default;
+
+ /** Construct and fill. */
+ template< typename T >
+ BufferObject( std::initializer_list< T > data,
+ std::size_t components = 1 ) :
+ m_Id(),
+ m_Count( data.size() ),
+ m_Size( sizeof( T ) ),
+ m_Components( components ),
+ m_GlType( TypeTraits< T >::value() )
+ {
+ assert( data.size() );
+ assert( components );
+
+ glBufferData(
+ static_cast< GLenum >( E ),
+ data.size() * sizeof( T ),
+ data.begin(),
+ GL_STATIC_DRAW
+ );
+
+ CheckError();
+ }
+
+ ~BufferObject() = default;
+
+ BufferObject( BufferObject && ) = default;
+
+ BufferObject & operator = ( BufferObject && ) = default;
+
+ /** Cast operator. */
+ operator Id_t() const noexcept
+ {
+ return m_Id;
+ }
+
+ void
+ Bind( bool isEnabled = true ) const
+ {
+ m_Id.Bind( isEnabled );
+ }
+
+ GLenum
+ GlType() const noexcept
+ {
+ return m_GlType;
+ }
+
+ std::size_t
+ Size() const noexcept
+ {
+ return m_Size;
+ }
+
+ std::size_t
+ Stride( std::size_t components ) const noexcept
+ {
+ assert( m_Size>0 );
+ assert( m_Components>0 );
+
+ assert( components<=m_Components );
+
+ return m_Size * ( m_Components - components );
+ }
+
+private:
+ Handle< BufferObjectPolicy< E > > m_Id;
+ std::size_t m_Count = 0;
+ std::size_t m_Size = 0;
+ std::size_t m_Components = 0;
+ GLenum m_GlType = GL_ZERO;
+};
+
+
+using VertexBufferObject = BufferObject< element::vertex >;
+using IndexBufferObject = BufferObject< element::index >;
+
+
+} // end namespace gl.
+
+} // end namespace otb.
+
+
+#endif // otb_GlBufferObject_h
diff --git a/Modules/Visualization/Ice/include/otbGlError.h b/Modules/Visualization/Ice/include/otbGlError.h
new file mode 100644
index 0000000000000000000000000000000000000000..efd3691c6a8364e4982c49e4f76e72a5a83e3c56
--- /dev/null
+++ b/Modules/Visualization/Ice/include/otbGlError.h
@@ -0,0 +1,96 @@
+/*
+ * 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.
+ */
+
+#ifndef otb_GlError_h
+#define otb_GlError_h
+
+
+#include "OTBIceExport.h"
+
+#ifdef _WIN32
+# include
+#endif
+
+#include
+
+#include
+#include
+#include
+
+
+namespace otb { namespace gl {
+
+/**
+ * @class OpenGL-specific exception.
+ */
+struct OTBIce_EXPORT Error : public std::runtime_error
+{
+ /** Construct an OpenGL exception related to the OpenGL error code.
+ */
+ Error( GLenum code );
+
+}; // End class GlError
+
+enum class error : int
+{
+ clear = 0,
+ trace,
+ assertion,
+ exception,
+};
+
+
+template< error E = error::exception >
+GLenum
+CheckError()
+{
+ GLenum glError = glGetError();
+
+ if( E>=error::trace )
+ if( glError!=GL_NO_ERROR )
+ std::cerr
+ << "OPenGL error #" << glError << ": '" << gluErrorString( glError ) << "'"
+ << std::endl;
+
+ if( E>=error::assertion )
+ assert( glError==GL_NO_ERROR );
+
+ // When assert is removed (NDEBUG) and Throw is false, this function
+ // body is emtpy and the C++ compiler should optimize the call by
+ // removing it.
+ //
+ // N.B.: equivalent of a scoped (and breakpoint-friendly) macro.
+
+ // Condition is splitted because first is determined at compile time
+ // and may be removed (see above) and second is determined at
+ // runtime.
+ if( E>=error::exception )
+ if( glError!=GL_NO_ERROR )
+ throw Error( glError );
+
+ return glError;
+}
+
+} // End of namespace gl.
+
+} // End namespace otb.
+
+
+#endif // otb_GlError_h
diff --git a/Modules/Visualization/Ice/include/otbGlHandle.h b/Modules/Visualization/Ice/include/otbGlHandle.h
new file mode 100644
index 0000000000000000000000000000000000000000..94f5c5be7c0e63fc4cbc61d0eea249fa1382c0ba
--- /dev/null
+++ b/Modules/Visualization/Ice/include/otbGlHandle.h
@@ -0,0 +1,135 @@
+/*
+ * 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.
+ */
+
+#ifndef otb_GlHandle_h
+#define otb_GlHandle_h
+
+#include "OTBIceExport.h"
+
+
+#ifdef _WIN32
+# include
+#endif
+
+#include
+#include "otbGlError.h"
+
+#include
+#include
+
+
+namespace otb { namespace gl {
+
+using Id_t = GLuint;
+
+/**
+ * @class OpenGL handle.
+ */
+template< typename Policy >
+class OTBIce_EXPORT Handle
+{
+ using Policy_t = Policy;
+
+public:
+ /** OpenGL handle identifier type */
+ using Id_t = otb::gl::Id_t;
+
+ /** Default constructor */
+ Handle()
+ {
+ Policy::Generate( m_Id );
+ assert( m_Id );
+
+ CheckError();
+
+ Policy::Bind( m_Id );
+
+ CheckError();
+ }
+
+ /** Destructor */
+ ~Handle()
+ {
+ Release();
+ }
+
+ /** Copy constructor (disabled). */
+ Handle( Handle const & ) = delete;
+
+ /** Assignement operator (disabled). */
+ Handle & operator = ( Handle const & ) = delete;
+
+ /** Move constructor. */
+ Handle( Handle && rhs ) noexcept :
+ m_Id( std::exchange( rhs.m_Id, 0 ) ) {}
+
+ /** Move assignment operator. */
+ Handle &
+ operator = ( Handle && rhs )
+ {
+ Release();
+
+ m_Id = std::exchange( rhs.m_Id, GL_ZERO );
+
+ return *this;
+ }
+
+ /** Cast operator. */
+ operator Id_t() const noexcept
+ {
+ return m_Id;
+ }
+
+ /** OpenGL handle binding */
+ void
+ Bind( bool isEnabled = true ) const
+ {
+ assert( m_Id );
+
+ Policy::Bind( isEnabled ? m_Id : GL_ZERO );
+
+ CheckError();
+ }
+
+protected:
+ /** OpenGL handle identifier (handler) */
+ Id_t m_Id = GL_ZERO;
+
+private:
+ void
+ Release()
+ {
+ CheckError< error::clear >();
+
+ Policy::Release( m_Id );
+
+ m_Id = GL_ZERO;
+
+ CheckError();
+ }
+};
+
+
+} // end namespace gl.
+
+} // end namespace otb.
+
+
+#endif // otb_GlHandle_h
diff --git a/Modules/Visualization/Ice/include/otbGlImageActor.h b/Modules/Visualization/Ice/include/otbGlImageActor.h
index be094a76e847fc27244bfbc1b252ad1e47688217..40b9c6d839eef8ee0fdf086e55f87279c68661e2 100644
--- a/Modules/Visualization/Ice/include/otbGlImageActor.h
+++ b/Modules/Visualization/Ice/include/otbGlImageActor.h
@@ -26,7 +26,6 @@
#include "itkCenteredRigid2DTransform.h"
-#include "otbFragmentShader.h"
#include "otbGenericRSTransform.h"
#include "otbGeoInterface.h"
#include "otbGlActor.h"
@@ -35,13 +34,20 @@
#include "otbMultiChannelExtractROI.h"
#include "otbVectorRescaleIntensityImageFilter.h"
#include "otbVectorImage.h"
+
#include
namespace otb
{
-class OTBIce_EXPORT GlImageActor
+namespace gl
+{
+struct Mesh;
+}
+
+
+class OTBIce_EXPORT GlImageActor
: public GlActor, public GeoInterface
{
public:
@@ -63,7 +69,7 @@ public:
typedef VectorImageType::SpacingType SpacingType;
typedef VectorImageType::PointType PointType;
typedef VectorRescaleIntensityImageFilter RescaleFilterType;
-
+
struct ResolutionAlgorithm
{
enum type
@@ -76,7 +82,7 @@ public:
///performances, better quality)
MAX__};
};
-
+
// Initialize with a new image
void Initialize(const std::string & filename);
@@ -125,11 +131,7 @@ public:
itkSetMacro(TileSize,unsigned int);
itkGetMacro(TileSize,unsigned int);
- itkBooleanMacro(SoftwareRendering );
- itkSetMacro(SoftwareRendering, bool );
- itkGetMacro(SoftwareRendering, bool );
-
- void CreateShader();
+ void CreateShader() override;
void SetResolutionAlgorithm(ResolutionAlgorithm::type alg)
{
@@ -144,7 +146,7 @@ public:
virtual void SetRedIdx(const unsigned int idx)
{
if ( this->m_RedIdx != idx )
- {
+ {
this->m_RedIdx = std::min(this->GetNumberOfComponents(),idx);
this->Modified();
}
@@ -153,25 +155,25 @@ public:
virtual void SetGreenIdx(const unsigned int idx)
{
if ( this->m_GreenIdx != idx )
- {
+ {
this->m_GreenIdx = std::min(this->GetNumberOfComponents(),idx);
this->Modified();
}
- }
+ }
virtual void SetBlueIdx(const unsigned int idx)
{
if ( this->m_BlueIdx != idx )
- {
+ {
this->m_BlueIdx = std::min(this->GetNumberOfComponents(),idx);
- this->Modified();
+ this->Modified();
}
}
PointType ViewportToImageTransform(const PointType & in, bool physical = true) const;
PointType ImageToViewportTransform(const PointType & in, bool physical = true) const;
-
+
bool GetPixelFromViewport( const PointType & in, PixelType & pixel ) const;
bool GetPixelFromViewport( const PointType & view,
@@ -181,9 +183,6 @@ public:
bool GetPixel( const PointType & physical, PixelType & pixel, IndexType & index ) const;
- itkGetObjectMacro(Shader,FragmentShader);
- itkSetObjectMacro(Shader,FragmentShader);
-
itkGetObjectMacro( ImageSettings, ImageSettings );
//
@@ -203,7 +202,7 @@ public:
protected:
GlImageActor();
-
+
~GlImageActor() override;
typedef ImageFileReader ReaderType;
@@ -216,33 +215,23 @@ protected:
class Tile
{
public:
- Tile()
- : m_Loaded(false),
- m_TextureId(0),
- m_ImageRegion(),
- m_TileSize(0),
- m_Image(),
- m_UL(),
- m_UR(),
- m_LL(),
- m_LR(),
- m_Resolution(1),
- m_RedIdx(1),
- m_GreenIdx(2),
- m_BlueIdx(3),
- m_RescaleFilter(nullptr)
- {
- m_UL.Fill(0);
- m_UR.Fill(0);
- m_LL.Fill(0);
- m_LR.Fill(0);
- }
+ Tile();
+
+ ~Tile();
+
+ void Link( ReaderType::OutputImageType * );
+
+ ReaderType::OutputImageType::Pointer const &
+ Image() const noexcept
+ { return m_Image; }
+
+ void Acquire() noexcept;
+ void Release();
bool m_Loaded;
unsigned int m_TextureId;
RegionType m_ImageRegion;
unsigned int m_TileSize;
- VectorImageType::Pointer m_Image;
PointType m_UL;
PointType m_UR;
PointType m_LL;
@@ -252,10 +241,14 @@ protected:
unsigned int m_GreenIdx;
unsigned int m_BlueIdx;
RescaleFilterType::Pointer m_RescaleFilter;
+
+ private:
+ VectorImageType::Pointer m_Image;
+
};
- typedef std::vector TileVectorType;
-
+ typedef std::list< Tile > TileVectorType;
+
private:
// prevent implementation
GlImageActor(const Self&);
@@ -263,7 +256,7 @@ private:
// Load tile to GPU
void LoadTile(Tile& tile);
-
+
// Unload tile from GPU
void UnloadTile(Tile& tile);
@@ -283,11 +276,11 @@ private:
void ViewportExtentToImageRegion(const double& ulx, const double & uly, const double & lrx, const double & lry, RegionType & region) const;
void UpdateResolution();
-
+
unsigned int m_TileSize;
std::string m_FileName;
-
+
ReaderType::Pointer m_FileReader;
TileVectorType m_LoadedTiles;
@@ -308,7 +301,6 @@ private:
unsigned int m_NumberOfComponents;
ImageSettings::Pointer m_ImageSettings;
- FragmentShader::Pointer m_Shader;
RSTransformType::Pointer m_ViewportToImageTransform;
RSTransformType::Pointer m_ImageToViewportTransform;
@@ -318,7 +310,8 @@ private:
ResolutionAlgorithm::type m_ResolutionAlgorithm;
- bool m_SoftwareRendering;
+ /** OpenGL quad. */
+ std::unique_ptr< gl::Mesh > m_Mesh;
}; // End class GlImageActor
diff --git a/Modules/Visualization/Ice/include/otbGlMesh.h b/Modules/Visualization/Ice/include/otbGlMesh.h
new file mode 100644
index 0000000000000000000000000000000000000000..3d64d73368d8fab37f1bdee870cd48e27785debe
--- /dev/null
+++ b/Modules/Visualization/Ice/include/otbGlMesh.h
@@ -0,0 +1,108 @@
+/*
+ * 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.
+ */
+
+#ifndef otb_GlMesh_h
+#define otb_GlMesh_h
+
+#include "OTBIceExport.h"
+
+
+#include "otbGlVertexArrayObject.h"
+#include "otbGlBufferObject.h"
+
+
+namespace otb { namespace gl {
+
+/**
+ * @class OpenGL mesh.
+ */
+struct Mesh
+{
+ Mesh() = default;
+
+ template< typename VT,
+ typename IT = GLuint >
+ Mesh( std::initializer_list< VT > vertices,
+ std::size_t components,
+ std::initializer_list< IT > indices ) :
+ m_VBO( vertices, components ),
+ m_IBO( indices, 3 )
+ {}
+
+ Mesh( Mesh && ) = default;
+
+ // Mesh & operator = ( Mesh && ) = default;
+
+ // Mesh( Mesh && m ) :
+ // m_VAO( std::move( m.m_VAO ) ),
+ // m_VBO( std::move( m.m_VBO ) ),
+ // m_IBO( std::move( m.m_IBO ) )
+ // {}
+
+
+ void
+ Bind( bool isEnabled = true )
+ {
+ assert( glIsBuffer( m_VBO ) );
+ assert( glIsBuffer( m_IBO ) );
+
+ assert( glIsVertexArray( m_VAO ) );
+
+ m_VAO.Bind( isEnabled );
+ m_VBO.Bind( isEnabled );
+ m_IBO.Bind( isEnabled );
+ }
+
+ void
+ VertexAttribPointer( VertexBufferObject::Id_t id,
+ std::size_t components,
+ std::ptrdiff_t first = 0 ) const;
+
+ VertexBufferObject const &
+ VBO() const noexcept
+ {
+ return m_VBO;
+ }
+
+ IndexBufferObject const &
+ IBO() const
+ {
+ return m_IBO;
+ }
+
+private:
+ VertexArrayObject m_VAO;
+ VertexBufferObject m_VBO;
+ IndexBufferObject m_IBO;
+};
+
+
+Mesh MakeTexturedQuad( Id_t xy, Id_t uv );
+
+Mesh MakeInterleavedTexturedQuad( Id_t xy, Id_t uv );
+
+Mesh MakeQuad( Id_t xy);
+
+} // end namespace gl.
+
+} // end namespace otb.
+
+
+#endif // otb_GlMesh_h
diff --git a/Modules/Visualization/Ice/include/otbGlROIActor.h b/Modules/Visualization/Ice/include/otbGlROIActor.h
index 536c5dc2e549eca24484794841d247fda42cb55c..691792804adc36e2ef3f43a0dc18327e120a01ce 100644
--- a/Modules/Visualization/Ice/include/otbGlROIActor.h
+++ b/Modules/Visualization/Ice/include/otbGlROIActor.h
@@ -24,7 +24,6 @@
#include "otbGlActor.h"
#include "otbGenericRSTransform.h"
-#include "otbFragmentShader.h"
#include "otbImageKeywordlist.h"
#include "itkImageRegion.h"
#include "itkVector.h"
@@ -33,6 +32,11 @@
namespace otb
{
+namespace gl
+{
+struct Mesh;
+}
+
class OTBIce_EXPORT GlROIActor
: public GlActor
{
@@ -61,6 +65,8 @@ public:
// Gl rendering of current state
void Render() override;
+ void CreateShader() override;
+
void SetUL( const PointType & );
itkGetConstReferenceMacro(UL,PointType);
@@ -105,6 +111,7 @@ private:
ColorType m_Color;
double m_Alpha;
+ double m_CurrentAlpha;
bool m_Fill;
RSTransformType::Pointer m_ViewportToImageTransform;
@@ -115,6 +122,9 @@ private:
PointType m_VpLL;
PointType m_VpLR;
+ /** OpenGL quad. */
+ std::unique_ptr< gl::Mesh > m_Mesh;
+
}; // End class GlROIActor
} // End namespace otb
diff --git a/Modules/Visualization/Ice/include/otbGlTypeTraits.h b/Modules/Visualization/Ice/include/otbGlTypeTraits.h
new file mode 100644
index 0000000000000000000000000000000000000000..c9f9846cc418b764215d7e8c5454e1c9eb8b5287
--- /dev/null
+++ b/Modules/Visualization/Ice/include/otbGlTypeTraits.h
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ */
+
+#ifndef otb_GlTypeTraits_h
+#define otb_GlTypeTraits_h
+
+#include "OTBIceExport.h"
+
+
+#ifdef _WIN32
+# include
+#endif
+
+#include
+
+
+namespace otb { namespace gl {
+
+
+using Id_t = GLuint;
+
+
+/**
+ * @class traits to associate (OpenGL) type to its GLenum value.
+ */
+template< typename T >
+struct TypeTraits
+{
+ /** OpenGL type */
+ using Type = T;
+
+ /** OpenGL type enum */
+ static constexpr GLenum value() noexcept;
+
+ static char const * name() noexcept;
+};
+
+
+/** Define OpenGL type to its GLenum value */
+#define OTB_GL_TYPE_TRAITS( type, glenum, glname ) \
+ /** OpenGL type to GLenum association. */ \
+ template<> \
+ struct TypeTraits< type > \
+ { \
+ static constexpr GLenum value() noexcept { return glenum; } \
+ \
+ static constexpr char const * name() noexcept { return glname; } \
+ }
+
+OTB_GL_TYPE_TRAITS( GLfloat, GL_FLOAT, "GLfloat" );
+OTB_GL_TYPE_TRAITS( GLdouble, GL_DOUBLE, "GLdouble" );
+OTB_GL_TYPE_TRAITS( GLint, GL_INT, "GLint" );
+OTB_GL_TYPE_TRAITS( GLuint, GL_UNSIGNED_INT, "GLuint" );
+
+
+} // end namespace gl.
+
+} // end namespace otb.
+
+
+#endif // otb_TypeTraits_h
diff --git a/Modules/Visualization/Ice/include/otbGlVectorActor.h b/Modules/Visualization/Ice/include/otbGlVectorActor.h
index a919f73334320cf26909a871f07d5eef2dc08117..6fdbd3bd086ba14376528b04a985ec07e87f2439 100644
--- a/Modules/Visualization/Ice/include/otbGlVectorActor.h
+++ b/Modules/Visualization/Ice/include/otbGlVectorActor.h
@@ -82,6 +82,8 @@ public:
// Gl rendering of current state
void Render() override;
+ void CreateShader() override;
+
PointType ViewportToVectorTransform(const PointType & point) const;
itkSetMacro(Color,ColorType);
diff --git a/Modules/Visualization/Ice/include/otbGlVersionChecker.h b/Modules/Visualization/Ice/include/otbGlVersionChecker.h
index 75f15bf85ef210e0a14819acda94caae989c2483..56345e420424dde81051f4af8ad9efee2f6e0537 100644
--- a/Modules/Visualization/Ice/include/otbGlVersionChecker.h
+++ b/Modules/Visualization/Ice/include/otbGlVersionChecker.h
@@ -48,7 +48,7 @@ public:
* std::runtime_error() is thrown when glGetError() is different
* than GL_NO_ERROR.
*/
- static const char * GLVersion();
+ static const char * GLVersion() noexcept;
/**
* \return The OpenGL Shading-Language version used at runtime. The
@@ -59,7 +59,15 @@ public:
* 2.0. (@see
* http://www.opengl.org/sdk/docs/man2/xhtml/glGetString.xml).
*/
- static const char * GLSLVersion();
+ static const char * GLSLVersion() noexcept;
+
+ /**
+ * \brief Check that OpenGL required capabilities have been reached.
+ *
+ * \return true if OpengGL capabilities of running platform meets
+ * the needs of the library.
+ */
+ static bool CheckGLCapabilities() noexcept;
/**
* \brief Check that OpenGL required capabilities have been reached.
@@ -74,7 +82,7 @@ public:
* the needs of the library.
*/
static bool CheckGLCapabilities( const char * & glVersion,
- const char * & glslVersion );
+ const char * & glslVersion ) noexcept;
/**
* \brief Compares to version-strings on the model of strcmp().
@@ -90,14 +98,7 @@ public:
* \return -1
if version0 if
* version==required; +1
if version>=required.
*/
- static int VerCmp( const char * version, const char * required );
-
-private:
- // Prevent instantiation
- GlVersionChecker();
- ~GlVersionChecker();
- GlVersionChecker(const GlVersionChecker&);
- void operator=(const GlVersionChecker&);
+ static int VerCmp( const char * version, const char * required ) noexcept;
/**
* \brief Split version string into Major.minor.release triplet.
@@ -114,7 +115,14 @@ private:
static bool SplitVersion( const char * version,
int& major,
int& minor,
- int& release );
+ int& release ) noexcept;
+
+private:
+ // Prevent instantiation
+ GlVersionChecker() = delete;
+ ~GlVersionChecker() = delete;
+ GlVersionChecker( const GlVersionChecker & ) = delete;
+ void operator = ( const GlVersionChecker & ) = delete;
};
} // End namespace otb
diff --git a/Modules/Visualization/Ice/include/otbGlVertexArrayObject.h b/Modules/Visualization/Ice/include/otbGlVertexArrayObject.h
new file mode 100644
index 0000000000000000000000000000000000000000..9eb49be8d5e48c92d5d5adaf19a4ac9ba40bb291
--- /dev/null
+++ b/Modules/Visualization/Ice/include/otbGlVertexArrayObject.h
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+
+#ifndef otb_GlVertexArrayObject_h
+#define otb_GlVertexArrayObject_h
+
+#include "OTBIceExport.h"
+
+
+#include "otbGlHandle.h"
+#include "otbGlTypeTraits.h"
+
+
+namespace otb { namespace gl {
+
+/**
+ * @class OpenGL vertex-arary object handle policy.
+ */
+struct OTBIce_EXPORT VertexArrayObjectPolicy
+{
+ static void Generate( Id_t & );
+ static void Bind( Id_t );
+ static void Release( Id_t & );
+};
+
+
+/** VertexArrayObject type definition. */
+using VertexArrayObject = Handle< VertexArrayObjectPolicy >;
+
+
+} // end namespace gl.
+
+} // end namespace otb.
+
+
+#endif // otb_GlVetexArrayObject_h
diff --git a/Modules/Visualization/Ice/include/otbGlView.h b/Modules/Visualization/Ice/include/otbGlView.h
index 114add8e4bc38567474a20a29f9d4b093f9a7eba..15a85e31dd879500adb21781ec83b154b472fc3d 100644
--- a/Modules/Visualization/Ice/include/otbGlView.h
+++ b/Modules/Visualization/Ice/include/otbGlView.h
@@ -66,7 +66,7 @@ assert_NaN( T val )
((void)val);
}
-/**
+/**
* The GlView class acts like an OpenGl scene where actors deriving
* from the GlActor class can be rendered. The GlView class contains the
* OpenGl viewport and manages:
@@ -75,11 +75,11 @@ assert_NaN( T val )
* all actors and all OpenGl specific stuff needed before and after
* the actors update,
* - The actors stack (order in which actors are rendered).
- *
+ *
* All parameters related to scene description (origin, spacing, angle
* ...) are stored and managed by the ViewSettings class.
*/
-class OTBIce_EXPORT GlView
+class OTBIce_EXPORT GlView
: public itk::Object
{
public:
@@ -99,20 +99,32 @@ public:
itkNewMacro(Self);
+ /**
+ * @return Same value as GLSL #version
, or 0 if minimum
+ * requirements are not met.
+ */
+ std::size_t CheckGLCapabilities( char const * & glVersion,
+ char const * & glslVersion );
+
/**
* The Initialize method will reset the OpenGl viewport to the given
* size, clear view settings and remove any existing actor.
* \param sx Width of the viewport
* \param sy Height of the viewport
- */
- void Initialize(unsigned int sx, unsigned int sy);
+ */
+ void Initialize( unsigned int sx, unsigned int sy ) noexcept;
+
+ /**
+ * @return true
there is no actor in view.
+ */
+ bool IsEmpty() const noexcept { return m_Actors.empty(); }
/**
* This method allows adding a new actor (deriving from GlActor) to
* the GlView. The actor can be identified by an optional key. If
* not provided, and the default value is used, the method will
* generate a key to identify the actor. In both case, the key is
- * returned by the method.
+ * returned by the method.
* \param actor The actor to be added
* \param key The key to be used to identify the actor (default to
* empty string)
@@ -121,7 +133,7 @@ public:
*/
std::string AddActor(ActorType * actor, const std::string & key = "");
- /**
+ /**
* This method will try to remove the actor identified by the given
* key.
* \param key The key identifying the actor to remove
@@ -133,7 +145,7 @@ public:
/**
* This method will remove all existing actors at once.
*/
- void ClearActors();
+ void ClearActors() noexcept;
/**
* This method allows retrieving a pointer to the actor identified
@@ -141,7 +153,7 @@ public:
* \param key The key identifying the actor to retrieve
* \return A pointer to the retrieved actor. This pointer will be
* null if no actor could be found with this key.
- */
+ */
ActorType::Pointer GetActor(const std::string & key) const;
/**
@@ -157,7 +169,7 @@ public:
* This method will return a vector containing the keys of all
* actors.
* \return A vector of string containing the keys of all actors.
- */
+ */
std::vector GetActorsKeys() const;
/**
@@ -189,12 +201,23 @@ public:
void HeavyRender();
// Resize viewport
- void Resize(unsigned int sx, unsigned int sy);
+ void Resize( unsigned int sx, unsigned int sy ) noexcept;
itkSetObjectMacro(Settings,ViewSettings);
itkGetObjectMacro(Settings,ViewSettings);
itkGetConstObjectMacro(Settings,ViewSettings);
+ /** @return true
OpenGL driver has required GLSL capability. */
+ bool IsGLSLAvailable() const noexcept { return m_IsGLSLAvailable; }
+
+ /**
+ * Enable/Disable GLSL-mode.
+ */
+ void SetGLSLEnabled( bool );
+
+ /** @return true
if GLSL-mode is enabled. */
+ bool IsGLSLEnabled() const noexcept { return m_IsGLSLEnabled; }
+
//comment this macro (not compiling with OTB 3.X)
// Get Rendering order
const StringVectorType & GetRenderingOrder() const
@@ -294,6 +317,12 @@ private:
StringVectorType m_RenderingOrder;
+ float m_ProjMatrix[16];
+
+ float m_ModelViewMatrix[16];
+
+ bool m_IsGLSLAvailable : 1;
+ bool m_IsGLSLEnabled : 1;
}; // End class GlView
@@ -332,7 +361,7 @@ GlView
return false;
const otb::GeoInterface::Spacing2 nativeReferenceSpacing = geo->GetSpacing();
-
+
//
// Compute transform origin.
if( !geo->TransformFromViewport( center, vcenter, true ) )
@@ -342,7 +371,7 @@ GlView
// Compute transformed X-axis extremity.
GeoInterface::Point2d x( vcenter );
- x[ 0 ] += norm * vspacing[ 0 ];
+ x[ 0 ] += norm * vspacing[ 0 ];
// std::cout << "X {" << std::endl;
@@ -365,7 +394,7 @@ GlView
// std::cout << "Y {" << std::endl;
if( !geo->TransformFromViewport( y, y, true ) )
- return false;
+ return false;
// std::cout << "y: " << y[ 0 ] << ", " << y[ 1 ] << std::endl;
@@ -395,7 +424,7 @@ GlView
spacing[ 1 ] = std::sqrt( y[ 0 ] * y[ 0 ] + y[ 1 ] * y[ 1 ] ) / norm;
// New spacing signs should match signs of the reference image spacing
-
+
if( nativeReferenceSpacing[0]<0.0 )
spacing[ 0 ] = -spacing[ 0 ];
diff --git a/Modules/Visualization/Ice/include/otbMinimalShader.h b/Modules/Visualization/Ice/include/otbMinimalShader.h
new file mode 100644
index 0000000000000000000000000000000000000000..536b9779deac99f056950f7af73b9f9f9c8468a5
--- /dev/null
+++ b/Modules/Visualization/Ice/include/otbMinimalShader.h
@@ -0,0 +1,80 @@
+/*
+ * 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.
+ */
+
+#ifndef otb_MinimalShader_h
+#define otb_MinimalShader_h
+
+#include
+#include "otbShader.h"
+#include
+
+namespace otb
+{
+
+class OTBIce_EXPORT MinimalShader
+ : public Shader
+{
+public:
+ typedef MinimalShader Self;
+ typedef Shader Superclass;
+ typedef itk::SmartPointer Pointer;
+ typedef itk::SmartPointer ConstPointer;
+
+ typedef itk::Point PointType;
+
+ void SetupShader() override;
+
+ itkNewMacro(Self);
+
+ void SetColor(const double *rgb, const double *a);
+
+protected:
+ MinimalShader();
+
+ ~MinimalShader() override;
+
+ std::string GetVertexSource() const override;
+
+ std::string GetFragmentSource() const override;
+
+ std::string GetName() const override;
+
+private:
+ // prevent implementation
+ MinimalShader(const Self&);
+ void operator=(const Self&);
+
+ const double *m_ColorRGB;
+ const double *m_ColorA;
+
+ struct UniformLocs
+ {
+ int proj;
+ int modelview;
+ int color;
+ };
+
+ UniformLocs m_Loc;
+}; // End class MinimalShader
+
+} // End namespace otb
+
+#endif
+
diff --git a/Modules/Visualization/Ice/include/otbFragmentShader.h b/Modules/Visualization/Ice/include/otbShader.h
similarity index 65%
rename from Modules/Visualization/Ice/include/otbFragmentShader.h
rename to Modules/Visualization/Ice/include/otbShader.h
index d697da182bb20a3d68410bb09f84c4484d561c5e..68e7baa2bf7451c948cc5866f6857d4335618897 100644
--- a/Modules/Visualization/Ice/include/otbFragmentShader.h
+++ b/Modules/Visualization/Ice/include/otbShader.h
@@ -18,8 +18,8 @@
* limitations under the License.
*/
-#ifndef otb_FragmentShader_h
-#define otb_FragmentShader_h
+#ifndef otb_Shader_h
+#define otb_Shader_h
#include "OTBIceExport.h"
@@ -29,11 +29,14 @@
namespace otb
{
-class OTBIce_EXPORT FragmentShader
+class GlView;
+
+class OTBIce_EXPORT Shader
: public itk::Object
{
+friend class GlView;
public:
- typedef FragmentShader Self;
+ typedef Shader Self;
typedef itk::Object Superclass;
typedef itk::SmartPointer Pointer;
typedef itk::SmartPointer ConstPointer;
@@ -46,37 +49,39 @@ public:
void UnloadShader();
- itkSetMacro(UL,PointType);
- itkSetMacro(UR,PointType);
- itkSetMacro(LL,PointType);
- itkSetMacro(LR,PointType);
- itkGetConstReferenceMacro(UL,PointType);
- itkGetConstReferenceMacro(UR,PointType);
- itkGetConstReferenceMacro(LL,PointType);
- itkGetConstReferenceMacro(LR,PointType);
+ const std::vector & GetAttribIdx();
protected:
- FragmentShader();
+ Shader();
- ~FragmentShader() override;
+ ~Shader() override;
+ /** Build the shader sources and fills m_Program */
void BuildShader();
- virtual std::string GetSource() const = 0;
+ virtual std::string GetVertexSource() const = 0;
+
+ virtual std::string GetFragmentSource() const = 0;
virtual std::string GetName() const = 0;
+ /** Program object in which the shader is compiled and linked (0 if no program) */
+ unsigned int m_Program;
+
+ /** Projection matrix */
+ const float * m_ProjMatrix;
+
+ /** ModelView matrix */
+ const float * m_ModelViewMatrix;
+
+ std::vector m_AttribIdx;
+
private:
// prevent implementation
- FragmentShader(const Self&);
+ Shader(const Self&);
void operator=(const Self&);
- PointType m_UL;
- PointType m_UR;
- PointType m_LL;
- PointType m_LR;
-
-}; // End class FragmentShader
+}; // End class Shader
} // End namespace otb
diff --git a/Modules/Visualization/Ice/include/otbFragmentShaderRegistry.h b/Modules/Visualization/Ice/include/otbShaderRegistry.h
similarity index 78%
rename from Modules/Visualization/Ice/include/otbFragmentShaderRegistry.h
rename to Modules/Visualization/Ice/include/otbShaderRegistry.h
index c7b2ecf90e1fbee668bb349517324b3c979d96af..9d0b82337fe7f9a779af238ef9b2298496e495e8 100644
--- a/Modules/Visualization/Ice/include/otbFragmentShaderRegistry.h
+++ b/Modules/Visualization/Ice/include/otbShaderRegistry.h
@@ -18,8 +18,8 @@
* limitations under the License.
*/
-#ifndef otb_FragmentShaderRegistry_h
-#define otb_FragmentShaderRegistry_h
+#ifndef otb_ShaderRegistry_h
+#define otb_ShaderRegistry_h
#include "itkObject.h"
#include "itkObjectFactory.h"
@@ -27,18 +27,18 @@
namespace otb
{
-class FragmentShaderRegistry
+class ShaderRegistry
: public itk::Object
{
public:
- typedef FragmentShaderRegistry Self;
+ typedef ShaderRegistry Self;
typedef itk::Object Superclass;
typedef itk::SmartPointer Pointer;
typedef itk::SmartPointer ConstPointer;
static Pointer Instance();
- void RegisterShader(const std::string& name, const std::string& source);
+ void RegisterShader(const std::string& name, const std::string& vSource, const std::string& fSource);
bool UnregisterShader(const std::string& name);
@@ -53,24 +53,26 @@ public:
unsigned int GetShaderProgram(const std::string& name);
protected:
- FragmentShaderRegistry();
+ ShaderRegistry();
- ~FragmentShaderRegistry() override;
+ ~ShaderRegistry() override;
private:
- typedef std::map > ShaderMapType;
+ typedef std::map ShaderMapType;
itkNewMacro(Self);
// prevent implementation
- FragmentShaderRegistry(const Self&);
+ ShaderRegistry(const Self&);
void operator=(const Self&);
+ unsigned int CompileShader(int stype, const std::string& name, const std::string& src);
+
static Pointer m_Instance;
ShaderMapType m_ShaderMap;
-}; // End class FragmentShaderRegistry
+}; // End class ShaderRegistry
} // End namespace otb
diff --git a/Modules/Visualization/Ice/include/otbStandardShader.h b/Modules/Visualization/Ice/include/otbStandardShader.h
index 246bb8200c6964745bca82debf6c13d2cee5ded9..790ea965bd7ea10d78d503bd6f709a9254469c37 100644
--- a/Modules/Visualization/Ice/include/otbStandardShader.h
+++ b/Modules/Visualization/Ice/include/otbStandardShader.h
@@ -22,7 +22,7 @@
#define otb_StandardShader_h
#include
-#include "otbFragmentShader.h"
+#include "otbShader.h"
#include "otbImageSettings.h"
#include
@@ -52,11 +52,11 @@ typedef enum
class OTBIce_EXPORT StandardShader
- : public FragmentShader
+ : public Shader
{
public:
typedef StandardShader Self;
- typedef FragmentShader Superclass;
+ typedef Shader Superclass;
typedef itk::SmartPointer Pointer;
typedef itk::SmartPointer ConstPointer;
@@ -99,7 +99,9 @@ protected:
~StandardShader() override;
- std::string GetSource() const override;
+ std::string GetVertexSource() const override;
+
+ std::string GetFragmentSource() const override;
std::string GetName() const override;
@@ -124,6 +126,31 @@ private:
bool m_VerticalSlider;
ShaderType m_ShaderType;
+
+ bool m_HasGLSL140;
+
+ struct UniformLocs
+ {
+ int proj;
+ int modelview;
+ int a;
+ int b;
+ int use_no_data;
+ int no_data;
+ int gamma;
+ int alpha;
+ int radius;
+ int center;
+ int type;
+ int current;
+ int localc_range;
+ int spectral_angle_range;
+ int chessboard_size;
+ int slider_pos;
+ int vertical_slider_flag;
+ };
+
+ UniformLocs m_Loc;
}; // End class StandardShader
} // End namespace otb
diff --git a/Modules/Visualization/Ice/src/CMakeLists.txt b/Modules/Visualization/Ice/src/CMakeLists.txt
index c9740fa840cb99ebf411a32633bd32a62d1a8666..3a1d4abe40eebac8ab4d0d642203c571f37f35b9 100644
--- a/Modules/Visualization/Ice/src/CMakeLists.txt
+++ b/Modules/Visualization/Ice/src/CMakeLists.txt
@@ -19,16 +19,21 @@
#
set(OTBICE_SRCS
- otbFragmentShader.cxx
- otbFragmentShaderRegistry.cxx
otbGeoInterface.cxx
otbGlActor.cxx
+ otbGlError.cxx
otbGlImageActor.cxx
+ otbGlMesh.cxx
otbGlROIActor.cxx
+ otbGlView.cxx
otbGlVectorActor.cxx
otbGlVersionChecker.cxx
- otbGlView.cxx
+ otbGlVersionChecker.cxx
+ otbGlVertexArrayObject.cxx
otbImageSettings.cxx
+ otbMinimalShader.cxx
+ otbShader.cxx
+ otbShaderRegistry.cxx
otbStandardShader.cxx
otbViewSettings.cxx
)
diff --git a/Modules/Visualization/Ice/src/otbFragmentShader.cxx b/Modules/Visualization/Ice/src/otbFragmentShader.cxx
deleted file mode 100644
index d7e105378f00ed94d2d87a0b103dcd96d4cf5920..0000000000000000000000000000000000000000
--- a/Modules/Visualization/Ice/src/otbFragmentShader.cxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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 "otbFragmentShader.h"
-#include "otbFragmentShaderRegistry.h"
-
-namespace otb
-{
-FragmentShader::FragmentShader()
-{}
-
-FragmentShader::~FragmentShader()
-{}
-
-void FragmentShader::BuildShader()
-{
- std::string source = this->GetSource();
- std::string name = this->GetName();
-
- try
- {
- // Assumption here is that each shader has its unique name
- if(!otb::FragmentShaderRegistry::Instance()->IsShaderRegistered(name))
- {
- otb::FragmentShaderRegistry::Instance()->RegisterShader(name,source);
- }
- }
- catch(itk::ExceptionObject& err)
- {
- // Log compilation errors if any
- std::cerr<LoadShader(GetName());
-}
-
-void FragmentShader::UnloadShader()
-{
- otb::FragmentShaderRegistry::Instance()->UnloadShader();
-}
-
-void FragmentShader::SetupShader()
-{
- // // Default always report corners
- // GLint shader_ul = glGetUniformLocation(otb::FragmentShaderRegistry::Instance()->GetShaderProgram("StandardShader"), "shader_ul");
-
- // glUniform2f(shader_ul,m_UL[0],m_UL[1]);
- // GLint shader_ur = glGetUniformLocation(otb::FragmentShaderRegistry::Instance()->GetShaderProgram("StandardShader"), "shader_ur");
- // glUniform2f(shader_ur,m_UR[0],m_UR[1]);
-
- // GLint shader_ll = glGetUniformLocation(otb::FragmentShaderRegistry::Instance()->GetShaderProgram("StandardShader"), "shader_ll");
- // glUniform2f(shader_ll,m_LL[0],m_LL[1]);
-
- // GLint shader_lr = glGetUniformLocation(otb::FragmentShaderRegistry::Instance()->GetShaderProgram("StandardShader"), "shader_lr");
- // glUniform2f(shader_lr,m_LR[0],m_LR[1]);
-}
-
-}
diff --git a/Modules/Visualization/Ice/src/otbGlActor.cxx b/Modules/Visualization/Ice/src/otbGlActor.cxx
index c91ad6d17d481ab9eceb34026e4ecbdda7a84bbb..f7ee8c419d8c9f2475a6b8fbe7bea994db687651 100644
--- a/Modules/Visualization/Ice/src/otbGlActor.cxx
+++ b/Modules/Visualization/Ice/src/otbGlActor.cxx
@@ -23,14 +23,19 @@
namespace otb
{
GlActor::GlActor()
- : m_Settings(ViewSettings::New()),
- m_Name("Actor"),
- m_Visible(true),
- m_GeometryChanged( false ),
- m_Overlay( false )
+ : m_Shader()
+ , m_Settings(ViewSettings::New())
+ , m_Name("Actor")
+ , m_Visible(true)
+ , m_GeometryChanged( false )
+ , m_Overlay( false )
{}
GlActor::~GlActor()
{}
+void
+GlActor::CreateShader()
+{}
+
} // End namespace 'otb'.
diff --git a/Modules/Visualization/Ice/src/otbGlError.cxx b/Modules/Visualization/Ice/src/otbGlError.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..44c7bfdc5a24f4cd27f8c0fd6492d697052f93e6
--- /dev/null
+++ b/Modules/Visualization/Ice/src/otbGlError.cxx
@@ -0,0 +1,52 @@
+/*
+ * 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 "otbGlError.h"
+
+#include
+
+
+// This
+namespace otb
+{
+
+namespace gl
+{
+
+Error
+::Error( GLenum code ) :
+ std::runtime_error(
+ [ code ]()
+ {
+ std::ostringstream oss;
+
+ oss << "OpenGL error #" << code << ": '" << gluErrorString( code ) << "'";
+
+ return std::move( oss.str() );
+ }()
+ )
+{
+}
+
+
+} // End namespace 'gl'.
+
+
+} // End namespace 'otb'.
diff --git a/Modules/Visualization/Ice/src/otbGlImageActor.cxx b/Modules/Visualization/Ice/src/otbGlImageActor.cxx
index 1a61ab0062e8745c104dbfb0372a2523c01f6909..179343db26c72980f6f9f1695b6c03af344ac4b4 100644
--- a/Modules/Visualization/Ice/src/otbGlImageActor.cxx
+++ b/Modules/Visualization/Ice/src/otbGlImageActor.cxx
@@ -21,19 +21,132 @@
#include "otbGlImageActor.h"
#include "otbViewSettings.h"
#include "otbMath.h"
+
#ifdef _WIN32
-#include
+# include
#endif
+
#include
+#include "otbGlMesh.h"
+
#include "otbStandardShader.h"
#include "itkListSample.h"
#include "otbListSampleToHistogramListGenerator.h"
+#include "otbCast.h"
+
+#include
namespace otb
{
+GlImageActor::Tile
+::Tile()
+ : m_Loaded(false)
+ , m_TextureId(0)
+ , m_ImageRegion()
+ , m_TileSize(0)
+ , m_UL()
+ , m_UR()
+ , m_LL()
+ , m_LR()
+ , m_Resolution(1)
+ , m_RedIdx(1)
+ , m_GreenIdx(2)
+ , m_BlueIdx(3)
+ , m_RescaleFilter(nullptr)
+{
+ m_UL.Fill(0);
+ m_UR.Fill(0);
+ m_LL.Fill(0);
+ m_LR.Fill(0);
+}
+
+GlImageActor::Tile
+::~Tile()
+{}
+
+
+void
+GlImageActor::Tile
+::Acquire() noexcept
+{
+ // Now load the texture
+ assert( m_TextureId==0 );
+
+ glGenTextures( 1, &m_TextureId );
+
+ // Following assert is sometimes false on some OpenGL systems for
+ // some unknown reason even though the glGenTexture() call has
+ // succeeded.
+ // assert( glGetError()==GL_NO_ERROR );
+
+ assert( m_TextureId!=0 );
+
+ // std::cout << "Generated texture #" << m_TextureId << std::endl;
+
+ glBindTexture( GL_TEXTURE_2D, m_TextureId );
+
+#if defined( GL_TEXTURE_BASE_LEVEL ) && defined( GL_TEXTURE_MAX_LEVEL )
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0 );
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0 );
+#endif
+
+#if 0
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+#endif
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,GL_MIRRORED_REPEAT);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,GL_MIRRORED_REPEAT);
+}
+
+
+void
+GlImageActor::Tile
+::Release()
+{
+ assert( m_TextureId );
+
+ glDeleteTextures( 1, &m_TextureId );
+
+ // std::cout << "Deleted texture #" << m_TextureId << std::endl;
+
+ m_TextureId = GL_ZERO;
+ m_Image = VectorImageType::Pointer();
+ m_RescaleFilter = RescaleFilterType::Pointer();
+ m_Loaded = false;
+}
+
+
+void
+GlImageActor::Tile
+::Link( GlImageActor::ReaderType::OutputImageType * i )
+{
+ assert( i );
+
+ assert( !m_Loaded );
+ assert( m_Image.IsNull() );
+
+ auto extract = ExtractROIFilterType::New();
+
+ assert( extract );
+
+ extract->SetInput( i );
+
+ extract->SetExtractionRegion( m_ImageRegion );
+
+ extract->SetChannel( m_RedIdx );
+ extract->SetChannel( m_GreenIdx );
+ extract->SetChannel( m_BlueIdx );
+
+ extract->Update();
+
+ m_Image = extract->GetOutput();
+}
+
+
GlImageActor::GlImageActor()
: m_TileSize(256),
m_FileName(),
@@ -48,13 +161,12 @@ GlImageActor::GlImageActor()
m_Spacing(),
m_NumberOfComponents(0),
m_ImageSettings( ImageSettings::New() ),
- m_Shader(),
m_ViewportToImageTransform(),
m_ImageToViewportTransform(),
m_ViewportForwardRotationTransform(RigidTransformType::New()),
m_ViewportBackwardRotationTransform(RigidTransformType::New()),
m_ResolutionAlgorithm(ResolutionAlgorithm::Nearest),
- m_SoftwareRendering(false)
+ m_Mesh()
{}
GlImageActor
@@ -69,14 +181,29 @@ GlImageActor
m_LoadedTiles.clear();
}
+
void
GlImageActor
::CreateShader()
{
+ assert( m_Shader.IsNull() );
+
StandardShader::Pointer shader( StandardShader::New() );
shader->SetImageSettings( m_ImageSettings );
+ // Check previous OpenGL error and clear error flag.
+ gl::CheckError< gl::error::clear >();
+
+ m_Mesh = std::make_unique< gl::Mesh >(
+ gl::MakeTexturedQuad(
+ shader->GetAttribIdx()[ 0 ],
+ shader->GetAttribIdx()[ 1 ]
+ )
+ );
+
+ // Should be done last in order to ensure exception-safety of
+ // invariant.
m_Shader = shader;
}
@@ -159,23 +286,8 @@ void GlImageActor::Initialize(const std::string & filename)
unsigned int ovrCount = m_FileReader->GetOverviewsCount();
- // std::cout << "overview-count: " << ovrCount << std::endl;
-
assert( ovrCount>0 );
- // {
- // typedef std::vector< std::string > StringVector;
-
- // StringVector info(
- // m_FileReader->GetOverviewsInfo()
- // );
-
- // for( StringVector::const_iterator it( info.begin() );
- // it!=info.end();
- // ++it )
- // std::cout << *it << std::endl;
- // }
-
m_AvailableResolutions.clear();
for( unsigned int i=0; iSetParameters(rigidParameters);
rigidParameters[0]=-settings->GetRotationAngle();
-
+
m_ViewportBackwardRotationTransform->SetParameters(rigidParameters);
-
+
UpdateTransforms();
-
+
for (TileVectorType::iterator it = m_LoadedTiles.begin();
it!=m_LoadedTiles.end();
++it)
@@ -239,7 +349,7 @@ void GlImageActor::UpdateData()
ViewSettings::ConstPointer settings = GetSettings();
RegionType largest( m_FileReader->GetOutput()->GetLargestPossibleRegion() );
-
+
double ulx, uly, lrx, lry;
settings->GetViewportExtent(ulx,uly,lrx,lry);
@@ -252,7 +362,7 @@ void GlImageActor::UpdateData()
if( !requested.Crop( largest ) )
return;
-
+
// Now we have the requested part of image, we need to find the
// corresponding tiles
@@ -262,22 +372,21 @@ void GlImageActor::UpdateData()
//unsigned int nbTilesY = std::ceil(static_cast(requested.GetSize()[1])/m_TileSize);
unsigned int tileStartX = m_TileSize*(requested.GetIndex()[0]/m_TileSize);
unsigned int tileStartY = m_TileSize*(requested.GetIndex()[1]/m_TileSize);
-
+
SizeType tileSize;
tileSize.Fill(m_TileSize);
- Tile newTile;
-
+
for(unsigned int i = 0; i < nbTilesX; ++i)
{
for(unsigned int j = 0; j(tileStartX+i*m_TileSize);
tileIndex[1] = static_cast(tileStartY+j*m_TileSize);
-
+
newTile.m_ImageRegion.SetSize(tileSize);
newTile.m_ImageRegion.SetIndex(tileIndex);
@@ -323,30 +432,33 @@ void GlImageActor::Render()
// std::cout
// << "otb::GlImageActor@" << std::hex << this << std::dec << std::endl
// << "\tresolution: " << m_ResolutionAlgorithm << std::endl
- // << "\tpixel: " << m_SoftwareRendering << std::endl
// << "\ttile: " << m_TileSize << std::endl;
- if( !m_SoftwareRendering && !m_Shader.IsNull() )
- {
- // std::cout << "\tGLSL" << std::endl;
+ bool isShaderMode = !m_Shader.IsNull();
+ if( isShaderMode )
+ {
m_Shader->LoadShader();
m_Shader->SetupShader();
- }
- else
- {
- // std::cout << "\tOTB" << std::endl;
+ // Check OpenGL error and clear error flag.
+ gl::CheckError< gl::error::clear >();
+
+ assert( m_Mesh );
+ m_Mesh->Bind();
+ }
+ else
+ {
for(TileVectorType::iterator it = m_LoadedTiles.begin();
it != m_LoadedTiles.end(); ++it)
- {
+ {
if(!it->m_RescaleFilter)
- {
+ {
it->m_RescaleFilter = RescaleFilterType::New();
it->m_RescaleFilter->AutomaticInputMinMaxComputationOff();
- it->m_RescaleFilter->SetInput(it->m_Image);
- }
-
+ it->m_RescaleFilter->SetInput(it->Image());
+ }
+
VectorImageType::PixelType mins(3),maxs(3),omins(3),omaxs(3);
mins.Fill(0);
maxs.Fill(255);
@@ -358,135 +470,138 @@ void GlImageActor::Render()
mins[ 0 ] = m_ImageSettings->GetMinRed();
mins[ 1 ] = m_ImageSettings->GetMinGreen();
mins[ 2 ] = m_ImageSettings->GetMinBlue();
-
+
maxs[ 0 ] = m_ImageSettings->GetMaxRed();
maxs[ 1 ] = m_ImageSettings->GetMaxGreen();
- maxs[ 2 ] = m_ImageSettings->GetMaxBlue();
+ maxs[ 2 ] = m_ImageSettings->GetMaxBlue();
// MANTIS-1204
// {
double gamma = m_ImageSettings->GetGamma();
gamma =
- gamma == 0.0
+ gamma == 0.0
? std::numeric_limits< double >::max()
: 1.0 / gamma;
// }
-
-
+
+
if( m_ImageSettings->GetUseNoData() )
noData = m_ImageSettings->GetNoData();
-
+
omins.Fill( 0 );
omaxs.Fill( 255 );
-
+
it->m_RescaleFilter->SetInputMinimum(mins);
it->m_RescaleFilter->SetInputMaximum(maxs);
it->m_RescaleFilter->SetOutputMinimum(omins);
it->m_RescaleFilter->SetOutputMaximum(omaxs);
it->m_RescaleFilter->SetGamma(gamma);
-
+
it->m_RescaleFilter->Update();
itk::ImageRegionConstIterator imIt(it->m_RescaleFilter->GetOutput(),it->m_RescaleFilter->GetOutput()->GetLargestPossibleRegion());
- itk::ImageRegionConstIterator inIt(it->m_Image,it->m_Image->GetLargestPossibleRegion());
+ itk::ImageRegionConstIterator inIt(it->Image(),it->Image()->GetLargestPossibleRegion());
+
+ auto buffer =
+ std::make_unique< GLubyte[] >(
+ 4 * it->m_RescaleFilter->GetOutput()->GetLargestPossibleRegion().GetNumberOfPixels()
+ );
-
-
- unsigned char * buffer = new unsigned char[4*it->m_RescaleFilter->GetOutput()->GetLargestPossibleRegion().GetNumberOfPixels()];
-
unsigned int idx = 0;
-
+
for(imIt.GoToBegin(),inIt.GoToBegin();!imIt.IsAtEnd()&&!inIt.IsAtEnd();++imIt,++inIt)
- {
- buffer[idx] = static_cast(imIt.Get()[2]);
- ++idx;
- buffer[idx] = static_cast(imIt.Get()[1]);
- ++idx;
- buffer[idx] = static_cast(imIt.Get()[0]);
- ++idx;
- buffer[idx] = 255;
-
- if(m_ImageSettings->GetUseNoData() && (inIt.Get()[0] == noData ||inIt.Get()[1] == noData ||inIt.Get()[2] == noData))
- {
- buffer[idx] = 0;
- }
-
- ++idx;
- }
+ {
+ buffer[ idx++ ] = static_cast< GLubyte >(imIt.Get()[2]);
+ buffer[ idx++ ] = static_cast< GLubyte >(imIt.Get()[1]);
+ buffer[ idx++ ] = static_cast< GLubyte >(imIt.Get()[0]);
+ buffer[ idx++ ] =
+ ( m_ImageSettings->GetUseNoData() &&
+ ( inIt.Get()[ 0 ] == noData ||
+ inIt.Get()[ 1 ] == noData ||
+ inIt.Get()[ 2 ] == noData ) )
+ ? 0
+ : 255;
+ }
+
+ assert( it->m_TextureId );
- if(!it->m_TextureId)
- {
- glGenTextures(1, &(it->m_TextureId));
- }
glBindTexture(GL_TEXTURE_2D, it->m_TextureId);
-#if defined(GL_TEXTURE_BASE_LEVEL) && defined(GL_TEXTURE_MAX_LEVEL)
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
-#endif
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- //glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
-// #if defined(GL_CLAMP_TO_BORDER)
-// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,GL_CLAMP_TO_BORDER);
-// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,GL_CLAMP_TO_BORDER);
-// #elif defined (GL_CLAMP_TO_BORDER_EXT)
-// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,GL_CLAMP_TO_BORDER_EXT);
-// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,GL_CLAMP_TO_BORDER_EXT);
-// #elif defined (GL_MIRRORED_REPEAT)
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,GL_MIRRORED_REPEAT);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,GL_MIRRORED_REPEAT);
-// #endif
+
glTexImage2D(
GL_TEXTURE_2D, 0, GL_RGBA8,
it->m_RescaleFilter->GetOutput()->GetLargestPossibleRegion().GetSize()[0],
- it->m_RescaleFilter->GetOutput()->GetLargestPossibleRegion().GetSize()[1],
+ it->m_RescaleFilter->GetOutput()->GetLargestPossibleRegion().GetSize()[1],
0, GL_BGRA, GL_UNSIGNED_BYTE,
- buffer);
+ buffer.get()
+ );
it->m_Loaded = true;
-
- delete [] buffer;
- }
}
+ }
for(TileVectorType::iterator it = m_LoadedTiles.begin();
it != m_LoadedTiles.end(); ++it)
- {
-
+ {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
-
- glEnable(GL_TEXTURE_2D);
+
+ glEnable( GL_TEXTURE_2D );
glBindTexture(GL_TEXTURE_2D,it->m_TextureId);
-
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- if(m_CurrentResolution == 0)
- {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- }
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+
+ glTexParameteri(
+ GL_TEXTURE_2D,
+ GL_TEXTURE_MAG_FILTER,
+ m_CurrentResolution ? GL_LINEAR : GL_NEAREST
+ );
+
+ if( isShaderMode )
+ {
+ GLfloat vertexPosition[ 8 ] = {
+ -1.0f, -1.0f,
+ 1.0f, -1.0f,
+ 1.0f, 1.0f,
+ -1.0f, 1.0f
+ };
+
+ vertexPosition[0] = it->m_LL[0];
+ vertexPosition[1] = it->m_LL[1];
+ vertexPosition[2] = it->m_LR[0];
+ vertexPosition[3] = it->m_LR[1];
+ vertexPosition[4] = it->m_UR[0];
+ vertexPosition[5] = it->m_UR[1];
+ vertexPosition[6] = it->m_UL[0];
+ vertexPosition[7] = it->m_UL[1];
+
+ glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertexPosition), vertexPosition);
+
+ glDrawElements( GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
+ }
else
+ {
+ // Compatibility mode
+ // Reset color before rendering
+ glColor4d( 1.0f, 1.0f, 1.0f, m_ImageSettings->GetAlpha() );
+
+ glBegin( GL_QUADS );
{
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexCoord2f( 0.0, 1.0 ); glVertex2f( it->m_LL[ 0 ], it->m_LL[ 1 ] );
+ glTexCoord2f( 1.0, 1.0 ); glVertex2f( it->m_LR[ 0 ], it->m_LR[ 1 ] );
+ glTexCoord2f( 1.0, 0.0 ); glVertex2f( it->m_UR[ 0 ], it->m_UR[ 1 ] );
+ glTexCoord2f( 0.0, 0.0 ); glVertex2f( it->m_UL[ 0 ], it->m_UL[ 1 ] );
}
-
- // Reset color before rendering
- glColor4d(1.0f,1.0f,1.0f, m_ImageSettings->GetAlpha());
-
- glBegin (GL_QUADS);
- glTexCoord2f (0.0, 1.0); glVertex2f(it->m_LL[0], it->m_LL[1]);
- glTexCoord2f (1.0, 1.0); glVertex2f(it->m_LR[0], it->m_LR[1]);
- glTexCoord2f (1.0, 0.0); glVertex2f(it->m_UR[0], it->m_UR[1]);
- glTexCoord2f (0.0, 0.0); glVertex2f(it->m_UL[0], it->m_UL[1]);
- glEnd ();
-
- glDisable(GL_TEXTURE_2D);
- glDisable(GL_BLEND);
+ glEnd ();
}
- if( !m_SoftwareRendering && !m_Shader.IsNull() )
+ glDisable( GL_TEXTURE_2D );
+ glDisable( GL_BLEND );
+ }
+
+ if( isShaderMode )
{
m_Shader->UnloadShader();
}
@@ -494,43 +609,29 @@ void GlImageActor::Render()
void GlImageActor::LoadTile(Tile& tile)
{
- // std::cout
- // << std::hex << this
- // << "::LoadTile(" << &tile << ")"
- // << std::dec << std::endl;
+ assert( !m_FileReader.IsNull() );
- // std::cout
- // << "[ " << tile.m_ImageRegion.GetIndex()[ 0 ]
- // << ", " << tile.m_ImageRegion.GetIndex()[ 1 ]
- // << " ]-[ " << tile.m_ImageRegion.GetSize()[ 0 ]
- // << ", " << tile.m_ImageRegion.GetSize()[ 1 ]
- // << "]"
- // << std::endl;
-
- ExtractROIFilterType::Pointer extract = ExtractROIFilterType::New();
-
- extract->SetInput(m_FileReader->GetOutput());
- extract->SetExtractionRegion(tile.m_ImageRegion);
- extract->SetChannel(tile.m_RedIdx);
- extract->SetChannel(tile.m_GreenIdx);
- extract->SetChannel(tile.m_BlueIdx);
-
- // std::cout << "ExtractROIFilter::Update()...";
- extract->Update();
- // std::cout << "\tDONE\n";
+ tile.Link( m_FileReader->GetOutput() );
- tile.m_Image = extract->GetOutput();
+ assert( tile.Image() );
+
+ if(!m_Shader.IsNull())
+ {
+ itk::ImageRegionConstIterator< VectorImageType > it(
+ tile.Image(),
+ tile.Image()->GetLargestPossibleRegion());
+
+ auto buffer =
+ std::make_unique< float[] >(
+ 4 * tile.Image()->GetLargestPossibleRegion().GetNumberOfPixels()
+ );
+
+ assert( buffer );
- if(!m_SoftwareRendering)
- {
- itk::ImageRegionConstIterator it(extract->GetOutput(),extract->GetOutput()->GetLargestPossibleRegion());
-
- float * buffer = new float[4*extract->GetOutput()->GetLargestPossibleRegion().GetNumberOfPixels()];
-
unsigned int idx = 0;
-
+
for(it.GoToBegin();!it.IsAtEnd();++it)
- {
+ {
buffer[idx] = static_cast(it.Get()[2]);
++idx;
buffer[idx] = static_cast(it.Get()[1]);
@@ -539,74 +640,35 @@ void GlImageActor::LoadTile(Tile& tile)
++idx;
buffer[idx] = 255.;
++idx;
- }
-
- // Now load the texture
- assert( tile.m_TextureId==0 );
-
- glGenTextures( 1, &tile.m_TextureId );
-
- // Following assert is sometimes false on some OpenGL systems for
- // some unknown reason even though the glGenTexture() call has
- // succeeded.
- // assert( glGetError()==GL_NO_ERROR );
+ }
- assert( tile.m_TextureId!=0 );
- // std::cout << "Generated texture #" << tile.m_TextureId << std::endl;
+ tile.Acquire();
- glBindTexture(GL_TEXTURE_2D, tile.m_TextureId);
-#if defined(GL_TEXTURE_BASE_LEVEL) && defined(GL_TEXTURE_MAX_LEVEL)
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
-#endif
- //glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
-// #if defined(GL_CLAMP_TO_BORDER)
-// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,GL_CLAMP_TO_BORDER);
-// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,GL_CLAMP_TO_BORDER);
-// #elif defined (GL_CLAMP_TO_BORDER_EXT)
-// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,GL_CLAMP_TO_BORDER_EXT);
-// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,GL_CLAMP_TO_BORDER_EXT);
-// #elif defined (GL_MIRRORED_REPEAT)
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,GL_MIRRORED_REPEAT);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,GL_MIRRORED_REPEAT);
-// #endif
glTexImage2D(
GL_TEXTURE_2D, 0, GL_RGB32F,
- extract->GetOutput()->GetLargestPossibleRegion().GetSize()[0],
- extract->GetOutput()->GetLargestPossibleRegion().GetSize()[1],
+ tile.Image()->GetLargestPossibleRegion().GetSize()[ 0 ],
+ tile.Image()->GetLargestPossibleRegion().GetSize()[ 1 ],
0, GL_BGRA, GL_FLOAT,
- buffer);
-
+ buffer.get()
+ );
+
tile.m_Loaded = true;
-
- delete [] buffer;
- }
-
- // And push to loaded texture
- m_LoadedTiles.push_back(tile);
+ }
+ else
+ {
+ tile.Acquire();
+ }
+
+ // And push to loaded texture
+ m_LoadedTiles.push_back( tile );
}
-
+
void GlImageActor::UnloadTile(Tile& tile)
{
// std::cout << std::hex << this << std::dec << "::UnloadTile()" << std::endl;
- if( tile.m_Loaded )
- {
- assert( tile.m_TextureId>0 );
-
- glDeleteTextures( 1, &tile.m_TextureId );
-
- // std::cout << "Deleted texture #" << tile.m_TextureId << std::endl;
-
- tile.m_TextureId = 0;
-
- tile.m_Image = VectorImageType::Pointer();
-
- tile.m_RescaleFilter = RescaleFilterType::Pointer();
-
- tile.m_Loaded = false;
- }
+ tile.Release();
}
void GlImageActor::CleanLoadedTiles()
@@ -615,17 +677,18 @@ void GlImageActor::CleanLoadedTiles()
// Retrieve settings
ViewSettings::ConstPointer settings = this->GetSettings();
-
+
double ulx, uly, lrx, lry;
settings->GetViewportExtent(ulx,uly,lrx,lry);
-
+
RegionType requested;
-
- this->ViewportExtentToImageRegion(ulx,uly,lrx,lry,requested);
- for(TileVectorType::iterator it = m_LoadedTiles.begin();
- it!=m_LoadedTiles.end();++it)
+ ViewportExtentToImageRegion( ulx, uly, lrx, lry, requested );
+
+ for( TileVectorType::iterator it = m_LoadedTiles.begin();
+ it!=m_LoadedTiles.end();
+ ++it )
{
RegionType tileRegion = it->m_ImageRegion;
@@ -639,8 +702,8 @@ void GlImageActor::CleanLoadedTiles()
// size might be smaller at images borders
|| it->m_TileSize!=m_TileSize)
{
-
-
+
+
// Tile will not be used anymore, unload it from GPU
UnloadTile(*it);
}
@@ -653,8 +716,6 @@ void GlImageActor::CleanLoadedTiles()
// std::cout<<"GPU memory cleanup: removing "<GetSettings();
-
+
itk::ContinuousIndex cul,cur,cll,clr;
-
+
cul[0] = region.GetIndex()[0];
cul[1] = region.GetIndex()[1];
cur = cul;
@@ -715,7 +776,7 @@ void GlImageActor::ImageRegionToViewportQuad(const RegionType & region, PointTyp
ill[1]+=0.5*spacing[1];
ilr[0]+=0.5*spacing[0];
ilr[1]+=0.5*spacing[1];
-
+
PointType pul = m_ImageToViewportTransform->TransformPoint(iul);
PointType pur = m_ImageToViewportTransform->TransformPoint(iur);
PointType pll = m_ImageToViewportTransform->TransformPoint(ill);
@@ -728,7 +789,7 @@ void GlImageActor::ImageRegionToViewportQuad(const RegionType & region, PointTyp
pll = m_ViewportBackwardRotationTransform->TransformPoint(pll);
plr = m_ViewportBackwardRotationTransform->TransformPoint(plr);
}
-
+
ul[0] = pul[0];
ul[1] = pul[1];
ur[0] = pur[0];
@@ -747,7 +808,7 @@ void GlImageActor::ViewportExtentToImageRegion(const double& ulx, const double &
RegionType largest = m_FileReader->GetOutput()->GetLargestPossibleRegion();
PointType ul,ur,ll,lr,tul,tur,tll,tlr;
-
+
ul[0]=ulx;
ul[1]=uly;
ur[0]=lrx;
@@ -756,7 +817,7 @@ void GlImageActor::ViewportExtentToImageRegion(const double& ulx, const double &
ll[1]=lry;
lr[0]=lrx;
lr[1]=lry;
-
+
tul = m_ViewportToImageTransform->TransformPoint(m_ViewportForwardRotationTransform->TransformPoint(ul));
tur = m_ViewportToImageTransform->TransformPoint(m_ViewportForwardRotationTransform->TransformPoint(ur));
tll = m_ViewportToImageTransform->TransformPoint(m_ViewportForwardRotationTransform->TransformPoint(ll));
@@ -768,7 +829,7 @@ void GlImageActor::ViewportExtentToImageRegion(const double& ulx, const double &
m_FileReader->GetOutput()->TransformPhysicalPointToContinuousIndex(tur,cur);
m_FileReader->GetOutput()->TransformPhysicalPointToContinuousIndex(tll,cll);
m_FileReader->GetOutput()->TransformPhysicalPointToContinuousIndex(tlr,clr);
-
+
// TODO: Take into account origin/scaling/rotation here ?
// TODO: Screen to image / image to screen transform calls here ?
@@ -777,21 +838,21 @@ void GlImageActor::ViewportExtentToImageRegion(const double& ulx, const double &
iulx = std::max(std::min(std::min(cul[0],cur[0]),std::min(cll[0],clr[0])),0.);
iuly = std::max(std::min(std::min(cul[1],cur[1]),std::min(cll[1],clr[1])),0.);
ilrx = std::min(std::max(std::max(cul[0],cur[0]),std::max(cll[0],clr[0])),static_cast(largest.GetSize()[0]));
- ilry = std::min(std::max(std::max(cul[1],cur[1]),std::max(cll[1],clr[1])),static_cast(largest.GetSize()[1]));
+ ilry = std::min(std::max(std::max(cul[1],cur[1]),std::max(cll[1],clr[1])),static_cast(largest.GetSize()[1]));
// Now we have the requested part of image, we need to find the
// corresponding tiles
IndexType index;
index[0] = static_cast(iulx);
index[1] = static_cast(iuly);
-
+
SizeType size;
size[0] = static_cast(ilrx-iulx);
size[1] = static_cast(ilry-iuly);
-
+
region.SetSize(size);
region.SetIndex(index);
-
+
region.Crop(m_FileReader->GetOutput()->GetLargestPossibleRegion());
}
@@ -821,7 +882,7 @@ GlImageActor::PointType GlImageActor::ImageToViewportTransform(const PointType &
}
PointType out = m_ImageToViewportTransform->TransformPoint(imgPoint);
-
+
return m_ViewportBackwardRotationTransform->TransformPoint(out);
}
@@ -830,7 +891,7 @@ GlImageActor::PointType GlImageActor::ImageToViewportTransform(const PointType &
bool
GlImageActor
::GetPixelFromViewport( const PointType & in,
- PixelType & pixel ) const
+ PixelType & pixel ) const
{
PointType p;
IndexType i;
@@ -842,9 +903,9 @@ GlImageActor
bool
GlImageActor
::GetPixelFromViewport( const PointType & ptView,
- PixelType & pixel,
- PointType & ptPhysical,
- IndexType & index ) const
+ PixelType & pixel,
+ PointType & ptPhysical,
+ IndexType & index ) const
{
ptPhysical = ViewportToImageTransform( ptView );
@@ -855,28 +916,13 @@ GlImageActor
bool
GlImageActor
::GetPixel( const PointType & physical,
- PixelType & pixel,
- IndexType & index ) const
+ PixelType & pixel,
+ IndexType & index ) const
{
-
- // std::cout << std::endl;
-
- // std::cout << "O: (" << m_Origin[ 0 ] << ", " << m_Origin[ 1 ] << ")";
- // std::cout << "\tS: (" << m_Spacing[ 1 ] << ", " << m_Spacing[ 1 ] << ")";
- // std::cout << std::endl;
-
- // std::cout << "P: (" << physical[ 0 ] << ", " << physical[ 1 ] << ")";
- // std::cout << std::endl;
-
// First, we need to return index in full img (not in overviews)
-#if 0
- index[ 0 ] = static_cast((physical[0]-m_Origin[0])/m_Spacing[0]);
- index[ 1 ] = static_cast((physical[1]-m_Origin[1])/m_Spacing[1]);
-
-#else
index[ 0 ] =
static_cast< IndexType::IndexValueType >(
- ( physical[ 0 ] + 0.5 * m_Spacing[0] - m_Origin[ 0 ] ) /
+ ( physical[ 0 ] + 0.5 * m_Spacing[0] - m_Origin[ 0 ] ) /
m_Spacing[ 0 ]
);
@@ -886,40 +932,15 @@ GlImageActor
m_Spacing[ 1 ]
);
-#endif
-
- // std::cout << "I: (" << index[ 0 ] << ", " << index[ 1 ] << ")";
- // std::cout
- // << "\tI: ("
- // << ( ( physical[ 0 ] - m_Origin[ 0 ] ) / m_Spacing[ 0 ] )
- // << ", "
- // << ( ( physical[ 1 ] - m_Origin[ 1 ] ) / m_Spacing[ 1 ] )
- // << ")";
- // std::cout << std::endl;
-
// Then, we need to find the index in the currently loaded overview
IndexType ovrIndex;
m_FileReader->GetOutput()->TransformPhysicalPointToIndex( physical, ovrIndex );
- // std::cout << "O: (" << ovrIndex[ 0 ] << ", " << ovrIndex[ 1 ] << ")";
- // std::cout << std::endl;
-
// And look it up in loaded tiles
for (TileVectorType::const_iterator it = m_LoadedTiles.begin();
it!=m_LoadedTiles.end();
++it)
{
- // std::cout
- // << "R: ("
- // << it->m_ImageRegion.GetIndex()[ 0 ]
- // << ", "
- // << it->m_ImageRegion.GetIndex()[ 1 ]
- // << ")-("
- // << it->m_ImageRegion.GetSize()[ 0 ]
- // << ", "
- // << it->m_ImageRegion.GetSize()[ 1 ]
- // << ")";
-
if(it->m_ImageRegion.IsInside(ovrIndex))
{
IndexType idx;
@@ -927,21 +948,16 @@ GlImageActor
idx[ 0 ] = ovrIndex[ 0 ] - it->m_ImageRegion.GetIndex()[ 0 ];
idx[ 1 ] = ovrIndex[ 1 ] - it->m_ImageRegion.GetIndex()[ 1 ];
- // std::cout << "\tIr: (" << idx[ 0 ] << ", " << idx[ 1 ] << ")";
-
- pixel = it->m_Image->GetPixel( idx );
+ pixel = it->Image()->GetPixel( idx );
return true;
}
-
- // std::cout << std::endl;
}
return false;
}
-
void GlImageActor::UpdateResolution()
{
// Retrieve settings
@@ -949,14 +965,14 @@ void GlImageActor::UpdateResolution()
// Retrieve viewport spacing
ViewSettings::SpacingType spacing = settings->GetSpacing();
-
+
// 100 screen pixels
PointType pointA, pointB, pointC;
pointA = settings->GetOrigin();
pointB = pointA;
pointC = pointA;
-
+
pointB[0]+=100*spacing[0];
pointC[1]+=100*spacing[1];
@@ -978,10 +994,9 @@ void GlImageActor::UpdateResolution()
double distAB = std::sqrt((pointA[0]-pointB[0])*(pointA[0]-pointB[0])+(pointA[1]-pointB[1])*(pointA[1]-pointB[1]));
double distAC = std::sqrt((pointA[0]-pointC[0])*(pointA[0]-pointC[0])+(pointA[1]-pointC[1])*(pointA[1]-pointC[1]));
-
+
double resolution = std::min(100/distAB,100/distAC);
- // std::cout << std::endl;
// std::cout << "resolution: " << resolution << std::endl;
// Arbitrary higher than any distance we will compute here
@@ -999,29 +1014,29 @@ void GlImageActor::UpdateResolution()
// Compute the diff and keep the index that minimize the distance
for (ResolutionVectorType::iterator it = m_AvailableResolutions.begin();
- it != m_AvailableResolutions.end(); ++it)
+ it != m_AvailableResolutions.end(); ++it)
{
double diff = 1/((double)(1<<(*it))) - resolution;
// std::cout << "diff: " << diff << std::endl;
if( ( ( m_ResolutionAlgorithm == ResolutionAlgorithm::Nearest_Lower &&
- diff <= 0 )
- ||
- ( m_ResolutionAlgorithm == ResolutionAlgorithm::Nearest_Upper &&
- diff >= 0 )
- ||
- ( m_ResolutionAlgorithm == ResolutionAlgorithm::Nearest ) )
- &&
- std::abs(diff) < minDist )
- {
- isFound = true;
-
- minDist = std::abs(diff);
- newResolution = std::distance(m_AvailableResolutions.begin(),it);
-
- // std::cout << "found: " << newResolution << std::endl;
- }
+ diff <= 0 )
+ ||
+ ( m_ResolutionAlgorithm == ResolutionAlgorithm::Nearest_Upper &&
+ diff >= 0 )
+ ||
+ ( m_ResolutionAlgorithm == ResolutionAlgorithm::Nearest ) )
+ &&
+ std::abs(diff) < minDist )
+ {
+ isFound = true;
+
+ minDist = std::abs(diff);
+ newResolution = std::distance(m_AvailableResolutions.begin(),it);
+
+ // std::cout << "found: " << newResolution << std::endl;
+ }
}
// MANTIS-1147: Cap current-resolution.
@@ -1038,7 +1053,7 @@ void GlImageActor::UpdateResolution()
if(newResolution != m_CurrentResolution)
{
m_CurrentResolution = newResolution;
-
+
std::ostringstream extFilename;
extFilename< ListSampleType;
typedef itk::Statistics::DenseFrequencyContainer2 DFContainerType;
@@ -1153,7 +1169,7 @@ void GlImageActor::AutoColorAdjustment( double & minRed, double & maxRed,
ListSampleType::Pointer listSample = ListSampleType::New();
listSample->SetMeasurementVectorSize(3);
-
+
if(full)
{
// Retrieve the lowest resolution
@@ -1202,7 +1218,7 @@ void GlImageActor::AutoColorAdjustment( double & minRed, double & maxRed,
extract->SetChannel(m_GreenIdx);
extract->SetChannel(m_BlueIdx);
extract->Update();
-
+
itk::ImageRegionConstIterator it(extract->GetOutput(),extract->GetOutput()->GetLargestPossibleRegion());
for(it.GoToBegin();!it.IsAtEnd();++it)
{
@@ -1223,24 +1239,28 @@ void GlImageActor::AutoColorAdjustment( double & minRed, double & maxRed,
{
// Retrieve all tiles
for(TileVectorType::iterator it = m_LoadedTiles.begin();it!=m_LoadedTiles.end();++it)
- {
- itk::ImageRegionConstIterator imIt(it->m_Image,it->m_Image->GetLargestPossibleRegion());
- for(imIt.GoToBegin();!imIt.IsAtEnd();++imIt)
{
- bool nonan = true;
+ itk::ImageRegionConstIterator< VectorImageType > imIt(
+ it->Image(),
+ it->Image()->GetLargestPossibleRegion()
+ );
- for(unsigned int i = 0; i < imIt.Get().Size();++i)
+ for(imIt.GoToBegin();!imIt.IsAtEnd();++imIt)
{
- nonan = nonan && !vnl_math_isnan(imIt.Get()[i]);
- }
+ bool nonan = true;
+
+ for(unsigned int i = 0; i < imIt.Get().Size();++i)
+ {
+ nonan = nonan && !vnl_math_isnan(imIt.Get()[i]);
+ }
- if(nonan)
- {
- listSample->PushBack(imIt.Get());
+ if(nonan)
+ {
+ listSample->PushBack(imIt.Get());
+ }
}
}
}
- }
// Compute the histogram
HistogramsGeneratorType::Pointer histogramsGenerator = HistogramsGeneratorType::New();
@@ -1254,7 +1274,7 @@ void GlImageActor::AutoColorAdjustment( double & minRed, double & maxRed,
minGreen = histogramsGenerator->GetOutput()->GetNthElement(1)->Quantile(0,lcp);
maxGreen = histogramsGenerator->GetOutput()->GetNthElement(1)->Quantile(0,1-hcp);
minBlue = histogramsGenerator->GetOutput()->GetNthElement(2)->Quantile(0,lcp);
- maxBlue = histogramsGenerator->GetOutput()->GetNthElement(2)->Quantile(0,1-hcp);
+ maxBlue = histogramsGenerator->GetOutput()->GetNthElement(2)->Quantile(0,1-hcp);
}
diff --git a/Modules/Visualization/Ice/src/otbGlMesh.cxx b/Modules/Visualization/Ice/src/otbGlMesh.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..0899d83a1bd2f1954d740a4c94e1f42f1b4b8e3a
--- /dev/null
+++ b/Modules/Visualization/Ice/src/otbGlMesh.cxx
@@ -0,0 +1,132 @@
+/*
+ * 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 "otbGlMesh.h"
+
+
+namespace otb { namespace gl {
+
+Mesh
+MakeTexturedQuad( Id_t xy, Id_t uv )
+{
+ Mesh mesh(
+ { // vertices (x, y)
+ -1.0f, -1.0f,
+ +1.0f, -1.0f,
+ +1.0f, +1.0f,
+ -1.0f, +1.0f,
+ // texcoords (u, v)
+ 0.0f, 1.0f,
+ 1.0f, 1.0f,
+ 1.0f, 0.0f,
+ 0.0f, 0.0f },
+ //
+ // Components
+ 2,
+ //
+ // triangle indices
+ { 0u, 1u, 2u,
+ 2u, 3u, 0u }
+ );
+
+ mesh.VertexAttribPointer( xy, 2, 0 );
+ mesh.VertexAttribPointer( uv, 2, 8 );
+
+ return std::move( mesh );
+}
+
+
+Mesh
+MakeInterleavedTexturedQuad( Id_t xy, Id_t uv )
+{
+ Mesh mesh(
+ //
+ // vertices: (x, y, u, v )
+ { -1.0f, -1.0f, 0.0f, 1.0f,
+ +1.0f, -1.0f, 1.0f, 1.0f,
+ +1.0f, +1.0f, 1.0f, 0.0f,
+ -1.0f, +1.0f, 0.0f, 0.0f },
+ //
+ // Components
+ 4,
+ //
+ // triangle indices
+ { 0u, 1u, 2u,
+ 2u, 3u, 0u }
+ );
+
+ mesh.VertexAttribPointer( xy, 2, 0 );
+ mesh.VertexAttribPointer( uv, 2, 2 );
+
+ return std::move( mesh );
+}
+
+Mesh
+MakeQuad( Id_t xy)
+{
+ Mesh mesh(
+ //
+ // vertices: (x, y )
+ { -1.0f, -1.0f,
+ +1.0f, -1.0f,
+ +1.0f, +1.0f,
+ -1.0f, +1.0f},
+ //
+ // Components
+ 2,
+ //
+ // indices compatible with triangles and line loop modes
+ { 0u, 1u, 2u,
+ 3u, 0u, 2u }
+ );
+
+ mesh.VertexAttribPointer( xy, 2, 0 );
+
+ return std::move( mesh );
+}
+
+void
+Mesh
+::VertexAttribPointer( Id_t id,
+ std::size_t components,
+ std::ptrdiff_t first ) const
+{
+ assert( components );
+
+ glVertexAttribPointer(
+ id,
+ components,
+ m_VBO.GlType(),
+ GL_FALSE,
+ m_VBO.Stride( components ),
+ reinterpret_cast< GLvoid const * >( first * m_VBO.Size() )
+ );
+
+ CheckError();
+
+ glEnableVertexAttribArray( id );
+
+ CheckError();
+}
+
+
+} // End namespace 'gl'.
+
+} // End namespace 'otb'.
diff --git a/Modules/Visualization/Ice/src/otbGlROIActor.cxx b/Modules/Visualization/Ice/src/otbGlROIActor.cxx
index f5e31b27099de21eb9e9a755f32175f3e15d091f..fdb9fea05375d78a22322d570061ae194a93ffc6 100644
--- a/Modules/Visualization/Ice/src/otbGlROIActor.cxx
+++ b/Modules/Visualization/Ice/src/otbGlROIActor.cxx
@@ -19,7 +19,10 @@
*/
#include "otbGlROIActor.h"
+#include "otbGlMesh.h"
#include "otbViewSettings.h"
+#include "otbMinimalShader.h"
+#include "otbCast.h"
#ifdef _WIN32
#include
#endif
@@ -36,13 +39,15 @@ GlROIActor::GlROIActor()
m_Kwl(),
m_Color(),
m_Alpha(1.0),
+ m_CurrentAlpha(1.0),
m_Fill(false),
m_ViewportToImageTransform(),
m_ImageToViewportTransform(),
m_VpUL(),
m_VpUR(),
m_VpLL(),
- m_VpLR()
+ m_VpLR(),
+ m_Mesh()
{
m_UL.Fill( 0 );
m_LR.Fill( 0 );
@@ -135,30 +140,95 @@ void GlROIActor::UpdateData()
void GlROIActor::Render()
{
- glColor3d(m_Color[0],m_Color[1],m_Color[2]);
+ bool useShader = !m_Shader.IsNull();
- glBegin(GL_LINE_LOOP);
- glVertex2d(m_VpUL[0],m_VpUL[1]);
- glVertex2d(m_VpUR[0],m_VpUR[1]);
- glVertex2d(m_VpLR[0],m_VpLR[1]);
- glVertex2d(m_VpLL[0],m_VpLL[1]);
- glEnd();
+ if (useShader)
+ {
+ m_CurrentAlpha = 1.0;
+ m_Shader->LoadShader();
+ m_Shader->SetupShader();
+
+ assert( m_Mesh );
+ m_Mesh->Bind();
+
+ GLfloat vertexPosition[ 8 ] = {
+ -1.0f, -1.0f,
+ 1.0f, -1.0f,
+ 1.0f, 1.0f,
+ -1.0f, 1.0f
+ };
+
+ vertexPosition[0] = m_VpUL[0];
+ vertexPosition[1] = m_VpUL[1];
+ vertexPosition[2] = m_VpUR[0];
+ vertexPosition[3] = m_VpUR[1];
+ vertexPosition[4] = m_VpLR[0];
+ vertexPosition[5] = m_VpLR[1];
+ vertexPosition[6] = m_VpLL[0];
+ vertexPosition[7] = m_VpLL[1];
+
+ glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertexPosition), vertexPosition);
+
+ glDrawElements( GL_LINE_LOOP, 4, GL_UNSIGNED_INT, 0);
+
+ if(m_Fill)
+ {
+ m_CurrentAlpha = m_Alpha;
+ m_Shader->SetupShader();
+
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ glDrawElements( GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
- if(m_Fill)
+ glDisable(GL_BLEND);
+ }
+
+ m_Shader->UnloadShader();
+ }
+ else
{
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glColor4d(m_Color[0],m_Color[1],m_Color[2],m_Alpha);
- glBegin(GL_QUADS);
+ glColor3d(m_Color[0],m_Color[1],m_Color[2]);
+
+ glBegin(GL_LINE_LOOP);
glVertex2d(m_VpUL[0],m_VpUL[1]);
glVertex2d(m_VpUR[0],m_VpUR[1]);
glVertex2d(m_VpLR[0],m_VpLR[1]);
glVertex2d(m_VpLL[0],m_VpLL[1]);
glEnd();
- glDisable(GL_BLEND);
+
+ if(m_Fill)
+ {
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glColor4d(m_Color[0],m_Color[1],m_Color[2],m_Alpha);
+ glBegin(GL_QUADS);
+ glVertex2d(m_VpUL[0],m_VpUL[1]);
+ glVertex2d(m_VpUR[0],m_VpUR[1]);
+ glVertex2d(m_VpLR[0],m_VpLR[1]);
+ glVertex2d(m_VpLL[0],m_VpLL[1]);
+ glEnd();
+ glDisable(GL_BLEND);
+ }
}
}
+void GlROIActor::CreateShader()
+{
+ MinimalShader::Pointer shader( MinimalShader::New() );
+ m_Shader = shader;
+
+ // Check previous OpenGL error and clear error flag.
+ gl::CheckError< gl::error::clear >();
+
+ m_Mesh = std::make_unique< gl::Mesh >(
+ gl::MakeQuad(
+ shader->GetAttribIdx()[ 0 ]
+ )
+ );
+
+ shader->SetColor(m_Color.GetDataPointer(), &m_CurrentAlpha);
+}
void GlROIActor::UpdateTransforms()
{
diff --git a/Modules/Visualization/Ice/src/otbGlVectorActor.cxx b/Modules/Visualization/Ice/src/otbGlVectorActor.cxx
index adb9182b6ee2b17abe007e82d0a20232ccf0d1df..58615f7820fb414aefe1418d2912d20b09f297e8 100644
--- a/Modules/Visualization/Ice/src/otbGlVectorActor.cxx
+++ b/Modules/Visualization/Ice/src/otbGlVectorActor.cxx
@@ -20,6 +20,8 @@
#include "otbGlVectorActor.h"
#include "otbViewSettings.h"
+#include "otbMinimalShader.h"
+#include "otbCast.h"
#ifdef _WIN32
#include
@@ -107,7 +109,6 @@ GlVectorActor::GlVectorActor()
m_PointMarkerSize(5),
m_ViewportForwardRotationTransform(RigidTransformType::New()),
m_ViewportBackwardRotationTransform(RigidTransformType::New())
-
{
m_Color.Fill(0);
m_Color[0]=1.0;
@@ -137,6 +138,16 @@ GlVectorActor::~GlVectorActor()
}
+void GlVectorActor::CreateShader()
+{
+ if (m_Shader.IsNull())
+ {
+ MinimalShader::Pointer shader( MinimalShader::New() );
+ m_Shader = shader;
+ shader->SetColor(m_Color.GetDataPointer(), &m_Alpha);
+ }
+}
+
void GlVectorActor::SetFill(bool flag)
{
if(m_Fill != flag)
@@ -624,17 +635,20 @@ void GlVectorActor::Render()
UpdateDisplayList();
}
+ m_Shader->LoadShader();
+ m_Shader->SetupShader();
+
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_LINE_SMOOTH);
glLineWidth(m_LineWidth);
- glColor4d(m_Color[0],m_Color[1],m_Color[2],m_Alpha);
glCallList(m_DisplayList);
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
-
+
+ m_Shader->UnloadShader();
}
diff --git a/Modules/Visualization/Ice/src/otbGlVersionChecker.cxx b/Modules/Visualization/Ice/src/otbGlVersionChecker.cxx
index bf96abcbfc572193f5a3a61724720754f991f50c..6387d9fbadf25ed385b4380cada5a018c45c8723 100644
--- a/Modules/Visualization/Ice/src/otbGlVersionChecker.cxx
+++ b/Modules/Visualization/Ice/src/otbGlVersionChecker.cxx
@@ -35,12 +35,12 @@
namespace otb
{
-const char * GlVersionChecker::REQUIRED_GL_VERSION = "2.0.0";
-const char * GlVersionChecker::REQUIRED_GLSL_VERSION = "1.20";
+const char * GlVersionChecker::REQUIRED_GL_VERSION = "3.0.0";
+const char * GlVersionChecker::REQUIRED_GLSL_VERSION = "1.30";
const char *
GlVersionChecker
-::GLVersion()
+::GLVersion() noexcept
{
const GLubyte * glVersionStr = glGetString( GL_VERSION );
@@ -61,7 +61,7 @@ GlVersionChecker
const char *
GlVersionChecker
-::GLSLVersion()
+::GLSLVersion() noexcept
{
const GLubyte * slVersionStr = glGetString( GL_SHADING_LANGUAGE_VERSION );
@@ -82,7 +82,18 @@ GlVersionChecker
bool
GlVersionChecker
-::CheckGLCapabilities( const char * & glVersion, const char * & glslVersion )
+::CheckGLCapabilities() noexcept
+{
+ char const * glVersion = nullptr;
+ char const * glslVersion = nullptr;
+
+ return GlVersionChecker::CheckGLCapabilities( glVersion, glslVersion );
+}
+
+
+bool
+GlVersionChecker
+::CheckGLCapabilities( const char * & glVersion, const char * & glslVersion ) noexcept
{
// Get OpenGL version.
glVersion = GlVersionChecker::GLVersion();
@@ -114,7 +125,7 @@ GlVersionChecker
::SplitVersion( const char * version,
int& major,
int& minor,
- int& release )
+ int& release ) noexcept
{
//
// Special case: empty strings returns 0.0.0 and true.
@@ -174,7 +185,7 @@ GlVersionChecker
int
GlVersionChecker
-::VerCmp( const char * version, const char * required )
+::VerCmp( const char * version, const char * required ) noexcept
{
//
// Split version.
@@ -231,4 +242,3 @@ GlVersionChecker
} // End namespace otb
-
diff --git a/Modules/Visualization/Ice/src/otbGlVertexArrayObject.cxx b/Modules/Visualization/Ice/src/otbGlVertexArrayObject.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..230dad2eab4ab2ae67474b8c7152b849ce4d5c86
--- /dev/null
+++ b/Modules/Visualization/Ice/src/otbGlVertexArrayObject.cxx
@@ -0,0 +1,52 @@
+/*
+ * 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 "otbGlVertexArrayObject.h"
+
+namespace otb { namespace gl {
+
+
+void
+VertexArrayObjectPolicy
+::Generate( Id_t & id )
+{
+ glGenVertexArrays( 1, &id );
+}
+
+
+void
+VertexArrayObjectPolicy
+::Bind( Id_t id )
+{
+ glBindVertexArray( id );
+}
+
+
+void
+VertexArrayObjectPolicy
+::Release( Id_t & id )
+{
+ glDeleteVertexArrays( 1, &id );
+}
+
+
+} // End namespace 'gl'.
+
+} // End namespace 'otb'.
diff --git a/Modules/Visualization/Ice/src/otbGlView.cxx b/Modules/Visualization/Ice/src/otbGlView.cxx
index 8e5727f6b1ab3a2ca6f3c682a312888701908250..d5a020d70450099d6f63b16dfaf325e08aa4918a 100644
--- a/Modules/Visualization/Ice/src/otbGlView.cxx
+++ b/Modules/Visualization/Ice/src/otbGlView.cxx
@@ -34,6 +34,7 @@
#include "itkRGBAPixel.h"
#include "otbGeoInterface.h"
+#include "otbGlVersionChecker.h"
#include "otbImage.h"
#include "otbImageFileWriter.h"
#include "otbImportImageFilter.h"
@@ -42,43 +43,118 @@
namespace otb
{
-GlView::GlView()
- : m_Settings(ViewSettings::New()),
- m_Actors(),
- m_RenderingOrder()
+GlView::GlView() :
+ m_Settings( ViewSettings::New() ),
+ m_Actors(),
+ m_RenderingOrder(),
+ m_ProjMatrix{
+ 1.0, 0.0, 0.0, 0.0,
+ 0.0, 1.0, 0.0, 0.0,
+ 0.0, 0.0, 1.0, 0.0,
+ 0.0, 0.0, 0.0, 1.0 },
+ m_ModelViewMatrix{
+ 1.0, 0.0, 0.0, 0.0,
+ 0.0, 1.0, 0.0, 0.0,
+ 0.0, 0.0, 1.0, 0.0,
+ 0.0, 0.0, 0.0, 1.0 },
+ m_IsGLSLAvailable( false ),
+ m_IsGLSLEnabled( false )
{}
+
GlView::~GlView()
{}
-void GlView::Initialize(unsigned int sx, unsigned int sy)
+
+std::size_t
+GlView
+::CheckGLCapabilities( char const * & glVersion,
+ char const * & glslVersion )
+{
+ m_IsGLSLEnabled = m_IsGLSLAvailable =
+ GlVersionChecker::CheckGLCapabilities( glVersion, glslVersion );
+
+ if( !m_IsGLSLAvailable )
+ return 0;
+
+ assert( glVersion );
+ assert( glslVersion );
+
+ int major = 0;
+ int minor = 0;
+ int release = 0;
+
+ GlVersionChecker::SplitVersion( glslVersion, major, minor, release );
+
+ assert( major>0 );
+ assert( minor>0 );
+ assert( release>=0 );
+
+ return 100 * major + minor;
+}
+
+
+void
+GlView
+::Initialize( unsigned int sx, unsigned int sy ) noexcept
{
m_Settings = ViewSettings::New();
-
- this->ClearActors();
- this->Resize(sx,sy);
+ ClearActors();
+
+ Resize( sx,sy );
}
-void GlView::Resize(unsigned int sx, unsigned int sy)
+
+void
+GlView
+::SetGLSLEnabled( bool isEnabled )
{
- ViewSettings::SizeType size;
- size[0] = sx;
- size[1] = sy;
- m_Settings->SetViewportSize(size);
+ assert( m_Actors.empty() );
+
+ if( !m_Actors.empty() )
+ throw std::runtime_error(
+ "Failed to change GLSL activation state (view must be cleared before)."
+ );
+
+ m_IsGLSLEnabled = isEnabled;
}
-void GlView::BeforeRendering()
+
+void
+GlView
+::Resize( unsigned int sx, unsigned int sy ) noexcept
+{
+ ViewSettings::SizeType size;
+
+ size[ 0 ] = sx;
+ size[ 1 ] = sy;
+
+ m_Settings->SetViewportSize( size );
+}
+
+
+void
+GlView
+::BeforeRendering()
{
// First, get all actors informed of new settings
for(ActorMapType::iterator it = m_Actors.begin();
it!=m_Actors.end();++it)
- {
+ {
if(it->second->GetVisible())
- {
+ {
it->second->ProcessViewSettings();
+
+ Shader* shader = it->second->GetShader();
+
+ if( shader )
+ {
+ shader->m_ProjMatrix = m_ProjMatrix;
+ shader->m_ModelViewMatrix = m_ModelViewMatrix;
}
}
+ }
// Second, get opengl ready
@@ -88,36 +164,106 @@ void GlView::BeforeRendering()
// Clear back-buffer(s) before rendering
glClear( GL_COLOR_BUFFER_BIT );
- // Setup projection according to view settings
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
-
double ulx = -1.0;
double uly = -1.0;
double lrx = 1.0;
double lry = 1.0;
-
+
+ assert( !m_Settings.IsNull() );
+
m_Settings->GetViewportExtent(ulx,uly,lrx,lry);
- glOrtho(ulx, lrx, lry, uly, -1, 1);
+ if( m_IsGLSLAvailable && m_IsGLSLEnabled )
+ {
+ // TODO: Use GLM [1] for OpenGL linear algebra.
+ // [1]: https://glm.g-truc.net/0.9.9/index.html
+
+ m_ProjMatrix[0] = 2.0/(lrx-ulx);
+ m_ProjMatrix[1] = 0.0;
+ m_ProjMatrix[2] = 0.0;
+ m_ProjMatrix[3] = 0.0;
+ m_ProjMatrix[4] = 0.0;
+ m_ProjMatrix[5] = 2.0/(uly-lry);
+ m_ProjMatrix[6] = 0.0;
+ m_ProjMatrix[7] = 0.0;
+ m_ProjMatrix[8] = 0.0;
+ m_ProjMatrix[9] = 0.0;
+ m_ProjMatrix[10] = -1.0;
+ m_ProjMatrix[11] = 0.0;
+ m_ProjMatrix[12] = -(lrx+ulx)/(lrx-ulx);
+ m_ProjMatrix[13] = -(uly+lry)/(uly-lry);
+ m_ProjMatrix[14] = 0.0;
+ m_ProjMatrix[15] = 1.0;
+
+ double ra = -m_Settings->GetRotationAngle();
+ if(ra == 0.0)
+ {
+ m_ModelViewMatrix[0] = 1.0;
+ m_ModelViewMatrix[1] = 0.0;
+ m_ModelViewMatrix[2] = 0.0;
+ m_ModelViewMatrix[3] = 0.0;
+ m_ModelViewMatrix[4] = 0.0;
+ m_ModelViewMatrix[5] = 1.0;
+ m_ModelViewMatrix[6] = 0.0;
+ m_ModelViewMatrix[7] = 0.0;
+ m_ModelViewMatrix[8] = 0.0;
+ m_ModelViewMatrix[9] = 0.0;
+ m_ModelViewMatrix[10] = 1.0;
+ m_ModelViewMatrix[11] = 0.0;
+ m_ModelViewMatrix[12] = 0.0;
+ m_ModelViewMatrix[13] = 0.0;
+ m_ModelViewMatrix[14] = 0.0;
+ m_ModelViewMatrix[15] = 1.0;
+ }
+ else
+ {
+ double rcx = m_Settings->GetRotationCenter()[0];
+ double rcy = m_Settings->GetRotationCenter()[1];
+ double cos_a = cos(ra);
+ double sin_a = sin(ra);
+ m_ModelViewMatrix[0] = cos_a;
+ m_ModelViewMatrix[1] = sin_a;
+ m_ModelViewMatrix[2] = 0.0;
+ m_ModelViewMatrix[3] = 0.0;
+ m_ModelViewMatrix[4] = -sin_a;
+ m_ModelViewMatrix[5] = cos_a;
+ m_ModelViewMatrix[6] = 0.0;
+ m_ModelViewMatrix[7] = 0.0;
+ m_ModelViewMatrix[8] = 0.0;
+ m_ModelViewMatrix[9] = 0.0;
+ m_ModelViewMatrix[10] = 1.0;
+ m_ModelViewMatrix[11] = 0.0;
+ m_ModelViewMatrix[12] = rcx * (1.0 - cos_a) + rcy * sin_a;
+ m_ModelViewMatrix[13] = -rcx * sin_a + rcy * (1.0 - cos_a);
+ m_ModelViewMatrix[14] = 0.0;
+ m_ModelViewMatrix[15] = 1.0;
+ }
+ }
+ else
+ {
+ // Setup projection according to view settings
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+
+ glOrtho(ulx, lrx, lry, uly, -1, 1);
- // std::cout
- // << "glOrtho( "
- // << ulx << ", " << lrx << ", "
- // << lry << ", " << uly
- // << ", -1, 1 )"
- // << std::endl;
-
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-
- glPushMatrix();
-
- glTranslatef(m_Settings->GetRotationCenter()[0],m_Settings->GetRotationCenter()[1],0);
- glRotatef(-m_Settings->GetRotationAngle()*180/M_PI,0,0,1);
- glTranslatef(-m_Settings->GetRotationCenter()[0],-m_Settings->GetRotationCenter()[1],0);
-
- // glScalef(m_Settings->GetSpacing()[0],m_Settings->GetSpacing()[1],1);
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+
+ // glPushMatrix();
+
+ glTranslatef(
+ m_Settings->GetRotationCenter()[ 0 ],
+ m_Settings->GetRotationCenter()[ 1 ], 0
+ );
+
+ glRotatef( -m_Settings->GetRotationAngle() * 180.0 / M_PI, 0, 0, 1 );
+
+ glTranslatef(
+ -m_Settings->GetRotationCenter()[ 0 ],
+ -m_Settings->GetRotationCenter()[ 1 ],
+ 0);
+ }
}
void GlView::AfterRendering()
@@ -125,7 +271,8 @@ void GlView::AfterRendering()
// std::cout << "geometry-changed: FALSE" << std::endl;
m_Settings->SetGeometryChanged(false);
- glPopMatrix();
+
+ // glPopMatrix();
}
std::string GlView::AddActor(ActorType * actor, const std::string& key)
@@ -169,7 +316,9 @@ bool GlView::RemoveActor(const std::string & key)
return true;
}
-void GlView::ClearActors()
+void
+GlView
+::ClearActors() noexcept
{
m_Actors.clear();
m_RenderingOrder.clear();
@@ -363,7 +512,7 @@ GlView
front
? m_RenderingOrder.end()
: m_RenderingOrder.begin(),
- thisKeys.begin(),
+ thisKeys.begin(),
thisKeys.end()
);
}
@@ -403,11 +552,11 @@ GlView
if( glGetError()!=GL_NO_ERROR )
throw std::runtime_error(
std::string(
- reinterpret_cast< const char * >(
- gluErrorString(
- glGetError()
- )
- )
+ reinterpret_cast< const char * >(
+ gluErrorString(
+ glGetError()
+ )
+ )
)
);
@@ -418,14 +567,14 @@ GlView
assert( RgbPixel::Length==3 );
assert( sizeof( GLubyte )==1 );
- RgbPixel::ValueType * glBuffer = new RgbPixel::ValueType[ RgbPixel::Length * count ];
+ auto glBuffer = std::make_unique< RgbPixel::ValueType[] >( RgbPixel::Length * count );
assert( glBuffer!=NULL );
- glReadPixels(
+ glReadPixels(
0, 0,
size[ 0 ], size[ 1 ],
GL_RGB, GL_UNSIGNED_BYTE,
- glBuffer
+ glBuffer.get()
);
//
@@ -435,17 +584,17 @@ GlView
if( glGetError()!=GL_NO_ERROR )
throw std::runtime_error(
std::string(
- reinterpret_cast< const char * >(
- gluErrorString(
- glGetError()
- )
- )
+ reinterpret_cast< const char * >(
+ gluErrorString(
+ glGetError()
+ )
+ )
)
);
//
// Copy & flip OpenGL pixel buffer into itk::RGBAPixel<> buffer.
- RgbPixel * itkBuffer = new RgbPixel[ count ];
+ auto itkBuffer = std::make_unique< RgbPixel[] >( count );
assert( itkBuffer );
for( unsigned long j=0; jSetImportPointer(
- itkBuffer,
+ itkBuffer.release(),
count,
true
);
diff --git a/Modules/Visualization/Ice/src/otbImageSettings.cxx b/Modules/Visualization/Ice/src/otbImageSettings.cxx
index d3b75013a9a3b01674fb08732a32aec3177cbbeb..2cd090f2e435d72fe5c999b41565f509d5d04110 100644
--- a/Modules/Visualization/Ice/src/otbImageSettings.cxx
+++ b/Modules/Visualization/Ice/src/otbImageSettings.cxx
@@ -19,9 +19,6 @@
*/
#include "otbImageSettings.h"
-#include "otbFragmentShaderRegistry.h"
-#include "otbGlVersionChecker.h"
-#include
namespace otb
{
diff --git a/Modules/Visualization/Ice/src/otbMinimalShader.cxx b/Modules/Visualization/Ice/src/otbMinimalShader.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..b09a8d9a63850cd29f44424ff2a5301fa7d10983
--- /dev/null
+++ b/Modules/Visualization/Ice/src/otbMinimalShader.cxx
@@ -0,0 +1,103 @@
+/*
+ * 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 "otbMinimalShader.h"
+
+#include
+#include
+
+#include "otbShaderRegistry.h"
+
+namespace otb
+{
+
+MinimalShader::MinimalShader()
+ : m_ColorRGB(nullptr)
+ , m_ColorA(nullptr)
+{
+ // Register the shader in the ShaderRegistry
+ BuildShader();
+
+ // Reserve variable locations
+ // - for vertex shader
+ m_Loc.proj = glGetUniformLocation(m_Program, "in_proj");
+ m_Loc.modelview = glGetUniformLocation(m_Program, "in_mv");
+ // - for fragment shader
+ m_Loc.color = glGetUniformLocation(m_Program, "in_color");
+
+ m_AttribIdx.push_back( glGetAttribLocation(m_Program, "position") );
+}
+
+MinimalShader::~MinimalShader()
+{}
+
+std::string MinimalShader::GetVertexSource() const
+{
+ std::string shader_source =
+ "#version 130 \n" \
+ "in vec4 position;\n" \
+ "uniform mat4 in_proj;\n" \
+ "uniform mat4 in_mv;\n" \
+ "void main()\n" \
+ "{\n" \
+ "gl_Position = in_proj * in_mv * position;\n" \
+ "}";
+
+ return shader_source;
+}
+
+std::string MinimalShader::GetFragmentSource() const
+{
+ std::string shader_source =
+ "#version 130 \n" \
+ "uniform vec4 in_color;\n" \
+ "out vec4 out_color;\n" \
+ "void main (void) {\n" \
+ "out_color = in_color;\n" \
+ "}";
+
+ return shader_source;
+}
+
+std::string MinimalShader::GetName() const
+{
+ return "MinimalShader";
+}
+
+void MinimalShader::SetupShader()
+{
+ glUniformMatrix4fv(m_Loc.proj,1, GL_FALSE, m_ProjMatrix);
+ glUniformMatrix4fv(m_Loc.modelview,1, GL_FALSE, m_ModelViewMatrix);
+
+ assert(m_ColorRGB);
+ assert(m_ColorA);
+
+ glUniform4f(m_Loc.color, m_ColorRGB[0], m_ColorRGB[1], m_ColorRGB[2], (*m_ColorA));
+}
+
+void MinimalShader::SetColor(const double *rgb, const double *a)
+{
+ m_ColorRGB = rgb;
+ m_ColorA = a;
+}
+
+} // End namespace otb
+
+
diff --git a/Modules/Visualization/Ice/src/otbShader.cxx b/Modules/Visualization/Ice/src/otbShader.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..7f4492a1f88eaf9b7cee52169b8c95630e0ccb0a
--- /dev/null
+++ b/Modules/Visualization/Ice/src/otbShader.cxx
@@ -0,0 +1,78 @@
+/*
+ * 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 "otbShader.h"
+#include "otbShaderRegistry.h"
+
+namespace otb
+{
+Shader::Shader()
+ : m_Program(0)
+ , m_ProjMatrix(nullptr)
+ , m_ModelViewMatrix(nullptr)
+{}
+
+Shader::~Shader()
+{}
+
+void Shader::BuildShader()
+{
+ std::string vSource = this->GetVertexSource();
+ std::string fSource = this->GetFragmentSource();
+ std::string name = this->GetName();
+
+ try
+ {
+ // Assumption here is that each shader has its unique name
+ if(!otb::ShaderRegistry::Instance()->IsShaderRegistered(name))
+ {
+ otb::ShaderRegistry::Instance()->RegisterShader(name,vSource,fSource);
+ }
+ m_Program = otb::ShaderRegistry::Instance()->GetShaderProgram(name);
+ }
+ catch(itk::ExceptionObject& err)
+ {
+ // Log compilation errors if any
+ std::cerr<LoadShader(GetName());
+}
+
+void Shader::UnloadShader()
+{
+ otb::ShaderRegistry::Instance()->UnloadShader();
+}
+
+void Shader::SetupShader()
+{
+ // Default does nothing
+}
+
+const std::vector &
+Shader::GetAttribIdx()
+{
+ return m_AttribIdx;
+}
+
+}
diff --git a/Modules/Visualization/Ice/src/otbFragmentShaderRegistry.cxx b/Modules/Visualization/Ice/src/otbShaderRegistry.cxx
similarity index 51%
rename from Modules/Visualization/Ice/src/otbFragmentShaderRegistry.cxx
rename to Modules/Visualization/Ice/src/otbShaderRegistry.cxx
index 47eefde7da50f43866dbb0a3ede9e5970ab56d01..0072fecbfc24c5c1489647a5548468c297297b9d 100644
--- a/Modules/Visualization/Ice/src/otbFragmentShaderRegistry.cxx
+++ b/Modules/Visualization/Ice/src/otbShaderRegistry.cxx
@@ -18,118 +18,115 @@
* limitations under the License.
*/
-#include "otbFragmentShaderRegistry.h"
+#include "otbShaderRegistry.h"
#include
namespace otb
{
-FragmentShaderRegistry::Pointer FragmentShaderRegistry::m_Instance;
+ShaderRegistry::Pointer ShaderRegistry::m_Instance;
-FragmentShaderRegistry::FragmentShaderRegistry()
+ShaderRegistry::ShaderRegistry()
: m_ShaderMap()
{}
-FragmentShaderRegistry::~FragmentShaderRegistry()
+ShaderRegistry::~ShaderRegistry()
{
this->ClearShaders();
}
-FragmentShaderRegistry::Pointer FragmentShaderRegistry::Instance()
+ShaderRegistry::Pointer ShaderRegistry::Instance()
{
if(m_Instance.IsNull())
{
- m_Instance = FragmentShaderRegistry::New();
- glewInit();
+ m_Instance = ShaderRegistry::New();
+ glewExperimental = GL_TRUE;
+ GLenum err = glewInit();
+ if (err != GLEW_OK)
+ {
+ itkGenericExceptionMacro(<< "Failed to initialize GLEW: "<< glewGetErrorString(err));
+ }
}
return m_Instance;
}
-void FragmentShaderRegistry::RegisterShader(const std::string& name, const std::string& source)
+void ShaderRegistry::RegisterShader(const std::string& name, const std::string& vSource, const std::string& fSource)
{
if(m_ShaderMap.count(name) != 0)
{
itkExceptionMacro(<<"A shader with name "< keys;
@@ -148,13 +145,49 @@ void FragmentShaderRegistry::ClearShaders()
m_ShaderMap.clear();
}
-unsigned int FragmentShaderRegistry::GetShaderProgram(const std::string& name)
+unsigned int ShaderRegistry::GetShaderProgram(const std::string& name)
{
if(m_ShaderMap.count(name) == 0)
{
itkExceptionMacro(<<"No shader with name "<
#include
-#include "otbFragmentShaderRegistry.h"
+#include "otbShaderRegistry.h"
#include "otbGlVersionChecker.h"
namespace otb
@@ -41,32 +41,74 @@ StandardShader::StandardShader() :
{
m_Center.Fill( 0 );
- BuildShader();
-}
-
-StandardShader::~StandardShader()
-{}
-
-std::string StandardShader::GetSource() const
-{
const char * glVersion = nullptr;
const char * glslVersion = nullptr;
if(!otb::GlVersionChecker::CheckGLCapabilities( glVersion, glslVersion))
{
itkExceptionMacro(<<" Required GL and GLSL versions were not found (GL version is "<=0;
- bool isGLSLS140Available = otb::GlVersionChecker::VerCmp(glslVersion,"1.40")>=0;
+ // Register the shader in the ShaderRegistry
+ BuildShader();
+ // Reserve variable locations
+ // - for vertex shader
+ m_Loc.proj = glGetUniformLocation(m_Program, "in_proj");
+ m_Loc.modelview = glGetUniformLocation(m_Program, "in_mv");
+ // - for fragment shader
+ m_Loc.a = glGetUniformLocation(m_Program, "shader_a");
+ m_Loc.b = glGetUniformLocation(m_Program, "shader_b");
+ m_Loc.use_no_data = glGetUniformLocation(m_Program, "shader_use_no_data");
+ m_Loc.no_data = glGetUniformLocation(m_Program, "shader_no_data");
+ m_Loc.gamma = glGetUniformLocation(m_Program, "shader_gamma");
+ m_Loc.alpha = glGetUniformLocation(m_Program, "shader_alpha");
+ m_Loc.radius = glGetUniformLocation(m_Program, "shader_radius");
+ m_Loc.center = glGetUniformLocation(m_Program, "shader_center");
+ m_Loc.type = glGetUniformLocation(m_Program, "shader_type");
+ m_Loc.current = glGetUniformLocation(m_Program, "shader_current");
+ m_Loc.localc_range = glGetUniformLocation(m_Program, "shader_localc_range");
+ m_Loc.spectral_angle_range = glGetUniformLocation(m_Program, "shader_spectral_angle_range");
+ m_Loc.chessboard_size = glGetUniformLocation(m_Program, "shader_chessboard_size");
+ m_Loc.slider_pos = glGetUniformLocation(m_Program, "shader_slider_pos");
+ m_Loc.vertical_slider_flag = glGetUniformLocation(m_Program, "shader_vertical_slider_flag");
+
+ m_AttribIdx.push_back( glGetAttribLocation(m_Program, "position") );
+ m_AttribIdx.push_back( glGetAttribLocation(m_Program , "in_coord") );
+}
+
+StandardShader::~StandardShader()
+{}
+
+std::string
+StandardShader
+::GetVertexSource() const
+{
+ return
+ "#version 130\n"
+ "in vec4 position;\n"
+ "in vec2 in_coord;\n"
+ "out vec2 tex_coord;\n"
+ "uniform mat4 in_proj;\n"
+ "uniform mat4 in_mv;\n"
+ "void main()\n"
+ "{\n"
+ "tex_coord = in_coord;\n"
+ "gl_Position = in_proj * in_mv * position;\n"
+ "}";
+}
+
+std::string StandardShader::GetFragmentSource() const
+{
std::string shader_source = "";
- if(isGLSLS140Available)
+ if(m_HasGLSL140)
{
- shader_source+="#version 140 \n";
+ shader_source+="#version 140\n";
}
else
{
- shader_source+="#version 130 \n";
+ shader_source+="#version 130\n";
}
shader_source +=
@@ -86,40 +128,42 @@ std::string StandardShader::GetSource() const
"uniform float shader_chessboard_size;\n" \
"uniform float shader_slider_pos;\n" \
"uniform int shader_vertical_slider_flag;\n" \
+ "in vec2 tex_coord;\n" \
+ "out vec4 out_color;\n" \
"void main (void) {\n" \
- "vec4 p = texture2D(src, gl_TexCoord[0].xy);\n" \
+ "vec4 p = texture(src, tex_coord);\n" \
"vec4 colors = pow( clamp( ( p+shader_b ) * shader_a, 0.0, 1.0 ), shader_gamma );\n" \
- "gl_FragColor = colors;\n" \
- "gl_FragColor[3] = clamp(shader_alpha,0.0,1.0);\n" \
+ "out_color = colors;\n" \
+ "out_color[3] = clamp(shader_alpha,0.0,1.0);\n" \
"if(shader_use_no_data > 0 && vec3(p) == vec3(shader_no_data)){\n" \
- "gl_FragColor[3] = 0.;\n" \
+ "out_color[3] = 0.;\n" \
"}\n" \
- "float alpha = gl_FragColor[3];\n" \
+ "float alpha = out_color[3];\n" \
"float dist = distance(gl_FragCoord.xy,shader_center);\n" \
"if(shader_type == 1)\n" \
"{\n" \
"if(dist < shader_radius)\n" \
"{\n" \
"vec3 tmp = clamp((vec3(p)-vec3(shader_current)+vec3(shader_localc_range))/(2.*vec3(shader_localc_range)),0.0,1.0);\n" \
- "gl_FragColor[0] = tmp[0];\n" \
- "gl_FragColor[1] = tmp[1];\n" \
- "gl_FragColor[2] = tmp[2];\n" \
- "gl_FragColor[3] = alpha;\n" \
+ "out_color[0] = tmp[0];\n" \
+ "out_color[1] = tmp[1];\n" \
+ "out_color[2] = tmp[2];\n" \
+ "out_color[3] = alpha;\n" \
"}\n" \
"}\n" \
"else if(shader_type == 2)" \
"{\n" \
- "gl_FragColor[3] = dist > shader_radius ? 1.0 : 0.0; \n" \
+ "out_color[3] = dist > shader_radius ? 1.0 : 0.0; \n" \
"}\n" \
"else if(shader_type == 3)\n" \
"{\n" \
"float alpha = (mod(floor(gl_FragCoord.x / shader_chessboard_size), 2.0) == 0.) != (mod(floor(gl_FragCoord.y / shader_chessboard_size), 2.0) == 1.) ? shader_alpha : 0.0;\n" \
- "gl_FragColor[3] = clamp(alpha,0.0,1.0);\n" \
+ "out_color[3] = clamp(alpha,0.0,1.0);\n" \
"}\n" \
"else if(shader_type == 4)\n" \
"{\n" \
"float alpha = (shader_vertical_slider_flag == 0 && gl_FragCoord.x > shader_slider_pos) || (shader_vertical_slider_flag == 1 && gl_FragCoord.y > shader_slider_pos) ? 1.0 : 0.0;\n" \
- "gl_FragColor[3] = clamp(alpha,0.0,1.0);\n" \
+ "out_color[3] = clamp(alpha,0.0,1.0);\n" \
"}\n" \
"else if(shader_type == 5)\n" \
"{\n" \
@@ -127,10 +171,10 @@ std::string StandardShader::GetSource() const
"{\n" \
"float angle = acos(clamp(dot(vec3(p),shader_current)/(length(vec3(p))*length(shader_current)),-1.0,1.0));\n" \
"vec3 tmp = clamp(vec3(1.-shader_spectral_angle_range*abs(angle)/3.142),0.0,1.0);\n" \
- "gl_FragColor[0] = tmp[0];\n" \
- "gl_FragColor[1] = tmp[1];\n" \
- "gl_FragColor[2] = tmp[2];\n" \
- "gl_FragColor[3] = alpha;\n" \
+ "out_color[0] = tmp[0];\n" \
+ "out_color[1] = tmp[1];\n" \
+ "out_color[2] = tmp[2];\n" \
+ "out_color[3] = alpha;\n" \
"}\n" \
"}\n" \
"else if(shader_type == 7)\n" \
@@ -141,9 +185,9 @@ std::string StandardShader::GetSource() const
"mapped[1] = -abs( 3.95 * (color - 0.492)) + 1.5;\n" \
"mapped[2] = -abs( 3.95 * (color - 0.2385)) + 1.5;\n" \
"mapped = clamp(mapped,0.0,1.0);\n" \
- "gl_FragColor[0] = mapped[0];\n" \
- "gl_FragColor[1] = mapped[1];\n" \
- "gl_FragColor[2] = mapped[2];\n" \
+ "out_color[0] = mapped[0];\n" \
+ "out_color[1] = mapped[1];\n" \
+ "out_color[2] = mapped[2];\n" \
"}\n" \
"else if(shader_type == 8)\n" \
"{\n" \
@@ -155,9 +199,9 @@ std::string StandardShader::GetSource() const
"mapped[1] = -abs( 3.95 * (color - 0.492)) + 1.5;\n" \
"mapped[2] = -abs( 3.95 * (color - 0.2385)) + 1.5;\n" \
"mapped = clamp(mapped,0.0,1.0);\n" \
- "gl_FragColor[0] = mapped[0];\n" \
- "gl_FragColor[1] = mapped[1];\n" \
- "gl_FragColor[2] = mapped[2];\n" \
+ "out_color[0] = mapped[0];\n" \
+ "out_color[1] = mapped[1];\n" \
+ "out_color[2] = mapped[2];\n" \
"}\n" \
"}\n" \
"else if(shader_type == 9)\n" \
@@ -168,9 +212,9 @@ std::string StandardShader::GetSource() const
"mapped[1] = 63.0 / 26.0 * color - 11.0 / 13.0;\n" \
"mapped[2] = 4.5 * color - 3.5;\n" \
"mapped = clamp(mapped,0.0,1.0);\n" \
- "gl_FragColor[0] = mapped[0];\n" \
- "gl_FragColor[1] = mapped[1];\n" \
- "gl_FragColor[2] = mapped[2];\n" \
+ "out_color[0] = mapped[0];\n" \
+ "out_color[1] = mapped[1];\n" \
+ "out_color[2] = mapped[2];\n" \
"}\n" \
"else if(shader_type == 10)\n" \
"{\n" \
@@ -182,9 +226,9 @@ std::string StandardShader::GetSource() const
"mapped[1] = 63.0 / 26.0 * color - 11.0 / 13.0;\n" \
"mapped[2] = 4.5 * color - 3.5;\n" \
"mapped = clamp(mapped,0.0,1.0);\n" \
- "gl_FragColor[0] = mapped[0];\n" \
- "gl_FragColor[1] = mapped[1];\n" \
- "gl_FragColor[2] = mapped[2];\n" \
+ "out_color[0] = mapped[0];\n" \
+ "out_color[1] = mapped[1];\n" \
+ "out_color[2] = mapped[2];\n" \
"}\n" \
"}\n" \
"else if(shader_type == 11)\n" \
@@ -195,9 +239,9 @@ std::string StandardShader::GetSource() const
"mapped[1] = color;\n" \
"mapped[2] = 1.0 - 0.5 * color;\n" \
"mapped = clamp(mapped,0.0,1.0);\n" \
- "gl_FragColor[0] = mapped[0];\n" \
- "gl_FragColor[1] = mapped[1];\n" \
- "gl_FragColor[2] = mapped[2];\n" \
+ "out_color[0] = mapped[0];\n" \
+ "out_color[1] = mapped[1];\n" \
+ "out_color[2] = mapped[2];\n" \
"}\n" \
"else if(shader_type == 12)\n" \
"{\n" \
@@ -209,9 +253,9 @@ std::string StandardShader::GetSource() const
"mapped[1] = color;\n" \
"mapped[2] = 1.0 - 0.5 * color;\n" \
"mapped = clamp(mapped,0.0,1.0);\n" \
- "gl_FragColor[0] = mapped[0];\n" \
- "gl_FragColor[1] = mapped[1];\n" \
- "gl_FragColor[2] = mapped[2];\n" \
+ "out_color[0] = mapped[0];\n" \
+ "out_color[1] = mapped[1];\n" \
+ "out_color[2] = mapped[2];\n" \
"}\n" \
"}\n" \
"else if(shader_type == 13)\n" \
@@ -222,9 +266,9 @@ std::string StandardShader::GetSource() const
"mapped[1] = 0.5*color+0.5;\n" \
"mapped[2] = 0.4;\n" \
"mapped = clamp(mapped,0.0,1.0);\n" \
- "gl_FragColor[0] = mapped[0];\n" \
- "gl_FragColor[1] = mapped[1];\n" \
- "gl_FragColor[2] = mapped[2];\n" \
+ "out_color[0] = mapped[0];\n" \
+ "out_color[1] = mapped[1];\n" \
+ "out_color[2] = mapped[2];\n" \
"}\n" \
"else if(shader_type == 14)\n" \
"{\n" \
@@ -236,9 +280,9 @@ std::string StandardShader::GetSource() const
"mapped[1] = 0.5*color+0.5;\n" \
"mapped[2] = 0.4;\n" \
"mapped = clamp(mapped,0.0,1.0);\n" \
- "gl_FragColor[0] = mapped[0];\n" \
- "gl_FragColor[1] = mapped[1];\n" \
- "gl_FragColor[2] = mapped[2];\n" \
+ "out_color[0] = mapped[0];\n" \
+ "out_color[1] = mapped[1];\n" \
+ "out_color[2] = mapped[2];\n" \
"}\n" \
"}\n" \
"else if(shader_type == 15)\n" \
@@ -249,9 +293,9 @@ std::string StandardShader::GetSource() const
"mapped[1] = 1.0-color;\n" \
"mapped[2] = 1.0;\n" \
"mapped = clamp(mapped,0.0,1.0);\n" \
- "gl_FragColor[0] = mapped[0];\n" \
- "gl_FragColor[1] = mapped[1];\n" \
- "gl_FragColor[2] = mapped[2];\n" \
+ "out_color[0] = mapped[0];\n" \
+ "out_color[1] = mapped[1];\n" \
+ "out_color[2] = mapped[2];\n" \
"}\n" \
"else if(shader_type == 16)\n" \
"{\n" \
@@ -263,31 +307,31 @@ std::string StandardShader::GetSource() const
"mapped[1] = 1.0-color;\n" \
"mapped[2] = 1.0;\n" \
"mapped = clamp(mapped,0.0,1.0);\n" \
- "gl_FragColor[0] = mapped[0];\n" \
- "gl_FragColor[1] = mapped[1];\n" \
- "gl_FragColor[2] = mapped[2];\n" \
+ "out_color[0] = mapped[0];\n" \
+ "out_color[1] = mapped[1];\n" \
+ "out_color[2] = mapped[2];\n" \
"}\n" \
"}\n";
-
- if(isGLSLS140Available)
- {
+
+ if( m_HasGLSL140 )
+ {
shader_source+=
- "else if(shader_type == 6)\n" \
- "{\n" \
- "if(dist < shader_radius)\n" \
- "{\n" \
- "vec2 size = vec2(textureSize(src,0));\n" \
- "vec2 dx = vec2(gl_TexCoord[0].xy);\n" \
- "dx[0]+=1.0/size[0];\n" \
- "vec2 dy = vec2(gl_TexCoord[0].xy);\n" \
- "dy[1]+=1.0/size[1];\n" \
- "vec4 pdx = texture2D(src, dx);\n" \
- "vec4 pdy = texture2D(src, dy);\n" \
- "gl_FragColor = clamp(pow(5*shader_a*(0.5*abs((pdx-p))+ 0.5*abs((pdy-p))),shader_gamma),0.0,1.0);\n" \
- "gl_FragColor[3] = alpha;\n" \
- "}\n" \
- "}\n";
- }
+ "else if(shader_type == 6)\n" \
+ "{\n" \
+ "if(dist < shader_radius)\n" \
+ "{\n" \
+ "vec2 size = vec2(textureSize(src,0));\n" \
+ "vec2 dx = tex_coord;\n" \
+ "dx[0]+=1.0/size[0];\n" \
+ "vec2 dy = tex_coord;\n" \
+ "dy[1]+=1.0/size[1];\n" \
+ "vec4 pdx = texture2D(src, dx);\n" \
+ "vec4 pdy = texture2D(src, dy);\n" \
+ "out_color = clamp(pow(5*shader_a*(0.5*abs((pdx-p))+ 0.5*abs((pdy-p))),shader_gamma),0.0,1.0);\n" \
+ "out_color[3] = alpha;\n" \
+ "}\n" \
+ "}\n";
+ }
shader_source+="}";
return shader_source;
}
@@ -301,6 +345,9 @@ void StandardShader::SetupShader()
{
assert( !m_ImageSettings.IsNull() );
+ glUniformMatrix4fv(m_Loc.proj,1, GL_FALSE, m_ProjMatrix);
+ glUniformMatrix4fv(m_Loc.modelview,1, GL_FALSE, m_ModelViewMatrix);
+
//
// Compute shifts.
double shr = -m_ImageSettings->GetMinRed();
@@ -314,64 +361,26 @@ void StandardShader::SetupShader()
double gamma = m_ImageSettings->GetGamma();
- GLint shader_a = glGetUniformLocation(otb::FragmentShaderRegistry::Instance()->GetShaderProgram("StandardShader"), "shader_a");
- glUniform4f(shader_a,scr,scg,scb,1.);
-
- GLint shader_b = glGetUniformLocation(otb::FragmentShaderRegistry::Instance()->GetShaderProgram("StandardShader"), "shader_b");
- glUniform4f(shader_b,shr,shg,shb,0);
-
- GLint shader_use_no_data = glGetUniformLocation(otb::FragmentShaderRegistry::Instance()->GetShaderProgram("StandardShader"), "shader_use_no_data");
- glUniform1i(shader_use_no_data, m_ImageSettings->GetUseNoData() );
-
- GLint shader_no_data = glGetUniformLocation(otb::FragmentShaderRegistry::Instance()->GetShaderProgram("StandardShader"), "shader_no_data");
- glUniform1f( shader_no_data, m_ImageSettings->GetNoData() );
-
- GLint shader_gamma = glGetUniformLocation(otb::FragmentShaderRegistry::Instance()->GetShaderProgram("StandardShader"), "shader_gamma");
- glUniform4f( shader_gamma, gamma, gamma, gamma, gamma );
-
- GLint shader_alpha = glGetUniformLocation(otb::FragmentShaderRegistry::Instance()->GetShaderProgram("StandardShader"), "shader_alpha");
- glUniform1f( shader_alpha, m_ImageSettings->GetAlpha() );
-
- GLint shader_radius = glGetUniformLocation(otb::FragmentShaderRegistry::Instance()->GetShaderProgram("StandardShader"), "shader_radius");
- glUniform1f(shader_radius,m_Radius);
-
- GLint shader_center = glGetUniformLocation(otb::FragmentShaderRegistry::Instance()->GetShaderProgram("StandardShader"), "shader_center");
- glUniform2f(shader_center,m_Center[0],m_Center[1]);
-
- GLint shader_type = glGetUniformLocation(otb::FragmentShaderRegistry::Instance()->GetShaderProgram("StandardShader"), "shader_type");
- glUniform1i(shader_type,m_ShaderType);
-
- // std::cout
- // << "r: " << m_ImageSettings->GetCurrentRed()
- // << " g: " << m_ImageSettings->GetCurrentGreen()
- // << " b: " << m_ImageSettings->GetCurrentBlue()
- // << std::endl;
-
- GLint shader_current = glGetUniformLocation(otb::FragmentShaderRegistry::Instance()->GetShaderProgram("StandardShader"), "shader_current");
+ glUniform4f(m_Loc.a,scr,scg,scb,1.);
+ glUniform4f(m_Loc.b,shr,shg,shb,0);
+ glUniform1i(m_Loc.use_no_data, m_ImageSettings->GetUseNoData() );
+ glUniform1f( m_Loc.no_data, m_ImageSettings->GetNoData() );
+ glUniform4f( m_Loc.gamma, gamma, gamma, gamma, gamma );
+ glUniform1f( m_Loc.alpha, m_ImageSettings->GetAlpha() );
+ glUniform1f(m_Loc.radius,m_Radius);
+ glUniform2f(m_Loc.center,m_Center[0],m_Center[1]);
+ glUniform1i(m_Loc.type,m_ShaderType);
glUniform3f(
- shader_current,
+ m_Loc.current,
m_ImageSettings->GetCurrentRed(),
m_ImageSettings->GetCurrentGreen(),
m_ImageSettings->GetCurrentBlue()
);
-
- GLint shader_localc_range = glGetUniformLocation(otb::FragmentShaderRegistry::Instance()->GetShaderProgram("StandardShader"), "shader_localc_range");
- glUniform1f(shader_localc_range,m_LocalContrastRange);
-
- GLint shader_spectral_angle_range = glGetUniformLocation(otb::FragmentShaderRegistry::Instance()->GetShaderProgram("StandardShader"), "shader_spectral_angle_range");
- glUniform1f(shader_spectral_angle_range,m_SpectralAngleRange);
-
- GLint shader_chessboard_size = glGetUniformLocation(otb::FragmentShaderRegistry::Instance()->GetShaderProgram("StandardShader"), "shader_chessboard_size");
- glUniform1f(shader_chessboard_size,m_ChessboardSize);
-
- GLint shader_slider_pos = glGetUniformLocation(otb::FragmentShaderRegistry::Instance()->GetShaderProgram("StandardShader"), "shader_slider_pos");
- glUniform1f(shader_slider_pos,m_SliderPosition);
-
- GLint shader_vertical_slider_flag = glGetUniformLocation(otb::FragmentShaderRegistry::Instance()->GetShaderProgram("StandardShader"), "shader_vertical_slider_flag");
- glUniform1i(shader_vertical_slider_flag,m_VerticalSlider);
-
+ glUniform1f(m_Loc.localc_range,m_LocalContrastRange);
+ glUniform1f(m_Loc.spectral_angle_range,m_SpectralAngleRange);
+ glUniform1f(m_Loc.chessboard_size,m_ChessboardSize);
+ glUniform1f(m_Loc.slider_pos,m_SliderPosition);
+ glUniform1i(m_Loc.vertical_slider_flag,m_VerticalSlider);
}
-
} // End namespace otb
-
diff --git a/Modules/Visualization/IceViewer/include/otbIceViewer.h b/Modules/Visualization/IceViewer/include/otbIceViewer.h
index 9b34da5b9aaf522248191a56dcf81439f9f185c1..79c0d41d0e709ee0bed1f7869f95fdfeac0b128d 100644
--- a/Modules/Visualization/IceViewer/include/otbIceViewer.h
+++ b/Modules/Visualization/IceViewer/include/otbIceViewer.h
@@ -144,6 +144,7 @@ private:
std::map m_ColorMap;
std::map::const_iterator m_ColorMapIterator;
+ bool m_UseGLSL;
}; // End class IceViewer
} // End namespace otb
diff --git a/Modules/Visualization/IceViewer/src/otbIceViewer.cxx b/Modules/Visualization/IceViewer/src/otbIceViewer.cxx
index 5aeb7130cd4b3128808458f3a25a3fda0635975b..a1a3321253684d5f0253a1bcdff301b88b227c87 100644
--- a/Modules/Visualization/IceViewer/src/otbIceViewer.cxx
+++ b/Modules/Visualization/IceViewer/src/otbIceViewer.cxx
@@ -55,7 +55,8 @@ IceViewer::IceViewer()
m_DisplayHud(true),
m_DisplayHelp(false),
m_ColorMap(),
- m_ColorMapIterator()
+ m_ColorMapIterator(),
+ m_UseGLSL(false)
{
// Fill color map
// Sources for some colors value: http://prideout.net/archive/colors.php"
@@ -91,10 +92,7 @@ void IceViewer::AddImage(const std::string& fname, const std::string& key, const
otb::GlImageActor::Pointer actor = otb::GlImageActor::New();
- const char* glVersion = nullptr;
- const char* glslVersion = nullptr;
-
- if (GlVersionChecker::CheckGLCapabilities(glVersion, glslVersion))
+ if( m_UseGLSL)
actor->CreateShader();
actor->Initialize(fname);
@@ -171,7 +169,9 @@ void IceViewer::AddVector(const std::string& fname, const std::string& key, cons
m_ColorMapIterator = m_ColorMap.begin();
}
- m_View->AddActor(actor, key);
+ actor->CreateShader();
+
+ m_View->AddActor(actor,key);
// Add other layers if the dataset contains some
std::vector layers = actor->GetAvailableLayers();
@@ -253,7 +253,11 @@ void IceViewer::Initialize(unsigned int w, unsigned int h, const std::string& na
// Create view
m_View = GlView::New();
- m_View->Initialize(w, h);
+ m_View->Initialize(w,h);
+
+ const char * glVersion = nullptr;
+ const char * glslVersion = nullptr;
+ m_UseGLSL = m_View->CheckGLCapabilities(glVersion, glslVersion);
}
void IceViewer::Refresh()
@@ -1197,12 +1201,15 @@ void IceViewer::key_callback(GLFWwindow* window, int key, int scancode, int acti
roiActor->SetFill(true);
roiActor->SetAlpha(0.2);
- m_View->AddActor(roiActor, tmpKey);
- m_View->MoveActorToEndOfRenderingOrder(tmpKey, true);
- }
-
- else if (action == GLFW_RELEASE)
- {
+ if (m_UseGLSL)
+ roiActor->CreateShader();
+
+ m_View->AddActor(roiActor,tmpKey);
+ m_View->MoveActorToEndOfRenderingOrder(tmpKey,true);
+ }
+
+ else if(action == GLFW_RELEASE)
+ {
m_View->RemoveActor(tmpKey);
}
}
diff --git a/Modules/Visualization/Monteverdi/include/mvdMainWindow.h b/Modules/Visualization/Monteverdi/include/mvdMainWindow.h
index 1263a3ea064b881530b10f6a01e625c81a21f973..07d822831f7efb30937e207093ded8ac6dc9b66d 100644
--- a/Modules/Visualization/Monteverdi/include/mvdMainWindow.h
+++ b/Modules/Visualization/Monteverdi/include/mvdMainWindow.h
@@ -415,7 +415,6 @@ private:
/**
*/
- bool m_isGLSLAvailable : 1;
bool m_ForceNoGLSL : 1;
/*-[ PRIVATE SLOTS SECTION ]-----------------------------------------------*/
diff --git a/Modules/Visualization/Monteverdi/src/main.cxx b/Modules/Visualization/Monteverdi/src/main.cxx
index 387467c1708ddcd1e61480f2c0470c555e4cc9e8..54ace4cd358171158da5fd27192143bfc639187a 100644
--- a/Modules/Visualization/Monteverdi/src/main.cxx
+++ b/Modules/Visualization/Monteverdi/src/main.cxx
@@ -207,7 +207,10 @@ int main(int argc, char* argv[])
//
// 4. Check OpenGL capabilities
- if (!mainWindow.CheckGLCapabilities(flags.forceNoGLSL))
+#if OTB_DEBUG
+ std::cout << "mainWindow.CheckGLCapabilities();" << std::endl;
+#endif
+ if( !mainWindow.CheckGLCapabilities( flags.forceNoGLSL ) )
return ERROR_CODE_GL_VERSION;
//
@@ -223,7 +226,10 @@ int main(int argc, char* argv[])
// 6. Load command-line filenames.
args.pop_front();
- mainWindow.ImportImages(args, !flags.forceNoOverviews);
+#if OTB_DEBUG
+ std::cout << "mainWindow.ImportImages();" << std::endl;
+#endif
+ mainWindow.ImportImages( args, !flags.forceNoOverviews );
//
// 6. Let's go: run the application and return exit code.
diff --git a/Modules/Visualization/Monteverdi/src/mvdMainWindow.cxx b/Modules/Visualization/Monteverdi/src/mvdMainWindow.cxx
index 70cc40d7385042919bbbac611b7ad155aae9d48d..04da0283797399768f2ab5dcd81b54e874a9400d 100644
--- a/Modules/Visualization/Monteverdi/src/mvdMainWindow.cxx
+++ b/Modules/Visualization/Monteverdi/src/mvdMainWindow.cxx
@@ -104,7 +104,6 @@ namespace mvd
Context comment for translator.
*/
-
/*****************************************************************************/
/* CONSTANTS */
@@ -135,16 +134,16 @@ MainWindow::MainWindow(QWidget* p, Qt::WindowFlags flags)
#if defined(OTB_USE_QT) && USE_OTB_APPS
m_OtbApplicationsBrowserDock(NULL),
#endif
- m_ImageView(NULL),
- m_QuicklookViewDock(NULL),
- m_StatusBarWidget(NULL),
- m_ShaderWidget(NULL),
- m_FilenameDragAndDropEventFilter(NULL),
- m_KeymapDialog(NULL),
- m_ProjectionBarWidget(NULL),
- m_GLSL140(-2),
- m_isGLSLAvailable(false),
- m_ForceNoGLSL(false)
+ m_ImageView( NULL ),
+ m_QuicklookViewDock( NULL ),
+ m_StatusBarWidget( NULL ),
+ m_ShaderWidget( NULL ),
+ m_FilenameDragAndDropEventFilter( NULL ),
+ m_KeymapDialog( NULL ),
+ m_ProjectionBarWidget( NULL ),
+ m_GLSL140( -2 ),
+ // m_isGLSLAvailable( false ),
+ m_ForceNoGLSL( false )
{
m_UI->setupUi(this);
@@ -171,8 +170,8 @@ MainWindow::~MainWindow()
/*****************************************************************************/
bool MainWindow::CheckGLCapabilities(bool forceNoGLSL)
{
- assert(m_ImageView != NULL);
- assert(m_ImageView->GetRenderer() != NULL);
+ assert( m_ImageView );
+ assert( m_ImageView->GetRenderer() );
// Coverity-19845
//
@@ -180,7 +179,17 @@ bool MainWindow::CheckGLCapabilities(bool forceNoGLSL)
// m_ImageView->GetRenderer()==NULL )
// return false;
- m_isGLSLAvailable = m_ImageView->GetRenderer()->CheckGLCapabilities(&m_GLSL140);
+ int glsl140 = 0;
+
+ bool isGLSLAvailable =
+ m_ImageView->CheckGLCapabilities( &glsl140 );
+
+ assert( GetQuicklookView() );
+
+ int glsl140QL = 0;
+
+ bool isGLSLAvailableQL =
+ GetQuicklookView()->CheckGLCapabilities( &glsl140QL );
#if FORCE_NO_GLSL
qWarning() << "No-GLSL is always forced in this build!";
@@ -192,7 +201,9 @@ bool MainWindow::CheckGLCapabilities(bool forceNoGLSL)
#endif // FORCE_NO_GLSL
- bool isGLSL = m_isGLSLAvailable && !m_ForceNoGLSL;
+ bool isAvailable = isGLSLAvailable && isGLSLAvailableQL;
+
+ bool isEnabled = isAvailable && !m_ForceNoGLSL;
{
assert(m_UI != NULL);
@@ -200,15 +211,15 @@ bool MainWindow::CheckGLCapabilities(bool forceNoGLSL)
bool isBlocked = m_UI->action_GLSL->blockSignals(true);
- m_UI->action_GLSL->setEnabled(m_isGLSLAvailable);
- m_UI->action_GLSL->setChecked(isGLSL);
+ m_UI->action_GLSL->setEnabled( isAvailable );
+ m_UI->action_GLSL->setChecked( isEnabled );
m_UI->action_GLSL->blockSignals(isBlocked);
}
- SetGLSLEnabled(isGLSL);
+ SetGLSLEnabled( isEnabled );
- return (!m_isGLSLAvailable || m_ForceNoGLSL) || m_isGLSLAvailable;
+ return ( !isAvailable || m_ForceNoGLSL ) || isGLSLAvailable;
}
/*****************************************************************************/
@@ -216,58 +227,32 @@ void MainWindow::SetGLSLEnabled(bool enabled)
{
//
// Image view
- {
- assert(m_ImageView != NULL);
-
- AbstractImageViewRenderer* renderer = m_ImageView->GetRenderer();
+ assert( m_ImageView );
- assert(renderer != NULL);
-
- if (renderer->SetGLSLEnabled(enabled) != enabled)
- {
- renderer->ClearScene(true);
- renderer->UpdateScene();
-
- m_ImageView->updateGL();
- }
- }
+ bool glslEnabled =
+ m_ImageView->SetGLSLEnabled( !m_ForceNoGLSL && enabled );
- {
- ImageViewWidget* quicklookView = GetQuicklookView();
- assert(quicklookView != NULL);
-
- // MANTIS-1204
- // {
- //
- // Forward GLSL state to quicklook view.
- assert(GetQuicklookView()->GetRenderer() != NULL);
-
- AbstractImageViewRenderer* renderer = quicklookView->GetRenderer();
-
- assert(renderer != NULL);
-
- if (renderer->SetGLSLEnabled(enabled) != enabled)
- {
- renderer->ClearScene(true);
- renderer->UpdateScene();
+ // MANTIS-1204
+ // {
+ //
+ // Forward GLSL state to quicklook view.
+ assert( GetQuicklookView() );
- quicklookView->updateGL();
- }
- // }
- }
+ glslEnabled =
+ GetQuicklookView()->SetGLSLEnabled( glslEnabled );
//
// Shader widget
- assert(m_ShaderWidget != NULL);
+ assert( m_ShaderWidget );
- m_ShaderWidget->SetGLSLEnabled(enabled);
- m_ShaderWidget->SetGLSL140Enabled(m_GLSL140 >= 0);
+ m_ShaderWidget->SetGLSLEnabled( glslEnabled );
+ m_ShaderWidget->SetGLSL140Enabled( m_GLSL140>=0 );
//
// Status bar widget.
- assert(m_StatusBarWidget != NULL);
+ assert( m_StatusBarWidget );
- m_StatusBarWidget->SetGLSLEnabled(enabled);
+ m_StatusBarWidget->SetGLSLEnabled( glslEnabled );
//
// Paint
@@ -1215,7 +1200,7 @@ void MainWindow::on_action_GLSL_triggered(bool checked)
{
// qDebug() << this << "::on_action_GLSL_triggered(" << checked << ")";
- SetGLSLEnabled(m_isGLSLAvailable && !m_ForceNoGLSL && checked);
+ SetGLSLEnabled(checked);
}
/*****************************************************************************/
diff --git a/Modules/Visualization/MonteverdiGui/include/mvdAbstractImageViewRenderer.h b/Modules/Visualization/MonteverdiGui/include/mvdAbstractImageViewRenderer.h
index 8f7884c8eb60638cd32e842bda605a6c574ab847..dc368bccbd5ecd214e319d9ee2efbc84acc38eb9 100644
--- a/Modules/Visualization/MonteverdiGui/include/mvdAbstractImageViewRenderer.h
+++ b/Modules/Visualization/MonteverdiGui/include/mvdAbstractImageViewRenderer.h
@@ -137,7 +137,7 @@ public:
/**
*/
- virtual bool CheckGLCapabilities(int*) = 0;
+ virtual bool CheckGLCapabilities( int * ) const =0;
template
const T* GetReferenceModel() const;
@@ -209,10 +209,13 @@ public:
inline bool IsBypassRenderingEnabled() const;
/**
*/
- inline bool SetGLSLEnabled(bool);
+ virtual bool IsGLSLAvailable() const noexcept = 0;
/**
*/
- inline bool IsGLSLEnabled() const;
+ virtual bool SetGLSLEnabled( bool ) = 0;
+ /**
+ */
+ virtual bool IsGLSLEnabled() const noexcept = 0;
/**
*/
virtual bool IsEffectsEnabled() const = 0;
@@ -253,7 +256,10 @@ protected:
/**
* Constructor.
*/
- AbstractImageViewRenderer(QObject* p = NULL) : QObject(p), m_StackedLayerModel(NULL), m_BypassRenderingEnabled(false), m_GLSLEnabled(true)
+ AbstractImageViewRenderer( QObject* p = NULL ) :
+ QObject( p ),
+ m_StackedLayerModel( NULL ),
+ m_BypassRenderingEnabled( false )
{
}
@@ -286,22 +292,24 @@ private:
/**
*/
- virtual bool virtual_ZoomToRegion(const PointType&, const PointType&, PointType&, SpacingType&) const
- {
- return false;
- }
+ virtual bool virtual_ZoomToRegion( const PointType &,
+ const PointType &,
+ PointType &,
+ SpacingType & ) const
+ { return false; }
+
/**
*/
- virtual bool virtual_ZoomToExtent(PointType&, SpacingType&) const
- {
- return false;
- }
+ virtual bool virtual_ZoomToExtent( PointType &, SpacingType & ) const
+ { return false; }
+
/**
*/
- virtual bool virtual_ZoomToLayer(const StackedLayerModel::KeyType&, PointType&, SpacingType&) const
- {
- return false;
- }
+ virtual bool virtual_ZoomToLayer( const StackedLayerModel::KeyType &,
+ PointType &,
+ SpacingType & ) const
+ { return false; }
+
/**
*/
virtual bool virtual_ZoomToFull(const StackedLayerModel::KeyType&, PointType&, SpacingType&) const
@@ -320,7 +328,6 @@ private:
bool m_BypassRenderingEnabled : 1;
/**
*/
- bool m_GLSLEnabled : 1;
/*-[ PRIVATE SLOTS SECTION ]-----------------------------------------------*/
@@ -391,22 +398,6 @@ inline bool AbstractImageViewRenderer::SetBypassRenderingEnabled(bool isEnabled)
return bypass;
}
-/*****************************************************************************/
-inline bool AbstractImageViewRenderer::IsGLSLEnabled() const
-{
- return m_GLSLEnabled;
-}
-
-/*****************************************************************************/
-inline bool AbstractImageViewRenderer::SetGLSLEnabled(bool isEnabled)
-{
- bool wasEnabled = m_GLSLEnabled;
-
- m_GLSLEnabled = isEnabled;
-
- return wasEnabled;
-}
-
/*****************************************************************************/
inline void AbstractImageViewRenderer::ClearScene(bool keepViewport)
{
diff --git a/Modules/Visualization/MonteverdiGui/include/mvdImageViewRenderer.h b/Modules/Visualization/MonteverdiGui/include/mvdImageViewRenderer.h
index 0084da8ee9235e2e18a59a41da9eb614954d193b..c2f61ecbefa221dea6392f8357e0d61007962198 100644
--- a/Modules/Visualization/MonteverdiGui/include/mvdImageViewRenderer.h
+++ b/Modules/Visualization/MonteverdiGui/include/mvdImageViewRenderer.h
@@ -137,7 +137,7 @@ public:
/**
*/
- bool CheckGLCapabilities(int*) override;
+ bool CheckGLCapabilities( int * ) const override;
/**
*/
@@ -161,14 +161,12 @@ public:
void GetViewExtent(PointType& origin, PointType& extent) const override;
-
AbstractImageViewRenderer::RenderingContext* NewRenderingContext() const override;
void InitializeGL() override;
void ResizeGL(int width, int height) override;
-
void PaintGL(const AbstractImageViewRenderer::RenderingContext* context) override;
void Pick(const PointType& view, PixelInfo::Vector& pixels) const override;
@@ -183,6 +181,12 @@ public:
bool IsEffectsEnabled() const override;
+ bool IsGLSLAvailable() const noexcept override;
+
+ bool SetGLSLEnabled( bool ) override;
+
+ bool IsGLSLEnabled() const noexcept override;
+
/*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/
// public slots
diff --git a/Modules/Visualization/MonteverdiGui/include/mvdImageViewWidget.h b/Modules/Visualization/MonteverdiGui/include/mvdImageViewWidget.h
index 2e50768a4f9dec7d58e61f33bacb84f4c8e3e903..98ed49b6111390c3787d73d9c54f8093b1a8b75e 100644
--- a/Modules/Visualization/MonteverdiGui/include/mvdImageViewWidget.h
+++ b/Modules/Visualization/MonteverdiGui/include/mvdImageViewWidget.h
@@ -155,11 +155,21 @@ public:
*/
bool IsPickingEnabled() const;
+ /**
+ */
+ bool CheckGLCapabilities( int * );
+
/*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/
//
// Public SLOTS.
public slots:
+ /**
+ */
+ bool SetGLSLEnabled( bool ) noexcept;
+ /**
+ */
+ void ClearScene( bool );
/**
*/
void UpdateScene();
diff --git a/Modules/Visualization/MonteverdiGui/src/mvdImageViewRenderer.cxx b/Modules/Visualization/MonteverdiGui/src/mvdImageViewRenderer.cxx
index 3ab463ecbaabb8361ced5c7f67a4b2a4a4a04aea..3a30083d3c8fe3d1fccbe217bada8c0729e0b2ce 100644
--- a/Modules/Visualization/MonteverdiGui/src/mvdImageViewRenderer.cxx
+++ b/Modules/Visualization/MonteverdiGui/src/mvdImageViewRenderer.cxx
@@ -125,7 +125,9 @@ ImageViewRenderer::~ImageViewRenderer()
}
/*****************************************************************************/
-bool ImageViewRenderer::CheckGLCapabilities(int* glsl140)
+bool
+ImageViewRenderer
+::CheckGLCapabilities( int * glsl140 ) const
{
#if USE_REMOTE_DESKTOP_DISABLED_RENDERING
return true;
@@ -134,10 +136,12 @@ bool ImageViewRenderer::CheckGLCapabilities(int* glsl140)
//
// Trace required OpenGL and GLSL versions.
- qWarning() << ToStdString(tr("Required OpenGL version '%1' with GLSL version '%2'.")
- .arg(otb::GlVersionChecker::REQUIRED_GL_VERSION)
- .arg(otb::GlVersionChecker::REQUIRED_GLSL_VERSION))
- .c_str();
+ qWarning() <<
+ ToStdString(
+ tr( "Required OpenGL version '%1' with GLSL version '%2'." )
+ .arg( otb::GlVersionChecker::REQUIRED_GL_VERSION )
+ .arg( otb::GlVersionChecker::REQUIRED_GLSL_VERSION )
+ ).c_str();
//
// Get and check OpenGL and GLSL versions.
@@ -145,28 +149,37 @@ bool ImageViewRenderer::CheckGLCapabilities(int* glsl140)
const char* glVersion = NULL;
const char* glslVersion = NULL;
+ assert( !m_GlView.IsNull() );
+
bool isOk = false;
try
{
- isOk = otb::GlVersionChecker::CheckGLCapabilities(glVersion, glslVersion);
+ std::size_t glslVer = m_GlView->CheckGLCapabilities( glVersion, glslVersion );
+
+ isOk = glslVer>0;
if (glsl140 != NULL)
*glsl140 = otb::GlVersionChecker::VerCmp(glslVersion, "1.40");
//
// Trace runtime OpenGL and GLSL versions.
- qWarning() << ToStdString(tr("Runtime OpenGL version '%1' with GLSL version '%2'.").arg(glVersion).arg(glslVersion)).c_str();
+ qWarning() <<
+ ToStdString(
+ tr( "Runtime OpenGL version '%1' with GLSL version '%2'." )
+ .arg( glVersion )
+ .arg( glslVersion )
+ ).c_str();
}
- catch (std::exception& exc)
+ catch( std::exception& exc )
{
- QMessageBox::critical(qobject_cast(parent()), tr("Critical error!"), ToQString(exc.what()));
+ QMessageBox::critical(
+ qobject_cast< QWidget* >( parent() ),
+ tr( "Critical error!"),
+ ToQString( exc.what() )
+ );
}
- //
- // Set GLSL effects state.
- SetGLSLEnabled(isOk);
-
//
// Return if check has succeeded.
if (isOk)
@@ -174,14 +187,19 @@ bool ImageViewRenderer::CheckGLCapabilities(int* glsl140)
//
// Construct message.
- QString message(tr("Current OpenGL version is '%1' supporting OpenGL Shading-Language (GLSL) version '%2'.\nTo run at best performances, this application "
- "needs, at least, OpenGL version '%3' with GLSL version '%4'.\nThe application will automatically switch to a rendering mode which does "
- "not make use of OpenGL shaders and GLSL.\nIf you are running this application under some remote-desktop service, runtime OpenGL and GLSL "
- "versions may differ from those running directly on remote platform.")
- .arg(glVersion)
- .arg(glslVersion)
- .arg(otb::GlVersionChecker::REQUIRED_GL_VERSION)
- .arg(otb::GlVersionChecker::REQUIRED_GLSL_VERSION));
+ QString message(
+ tr( "Current OpenGL version is '%1' supporting OpenGL Shading-Language "
+ "(GLSL) version '%2'.\nTo run at best performances, this application "
+ "needs, at least, OpenGL version '%3' with GLSL version '%4'.\nThe "
+ "application will automatically switch to a rendering mode which does "
+ "not make use of OpenGL shaders and GLSL.\nIf you are running this "
+ "application under some remote-desktop service, runtime OpenGL and GLSL "
+ "versions may differ from those running directly on remote platform." )
+ .arg( glVersion )
+ .arg( glslVersion )
+ .arg( otb::GlVersionChecker::REQUIRED_GL_VERSION )
+ .arg( otb::GlVersionChecker::REQUIRED_GLSL_VERSION )
+ );
//
// Warn user is check has failed.
@@ -192,7 +210,7 @@ bool ImageViewRenderer::CheckGLCapabilities(int* glsl140)
qobject_cast< QWidget* >( parent() ),
tr( "Critical error!" ),
message
- );
+ );
#endif
//
@@ -615,35 +633,37 @@ void ImageViewRenderer::UpdateActors(const AbstractImageViewRenderer::RenderingC
//
// Must use local variable to cast from T* to T::Pointer because
// of ITK set/get macros...
- otb::FragmentShader::Pointer fragmentShader(imageActor->GetShader());
-
- if (!fragmentShader.IsNull())
- {
- // If this point is reached, shader is not null which means
- // that isGLSLEnabled() is true.
- assert(IsGLSLEnabled());
-
- otb::StandardShader::Pointer shader(otb::DynamicCast(fragmentShader));
-
- assert(!shader.IsNull());
-
- if (m_EffectsEnabled)
- switch (settings.GetEffect())
- {
- case EFFECT_CHESSBOARD:
- shader->SetShaderType(otb::SHADER_ALPHA_GRID);
- shader->SetChessboardSize(settings.GetSize());
- break;
-
- case EFFECT_GRADIENT:
- shader->SetShaderType(otb::SHADER_GRADIENT);
- shader->SetRadius(settings.GetSize());
- break;
-
- case EFFECT_LOCAL_CONTRAST:
- shader->SetShaderType(otb::SHADER_LOCAL_CONTRAST);
- shader->SetRadius(settings.GetSize());
- shader->SetLocalContrastRange(
+ otb::Shader::Pointer imageShader( imageActor->GetShader() );
+
+ if( !imageShader.IsNull() )
+ {
+ // If this point is reached, imageShader is not null which means
+ // that isGLSLEnabled() is true.
+ assert( IsGLSLEnabled() );
+
+ otb::StandardShader::Pointer shader(
+ otb::DynamicCast< otb::StandardShader >( imageShader )
+ );
+
+ assert( !shader.IsNull() );
+
+ if( m_EffectsEnabled )
+ switch( settings.GetEffect() )
+ {
+ case EFFECT_CHESSBOARD:
+ shader->SetShaderType( otb::SHADER_ALPHA_GRID );
+ shader->SetChessboardSize( settings.GetSize() );
+ break;
+
+ case EFFECT_GRADIENT:
+ shader->SetShaderType( otb::SHADER_GRADIENT );
+ shader->SetRadius( settings.GetSize() );
+ break;
+
+ case EFFECT_LOCAL_CONTRAST:
+ shader->SetShaderType( otb::SHADER_LOCAL_CONTRAST );
+ shader->SetRadius( settings.GetSize() );
+ shader->SetLocalContrastRange(
#if 0
settings.GetValue() *
std::max(
@@ -656,97 +676,100 @@ void ImageViewRenderer::UpdateActors(const AbstractImageViewRenderer::RenderingC
#else
settings.GetValue()
#endif
- );
- break;
+ );
+ break;
- case EFFECT_LOCAL_TRANSLUCENCY:
- shader->SetShaderType(otb::SHADER_LOCAL_ALPHA);
- shader->SetRadius(settings.GetSize());
- break;
+ case EFFECT_LOCAL_TRANSLUCENCY:
+ shader->SetShaderType( otb::SHADER_LOCAL_ALPHA );
+ shader->SetRadius( settings.GetSize() );
+ break;
- case EFFECT_NONE:
- case EFFECT_NORMAL:
- shader->SetShaderType(otb::SHADER_STANDARD);
- break;
+ case EFFECT_NONE:
+ case EFFECT_NORMAL:
+ shader->SetShaderType( otb::SHADER_STANDARD );
+ break;
- case EFFECT_SPECTRAL_ANGLE:
- shader->SetShaderType(otb::SHADER_SPECTRAL_ANGLE);
- shader->SetRadius(settings.GetSize());
- shader->SetSpectralAngleRange(settings.GetValue());
- break;
+ case EFFECT_SPECTRAL_ANGLE:
+ shader->SetShaderType( otb::SHADER_SPECTRAL_ANGLE );
+ shader->SetRadius( settings.GetSize() );
+ shader->SetSpectralAngleRange( settings.GetValue() );
+ break;
- case EFFECT_SWIPE_H:
- shader->SetShaderType(otb::SHADER_ALPHA_SLIDER);
- shader->SetVerticalSlider(false);
- break;
+ case EFFECT_SWIPE_H:
+ shader->SetShaderType( otb::SHADER_ALPHA_SLIDER );
+ shader->SetVerticalSlider( false );
+ break;
- case EFFECT_SWIPE_V:
- shader->SetShaderType(otb::SHADER_ALPHA_SLIDER);
- shader->SetVerticalSlider(true);
- break;
+ case EFFECT_SWIPE_V:
+ shader->SetShaderType( otb::SHADER_ALPHA_SLIDER );
+ shader->SetVerticalSlider( true );
+ break;
- case EFFECT_LUT_JET:
- shader->SetShaderType(otb::SHADER_LUT_JET);
- break;
+ case EFFECT_LUT_JET:
+ shader->SetShaderType(otb::SHADER_LUT_JET);
+ break;
- case EFFECT_LUT_LOCAL_JET:
- shader->SetShaderType(otb::SHADER_LUT_LOCAL_JET);
- shader->SetRadius(settings.GetSize());
- shader->SetLocalContrastRange(settings.GetValue());
+ case EFFECT_LUT_LOCAL_JET:
+ shader->SetShaderType(otb::SHADER_LUT_LOCAL_JET);
+ shader->SetRadius( settings.GetSize() );
+ shader->SetLocalContrastRange(settings.GetValue());
- break;
+ break;
- case EFFECT_LUT_HOT:
- shader->SetShaderType(otb::SHADER_LUT_HOT);
- break;
+ case EFFECT_LUT_HOT:
+ shader->SetShaderType(otb::SHADER_LUT_HOT);
+ break;
- case EFFECT_LUT_LOCAL_HOT:
- shader->SetShaderType(otb::SHADER_LUT_LOCAL_HOT);
- shader->SetRadius(settings.GetSize());
- shader->SetLocalContrastRange(settings.GetValue());
+ case EFFECT_LUT_LOCAL_HOT:
+ shader->SetShaderType(otb::SHADER_LUT_LOCAL_HOT);
+ shader->SetRadius( settings.GetSize() );
+ shader->SetLocalContrastRange(settings.GetValue());
- break;
+ break;
- case EFFECT_LUT_SUMMER:
- shader->SetShaderType(otb::SHADER_LUT_SUMMER);
- break;
+ case EFFECT_LUT_SUMMER:
+ shader->SetShaderType(otb::SHADER_LUT_SUMMER);
+ break;
- case EFFECT_LUT_LOCAL_SUMMER:
- shader->SetShaderType(otb::SHADER_LUT_LOCAL_SUMMER);
- shader->SetRadius(settings.GetSize());
- shader->SetLocalContrastRange(settings.GetValue());
+ case EFFECT_LUT_LOCAL_SUMMER:
+ shader->SetShaderType(otb::SHADER_LUT_LOCAL_SUMMER);
+ shader->SetRadius( settings.GetSize() );
+ shader->SetLocalContrastRange(settings.GetValue());
- break;
+ break;
- case EFFECT_LUT_WINTER:
- shader->SetShaderType(otb::SHADER_LUT_WINTER);
- break;
+ case EFFECT_LUT_WINTER:
+ shader->SetShaderType(otb::SHADER_LUT_WINTER);
+ break;
- case EFFECT_LUT_LOCAL_WINTER:
- shader->SetShaderType(otb::SHADER_LUT_LOCAL_WINTER);
- shader->SetRadius(settings.GetSize());
- shader->SetLocalContrastRange(settings.GetValue());
+ case EFFECT_LUT_LOCAL_WINTER:
+ shader->SetShaderType(otb::SHADER_LUT_LOCAL_WINTER);
+ shader->SetRadius( settings.GetSize() );
+ shader->SetLocalContrastRange(settings.GetValue());
- break;
+ break;
- case EFFECT_LUT_COOL:
- shader->SetShaderType(otb::SHADER_LUT_COOL);
- break;
+ case EFFECT_LUT_COOL:
+ shader->SetShaderType(otb::SHADER_LUT_COOL);
+ break;
- case EFFECT_LUT_LOCAL_COOL:
- shader->SetShaderType(otb::SHADER_LUT_LOCAL_COOL);
- shader->SetRadius(settings.GetSize());
- shader->SetLocalContrastRange(settings.GetValue());
+ case EFFECT_LUT_LOCAL_COOL:
+ shader->SetShaderType(otb::SHADER_LUT_LOCAL_COOL);
+ shader->SetRadius( settings.GetSize() );
+ shader->SetLocalContrastRange(settings.GetValue());
- break;
+ break;
- default:
- assert(false && "Unhandled mvd::Effect value!");
- break;
- }
- }
- }
+
+
+
+ default:
+ assert( false && "Unhandled mvd::Effect value!" );
+ break;
+ }
+ }
+ }
//
else
{
@@ -805,30 +828,33 @@ void ImageViewRenderer::virtual_UpdateScene()
else
{
{
- otb::GlView::StringVectorType keys(m_GlView->GetActorsKeys());
-
- for (otb::GlView::StringVectorType::const_iterator it(keys.begin()); it != keys.end(); ++it)
- if (!stackedLayerModel->Contains(*it))
- {
- // qDebug()
- // << QString( "Removing image-actor '%1'..." ).arg( it->c_str() );
-
- m_GlView->RemoveActor(*it);
- }
+ otb::GlView::StringVectorType keys( m_GlView->GetActorsKeys() );
+
+ for( otb::GlView::StringVectorType::const_iterator it( keys.begin() );
+ it!=keys.end();
+ ++it )
+ if( !stackedLayerModel->Contains( *it ) )
+ {
+ // qDebug()
+ // << QString( "Removing image-actor '%1'..." ).arg( it->c_str() );
+
+ m_GlView->RemoveActor( *it );
+ }
}
-
#if USE_REMOTE_DESKTOP_DISABLED_RENDERING
#else // USE_REMOTE_DESKTOP_DISABLED_RENDERING
- for (StackedLayerModel::ConstIterator it(stackedLayerModel->Begin()); it != stackedLayerModel->End(); ++it)
- if (!m_GlView->ContainsActor(it->first))
+ for( StackedLayerModel::ConstIterator it( stackedLayerModel->Begin() );
+ it!=stackedLayerModel->End();
+ ++it )
+ if( !m_GlView->ContainsActor( it->first ) )
{
- assert(it->second != NULL);
+ assert( it->second!=NULL );
- if (it->second->inherits(VectorImageModel::staticMetaObject.className()))
- {
- otb::GlImageActor::Pointer glImageActor(otb::GlImageActor::New());
+ if( it->second->inherits( VectorImageModel::staticMetaObject.className()))
+ {
+ otb::GlImageActor::Pointer glImageActor( otb::GlImageActor::New() );
// Should all AbstractLayerModel have a ::GetFilename()
// method?
@@ -850,22 +876,27 @@ void ImageViewRenderer::virtual_UpdateScene()
// << "\tQString:" << vectorImageModel->GetFilename()
// << "\tstd::string" << QFile::encodeName( vectorImageModel->GetFilename() );
- if (IsGLSLEnabled())
+ if(IsGLSLEnabled())
{
// qDebug() << "Created shader for" << FromStdString( it->first );
-
+
glImageActor->CreateShader();
}
- glImageActor->Initialize(QFile::encodeName(vectorImageModel->GetFilename()).constData());
+ glImageActor->Initialize(
+ QFile::encodeName(
+ vectorImageModel->GetFilename()
+ )
+ .constData()
+ );
m_GlView->AddActor(glImageActor, it->first);
// qDebug() <<
- // QString( "Added image-actor '%1' from file '%2'" )
- // .arg( FromStdString( it->first ) )
- // .arg( vectorImageModel->GetFilename() );
- }
+ // QString( "Added image-actor '%1' from file '%2'" )
+ // .arg( FromStdString( it->first ) )
+ // .arg( vectorImageModel->GetFilename() );
+ }
else
{
assert(false && "Unhandled AbstractLayerModel derived type.");
@@ -1074,32 +1105,43 @@ void ImageViewRenderer::UpdatePixelInfo(const QPoint& screen, const PointType& /
//
// Get shader.
- otb::FragmentShader::Pointer fshader(glImageActor->GetShader());
+ otb::Shader::Pointer ishader( glImageActor->GetShader() );
- if (!fshader.IsNull())
+ if(!ishader.IsNull())
{
- otb::StandardShader::Pointer shader(otb::DynamicCast(fshader));
-
- assert(!shader.IsNull());
-
- //
- // Update cursor position of shader.
- PointType p_screen;
-
- assert(m_GlView->GetSettings() != NULL);
-
- p_screen[0] = screen.x();
- p_screen[1] = m_GlView->GetSettings()->GetViewportSize()[1] - screen.y();
-
- // qDebug()
- // << "otb::StandardShader::SetCenter("
- // << p_screen[ 0 ] << "," << p_screen[ 1 ]
- // << ")";
-
- shader->SetCenter(p_screen);
-
- if (shader->GetShaderType() == otb::SHADER_ALPHA_SLIDER)
- shader->SetSliderPosition(p_screen[shader->GetVerticalSlider() ? 1 : 0]);
+ otb::StandardShader::Pointer shader(
+ otb::DynamicCast< otb::StandardShader >(
+ ishader
+ )
+ );
+
+ assert( !shader.IsNull() );
+
+ //
+ // Update cursor position of shader.
+ PointType p_screen;
+
+ assert( m_GlView->GetSettings()!=NULL );
+
+ p_screen[ 0 ] = screen.x();
+ p_screen[ 1 ] =
+ m_GlView->GetSettings()->GetViewportSize()[ 1 ] - screen.y();
+
+ // qDebug()
+ // << "otb::StandardShader::SetCenter("
+ // << p_screen[ 0 ] << "," << p_screen[ 1 ]
+ // << ")";
+
+ shader->SetCenter( p_screen );
+
+ if( shader->GetShaderType()==otb::SHADER_ALPHA_SLIDER )
+ shader->SetSliderPosition(
+ p_screen[
+ shader->GetVerticalSlider()
+ ? 1
+ : 0
+ ]
+ );
}
}
}
@@ -1154,5 +1196,41 @@ bool ImageViewRenderer::virtual_ZoomToFull(const StackedLayerModel::KeyType& key
return m_GlView->ZoomToFull(key, center, spacing);
}
+/******************************************************************************/
+bool
+ImageViewRenderer
+::IsGLSLAvailable() const noexcept
+{
+ assert( !m_GlView.IsNull() );
+
+ return m_GlView->IsGLSLAvailable();
+}
+
+/******************************************************************************/
+bool
+ImageViewRenderer
+::IsGLSLEnabled() const noexcept
+{
+ assert( !m_GlView.IsNull() );
+
+ return m_GlView->IsGLSLEnabled();
+}
+
+/******************************************************************************/
+bool
+ImageViewRenderer
+::SetGLSLEnabled( bool isEnabled )
+{
+ assert( !m_GlView.IsNull() );
+
+ bool wasGLSLEnabled = m_GlView->IsGLSLEnabled();
+
+ assert( m_GlView->IsEmpty() );
+
+ m_GlView->SetGLSLEnabled( isEnabled );
+
+ return wasGLSLEnabled;
+}
+
/******************************************************************************/
} // end namespace 'mvd'
diff --git a/Modules/Visualization/MonteverdiGui/src/mvdImageViewWidget.cxx b/Modules/Visualization/MonteverdiGui/src/mvdImageViewWidget.cxx
index 47ed7d7fefc180a325d849b35dd89d7bbf0fa3fa..02c9efce197615eaf0124a66f75b1a36237ef7c6 100644
--- a/Modules/Visualization/MonteverdiGui/src/mvdImageViewWidget.cxx
+++ b/Modules/Visualization/MonteverdiGui/src/mvdImageViewWidget.cxx
@@ -28,6 +28,7 @@
//
// Qt includes (sorted by alphabetic order)
//// Must be included before system/custom includes.
+#include
//
// System includes (sorted by alphabetic order)
@@ -184,6 +185,8 @@ void ImageViewWidget::SetLayerStack(StackedLayerModel* stackedLayerModel)
// Set projection parameters of manipulator from layer data.
OnSetProjectionRequired();
+ makeCurrent();
+
// Insert image-models into image-view renderer.
m_Renderer->SetLayerStack(stackedLayerModel);
@@ -716,17 +719,42 @@ void ImageViewWidget::ListGlVersions() const
.constData();
#else
- qWarning()
- << tr("Runtime version of OpenGL used by Qt %1: %2.%3.").arg(qVersion()).arg(format().majorVersion()).arg(format().minorVersion()).toLatin1().constData();
+ qWarning() <<
+ tr( "Runtime version of OpenGL used by Qt %1: %2.%3." )
+ .arg( qVersion() )
+ .arg( format().majorVersion() )
+ .arg( format().minorVersion() )
+ .toLatin1()
+ .constData();
+
+ switch( format().profile() )
+ {
+ case QGLFormat::NoProfile:
+ qWarning() << "QGLFormat::NoProfile";
+ break;
- QGLFormat::OpenGLVersionFlags glVersionFlags(QGLFormat::openGLVersionFlags());
+ case QGLFormat::CoreProfile:
+ qWarning() << "QGLFormat::CoreProfile";
+ break;
+
+ case QGLFormat::CompatibilityProfile:
+ qWarning() << "QGLFormat::CompatibilityProfile";
+ break;
+
+ default:
+ assert( false && "Unexpected QGLFormat::profile()." );
+ break;
+ }
+
+ QGLFormat::OpenGLVersionFlags glVersionFlags(
+ QGLFormat::openGLVersionFlags()
+ );
qWarning() << tr("Version(s) of OpenGL supported by Qt %1:").arg(qVersion()).toLatin1().constData();
if (glVersionFlags & QGLFormat::OpenGL_Version_4_0)
qWarning() << "QGLFormat::OpenGL_Version_4_0";
-
- if (glVersionFlags & QGLFormat::OpenGL_Version_3_3)
+ if(glVersionFlags & QGLFormat::OpenGL_Version_3_3)
qWarning() << "- QGLFormat::OpenGL_Version_3_3";
if (glVersionFlags & QGLFormat::OpenGL_Version_3_2)
qWarning() << "- QGLFormat::OpenGL_Version_3_2";
@@ -734,13 +762,11 @@ void ImageViewWidget::ListGlVersions() const
qWarning() << "- QGLFormat::OpenGL_Version_3_1";
if (glVersionFlags & QGLFormat::OpenGL_Version_3_0)
qWarning() << "- QGLFormat::OpenGL_Version_3_0";
-
- if (glVersionFlags & QGLFormat::OpenGL_Version_2_1)
+ if(glVersionFlags & QGLFormat::OpenGL_Version_2_1)
qWarning() << "- QGLFormat::OpenGL_Version_2_1";
if (glVersionFlags & QGLFormat::OpenGL_Version_2_0)
qWarning() << "- QGLFormat::OpenGL_Version_2_0";
-
- if (glVersionFlags & QGLFormat::OpenGL_Version_1_5)
+ if(glVersionFlags & QGLFormat::OpenGL_Version_1_5)
qWarning() << "- QGLFormat::OpenGL_Version_1_5";
if (glVersionFlags & QGLFormat::OpenGL_Version_1_4)
qWarning() << "- QGLFormat::OpenGL_Version_1_4";
@@ -1038,15 +1064,21 @@ void ImageViewWidget::OnApplyAllRequested()
}
}
-void ImageViewWidget::OnResetEffectsRequested()
+/******************************************************************************/
+void
+ImageViewWidget
+::OnResetEffectsRequested()
{
StackedLayerModel* layerStack = m_Renderer->GetLayerStack();
- for (StackedLayerModel::ConstIterator it(layerStack->Begin()); it != layerStack->End(); ++it)
+ for( StackedLayerModel::ConstIterator it( layerStack->Begin() );
+ it!=layerStack->End();
+ ++it )
{
- if (it->second->inherits(VectorImageModel::staticMetaObject.className()))
+ if( it->second->inherits( VectorImageModel::staticMetaObject.className() ) )
{
- VectorImageModel* imageModel = qobject_cast(it->second);
+ VectorImageModel * imageModel =
+ qobject_cast< VectorImageModel * >( it->second );
VectorImageSettings& settings = imageModel->GetSettings();
settings.SetEffect(EFFECT_NORMAL);
@@ -1061,7 +1093,7 @@ void ImageViewWidget::OnClearProjectionRequired()
{
// qDebug() << this << "::OnClearProjectionRequested()";
- assert(m_Manipulator != NULL);
+ assert(m_Manipulator!=NULL);
m_Manipulator->SetWkt(std::string());
m_Manipulator->SetKeywordList(otb::ViewSettings::KeywordListType());
@@ -1086,6 +1118,8 @@ void ImageViewWidget::OnContentChanged()
{
// qDebug() << this << "::OnContentChanged()";
+ makeCurrent();
+
UpdateScene();
if (!ApplyFixedZoomType())
@@ -1097,6 +1131,8 @@ void ImageViewWidget::OnContentReset()
{
// qDebug() << this << "::OnContentReset()";
+ makeCurrent();
+
UpdateScene();
if (!ApplyFixedZoomType())
@@ -1797,8 +1833,9 @@ void ImageViewWidget::SaveScreenshot(bool isQuickMode)
}
}
+ makeCurrent();
- assert(m_Renderer != NULL);
+ assert( m_Renderer!=NULL );
try
{
@@ -1843,7 +1880,6 @@ void ImageViewWidget::OnUpdateGammaRequested(double factor)
assert(m_Renderer != NULL);
-
StackedLayerModel* stackedLayerModel = m_Renderer->GetLayerStack();
assert(stackedLayerModel != NULL);
@@ -1927,7 +1963,63 @@ void ImageViewWidget::OnUpdateProjectionRequired()
}
/******************************************************************************/
-void ImageViewWidget::UpdateScene()
+bool
+ImageViewWidget
+::CheckGLCapabilities( int * glsl140 )
+{
+ assert( m_Renderer );
+
+ makeCurrent();
+
+ return m_Renderer->CheckGLCapabilities( glsl140 );
+}
+
+/******************************************************************************/
+bool
+ImageViewWidget
+::SetGLSLEnabled( bool isEnabled ) noexcept
+{
+ assert( m_Renderer );
+
+ bool glslEnabled = m_Renderer->IsGLSLAvailable() && isEnabled;
+
+ if( m_Renderer->IsGLSLEnabled()==glslEnabled )
+ return m_Renderer->IsGLSLEnabled();
+
+ makeCurrent();
+
+ ClearScene( true );
+
+#if OTB_DEBUG
+ std::cout
+ << "ImageViewRenderer( 0x" << std::hex << m_Renderer << std::dec
+ << " )::SetGLSLEnabled( " << glslEnabled << " )"
+ << std::endl;
+#endif
+
+ m_Renderer->SetGLSLEnabled( glslEnabled );
+
+ UpdateScene();
+
+ updateGL();
+
+ return glslEnabled;
+}
+
+/******************************************************************************/
+void
+ImageViewWidget
+::ClearScene( bool keepViewport )
+{
+ assert( m_Renderer!=NULL );
+
+ m_Renderer->ClearScene( keepViewport );
+}
+
+/******************************************************************************/
+void
+ImageViewWidget
+::UpdateScene()
{
assert(m_Renderer != NULL);
diff --git a/Modules/Visualization/MonteverdiGui/src/mvdQuicklookViewRenderer.cxx b/Modules/Visualization/MonteverdiGui/src/mvdQuicklookViewRenderer.cxx
index 4764accd4b0e7ed33d703592ed6468508b1d50ee..47d3d0cfbee5825a5f974c7eb8b9612ab95c2a01 100644
--- a/Modules/Visualization/MonteverdiGui/src/mvdQuicklookViewRenderer.cxx
+++ b/Modules/Visualization/MonteverdiGui/src/mvdQuicklookViewRenderer.cxx
@@ -147,7 +147,12 @@ void QuicklookViewRenderer::virtual_FinishScene()
return;
#endif
- std::string key(m_GlView->AddActor(m_GlRoiActor, "ROI"));
+ if( IsGLSLEnabled() )
+ {
+ m_GlRoiActor->CreateShader();
+ }
+
+ std::string key( m_GlView->AddActor( m_GlRoiActor, "ROI" ) );
m_GlRoiActor->SetVisible(true);
m_GlRoiActor->SetOverlay(true);
diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h
index 38dceb6ef228fbce858a15a1a513da3cb3a049fb..726055b9cfcc206182e783e945165534efa2751d 100644
--- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h
+++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h
@@ -696,16 +696,16 @@ public:
* to select the image in an InputImageList. */
ImageBaseType::PointType GetImageOrigin(const std::string& key, unsigned int idx = 0);
- /** Get the spacing of the image parameter 'key'. The optional 'idx' allows to
- * select the image in an InputImageList. We use the signed spacing convention. */
+ /** Get the spacing of the image parameter 'key'. The optional 'idx' allows
+ * selecting the image in an InputImageList. We use the signed spacing convention. */
ImageBaseType::SpacingType GetImageSpacing(const std::string& key, unsigned int idx = 0);
- /** Get the size of the image parameter 'key'. The optional 'idx' allows to
- * select the image in an InputImageList. It corresponds to the size of LargestPossibleRegion*/
+ /** Get the size of the image parameter 'key'. The optional 'idx' allows
+ * selecting the image in an InputImageList. It corresponds to the size of LargestPossibleRegion*/
ImageBaseType::SizeType GetImageSize(const std::string& key, unsigned int idx = 0);
/** Get the number of bands in the image parameter 'key'. The optional 'idx'
- * allows to select the image in an InputImageList.*/
+ * allows selecting the image in an InputImageList.*/
unsigned int GetImageNbBands(const std::string& key, unsigned int idx = 0);
/** Get the projection of the image parameter 'key'. The optional 'idx' allows
@@ -713,18 +713,18 @@ public:
std::string GetImageProjection(const std::string& key, unsigned int idx = 0);
/** Get the keywordlist of the image parameter 'key'. The optional 'idx'
- * allows to select the image in an InputImageList.*/
+ * allows selecting the image in an InputImageList.*/
otb::ImageKeywordlist GetImageKeywordlist(const std::string& key, unsigned int idx = 0);
/** Set the requested region on the image parameter 'key' and propagate it.
* The returned value is an estimate of the RAM usage (in Bytes) to process
* this region. It should be assumed that the index of the largest possible
- * region starts at (0,0). The optional 'idx' allows to select the image in
+ * region starts at (0,0). The optional 'idx' allows selecting the image in
* an InputImageList*/
unsigned long PropagateRequestedRegion(const std::string& key, ImageBaseType::RegionType region, unsigned int idx = 0);
/** Get the requested region of the image parameter 'key'. The optional 'idx'
- * allows to select the image in an InputImageList. It should be assumed that
+ * allows selecting the image in an InputImageList. It should be assumed that
* the index of the largest possible region starts at (0,0).*/
ImageBaseType::RegionType GetImageRequestedRegion(const std::string& key, unsigned int idx = 0);
@@ -733,12 +733,12 @@ public:
/** Find out what is the pixel type from an image parameter
* This function assumes that the underlying object is either an otb::Image
- * or an otb::VectorImage. The optional 'idx' allows to access InputImageList.
+ * or an otb::VectorImage. The optional 'idx' allows accessing InputImageList.
*/
ImagePixelType GetImageBasePixelType(const std::string& key, unsigned int idx = 0);
/** Return the image from parameter 'key' as a base type. The optional 'idx'
- * allows to access InputImageList.
+ * allows accessing InputImageList.
*
* Works on parameters:
* \li ParameterType_InputImage
@@ -748,7 +748,7 @@ public:
ImageBaseType* GetParameterImageBase(const std::string& key, unsigned int idx = 0);
/** Set the image in parameter 'key' as a base type. The optional 'idx'
- * allows to access InputImageList.
+ * allows accessing InputImageList.
*
* Works on parameters:
* \li ParameterType_InputImage
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 1fe7839bcb3843932fb77c59b681c2b3041ee6f0..5752f9d0936138979652fd5ae368d1fd3326246f 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -1,3 +1,453 @@
+OTB-v.7.0.0 - Changes since version 6.6.0 (October 29th, 2019)
+----------------------------------------------------------------
+
+Features added:
+
+ * !596: Move Mosaic in OTB by Rémi Cresson
+ * !586: Add a new metadata (azimuthAnxTime) to Sentinel 1 Model by Gaëlle USSEGLIO
+ * !566: Package Python wrappers sources by Guillaume Pasero
+ * !565: Application VectorRegression by Cédric Traizet
+ * !508: New mode (SpotLight) for Cosmo sensor model by Gaëlle USSEGLIO
+ * !487: Refactor XML parameters by Victor Poughon
+ * !470: KMeans input centroids by Cédric Traizet
+ * !468: Design improvements of applications Qt Wrapper by Victor Poughon
+ * !454: Filter mouse wheel event in QComboBox of app parameters by Victor Poughon
+ * !452: ENH: Improve errors messages when loading app fail by Luc Hermitte
+ * !426: ENH: add GeoJSON driver and simplify driver selection by Jordi Inglada
+ * !414: Qgis parameter by Antoine Regimbeau
+ * !405: Logging in python wrapper by Cédric Traizet
+ * !396: Fix issue on reduced OTB-data by Stéphane Albert
+ * !386: New SAR sensor Model (CosmoSkymed) by Gaëlle USSEGLIO
+ * !371: Specify the overlap area for two S1_IW Bursts by Gaëlle USSEGLIO
+ * !370: Add a solar distance parameter in the optical calibration module by Aurélie Emilien
+ * !355: Enhance SARConcatenateBursts by Gaëlle USSEGLIO
+ * !353: Local Rx detector by Cédric Traizet
+ * !344: Number of endmember estimation application by Cédric Traizet
+ * !331: Constexpr in otbMath.h by Manuel Grizonnet
+ * !327: Switch for application connections by Guillaume Pasero
+ * !315: Enhance SARDeburst by Gaëlle USSEGLIO
+ * !310: Add DefaultConstructibleFunctorImageFilter in OTBFunctor module by Julien Michel
+ * !299: Add Functor module with FunctorImageFilter by Julien Michel
+ * !298: ENH : Add metadata to Sentinel 1 Model by Gaëlle USSEGLIO
+ * !290: Named inputs in FunctorImageFilter by Julien Michel
+ * !289: enhance SarSensorModelAdapter by Gaëlle USSEGLIO
+ * !286: Add class probability output for RF classifiers by Jordi Inglada
+ * !241: Implementation of the raster output for Zonalstatistics by Jordi Inglada
+ * !240: ENH: add support for GDAL's ALL_TOUCHED mode by Laurențiu Nicola
+ * !227: REFAC: allow vector/xml/raster output regardless of the input type by Jordi Inglada
+ * !226: ENH: Add option to allow to always trigger otb build step from superbuild tree by Manuel Grizonnet
+ * !223: StreamingStatisticsMapFromLabelImageFilter no data support by Laurențiu Nicola
+ * !222: Zonalstatistics by Rémi Cresson
+ * !191: Parameter Refactoring : String Parameter by Antoine Regimbeau
+ * !184: Resolve "Move otbExternalModuleTemplate repository from GitHub to gitlab.orfeo-toolbox.org" by Manuel Grizonnet
+ * !179: Resolve "Display Pixel type of Image in ReadImageInfo application" by David Youssefi
+ * !176: Resolve "Output time of otbcli applications in minutes, seconds instead of scientific notation" by Emmanuelle Sarrazin
+ * !158: ENH: Add box kernel to morphological operations apps by Laurențiu Nicola
+ * !154: ENH: Allow to compute modulus and phase from 2 bands scalar image by Manuel Grizonnet
+ * !77: Nodata extended filename by @CSSI_OTB
+
+Bugs fixed:
+
+ * !612: Ice OpenGL refactoring by Guillaume Pasero & Stéphane Albert
+ * !605: Resolve "ZonalStatistics app inbv parameter is not taken into account in stats filter" by Julien Michel
+ * !603: BUG: disable non relevant output parameters in zonal statistics depending on the output type chosen by Cédric Traizet
+ * !601: Fix OTB_ADDITIONAL_CACHE by Cédric Traizet
+ * !597: Fix the diapotb remote module by Cédric Traizet
+ * !592: Fix StreamingWarpImageFilter issue with empty region by Julien Michel
+ * !585: Fix PCA in Dimensionality reduction by Cédric Traizet
+ * !583: Revert Merge branch 'bugfix-streamingwarpfilter-empty-region' into 'develop'" by Julien Michel
+ * !576: BUG: fix potential TopologyException in GDAL by Guillaume Pasero
+ * !575: Fix build with Ossim >= 2.8 by Guillaume Pasero
+ * !573: Remove cookbook pdf target by Victor Poughon
+ * !572: Remove CVFold parameter from decision tree classifier in OpenCV 3 by Cédric Traizet
+ * !571: BUG: fix parameter expansion in otbenv by Guillaume Pasero
+ * !570: Packaging tweaks by Guillaume Pasero
+ * !569: Better cleaning of logger objects in the Python Swig wrapper by Cédric Traizet
+ * !568: BUG: files missing to use ENABLE_SHARED in remote modules by Guillaume Pasero
+ * !567: Crash bandmathx by Antoine Regimbeau
+ * !562: Undefined variable in cmake by Antoine Regimbeau
+ * !561: Resolve "PROJ linking to GDAL in Superbuild" by Rashad Kanavath
+ * !557: Do not return empty requested region in case StreamingWarpImageFilter by Julien Michel
+ * !552: Remove false NCLS by Antoine Regimbeau
+ * !549: COMP: master branch of diapotb breaks on windows by Guillaume Pasero
+ * !545: BUG: fix URL in OSMDataToVectorDataGenerator by Victor Poughon
+ * !537: Bug in ExtractROI (radius and extent modes) by Cédric Traizet
+ * !534: DOC: fix missing import & clarify python doc example by Victor Poughon
+ * !530: Resolve "UpdateParameters has to be called manually from the python API" by Victor Poughon
+ * !527: BUG dltest not available on macOS by Guillaume Pasero
+ * !525: BUG #1920: fix Qt 5.10.1 broken link by Guillaume Pasero
+ * !515: Type assertion in OGRFieldWrapper GetValue() by Cédric Traizet
+ * !512: Fix error : Invalid index -1 by Cédric Traizet
+ * !497: Resolve "pipeline containing a BandMath failed" by Victor Poughon
+ * !494: Add virtual descructor to RadiometricIndex abstract base class by Victor Poughon
+ * !490: Missing include in otbStackIndiceFunctor.h by Cédric Traizet
+ * !482: Fix assert in new radiometric indices by Victor Poughon
+ * !480: BUG: remove .Fixup() for GDAL 2.5 compatibility (develop fix) by Victor Poughon
+ * !478: Resolve "Assertion error on Sentinel1 product in debug build" by Victor Poughon
+ * !469: Fix spinbox locale issue (force C locale) by Victor Poughon
+ * !457: COMP: fix parenthesis warning in debug mode by Victor Poughon
+ * !455: Fix name of USE_SYSTEM_QT5 cmake var by Victor Poughon
+ * !453: BUG: sort Shark labels before encoding so that we know the order for the probability image by Jordi Inglada
+ * !450: Patch for S1 localization problems by Gaëlle USSEGLIO
+ * !448: Update mosaic git tag to include the functorImageFilter fix by Cédric Traizet
+ * !444: Fix OTBApplicationOutputImageChanged and ExecutionDone slots not being called by Victor Poughon
+ * !437: Fix assert in DotProductImageFilter by Cédric Traizet
+ * !433: Fix missing braces warning on clang by Victor Poughon
+ * !428: Fix CookBook build inside a virtualenv & add "Compiling documentation" subsection by Victor Poughon
+ * !422: Fix doxygen test by Antoine Regimbeau
+ * !420: Warning on GetJacobian with GitlabCI by Guillaume Pasero
+ * !419: Bugs in Virtual Dimensionality by Cédric Traizet
+ * !417: COMP: fix build error (missing include) by Victor Poughon
+ * !412: Refactor application parameters dynamic_cast pattern by Victor Poughon
+ * !409: Test using numpy by Antoine Regimbeau
+ * !407: Fix typo in python error message by Victor Poughon
+ * !406: BUG: #1825: use GetParameterName to get real names on composite apps by Guillaume Pasero
+ * !404: Fix bug in extract roi by Antoine Regimbeau
+ * !403: FIX: correct a minor bug in Superimpose application by Rémi Cresson
+ * !400: Fix ImageFileReader error message & add back otb::Logger::BuildFormattedEntry by Victor Poughon
+ * !391: COMP: allow Qt5 to compile on old kernels by Guillaume Pasero
+ * !388: 1808: Fix error in solar distance test by Aurélie Emilien
+ * !382: Fix warnings on Windows for the Local Rx Filter by Cédric Traizet
+ * !381: Fix FastICA by Cédric Traizet
+ * !379: Logger bug by Antoine Regimbeau
+ * !378: Resolve "otb::TestHelper::RegressionTestOgrFile() always says Yes" by Guillaume Pasero
+ * !376: Resolve "Building cookbook fails with ninja" by Guillaume Pasero
+ * !364: No progress to file by Guillaume Pasero
+ * !358: Lower threshold even more for SIFTFast to make the test pass on raoul by Julien Michel
+ * !340: Revert Merge branch '1769_drop_support_gdal_1' into 'develop'" by Cédric Traizet
+ * !339: COMP: Set boost configure specific options when building with clang on unix systems by Julien Michel
+ * !335: Add Haralick features formulas in software guide by Manuel Grizonnet
+ * !333: Remove Version installation in build_dir by Antoine Regimbeau
+ * !313: BUG : clean fftw threads only if fftw is used by Cédric Traizet
+ * !308: BUG: fix verbosity of libsvm by Guillaume Pasero
+ * !305: BUG: compat of QgisDescriptor with old params by Guillaume Pasero
+ * !304: BUG: Quick fix for Mellin test by Antoine Regimbeau
+ * !303: BUG: missing ComplexImage params in QGis wrapper by Guillaume Pasero
+ * !302: TEST: use different test output names by Guillaume Pasero
+ * !297: COMP: fix compilation of examples with clang 7 by Guillaume Pasero
+ * !294: PKG: declare libomp as system lib in macOS package by Guillaume Pasero
+ * !293: COMP: fix OverlapSave filter on Windows by Guillaume Pasero
+ * !292: FFTW upgrade by Guillaume Pasero
+ * !288: BUG: #1761: make sure OpenMP runtime is loaded by the main executable by Guillaume Pasero
+ * !285: SuperBuild: the Ossim issue 2354 now affects all platforms by Guillaume Pasero
+ * !284: COMP: fix ossim to build with clang7 by Guillaume Pasero
+ * !283: OpenMP fixes by Guillaume Pasero
+ * !279: BUG: #1623: fix doxygen search bar by Guillaume Pasero
+ * !278: BUG #1757 fix installation of Siftfast by Guillaume Pasero
+ * !277: Resolve "Orthorectification regression in v6.6" by Julien Michel
+ * !274: BUG: #1734: warn users when producing an ENVI dataset with positive Y spacing by Guillaume Pasero
+ * !272: BUG: #1753: adding options OTB_USE_MPI and OTB_USE_SPTW for superbuild by Guillaume Pasero
+ * !271: Monteverdi: fix band numbering in color setup widget by Victor Poughon
+ * !266: BUG: #1734: replace envi format with TIF by Guillaume Pasero
+ * !265: Resolve "OTB QGIS plugin documentation is outdated" by Guillaume Pasero
+ * !263: BUG: update hdf5 url by Antoine Regimbeau
+ * !262: Composite application bugfix by Antoine Regimbeau
+ * !258: Add a BUILD_COOKBOOK cmake option to control cookbook build targets by Manuel Grizonnet
+ * !257: BUG: dict.iteritems() not supported in python 3 by Guillaume Pasero
+ * !253: BUG: clear temporary validation filename when validation ratio is set to 0 by Manuel Grizonnet
+ * !252: Resolve "error C2039: 'min': is not a member of 'std'" by Rashad Kanavath
+ * !250: BUG: fix ITK version number for packaging by Guillaume Pasero
+ * !249: Resolve "macros without proper semi-colon" by Rashad Kanavath
+ * !248: Resolve "undefined method GetResolutionsInfo in otbImageFileReader" by Rashad Kanavath
+ * !247: Resolve "update patch for opencv in superbuild" by Rashad Kanavath
+ * !239: ENH: Update superbuild to ITK 4.13.1 so that it builds with gcc 8 by Jordi Inglada
+ * !234: BUG: fix qt5 compilation on ubuntu 18.04 by Manuel Grizonnet
+ * !232: BUG: #1582: detect empty training data by Guillaume Pasero
+ * !231: BUG: fix markdown syntax in MR template by Guillaume Pasero
+ * !218: Resolve "Build fails on OtbQgisDescriptor usage if OTB_INSTALL_APP_DIR is set to lib64/otb/applications" by Guillaume Pasero
+ * !216: Resolve "OTB does not compile with GCC 8.1" by Manuel Grizonnet
+ * !210: #1652 Fine Registration correction to handle the warping option by Yannick TANGUY
+ * !205: Resolve "Orthorectification of Spot 6/7 raster sensor products leads to wrong output with lambert93 projection" by Guillaume Pasero
+ * !204: Resolve "Extract ROI extent mode produces wrong output" by Guillaume Pasero
+ * !203: Resolve "SampleAugmentation field list" by Guillaume Pasero
+ * !202: Metadata reading from compound datasets by Guillaume Pasero
+ * !201: Resolve "Fail computing KMeans Classification on image with NaN pixels" by Guillaume Pasero
+ * !198: Resolve "segfault in DEMConvert" by Antoine Regimbeau
+ * !196: Resolve "Module which generates QGIS descriptor is called Qgis while the source directory is QGIS (upper case)" by Manuel Grizonnet
+ * !195: Resolve "Monteverdi build error (superbuild)" by Manuel Grizonnet
+ * !188: Fix compilation GDALImageIO by Emmanuelle Sarrazin
+ * !187: Resolve "QLayout: Attempting to add QLayout "" to otb::Wrapper::QtWidgetParameterGroup "", which already has a layout" by Victor Poughon
+ * !186: PKG: install openCV libraries to lib by Guillaume Pasero
+ * !182: Resolve "VectorDataReprojection app does not output VectorData in physical space when using a reference image in sensor geometry" by Julien Michel
+ * !181: Resolve "OTB_APPLICATIONS_NAME_LIST is not updated when modules are activated/deactivated" by Rashad Kanavath
+ * !180: Resolve "Linux self extracting binary does not install correctly on Debian Stretch" by Rashad Kanavath
+ * !177: Remove mantis 1427 workaround by Victor Poughon
+ * !169: Resolve "apTvClMethodDTImageClassifierQB1 failing after SuperBuild OpenCV upgrade" by Victor Poughon
+ * !168: Resolve "Generation of Qgis plugin descriptors fails with latest develop" by Julien Michel
+ * !159: BUG: Improve Convert and DynamicConvert mask handling (fix #1647) by Victor Poughon
+ * !157: Resolve "install qgis descriptors into /share/ on all platforms" by Rashad Kanavath
+ * !156: BUG fix issue 1656 related to eratic behavior of cmake configuration by Manuel Grizonnet
+ * !155: BUG: Be compliant with new cmake policy CMP0072 with cmake > 3.11 by Manuel Grizonnet
+ * !142: BUG: fix issue #1639 Update UserValue flag in QtWidgetParameterList by Manuel Grizonnet
+ * !126: BUG: Remove workaround for QT bug 22829 by Victor Poughon
+ * !125: BUG: Fix missing QWidget parents by Victor Poughon
+
+Refactoring:
+
+ * !595: Apply clang-format to the whole library by Cédric Traizet
+ * !593: Compatibility with OpenCV 4 by Cédric Traizet
+ * !587: Image regression application by Cédric Traizet
+ * !554: Upgrade boost by Antoine Regimbeau
+ * !551: Remove unused files in OssimPlugins by Julien Michel
+ * !548: Warning and Test fixes by Guillaume Pasero
+ * !544: Cmake 3.10.2 by Antoine Regimbeau
+ * !542: Fix some sonar qube issues by Victor Poughon
+ * !535: Remove spatial objects module by Cédric Traizet
+ * !531: Comment bfTvOverlapSaveConvolutionImageFilter on Win x86 by Guillaume Pasero
+ * !517: Fix Superbuild default OTB_DATA_ROOT by Cédric Traizet
+ * !511: Compatibility with gdal 3 by Cédric Traizet
+ * !510: Update libkml link in Superbuild by Cédric Traizet
+ * !506: Update Remote Module tags for Mosaic and SertitObject by Cédric Traizet
+ * !500: Upgrade gdal version in superbuild by Cédric Traizet
+ * !498: Prefer 'using' to 'typedef' in examples by Victor Poughon
+ * !496: Regression refactoring : Train images regression by Cédric Traizet
+ * !493: Remove java wrapping 2 by Cédric Traizet
+ * !488: Regression refactoring : TrainVectorRegression by Cédric Traizet
+ * !487: Refactor XML parameters by Victor Poughon
+ * !484: Remove docname by Victor Poughon
+ * !474: Fix sphinx warning on sphinx v1.4 by Victor Poughon
+ * !471: Clean-up of unused or low quality modules and filters by Julien Michel
+ * !464: Large refactoring of radiometric indices by Julien Michel
+ * !460: COMP: set remote module to follow master by Jordi Inglada
+ * !447: PERF: Improve convolution performances by Luc Hermitte
+ * !445: Improve build time of OTBApplicationEngine by Stéphane Albert
+ * !442: Remove complex image parameters by Cédric Traizet
+ * !441: Remove ApplicationHtmlDocGenerator by Victor Poughon
+ * !432: Remove the RAnd* family of filters by Julien Michel
+ * !427: Remove UnaryFunctorImageFilter by Cédric Traizet
+ * !424: REFAC: Drop swig/java support by Julien Michel
+ * !413: PERF: Improve FunctorImageFilter performances by Luc Hermitte
+ * !412: Refactor application parameters dynamic_cast pattern by Victor Poughon
+ * !410: PERF: Optimize compare image by Luc Hermitte
+ * !408: REFACT: Deprecate `auto_ptr` by Luc Hermitte
+ * !400: Fix ImageFileReader error message & add back otb::Logger::BuildFormattedEntry by Victor Poughon
+ * !398: Migrate developer's guide to the cookbook by Victor Poughon
+ * !395: Render examples in the CookBook by Victor Poughon
+ * !390: Catch otbImageFileReaderException in otbTestMain by Victor Poughon
+ * !387: Import OTB-Data test data under git lfs by Stéphane Albert
+ * !384: Remove stale examples by Victor Poughon
+ * !383: Move otb-data/Examples/* to otb-data/Input/ by Victor Poughon
+ * !380: Massive Software Guide clean-up by Julien Michel
+ * !377: Start usage of extern templates by Guillaume Pasero
+ * !373: Refactor FunctorImageFilter with neighborhood by Cédric Traizet
+ * !372: Make Shark Optional for the "OTBDimensionalityReductionLearning" module by Cédric Traizet
+ * !369: REFAC: 1778: Reduced input-data of MeanShiftSmoothingImageFilterQBRoad. by Stéphane Albert
+ * !366: REFAC: 1778: Reduced input-data of hyTvMDMDNMFImageFilterTest2. by Stéphane Albert
+ * !362: Remove GradientBoostedTree as done in OpenCV 3 by Guillaume Pasero
+ * !360: Faster segmentation tests by Guillaume Pasero
+ * !359: Update GIT_TAG for mosaic remote module by Rémi Cresson
+ * !357: Faster SampleAugmentation tests by Guillaume Pasero
+ * !356: WRG: Filter out remaining warnings on unknown pragmas by Julien Michel
+ * !354: REFAC: 1778: Reduced size of input-data for dmTvFineRegistrationImageFilterTestWithMeanSquare by Stéphane Albert
+ * !352: Drop python2 by Antoine Regimbeau
+ * !351: Increase default ram limit to 256MB by Victor Poughon
+ * !350: Remove const char* SetFilename overloads by Victor Poughon
+ * !349: owTvQtWidgetShow refactoring by Stéphane Albert
+ * !348: Update insource build error message by Victor Poughon
+ * !345: Refactor all keypoints tests into a single test by Julien Michel
+ * !343: Fix current warnings on dashboard by Julien Michel
+ * !342: Remove support for GDAL 1.X by Cédric Traizet
+ * !341: Updating superbuild GDAL configuration by Antoine Regimbeau
+ * !337: Update git tag for TemporalGapfilling module by Jordi Inglada
+ * !336: Remove CommandLineParser submodule by Antoine Regimbeau
+ * !335: Add Haralick features formulas in software guide by Manuel Grizonnet
+ * !334: Drop support for gdal 1.X by Cédric Traizet
+ * !331: Constexpr in otbMath.h by Manuel Grizonnet
+ * !329: Remove spurious UnaryFunctorImageFilter includes by Julien Michel
+ * !328: Rename Get/Set Variadic[Named]Input[s]() by Get/SetInput() for easier reading in FunctorImageFilter by Julien Michel
+ * !326: Replace use of TernaryFunctorImageFilter by use of FunctorImageFilter in ComplexImage by Julien Michel
+ * !325: Refactor PanSharpening module to use FunctorImageFilter everywhere by Julien Michel
+ * !324: Remove convert app by Cédric Traizet
+ * !323: ENH: declare constants in otbMath.h as constexpr by Manuel Grizonnet
+ * !321: Use FunctorImageFilter to refactor filters in MorphologicalProfiles module by Julien Michel
+ * !320: Remove OTB_USE_DEPRECATED, TileMapImageIO and VectorDataRendering by Victor Poughon
+ * !319: Use functor filter in app image utils by Yannick TANGUY
+ * !318: Refactor filters in Polarimetry module to use new FunctorFilter by Manuel Grizonnet
+ * !311: ENH: update cmake minimum required in tutorial by Victor Poughon
+ * !309: REFAC: use FunctorFilter in DomainTransform by Julien Michel
+ * !307: Remove ParameterType_Empty by Victor Poughon
+ * !301: ENH: initialize the number of openMP threads after any modification by command line by Guillaume Pasero
+ * !300: PKG: enable diapotb in SuperBuild with RemoteModules by Guillaume Pasero
+ * !299: Add Functor module with FunctorImageFilter by Julien Michel
+ * !296: Integrate diapotb as official remote module by Guillaume Pasero
+ * !295: Update deprecated cmake policies to NEW by Manuel Grizonnet
+ * !287: Filtering warnings for clang7 by Guillaume Pasero
+ * !275: Review applications parameter order by Victor Poughon
+ * !273: Update .clang-format by Victor Poughon
+ * !269: Remove LARGEINPUT dependency of SoftwareGuide build by Victor Poughon
+ * !264: Bug fixes and refactors from clang-tidy by Victor Poughon
+ * !245: ENH: update phenotb remote module git tag by Jordi Inglada
+ * !244: Deprecated TileMap and prTeCoordinateToNameExampleTest by Antoine Regimbeau
+ * !243: Remove `Modules/Adapters/OpenThreads` by Laurențiu Nicola
+ * !236: Deprecate mapnik in 7.0 by Guillaume Pasero
+ * !235: Make the CookBook a CMake target by Victor Poughon
+ * !233: Refactor small region merging by Cédric Traizet
+ * !230: REFAC: move code to functions so that DoExecute logic is readable by Jordi Inglada
+ * !229: ImageIOBase AsString functions should be static by Guillaume Pasero
+ * !227: REFAC: allow vector/xml/raster output regardless of the input type by Jordi Inglada
+ * !225: WRG: fix warnings declaration shadows a previous local seen with gcc 8 by Manuel Grizonnet
+ * !224: Change map projections backend to use Gdal instead of OSSIM by Julien Michel
+ * !221: Remove unused OSSIM based classes by Julien Michel
+ * !219: Warnings fixes (clang and OSSIM) by Guillaume Pasero
+ * !208: More warning fixes for Shark by Guillaume Pasero
+ * !206: Some warning fixes by Guillaume Pasero
+ * !199: Remove more c_str with itk::ExceptionObject string constructor by Victor Poughon
+ * !192: Revert Merge branch 'new_contributors' into 'develop'" by Manuel Grizonnet
+ * !190: WRG: fix unused parameter warning by Victor Poughon
+ * !189: Remove more c_str with SetFileName string overload by Victor Poughon
+ * !173: Remove all *New tests by Julien Michel
+ * !172: REFAC: remove unnecessary calls to c_str (2nd attempt) by Victor Poughon
+ * !171: fstream and iostream clean-up by Julien Michel
+ * !170: WRG: add missing overrides by Victor Poughon
+ * !167: Refactor WrapperParameter code to avoid method bodies in header by Julien Michel
+ * !163: ENH: Use std math instead of vcl by Laurențiu Nicola
+ * !162: Fix warnings on OTB develop branches by Manuel Grizonnet
+ * !161: Refactor in Modules/Wrappers/QtWidget by Victor Poughon
+ * !160: Merge release-6.6 into develop without the shark revert by Victor Poughon
+ * !152: rename files with txx extension to hxx by Manuel Grizonnet
+ * !150: Refactor of otbWrapperApplication.h by Victor Poughon
+ * !145: Resolve "Debug mode without try {} catch(...) in otbApplicationLauncherCommandLine" by Julien Michel
+ * !144: Resolve "Warn otbcli user about unused parameters" by Julien Michel
+ * !139: SuperBuild: Upgrade to OpenCV 3.4.1 by Victor Poughon
+ * !138: REFAC: include-what-you-use in Modules/Core/ by Victor Poughon
+ * !133: C++14: Replace comments by '= delete' by Victor Poughon
+ * !131: C++14: Replace ITK_OVERRIDE by override by Victor Poughon
+ * !130: C++14: Replace ITK_NULLPTR by nullptr by Victor Poughon
+ * !127: COMP: fix gcc 7 'defined' warnings by Victor Poughon
+ * !123: New custom widgets for Float and Int parameters by Victor Poughon
+
+CI:
+
+ * !598: Fix the otbGRM remote module by Cédric Traizet
+ * !589: Mentions of copyright check by Sébastien Dinot
+ * !584: Fixes for NamespaceHandler by Guillaume Pasero
+ * !582: Script to setup a namespace for OTB imported targets by Guillaume Pasero
+ * !581: Contributors check by Sébastien Dinot
+ * !571: BUG: fix parameter expansion in otbenv by Guillaume Pasero
+ * !563: CI move Superbuild Artifact repository by Guillaume Pasero
+ * !559: DOC: add badges for CI and coverage by Guillaume Pasero
+ * !558: CI: fixing cdash links on forks by Guillaume Pasero
+ * !556: CI simple contributing by Guillaume Pasero
+ * !550: CI Artifacts by Guillaume Pasero
+ * !543: CI coverage by Guillaume Pasero
+ * !539: Add QA related jobs to CI pipeline by Sébastien Dinot
+ * !538: Ci contributing update by Guillaume Pasero
+ * !536: CI Fixes episode N by Guillaume Pasero
+ * !526: CI Fix CDash error report by Guillaume Pasero
+ * !524: CI Windows by Guillaume Pasero
+ * !523: CI: deploy by Antoine Regimbeau
+ * !522: CI: add large input test by Antoine Regimbeau
+ * !521: CI improvements for QA by Guillaume Pasero
+ * !520: CI: Pipelines for develop and release branches by Guillaume Pasero
+ * !519: Update HowToRelease by Guillaume Pasero
+ * !513: CI: Enable diapotb by Guillaume Pasero
+ * !507: CI Merge Ubuntus by Guillaume Pasero
+ * !505: CI: Enable ccache macos by Guillaume Pasero
+ * !504: CI: fix fast build by Guillaume Pasero
+ * !499: CI Add MacOS by Antoine Regimbeau
+ * !491: CI: packaging by Antoine Regimbeau
+ * !489: CI: change git and ssh setup by Guillaume Pasero
+ * !486: CI Use single token for API by Guillaume Pasero
+ * !483: CI: fixed architecture by Antoine Regimbeau
+ * !476: CI: fix image name to satisfy regexp by Guillaume Pasero
+ * !475: CI: use official registry by Guillaume Pasero
+ * !473: CI fixes for documentation by Guillaume Pasero
+ * !466: Superbuild CI on Centos 6 by Stéphane Albert
+ * !465: CI: add fast precheck step by Guillaume Pasero
+ * !463: Ci local builds by Guillaume Pasero
+ * !462: CI: only 1 bionic build needed by Guillaume Pasero
+ * !461: CI: enable documentation build by Guillaume Pasero
+ * !459: Superbuild CI by Antoine Regimbeau
+ * !456: Various CI fixes for a lighter dashboard by Guillaume Pasero
+ * !449: CI: change build name and export short SHA to cdash by Guillaume Pasero
+ * !443: Link with CDASH by Antoine Regimbeau
+ * !438: Fix CI failing fetch by Antoine Regimbeau
+ * !436: Add Debian to CI by Antoine Regimbeau
+ * !430: Improve Git LFS performances by Guilhem Bonnefille
+ * !429: Factorize build images specification by Guilhem Bonnefille
+ * !423: CI: need to simplify CI scripts by Guillaume Pasero
+ * !418: CI: enable ccache on ubuntu-llvm by Guillaume Pasero
+ * !416: CI setup all pipelines by Guillaume Pasero
+ * !399: CI: use lld linker on ubuntu by Guillaume Pasero
+ * !397: CI: use docker images from gbonnefille registry by Guillaume Pasero
+ * !394: CI: allow per site configuration by Guillaume Pasero
+ * !389: CI: use ninja by Guillaume Pasero
+ * !385: Allow CI to fail by Antoine Regimbeau
+ * !374: New CI for OTB by Antoine Regimbeau
+
+Documentation:
+
+ * !599: Fix spelling errors by Bas Couwenberg
+ * !594: Fix typo in ossimCosmoSkymedModel by Laurențiu Nicola
+ * !591: Fix non compliant headers by Cédric Traizet
+ * !590: Error in FunctorImageFilter.rst example by Julien Michel
+ * !588: MultivariateAlterationDetector: consistency between doc and code by Cédric Traizet
+ * !587: Image regression application by Cédric Traizet
+ * !580: Refactoring of the BandMathX documentation, and fix OpticalCalibration documentation by Cédric Traizet
+ * !578: DOC: fix documentation_changes template by Guillaume Pasero
+ * !577: Add a mailmap file by Sébastien Dinot
+ * !564: Simplify the QGIS documentation by Antoine Regimbeau
+ * !560: Add Agustin Lobo to PSC by Victor Poughon
+ * !547: Update version of compiler and add sb version by Antoine Regimbeau
+ * !538: Ci contributing update by Guillaume Pasero
+ * !534: DOC: fix missing import & clarify python doc example by Victor Poughon
+ * !532: DOC: updates to parts of the documentation within the apps by Daniel McInerney
+ * !514: DOC: review recipe residual registration by Victor Poughon
+ * !509: Update PSC.md to add Julien Radoux as a PSC member by Julien Michel
+ * !503: Small update in documentation of step parameter in BlockMatching application by Julien Michel
+ * !502: Remove Travis and Coverity badges from README.md by Julien Michel
+ * !501: Review change detection examples by Victor Poughon
+ * !495: Fix BandMathX documentation by Cédric Traizet
+ * !492: Display deprecation status in application wrappers by Cédric Traizet
+ * !485: Add Archlinux installation documentation by Victor Poughon
+ * !481: Add a section on functor filter in new C++ cookbook part by Julien Michel
+ * !477: Examples review (part 1) by Victor Poughon
+ * !472: Add clang-format-diff command line to MR checklist by Julien Michel
+ * !451: Documentation for atmoshperic correction parameters in OpticalCalibration by Cédric Traizet
+ * !441: Remove ApplicationHtmlDocGenerator by Victor Poughon
+ * !440: No data documentation in Segmentation by Cédric Traizet
+ * !439: DOC: use double quotes for string parameter examples by Victor Poughon
+ * !435: Remove Software Guide by Victor Poughon
+ * !431: Show alternative versions in the CookBook by Victor Poughon
+ * !428: Fix CookBook build inside a virtualenv & add "Compiling documentation" subsection by Victor Poughon
+ * !425: Hypserspectral image processing recipe by Cédric Traizet
+ * !415: Reorder cookbook sections and update style by Victor Poughon
+ * !411: DOC: remove the OTB-Data-Examples step from how-to-release by Guillaume Pasero
+ * !398: Migrate developer's guide to the cookbook by Victor Poughon
+ * !395: Render examples in the CookBook by Victor Poughon
+ * !380: Massive Software Guide clean-up by Julien Michel
+ * !375: Cookbook FAQ updates & Contributors section by Victor Poughon
+ * !363: Migrate 'Compiling from source' documentation to CookBook by Victor Poughon
+ * !347: Bump copyright date by Julien Michel
+ * !335: Add Haralick features formulas in software guide by Manuel Grizonnet
+ * !332: Fix cookbook warnings and formatting by Victor Poughon
+ * !322: DOC: improve documentation on how to pass multiple additional options to otb cmake cache by Manuel Grizonnet
+ * !316: Christmas CookBook by Victor Poughon
+ * !312: Add missing listview to doxygen by Victor Poughon
+ * !291: Qt-Qwt dependency in superbuild by Antoine Regimbeau
+ * !282: DOC: suggested changes to the documentation by Daniel McInerney
+ * !265: Resolve "OTB QGIS plugin documentation is outdated" by Guillaume Pasero
+ * !256: Small Typo by Jee Roen
+ * !254: ENH: Redispatch applications tagged as Misc to more user oriented tag available… by Manuel Grizonnet
+ * !246: Add install section to README.md by Victor Poughon
+ * !238: Typo in cookbook by Victor Poughon
+ * !228: Document output of training applications by Guillaume Pasero
+ * !217: DOC: dmci edits to cookbook and installation tex file by Daniel McInerney
+ * !207: DOC: add missing packages needed to compile otb with superbuild on ubuntu 18.04 by Manuel Grizonnet
+ * !200: Resolve "Possible confusion when using single-value-mode parameter-lists in CLI" by Victor Poughon
+ * !185: DOC: update list of contributors by Manuel Grizonnet
+ * !178: Resolve "Some ITK paths are wrong in the SoftwareGuide" by Yannick TANGUY
+ * !175: #1611 - Document ParameterType_Bool by Yannick TANGUY
+ * !174: Adopt SemVer for 7.0.0 and migrate release template to a gitlab issue template by Victor Poughon
+ * !153: ENH: Document that conversion applications in otb don't support complex pixel types as output by Manuel Grizonnet
+ * !149: ENH: display parameter description as tool tip for the QtWidgetBoolParameter by Manuel Grizonnet
+ * !140: DOC: Minor fixes in Software Guide by Victor Poughon
+ * !137: DOC: Set of proposed edits to the documentation by Daniel McInerney
+ * !136: DOC: add checklist to MR template by Victor Poughon
+ * !132: ENH: Add comments to MR template by Victor Poughon
+ * !129: Update screenshots in Monteverdi Cookbook section with wrong RGB color composition by Manuel Grizonnet
+ * !124: Document third party environment variables by Julien Michel
+
OTB-v.6.6.0 - Changes since version 6.4.0 (June 20th, 2018)
-----------------------------------------------------------
diff --git a/SuperBuild/CMakeLists.txt b/SuperBuild/CMakeLists.txt
index f4a9ffd6c0077e5be3a0c9e6faf017cf4b6ca995..d2b8b27e5a68f8edd03538c95de24edf23555725 100644
--- a/SuperBuild/CMakeLists.txt
+++ b/SuperBuild/CMakeLists.txt
@@ -54,9 +54,8 @@ mark_as_advanced(BUILD_GEOS_STATIC_LIBS)
option(BUILD_ALWAYS "Always build or install OTB." ON)
option(WITH_REMOTE_MODULES "Build with specific list of remote modules." OFF)
option(OTB_USE_OPENMP "use openmp" OFF)
-set(OTB_ADDITIONAL_CACHE "" CACHE STRING "Additional cmake options for OTB with "
- "the syntax (semi-colon used as a separator): "
- "-D:=;-D:=")
+set(OTB_ADDITIONAL_CACHE "" CACHE STRING "Additional cmake options for OTB with the syntax (semi-colon used as a separator): -D:=;-D:=")
+
if(APPLE)
set(CMAKE_MACOSX_RPATH TRUE)
diff --git a/Utilities/Maintenance/SuperbuildDownloadList.sh b/Utilities/Maintenance/SuperbuildDownloadList.sh
index 0297395c0315f8b7219732557d8b45d31fac7b38..c436e2c5c742d72c16bc8050587e79f6f1dd6f62 100755
--- a/Utilities/Maintenance/SuperbuildDownloadList.sh
+++ b/Utilities/Maintenance/SuperbuildDownloadList.sh
@@ -79,6 +79,6 @@ ARCHIVE_NAME="SuperBuild-archives-$VERSION"
echo "Creating archive ${OUTPUT_DIR}/$ARCHIVE_NAME.tar.bz2"
cd "${OUTPUT_DIR}" || echo "cannot cd to OUTPUT_DIR"
touch "${DOWNLOAD_DIR}/OTBSuperBuild.readme"
-tar -cjf "$ARCHIVE_NAME.tar.bz2" -C "${DOWNLOAD_DIR}" ${DOWNLOAD_NAMES} OTBSuperBuild.readme
+tar -cjf "$ARCHIVE_NAME.tar.bz2" -C "${DOWNLOAD_DIR}" "${DOWNLOAD_NAMES}" OTBSuperBuild.readme
echo "Saving md5sum to ${OUTPUT_DIR}/$ARCHIVE_NAME.md5"
md5sum "$ARCHIVE_NAME.tar.bz2" > "$ARCHIVE_NAME.md5"
diff --git a/i18n/fr_FR.ts b/i18n/fr_FR.ts
index 21539d9b9579218288f7ee428b4dbda5d06aee25..4ca42ee6ab19bec70431dd5b18ef49e1f824aa89 100644
--- a/i18n/fr_FR.ts
+++ b/i18n/fr_FR.ts
@@ -1,6 +1,6 @@
-
+
ColorSetupController
@@ -136,11 +136,11 @@ Veuillez, s'il vous plait, supprimer votre répertoire de cache Monteverdi.
QObject
Execute
- Exécuter
+ Exécuter
Quit
- Quitter
+ Quitter
@@ -455,7 +455,7 @@ Veuillez, s'il vous plait, supprimer votre répertoire de cache Monteverdi.
Title
- Titre
+ Titre
Name
@@ -692,7 +692,7 @@ Veuillez, s'il vous plait, supprimer votre répertoire de cache Monteverdi.
Form
-
+
<html><head/><body><p align="center">Image bands<br/>↓</p></body></html>
<html><head/><body><p align="center">Bandes<br/>↓</p></body></html>
@@ -731,7 +731,7 @@ Veuillez, s'il vous plait, supprimer votre répertoire de cache Monteverdi.
BAND %1
- BANDE %1
+ BANDE %1
Red
@@ -1205,25 +1205,10 @@ Veuillez, s'il vous plait, supprimer votre répertoire de cache Monteverdi.
Necessary for lupdate to be aware of C++ namespaces. Context comment for translator.
-
- WARNG> %s
-
-
-
-
- ERROR> %s
-
-
-
Error:
Erreur :
-
- FATAL> %s
-
-
-
Fatal error:
Erreur fatale :
@@ -1314,11 +1299,11 @@ Veuillez, s'il vous plait, supprimer votre répertoire de cache Monteverdi.
Cannot access settings file.
- Impossible d'accéder au fichiers des paramètres
+ Impossible d'accéder au fichiers des paramètres
Bad settings file format.
- Mauvais format pour le fichier de paramètres
+ Mauvais format pour le fichier de paramètres
An error occurred while loading the geoid file, no geoid file will be used:
@@ -1633,7 +1618,7 @@ Si vous exécutez cette application via une système d'écran déporté, le
Version M.m.pl (codename)
Version M.m.pl (codename)
-
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
@@ -2620,7 +2605,7 @@ p, li { white-space: pre-wrap; }
Necessary for lupdate to be aware of C++ namespaces. Context comment for translator.
-
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
@@ -3964,11 +3949,11 @@ Voulez-vous sauvegarder avant de quitter ?
Image view
- Vue image
+ Vue image
Tab cannot be closed while OTB application is running.
- L'onglet de l'application OTB ne peut pas être fermé lors de l'exécution de l'application OTB.
+ L'onglet de l'application OTB ne peut pas être fermé lors de l'exécution de l'application OTB.
Welcome new Montevedi2 user !
@@ -4152,6 +4137,14 @@ Charger '%1' provoquera l'affichage des couches dans une vue non
Use OpenGL Shading Language (GLSL)
Utiliser OpenGL Shading Language (GLSL)
+
+ Documentation
+ Documentation
+
+
+ F1
+ F1
+
mvd::MainWindowTitleLoader
@@ -4243,6 +4236,14 @@ Charger '%1' provoquera l'affichage des couches dans une vue non
Enable OTB_USE_QT preprocessor definition at compile time!
Activer la définition de pré-processeur OTB_USE_QT lors de la compilation !
+
+ Documentation
+ Documentation
+
+
+ F1
+ F1
+
mvd::Math
@@ -4405,12 +4406,16 @@ Charger '%1' provoquera l'affichage des couches dans une vue non
Generting overviews for file %1/%2 '%3'.
- Génération des Overview pour le fichier %1/%2 '%3'.
+ Génération des Overview pour le fichier %1/%2 '%3'.
Preparing to build GDAL overviews...
Préparation à la construction des Overview GDAL...
+
+ Generating overviews for file %1/%2 '%3'.
+ Génération des Overview pour le fichier %1/%2 '%3'.
+
mvd::PixelDescriptionWidget
@@ -5091,11 +5096,11 @@ Le(s) résultat(s) vont être importés en tant que jeu de données.
Warning!
- Avertissement !
+ Avertissement !
OTB-Application '%1' cannot be closed while running!
- Impossible de fermer l'OTB-Application '%1' pendant sont exécution !
+ Impossible de fermer l'OTB-Application '%1' pendant sont exécution !
Following files will be overwritten. Are you sure you want to continue?
@@ -5104,43 +5109,43 @@ Le(s) résultat(s) vont être importés en tant que jeu de données.
File '%1' is being viewed in
- Le fichier '%1' est en cours de visualisation dans
+ Le fichier '%1' est en cours de visualisation dans
Following files are being viewed in
- Les fichiers suivants sont en cours de visualisation dans
+ Les fichiers suivants sont en cours de visualisation dans
Running
- En cours
+ En cours
Done
- Terminé
+ Terminé
Failed
- Echec
+ Echec
Ready to run
- Prêt à démarrer
+ Prêt à démarrer
Select parameters
- Choix des paramètres
+ Choix des paramètres
Parameters
- Paramètres
+ Paramètres
Documentation
- Documentation
+ Documentation
Logs
- Logs
+ Logs