[Liblas-commits] hg: remove output-format and instead add an implicit 'compressed...

liblas-commits at liblas.org liblas-commits at liblas.org
Wed Dec 29 09:53:20 EST 2010


details:   http://hg.liblas.orghg/rev/6a7c1e7bc7ff
changeset: 2653:6a7c1e7bc7ff
user:      Howard Butler <hobu.inc at gmail.com>
date:      Wed Dec 29 08:53:10 2010 -0600
description:
remove output-format and instead add an implicit 'compressed' parameter to denote whether or not the file should be LASzip-compressed output

diffstat:

 apps/las2las.cpp |  24 ++++++------------------
 1 files changed, 6 insertions(+), 18 deletions(-)

diffs (58 lines):

diff -r b002cf6403c8 -r 6a7c1e7bc7ff apps/las2las.cpp
--- a/apps/las2las.cpp	Tue Dec 28 08:32:40 2010 -0700
+++ b/apps/las2las.cpp	Wed Dec 29 08:53:10 2010 -0600
@@ -245,7 +245,8 @@
     
     std::vector<liblas::FilterPtr> filters;
     std::vector<liblas::TransformPtr> transforms;
-    
+
+    bool bCompressed = false;
     liblas::Header header;
 
     try {
@@ -265,7 +266,7 @@
             ("split-pts", po::value<boost::uint32_t>(&split_pts)->default_value(0), "Split file into multiple files with each being this many points or less. If this value is 0, no splitting is done")
             ("input,i", po::value< string >(), "input LAS file")
             ("output,o", po::value< string >(&output)->default_value("output.las"), "output LAS file")
-            ("output-format", po::value< string >(&output_format)->default_value(""), "output format type ('las' or 'laz')")
+            ("compressed,c", po::value<bool>(&bCompressed)->zero_tokens()->implicit_value(true), "Produce .laz compressed data")
             ("verbose,v", po::value<bool>(&verbose)->zero_tokens(), "Verbose message output")
         ;
 
@@ -327,24 +328,11 @@
         // Transforms alter our header as well.  Setting scales, offsets, etc.
         transforms = GetTransforms(vm, verbose, header);
 
-        WriterFactory::FileType output_file_type = WriterFactory::FileType_Unknown;
-        if (output_format == "")
-        {
-            // use file extension
-            output_file_type = WriterFactory::InferFileTypeFromExtension(output);
-        }
-        else if (output_format == "las")
-        {
-            output_file_type = WriterFactory::FileType_LAS;
-        }
-        else if (output_format == "laz")
+        WriterFactory::FileType output_file_type = WriterFactory::FileType_LAS;
+        if (bCompressed)
         {
             output_file_type = WriterFactory::FileType_LAZ;
         }
-        else
-        {
-            output_file_type = WriterFactory::FileType_Unknown;
-        }
 
         switch (output_file_type)
         {
@@ -355,7 +343,7 @@
 #ifdef HAVE_LASZIP
             header.SetCompressed(true);
 #else
-            throw configuration_error("Compression support not enabled in liblas configuration");
+            throw configuration_error("LASzip compression support not enabled in this libLAS configuration.");
 #endif
             break;
         case WriterFactory::FileType_Unknown:


More information about the Liblas-commits mailing list