[Liblas-commits] hg: add verbose option to turn off std::cout updates

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Aug 10 09:39:20 EDT 2010


changeset d9bee62875b5 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=d9bee62875b5
summary: add verbose option to turn off std::cout updates

diffstat:

 apps/las2las2.cpp |  43 +++++++++++++++++++++++--------------------
 1 files changed, 23 insertions(+), 20 deletions(-)

diffs (99 lines):

diff -r c3e01b4cb920 -r d9bee62875b5 apps/las2las2.cpp
--- a/apps/las2las2.cpp	Mon Aug 09 22:18:21 2010 -0500
+++ b/apps/las2las2.cpp	Tue Aug 10 08:37:20 2010 -0500
@@ -1,16 +1,14 @@
-// $Id$
-//
-// ts2las translates TerraSolid .bin file to ASPRS LAS file.
-//
-// TerraSolid format: http://cdn.terrasolid.fi/tscan.pdf
-//
-// (C) Copyright Howard Butler 2009, hobu.inc at gmail.com
-//
-// Distributed under the BSD License
-// (See accompanying file LICENSE.txt or copy at
-// http://www.opensource.org/licenses/bsd-license.php)
-//
-// liblas
+/***************************************************************************
+ *
+ * Project: libLAS -- C/C++ read/write library for LAS LIDAR data
+ * Purpose: LAS translation with optional configuration
+ * Author:  Howard Butler, hobu.inc at gmail.com
+ ***************************************************************************
+ * Copyright (c) 2010, Howard Butler, hobu.inc at gmail.com 
+ *
+ * See LICENSE.txt in this source distribution for more information.
+ **************************************************************************/
+
 #include <liblas/liblas.hpp>
 
 #include <fstream>
@@ -191,7 +189,8 @@
 bool process(   std::string const& input,
                 std::string const& output,
                 std::vector<liblas::FilterI*>& filters,
-                uint32_t split_size)
+                uint32_t split_size,
+                bool verbose)
 {
 
 
@@ -218,7 +217,7 @@
         writer = start_writer(ofs, out+"-1"+".las", reader.GetHeader());
     }
 
-
+    if (verbose)
     std::cout << "Target:" 
         << "\n - : " << output
         << std::endl;
@@ -235,8 +234,9 @@
     while (reader.ReadNextPoint())
     {
         liblas::Point const& p = reader.GetPoint(); 
-        writer->WritePoint(p);  
-        term_progress(std::cout, (i + 1) / static_cast<double>(size));
+        writer->WritePoint(p);
+        if (verbose)
+            term_progress(std::cout, (i + 1) / static_cast<double>(size));
         i++;
 
         split_bytes_count = split_bytes_count - reader.GetHeader().GetSchema().GetByteSize();        
@@ -258,8 +258,8 @@
             split_bytes_count = 1024*1024*split_size;
         }
     }
-    
-    std::cout << std::endl;
+    if (verbose)
+        std::cout << std::endl;
     
     delete writer;
     delete ofs;
@@ -288,6 +288,7 @@
     bool last_return_only;
     bool first_return_only;
     bool valid_only;
+    bool verbose = false;
     std::vector<liblas::FilterI*> filters;    
 
     try {
@@ -315,6 +316,7 @@
             ("drop-intensity", po::value< string >(), "Range in which to drop intensity.\nThe following expression types are supported.  --drop-intensity <200\n --drop-intensity >400\n--drop-intensity >=200")
             ("keep-time", po::value< string >(), "Range in which to keep time.\nThe following expression types are supported.  --keep-time 413665.2336-414092.8462\n --keep-time <414094.8462\n --keep-time >413665.2336\n--keep-time >=413665.2336")
             ("drop-time", po::value< string >(), "Range in which to drop time.\nThe following expression types are supported.  --drop-time <413666.2336\n --drop-time >413665.2336\n--drop-time >=413665.2336")
+            ("verbose", po::value<bool>(&verbose)->zero_tokens(), "Keep only valid points")
             
 
     ;
@@ -477,7 +479,8 @@
         bool op = process(  input, 
                             output, 
                             filters,
-                            split_size
+                            split_size,
+                            verbose
                             );
         if (!op) {
             return (1);


More information about the Liblas-commits mailing list