[Liblas-commits] hg-main-tree: make base_table_bounds optional, and if not provid...

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Aug 2 14:57:35 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/9a6cd83d3a90
changeset: 993:9a6cd83d3a90
user:      Howard Butler <hobu.inc at gmail.com>
date:      Tue Aug 02 13:57:31 2011 -0500
description:
make base_table_bounds optional, and if not provided in the options, use the cumulated block bounds

diffstat:

 src/drivers/oci/Writer.cpp |  32 ++++++++++++++++++++++++--------
 1 files changed, 24 insertions(+), 8 deletions(-)

diffs (51 lines):

diff -r 3034b77d2527 -r 9a6cd83d3a90 src/drivers/oci/Writer.cpp
--- a/src/drivers/oci/Writer.cpp	Tue Aug 02 13:43:25 2011 -0500
+++ b/src/drivers/oci/Writer.cpp	Tue Aug 02 13:57:31 2011 -0500
@@ -559,8 +559,19 @@
     long gtype = GetGType();
     
     std::string eleminfo = CreatePCElemInfo();
+    
+    std::string bounds_string;
+    try {
+        bounds_string = tree.get<std::string>("base_table_bounds");
+    } catch (boost::property_tree::ptree_bad_path const& ) 
+    {
+        if (IsGeographic(srid))
+            bounds_string = std::string("([-179.99, 179.99], [-89.99, 89.99])");
+        else
+            bounds_string = std::string("[0.0, 0.0], [100.0, 100.0]");
+    }
 
-    std::string bounds_string  = tree.get<std::string>("base_table_bounds");
+
     std::stringstream ss(bounds_string, std::stringstream::in | std::stringstream::out);
     pdal::Bounds<double> e;
     ss >> e;
@@ -1182,14 +1193,19 @@
     
     boost::uint32_t srid = tree.get<boost::uint32_t>("srid");    
 
-    std::string bounds_string  = tree.get<std::string>("base_table_bounds");
-    std::stringstream ss(bounds_string, std::stringstream::in | std::stringstream::out);
     pdal::Bounds<double> e;
-    ss >> e;
-    
-    // If the user didn't override it in the options, we'll use our cumulated one
-    if (e.empty()) e = m_pcExtent;
-    
+    std::string bounds_string;
+    try {
+        bounds_string = tree.get<std::string>("base_table_bounds");
+        std::stringstream ss(bounds_string, std::stringstream::in | std::stringstream::out);
+        ss >> e;
+
+    } catch (boost::property_tree::ptree_bad_path const& ) 
+    {
+        // If the user didn't override it in the options, we'll use our cumulated one
+        e = m_pcExtent;
+    }
+
     long gtype = GetGType();
     
     std::string eleminfo = CreatePCElemInfo();


More information about the Liblas-commits mailing list