[Liblas-commits] hg-main-tree: trim dead code

liblas-commits at liblas.org liblas-commits at liblas.org
Fri Apr 8 17:31:01 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/79b99afa7d5f
changeset: 509:79b99afa7d5f
user:      Howard Butler <hobu.inc at gmail.com>
date:      Fri Apr 08 08:30:05 2011 -0500
description:
trim dead code
Subject: hg-main-tree: use liblas::HeaderPtr to keep track of header information for LAS writer

details:   http://hg.libpc.orghg-main-tree/rev/489a023ec2be
changeset: 510:489a023ec2be
user:      Howard Butler <hobu.inc at gmail.com>
date:      Fri Apr 08 14:27:32 2011 -0500
description:
use liblas::HeaderPtr to keep track of header information for LAS writer
Subject: hg-main-tree: only try deleting block table if it exists

details:   http://hg.libpc.orghg-main-tree/rev/86cecea31f79
changeset: 511:86cecea31f79
user:      Howard Butler <hobu.inc at gmail.com>
date:      Fri Apr 08 15:45:52 2011 -0500
description:
only try deleting block table if it exists
Subject: hg-main-tree: use size_type instead of size_t for vector size, add an add() method

details:   http://hg.libpc.orghg-main-tree/rev/e14a5a04b336
changeset: 512:e14a5a04b336
user:      Howard Butler <hobu.inc at gmail.com>
date:      Fri Apr 08 16:14:17 2011 -0500
description:
use size_type instead of size_t for vector size, add an add() method
Subject: hg-main-tree: remove dead code, add bounds fetching

details:   http://hg.libpc.orghg-main-tree/rev/f70b768394db
changeset: 513:f70b768394db
user:      Howard Butler <hobu.inc at gmail.com>
date:      Fri Apr 08 16:30:36 2011 -0500
description:
remove dead code, add bounds fetching
Subject: hg-main-tree: more tweaks of oracle configs

details:   http://hg.libpc.orghg-main-tree/rev/d546f75a96d5
changeset: 514:d546f75a96d5
user:      Howard Butler <hobu.inc at gmail.com>
date:      Fri Apr 08 16:30:52 2011 -0500
description:
more tweaks of oracle configs

diffstat:

 apps/pc2pc.cpp                          |  508 +------------------------------
 include/libpc/Vector.hpp                |   10 +-
 include/libpc/drivers/liblas/Writer.hpp |    9 +-
 src/drivers/liblas/Writer.cpp           |    7 +-
 src/drivers/oci/Iterator.cpp            |  210 +++---------
 src/drivers/oci/Writer.cpp              |    8 +-
 6 files changed, 95 insertions(+), 657 deletions(-)

diffs (truncated from 972 to 300 lines):

diff -r 76304ef6213f -r d546f75a96d5 apps/pc2pc.cpp
--- a/apps/pc2pc.cpp	Thu Apr 07 15:29:00 2011 -0500
+++ b/apps/pc2pc.cpp	Fri Apr 08 16:30:52 2011 -0500
@@ -54,6 +54,9 @@
 
     std::string m_inputFile;
     std::string m_outputFile;
+    std::string m_OracleReadSQL;
+    std::string m_OracleWriteSQL;
+    
 };
 
 
@@ -89,8 +92,8 @@
         ("input,i", po::value<std::string>(&m_inputFile), "input file name")
         ("output,o", po::value<std::string>(&m_outputFile), "output file name")
         ("native", "use native LAS classes (not liblas)")
-        ("oracle", "oracle test")
-        ("oracle-reader", "oracle test")
+        ("oracle-writer", "write data into oracle (must edit source to make this work right now)")
+        ("oracle-reader", po::value<std::string>(&m_OracleReadSQL), "SQL to select a block table")
         ;
 
     addOptionSet(file_options);
@@ -121,7 +124,7 @@
         writer.write(numPoints);
     }
 
