[Liblas-commits] libpc: set output point format to same as input

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Mar 1 18:32:11 EST 2011


details:   http://hg.liblas.orglibpc/rev/9e53c836c1c1
changeset: 147:9e53c836c1c1
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Tue Mar 01 15:31:48 2011 -0800
description:
set output point format to same as input
Subject: libpc: wrap user function in try/catch

details:   http://hg.liblas.orglibpc/rev/ee76332d0836
changeset: 148:ee76332d0836
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Tue Mar 01 15:32:03 2011 -0800
description:
wrap user function in try/catch

diffstat:

 apps/Application.cpp |  20 ++++++++++++++++++--
 apps/pc2pc.cpp       |   2 ++
 2 files changed, 20 insertions(+), 2 deletions(-)

diffs (43 lines):

diff -r 3bb36d53330d -r ee76332d0836 apps/Application.cpp
--- a/apps/Application.cpp	Tue Mar 01 13:51:51 2011 -0800
+++ b/apps/Application.cpp	Tue Mar 01 15:32:03 2011 -0800
@@ -88,9 +88,25 @@
     boost::timer timer;
     
     // call derived function
-    int status = execute();
+    int status = 0;
+    
+    try
+    {
+        status = execute();
+    }
+    catch (std::exception e)
+    {
+        const std::string s(e.what());
+        runtimeError("Caught exception: " + s);
+        status = 1;
+    }
+    catch (...)
+    {
+        runtimeError("Caught unknown exception");
+        status = 1;
+    }
 
-    if (hasOption("timer"))
+    if (status == 0 && hasOption("timer"))
     {
         const double t = timer.elapsed();
         std::cout << "Elapsed time: " << t << " seconds" << std::endl;
diff -r 3bb36d53330d -r ee76332d0836 apps/pc2pc.cpp
--- a/apps/pc2pc.cpp	Tue Mar 01 13:51:51 2011 -0800
+++ b/apps/pc2pc.cpp	Tue Mar 01 15:32:03 2011 -0800
@@ -108,6 +108,8 @@
 
         //BUG: handle laz writer.setCompressed(false);
 
+        writer.setPointFormat( reader.getPointFormatNumber() );
+
         size_t np = (size_t)numPoints;
         assert(numPoints == np); // BUG
         writer.write(np);


More information about the Liblas-commits mailing list