[Liblas-commits] hg-main-tree: fix up test for r1028

liblas-commits at liblas.org liblas-commits at liblas.org
Mon Aug 8 15:17:06 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/bee09538bc69
changeset: 1029:bee09538bc69
user:      Howard Butler <hobu.inc at gmail.com>
date:      Mon Aug 08 13:52:01 2011 -0500
description:
fix up test for r1028
Subject: hg-main-tree: more tweaks to support pipelines

details:   http://hg.libpc.orghg-main-tree/rev/52d4f4950510
changeset: 1030:52d4f4950510
user:      Howard Butler <hobu.inc at gmail.com>
date:      Mon Aug 08 14:12:07 2011 -0500
description:
more tweaks to support pipelines
Subject: hg-main-tree: support Options constructor for pipeline support

details:   http://hg.libpc.orghg-main-tree/rev/da606ab19938
changeset: 1031:da606ab19938
user:      Howard Butler <hobu.inc at gmail.com>
date:      Mon Aug 08 14:12:33 2011 -0500
description:
support Options constructor for pipeline support

diffstat:

 include/pdal/filters/Chipper.hpp |  22 +++++++++++-----------
 src/drivers/oci/Writer.cpp       |  22 +++++++++++++---------
 src/filters/Chipper.cpp          |   9 ++++++++-
 test/unit/ChipperTest.cpp        |   8 +++++++-
 test/unit/OptionsTest.cpp        |   2 +-
 5 files changed, 40 insertions(+), 23 deletions(-)

diffs (179 lines):

diff -r 405a795accc7 -r da606ab19938 include/pdal/filters/Chipper.hpp
--- a/include/pdal/filters/Chipper.hpp	Mon Aug 08 13:39:34 2011 -0500
+++ b/include/pdal/filters/Chipper.hpp	Mon Aug 08 14:12:33 2011 -0500
@@ -155,17 +155,17 @@
 
 public:
     Chipper(Stage& prevStage, const Options&);
-    Chipper(Stage& prevStage, boost::uint32_t max_partition_size)
-        : pdal::Filter(prevStage, Options::none())
-        , m_threshold(max_partition_size)
-        , m_xvec(chipper::DIR_X)
-        , m_yvec(chipper::DIR_Y)
-        , m_spare(chipper::DIR_NONE) 
-    {
-        checkImpedance();
-        setPointCountType(PointCount_Fixed);
-        setNumPoints(0);
-    }
+    // Chipper(Stage& prevStage, boost::uint32_t max_partition_size)
+    //     : pdal::Filter(prevStage, Options::none())
+    //     , m_threshold(max_partition_size)
+    //     , m_xvec(chipper::DIR_X)
+    //     , m_yvec(chipper::DIR_Y)
+    //     , m_spare(chipper::DIR_NONE) 
+    // {
+    //     checkImpedance();
+    //     setPointCountType(PointCount_Fixed);
+    //     setNumPoints(0);
+    // }
 
     virtual void initialize();
 
diff -r 405a795accc7 -r da606ab19938 src/drivers/oci/Writer.cpp
--- a/src/drivers/oci/Writer.cpp	Mon Aug 08 13:39:34 2011 -0500
+++ b/src/drivers/oci/Writer.cpp	Mon Aug 08 14:12:33 2011 -0500
@@ -54,6 +54,7 @@
 Writer::Writer(Stage& prevStage, const Options& options)
     : pdal::Writer(prevStage, options)
     , m_stage((Stage&)prevStage)
+    , m_doCreateIndex(false)
     , m_pc_id(0)
 {
     Debug();
@@ -291,7 +292,8 @@
 
 boost::int32_t Writer::getPCID() const 
 {
-    return getOptions().getValueOrThrow<boost::int32_t>("cloud_id");
+    return m_pc_id;
+    // return getOptions().getValueOrThrow<boost::int32_t>("cloud_id");
 }
 
 void Writer::CreateBlockIndex()
@@ -324,7 +326,7 @@
     std::string block_table_name = getOptions().getValueOrThrow<std::string>("block_table_name");
 
     boost::uint32_t srid = getOptions().getValueOrThrow<boost::uint32_t>("srid");
-    boost::uint32_t precision = getDefaultedOption<boost::uint32_t>("precision");
+    boost::uint32_t precision = getDefaultedOption<boost::uint32_t>("stream_output_precision");
     
     bool bUse3d = is3d();
     
@@ -402,7 +404,10 @@
         // the table doesn't exist.  If this really isn't the case, we're going 
         // to get more legit message further down the line.
         return false;
-    }  
+    } 
+    
+    if (isDebug())
+        std::cout << "checking for " << szTable << " existence" << std::endl;
     
     return true;
     
