[Liblas-commits] hg-main-tree: add demo version

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Apr 19 00:27:57 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/8a9807af8582
changeset: 597:8a9807af8582
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Mon Apr 18 21:27:51 2011 -0700
description:
add demo version

diffstat:

 apps/pcview/main.cpp |  53 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 51 insertions(+), 2 deletions(-)

diffs (72 lines):

diff -r 1b8de28f673d -r 8a9807af8582 apps/pcview/main.cpp
--- a/apps/pcview/main.cpp	Mon Apr 18 21:22:04 2011 -0700
+++ b/apps/pcview/main.cpp	Mon Apr 18 21:27:51 2011 -0700
@@ -293,17 +293,66 @@
 }
 
 
+static void readFileSimple(Controller& controller, const string& file)
+{
+    boost::timer timer;
+
+    libpc::Stage* reader = new libpc::drivers::las::LasReader(file);
+    
+    libpc::Stage* decimator = new libpc::filters::DecimationFilter(*reader, factor);
+
+    libpc::Stage* colorizer = new libpc::filters::ColorFilter(*decimator);
+
+    const boost::uint32_t numPoints = (boost::uint32_t)colorizer->getNumPoints();
+
+#if 1
+    ThreadArgs t1arg(controller, *colorizer, 0, numPoints);
+    givePointsToEngine(&t1arg);
+    const boost::uint32_t numRead1 = t1arg.m_numRead;
+    cout << "moved " << numRead1 << " points into buffer1 done\n";
+#else
+    ThreadArgs t1arg(controller, *colorizer, 0, numPoints/2);
+    ThreadArgs t2arg(controller, *colorizer, numPoints/2, numPoints/2);
+    boost::thread t1(givePointsToEngine, &t1arg);
+    boost::thread t2(givePointsToEngine, &t2arg);
+
+    t1.join();
+    t2.join();
+
+    const boost::uint32_t numRead1 = t1arg.m_numRead;
+    const boost::uint32_t numRead2 = t2arg.m_numRead;
+
+    cout << "moved " << numRead1 << " points into buffer1 done\n";
+    cout << "moved " << numRead2 << " points into buffer2 done\n";
+#endif
+
+    cout << "done reading points\n";
+    cout << "  elapsed time: " << timer.elapsed() << " seconds" << std::endl;
+    
+    const libpc::Bounds<double>& bounds = colorizer->getBounds();
+    controller.setBounds((float)bounds.getMinimum(0), (float)bounds.getMinimum(1), (float)bounds.getMinimum(2), 
+                         (float)bounds.getMaximum(0), (float)bounds.getMaximum(1), (float)bounds.getMaximum(2));
+
+    delete colorizer;
+    delete decimator;
+    delete reader;
+
+    return;
+}
+
+
 int main(int argc, char** argv)
 {
     Controller controller;
-    //argc=1;
+
     if (argc==1)
     {
         readFakeFile(controller);
     }
     else
     {
-        readFile(controller, argv[1]);
+        //readFile(controller, argv[1]);
+        readFileSimple(controller, argv[1]);
     }
 
     controller.setWindowSize(500,500);


More information about the Liblas-commits mailing list