[Liblas-commits] hg: Fixed an indentation mistake in oci2las.py
liblas-commits at liblas.org
liblas-commits at liblas.org
Thu Jan 13 20:15:00 EST 2011
details: http://hg.liblas.orghg/rev/130d65ed4b62
changeset: 2761:130d65ed4b62
user: William Angley <angley_william at bah.com>
date: Thu Jan 13 17:49:20 2011 -0500
description:
Fixed an indentation mistake in oci2las.py
Subject: hg: LASReader_Create now uses liblas::ReaderFactory when creating readers.
details: http://hg.liblas.orghg/rev/67a2f45de800
changeset: 2762:67a2f45de800
user: William Angley <angley_william at bah.com>
date: Thu Jan 13 18:30:34 2011 -0500
description:
LASReader_Create now uses liblas::ReaderFactory when creating readers.
Subject: hg: Updated LASReader_CreateWithHeader to handle compressed lasfiles.
details: http://hg.liblas.orghg/rev/3c789f598711
changeset: 2763:3c789f598711
user: William Angley <angley_william at bah.com>
date: Thu Jan 13 19:24:49 2011 -0500
description:
Updated LASReader_CreateWithHeader to handle compressed lasfiles.
This code was "borrowed" from src/factory.cpp.
diffstat:
python/scripts/oci2las.py | 4 ++--
src/c_api.cpp | 24 +++++++++++++++++++++---
2 files changed, 23 insertions(+), 5 deletions(-)
diffs (62 lines):
diff -r 700fd86f446a -r 3c789f598711 python/scripts/oci2las.py
--- a/python/scripts/oci2las.py Thu Jan 13 15:07:46 2011 -0500
+++ b/python/scripts/oci2las.py Thu Jan 13 19:24:49 2011 -0500
@@ -187,8 +187,8 @@
if self.options.verbose:
print 'using minimum offsets', h.offset
- h.compressed = self.options.compressed
-
+ h.compressed = self.options.compressed
+
if self.srs:
h.srs = self.srs
diff -r 700fd86f446a -r 3c789f598711 src/c_api.cpp
--- a/src/c_api.cpp Thu Jan 13 15:07:46 2011 -0500
+++ b/src/c_api.cpp Thu Jan 13 19:24:49 2011 -0500
@@ -52,7 +52,9 @@
#endif
#include <liblas/liblas.hpp>
-
+#include <liblas/detail/reader/reader.hpp>
+#include <liblas/detail/reader/zipreader.hpp>
+#include <liblas/detail/reader/cachedreader.hpp>
typedef struct LASWriterHS *LASWriterH;
typedef struct LASReaderHS *LASReaderH;
@@ -223,7 +225,8 @@
try {
std::istream* istrm = OpenInput(std::string(filename));
- liblas::Reader* reader = new liblas::Reader(*istrm);
+ liblas::ReaderFactory f;
+ liblas::Reader* reader = new liblas::Reader(f.CreateWithStream(*istrm));
readers.insert(std::pair<liblas::Reader*, std::istream*>(reader, istrm));
return (LASReaderH) reader;
@@ -247,7 +250,22 @@
std::istream* istrm = OpenInput(std::string(filename));
liblas::Header* header = ((liblas::Header*) hHeader);
- liblas::Reader* reader = new liblas::Reader(*istrm);
+ liblas::Reader* reader = NULL;
+
+ if (header->Compressed())
+ {
+#ifdef HAVE_LASZIP
+ ReaderIPtr r = ReaderIPtr(new liblas::detail::ZipReaderImpl(*istrm) );
+ reader = new liblas::Reader(r);
+#else
+ throw configuration_error("Compression support not enabled in liblas configuration");
+#endif
+ }
+ else {
+ ReaderIPtr r = ReaderIPtr(new liblas::detail::ReaderImpl(*istrm) );
+ reader = new liblas::Reader(r);
+ }
+
reader->SetHeader(*header);
readers.insert(std::pair<liblas::Reader*, std::istream*>(reader, istrm));
return (LASReaderH) reader;
More information about the Liblas-commits
mailing list