[Liblas-commits] hg-main-tree: remove dead code and carry a bounds object to cumu...

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Aug 2 14:43:32 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/cdbdff8ca992
changeset: 985:cdbdff8ca992
user:      Howard Butler <hobu.inc at gmail.com>
date:      Tue Aug 02 09:13:57 2011 -0500
description:
remove dead code and carry a bounds object to cumulate the extent of the PC as it is loaded
Subject: hg-main-tree: more descriptive error messages

details:   http://hg.libpc.orghg-main-tree/rev/ce379087d71c
changeset: 986:ce379087d71c
user:      Howard Butler <hobu.inc at gmail.com>
date:      Tue Aug 02 13:34:00 2011 -0500
description:
more descriptive error messages
Subject: hg-main-tree: short-circuit the parsing of empty bounds objects -- feel free to make this not suck so bad mpg

details:   http://hg.libpc.orghg-main-tree/rev/09b13adbe63d
changeset: 987:09b13adbe63d
user:      Howard Butler <hobu.inc at gmail.com>
date:      Tue Aug 02 13:34:50 2011 -0500
description:
short-circuit the parsing of empty bounds objects -- feel free to make this not suck so bad mpg
Subject: hg-main-tree: add testing for ingestion of empty bounds

details:   http://hg.libpc.orghg-main-tree/rev/675bca0f1f7c
changeset: 988:675bca0f1f7c
user:      Howard Butler <hobu.inc at gmail.com>
date:      Tue Aug 02 13:35:13 2011 -0500
description:
add testing for ingestion of empty bounds
Subject: hg-main-tree: update the SDO_PC.PC_EXTENT with the cumulated bounds of all of the blocks if no base_table_bounds is set in the options

details:   http://hg.libpc.orghg-main-tree/rev/676201d0b177
changeset: 989:676201d0b177
user:      Howard Butler <hobu.inc at gmail.com>
date:      Tue Aug 02 13:35:55 2011 -0500
description:
update the SDO_PC.PC_EXTENT with the cumulated bounds of all of the blocks if no base_table_bounds is set in the options
Subject: hg-main-tree: remove reader.initialize(), we shouldn't do that

details:   http://hg.libpc.orghg-main-tree/rev/9e92de98d72f
changeset: 990:9e92de98d72f
user:      Howard Butler <hobu.inc at gmail.com>
date:      Tue Aug 02 13:36:40 2011 -0500
description:
remove reader.initialize(), we shouldn't do that
Subject: hg-main-tree: merge

details:   http://hg.libpc.orghg-main-tree/rev/e431a8367fb9
changeset: 991:e431a8367fb9
user:      Howard Butler <hobu.inc at gmail.com>
date:      Tue Aug 02 13:43:09 2011 -0500
description:
merge
Subject: hg-main-tree: merge

details:   http://hg.libpc.orghg-main-tree/rev/3034b77d2527
changeset: 992:3034b77d2527
user:      Howard Butler <hobu.inc at gmail.com>
date:      Tue Aug 02 13:43:25 2011 -0500
description:
merge

