diff --git a/Examples/Projections/CMakeLists.txt b/Examples/Projections/CMakeLists.txt index df31ac0a3b35022fc52b5225ab6b3fd9cf5f54f1..66e5b2a36ca040504557e9654897e918cfba0d3f 100644 --- a/Examples/Projections/CMakeLists.txt +++ b/Examples/Projections/CMakeLists.txt @@ -101,7 +101,19 @@ ADD_TEST(VectorDataProjectionExampleTest ${EXE_TESTS} ) ENDIF(OTB_DATA_USE_LARGEINPUT) -ADD_EXECUTABLE(otbProjectionsExamplesTests otbProjectionsExamplesTests.cxx) -TARGET_LINK_LIBRARIES(otbProjectionsExamplesTests gdal ITKIO ITKAlgorithms ITKStatistics ITKNumerics ITKCommon OTBBasicFilters OTBCommon OTBDisparityMap OTBIO OTBSpatialReasoning OTBChangeDetection OTBFeatureExtraction OTBLearning OTBMultiScale OTBFusion OTBProjections) +IF( OTB_USE_CURL ) +ADD_TEST(PlaceNameToLonLatExampleTest ${EXE_TESTS} + PlaceNameToLonLatExampleTest + Toulouse +) +ENDIF( OTB_USE_CURL ) + +IF( OTB_USE_CURL ) + ADD_EXECUTABLE(otbProjectionsExamplesTests otbProjectionsExamplesTests.cxx) + TARGET_LINK_LIBRARIES(otbProjectionsExamplesTests OTBCommon OTBIO OTBProjections ${CURL_LIBRARY} tinyXML) +ELSE( OTB_USE_CURL ) + ADD_EXECUTABLE(otbProjectionsExamplesTests otbProjectionsExamplesTests.cxx) + TARGET_LINK_LIBRARIES(otbProjectionsExamplesTests OTBCommon OTBIO OTBProjections) +ENDIF( OTB_USE_CURL ) ENDIF( NOT OTB_DISABLE_CXX_TESTING AND BUILD_TESTING ) diff --git a/Examples/Projections/PlaceNameToLonLatExample.cxx b/Examples/Projections/PlaceNameToLonLatExample.cxx index a83ae12b7137a7569bfe5e820da0e43a66509927..d312d7b172e49ef604ecff5cf52bf0b225f21a82 100644 --- a/Examples/Projections/PlaceNameToLonLatExample.cxx +++ b/Examples/Projections/PlaceNameToLonLatExample.cxx @@ -42,12 +42,27 @@ int main( int argc, char* argv[] ) return EXIT_FAILURE; } + // Software Guide : BeginLatex + // + // You instantiate the class and pass the name you want to look for as a + // std::string to the SetPlaceName method. + // + // The call to evaluate will trigger the retrival process. + // + // Software Guide : EndLatex + // Software Guide : BeginCodeSnippet otb::PlaceNameToLonLat::Pointer pn2LL = otb::PlaceNameToLonLat::New(); pn2LL->SetPlaceName(std::string(argv[1])); pn2LL->Evaluate(); // Software Guide : EndCodeSnippet + // Software Guide : BeginLatex + // + // To get the data, you can simply call the GetLon and GetLat methods. + // + // Software Guide : EndLatex + // Software Guide : BeginCodeSnippet double lon = pn2LL->GetLon(); double lat = pn2LL->GetLat(); @@ -56,6 +71,19 @@ int main( int argc, char* argv[] ) std::cout << "Longitude: " << lon << std::endl; // Software Guide : EndCodeSnippet + + // Software Guide : BeginLatex + // + // If you tried with a string such as "Toulouse", you should obtain something + // like: + // + // \begin{verbatim} + // Latitude: 43.6044 + // Longitude: 1.44295 + // \end{verbatim} + // + // Software Guide : EndLatex + return EXIT_SUCCESS; } diff --git a/Examples/Projections/otbProjectionsExamplesTests.cxx b/Examples/Projections/otbProjectionsExamplesTests.cxx index abf7d0bc6607024b47f046f43a6e33994734b53c..57df32860016d74f38f18eb2e272cd4bd646602d 100644 --- a/Examples/Projections/otbProjectionsExamplesTests.cxx +++ b/Examples/Projections/otbProjectionsExamplesTests.cxx @@ -29,6 +29,7 @@ void RegisterTests() REGISTER_TEST(OrthoRectificationExampleTest); REGISTER_TEST(MapProjectionExampleTest); REGISTER_TEST(VectorDataProjectionExampleTest); + REGISTER_TEST(PlaceNameToLonLatExampleTest); } #undef main @@ -42,3 +43,7 @@ void RegisterTests() #undef main #define main VectorDataProjectionExampleTest #include "VectorDataProjectionExample.cxx" + +#undef main +#define main PlaceNameToLonLatExampleTest +#include "PlaceNameToLonLatExample.cxx"