[Liblas-commits] hg-main-tree: Reenable oci.Writer's loading w/o boundary column

liblas-commits at liblas.org liblas-commits at liblas.org
Fri Aug 12 18:04:27 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/4363494f1a6c
changeset: 1078:4363494f1a6c
user:      Pete Gadomski <pete.gadomski at gmail.com>
date:      Fri Aug 12 15:04:13 2011 -0700
description:
Reenable oci.Writer's loading w/o boundary column
Subject: hg-main-tree: Merge

details:   http://hg.libpc.orghg-main-tree/rev/7cca9a500547
changeset: 1079:7cca9a500547
user:      Pete Gadomski <pete.gadomski at gmail.com>
date:      Fri Aug 12 15:04:23 2011 -0700
description:
Merge

diffstat:

 include/pdal/StageBase.hpp                  |  42 +++++++++-----------------
 include/pdal/drivers/faux/Reader.hpp        |   7 ++-
 include/pdal/drivers/faux/Writer.hpp        |   7 ++-
 include/pdal/drivers/las/Reader.hpp         |   7 ++-
 include/pdal/drivers/las/Writer.hpp         |   5 +-
 include/pdal/drivers/liblas/Reader.hpp      |   5 +-
 include/pdal/drivers/liblas/Writer.hpp      |   5 +-
 include/pdal/drivers/oci/Reader.hpp         |   6 ++-
 include/pdal/drivers/oci/Writer.hpp         |   8 +++-
 include/pdal/drivers/qfit/Reader.hpp        |   6 +-
 include/pdal/drivers/terrasolid/Reader.hpp  |   6 +-
 include/pdal/filters/ByteSwapFilter.hpp     |   5 +-
 include/pdal/filters/CacheFilter.hpp        |   5 +-
 include/pdal/filters/Chipper.hpp            |   5 +-
 include/pdal/filters/ColorFilter.hpp        |   6 ++-
 include/pdal/filters/CropFilter.hpp         |   5 +-
 include/pdal/filters/DecimationFilter.hpp   |   6 ++-
 include/pdal/filters/MosaicFilter.hpp       |   6 ++-
 include/pdal/filters/ReprojectionFilter.hpp |   6 ++-
 include/pdal/filters/ScalingFilter.hpp      |  10 +++++-
 src/drivers/faux/Reader.cpp                 |   6 +--
 src/drivers/faux/Writer.cpp                 |   7 +---
 src/drivers/las/Reader.cpp                  |   9 +---
 src/drivers/las/Writer.cpp                  |   7 +---
 src/drivers/liblas/Reader.cpp               |   7 +---
 src/drivers/liblas/Writer.cpp               |   7 +---
 src/drivers/oci/Reader.cpp                  |   6 +--
 src/drivers/oci/Writer.cpp                  |  46 +++++++++++++++-------------
 src/drivers/qfit/Reader.cpp                 |   7 +---
 src/drivers/terrasolid/Reader.cpp           |   6 +--
 src/filters/ByteSwapFilter.cpp              |   7 +---
 src/filters/CacheFilter.cpp                 |   5 +--
 src/filters/Chipper.cpp                     |   6 +--
 src/filters/ColorFilter.cpp                 |   7 +---
 src/filters/CropFilter.cpp                  |   7 +---
 src/filters/DecimationFilter.cpp            |   7 +---
 src/filters/MosaicFilter.cpp                |   6 +--
 src/filters/ReprojectionFilter.cpp          |   6 +--
 src/filters/ScalingFilter.cpp               |  11 +-----
 test/unit/MosaicFilterTest.cpp              |   2 +-
 test/unit/OptionsTest.cpp                   |   5 ++-
 41 files changed, 153 insertions(+), 182 deletions(-)

diffs (truncated from 1058 to 300 lines):

diff -r 42e1b3e69f3f -r 7cca9a500547 include/pdal/StageBase.hpp
--- a/include/pdal/StageBase.hpp	Fri Aug 12 14:46:55 2011 -0500
+++ b/include/pdal/StageBase.hpp	Fri Aug 12 15:04:23 2011 -0700
@@ -84,39 +84,27 @@
     bool isVerbose() const; // true iff verbosity>0 
     boost::uint8_t getVerboseLevel() const; 
 