-    else if (hasOption("oracle"))
+    else if (hasOption("oracle-writer"))
     {
 #ifdef LIBPC_HAVE_ORACLE
         libpc::drivers::liblas::LiblasReader reader(m_inputFile);
@@ -131,13 +134,16 @@
         libpc::drivers::oci::Options options;
         boost::property_tree::ptree& tree = options.GetPTree();
         
-        boost::uint32_t capacity = 1000;
+        boost::uint32_t capacity = 10000;
         tree.put("capacity", capacity);
         tree.put("overwrite", true);
-        tree.put("connection", "lidar/lidar at 192.168.56.101/orcl");
+        tree.put("connection", "lidar/lidar at oracle.hobu.biz/orcl");
         // tree.put("connection", "lidar/lidar at oracle.hobu.biz/crrel");
         tree.put("debug", true);
         tree.put("verbose", true);
+        tree.put("scale.x", 0.0000001);
+        tree.put("scale.y", 0.0000001);
+        tree.put("scale.z", 0.001);
         
         libpc::filters::CacheFilter cache(reader, 1, 1024);
         libpc::filters::Chipper chipper(cache, capacity);
@@ -154,12 +160,21 @@
             libpc::drivers::oci::Options options;
             boost::property_tree::ptree& tree = options.GetPTree();
             tree.put("capacity", 12);
-            tree.put("connection", "lidar/lidar at 192.168.56.101/orcl");
+            tree.put("connection", "lidar/lidar at oracle.hobu.biz/orcl");
             // tree.put("connection", "lidar/lidar at oracle.hobu.biz/crrel");
             tree.put("debug", true);
             tree.put("verbose", true);
-            tree.put("select_sql", "select * from output");
+        tree.put("scale.x", 0.0000001);
+        tree.put("scale.y", 0.0000001);
+        tree.put("scale.z", 0.001);
+            // tree.put("select_sql", "select * from output");
             // tree.put("select_sql", "select cloud from hobu where id = 5");
+            // tree.put("select_sql", "select cloud from hobu where id = 1");
+            
+            if (m_OracleReadSQL.size() == 0) {
+                throw libpc_error("Select statement to read OCI data is empty!");
+            }
+            tree.put("select_sql", m_OracleReadSQL);
 
             libpc::drivers::oci::Reader reader(options);
 
@@ -203,482 +218,3 @@
 
 
 
-
-
-#if 0
-
-static void test1()
-{
-  // we are faking the reader, so we need to describe it here
-  // the faux reader only supports fields (X,Y,Z,T)
-  const Bounds<double> bounds(0, 0, -100, 200, 200, 100);
-  const int numPoints = 30;
-  FauxReader reader(bounds, numPoints, FauxReader::Random);
-
-  CropFilter cropper(reader, Bounds<double>(0, 0, 0, 100, 100, 100));
-
-  ColorFilter colorizer(cropper);
-
-  FauxWriter writer(colorizer);
-  
-  writer.write(30);
-
-  return;
-}
-
-
-static void test2()
-{
-  const int numPoints = 10;
-  const Bounds<double> bounds1(0, 0, 0, 100, 100, 100);
-  FauxReader reader1(bounds1, numPoints, FauxReader::Random);
-
-  const Bounds<double> bounds2(100, 100, 100, 200, 200, 100);
-  FauxReader reader2(bounds2, numPoints, FauxReader::Random);
-
-  MosaicFilter mosaicker(reader1, reader2);
-
-  FauxWriter writer(mosaicker);
-  
-  writer.write(20);
-  
-  return;
-}
-
-
-
-static void test3()
-{
-  std::istream* ifs = Utils::openFile("test/data/1.2-with-color.las");
-
-  LasReader reader(*ifs);
-
-  const Header& header = reader.getHeader();
-
-  std::cout << (const LasHeader&)header;
-
-  std::ostream* ofs = Utils::createFile("temp.las");
-
-  LasWriter lasWriter(reader, *ofs);
-  lasWriter.write( header.getNumPoints() );
-
-  Utils::closeFile(ofs);
-
-  Utils::closeFile(ifs);
-
-  return;
-}
-
-
-int xmain(int, char* [])
-{
-    test3();
-
-    {
-        Bounds<double> bounds(1,2,3,4,5,6);
-        std::cout << bounds << std::endl;
-    }
-
-    {
-        const int major = GetVersionMajor();
-        const int minor = GetVersionMinor();
-        const int patch = GetVersionPatch();
-        const int verInt = GetVersionInteger();
-        std::cout << "Version: " << major << " " << minor << " " << patch << " (" << verInt << ")" << std::endl;
-
-        const std::string verString = GetVersionString();
-        std::cout << " string: " << verString << std::endl;
-
-        const std::string fullString = GetFullVersionString();
-        std::cout << "Full version string: " << fullString << std::endl;
-    }
-
-    {
-        Dimension dim(Dimension::Field_User1, Dimension::Uint8);
-        std::cout << dim << std::endl;
-    }
-
-    Color c;
-
-    test1();
-
-    test2();
-
-    std::istream* ifs = Utils::openFile("test/data/1.2-with-color.las");
-    // LiblasReader r(*ifs);
-
-    return 0;
-}
-
-#endif
-
-#if 0
-
-#include <liblas/liblas.hpp>
-#include "laskernel.hpp"
-
-#include <boost/cstdint.hpp>
-#include <boost/foreach.hpp>
-#include <boost/shared_ptr.hpp>
-
-namespace po = boost::program_options;
-
-using namespace liblas;
-using namespace std;
-
-typedef boost::shared_ptr<liblas::Writer> WriterPtr;
-typedef boost::shared_ptr<liblas::CoordinateSummary> SummaryPtr;
-
-
-WriterPtr start_writer(   std::ostream*& ofs, 
-                      std::string const& output, 
-                      liblas::Header const& header)
-{
-ofs = liblas::Create(output, std::ios::out | std::ios::binary);
-if (!ofs)
-{
-    std::ostringstream oss;
-    oss << "Cannot create " << output << "for write.  Exiting...";
-    throw std::runtime_error(oss.str());
-}
-
-WriterPtr writer( new liblas::Writer(*ofs, header));
-return writer;
-}
-
-bool process(   std::istream& ifs,
-                std::string const& output,
-                liblas::Header & header,
-                std::vector<liblas::FilterPtr>& filters,
-                std::vector<liblas::TransformPtr>& transforms,
-                boost::uint32_t split_mb,
-                boost::uint32_t split_pts,
-                bool verbose,
-                bool min_offset)
-{
-    liblas::ReaderFactory f;
-    liblas::Reader reader = f.CreateWithStream(ifs);
-    SummaryPtr summary(new::liblas::CoordinateSummary);
-    
-    reader.SetFilters(filters);
-    reader.SetTransforms(transforms);    
-    
-    if (min_offset) 
-    {
-        liblas::property_tree::ptree tree = SummarizeReader(reader);
-
-        try
-        {
-            header.SetOffset(tree.get<double>("summary.points.minimum.x"),
-                             tree.get<double>("summary.points.minimum.y"),
-                             tree.get<double>("summary.points.minimum.z"));
-    
-                              
-        }
-        catch (liblas::property_tree::ptree_bad_path const& e) 
-        {
-            std::cerr << "Unable to write minimum header info.  Does the outputted file have any points?";
-            std::cerr << e.what() << std::endl;
-            return false;
-        }
-        if (verbose) 
-        {
-            std::cout << "Using minimum offsets ";
-            SetStreamPrecision(std::cout, header.GetScaleX());
-            std::cout << header.GetOffsetX() << " ";
-            SetStreamPrecision(std::cout, header.GetScaleY());
-            std::cout << header.GetOffsetY() << " ";
-            SetStreamPrecision(std::cout, header.GetScaleZ());
-            std::cout << header.GetOffsetZ() << " ";
-            std::cout << std::endl;
-        }
-        reader.Reset();
-    }
-
-    std::ostream* ofs = NULL;
-    std::string out = output;
-    
-    WriterPtr writer;
-
-    if (!split_mb && !split_pts) {
-        writer = start_writer(ofs, output, header);
-        
-    } else {
-        string::size_type dot_pos = output.find_first_of(".");
-        out = output.substr(0, dot_pos);
-        writer = start_writer(ofs, out+"-1"+".las", header);
-    }
-
-    if (verbose)
-    std::cout << "Writing output:" 
-        << "\n - : " << output
-        << std::endl;
-
-    //
-    // Translation of points cloud to features set
-    //
-    boost::uint32_t i = 0;
-    boost::uint32_t const size = header.GetPointRecordsCount();
-    
-    boost::int32_t split_bytes_count = 1024*1024*split_mb;
-    boost::uint32_t split_points_count = 0;
-    int fileno = 2;


More information about the Liblas-commits mailing list