[Liblas-commits] r1266 - in trunk: apps include/liblas src

liblas-commits at liblas.org liblas-commits at liblas.org
Fri May 15 12:27:41 EDT 2009


Author: hobu
Date: Fri May 15 12:27:40 2009
New Revision: 1266
URL: http://liblas.org/changeset/1266

Log:
indexing does not belong in the reader

Modified:
   trunk/apps/lasindex.cpp
   trunk/include/liblas/lasreader.hpp
   trunk/src/lasreader.cpp

Modified: trunk/apps/lasindex.cpp
==============================================================================
--- trunk/apps/lasindex.cpp	(original)
+++ trunk/apps/lasindex.cpp	Fri May 15 12:27:40 2009
@@ -105,43 +105,43 @@
         usage();
         exit(-1);
     }
-    std::cout << "input: " << input<<  " output: " <<output<<std::endl;
-
-    std::istream* istrm = OpenInput(input);
-    LASReader* reader = new LASReader(*istrm);
-    reader->Index(input);
-    
-    LASHeader header = reader->GetHeader();
-    std::cout << "number of points: " << header.GetPointRecordsCount() << std::endl;
-    
-    for (int i=0; i< header.GetPointRecordsCount(); i++) {
-        
-        try{
-            bool read = reader->ReadPointAt(i);
-            LASPoint p = reader->GetPoint();
-        } catch (Tools::IllegalStateException& e) {
-            std::string s = e.what();
-            std::cout << "error creating index" << s <<std::endl; exit(1);
-        }        
-        
-        std::cout.precision(2);
-        std::cout.setf(std::ios_base::fixed);
-        // std::cout << "x: " << p.GetX() << " y: " << p.GetY() << std::endl;
-    }
-    
-    LASIndex* idx = reader->GetIndex();
-
-    std::vector<liblas::uint32_t>* ids = 0;
-    try{
-        ids = idx->intersects(289815.12,4320979.06, 289818.01,4320982.59,46.83,170.65);
-    } catch (Tools::IllegalArgumentException& e) {
-        std::string s = e.what();
-        std::cout << "error querying index value" << s <<std::endl; exit(1);
-    }
-        
-    
-    
-    std::cout << "Vec length" << ids->size() << std::endl;
-    delete reader;
-    delete istrm;
+    // std::cout << "input: " << input<<  " output: " <<output<<std::endl;
+    // 
+    // std::istream* istrm = OpenInput(input);
+    // LASReader* reader = new LASReader(*istrm);
+    // reader->Index(input);
+    // 
+    // LASHeader header = reader->GetHeader();
+    // std::cout << "number of points: " << header.GetPointRecordsCount() << std::endl;
+    // 
+    // for (int i=0; i< header.GetPointRecordsCount(); i++) {
+    //     
+    //     try{
+    //         bool read = reader->ReadPointAt(i);
+    //         LASPoint p = reader->GetPoint();
+    //     } catch (Tools::IllegalStateException& e) {
+    //         std::string s = e.what();
+    //         std::cout << "error creating index" << s <<std::endl; exit(1);
+    //     }        
+    //     
+    //     std::cout.precision(2);
+    //     std::cout.setf(std::ios_base::fixed);
+    //     // std::cout << "x: " << p.GetX() << " y: " << p.GetY() << std::endl;
+    // }
+    // 
+    // LASIndex* idx = reader->GetIndex();
+    // 
+    // std::vector<liblas::uint32_t>* ids = 0;
+    // try{
+    //     ids = idx->intersects(289815.12,4320979.06, 289818.01,4320982.59,46.83,170.65);
+    // } catch (Tools::IllegalArgumentException& e) {
+    //     std::string s = e.what();
+    //     std::cout << "error querying index value" << s <<std::endl; exit(1);
+    // }
+    //     
+    // 
+    // 
+    // std::cout << "Vec length" << ids->size() << std::endl;
+    // delete reader;
+    // delete istrm;
 }

Modified: trunk/include/liblas/lasreader.hpp
==============================================================================
--- trunk/include/liblas/lasreader.hpp	(original)
+++ trunk/include/liblas/lasreader.hpp	Fri May 15 12:27:40 2009
@@ -49,10 +49,6 @@
 #include <liblas/lasspatialreference.hpp>
 #include <liblas/detail/fwd.hpp>
 
-#ifdef HAVE_SPATIALINDEX
-#include <liblas/lasindex.hpp>
-#endif
-
 // std
 #include <iosfwd>
 #include <string>
@@ -92,10 +88,6 @@
     void Index(std::string& filename);
     void Index();
 
-#ifdef HAVE_SPATIALINDEX
-    LASIndex* GetIndex();
-#endif
-
 private:
 
     // Blocked copying operations, declared but not defined.
@@ -109,13 +101,6 @@
     LASPoint m_point;
     std::vector<LASVariableRecord> m_vlrs;
     
-    bool m_doindex;
-
-#ifdef HAVE_SPATIALINDEX
-    LASIndex* m_index;
-#else
-    typedef void* LASIndex;
-#endif
 };
 
 } // namespace liblas

Modified: trunk/src/lasreader.cpp
==============================================================================
--- trunk/src/lasreader.cpp	(original)
+++ trunk/src/lasreader.cpp	Fri May 15 12:27:40 2009
@@ -55,12 +55,9 @@
 {
 
 LASReader::LASReader(std::istream& ifs) :
-    m_pimpl(detail::ReaderFactory::Create(ifs)),
-    m_doindex(false)
+    m_pimpl(detail::ReaderFactory::Create(ifs))
 {
-#ifdef HAVE_SPATIALINDEX
-    m_index = 0;
-#endif
+
     Init();
 }
 
@@ -68,9 +65,6 @@
 {
     // empty, but required so we can implement PIMPL using
     // std::auto_ptr with incomplete type (Reader).
-#ifdef HAVE_SPATIALINDEX
-    if (m_index != 0) delete m_index;
-#endif
 }
 
 std::size_t LASReader::GetVersion() const
@@ -97,10 +91,6 @@
 bool LASReader::ReadPointAt(std::size_t n)
 {
     bool ret = m_pimpl->ReadPointAt(n, m_point, m_header);
-
-#ifdef HAVE_SPATIALINDEX
-    if (m_doindex) m_index->insert(m_point, n);
-#endif
     return ret;
 }
 
@@ -156,28 +146,5 @@
     return true;
 }
 
-void LASReader::Index()
-{
-    m_doindex = true;
-#ifdef HAVE_SPATIALINDEX
-    m_index = new LASIndex();
-#endif
-}
-
-void LASReader::Index(std::string& filename)
-{
-    m_doindex = true;
-#ifdef HAVE_SPATIALINDEX
-    m_index = new LASIndex(filename);
-#endif
-}
-
-#ifdef HAVE_SPATIALINDEX
-
-LASIndex* LASReader::GetIndex()
-{
-    return m_index;
-}
-#endif
 } // namespace liblas
 


More information about the Liblas-commits mailing list