-    // For Name, Description, and DefaultOptions:
-    //   each concrete class should provide a static function s_getX() which returns a static object
-    //   each concrete class should provide a virtual getX() which returns s_getX()
-    // This is automated via the GenerateStatics() macro below.
+    // Everyone must implement this.  If you want to access the list of 
+    // options "statically", you are free to construct the stage with no
+    // arguments and cal getDefaultOptions() on it -- there is no need
+    // to call initialize(), so it should be a fast/safe operation.
+    virtual const Options getDefaultOptions() const = 0;
 
     // Use a dotted, XPath-style name for your 
     // stage.  For example, 'drivers.las.reader' or 'filters.crop'.  This 
     // XPath-style name will also correspond to an entry in the pdal::Options
     // tree for the given stage.
+    virtual std::string getName() const = 0;
+    virtual std::string getDescription() const = 0;
 
-    virtual const Options& getDefaultOptions() const = 0; // { return s_getDefaultOptions(); }
-    virtual const std::string& getName() const = 0; // { return s_getName(); }
-    virtual const std::string& getDescription() const = 0; // { return s_getDescription(); }
-    //static const Options& s_getDefaultOptions();
-    //static const std::string& s_getName();
-    //static const std::string& s_getDescription();
-    
-#define DECLARE_STATICS  \
-    public: \
-    static const Options& s_getDefaultOptions(); \
-    virtual const Options& getDefaultOptions() const;  \
-    static const std::string& s_getName();  \
-    virtual const std::string& getName() const;  \
-    static const std::string& s_getDescription();  \
-    virtual const std::string& getDescription() const;  \
-    private:
-
-#define IMPLEMENT_STATICS(T, name, description)  \
-    const Options& T::getDefaultOptions() const { return s_getDefaultOptions(); }  \
-    const std::string& T::s_getName() { static std::string s(name); return s; }  \
-    const std::string& T::getName() const { return s_getName(); }  \
-    const std::string& T::s_getDescription() { static std::string s(description); return s; }  \
-    const std::string& T::getDescription() const { return s_getDescription(); }
+    // For getName() and getDescription(), each stage provides a static and 
+    // a dynamic version of the function.  Each (concrete) stage should call 
+    // the following macro to create the functions for you.
+#define SET_STAGE_NAME(name, description)  \
+    static std::string s_getName() { return name; }  \
+    std::string getName() const { return name; }  \
+    static std::string s_getDescription() { return description; }  \
+    std::string getDescription() const { return description; }
 
 protected:
     Options& getOptions();