diffstat:

 apps/pc2pc.cpp                              |    9 +-
 apps/pcinfo.cpp                             |    4 +-
 apps/pcpipeline.cpp                         |    3 +-
 include/pdal/FileUtils.hpp                  |   95 ++++++++
 include/pdal/PipelineReader.hpp             |    1 +
 include/pdal/StageBase.hpp                  |    2 +-
 include/pdal/Utils.hpp                      |   14 -
 include/pdal/XMLSchema.hpp                  |    1 -
 include/pdal/drivers/oci/Writer.hpp         |    7 +-
 include/pdal/filters/ReprojectionFilter.hpp |    3 +
 src/Bounds.cpp                              |   23 +-
 src/CMakeLists.txt                          |    2 +
 src/Dimension.cpp                           |    1 -
 src/FileUtils.cpp                           |  179 +++++++++++++++
 src/PipelineReader.cpp                      |   28 ++
 src/Range.cpp                               |    6 +-
 src/StageBase.cpp                           |   11 +-
 src/StreamManager.cpp                       |   10 +-
 src/Utils.cpp                               |  104 ---------
 src/XMLSchema.cpp                           |    1 -
 src/drivers/las/Iterator.cpp                |    6 +-
 src/drivers/las/LasHeaderReader.cpp         |    1 -
 src/drivers/las/Reader.cpp                  |    5 +-
 src/drivers/liblas/Iterator.cpp             |    6 +-
 src/drivers/liblas/Reader.cpp               |    5 +-
 src/drivers/oci/Iterator.cpp                |    2 -
 src/drivers/oci/Reader.cpp                  |    4 +-
 src/drivers/oci/Writer.cpp                  |  319 +++++++--------------------
 src/drivers/qfit/Iterator.cpp               |   10 +-
 src/drivers/qfit/Reader.cpp                 |    4 +-
 src/drivers/terrasolid/Iterator.cpp         |   10 +-
 src/drivers/terrasolid/Reader.cpp           |    4 +-
 src/filters/ReprojectionFilter.cpp          |   28 ++-
 test/data/pipeline_read.xml                 |    2 +-
 test/data/pipeline_write.xml                |    2 +-
 test/unit/BoundsTest.cpp                    |    5 +
 test/unit/CMakeLists.txt                    |    1 +
 test/unit/FileUtilsTest.cpp                 |  159 +++++++++++++
 test/unit/LasWriterTest.cpp                 |   25 +-
 test/unit/LiblasWriterTest.cpp              |   29 +-
 test/unit/OCITest.cpp                       |    1 -
 test/unit/PipelineManagerTest.cpp           |    6 +-
 test/unit/PipelineReaderTest.cpp            |    6 +-
 test/unit/PipelineWriterTest.cpp            |   13 +-
 test/unit/PointBufferTest.cpp               |    1 -
 test/unit/ReprojectionFilterTest.cpp        |   31 +--
 test/unit/SpatialReferenceTest.cpp          |   22 +-
 test/unit/StageFactoryTest.cpp              |    9 +-
 test/unit/StreamManagerTest.cpp             |   26 +-
 test/unit/Support.cpp                       |   30 +-
 test/unit/UtilsTest.cpp                     |   36 ---
 test/unit/XMLSchemaTest.cpp                 |    4 +-
 52 files changed, 754 insertions(+), 562 deletions(-)

diffs (truncated from 2671 to 300 lines):

diff -r 0893210f7f19 -r 3034b77d2527 apps/pc2pc.cpp
--- a/apps/pc2pc.cpp	Mon Aug 01 16:54:55 2011 -0700
+++ b/apps/pc2pc.cpp	Tue Aug 02 13:43:25 2011 -0500
@@ -13,6 +13,7 @@
 #include <iostream>
 
 #include <pdal/exceptions.hpp>
+#include <pdal/FileUtils.hpp>
 //#include <pdal/pdal_config.hpp>
 //#include <pdal/Bounds.hpp>
 //#include <pdal/Color.hpp>
