[Liblas-commits] hg-main-tree: decruft and comment about how we
loop through the ...
liblas-commits at liblas.org
liblas-commits at liblas.org
Mon Jul 25 11:19:47 EDT 2011
details: http://hg.libpc.orghg-main-tree/rev/f79a2c924193
changeset: 920:f79a2c924193
user: Howard Butler <hobu.inc at gmail.com>
date: Mon Jul 25 09:32:06 2011 -0500
description:
decruft and comment about how we loop through the non-XYZ dimensions to copy the data
Subject: hg-main-tree: add non-const getDimensions method
details: http://hg.libpc.orghg-main-tree/rev/1ddc67c08d10
changeset: 921:1ddc67c08d10
user: Howard Butler <hobu.inc at gmail.com>
date: Mon Jul 25 10:17:28 2011 -0500
description:
add non-const getDimensions method
Subject: hg-main-tree: ByteSwapFilter should flip the endianness bit on its dimensions
details: http://hg.libpc.orghg-main-tree/rev/8a61ddaa2889
changeset: 922:8a61ddaa2889
user: Howard Butler <hobu.inc at gmail.com>
date: Mon Jul 25 10:18:05 2011 -0500
description:
ByteSwapFilter should flip the endianness bit on its dimensions
Subject: hg-main-tree: merge
details: http://hg.libpc.orghg-main-tree/rev/0cf0602555f2
changeset: 923:0cf0602555f2
user: Howard Butler <hobu.inc at gmail.com>
date: Mon Jul 25 10:19:40 2011 -0500
description:
merge
diffstat:
apps/CMakeLists.txt | 6 +-
include/pdal/MultiFilter.hpp | 2 +-
include/pdal/Options.hpp | 14 +++
include/pdal/Schema.hpp | 1 +
include/pdal/Stage.hpp | 20 +----
include/pdal/StageBase.hpp | 106 ++++++++++++++++++++++++++++
include/pdal/Writer.hpp | 14 +--
include/pdal/drivers/faux/Reader.hpp | 6 +-
include/pdal/drivers/faux/Writer.hpp | 7 +-
include/pdal/drivers/las/Reader.hpp | 6 +-
include/pdal/drivers/las/Writer.hpp | 6 +-
include/pdal/drivers/liblas/Reader.hpp | 6 +-
include/pdal/drivers/liblas/Writer.hpp | 6 +-
include/pdal/drivers/oci/Reader.hpp | 9 +-
include/pdal/drivers/oci/Writer.hpp | 7 +-
include/pdal/drivers/qfit/Reader.hpp | 5 +-
include/pdal/drivers/terrasolid/Reader.hpp | 4 +-
include/pdal/filters/ByteSwapFilter.hpp | 10 +-
include/pdal/filters/CacheFilter.hpp | 6 +-
include/pdal/filters/Chipper.hpp | 6 +-
include/pdal/filters/ColorFilter.hpp | 6 +-
include/pdal/filters/CropFilter.hpp | 6 +-
include/pdal/filters/DecimationFilter.hpp | 6 +-
include/pdal/filters/MosaicFilter.hpp | 7 +-
include/pdal/filters/ReprojectionFilter.hpp | 6 +-
include/pdal/filters/ScalingFilter.hpp | 6 +-
src/CMakeLists.txt | 2 +
src/MultiFilter.cpp | 2 +-
src/Options.cpp | 11 ++
src/PipelineManager.cpp | 10 +-
src/Schema.cpp | 5 +
src/Stage.cpp | 15 +---
src/StageBase.cpp | 74 +++++++++++++++++++
src/StageFactory.cpp | 100 ++++++++++++++++----------
src/Writer.cpp | 8 +-
src/drivers/faux/Reader.cpp | 24 +++---
src/drivers/faux/Writer.cpp | 21 +---
src/drivers/las/Reader.cpp | 24 ++---
src/drivers/las/Writer.cpp | 26 +++---
src/drivers/liblas/Reader.cpp | 26 +++---
src/drivers/liblas/Writer.cpp | 23 ++---
src/drivers/oci/Reader.cpp | 26 +++---
src/drivers/oci/Writer.cpp | 31 +++----
src/drivers/qfit/Reader.cpp | 17 +---
src/drivers/terrasolid/Reader.cpp | 23 ++---
src/filters/ByteSwapFilter.cpp | 42 +++++++---
src/filters/CacheFilter.cpp | 23 ++---
src/filters/Chipper.cpp | 23 ++---
src/filters/ColorFilter.cpp | 24 +++---
src/filters/CropFilter.cpp | 24 ++---
src/filters/DecimationFilter.cpp | 24 ++---
src/filters/MosaicFilter.cpp | 21 +---
src/filters/ReprojectionFilter.cpp | 24 ++---
src/filters/ScalingFilter.cpp | 73 +++----------------
test/unit/CropFilterTest.cpp | 2 +-
test/unit/FauxWriterTest.cpp | 4 +-
test/unit/MosaicFilterTest.cpp | 2 +-
test/unit/OptionsTest.cpp | 21 +++++-
test/unit/PipelineManagerTest.cpp | 16 ++--
test/unit/StageFactoryTest.cpp | 56 +++++++-------
60 files changed, 634 insertions(+), 497 deletions(-)
diffs (truncated from 2192 to 300 lines):
diff -r cc1a954b7bac -r 0cf0602555f2 apps/CMakeLists.txt
--- a/apps/CMakeLists.txt Fri Jul 22 10:24:11 2011 -0500
+++ b/apps/CMakeLists.txt Mon Jul 25 10:19:40 2011 -0500
@@ -90,9 +90,9 @@
# if(WITH_GDAL)
# set(PKGCFG_INC_DIR "${PKGCFG_INC_DIR} ${GDAL_INCLUDE_DIR}")
# endif()
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pdal.pc
- DESTINATION ${PDAL_LIB_DIR}/pkgconfig
- PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+ # install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pdal.pc
+ # DESTINATION ${PDAL_LIB_DIR}/pkgconfig
+ # PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
else()
diff -r cc1a954b7bac -r 0cf0602555f2 include/pdal/MultiFilter.hpp
--- a/include/pdal/MultiFilter.hpp Fri Jul 22 10:24:11 2011 -0500
+++ b/include/pdal/MultiFilter.hpp Mon Jul 25 10:19:40 2011 -0500
@@ -47,7 +47,7 @@
public:
// entries may not be null
// vector.size() must be > 0
- MultiFilter(std::vector<const Stage*> prevStages, const Options& options);
+ MultiFilter(const std::vector<const Stage*>& prevStages, const Options& options);
const std::vector<const Stage*>& getPrevStages() const;
diff -r cc1a954b7bac -r 0cf0602555f2 include/pdal/Options.hpp
--- a/include/pdal/Options.hpp Fri Jul 22 10:24:11 2011 -0500
+++ b/include/pdal/Options.hpp Mon Jul 25 10:19:40 2011 -0500
@@ -154,6 +154,10 @@
// defult ctor, empy options list
Options() {}
+ // construct from an array of Option items
+ // (useful for initialization of a static Options object)
+ Options(std::vector<pdal::Option<std::string> > options);
+
Options(boost::property_tree::ptree t);
// read options from an xml stream
@@ -232,6 +236,16 @@
PDAL_DLL std::ostream& operator<<(std::ostream& ostr, const OptionsOld&);
+// Use this to create a static variable initialized to the given Option items.
+// Note that option_items must use boost::assign syntax, e.g.
+// INIT_OPTIONS(s_defaultOptions, (pdal::Option<std::string>("r","s","t")) (pdal::Option<std::string>("u","v","w")) )
+// The reason for this mess is that we want to initialize static Options objects, and there's no clean way to do that.
+
+#define INIT_OPTIONS(var, option_items) \
+ static const std::vector<pdal::Option<std::string> > var##_vector(boost::assign::list_of option_items); \
+ static const pdal::Options var(var##_vector);
+
+
} // namespace pdal
#endif
diff -r cc1a954b7bac -r 0cf0602555f2 include/pdal/Schema.hpp
--- a/include/pdal/Schema.hpp Fri Jul 22 10:24:11 2011 -0500
+++ b/include/pdal/Schema.hpp Mon Jul 25 10:19:40 2011 -0500
@@ -85,6 +85,7 @@
const Dimension& getDimension(std::size_t index) const;
Dimension& getDimension(std::size_t index);
const Dimensions& getDimensions() const;
+ Dimensions& getDimensions();
// returns the index of the field
//
diff -r cc1a954b7bac -r 0cf0602555f2 include/pdal/Stage.hpp
--- a/include/pdal/Stage.hpp Fri Jul 22 10:24:11 2011 -0500
+++ b/include/pdal/Stage.hpp Mon Jul 25 10:19:40 2011 -0500
@@ -37,13 +37,11 @@
#include <pdal/pdal.hpp>
-#include <string>
-
+#include <pdal/StageBase.hpp>
#include <pdal/Schema.hpp>
#include <pdal/Bounds.hpp>
#include <pdal/SpatialReference.hpp>
#include <pdal/MetadataRecord.hpp>
-#include <pdal/Options.hpp>
namespace pdal
{
@@ -54,22 +52,12 @@
class StageBlockIterator;
// every stage owns its own header, they are not shared
-class PDAL_DLL Stage
+class PDAL_DLL Stage : public StageBase
{
public:
Stage(const Options& options);
virtual ~Stage();
- const Options& getOptions() const;
-
- // Implement this in your concrete classes to return a constant string
- // as the name of the stage. 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 const std::string& getName() const = 0;
- virtual const std::string& getDescription() const = 0;
-
// core properties of all stages
const Schema& getSchema() const;
virtual boost::uint64_t getNumPoints() const;
@@ -89,8 +77,6 @@
void dump() const;
protected:
- Options& getOptions();
-
// setters for the core properties
Schema& getSchemaRef();
void setSchema(const Schema&);
@@ -106,8 +92,6 @@
void setCoreProperties(const Stage&);
private:
- Options m_options;
-
Schema m_schema;
boost::uint64_t m_numPoints;
PointCountType m_pointCountType;
diff -r cc1a954b7bac -r 0cf0602555f2 include/pdal/StageBase.hpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/include/pdal/StageBase.hpp Mon Jul 25 10:19:40 2011 -0500
@@ -0,0 +1,106 @@
+/******************************************************************************
+* 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_STAGEBASE_HPP
+#define INCLUDED_STAGEBASE_HPP
+
+#include <pdal/pdal.hpp>
+#include <pdal/Options.hpp>
+
+#include <string>
+
+
+namespace pdal
+{
+
+
+// both Stages and Writers have a few common properties, so
+class PDAL_DLL StageBase
+{
+public:
+ StageBase(const Options& options);
+
+ const Options& getOptions() 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.
+
+ // 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 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::s_getDefaultOptions() { return s_defaultOptions; } \
+ 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(); }
+
+protected:
+ Options& getOptions();
+
+private:
+ Options m_options;
+
+ StageBase& operator=(const StageBase&); // not implemented
+ StageBase(const StageBase&); // not implemented
+};
+
+
+PDAL_DLL std::ostream& operator<<(std::ostream& ostr, const StageBase&);
+
+} // namespace pdal
+
+#endif
diff -r cc1a954b7bac -r 0cf0602555f2 include/pdal/Writer.hpp
--- a/include/pdal/Writer.hpp Fri Jul 22 10:24:11 2011 -0500
+++ b/include/pdal/Writer.hpp Mon Jul 25 10:19:40 2011 -0500
@@ -37,6 +37,7 @@
#include <pdal/pdal.hpp>
#include <pdal/Options.hpp>
+#include <pdal/Stage.hpp>
#include <string>
@@ -46,10 +47,10 @@
class Stage;
class PointBuffer;
-class PDAL_DLL Writer
+class PDAL_DLL Writer : public StageBase
{
public:
- Writer(Stage& prevStage, const Options& options);
+ Writer(const Stage& prevStage, const Options& options);
virtual ~Writer() {}
// size of the PointBuffer buffer to use
@@ -61,8 +62,6 @@
// actually written.
boost::uint64_t write(boost::uint64_t targetNumPointsToWrite);
- const Options& getOptions() const;
-
protected:
// this is called once before the loop with the writeBuffer calls
virtual void writeBegin() = 0;
@@ -73,17 +72,14 @@
// called once, after the writeBuffer calls
virtual void writeEnd() = 0;
- Stage& getPrevStage();
+ const Stage& getPrevStage();
// these two are valid for use after writeBegin has been called
boost::uint64_t m_actualNumPointsWritten;
boost::uint64_t m_targetNumPointsToWrite;
- Options& getOptions();
-
private:
- Options m_options;
- Stage& m_prevStage;
+ const Stage& m_prevStage;
boost::uint32_t m_chunkSize;
static const boost::uint32_t s_defaultChunkSize;
diff -r cc1a954b7bac -r 0cf0602555f2 include/pdal/drivers/faux/Reader.hpp
--- a/include/pdal/drivers/faux/Reader.hpp Fri Jul 22 10:24:11 2011 -0500
+++ b/include/pdal/drivers/faux/Reader.hpp Mon Jul 25 10:19:40 2011 -0500
@@ -65,6 +65,8 @@
//
class PDAL_DLL Reader : public pdal::Reader
{
More information about the Liblas-commits
mailing list