[Liblas-commits] hg: CachedReader doesn't do compressed data right now

liblas-commits at liblas.org liblas-commits at liblas.org
Mon Jan 24 11:56:55 EST 2011


details:   http://hg.liblas.orghg/rev/5b95133c6c13
changeset: 2814:5b95133c6c13
user:      Howard Butler <hobu.inc at gmail.com>
date:      Mon Jan 24 10:56:35 2011 -0600
description:
CachedReader doesn't do compressed data right now
Subject: hg: support reading compressed data with las2oci

details:   http://hg.liblas.orghg/rev/64c13911e15f
changeset: 2815:64c13911e15f
user:      Howard Butler <hobu.inc at gmail.com>
date:      Mon Jan 24 10:56:50 2011 -0600
description:
support reading compressed data with las2oci

diffstat:

 apps/las2oci.cpp |  6 +++++-
 src/factory.cpp  |  9 +++++++++
 2 files changed, 14 insertions(+), 1 deletions(-)

diffs (43 lines):

diff -r 9871e606bd68 -r 64c13911e15f apps/las2oci.cpp
--- a/apps/las2oci.cpp	Sun Jan 23 21:26:52 2011 -0600
+++ b/apps/las2oci.cpp	Mon Jan 24 10:56:50 2011 -0600
@@ -1108,7 +1108,7 @@
 
 
         std::istream* istrm2;
-        istrm2 = OpenInput(input, false);
+        istrm2 = liblas::Open(input, std::ios::in | std::ios::binary);
         
         liblas::Reader* reader2 = 0;
         if (bCachedReader)
@@ -1119,7 +1119,11 @@
             // reader2 = new liblas::Reader(*istrm2,0);
         }
         else
+        {
+            liblas::ReaderFactory rf;
+            liblas::Reader r =  rf.CreateWithStream(*istrm2);            
             reader2 = new liblas::Reader(*istrm2);
+        }
 
         reader2->SetFilters(filters);
         reader2->SetTransforms(transforms);
diff -r 9871e606bd68 -r 64c13911e15f src/factory.cpp
--- a/src/factory.cpp	Sun Jan 23 21:26:52 2011 -0600
+++ b/src/factory.cpp	Mon Jan 24 10:56:50 2011 -0600
@@ -73,6 +73,15 @@
 
 Reader ReaderFactory::CreateCached(std::istream& stream, boost::uint32_t cache_size)
 {
+    detail::HeaderReaderPtr h(new detail::reader::Header(stream));
+    h->read();
+    HeaderPtr header = h->GetHeader();
+
+    if (header->Compressed())
+    {
+        throw configuration_error("Compressed files are not readable with cached reader");
+    }
+
     ReaderIPtr r = ReaderIPtr(new detail::CachedReaderImpl(stream, cache_size) );
     return liblas::Reader(r);
 }


More information about the Liblas-commits mailing list