[Liblas-commits] hg-main-tree: stub in old StageFactory files,
restore pipeline u...
liblas-commits at liblas.org
liblas-commits at liblas.org
Wed Jul 20 16:29:44 EDT 2011
details: http://hg.libpc.orghg-main-tree/rev/7aa1bc46a9fb
changeset: 892:7aa1bc46a9fb
user: Michael P. Gerlek <mpg at flaxen.com>
date: Wed Jul 20 12:19:43 2011 -0700
description:
stub in old StageFactory files, restore pipeline unit test file
Subject: hg-main-tree: merge
details: http://hg.libpc.orghg-main-tree/rev/2a4db1606542
changeset: 893:2a4db1606542
user: Michael P. Gerlek <mpg at flaxen.com>
date: Wed Jul 20 12:20:10 2011 -0700
description:
merge
Subject: hg-main-tree: re-fix the liblas vs. native writer issue
details: http://hg.libpc.orghg-main-tree/rev/bd90f06866ef
changeset: 894:bd90f06866ef
user: Michael P. Gerlek <mpg at flaxen.com>
date: Wed Jul 20 13:29:32 2011 -0700
description:
re-fix the liblas vs. native writer issue
diffstat:
apps/pc2pc.cpp | 6 +-
include/pdal/Schema.hpp | 32 +----
include/pdal/StageFactory.hpp | 123 ++++++++++++++++++
mpg-config.bat | 4 +-
src/CMakeLists.txt | 2 +
src/Schema.cpp | 65 ++-------
src/StageFactory.cpp | 246 ++++++++++++++++++++++++++++++++++++
src/filters/ScalingFilter.cpp | 12 +-
test/data/1.2-with-color.laz | 0
test/data/1.2-with-color_LIBLAS.laz | 0
test/data/1.2-with-color_NATIVE.laz | 0
test/data/pipeline1.xml | 25 +++
test/unit/CMakeLists.txt | 1 +
test/unit/LasWriterTest.cpp | 2 +-
test/unit/LiblasWriterTest.cpp | 2 +-
test/unit/StageFactoryTest.cpp | 175 +++++++++++++++++++++++++
16 files changed, 602 insertions(+), 93 deletions(-)
diffs (truncated from 898 to 300 lines):
diff -r cd1f7f438601 -r bd90f06866ef apps/pc2pc.cpp
--- a/apps/pc2pc.cpp Wed Jul 20 12:34:15 2011 -0500
+++ b/apps/pc2pc.cpp Wed Jul 20 13:29:32 2011 -0700
@@ -152,9 +152,9 @@
pdal::OptionsOld options(oracle_options);
boost::property_tree::ptree in_srs_options = las_options.get_child("spatialreference");
- std::string out_wkt = in_srs_options.get<std::string>("userinput");
+ std::string in_wkt = in_srs_options.get<std::string>("userinput");
boost::property_tree::ptree out_srs_options = oracle_options.get_child("spatialreference");
- std::string in_wkt = out_srs_options.get<std::string>("userinput");
+ std::string out_wkt = out_srs_options.get<std::string>("userinput");
pdal::SpatialReference in_ref(in_wkt);
pdal::SpatialReference out_ref(out_wkt);
@@ -180,7 +180,7 @@
scalez, offsetz,
true);
- pdal::filters::ByteSwapFilter swapper(descalingFilter);
+ // pdal::filters::ByteSwapFilter swapper(descalingFilter);
pdal::drivers::oci::Writer writer(descalingFilter, options);
writer.write(numPoints);
diff -r cd1f7f438601 -r bd90f06866ef include/pdal/Schema.hpp
--- a/include/pdal/Schema.hpp Wed Jul 20 12:34:15 2011 -0500
+++ b/include/pdal/Schema.hpp Wed Jul 20 13:29:32 2011 -0700
@@ -56,40 +56,10 @@
#include <boost/array.hpp>
#include <boost/optional.hpp>
-#include <boost/multi_index_container.hpp>
-#include <boost/multi_index/member.hpp>
-#include <boost/multi_index/ordered_index.hpp>
-#include <boost/multi_index/hashed_index.hpp>
-#include <boost/multi_index/sequenced_index.hpp>
-#include <boost/multi_index/mem_fun.hpp>
-#include <boost/multi_index/random_access_index.hpp>
-
namespace pdal
{
-namespace schema {
-namespace index {
-
-struct name{};
-struct position{};
-struct index{};
-
-typedef boost::multi_index::multi_index_container<
- Dimension,
- boost::multi_index::indexed_by<
- // sort by Dimension::operator<
- // boost::multi_index::ordered_unique<boost::multi_index::tag<position>, boost::multi_index::identity<Dimension> >,
-
- // Random access
- boost::multi_index::random_access<boost::multi_index::tag<index> >
- // sort by less<string> on GetName
- // boost::multi_index::hashed_unique<boost::multi_index::tag<name>, boost::multi_index::const_mem_fun<Dimension,std::string const&,&Dimension::GetName> >
- >
-> IndexMap;
-
-}} // pdal::schema::index
-
/// Schema definition
class PDAL_DLL Schema
{
@@ -140,7 +110,7 @@
// this is a mapping from field name to index position in the
// m_dimensions array (or -1 if field not present)
- int m_indexTable[Dimension::Field_LAST];
+ // int m_indexTable[Dimension::Field_LAST];
};
diff -r cd1f7f438601 -r bd90f06866ef include/pdal/StageFactory.hpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/include/pdal/StageFactory.hpp Wed Jul 20 13:29:32 2011 -0700
@@ -0,0 +1,123 @@
+#if 0
+/******************************************************************************
+* 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_STAGEFACTORY_HPP
+#define INCLUDED_STAGEFACTORY_HPP
+
+#include <pdal/pdal.hpp>
+#include <pdal/Stage.hpp>
+#include <pdal/Reader.hpp>
+#include <pdal/Filter.hpp>
+#include <pdal/MultiFilter.hpp>
+#include <pdal/Writer.hpp>
+
+#include <boost/shared_ptr.hpp>
+
+#include <vector>
+#include <map>
+#include <string>
+
+
+namespace pdal
+{
+
+class Options;
+
+
+// This class provides a mechanism for creating Stage objects using only a
+// string (the stage type name) and an Options block.
+//
+// We keep a list of (stage type name, creation function) pairs, which
+// acts as a registry of creator functions. The list is initialized with
+// the core stages we know about (I wish C++ had anonymous functions.).
+// We allow the user to add his own "external" drivers to the registry list
+// as well.
+//
+// We use 4 different functions for each kind of operation, since we have
+// 4 types of derived classes from Stage and they all have slightly different
+// parameters. That makes it kinda messy.
+
+class PDAL_DLL StageFactory
+{
+public:
+ typedef Reader* ReaderCreator(const Options&);
+ typedef Filter* FilterCreator(const DataStagePtr& prevStage, const Options&);
+ typedef MultiFilter* MultiFilterCreator(const std::vector<const DataStagePtr>& prevStages, const Options&);
+ typedef Writer* WriterCreator(const DataStagePtr& prevStage, const Options&);
+
+ typedef std::map<std::string, ReaderCreator*> ReaderCreatorList;
+ typedef std::map<std::string, FilterCreator*> FilterCreatorList;
+ typedef std::map<std::string, MultiFilterCreator*> MultiFilterCreatorList;
+ typedef std::map<std::string, WriterCreator*> WriterCreatorList;
+
+public:
+ StageFactory();
+
+ ReaderPtr createReader(const std::string& type, const Options& options);
+ FilterPtr createFilter(const std::string& type, const DataStagePtr& prevStage, const Options& options);
+ MultiFilterPtr createMultiFilter(const std::string& type, const std::vector<const DataStagePtr>& prevStages, const Options& options);
+ WriterPtr createWriter(const std::string& type, const DataStagePtr& prevStage, const Options& options);
+
+ void registerReader(const std::string& type, ReaderCreator* f);
+ void registerFilter(const std::string& type, FilterCreator* f);
+ void registerMultiFilter(const std::string& type, MultiFilterCreator* f);
+ void registerWriter(const std::string& type, WriterCreator* f);
+
+private:
+ ReaderCreator* getReaderCreator(const std::string& type) const;
+ FilterCreator* getFilterCreator(const std::string& type) const;
+ MultiFilterCreator* getMultiFilterCreator(const std::string& type) const;
+ WriterCreator* getWriterCreator(const std::string& type) const;
+
+ void registerKnownReaders();
+ void registerKnownFilters();
+ void registerKnownMultiFilters();
+ void registerKnownWriters();
+
+ // these are the "registries" of the factory creator functions
+ ReaderCreatorList m_readerCreators;
+ FilterCreatorList m_filterCreators;
+ MultiFilterCreatorList m_multifilterCreators;
+ WriterCreatorList m_writerCreators;
+
+ StageFactory& operator=(const StageFactory&); // not implemented
+ StageFactory(const StageFactory&); // not implemented
+};
+
+
+} // namespace pdal
+
+#endif
+#endif
diff -r cd1f7f438601 -r bd90f06866ef mpg-config.bat
--- a/mpg-config.bat Wed Jul 20 12:34:15 2011 -0500
+++ b/mpg-config.bat Wed Jul 20 13:29:32 2011 -0700
@@ -7,7 +7,7 @@
set BUILD_TYPE=Debug
set UTILS_DIR=c:\Utils
-set DEV_DIR=c:\dev
+set DEV_DIR=d:\dev
set OSGEO4W_DIR=C:\OSGeo4W
rem *** These packages are needed from OSGeo4W
@@ -27,6 +27,8 @@
set LIBXML2_DIR=%UTILS_DIR%\libxml2-2.7.7.win32
set PDAL_DIR=%DEV_DIR%\pdal
+set ORACLE_HOME=%OSGEO4W_DIR%
+
cmake -G %COMPILER% ^
-DBOOST_INCLUDEDIR=%BOOST_DIR% ^
-DWITH_GDAL=ON ^
diff -r cd1f7f438601 -r bd90f06866ef src/CMakeLists.txt
--- a/src/CMakeLists.txt Wed Jul 20 12:34:15 2011 -0500
+++ b/src/CMakeLists.txt Wed Jul 20 13:29:32 2011 -0700
@@ -46,6 +46,7 @@
${PDAL_HEADERS_DIR}/Signaller.hpp
${PDAL_HEADERS_DIR}/SpatialReference.hpp
${PDAL_HEADERS_DIR}/Stage.hpp
+ ${PDAL_HEADERS_DIR}/StageFactory.hpp
${PDAL_HEADERS_DIR}/StageIterator.hpp
${PDAL_HEADERS_DIR}/Utils.hpp
${PDAL_HEADERS_DIR}/Vector.hpp
@@ -79,6 +80,7 @@
Signaller.cpp
SpatialReference.cpp
Stage.cpp
+ StageFactory.cpp
StageIterator.cpp
Utils.cpp
Vector.cpp
diff -r cd1f7f438601 -r bd90f06866ef src/Schema.cpp
--- a/src/Schema.cpp Wed Jul 20 12:34:15 2011 -0500
+++ b/src/Schema.cpp Wed Jul 20 13:29:32 2011 -0700
@@ -55,10 +55,6 @@
Schema::Schema()
{
- for (int i=0; i<Dimension::Field_LAST; i++)
- {
- m_indexTable[i] = -1;
- }
return;
}
@@ -67,10 +63,7 @@
Schema::Schema(Schema const& other)
: m_dimensions(other.m_dimensions)
{
- for (int i=0; i<Dimension::Field_LAST; i++)
- {
- m_indexTable[i] = other.m_indexTable[i];
- }
+
}
@@ -80,10 +73,6 @@
if (&rhs != this)
{
m_dimensions = rhs.m_dimensions;
- for (int i=0; i<Dimension::Field_LAST; i++)
- {
- m_indexTable[i] = rhs.m_indexTable[i];
- }
}
return *this;
@@ -94,10 +83,6 @@
{
if (m_dimensions == other.m_dimensions)
{
- for (int i=0; i<Dimension::Field_LAST; i++)
- {
- if (m_indexTable[i] != other.m_indexTable[i]) return false;
- }
return true;
}
@@ -139,27 +124,15 @@
void Schema::addDimension(Dimension const& dim)
{
- std::size_t index = m_dimensions.size();
-
m_dimensions.push_back(dim);
-
More information about the Liblas-commits
mailing list