[Liblas-commits] hg-main-tree: remove OCI-specific stuff from
libpc::Options
liblas-commits at liblas.org
liblas-commits at liblas.org
Tue Apr 26 09:16:39 EDT 2011
details: http://hg.libpc.orghg-main-tree/rev/22692e3985f2
changeset: 651:22692e3985f2
user: Howard Butler <hobu.inc at gmail.com>
date: Tue Apr 26 08:16:36 2011 -0500
description:
remove OCI-specific stuff from libpc::Options
diffstat:
include/libpc/Options.hpp | 4 +-
include/libpc/drivers/oci/Reader.hpp | 1 +
include/libpc/drivers/oci/Writer.hpp | 10 +++-
src/Options.cpp | 82 +-----------------------------------
src/drivers/oci/Reader.cpp | 7 ++-
src/drivers/oci/Writer.cpp | 41 +++++++++++++----
src/drivers/oci/common.cpp | 45 +------------------
7 files changed, 51 insertions(+), 139 deletions(-)
diffs (truncated from 349 to 300 lines):
diff -r bc05bd220320 -r 22692e3985f2 include/libpc/Options.hpp
--- a/include/libpc/Options.hpp Mon Apr 25 21:12:51 2011 -0500
+++ b/include/libpc/Options.hpp Tue Apr 26 08:16:36 2011 -0500
@@ -52,9 +52,7 @@
public:
Options();
- bool IsDebug() const;
- bool Is3d() const;
- bool IsSolid() const;
+
boost::property_tree::ptree& GetPTree() {return m_tree; }
boost::property_tree::ptree const& GetPTree() const {return m_tree; }
};
diff -r bc05bd220320 -r 22692e3985f2 include/libpc/drivers/oci/Reader.hpp
--- a/include/libpc/drivers/oci/Reader.hpp Mon Apr 25 21:12:51 2011 -0500
+++ b/include/libpc/drivers/oci/Reader.hpp Tue Apr 26 08:16:36 2011 -0500
@@ -75,6 +75,7 @@
BlockPtr getBlock() const { return m_block; }
std::string getQuery() const;
bool isVerbose() const;
+ bool isDebug() const;
private:
diff -r bc05bd220320 -r 22692e3985f2 include/libpc/drivers/oci/Writer.hpp
--- a/include/libpc/drivers/oci/Writer.hpp Mon Apr 25 21:12:51 2011 -0500
+++ b/include/libpc/drivers/oci/Writer.hpp Tue Apr 26 08:16:36 2011 -0500
@@ -62,6 +62,9 @@
inline libpc::Bounds<double> getBounds() const { return m_bounds; }
inline Connection getConnection() const { return m_connection;}
+
+
+
protected:
// this is called once before the loop with the writeBuffer calls
virtual void writeBegin();
@@ -102,8 +105,13 @@
libpc::Bounds<double> const& extent);
void SetElements(Statement statement,
OCIArray* elem_info);
+
+ bool isVerbose() const;
+ bool isDebug() const;
+ bool is3d() const;
+ bool isSolid() const;
+
Stage& m_stage;
- // filters::Chipper m_chipper;
Options& m_options;
libpc::Bounds<double> m_bounds; // Bounds of the entire point cloud
diff -r bc05bd220320 -r 22692e3985f2 src/Options.cpp
--- a/src/Options.cpp Mon Apr 25 21:12:51 2011 -0500
+++ b/src/Options.cpp Tue Apr 26 08:16:36 2011 -0500
@@ -35,7 +35,7 @@
#include <libpc/Options.hpp>
#include <boost/concept_check.hpp> // ignore_unused_variable_warning
-
+#include <boost/optional.hpp>
#include <iostream>
#include <libpc/exceptions.hpp>
@@ -47,89 +47,9 @@
Options::Options()
{
m_tree.put("is3d", false);
- m_tree.put("solid", false);
- m_tree.put("overwrite", false);
- m_tree.put("debug", false);
- m_tree.put("verbose", false);
- m_tree.put("srid", 4269);
- m_tree.put("capacity", 8000);
- m_tree.put("precision", 8);
- m_tree.put("cloud_id", -1);
- m_tree.put("dimensions", 5);
- m_tree.put("connection", std::string(""));
- m_tree.put("block_table_name", std::string("output"));
- m_tree.put("block_table_partition_column", std::string(""));
- m_tree.put("block_table_partition_value", boost::int32_t(0));
- m_tree.put("base_table_name", std::string("hobu"));
- m_tree.put("cloud_column_name", std::string("cloud"));
- m_tree.put("header_blob_column_name", std::string(""));
- m_tree.put("base_table_aux_columns", std::string(""));
- m_tree.put("base_table_aux_values", std::string(""));
- m_tree.put("base_table_boundary_column", std::string(""));
- m_tree.put("base_table_boundary_wkt", std::string(""));
- m_tree.put("pre_block_sql", std::string(""));
- m_tree.put("pre_sql", std::string(""));
- m_tree.put("post_block_sql", std::string(""));
- m_tree.put("select_sql", std::string(""));
- m_tree.put("base_table_bounds", libpc::Bounds<double>());
- m_tree.put("blob_read_byte_size", boost::uint32_t(2000));
- m_tree.put("point_schema_override", "");
-
- boost::property_tree::ptree scales;
- scales.put("x", double(0.01));
- scales.put("y", double(0.01));
- scales.put("z", double(0.01));
- boost::property_tree::ptree offsets;
- offsets.put("x", double(0.0));
- offsets.put("y", double(0.0));
- offsets.put("z", double(0.0));
-
- m_tree.add_child("scale", scales);
- m_tree.add_child("offset", offsets);
}
-bool Options::IsDebug() const
-{
- bool debug = false;
- try
- {
- debug = m_tree.get<bool>("debug");
- }
- catch (boost::property_tree::ptree_bad_path const& e) {
- ::boost::ignore_unused_variable_warning(e);
-
- }
- return debug;
-}
-
-bool Options::Is3d() const
-{
- bool is3d = false;
- try
- {
- is3d = m_tree.get<bool>("is3d");
- }
- catch (boost::property_tree::ptree_bad_path const& e) {
- ::boost::ignore_unused_variable_warning(e);
-
- }
- return is3d;
-}
-
-bool Options::IsSolid() const
-{
- bool IsSolid = false;
- try
- {
- IsSolid = m_tree.get<bool>("solid");
- }
- catch (boost::property_tree::ptree_bad_path const& e) {
- ::boost::ignore_unused_variable_warning(e);
-
- }
- return IsSolid;
-}
std::ostream& operator<<(std::ostream& ostr, const Options& /*options*/)
diff -r bc05bd220320 -r 22692e3985f2 src/drivers/oci/Reader.cpp
--- a/src/drivers/oci/Reader.cpp Mon Apr 25 21:12:51 2011 -0500
+++ b/src/drivers/oci/Reader.cpp Tue Apr 26 08:16:36 2011 -0500
@@ -88,6 +88,11 @@
return m_options.GetPTree().get<bool>("verbose");
}
+bool Reader::isDebug() const
+{
+ return m_options.GetPTree().get<bool>("debug");
+}
+
std::string Reader::getQuery() const
{
return m_options.GetPTree().get<std::string>("select_sql");
@@ -95,7 +100,7 @@
void Reader::Debug()
{
- bool debug = m_options.IsDebug();
+ bool debug = isDebug();
CPLPopErrorHandler();
diff -r bc05bd220320 -r 22692e3985f2 src/drivers/oci/Writer.cpp
--- a/src/drivers/oci/Writer.cpp Mon Apr 25 21:12:51 2011 -0500
+++ b/src/drivers/oci/Writer.cpp Tue Apr 26 08:16:36 2011 -0500
@@ -111,7 +111,7 @@
{
// if we failed, let's try dropping the spatial index for the block_table_name
oss.str("");
- if (m_options.IsDebug())
+ if (isDebug())
std::cout << "Dropping index " << block_table_name
<< "_cloud_idx for block_table_name"
<< std::endl;
@@ -154,16 +154,37 @@
run(oss);
}
+bool Writer::isVerbose() const
+{
+ return m_options.GetPTree().get<bool>("verbose");
+}
+
+bool Writer::isDebug() const
+{
+ return m_options.GetPTree().get<bool>("debug");
+}
+
+bool Writer::is3d() const
+{
+ return m_options.GetPTree().get<bool>("is3d");
+}
+
+bool Writer::isSolid() const
+{
+ return m_options.GetPTree().get<bool>("solid");
+}
+
+
void Writer::CreateBlockIndex()
{
std::ostringstream oss;
std::string block_table_name = m_options.GetPTree().get<std::string>("block_table_name");
- bool is3d = m_options.Is3d();
+ bool bUse3d = is3d();
oss << "CREATE INDEX "<< block_table_name << "_cloud_idx on "
<< block_table_name << "(blk_extent) INDEXTYPE IS MDSYS.SPATIAL_INDEX";
- if (is3d)
+ if (bUse3d)
{
oss <<" PARAMETERS('sdo_indx_dims=3')";
}
@@ -187,7 +208,7 @@
boost::uint32_t srid = tree.get<boost::uint32_t>("srid");
boost::uint32_t precision = tree.get<boost::uint32_t>("precision");
- bool bUse3d = m_options.Is3d();
+ bool bUse3d = is3d();
std::ostringstream oss;
@@ -370,7 +391,7 @@
- if (m_options.IsDebug())
+ if (isDebug())
std::cout << "running "<< filename << " ..." <<std::endl;
run(oss);
@@ -380,7 +401,7 @@
long Writer::GetGType()
{
boost::property_tree::ptree tree = m_options.GetPTree();
- bool bUse3d = tree.get<bool>("is3d");
+ bool bUse3d = is3d();
bool bUseSolidGeometry = tree.get<bool>("solid");
long gtype = 0;
if (bUse3d) {
@@ -405,7 +426,7 @@
std::string Writer::CreatePCElemInfo()
{
boost::property_tree::ptree tree = m_options.GetPTree();
- bool bUse3d = tree.get<bool>("is3d");
+ bool bUse3d = is3d();
bool bUseSolidGeometry = tree.get<bool>("solid");
std::ostringstream s_eleminfo;
@@ -453,7 +474,7 @@
boost::uint32_t precision = tree.get<boost::uint32_t>("precision");
boost::uint32_t capacity = tree.get<boost::uint32_t>("capacity");
boost::uint32_t dimensions = tree.get<boost::uint32_t>("dimensions");
- bool bUse3d = tree.get<bool>("is3d");
+ bool bUse3d = is3d();
bool bHaveSchemaOverride = (point_schema_override.size() > 0);
@@ -792,7 +813,7 @@
statement->AddElement(elem_info, 1);
- bool bUseSolidGeometry = m_options.IsSolid();
+ bool bUseSolidGeometry = isSolid();
if (bUseSolidGeometry == true) {
//"(1,1007,3)";
statement->AddElement(elem_info, 1007);
@@ -987,7 +1008,7 @@
void Writer::Debug()
{
- bool debug = m_options.IsDebug();
+ bool debug = isDebug();
diff -r bc05bd220320 -r 22692e3985f2 src/drivers/oci/common.cpp
--- a/src/drivers/oci/common.cpp Mon Apr 25 21:12:51 2011 -0500
+++ b/src/drivers/oci/common.cpp Tue Apr 26 08:16:36 2011 -0500
@@ -92,49 +92,8 @@
tree.add_child("scale", scales);
tree.add_child("offset", offsets);
More information about the Liblas-commits
mailing list