[Liblas-commits] hg: use a pointer to the list of filters for now

liblas-commits at liblas.org liblas-commits at liblas.org
Thu May 20 14:24:52 EDT 2010


changeset 5dfcb15cc06d in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=5dfcb15cc06d
summary: use a pointer to the list of filters for now

diffstat:

 apps/las2las2.cpp            |   2 +-
 include/liblas/lasreader.hpp |   4 ++--
 src/lasreader.cpp            |  16 ++++++++++------
 3 files changed, 13 insertions(+), 9 deletions(-)

diffs (97 lines):

diff -r 422eaffeb92c -r 5dfcb15cc06d apps/las2las2.cpp
--- a/apps/las2las2.cpp	Thu May 20 07:44:44 2010 -0500
+++ b/apps/las2las2.cpp	Thu May 20 13:24:43 2010 -0500
@@ -203,7 +203,7 @@
         }
         liblas::Reader reader(ifs);
         
-        reader.SetFilters(filters);
+        reader.SetFilters(&filters);
     
         std::ofstream ofs;
         if (!liblas::Create(ofs, out_file.c_str()))
diff -r 422eaffeb92c -r 5dfcb15cc06d include/liblas/lasreader.hpp
--- a/include/liblas/lasreader.hpp	Thu May 20 07:44:44 2010 -0500
+++ b/include/liblas/lasreader.hpp	Thu May 20 13:24:43 2010 -0500
@@ -139,7 +139,7 @@
     /// keep a point that was read from the file.  Filters have *no* 
     /// effect for reading data at specific locations in the file.  
     /// They only affect reading ReadNextPoint-style operations
-    void SetFilters(std::vector<liblas::FilterI*>& filters) {std::cout << "setting filters to " << m_filters.size() << std::endl; m_filters = filters;}
+    void SetFilters(std::vector<liblas::FilterI*>* filters) {m_filters = filters;}
 
 private:
 
@@ -158,7 +158,7 @@
     // read from the istream
     bool bCustomHeader;
     
-    std::vector<liblas::FilterI*> m_filters;
+    std::vector<liblas::FilterI*>* m_filters;
 
     // std::istream& m_ifs;
     
diff -r 422eaffeb92c -r 5dfcb15cc06d src/lasreader.cpp
--- a/src/lasreader.cpp	Thu May 20 07:44:44 2010 -0500
+++ b/src/lasreader.cpp	Thu May 20 13:24:43 2010 -0500
@@ -60,7 +60,8 @@
     m_pimpl(new detail::CachedReaderImpl(ifs,3)),
     m_point(0),
     m_empty_point(new Point()),
-    bCustomHeader(false)
+    bCustomHeader(false),
+    m_filters(0)
 {
     Init();
 }
@@ -69,7 +70,8 @@
     m_pimpl(reader),
     m_point(0),
     m_empty_point(new Point()),
-    bCustomHeader(false)
+    bCustomHeader(false),
+    m_filters(0)
 {
     Init();
 }
@@ -78,7 +80,8 @@
     m_pimpl(new detail::CachedReaderImpl(ifs,3)),
     m_point(0),
     m_empty_point(new Point()),
-    bCustomHeader(false)
+    bCustomHeader(false),
+    m_filters(0)
 {
     m_header = header;
     bCustomHeader = true;
@@ -108,11 +111,12 @@
 
     try {
         m_point = const_cast<Point*>(&(m_pimpl->ReadNextPoint(m_header)));
-        if (m_filters.size() != 0) {
+        if (m_filters != 0 ) {
+        if (m_filters->size() != 0) {
             // We have filters, filter this point.  All filters must 
             // return true for us to keep it.
             bool keep = false;
-            for (i = m_filters.begin(); i != m_filters.end(); ++i) {
+            for (i = m_filters->begin(); i != m_filters->end(); ++i) {
                 liblas::FilterI* filter = *i;
                 if (filter->filter(*m_point)){
                     // if ->filter() is true, we keep the point
@@ -129,6 +133,7 @@
                 return true;
             }
         }
+        }
         return true;
     } catch (std::out_of_range) {
         m_point = 0;
@@ -190,7 +195,6 @@
     // keep it around until the reader closes down and then deletes.  
     // 
     m_point = m_empty_point;
-    m_filters.resize(0);
 }
 
 std::istream& Reader::GetStream() const


More information about the Liblas-commits mailing list