From 86d53d5b53fd5734626f3d9402804740b5f39de9 Mon Sep 17 00:00:00 2001
From: Emmanuel Christophe <emmanuel.christophe@orfeo-toolbox.org>
Date: Wed, 14 Jan 2009 15:01:07 +0800
Subject: [PATCH] DOC: add PlaceNameToLonLatExample

---
 Examples/Projections/CMakeLists.txt           | 16 +++++++++--
 .../Projections/PlaceNameToLonLatExample.cxx  | 28 +++++++++++++++++++
 .../otbProjectionsExamplesTests.cxx           |  5 ++++
 3 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/Examples/Projections/CMakeLists.txt b/Examples/Projections/CMakeLists.txt
index df31ac0a3b..66e5b2a36c 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 a83ae12b71..d312d7b172 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 abf7d0bc66..57df328600 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"
-- 
GitLab