diff --git a/Code/BasicFilters/otbEuclideanDistanceWithMissingValuePow2.txx b/Code/BasicFilters/otbEuclideanDistanceWithMissingValuePow2.txx index c62008a0270ab1629149ea50ea1fe1564baa196b..16a57e83843af2f6e508be563d56946706fcac04 100644 --- a/Code/BasicFilters/otbEuclideanDistanceWithMissingValuePow2.txx +++ b/Code/BasicFilters/otbEuclideanDistanceWithMissingValuePow2.txx @@ -108,7 +108,7 @@ void EuclideanDistanceWithMissingValuePow2< TVector > ::SetToMissingValue ( ValueType & v ) { - double zero = 0.0; + static double zero; v = static_cast<ValueType>( 0.0/zero ); } diff --git a/Code/Learning/otbSVMKernels.h b/Code/Learning/otbSVMKernels.h index 8cbe43fd484e2edcef2717c52e9f9c7ff56afaf2..d302aa5d410bc676ef7770f8430598822cc5267b 100644 --- a/Code/Learning/otbSVMKernels.h +++ b/Code/Learning/otbSVMKernels.h @@ -38,7 +38,7 @@ public: }; virtual ~CustomKernelFunctor() {}; - virtual double operator()(const svm_node *x, const svm_node *y, const svm_parameter& param) const + virtual double operator()(const svm_node *x, const svm_node *y, const svm_parameter& /*param*/) const { return ( dot(x, x) - 2.0 * dot( x, y) + dot(y, y) ); } @@ -107,7 +107,7 @@ public: }; virtual ~SAMKernelFunctor() {}; - virtual double operator()(const svm_node *x, const svm_node *y, const svm_parameter& param) const + virtual double operator()(const svm_node *x, const svm_node *y, const svm_parameter& /*param*/) const { double den = dot(x, x) * dot(y, y); if ( den <= 0. ) diff --git a/Code/Radiometry/otbAtmosphericRadiativeTerms.cxx b/Code/Radiometry/otbAtmosphericRadiativeTerms.cxx index 65cf214d322e8e7f81d7e1e752e4a872c79aa167..fc3c7695ab90c7c20e84724ccecfa91feac0703d 100644 --- a/Code/Radiometry/otbAtmosphericRadiativeTerms.cxx +++ b/Code/Radiometry/otbAtmosphericRadiativeTerms.cxx @@ -43,8 +43,8 @@ AtmosphericRadiativeTermsSingleChannel ::PrintSelf(std::ostream& os, itk::Indent indent) const { Superclass::PrintSelf(os,indent); - os << indent << "Intrinsic Atmospheric Reflectance : " << m_IntrinsicAtmosphericReflectance << std::endl; - os << indent << "Atmospher Shperical Albedo : " << m_SphericalAlbedo << std::endl; + os << indent << "Atmospheric Intrinsic Reflectance : " << m_IntrinsicAtmosphericReflectance << std::endl; + os << indent << "Atmosphere Shperical Albedo : " << m_SphericalAlbedo << std::endl; os << indent << "Total Gaseous Transmission : " << m_TotalGaseousTransmission << std::endl; os << indent << "Atmospher Downward Transmittance : " << m_DownwardTransmittance << std::endl; os << indent << "Atmospher Upward Transmittance : " << m_UpwardTransmittance << std::endl; @@ -519,15 +519,15 @@ AtmosphericRadiativeTerms { os << "Channel "<< i << " : "<< std::endl; //ValueType::(os,indent); - os << indent << "Intrinsic Atmospheric Reflectance : " << m_Values[i]->GetIntrinsicAtmosphericReflectance() << std::endl; - os << indent << "Shperical Albedo of the Atmosphere : " << m_Values[i]->GetSphericalAlbedo() << std::endl; - os << indent << "Total Gaseous Transmission : " << m_Values[i]->GetTotalGaseousTransmission() << std::endl; - os << indent << "Downward Transmittance of the Atmospher : " << m_Values[i]->GetDownwardTransmittance() << std::endl; - os << indent << "Upward Transmittance of the Atmospher : " << m_Values[i]->GetUpwardTransmittance() << std::endl; - os << indent << "Upward diffuse transmittance : " << m_Values[i]->GetUpwardDiffuseTransmittance() << std::endl; - os << indent << "Upward direct transmittance : " << m_Values[i]->GetUpwardDirectTransmittance() << std::endl; - os << indent << "Upward diffuse transmittance for rayleigh: " << m_Values[i]->GetUpwardDiffuseTransmittanceForRayleigh() << std::endl; - os << indent << "Upward diffuse transmittance for aerosols: " << m_Values[i]->GetUpwardDiffuseTransmittanceForAerosol() << std::endl; + os << indent << "Intrinsic Atmospheric Reflectance : " << m_Values[i]->GetIntrinsicAtmosphericReflectance() << std::endl; + os << indent << "Shperical Albedo of the Atmosphere : " << m_Values[i]->GetSphericalAlbedo() << std::endl; + os << indent << "Total Gaseous Transmission : " << m_Values[i]->GetTotalGaseousTransmission() << std::endl; + os << indent << "Atmosphere Downward Transmittance : " << m_Values[i]->GetDownwardTransmittance() << std::endl; + os << indent << "Atmosphere Upward Transmittance : " << m_Values[i]->GetUpwardTransmittance() << std::endl; + os << indent << "Upward Diffuse Transmittance : " << m_Values[i]->GetUpwardDiffuseTransmittance() << std::endl; + os << indent << "Upward Direct Transmittance : " << m_Values[i]->GetUpwardDirectTransmittance() << std::endl; + os << indent << "Rayleigh Upward Diffuse Transmittance : " << m_Values[i]->GetUpwardDiffuseTransmittanceForRayleigh() << std::endl; + os << indent << "Aerosols Upward Diffuse Transmittance : " << m_Values[i]->GetUpwardDiffuseTransmittanceForAerosol() << std::endl; } } diff --git a/Testing/Code/IO/CMakeLists.txt b/Testing/Code/IO/CMakeLists.txt index 4db5a98ffa529ead0c35b66cf03cbd4c20dd98d4..41f81e6f8c31c260c29b885110c333d432d5b54d 100755 --- a/Testing/Code/IO/CMakeLists.txt +++ b/Testing/Code/IO/CMakeLists.txt @@ -1424,6 +1424,19 @@ ADD_TEST(ioTvossimElevManagerTest3 ${IO_TESTS12} # -1.8870830 52.0135758 0.024363378967 -0.018457085039 232 422 ) +#This test investigate the problem with the ossimElevManager +# - differences between plaforms +# - file descriptor leak +ADD_TEST(ioTvossimElevManagerTest4 ${IO_TESTS12} +--compare-image ${EPSILON_9} ${BASELINE}/ioTvossimElevManagerTest3.tif + ${TEMP}/ioTvossimElevManagerTest4.hdr + otbOssimElevManagerTest4 + ${INPUTDATA}/DEM/srtm_directory + ${TEMP}/ioTvossimElevManagerTest4 + -1.8 52 0.02 -0.018 232 422 + ) + + ADD_TEST(ioTvossimElevManagerTest2 ${IO_TESTS12} --compare-ascii ${EPSILON_9} ${BASELINE_FILES}/ioTvossimElevManagerTest2.txt ${TEMP}/ioTvossimElevManagerTest2.txt @@ -2017,6 +2030,7 @@ otbDEMToImageGeneratorNew.cxx otbDEMToImageGeneratorTest.cxx otbOssimElevManagerTest.cxx otbOssimElevManagerTest2.cxx +otbOssimElevManagerTest4.cxx otbDEMToOrthoImageGeneratorNew.cxx otbDEMToOrthoImageGeneratorTest.cxx otbPrepareSRTMDirectoryNew.cxx diff --git a/Testing/Code/IO/otbIOTests12.cxx b/Testing/Code/IO/otbIOTests12.cxx index f861ad8a23c699ab1f90d986a3ce0638a78adc53..cce0b7f8aac52f4c9da1165e2d2ad1b8d3c4469c 100644 --- a/Testing/Code/IO/otbIOTests12.cxx +++ b/Testing/Code/IO/otbIOTests12.cxx @@ -34,6 +34,7 @@ REGISTER_TEST(otbDEMToImageGeneratorNew); REGISTER_TEST(otbDEMToImageGeneratorTest); REGISTER_TEST(otbOssimElevManagerTest); REGISTER_TEST(otbOssimElevManagerTest2); +REGISTER_TEST(otbOssimElevManagerTest4); REGISTER_TEST(otbDEMToOrthoImageGeneratorNew); REGISTER_TEST(otbDEMToOrthoImageGeneratorTest); REGISTER_TEST(otbPrepareSRTMDirectoryNew); diff --git a/Testing/Code/IO/otbOssimElevManagerTest4.cxx b/Testing/Code/IO/otbOssimElevManagerTest4.cxx new file mode 100644 index 0000000000000000000000000000000000000000..cd37ea5c034b091390f411d366616d4425cd736e --- /dev/null +++ b/Testing/Code/IO/otbOssimElevManagerTest4.cxx @@ -0,0 +1,111 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + +#include <cstdlib> +#include <fstream> +#include <sstream> + +#include "elevation/ossimElevManager.h" +#include "base/ossimFilename.h" + + + +int otbOssimElevManagerTest4(int argc,char* argv[]) +{ + + if (argc!=9) + { + std::cout<<"Usage: "<<std::endl; + std::cout<<argv[0]<<" srtmDir outfname originX originY spacingX spacingY sizeX sizeY"<<std::endl; + return EXIT_FAILURE; + } + + const ossimFilename srtmDir(argv[1]); + const char * outfname = argv[2]; + + double origin[2]; + double spacing[2]; + int size[2]; + + origin[0]= atof(argv[3]); + origin[1]= atof(argv[4]); + spacing[0]=atof(argv[5]); + spacing[1]=atof(argv[6]); + size[0]= atoi(argv[7]); + size[1]= atoi(argv[8]); + + double* image = new double[size[0]*size[1]]; + + + ossimElevManager * elevManager = ossimElevManager::instance(); + + elevManager->openDirectory(srtmDir); + + for (int j=0; j<size[1]; ++j) + { + for (int i=0; i<size[0]; ++i) + { + double point[2]; + point[0] = origin[0]+i*spacing[0]; + point[1] = origin[1]+j*spacing[1]; + + ossimGpt ossimWorldPoint; + ossimWorldPoint.lon=point[0]; + ossimWorldPoint.lat=point[1]; + double height = elevManager->getHeightAboveMSL(ossimWorldPoint); + + if (!ossim::isnan(height)) + { + // Fill the image + image[i+j*size[0]] = height; + } + else + { + // Back to the MNT default value + image[i+j*size[0]] = 0; + } + } + } + + std::ofstream file; + file.open(outfname, ios::binary|ios::out); + + file.write(reinterpret_cast<char*>(image), sizeof(image)*size[0]*size[1]); + file.close(); + + + delete[] image; + + //Create the header + std::stringstream headerName; + headerName << outfname << ".hdr"; + std::ofstream headerFile; + headerFile.open(headerName.str().c_str()); + headerFile << "ENVI\n"; + headerFile << "samples = " << size[0] << "\n"; + headerFile << "lines = " << size[1] << "\n"; + headerFile << "bands = 1\n"; + headerFile << "header offset = 0\n"; + headerFile << "file type = ENVI Standard\n"; + headerFile << "data type = 5\n"; + headerFile << "interleave = bsq\n"; + headerFile << "byte order = 0\n"; + headerFile.close(); + + return EXIT_SUCCESS; +} diff --git a/Testing/Utilities/CMakeLists.txt b/Testing/Utilities/CMakeLists.txt index 99c9b3b7b0c11eee33c341e31f726acb7fdbbeda..7e1a87a6babc68ceeff5d7c0aeff72393125a10a 100644 --- a/Testing/Utilities/CMakeLists.txt +++ b/Testing/Utilities/CMakeLists.txt @@ -31,7 +31,7 @@ SET(UTILITIES_TESTS ${CXX_TEST_PATH}/otbUtilitiesTests) IF(OTB_DATA_USE_LARGEINPUT) ADD_TEST(utTvOssimKeywordlistToulouseQuickBirdTest ${UTILITIES_TESTS} ---compare-ascii ${EPSILON_10e6} ${BASELINE_FILES}/utOssimKeywordlistToulouseQuickBird.txt +--compare-list ${EPSILON_10e6} ${BASELINE_FILES}/utOssimKeywordlistToulouseQuickBird.txt ${TEMP}/utOssimKeywordlistToulouseQuickBird.txt ossimKeywordlistTest ${IMAGEDATA}/TOULOUSE/QuickBird/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF @@ -39,7 +39,7 @@ ADD_TEST(utTvOssimKeywordlistToulouseQuickBirdTest ${UTILITIES_TESTS} ) ADD_TEST(utTvOssimKeywordlistBlossevilleIkonosTest ${UTILITIES_TESTS} ---compare-ascii ${TOL} ${BASELINE_FILES}/utOssimKeywordlistBlossevilleIkonos.txt +--compare-list ${TOL} ${BASELINE_FILES}/utOssimKeywordlistBlossevilleIkonos.txt ${TEMP}/utOssimKeywordlistBlossevilleIkonos.txt ossimKeywordlistTest ${IMAGEDATA}/IKONOS_BLOSSEVILLE/po_2619900_grn_0000000.tif diff --git a/Utilities/otbkml/src/kml/dom/element.h b/Utilities/otbkml/src/kml/dom/element.h index 5950d0841e50663642a95e1602659905b0ac89db..5d9e61cfc20ab164cedfab66883356ec8dc8a703 100644 --- a/Utilities/otbkml/src/kml/dom/element.h +++ b/Utilities/otbkml/src/kml/dom/element.h @@ -103,7 +103,7 @@ class Element : public kmlbase::Referent { // A derived class implements this to use with serialization. See // class Serializer for more information. - virtual void Serialize(Serializer& serialize) const {} + virtual void Serialize(Serializer& /*serialize*/) const {} // A derived class uses this to use with serialization. The derived // class adds its attributes to the given set and passes attributes @@ -130,11 +130,11 @@ class Element : public kmlbase::Referent { } // Permits polymorphic use of Field methods. - virtual bool SetBool(bool* val) { return false; } - virtual bool SetDouble(double* val) { return false; } - virtual bool SetInt(int* val) { return false; } - virtual bool SetEnum(int* val) { return false; } - virtual bool SetString(std::string* val) { return false; } + virtual bool SetBool(bool* /*val*/) { return false; } + virtual bool SetDouble(double* /*val*/) { return false; } + virtual bool SetInt(int* /*val*/) { return false; } + virtual bool SetEnum(int* /*val*/) { return false; } + virtual bool SetString(std::string* /*val*/) { return false; } protected: // Element is an abstract base class and is never created directly. diff --git a/Utilities/otbkml/src/kml/dom/parser_observer.h b/Utilities/otbkml/src/kml/dom/parser_observer.h index 230fc088c7b190ccf79d4fef32b04171888f696a..a88f5c43bad13cedef0ab0ecc6bdb7457bc0b3e0 100644 --- a/Utilities/otbkml/src/kml/dom/parser_observer.h +++ b/Utilities/otbkml/src/kml/dom/parser_observer.h @@ -44,12 +44,12 @@ class ParserObserver { } // Called after this element is created by the parser. - virtual bool NewElement(const ElementPtr& element) { + virtual bool NewElement(const ElementPtr& /*element*/) { return true; // Default implementation is a NOP: parse continues. } // Called after the given child has been set to the given parent. - virtual bool AddChild(const ElementPtr& parent, const ElementPtr& child) { + virtual bool AddChild(const ElementPtr& /*parent*/, const ElementPtr& /*child*/) { return true; // Default implementation is a NOP: parse continues. } };