diff -r 42e1b3e69f3f -r 7cca9a500547 include/pdal/drivers/faux/Reader.hpp
--- a/include/pdal/drivers/faux/Reader.hpp	Fri Aug 12 14:46:55 2011 -0500
+++ b/include/pdal/drivers/faux/Reader.hpp	Fri Aug 12 15:04:23 2011 -0700
@@ -65,8 +65,6 @@
 //
 class PDAL_DLL Reader : public pdal::Reader
 {
-    DECLARE_STATICS
-
 public:
     enum Mode
     {
@@ -76,11 +74,14 @@
     };
 
 public:
+    SET_STAGE_NAME("drivers.faux.reader", "Faux Reader")
+
     Reader(const Options& options);
     Reader(const Bounds<double>&, boost::uint64_t numPoints, Mode mode);
     Reader(const Bounds<double>&, boost::uint64_t numPoints, Mode mode, const std::vector<Dimension>& dimensions);
-
+    
     virtual void initialize();
+    virtual const Options getDefaultOptions() const;
     
     Mode getMode() const;
     
diff -r 42e1b3e69f3f -r 7cca9a500547 include/pdal/drivers/faux/Writer.hpp
--- a/include/pdal/drivers/faux/Writer.hpp	Fri Aug 12 14:46:55 2011 -0500
+++ b/include/pdal/drivers/faux/Writer.hpp	Fri Aug 12 15:04:23 2011 -0700
@@ -51,12 +51,13 @@
 //
 class PDAL_DLL Writer : public pdal::Writer
 {
-    DECLARE_STATICS
+public:
+    SET_STAGE_NAME("drivers.faux.writer", "Faux Writer")
 
-public:
     Writer(Stage& prevStage, const Options&);
-
+    
     virtual void initialize();
+    virtual const Options getDefaultOptions() const;
 
     // retrieve the summary info
     double getMinX() const { return m_minimumX; }
diff -r 42e1b3e69f3f -r 7cca9a500547 include/pdal/drivers/las/Reader.hpp
--- a/include/pdal/drivers/las/Reader.hpp	Fri Aug 12 14:46:55 2011 -0500
+++ b/include/pdal/drivers/las/Reader.hpp	Fri Aug 12 15:04:23 2011 -0700
@@ -55,13 +55,14 @@
 
 class PDAL_DLL LasReader : public LasReaderBase
 {
-    DECLARE_STATICS
+public:
+    SET_STAGE_NAME("drivers.las.reader", "Las Reader")
 
-public:
     LasReader(const Options&);
     LasReader(const std::string& filename);
-
+    
     virtual void initialize();
+    virtual const Options getDefaultOptions() const;
 
     const std::string& getFileName() const;
 
diff -r 42e1b3e69f3f -r 7cca9a500547 include/pdal/drivers/las/Writer.hpp
--- a/include/pdal/drivers/las/Writer.hpp	Fri Aug 12 14:46:55 2011 -0500
+++ b/include/pdal/drivers/las/Writer.hpp	Fri Aug 12 15:04:23 2011 -0700
@@ -53,14 +53,15 @@
 
 class PDAL_DLL LasWriter : public Writer
 {
-    DECLARE_STATICS
+public:
+    SET_STAGE_NAME("drivers.las.writer", "Las Writer")
 
-public:
     LasWriter(Stage& prevStage, const Options&);
     LasWriter(Stage& prevStage, std::ostream*);
     ~LasWriter();
 
     virtual void initialize();
+    virtual const Options getDefaultOptions() const;
 
     void setFormatVersion(boost::uint8_t majorVersion, boost::uint8_t minorVersion);
     void setPointFormat(PointFormat);
diff -r 42e1b3e69f3f -r 7cca9a500547 include/pdal/drivers/liblas/Reader.hpp
--- a/include/pdal/drivers/liblas/Reader.hpp	Fri Aug 12 14:46:55 2011 -0500
+++ b/include/pdal/drivers/liblas/Reader.hpp	Fri Aug 12 15:04:23 2011 -0700
@@ -55,14 +55,15 @@
 
 class PDAL_DLL LiblasReader : public pdal::drivers::las::LasReaderBase
 {
-    DECLARE_STATICS
+public:
+    SET_STAGE_NAME("drivers.liblas.reader", "Liblas Reader")
 
-public:
     LiblasReader(const Options&);
     LiblasReader(const std::string& filename);
     ~LiblasReader();
 
     virtual void initialize();
+    virtual const Options getDefaultOptions() const;
 
     const std::string& getFileName() const;
 
diff -r 42e1b3e69f3f -r 7cca9a500547 include/pdal/drivers/liblas/Writer.hpp
--- a/include/pdal/drivers/liblas/Writer.hpp	Fri Aug 12 14:46:55 2011 -0500
+++ b/include/pdal/drivers/liblas/Writer.hpp	Fri Aug 12 15:04:23 2011 -0700
@@ -53,14 +53,15 @@
 // we default to LAS 1.2, point format 0
 class PDAL_DLL LiblasWriter : public Writer
 {
-    DECLARE_STATICS
+public:
+    SET_STAGE_NAME("drivers.liblas.writer", "Liblas Writer")
 
-public:
     LiblasWriter(Stage& prevStage, const Options&);
     LiblasWriter(Stage& prevStage, std::ostream*);
     ~LiblasWriter();
 
     virtual void initialize();
+    virtual const Options getDefaultOptions() const;
 
     void setFormatVersion(boost::uint8_t majorVersion, boost::uint8_t minorVersion);
     void setPointFormat(::pdal::drivers::las::PointFormat);
diff -r 42e1b3e69f3f -r 7cca9a500547 include/pdal/drivers/oci/Reader.hpp
--- a/include/pdal/drivers/oci/Reader.hpp	Fri Aug 12 14:46:55 2011 -0500
+++ b/include/pdal/drivers/oci/Reader.hpp	Fri Aug 12 15:04:23 2011 -0700
@@ -51,12 +51,14 @@
 
 class PDAL_DLL Reader : public pdal::Reader
 {
-    DECLARE_STATICS
+public:
+    SET_STAGE_NAME("drivers.oci.reader", "OCI Reader")
 
-public:
     Reader(const Options&);
     ~Reader();
+
     virtual void initialize();
+    virtual const Options getDefaultOptions() const;
  
     bool supportsIterator (StageIteratorType t) const
     {   
diff -r 42e1b3e69f3f -r 7cca9a500547 include/pdal/drivers/oci/Writer.hpp
--- a/include/pdal/drivers/oci/Writer.hpp	Fri Aug 12 14:46:55 2011 -0500
+++ b/include/pdal/drivers/oci/Writer.hpp	Fri Aug 12 15:04:23 2011 -0700
@@ -49,12 +49,14 @@
 
 class PDAL_DLL Writer : public pdal::Writer
 {
-    DECLARE_STATICS
+public:
+    SET_STAGE_NAME("drivers.oci.writer", "OCI Writer")
 
-public:
     Writer(Stage& prevStage, const Options&);
     ~Writer();
+
     virtual void initialize();
+    virtual const Options getDefaultOptions() const;
 
     void run(std::ostringstream const& command);
     inline void setBounds(pdal::Bounds<double> bounds) {m_bounds = bounds; }
@@ -101,7 +103,7 @@
     
     template<typename T> T getDefaultedOption(std::string const& option_name) const
     {
-        T default_value = Writer::s_getDefaultOptions().getOption<T>(option_name).getValue();
+        T default_value = getDefaultOptions().getOption<T>(option_name).getValue();
         return getOptions().getValueOrDefault<T>(option_name, default_value);
     }
     
diff -r 42e1b3e69f3f -r 7cca9a500547 include/pdal/drivers/qfit/Reader.hpp
--- a/include/pdal/drivers/qfit/Reader.hpp	Fri Aug 12 14:46:55 2011 -0500
+++ b/include/pdal/drivers/qfit/Reader.hpp	Fri Aug 12 15:04:23 2011 -0700
@@ -119,17 +119,17 @@
 
 class PDAL_DLL Reader : public pdal::Reader
 {
-    DECLARE_STATICS
+public:
+    SET_STAGE_NAME("drivers.qfit.reader", "QFIT Reader")
 
-public:
     Reader(const Options& options);
     ~Reader();
     
     virtual void initialize();
+    virtual const Options getDefaultOptions() const;
 
     std::string getFileName() const;
 
- 
     bool supportsIterator (StageIteratorType t) const
     {   
         if (t == StageIterator_Sequential ) return true;
diff -r 42e1b3e69f3f -r 7cca9a500547 include/pdal/drivers/terrasolid/Reader.hpp
--- a/include/pdal/drivers/terrasolid/Reader.hpp	Fri Aug 12 14:46:55 2011 -0500
+++ b/include/pdal/drivers/terrasolid/Reader.hpp	Fri Aug 12 15:04:23 2011 -0700
@@ -127,18 +127,18 @@
 
 class PDAL_DLL Reader : public pdal::Reader
 {
-    DECLARE_STATICS
+public:
+    SET_STAGE_NAME("drivers.terrasolid.reader", "TerraSolid Reader")
 
-public:
     Reader(const Options&);
     Reader(OptionsOld& options);
     ~Reader();
     
     virtual void initialize();
+    virtual const Options getDefaultOptions() const;
 
     std::string getFileName() const;
 
- 
     bool supportsIterator (StageIteratorType t) const
     {   
         if (t == StageIterator_Sequential ) return true;
diff -r 42e1b3e69f3f -r 7cca9a500547 include/pdal/filters/ByteSwapFilter.hpp
--- a/include/pdal/filters/ByteSwapFilter.hpp	Fri Aug 12 14:46:55 2011 -0500
+++ b/include/pdal/filters/ByteSwapFilter.hpp	Fri Aug 12 15:04:23 2011 -0700
@@ -54,13 +54,14 @@
 // updates the header accordingly
 class PDAL_DLL ByteSwapFilter : public Filter
 {
-    DECLARE_STATICS
+public:
+    SET_STAGE_NAME("filters.byteswap", "Crop Filter")
 
-public:


More information about the Liblas-commits mailing list