diff --git a/CMakeLists.txt b/CMakeLists.txt index a64034fb24b55a67388a3cccdfef58500ade0955..7013f81e8ab1af70a4b5cc341bf334b431c417d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,7 +71,7 @@ SET(OTB_VERSION_STRING "${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}.${OTB_VERSION_ # => Comment for OTB 3.0.0 -#OPTION(BUILD_TESTING "Build testing." OFF) +OPTION(BUILD_TESTING "Build testing." OFF) #----------------------------------------------------------------------------- # OTB build configuration options. @@ -325,6 +325,35 @@ IF(OTB_USE_CURL) ENDIF(OTB_USE_CURL) +#------------------------------- +# Mapnik Library +#------------------------------- +OPTION(OTB_USE_MAPNIK "Use mapnik library." OFF) +MARK_AS_ADVANCED(OTB_USE_MAPNIK) +IF(OTB_USE_MAPNIK) + + FIND_PATH(MAPNIK_INCLUDE_DIR mapnik/map.hpp PATHS) + MARK_AS_ADVANCED(MAPNIK_INCLUDE_DIR) + IF (NOT MAPNIK_INCLUDE_DIR) + MESSAGE(FATAL_ERROR + "Cannot find MAPNIK include directory. Please set MAPNIK_INCLUDE_DIR or SET OTB_USE_MAPNIK OFF.") + ENDIF (NOT MAPNIK_INCLUDE_DIR) + + FIND_LIBRARY(MAPNIK_LIBRARY mapnik ) + MARK_AS_ADVANCED(MAPNIK_LIBRARY) + IF (NOT MAPNIK_LIBRARY) + MESSAGE(FATAL_ERROR + "Cannot find MAPNIK library. Please set MAPNIK_LIBRARY or SET OTB_USE_MAPNIK OFF.") + ENDIF (NOT MAPNIK_LIBRARY) + +# Add compiler option + ADD_DEFINITIONS(-DOTB_USE_MAPNIK) + + INCLUDE_DIRECTORIES(${MAPNIK_INCLUDE_DIR}) + +ENDIF(OTB_USE_MAPNIK) + + #------------------------------- # Boost Library #------------------------------- diff --git a/Code/IO/otbGDALImageIO.cxx b/Code/IO/otbGDALImageIO.cxx index bd3417dcf20cc9495c87f5040419ab42dea61843..726e32aff482dafb699f791ddb39e46e916e4b2a 100644 --- a/Code/IO/otbGDALImageIO.cxx +++ b/Code/IO/otbGDALImageIO.cxx @@ -22,8 +22,7 @@ #include "itkRGBPixel.h" #include "itkRGBAPixel.h" -#include <gdal.h> -#include <gdal_priv.h> +#include "gdal_priv.h" //#include <iostream.h> #include <string.h> #include <list> diff --git a/Code/IO/otbTileMapImageIO.cxx b/Code/IO/otbTileMapImageIO.cxx index cef7187aa0c4e6a517ed6399a607afc9c2d995eb..8f06686745c82f768880e72c92572291097d1fe3 100644 --- a/Code/IO/otbTileMapImageIO.cxx +++ b/Code/IO/otbTileMapImageIO.cxx @@ -22,8 +22,8 @@ #include "itkRGBPixel.h" #include "itkRGBAPixel.h" -#include <gdal.h> -#include <gdal_priv.h> +#include "gdal.h" +#include "gdal_priv.h" //#include <iostream.h> #include <string.h> #include <list> diff --git a/Testing/Code/Common/CMakeLists.txt b/Testing/Code/Common/CMakeLists.txt index 4af2ae623d8eb185d2cc0f431b48c904e7aa8a75..112037651f4d957c578d541ad98ac3a769fd7c4e 100755 --- a/Testing/Code/Common/CMakeLists.txt +++ b/Testing/Code/Common/CMakeLists.txt @@ -440,9 +440,13 @@ ADD_TEST(coTvPolygon ${COMMON_TESTS6} #-------- otb::PolyLineImageIterator ----------------------------------------- - ADD_TEST(coTuPolyLineImageConstIteratorNew ${COMMON_TESTS6} - otbPolyLineImageConstIteratorNew - ${INPUTDATA}/poupees_sub_c1.png + ADD_TEST(coTvPolyLineImageConstIterator ${COMMON_TESTS6} + --compare-ascii ${TOL} + ${BASELINE_FILES}/coTvPolyLineImageConstIterator.txt + ${TEMP}/coTvPolyLineImageConstIterator.txt + otbPolyLineImageConstIterator + 512 512 20 + ${TEMP}/coTvPolyLineImageConstIterator.txt ) ADD_TEST(coTvPolyLineImageIterator ${COMMON_TESTS6} @@ -755,7 +759,7 @@ otbArcSpatialObjectNew.cxx otbPathListToPathListFilterNew.cxx ) SET(BasicCommon_SRCS6 -otbPolyLineImageConstIteratorNew.cxx +otbPolyLineImageConstIterator.cxx otbPolyLineImageIterator.cxx otbDrawPathFilterNew.cxx otbDrawPathFilter.cxx diff --git a/Testing/Code/Common/otbCommonTests6.cxx b/Testing/Code/Common/otbCommonTests6.cxx index 7bd650aaa5d3e3eb4ecb51add1ee109f5198b466..ef407f0e5f14daa541571419b054f5b16f9b5abc 100644 --- a/Testing/Code/Common/otbCommonTests6.cxx +++ b/Testing/Code/Common/otbCommonTests6.cxx @@ -30,7 +30,7 @@ void RegisterTests() REGISTER_TEST(otbDrawPathListFilter); REGISTER_TEST(otbDrawPathListFilterWithValue); REGISTER_TEST(otbPolyLineParametricPathWithValueNew); - REGISTER_TEST(otbPolyLineImageConstIteratorNew); + REGISTER_TEST(otbPolyLineImageConstIterator); REGISTER_TEST(otbPolyLineImageIterator); REGISTER_TEST(otbDrawPathFilterNew); REGISTER_TEST(otbDrawPathFilter); diff --git a/Testing/Code/Common/otbPolyLineImageConstIterator.cxx b/Testing/Code/Common/otbPolyLineImageConstIterator.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8c96555d1e3d408f072ae20b41252c6b224ef472 --- /dev/null +++ b/Testing/Code/Common/otbPolyLineImageConstIterator.cxx @@ -0,0 +1,96 @@ +/*========================================================================= + + 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 "itkExceptionObject.h" + +#include "otbPolyLineImageIterator.h" +#include "itkPolyLineParametricPath.h" +#include "otbImage.h" +#include <fstream> + +int otbPolyLineImageConstIterator(int argc, char * argv[]) +{ + if (argc!=5) + { + std::cout<<"Usgage: "<<argv[0]<<" sizex sizey nbpoints outfname"<<std::endl; + return EXIT_SUCCESS; + } + const unsigned int sizex = atoi(argv[1]); + const unsigned int sizey = atoi(argv[2]); + const unsigned int nbpoints = atoi(argv[3]); + const char * outfname = argv[4]; + + const unsigned int Dimension = 2; + typedef unsigned char PixelType; + typedef otb::Image<PixelType,Dimension> ImageType; + typedef itk::PolyLineParametricPath<Dimension> PathType; + typedef PathType::VertexType VertexType; + typedef otb::PolyLineImageIterator<ImageType, PathType> IteratorType; + + typedef otb::PolyLineImageConstIterator<ImageType, PathType> ConstIteratorType; + + + ImageType::SizeType size; + size[0] = sizex; + size[1] = sizey; + ImageType::IndexType index; + index.Fill(0); + ImageType::RegionType region; + region.SetSize(size); + region.SetIndex(index); + ImageType::Pointer image = ImageType::New(); + image->SetRegions(region); + image->Allocate(); + image->FillBuffer(255); + + PathType::Pointer path = PathType::New(); + + for (unsigned int i =1; i<nbpoints;i++) + { + VertexType vertex1,vertex2; + vertex1[0]=0; + vertex1[1]=i*sizey/nbpoints; + vertex2[0]=i*sizex/nbpoints; + vertex2[1]=0; + path->AddVertex(vertex1); + path->AddVertex(vertex2); + } + for (unsigned int i =1; i<nbpoints;i++) + { + VertexType vertex1,vertex2; + vertex1[0]=i*sizex/nbpoints; + vertex1[1]=sizey-1; + vertex2[0]=sizex-1; + vertex2[1]=i*sizey/nbpoints; + path->AddVertex(vertex1); + path->AddVertex(vertex2); + } + + image->Update(); + + ConstIteratorType cit((const ImageType*)image,(const PathType*)path); + + std::ofstream flux(outfname); + + for (cit.GoToBegin();!cit.IsAtEnd();++cit) + { + flux <<cit.GetIndex()<<std::endl; + } + flux.close(); + + return EXIT_SUCCESS; +} diff --git a/Testing/Code/Common/otbPolyLineImageConstIteratorNew.cxx b/Testing/Code/Common/otbPolyLineImageConstIteratorNew.cxx deleted file mode 100644 index 39f6b6628b5cea143e72c38d0a6662c2ba2d6ab3..0000000000000000000000000000000000000000 --- a/Testing/Code/Common/otbPolyLineImageConstIteratorNew.cxx +++ /dev/null @@ -1,37 +0,0 @@ -/*========================================================================= - - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. - - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. - -=========================================================================*/ -#include "itkExceptionObject.h" - -#include "itkPolyLineParametricPath.h" -#include "otbImage.h" -#include "otbPolyLineImageConstIterator.h" - -int otbPolyLineImageConstIteratorNew(int argc, char * argv[]) -{ - const unsigned int Dimension =2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef itk::PolyLineParametricPath<Dimension> PathType; - typedef otb::PolyLineImageConstIterator<ImageType,PathType> ConstIteratorType; - - // Instantiating object - ConstIteratorType it(); - - - return EXIT_SUCCESS; -} diff --git a/Testing/Utilities/openthreadsWorkCrew.cpp b/Testing/Utilities/openthreadsWorkCrew.cpp index 727fa88fbfccf8c2a547438d0fb5fea50ee0fdfc..9f22a60090e792b70028659d08c796abbc3e1415 100644 --- a/Testing/Utilities/openthreadsWorkCrew.cpp +++ b/Testing/Utilities/openthreadsWorkCrew.cpp @@ -44,7 +44,7 @@ #include <OpenThreads/Condition> #include <OpenThreads/Barrier> -extern int errno; +//extern int errno; #ifdef DEBUG # define DPRINTF(arg) printf arg @@ -313,7 +313,8 @@ int crew_start(Crew *crew) { // status = crew->mutex.lock(); if(status != 0) { - DPRINTF(("Lock Error: %s\n", strerror(errno))); +// OTB Modif DPRINTF(("Lock Error: %s\n", strerror(errno))); + DPRINTF(("Lock Error !\n")); } assert(status == 0); diff --git a/Testing/Utilities/siftfast.cpp b/Testing/Utilities/siftfast.cpp index 53d822573fc635c9a916079a10301085fe3e460f..35d7d2dc372b319ed1a4bb05fea585112809c8d9 100755 --- a/Testing/Utilities/siftfast.cpp +++ b/Testing/Utilities/siftfast.cpp @@ -89,7 +89,7 @@ SiftFastImage ReadPGM(FILE *fp) image = CreateImage(height, width); for (r = 0; r < height; r++) for (c = 0; c < width; c++) - image->pixels[r*image->stride+c] = ((float) fgetc(fp)) / 255.0; + image->pixels[r*image->stride+c] = static_cast<float>(((float) fgetc(fp)) / 255.0); //Check if there is another image in this file, as the latest PGM // standard allows for multiple images. diff --git a/Utilities/otbossimplugins/gdal/ossimOgcWktTranslator.cpp b/Utilities/otbossimplugins/gdal/ossimOgcWktTranslator.cpp index 894f00dea38cb5a5ea981a5e871191dfbe39d9cf..fd15344ed6d1d2b511005c93fa9b7a81cc345d00 100644 --- a/Utilities/otbossimplugins/gdal/ossimOgcWktTranslator.cpp +++ b/Utilities/otbossimplugins/gdal/ossimOgcWktTranslator.cpp @@ -16,7 +16,7 @@ // $Id: ossimOgcWktTranslator.cpp 12031 2007-11-13 18:03:57Z gpotts $ #include <cstdio> -#include <gdal.h> +#include "gdal.h" #include "ossimOgcWktTranslator.h" #include <ogr_spatialref.h> diff --git a/Utilities/otbossimplugins/ossim/ossimCosmoSkymedModel.cpp b/Utilities/otbossimplugins/ossim/ossimCosmoSkymedModel.cpp index a9fe414324a8d8d0f363a9e62054e74241cb59c8..569eafff441c34816a18e7c7911321a2a21a746b 100644 --- a/Utilities/otbossimplugins/ossim/ossimCosmoSkymedModel.cpp +++ b/Utilities/otbossimplugins/ossim/ossimCosmoSkymedModel.cpp @@ -81,7 +81,7 @@ bool ossimCosmoSkymedModel::InitSensorParams(const ossimKeywordlist &kwl, const /** - * @todo : � voir sur de vrais produits (exemples de DESCENDING et ASCENDING) + * @todo : � voir sur de vrais produits (exemples de DESCENDING et ASCENDING) */ const char* orbitDirection_str = kwl.find(prefix,"orbitDirection"); std::string orbitDirection(orbitDirection_str) ; @@ -376,7 +376,7 @@ bool ossimCosmoSkymedModel::UtcDateTimeStringToCivilDate(const std::string &utcS outputDate.set_year(atoi(year_str)); outputDate.set_month(atoi(month_str)); outputDate.set_day(atoi(day_str)); - outputDate.set_second(0.0); + outputDate.set_second(0); outputDate.set_decimal(0.0); return true ; diff --git a/Utilities/otbossimplugins/ossim/ossimRadarSat2ProductDoc.cpp b/Utilities/otbossimplugins/ossim/ossimRadarSat2ProductDoc.cpp index 83f8135cbb8a20ff5065c6c5d2ed63cbb99bd0b0..7430a38db7e969b348a4b5fd04fb5a0af5dab9bc 100644 --- a/Utilities/otbossimplugins/ossim/ossimRadarSat2ProductDoc.cpp +++ b/Utilities/otbossimplugins/ossim/ossimRadarSat2ProductDoc.cpp @@ -415,7 +415,7 @@ bool ossimRadarSat2ProductDoc::initImageSize(const ossimXmlDocument* xdoc, ossimString s; if ( getNumberOfSamplesPerLine(xdoc, s) ) { - imageSize.x = s.toFloat64(); + imageSize.x = static_cast<ossim_int32>(s.toFloat64()); } else { @@ -423,7 +423,7 @@ bool ossimRadarSat2ProductDoc::initImageSize(const ossimXmlDocument* xdoc, } if ( getNumberOfLines(xdoc, s) ) { - imageSize.y = s.toFloat64(); + imageSize.y = static_cast<ossim_int32>(s.toFloat64()); } else { diff --git a/Utilities/otbossimplugins/ossim/otb/Ephemeris.h b/Utilities/otbossimplugins/ossim/otb/Ephemeris.h index 8e48f4f9de3572d123fff1e84a99942e76bfb319..da58ede92604b1ddd7ba432345c55dec48462d66 100644 --- a/Utilities/otbossimplugins/ossim/otb/Ephemeris.h +++ b/Utilities/otbossimplugins/ossim/otb/Ephemeris.h @@ -28,7 +28,7 @@ public: /** * @brief Destructor */ - ~Ephemeris(); + virtual ~Ephemeris(); /** * @brief Constructor with initialisations diff --git a/Utilities/otbossimplugins/ossim/otb/GalileanEphemeris.h b/Utilities/otbossimplugins/ossim/otb/GalileanEphemeris.h index ad508ec23a7e3a7881626833f11506ef6701fb27..cafff3bd39a9ee9f726d611570de9eb67bb9e680 100644 --- a/Utilities/otbossimplugins/ossim/otb/GalileanEphemeris.h +++ b/Utilities/otbossimplugins/ossim/otb/GalileanEphemeris.h @@ -30,7 +30,7 @@ public: /** * @brief Destructor */ - ~GalileanEphemeris(); + virtual ~GalileanEphemeris(); /** * @brief Constructor with initialisations @@ -49,7 +49,7 @@ public: GalileanEphemeris& operator=(const GalileanEphemeris& rhs); /** - * @brief This fonction converts the current ephemeris in the Geographic coordinates syst�m + * @brief This fonction converts the current ephemeris in the Geographic coordinates syst�m */ void ToGeographic(GeographicEphemeris* vGeo); void ToGeographic(double greenwich,GeographicEphemeris* vGeo); diff --git a/Utilities/otbossimplugins/ossim/otb/GeographicEphemeris.h b/Utilities/otbossimplugins/ossim/otb/GeographicEphemeris.h index 32dabdedcdbd37274fd8a6aa46af58a648e54eb7..2245197b995d27de4f23fc37a9155cc4fba6c396 100644 --- a/Utilities/otbossimplugins/ossim/otb/GeographicEphemeris.h +++ b/Utilities/otbossimplugins/ossim/otb/GeographicEphemeris.h @@ -29,7 +29,7 @@ public: /** * @brief Destructor */ - ~GeographicEphemeris(); + virtual ~GeographicEphemeris(); /** * @brief Constructor with initialisations diff --git a/Utilities/otbossimplugins/ossim/otb/SarSensor.h b/Utilities/otbossimplugins/ossim/otb/SarSensor.h index 7854dd46f9e86940ac9dcdb54749cad0117d1d05..e0816d7665868888500dc646d8834b736b53c994 100644 --- a/Utilities/otbossimplugins/ossim/otb/SarSensor.h +++ b/Utilities/otbossimplugins/ossim/otb/SarSensor.h @@ -35,7 +35,7 @@ public: /** * @brief Destructor */ - ~SarSensor(); + virtual ~SarSensor(); /** * @brief This function is able to convert image coordinates into geodetic world coordinates using a geometric SAR sensor model diff --git a/Utilities/otbossimplugins/ossim/otb/Sensor.h b/Utilities/otbossimplugins/ossim/otb/Sensor.h index fa135a6fa9d25fdfade2f5ba908517a4dd4d8d78..44ac37eac00a8b28c0c962b4a7386231e8b4fba6 100644 --- a/Utilities/otbossimplugins/ossim/otb/Sensor.h +++ b/Utilities/otbossimplugins/ossim/otb/Sensor.h @@ -34,7 +34,7 @@ public: /** * @brief Destructor */ - ~Sensor(); + virtual ~Sensor(); /** * @brief This function is able to convert image coordinates into geodetic world coordinates using a sensor model diff --git a/Utilities/otbossimplugins/ossim/otb/SensorParams.h b/Utilities/otbossimplugins/ossim/otb/SensorParams.h index ba38282cbd146991d38a7101b27dabcec6dd554c..ff86ab9a0ede9c6f2792a5c6e3f5f3a807c62c97 100644 --- a/Utilities/otbossimplugins/ossim/otb/SensorParams.h +++ b/Utilities/otbossimplugins/ossim/otb/SensorParams.h @@ -36,7 +36,7 @@ public: /** * @brief Destructor */ - ~SensorParams(); + virtual ~SensorParams(); /** *@brief Copy constructor diff --git a/otbIncludeDirectories.cmake b/otbIncludeDirectories.cmake index d748355cd3156e638513bdebf118764b80903d3f..32abab858ffcf1dc5f0ae417bcc7a57cc59ef558 100644 --- a/otbIncludeDirectories.cmake +++ b/otbIncludeDirectories.cmake @@ -15,9 +15,12 @@ IF(OTB_USE_EXTERNAL_BOOST) ELSE(OTB_USE_EXTERNAL_BOOST) SET(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE} ${OTB_SOURCE_DIR}/Utilities/BGL - ${OTB_SOURCE_DIR}/Utilities/BGL/boost) + ${OTB_SOURCE_DIR}/Utilities/BGL/boost +) ENDIF(OTB_USE_EXTERNAL_BOOST) + + # These directories are always needed. SET(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE} ${OTB_SOURCE_DIR}/Code/Common @@ -50,7 +53,6 @@ SET(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE} ${OTB_SOURCE_DIR}/Utilities/otbkml ${OTB_SOURCE_DIR}/Utilities/otbkml/src ${OTB_SOURCE_DIR}/Utilities/otbkml/third_party - ${OTB_SOURCE_DIR}/Utilities/otbkml/third_party/boost_1_34_1 # ${OTB_SOURCE_DIR}/Utilities/otbkml/third_party/zlib-1.2.3 # ${OTB_SOURCE_DIR}/Utilities/otbkml/third_party/zlib-1.2.3/contrib ${OTB_SOURCE_DIR}/Utilities/otbliblas/include @@ -61,6 +63,12 @@ SET(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE} ${OTB_BINARY_DIR}/Code/Visualization ) + +IF(NOT OTB_USE_EXTERNAL_BOOST) + SET(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE} + ${OTB_SOURCE_DIR}/Utilities/otbkml/third_party/boost_1_34_1) +ENDIF(NOT OTB_USE_EXTERNAL_BOOST) + IF(OTB_COMPILE_JPEG2000) SET(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE} ${OTB_SOURCE_DIR}/Utilities/otbopenjpeg @@ -85,6 +93,13 @@ IF(OTB_USE_CURL) ${CURL_INCLUDE_DIR} ) ENDIF(OTB_USE_CURL) +#----------------------------------------------------------------------------- +# Include directories from the MAPNIK build tree. +IF(OTB_USE_MAPNIK) + SET(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE} + ${MAPNIK_INCLUDE_DIR} ) +ENDIF(OTB_USE_MAPNIK) + #----------------------------------------------------------------------------- # Include directories from the ITK build tree. IF(OTB_USE_EXTERNAL_ITK) @@ -279,6 +294,12 @@ IF(OTB_USE_CURL) ${CURL_INCLUDE_DIR} ) ENDIF(OTB_USE_CURL) +#For MAPNIK header file +IF(OTB_USE_MAPNIK) + SET(OTB_INCLUDE_ABSOLUE_DIRS ${OTB_INCLUDE_ABSOLUE_DIRS} + ${MAPNIK_INCLUDE_DIR} ) +ENDIF(OTB_USE_MAPNIK) + # For OpentTreads header file IF(OTB_USE_EXTERNAL_OPENTHREADS) SET(OTB_INCLUDE_ABSOLUE_DIRS ${OTB_INCLUDE_ABSOLUE_DIRS}