@@ -112,13 +113,13 @@
 
 int Application_pc2pc::execute()
 {
-    if (!Utils::fileExists(m_inputFile))
+    if (!FileUtils::fileExists(m_inputFile))
     {
         runtimeError("file not found: " + m_inputFile);
         return 1;
     }
 
-    std::ostream* ofs = Utils::createFile(m_outputFile);
+    std::ostream* ofs = FileUtils::createFile(m_outputFile);
 
     if (hasOption("native"))
     {
@@ -142,7 +143,6 @@
 #ifdef PDAL_HAVE_ORACLE
         try{
         pdal::drivers::las::LasReader reader(m_inputFile);
-        reader.initialize();
     
         const boost::uint64_t numPoints = reader.getNumPoints();
 
@@ -233,7 +233,6 @@
 
 
         pdal::drivers::oci::Reader reader(options);
-        reader.initialize();
 
         pdal::drivers::las::LasWriter* writer;
 
@@ -312,7 +311,7 @@
         writer.write(numPoints);
     }
 
-    Utils::closeFile(ofs);
+    FileUtils::closeFile(ofs);
 
     return 0;
 }
diff -r 0893210f7f19 -r 3034b77d2527 apps/pcinfo.cpp
--- a/apps/pcinfo.cpp	Mon Aug 01 16:54:55 2011 -0700
+++ b/apps/pcinfo.cpp	Tue Aug 02 13:43:25 2011 -0500
@@ -12,7 +12,7 @@
 
 #include <pdal/drivers/las/Reader.hpp>
 #include <pdal/drivers/liblas/Reader.hpp>
-#include <pdal/Utils.hpp>
+#include <pdal/FileUtils.hpp>
 #ifdef PDAL_HAVE_MRSID
 #include <pdal/drivers/mrsid/Reader.hpp>
 #endif
@@ -74,7 +74,7 @@
 
 int Application_pcinfo::execute()
 {
-    if (!Utils::fileExists(m_inputFile))
+    if (!FileUtils::fileExists(m_inputFile))
     {
         runtimeError("file not found: " + m_inputFile);
         return 1;
diff -r 0893210f7f19 -r 3034b77d2527 apps/pcpipeline.cpp
--- a/apps/pcpipeline.cpp	Mon Aug 01 16:54:55 2011 -0700
+++ b/apps/pcpipeline.cpp	Tue Aug 02 13:43:25 2011 -0500
@@ -36,6 +36,7 @@
 
 #include <pdal/PipelineReader.hpp>
 #include <pdal/PipelineManager.hpp>
+#include <pdal/FileUtils.hpp>
 
 #include "Application.hpp"
 
@@ -91,7 +92,7 @@
 
 int Application_pcpipeline::execute()
 {
-    if (!Utils::fileExists(m_inputFile))
+    if (!FileUtils::fileExists(m_inputFile))
     {
         runtimeError("file not found: " + m_inputFile);
         return 1;
diff -r 0893210f7f19 -r 3034b77d2527 include/pdal/FileUtils.hpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/pdal/FileUtils.hpp	Tue Aug 02 13:43:25 2011 -0500
@@ -0,0 +1,95 @@
+/******************************************************************************
+* Copyright (c) 2011, Michael P. Gerlek (mpg at flaxen.com)
+*
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following
+* conditions are met:
+*
+*     * Redistributions of source code must retain the above copyright
+*       notice, this list of conditions and the following disclaimer.
+*     * Redistributions in binary form must reproduce the above copyright
+*       notice, this list of conditions and the following disclaimer in
+*       the documentation and/or other materials provided
+*       with the distribution.
+*     * Neither the name of Hobu, Inc. or Flaxen Geo Consulting nor the
+*       names of its contributors may be used to endorse or promote
+*       products derived from this software without specific prior
+*       written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+* OF SUCH DAMAGE.
+****************************************************************************/
+
+#ifndef INCLUDED_FILEUTILS_HPP
+#define INCLUDED_FILEUTILS_HPP
+
+#include <pdal/pdal.hpp>
+
+#include <string>
+#include <cassert>
+#include <stdexcept>
+#include <cmath>
+#include <ostream>
+#include <istream>
+
+namespace pdal
+{
+
+// this is a static class -- do not instantiate]
+class PDAL_DLL FileUtils
+{
+public:
+    // open existing file for reading
+    static std::istream* openFile(std::string const& filename, bool asBinary=true);
+
+    // open new file for writing
+    static std::ostream* createFile(std::string const& filename, bool asBinary=true);
+
+    static void closeFile(std::ostream* ofs);
+    static void closeFile(std::istream* ifs);
+
+    static bool deleteFile(const std::string& filename);
+    static void renameFile(const std::string& dest, const std::string& src);
+    static bool fileExists(const std::string& filename);
+    static boost::uintmax_t fileSize(const std::string& filename);
+
+    // return current working dir
+    static std::string getcwd();
+
+    // return the directory component of the given path, e.g. "d:/foo/bar/a.c" -> "d:/foo/bar"
+    static std::string getDirectory(const std::string& path);
+
+    // returns true iff the path is not relative
+    static bool isAbsolutePath(const std::string& path);
+
+    // if the filename is an absolute path, just return it
+    // otherwise, make it absolute (relative to current working dir) and return that
+    static std::string toAbsolutePath(const std::string& filename);
+
+    // if the filename is an absolute path, just return it
+    // otherwise, make it absolute (relative to base dir) and return that
+    // 
+    // note: if base dir is not absolute, first make it absolute via toAbsolutePath(base)
+    static std::string toAbsolutePath(const std::string& filename, const std::string base);
+
+private:
+    FileUtils& operator=(const FileUtils&); // not implemented
+    FileUtils(const FileUtils&); // not implemented;
+};
+
+
+} // namespace pdal
+
+#endif
diff -r 0893210f7f19 -r 3034b77d2527 include/pdal/PipelineReader.hpp
--- a/include/pdal/PipelineReader.hpp	Mon Aug 01 16:54:55 2011 -0700
+++ b/include/pdal/PipelineReader.hpp	Tue Aug 02 13:43:25 2011 -0500
@@ -85,6 +85,7 @@
     bool m_isDebug;
     boost::uint8_t m_verboseLevel;
     Options m_baseOptions;
+    std::string m_inputXmlFile;
 
     PipelineReader& operator=(const PipelineReader&); // not implemented
     PipelineReader(const PipelineReader&); // not implemented
diff -r 0893210f7f19 -r 3034b77d2527 include/pdal/StageBase.hpp
--- a/include/pdal/StageBase.hpp	Mon Aug 01 16:54:55 2011 -0700
+++ b/include/pdal/StageBase.hpp	Tue Aug 02 13:43:25 2011 -0500
@@ -55,7 +55,7 @@
     // This function is for derived stages to perform "static" validation, e.g. bad Option arguments.
     // It will recursively call initialize() on all previous stages.
     // Users must call this after the last stage in the pipeline has been consturcted.  
-    // It is not illegal to call this twice for a stage, but that doesn't mean you should.
+    // It is illegal to call this twice for a stage.
     // Derived stages should feel free to provide their own implementations.  Remeber to call initialize() on
     //   the parent class before your own class-specific code.
     // This function will throw when errors are found.
diff -r 0893210f7f19 -r 3034b77d2527 include/pdal/Utils.hpp
--- a/include/pdal/Utils.hpp	Mon Aug 01 16:54:55 2011 -0700
+++ b/include/pdal/Utils.hpp	Tue Aug 02 13:43:25 2011 -0500
@@ -76,20 +76,6 @@
         return true;
     }
 
-    // open existing file for reading
-    static std::istream* openFile(std::string const& filename, bool asBinary=true);
-
-    // open new file for writing
-    static std::ostream* createFile(std::string const& filename, bool asBinary=true);
-
-    static void closeFile(std::ostream* ofs);
-    static void closeFile(std::istream* ifs);
-
-    static bool deleteFile(const std::string& filename);
-    static void renameFile(const std::string& dest, const std::string& src);
-    static bool fileExists(const std::string& filename);
-    static boost::uintmax_t fileSize(const std::string& filename);
-
     template<class T>
     static inline void write_field(boost::uint8_t*& dest, T v)
     {
diff -r 0893210f7f19 -r 3034b77d2527 include/pdal/XMLSchema.hpp
--- a/include/pdal/XMLSchema.hpp	Mon Aug 01 16:54:55 2011 -0700
+++ b/include/pdal/XMLSchema.hpp	Tue Aug 02 13:43:25 2011 -0500
@@ -37,7 +37,6 @@
 
 #include <pdal/pdal.hpp>
 #include <pdal/Schema.hpp>
-#include <pdal/Utils.hpp>
 #include <pdal/SchemaLayout.hpp>
 #include <pdal/Dimension.hpp>
 #include <pdal/DimensionLayout.hpp>
diff -r 0893210f7f19 -r 3034b77d2527 include/pdal/drivers/oci/Writer.hpp
--- a/include/pdal/drivers/oci/Writer.hpp	Mon Aug 01 16:54:55 2011 -0700
+++ b/include/pdal/drivers/oci/Writer.hpp	Tue Aug 02 13:43:25 2011 -0500
@@ -109,8 +109,10 @@
     bool isDebug() const;
     bool is3d() const;
     bool isSolid() const;
-    // PointBuffer& ConstructBuffer(const PointBuffer& input) const;
-    
+    boost::int32_t getPCID() const;
+    void UpdatePCExtent();
+
+    pdal::Bounds<double> CalculateBounds(PointBuffer const& buffer);
     Stage& m_stage;
     
     OptionsOld& m_optionsOld;
@@ -118,6 +120,7 @@
     Connection m_connection;
     bool m_verbose;
     bool m_doCreateIndex;
+    Bounds<double> m_pcExtent;
 };
 
 }}} // namespace pdal::driver::oci
diff -r 0893210f7f19 -r 3034b77d2527 include/pdal/filters/ReprojectionFilter.hpp
--- a/include/pdal/filters/ReprojectionFilter.hpp	Mon Aug 01 16:54:55 2011 -0700
+++ b/include/pdal/filters/ReprojectionFilter.hpp	Tue Aug 02 13:43:25 2011 -0500
@@ -57,6 +57,8 @@
 public:
     ReprojectionFilter(Stage& prevStage, const Options&);
     ReprojectionFilter(Stage& prevStage,
+                       const SpatialReference& outSRS);
+    ReprojectionFilter(Stage& prevStage,
                        const SpatialReference& inSRS,
                        const SpatialReference& outSRS);
     virtual void initialize();
@@ -80,6 +82,7 @@
 
     SpatialReference m_inSRS;
     SpatialReference m_outSRS;
+    bool m_inferInputSRS;
 
     typedef boost::shared_ptr<void> ReferencePtr;
     typedef boost::shared_ptr<void> TransformPtr;
diff -r 0893210f7f19 -r 3034b77d2527 src/Bounds.cpp
--- a/src/Bounds.cpp	Mon Aug 01 16:54:55 2011 -0700
+++ b/src/Bounds.cpp	Tue Aug 02 13:43:25 2011 -0500
@@ -45,24 +45,41 @@
 
 std::istream& operator>>(std::istream& istr, Bounds<double>& bounds)


More information about the Liblas-commits mailing list