From 7f5efd9ac883a87c918d162208ea69ca2c4dd245 Mon Sep 17 00:00:00 2001 From: Cyrille Valladeau <cyrille.valladeau@c-s.fr> Date: Mon, 27 Apr 2009 15:04:42 +0200 Subject: [PATCH] ENH : change .txx->.cxx + test --- ...ectory.txx => otbPrepareSRTMDirectory.cxx} | 0 Code/Projections/otbPrepareSRTMDirectory.txx | 132 ------------------ .../DisparityMap/otbMIRegistrationFilter.cxx | 4 +- Testing/Code/IO/CMakeLists.txt | 7 + Testing/Code/IO/otbIOTests17.cxx | 2 + .../otbPrepareSRTMDirectoryNew.cxx | 0 Testing/Code/Projections/CMakeLists.txt | 25 +--- 7 files changed, 13 insertions(+), 157 deletions(-) rename Code/IO/{otbPrepareSRTMDirectory.txx => otbPrepareSRTMDirectory.cxx} (100%) delete mode 100644 Code/Projections/otbPrepareSRTMDirectory.txx rename Testing/Code/{Projections => IO}/otbPrepareSRTMDirectoryNew.cxx (100%) diff --git a/Code/IO/otbPrepareSRTMDirectory.txx b/Code/IO/otbPrepareSRTMDirectory.cxx similarity index 100% rename from Code/IO/otbPrepareSRTMDirectory.txx rename to Code/IO/otbPrepareSRTMDirectory.cxx diff --git a/Code/Projections/otbPrepareSRTMDirectory.txx b/Code/Projections/otbPrepareSRTMDirectory.txx deleted file mode 100644 index 19bb4d4dcf..0000000000 --- a/Code/Projections/otbPrepareSRTMDirectory.txx +++ /dev/null @@ -1,132 +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. - -=========================================================================*/ -#ifndef __otbPrepareSRTMDirectory_txx -#define __otbPrepareSRTMDirectory_txx - -#include "otbPrepareSRTMDirectory.h" - - -namespace otb -{ - -/** - * Constructor - */ - -PrepareSRTMDirectory::PrepareSRTMDirectory() -{ - m_ULLon = 0.0; - m_ULLat = 0.0; - m_LRLon = 0.0; - m_LRLat = 0.0; - m_FullDEMDirectoryPath = ""; - m_DEMDirectoryPath = ""; -} - -/** - * - */ - -void -PrepareSRTMDirectory -::PrintSelf(std::ostream& os, itk::Indent indent) const -{ - this->Superclass::PrintSelf(os,indent); - os << indent << " m_ULLon " << m_ULLon << std::endl; - os << indent << " m_ULLat " << m_ULLat << std::endl; - os << indent << " m_LRLon " << m_LRLon << std::endl; - os << indent << " m_LRLat " << m_LRLat << std::endl; - os << indent << " m_FullDEMDirectoryPath" << m_FullDEMDirectoryPath << std::endl; - os << indent << " m_DEMDirectoryPath" << m_DEMDirectoryPath << std::endl; -} - - -bool PrepareSRTMDirectory::Evaluate() -{ - - int startX = static_cast<int>(floor(m_ULLon)); - int endX = static_cast<int>(ceil(m_LRLon)); - int startY = static_cast<int>(floor(m_LRLat)); - int endY = static_cast<int>(ceil(m_ULLat)); - - std::cout << startX << std::endl; - std::cout << endX << std::endl; - std::cout << startY << std::endl; - std::cout << endY << std::endl; - - for (int j=startY; j<endY; j++) - { - for (int i=startX; i< endX; i++) - { - std::ostringstream inputfilename; - inputfilename << m_FullDEMDirectoryPath; - inputfilename << "/"; - - std::ostringstream outputfilename; - outputfilename << m_DEMDirectoryPath; - outputfilename << "/"; - - if (j >= 0) - { - inputfilename << "N"; - inputfilename << setfill('0') << setw(2) << j; - outputfilename << "N"; - outputfilename << setfill('0') << setw(2) << j; - } - else - { - inputfilename << "S"; - inputfilename << setfill('0') << setw(2) << -j; - outputfilename << "S"; - outputfilename << setfill('0') << setw(2) << -j; - } - if (i >= 0) - { - inputfilename << "E"; - inputfilename << setfill('0') << setw(3) << i; - outputfilename << "E"; - outputfilename << setfill('0') << setw(3) << i; - } - else - { - inputfilename << "W"; - inputfilename << setfill('0') << setw(3) << -i; - outputfilename << "W"; - outputfilename << setfill('0') << setw(3) << -i; - } - - inputfilename << ".hgt"; - outputfilename << ".hgt"; - - std::cout << "Copying " << inputfilename.str() << " to " << outputfilename.str() << std::endl; - - //copy input file to output file - ossimFilename inputFile(inputfilename.str().c_str()); - ossimFilename outputFile(outputfilename.str().c_str()); - inputFile.copyFileTo(outputFile); - - - } - } - - return true; -} - -} // namespace otb - -#endif diff --git a/Testing/Code/DisparityMap/otbMIRegistrationFilter.cxx b/Testing/Code/DisparityMap/otbMIRegistrationFilter.cxx index ddf5bc7652..6d24671014 100644 --- a/Testing/Code/DisparityMap/otbMIRegistrationFilter.cxx +++ b/Testing/Code/DisparityMap/otbMIRegistrationFilter.cxx @@ -93,9 +93,11 @@ int otbMIRegistrationFilter(int argc, char* argv []) DFWriterType::Pointer dfWriter = DFWriterType::New(); dfWriter->SetFileName(argv[3]); dfWriter->SetInput( registrator->GetOutput() ); + + std::cout<<"UPDATE"<<std::endl; dfWriter->Update(); + std::cout<<"UPDATE"<<std::endl; return EXIT_SUCCESS; - } diff --git a/Testing/Code/IO/CMakeLists.txt b/Testing/Code/IO/CMakeLists.txt index c9cf9158f2..76c08420f4 100755 --- a/Testing/Code/IO/CMakeLists.txt +++ b/Testing/Code/IO/CMakeLists.txt @@ -1758,7 +1758,12 @@ ADD_TEST(ioTvDEMToOrthoImageGeneratorTest ${IO_TESTS17} N # hemisphere ) +# --- otb::PrepareSRTMDirectory --- +ADD_TEST(ioTuPrepareSRTMDirectoryNew ${IO_TESTS17} + otbPrepareSRTMDirectoryNew ) +#ADD_TEST(ioTuPrepareSRTMDirectoryTest ${IO_TESTS17} +# otbPrepareSRTMDirectoryTest ) #---------------------------------------------------------------------------------- SET(BasicIO_SRCS1 @@ -1901,6 +1906,8 @@ otbPointSetFileReader.cxx otbImageIOFactoryNew.cxx otbDEMToOrthoImageGeneratorNew.cxx otbDEMToOrthoImageGeneratorTest.cxx +otbPrepareSRTMDirectoryNew.cxx +#otbPrepareSRTMDirectoryTest.cxx ) INCLUDE_DIRECTORIES("${OTBTesting_BINARY_DIR}") diff --git a/Testing/Code/IO/otbIOTests17.cxx b/Testing/Code/IO/otbIOTests17.cxx index 00ce05ce08..a29c5c86ce 100644 --- a/Testing/Code/IO/otbIOTests17.cxx +++ b/Testing/Code/IO/otbIOTests17.cxx @@ -33,4 +33,6 @@ REGISTER_TEST(otbPointSetFileReader); REGISTER_TEST(otbImageIOFactoryNew); REGISTER_TEST(otbDEMToOrthoImageGeneratorNew); REGISTER_TEST(otbDEMToOrthoImageGeneratorTest); +REGISTER_TEST(otbPrepareSRTMDirectoryNew); +//REGISTER_TEST(otbPrepareSRTMDirectoryTest); } diff --git a/Testing/Code/Projections/otbPrepareSRTMDirectoryNew.cxx b/Testing/Code/IO/otbPrepareSRTMDirectoryNew.cxx similarity index 100% rename from Testing/Code/Projections/otbPrepareSRTMDirectoryNew.cxx rename to Testing/Code/IO/otbPrepareSRTMDirectoryNew.cxx diff --git a/Testing/Code/Projections/CMakeLists.txt b/Testing/Code/Projections/CMakeLists.txt index 71c7d98f9f..4248f8161f 100644 --- a/Testing/Code/Projections/CMakeLists.txt +++ b/Testing/Code/Projections/CMakeLists.txt @@ -17,7 +17,6 @@ SET(EPSILON 0.0001) SET(PROJECTIONS_TESTS1 ${CXX_TEST_PATH}/otbProjectionsTests1) SET(PROJECTIONS_TESTS2 ${CXX_TEST_PATH}/otbProjectionsTests2) SET(PROJECTIONS_TESTS3 ${CXX_TEST_PATH}/otbProjectionsTests3) -SET(PROJECTIONS_TESTS4 ${CXX_TEST_PATH}/otbProjectionsTests4) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ otbPROJECTIONS_TESTS1 ~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -336,24 +335,6 @@ ADD_TEST(prTvGeocentricTransform ${PROJECTIONS_TESTS3} ${TEMP}/prTvGeocentricTransform.txt ) - -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ otbPROJECTIONS_TESTS4 ~~~~~~~~~~~~~~~~~~~~~~~~~~ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -ADD_TEST(prTuPrepareSRTMDirectoryNew ${PROJECTIONS_TESTS4} - otbPrepareSRTMDirectoryNew ) - - - - - - - - - - - #======================================================================================= SET(Projections_SRCS1 otbProjectionBaseNew.cxx @@ -384,9 +365,7 @@ otbVectorDataProjectionFilterFromMapToGeo.cxx otbGeocentricTransformNew.cxx otbGeocentricTransform.cxx ) -SET(Projections_SRCS4 -otbPrepareSRTMDirectoryNew.cxx -) + INCLUDE_DIRECTORIES("${OTBTesting_BINARY_DIR}") @@ -396,7 +375,5 @@ ADD_EXECUTABLE(otbProjectionsTests2 otbProjectionsTests2.cxx ${Projections_SRCS2 TARGET_LINK_LIBRARIES(otbProjectionsTests2 OTBProjections OTBIO) ADD_EXECUTABLE(otbProjectionsTests3 otbProjectionsTests3.cxx ${Projections_SRCS3}) TARGET_LINK_LIBRARIES(otbProjectionsTests3 OTBProjections OTBIO) -ADD_EXECUTABLE(otbProjectionsTests4 otbProjectionsTests4.cxx ${Projections_SRCS4}) -TARGET_LINK_LIBRARIES(otbProjectionsTests4 OTBProjections OTBIO) ENDIF( NOT OTB_DISABLE_CXX_TESTING AND BUILD_TESTING ) -- GitLab