@@ -589,7 +594,7 @@
     std::string base_table_boundary_wkt = getDefaultedOption<std::string>("base_table_boundary_wkt");
     
     boost::uint32_t srid = getOptions().getValueOrThrow<boost::uint32_t>("srid");
-    boost::uint32_t precision = getDefaultedOption<boost::uint32_t>("precision");
+    boost::uint32_t precision = getDefaultedOption<boost::uint32_t>("stream_output_precision");
     boost::uint32_t capacity = getDefaultedOption<boost::uint32_t>("capacity");
 
     bool bUse3d = is3d();
@@ -785,18 +790,18 @@
 void Writer::writeBegin(boost::uint64_t targetNumPointsToWrite)
 {
 
-
+    bool bHaveOutputTable = BlockTableExists();
     
     if (getDefaultedOption<bool>("overwrite"))
     {
-        if (BlockTableExists())
+        if (bHaveOutputTable)
         {
             WipeBlockTable();
         }
     }
     
     RunFileSQL("pre_sql");
-    if (!BlockTableExists())
+    if (!bHaveOutputTable)
     {
         m_doCreateIndex = true;
         CreateBlockTable();
@@ -1278,7 +1283,6 @@
     statement->Define(szStatus);
     
     statement->Execute();
-    std::cout << "Trigger: " << szTrigger << " status: " << szStatus << std::endl;
 
     // Yes, we're assuming there's only one trigger that met these criteria.
     
@@ -1345,7 +1349,7 @@
     std::string trigger = ShutOff_SDO_PC_Trigger();
     
     std::ostringstream s_geom;
-    boost::uint32_t precision = getDefaultedOption<boost::uint32_t>("precision");
+    boost::uint32_t precision = getDefaultedOption<boost::uint32_t>("stream_output_precision");
     s_geom.setf(std::ios_base::fixed, std::ios_base::floatfield);
     s_geom.precision(precision);
 
diff -r 405a795accc7 -r da606ab19938 src/filters/Chipper.cpp
--- a/src/filters/Chipper.cpp	Mon Aug 08 13:39:34 2011 -0500
+++ b/src/filters/Chipper.cpp	Mon Aug 08 14:12:33 2011 -0500
@@ -139,8 +139,15 @@
 
 Chipper::Chipper(Stage& prevStage, const Options& options)
     : pdal::Filter(prevStage, options)
+    , m_xvec(chipper::DIR_X)
+    , m_yvec(chipper::DIR_Y)
+    , m_spare(chipper::DIR_NONE)
 {
-    throw not_yet_implemented("options ctor"); 
+    m_threshold = options.getValueOrThrow<boost::uint32_t>("capacity");
+
+    checkImpedance();
+    setPointCountType(PointCount_Fixed);
+    setNumPoints(0);
 }
 
 
diff -r 405a795accc7 -r da606ab19938 test/unit/ChipperTest.cpp
--- a/test/unit/ChipperTest.cpp	Mon Aug 08 13:39:34 2011 -0500
+++ b/test/unit/ChipperTest.cpp	Mon Aug 08 14:12:33 2011 -0500
@@ -38,6 +38,7 @@
 #include <pdal/filters/Chipper.hpp>
 #include <pdal/drivers/liblas/Writer.hpp>
 #include <pdal/drivers/liblas/Reader.hpp>
+#include <pdal/Options.hpp>
 
 #include "Support.hpp"
 
@@ -53,7 +54,12 @@
 
     {
         // need to scope the writer, so that's it dtor can use the stream
-        pdal::filters::Chipper chipper(reader, 15);
+        
+        pdal::Options options;
+        pdal::Option<boost::uint32_t> capacity("capacity", 15, "capacity");
+        options.add(capacity);
+        
+        pdal::filters::Chipper chipper(reader, options);
         chipper.initialize();
 
         const boost::uint64_t num_points = reader.getNumPoints();
diff -r 405a795accc7 -r da606ab19938 test/unit/OptionsTest.cpp
--- a/test/unit/OptionsTest.cpp	Mon Aug 08 13:39:34 2011 -0500
+++ b/test/unit/OptionsTest.cpp	Mon Aug 08 14:12:33 2011 -0500
@@ -170,7 +170,7 @@
     }
     catch (pdal::option_not_found ex)
     {
-        BOOST_CHECK(strcmp(ex.what(), "foo") == 0);
+        BOOST_CHECK(strcmp(ex.what(), "Required option 'foo' was not found on this stage") == 0);
         reached = true;
     }
     BOOST_CHECK(reached == true);


More information about the Liblas-commits mailing list