[Liblas-commits] hg-main-tree: scales need to default to 1.0,
not 0.0 or bad thin...
liblas-commits at liblas.org
liblas-commits at liblas.org
Fri Aug 5 16:00:38 EDT 2011
details: http://hg.libpc.orghg-main-tree/rev/0755f9209963
changeset: 1014:0755f9209963
user: Howard Butler <hobu.inc at gmail.com>
date: Fri Aug 05 10:51:49 2011 -0500
description:
scales need to default to 1.0, not 0.0 or bad things'll happen
Subject: hg-main-tree: common Connect() method that uses the new Options stuff
details: http://hg.libpc.orghg-main-tree/rev/528982e49875
changeset: 1015:528982e49875
user: Howard Butler <hobu.inc at gmail.com>
date: Fri Aug 05 13:33:03 2011 -0500
description:
common Connect() method that uses the new Options stuff
Subject: hg-main-tree: turn off oracle-write
details: http://hg.libpc.orghg-main-tree/rev/a811e9658a74
changeset: 1016:a811e9658a74
user: Howard Butler <hobu.inc at gmail.com>
date: Fri Aug 05 14:58:54 2011 -0500
description:
turn off oracle-write
Subject: hg-main-tree: Optionsify drivers.oci.writer
details: http://hg.libpc.orghg-main-tree/rev/8b20a7c44775
changeset: 1017:8b20a7c44775
user: Howard Butler <hobu.inc at gmail.com>
date: Fri Aug 05 15:00:06 2011 -0500
description:
Optionsify drivers.oci.writer
Subject: hg-main-tree: bring PDAL's native driver in line with libLAS' for header handling. LASzip still not working for some reason yet
details: http://hg.libpc.orghg-main-tree/rev/61a4bd57e21a
changeset: 1018:61a4bd57e21a
user: Howard Butler <hobu.inc at gmail.com>
date: Fri Aug 05 15:00:32 2011 -0500
description:
bring PDAL's native driver in line with libLAS' for header handling. LASzip still not working for some reason yet
diffstat:
apps/pc2pc.cpp | 134 ++++++------
include/pdal/drivers/las/Header.hpp | 13 +-
include/pdal/drivers/las/VariableLengthRecord.hpp | 3 +-
include/pdal/drivers/las/Writer.hpp | 1 -
include/pdal/drivers/oci/Reader.hpp | 1 -
include/pdal/drivers/oci/Writer.hpp | 15 +-
include/pdal/drivers/oci/common.hpp | 2 +-
src/drivers/las/Header.cpp | 26 ++
src/drivers/las/LasHeaderWriter.cpp | 73 ++++---
src/drivers/las/VariableLengthRecord.cpp | 11 +
src/drivers/las/Writer.cpp | 9 +-
src/drivers/oci/Reader.cpp | 32 +---
src/drivers/oci/Writer.cpp | 218 ++++++++-------------
src/drivers/oci/common.cpp | 24 +--
src/filters/ScalingFilter.cpp | 12 +-
15 files changed, 265 insertions(+), 309 deletions(-)
diffs (truncated from 1065 to 300 lines):
diff -r 435254c9c30f -r 61a4bd57e21a apps/pc2pc.cpp
--- a/apps/pc2pc.cpp Fri Aug 05 09:34:30 2011 -0500
+++ b/apps/pc2pc.cpp Fri Aug 05 15:00:32 2011 -0500
@@ -137,73 +137,73 @@
writer.write(numPoints);
}
- else if (hasOption("oracle-writer"))
- {
-#ifdef PDAL_HAVE_ORACLE
- try{
- pdal::drivers::las::LasReader reader(m_inputFile);
-
- const boost::uint64_t numPoints = reader.getNumPoints();
-
- boost::property_tree::ptree load_tree;
-
- boost::property_tree::read_xml(m_xml, load_tree);
-
- boost::property_tree::ptree oracle_options = load_tree.get_child("pdal.drivers.oci.writer");
- boost::property_tree::ptree las_options = load_tree.get_child("pdal.drivers.las");
-
- pdal::OptionsOld options(oracle_options);
-
- boost::property_tree::ptree in_srs_options = las_options.get_child("spatialreference");
- 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 out_wkt = out_srs_options.get<std::string>("userinput");
-
- pdal::SpatialReference in_ref(in_wkt);
- pdal::SpatialReference out_ref(out_wkt);
-
- boost::property_tree::ptree& tree = options.GetPTree();
-
- boost::uint32_t capacity = tree.get<boost::uint32_t>("capacity");
- double scalex = oracle_options.get<double>("scale.x");
- double scaley = oracle_options.get<double>("scale.y");
- double scalez = oracle_options.get<double>("scale.z");
-
- double offsetx = oracle_options.get<double>("offset.x");
- double offsety = oracle_options.get<double>("offset.y");
- double offsetz = oracle_options.get<double>("offset.z");
-
- pdal::filters::CacheFilter cache(reader, 1, capacity);
- pdal::filters::Chipper chipper(cache, capacity);
- pdal::filters::ScalingFilter scalingFilter(chipper);
- pdal::filters::ReprojectionFilter reprojectionFilter(scalingFilter, in_ref, out_ref);
- pdal::filters::DescalingFilter descalingFilter(reprojectionFilter,
- scalex, offsetx,
- scaley, offsety,
- scalez, offsetz);
-
- // pdal::filters::ByteSwapFilter swapper(descalingFilter);
- pdal::drivers::oci::Writer writer(descalingFilter, options);
-
- writer.initialize();
-
- writer.write(numPoints);
-
-
-
- boost::property_tree::ptree output_tree;
- // output_tree.put_child(writer.getName(), options.GetPTree());
- // boost::property_tree::write_xml(m_xml, output_tree);
-
- } catch (pdal::pdal_error& e)
- {
- std::cerr << "Error writing oracle: " << e.what() << std::endl;
-
- }
-#else
- throw configuration_error("PDAL not compiled with Oracle support");
-#endif
- }
+// else if (hasOption("oracle-writer"))
+// {
+// #ifdef PDAL_HAVE_ORACLE
+// try{
+// pdal::drivers::las::LasReader reader(m_inputFile);
+//
+// const boost::uint64_t numPoints = reader.getNumPoints();
+//
+// boost::property_tree::ptree load_tree;
+//
+// boost::property_tree::read_xml(m_xml, load_tree);
+//
+// boost::property_tree::ptree oracle_options = load_tree.get_child("pdal.drivers.oci.writer");
+// boost::property_tree::ptree las_options = load_tree.get_child("pdal.drivers.las");
+//
+// pdal::OptionsOld options(oracle_options);
+//
+// boost::property_tree::ptree in_srs_options = las_options.get_child("spatialreference");
+// 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 out_wkt = out_srs_options.get<std::string>("userinput");
+//
+// pdal::SpatialReference in_ref(in_wkt);
+// pdal::SpatialReference out_ref(out_wkt);
+//
+// boost::property_tree::ptree& tree = options.GetPTree();
+//
+// boost::uint32_t capacity = tree.get<boost::uint32_t>("capacity");
+// double scalex = oracle_options.get<double>("scale.x");
+// double scaley = oracle_options.get<double>("scale.y");
+// double scalez = oracle_options.get<double>("scale.z");
+//
+// double offsetx = oracle_options.get<double>("offset.x");
+// double offsety = oracle_options.get<double>("offset.y");
+// double offsetz = oracle_options.get<double>("offset.z");
+//
+// pdal::filters::CacheFilter cache(reader, 1, capacity);
+// pdal::filters::Chipper chipper(cache, capacity);
+// pdal::filters::ScalingFilter scalingFilter(chipper);
+// pdal::filters::ReprojectionFilter reprojectionFilter(scalingFilter, in_ref, out_ref);
+// pdal::filters::DescalingFilter descalingFilter(reprojectionFilter,
+// scalex, offsetx,
+// scaley, offsety,
+// scalez, offsetz);
+//
+// // pdal::filters::ByteSwapFilter swapper(descalingFilter);
+// pdal::drivers::oci::Writer writer(descalingFilter, options);
+//
+// writer.initialize();
+//
+// writer.write(numPoints);
+//
+//
+//
+// boost::property_tree::ptree output_tree;
+// // output_tree.put_child(writer.getName(), options.GetPTree());
+// // boost::property_tree::write_xml(m_xml, output_tree);
+//
+// } catch (pdal::pdal_error& e)
+// {
+// std::cerr << "Error writing oracle: " << e.what() << std::endl;
+//
+// }
+// #else
+// throw configuration_error("PDAL not compiled with Oracle support");
+// #endif
+// }
// else if (hasOption("oracle-reader"))
// {
// #ifdef PDAL_HAVE_ORACLE
diff -r 435254c9c30f -r 61a4bd57e21a include/pdal/drivers/las/Header.hpp
--- a/include/pdal/drivers/las/Header.hpp Fri Aug 05 09:34:30 2011 -0500
+++ b/include/pdal/drivers/las/Header.hpp Fri Aug 05 15:00:32 2011 -0500
@@ -305,6 +305,8 @@
const VLRList& getVLRs() const;
VLRList& getVLRs();
+ std::size_t getVLRBlockSize() const;
+
/// Returns a property_tree that contains
/// all of the header data in a structured format.
boost::property_tree::ptree GetPTree() const;
@@ -319,10 +321,10 @@
void setSpatialReference(const SpatialReference&);
const SpatialReference& getSpatialReference() const;
- //void to_rst(std::ostream& os) const;
- //void to_xml(std::ostream& os) const;
- //void to_json(std::ostream& os) const;
-
+ void SetHeaderPadding(boost::uint32_t v);
+ boost::uint32_t GetHeaderPadding() const;
+
+
private:
typedef Vector<double> PointScales;
typedef Vector<double> PointOffsets;
@@ -365,7 +367,8 @@
PointScales m_scales;
PointOffsets m_offsets;
bool m_isCompressed;
-
+ boost::uint32_t m_headerPadding;
+
PointFormat m_pointFormat;
Bounds<double> m_bounds;
diff -r 435254c9c30f -r 61a4bd57e21a include/pdal/drivers/las/VariableLengthRecord.hpp
--- a/include/pdal/drivers/las/VariableLengthRecord.hpp Fri Aug 05 09:34:30 2011 -0500
+++ b/include/pdal/drivers/las/VariableLengthRecord.hpp Fri Aug 05 15:00:32 2011 -0500
@@ -80,7 +80,8 @@
const boost::uint8_t* getBytes() const;
std::size_t getLength() const;
-
+ std::size_t getTotalSize() const;
+
static const int s_headerLength = 54;
static void setSRSFromVLRs(const std::vector<VariableLengthRecord>& vlrs, SpatialReference& srs);
diff -r 435254c9c30f -r 61a4bd57e21a include/pdal/drivers/las/Writer.hpp
--- a/include/pdal/drivers/las/Writer.hpp Fri Aug 05 09:34:30 2011 -0500
+++ b/include/pdal/drivers/las/Writer.hpp Fri Aug 05 15:00:32 2011 -0500
@@ -93,7 +93,6 @@
SpatialReference m_spatialReference;
#ifdef PDAL_HAVE_LASZIP
- boost::scoped_ptr<LASzip> m_zip;
boost::scoped_ptr<LASzipper> m_zipper;
boost::scoped_ptr<ZipPoint> m_zipPoint;
#endif
diff -r 435254c9c30f -r 61a4bd57e21a include/pdal/drivers/oci/Reader.hpp
--- a/include/pdal/drivers/oci/Reader.hpp Fri Aug 05 09:34:30 2011 -0500
+++ b/include/pdal/drivers/oci/Reader.hpp Fri Aug 05 15:00:32 2011 -0500
@@ -85,7 +85,6 @@
QueryType describeQueryType() const;
BlockPtr defineBlock() const;
Schema fetchSchema(sdo_pc* pc);
- Connection Connect();
Connection m_connection;
Statement m_statement;
diff -r 435254c9c30f -r 61a4bd57e21a include/pdal/drivers/oci/Writer.hpp
--- a/include/pdal/drivers/oci/Writer.hpp Fri Aug 05 09:34:30 2011 -0500
+++ b/include/pdal/drivers/oci/Writer.hpp Fri Aug 05 15:00:32 2011 -0500
@@ -53,7 +53,6 @@
public:
Writer(Stage& prevStage, const Options&);
- Writer(Stage& prevStage, OptionsOld& options);
~Writer();
virtual void initialize();
@@ -82,7 +81,7 @@
void CreateBlockIndex();
void CreateBlockTable();
void CreateSDOEntry();
- void CreatePCEntry(std::vector<boost::uint8_t> const* header_data);
+ void CreatePCEntry();
long GetGType();
std::string CreatePCElemInfo();
bool BlockTableExists();
@@ -99,9 +98,13 @@
pdal::Bounds<double> const& extent);
void SetElements(Statement statement,
OCIArray* elem_info);
-
- bool isVerbose() const;
- bool isDebug() const;
+
+ template<typename T> T getDefaultedOption(std::string const& option_name) const
+ {
+ T default_value = Writer::s_getDefaultOptions().getOption<T>(option_name).getValue();
+ return getOptions().getValueOrDefault<T>(option_name, default_value);
+ }
+
bool is3d() const;
bool isSolid() const;
boost::int32_t getPCID() const;
@@ -111,12 +114,12 @@
pdal::Bounds<double> CalculateBounds(PointBuffer const& buffer);
Stage& m_stage;
- OptionsOld& m_optionsOld;
pdal::Bounds<double> m_bounds; // Bounds of the entire point cloud
Connection m_connection;
bool m_verbose;
bool m_doCreateIndex;
Bounds<double> m_pcExtent;
+ int m_pc_id;
};
}}} // namespace pdal::driver::oci
diff -r 435254c9c30f -r 61a4bd57e21a include/pdal/drivers/oci/common.hpp
--- a/include/pdal/drivers/oci/common.hpp Fri Aug 05 09:34:30 2011 -0500
+++ b/include/pdal/drivers/oci/common.hpp Fri Aug 05 15:00:32 2011 -0500
@@ -171,7 +171,7 @@
typedef boost::shared_ptr<Block> BlockPtr;
-PDAL_DLL Connection Connect(pdal::OptionsOld const& options);
+PDAL_DLL Connection Connect(pdal::Options const& options, bool debug, int verbosity);
std::string to_upper(std::string const& input);
diff -r 435254c9c30f -r 61a4bd57e21a src/drivers/las/Header.cpp
--- a/src/drivers/las/Header.cpp Fri Aug 05 09:34:30 2011 -0500
+++ b/src/drivers/las/Header.cpp Fri Aug 05 15:00:32 2011 -0500
@@ -363,6 +363,16 @@
return m_bounds.getMinimum(2);
}
+boost::uint32_t LasHeader::GetHeaderPadding() const
+{
+ return m_headerPadding;
+}
+
+void LasHeader::SetHeaderPadding( boost::uint32_t v)
+{
+ m_headerPadding = v;
+}
+
void LasHeader::SetMax(double x, double y, double z)
{
// m_extent = Bounds(m_extent.min(0), m_extent.min(1), m_extent.max(0), m_extent.max(1), m_extent.min(2), m_extent.max(2));
@@ -422,6 +432,7 @@
More information about the Liblas-commits
mailing list