From 4134f46286541eb7e03501ed936fb597990b5110 Mon Sep 17 00:00:00 2001
From: Emmanuel Christophe <emmanuel.christophe@orfeo-toolbox.org>
Date: Tue, 11 Nov 2008 11:44:49 +0800
Subject: [PATCH] ENH: liblas, instantiation test OK

---
 Code/IO/otbPointSetFileReader.h   |  1 +
 Code/IO/otbPointSetFileReader.txx | 21 +++++++--------------
 Testing/Code/IO/CMakeLists.txt    |  6 +++---
 Testing/Code/IO/otbIOTests16.cxx  |  2 ++
 4 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/Code/IO/otbPointSetFileReader.h b/Code/IO/otbPointSetFileReader.h
index b93fe23053..35583ae006 100644
--- a/Code/IO/otbPointSetFileReader.h
+++ b/Code/IO/otbPointSetFileReader.h
@@ -73,6 +73,7 @@ template<class TOutputPointSet>
     void TestFileExistanceAndReadability();
     
     std::string m_FileName; // The file to be read
+    long int m_NumberOfPoints;
     
   private:
     PointSetFileReader(const Self&); //purposely not implemented
diff --git a/Code/IO/otbPointSetFileReader.txx b/Code/IO/otbPointSetFileReader.txx
index dc5121a0ff..709e6d7298 100644
--- a/Code/IO/otbPointSetFileReader.txx
+++ b/Code/IO/otbPointSetFileReader.txx
@@ -33,6 +33,7 @@ namespace otb
       PointSetFileReader<TOutputPointSet>
   ::PointSetFileReader() : otb::PointSetSource<TOutputPointSet>()
   {
+    m_NumberOfPoints=-1;
   }
   
   template <class TOutputPointSet>
@@ -83,7 +84,8 @@ namespace otb
     std::cout << "Signature: " << header.GetFileSignature() << std::endl;
     std::cout << "Points count: " << header.GetPointRecordsCount() << std::endl;
 
-  
+    m_NumberOfPoints = header.GetPointRecordsCount();
+    
   
   }
   
@@ -97,7 +99,7 @@ namespace otb
     if( ! itksys::SystemTools::FileExists( m_FileName.c_str() ) )
     {
       itk::ImageFileReaderException e(__FILE__, __LINE__);
-      OStringStream msg;
+      itk::OStringStream msg;
       msg <<"The file doesn't exist. "
           << std::endl << "Filename = " << m_FileName
           << std::endl;
@@ -112,7 +114,7 @@ namespace otb
     if( readTester.fail() )
     {
       readTester.close();
-      OStringStream msg;
+      itk::OStringStream msg;
       msg <<"The file couldn't be opened for reading. "
           << std::endl << "Filename: " << m_FileName
           << std::endl;
@@ -130,7 +132,7 @@ namespace otb
   {
   
 
-    typename TOutputImage::Pointer output = this->GetOutput();
+    typename TOutputPointSet::Pointer output = this->GetOutput();
   
   
   }
@@ -142,16 +144,7 @@ namespace otb
   ::PrintSelf(std::ostream& os, itk::Indent indent) const
   {
     Superclass::PrintSelf(os, indent);
-
-    if (this->->GetOutput())
-    {
-      os << indent << "Number of points: " << this->->GetOutput()->GetNumberOfPoints() << std::endl;
-    }
-    else
-    {
-      os << indent << "Output: (null)" << "\n";
-    }
-
+    os << indent << "Number of points: " << this->m_NumberOfPoints << std::endl;
     os << indent << "m_FileName: " << this->m_FileName << "\n";
   }
   
diff --git a/Testing/Code/IO/CMakeLists.txt b/Testing/Code/IO/CMakeLists.txt
index 9aee3ecb29..f838a212fd 100755
--- a/Testing/Code/IO/CMakeLists.txt
+++ b/Testing/Code/IO/CMakeLists.txt
@@ -1582,15 +1582,15 @@ ADD_TEST(ioTvImageFileReaderTIF2RADCI4 ${IO_TESTS16}
 #        ${TEMP}/ioImageFileReaderPNG2RADPHA.rad )
 
 
-ADD_TEST(ioTuPointSetFileReaderNew ${IO_TESTS15} 
+ADD_TEST(ioTuPointSetFileReaderNew ${IO_TESTS16} 
         otbPointSetFileReaderNew )
 
-ADD_TEST(ioTvPointSetFileReader ${IO_TESTS15} 
+ADD_TEST(ioTvPointSetFileReader ${IO_TESTS16} 
         --compare-ascii ${TOL}  ${BASELINE_FILES}/ioPointSetFileReader.txt
                         ${TEMP}/ioPointSetFileReader.txt
         otbPointSetFileReader
   ${INPUTDATA}/lidar.las
-  ${TEMP}/ioPointSetFileReader.txt)        
+  ${TEMP}/ioPointSetFileReader.txt)
         
   
 #----------------------------------------------------------------------------------
diff --git a/Testing/Code/IO/otbIOTests16.cxx b/Testing/Code/IO/otbIOTests16.cxx
index 3b14ec8a34..e960868109 100644
--- a/Testing/Code/IO/otbIOTests16.cxx
+++ b/Testing/Code/IO/otbIOTests16.cxx
@@ -35,4 +35,6 @@ REGISTER_TEST(otbImageFileReaderRADFloat);
 REGISTER_TEST(otbImageFileReaderRADComplexDouble);
 REGISTER_TEST(otbImageFileReaderRADComplexFloat);
 REGISTER_TEST(otbImageFileReaderRADComplexInt);
+REGISTER_TEST(otbPointSetFileReaderNew);
+REGISTER_TEST(otbPointSetFileReader);
 }
-- 
GitLab