[Liblas-commits] hg: .LAZ implies --compressed

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Jan 4 11:05:42 EST 2011


details:   http://hg.liblas.orghg/rev/b8ede5465c2b
changeset: 2674:b8ede5465c2b
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Tue Jan 04 08:05:32 2011 -0800
description:
.LAZ implies --compressed

diffstat:

 apps/las2las.cpp           |  18 +++++++++++++++++-
 include/liblas/factory.hpp |   1 +
 2 files changed, 18 insertions(+), 1 deletions(-)

diffs (43 lines):

diff -r e2cf1be6b142 -r b8ede5465c2b apps/las2las.cpp
--- a/apps/las2las.cpp	Mon Jan 03 10:59:15 2011 -0800
+++ b/apps/las2las.cpp	Tue Jan 04 08:05:32 2011 -0800
@@ -328,11 +328,27 @@
         // Transforms alter our header as well.  Setting scales, offsets, etc.
         transforms = GetTransforms(vm, verbose, header);
 
-        WriterFactory::FileType output_file_type = WriterFactory::FileType_LAS;
+        // our policy for determining the output format is this:
+        //   if -compressed given, use LAZ
+        //   else if we see .las or .laz, use LAS or LAZ (resp.)
+        //   else just use LAS
+        WriterFactory::FileType output_file_type = WriterFactory::FileType_Unknown;
         if (bCompressed)
         {
             output_file_type = WriterFactory::FileType_LAZ;
         }
+        else 
+        {
+            WriterFactory::FileType ext_type = WriterFactory::InferFileTypeFromExtension(output);
+            if (ext_type != WriterFactory::FileType_Unknown)
+            {
+                output_file_type = ext_type;
+            }
+            else
+            {
+                output_file_type = WriterFactory::FileType_LAS;
+            }
+        }
 
         switch (output_file_type)
         {
diff -r e2cf1be6b142 -r b8ede5465c2b include/liblas/factory.hpp
--- a/include/liblas/factory.hpp	Mon Jan 03 10:59:15 2011 -0800
+++ b/include/liblas/factory.hpp	Tue Jan 04 08:05:32 2011 -0800
@@ -102,6 +102,7 @@
     /// @exception nothrow
     ~WriterFactory() {};
 
+    // returns Unknown, unless we find a .laz or .las extension
     static FileType InferFileTypeFromExtension(const std::string&);
 private:
 


More information about the Liblas-commits mailing list