[Liblas-commits] hg-main-tree: checkpoint - SRS/VLR work

liblas-commits at liblas.org liblas-commits at liblas.org
Mon Apr 25 17:29:04 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/0086271d0b6a
changeset: 641:0086271d0b6a
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Mon Apr 25 10:42:42 2011 -0700
description:
checkpoint - SRS/VLR work
Subject: hg-main-tree: checkpoint - SRS/VLR work - split off from Metadata, change VLR ids to strings, etc

details:   http://hg.libpc.orghg-main-tree/rev/8300140198a4
changeset: 642:8300140198a4
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Mon Apr 25 11:43:14 2011 -0700
description:
checkpoint - SRS/VLR work - split off from Metadata, change VLR ids to strings, etc
Subject: hg-main-tree: still debugging VLR/SRS stuff

details:   http://hg.libpc.orghg-main-tree/rev/b95c2454cfcc
changeset: 643:b95c2454cfcc
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Mon Apr 25 13:38:04 2011 -0700
description:
still debugging VLR/SRS stuff
Subject: hg-main-tree: srs writing done, but with one unit test failure

details:   http://hg.libpc.orghg-main-tree/rev/4b21908c3bc8
changeset: 644:4b21908c3bc8
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Mon Apr 25 14:28:43 2011 -0700
description:
srs writing done, but with one unit test failure
Subject: hg-main-tree: merge

details:   http://hg.libpc.orghg-main-tree/rev/b5679e136165
changeset: 645:b5679e136165
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Mon Apr 25 14:28:56 2011 -0700
description:
merge

diffstat:

 apps/pc2pc.cpp                                     |    4 +-
 include/libpc/Options.hpp                          |   67 +++++
 include/libpc/Stage.hpp                            |    4 +-
 include/libpc/Writer.hpp                           |    4 -
 include/libpc/drivers/faux/Reader.hpp              |    3 +-
 include/libpc/drivers/faux/Writer.hpp              |    3 +-
 include/libpc/drivers/las/Header.hpp               |   30 +--
 include/libpc/drivers/las/Reader.hpp               |    3 +
 include/libpc/drivers/las/VariableLengthRecord.hpp |   58 +++-
 include/libpc/drivers/las/Writer.hpp               |    1 +
 include/libpc/drivers/liblas/Reader.hpp            |    3 +-
 include/libpc/drivers/liblas/Writer.hpp            |    3 +-
 include/libpc/drivers/mrsid/Reader.hpp             |    1 +
 include/libpc/drivers/oci/Common.hpp               |   20 +-
 include/libpc/drivers/oci/Reader.hpp               |    1 +
 include/libpc/drivers/oci/Writer.hpp               |    3 +-
 include/libpc/filters/CacheFilter.hpp              |    1 +
 include/libpc/filters/Chipper.hpp                  |    3 +-
 include/libpc/filters/ColorFilter.hpp              |    1 +
 include/libpc/filters/CropFilter.hpp               |    1 +
 include/libpc/filters/DecimationFilter.hpp         |    1 +
 include/libpc/filters/MosaicFilter.hpp             |    1 +
 src/CMakeLists.txt                                 |    2 +
 src/Options.cpp                                    |  153 +++++++++++
 src/SpatialReference.cpp                           |   10 +-
 src/Stage.cpp                                      |    2 +-
 src/drivers/faux/Reader.cpp                        |    7 +-
 src/drivers/faux/Writer.cpp                        |    7 +-
 src/drivers/las/Header.cpp                         |   79 +-----
 src/drivers/las/LasHeaderReader.cpp                |  113 ++++---
 src/drivers/las/LasHeaderReader.hpp                |    2 +
 src/drivers/las/LasHeaderWriter.cpp                |  181 +++++--------
 src/drivers/las/Reader.cpp                         |   24 +-
 src/drivers/las/Support.cpp                        |   46 ++-
 src/drivers/las/VariableLengthRecord.cpp           |  280 ++++++++++++++------
 src/drivers/las/Writer.cpp                         |    7 +-
 src/drivers/las/ZipPoint.cpp                       |   12 +-
 src/drivers/liblas/Reader.cpp                      |   34 +--
 src/drivers/liblas/Writer.cpp                      |    7 +-
 src/drivers/mrsid/Reader.cpp                       |    8 +-
 src/drivers/oci/Reader.cpp                         |    9 +-
 src/drivers/oci/Writer.cpp                         |    8 +-
 src/drivers/oci/common.cpp                         |  149 +++++-----
 src/filters/CacheFilter.cpp                        |    7 +-
 src/filters/Chipper.cpp                            |    7 +-
 src/filters/ColorFilter.cpp                        |    7 +-
 src/filters/CropFilter.cpp                         |    8 +-
 src/filters/DecimationFilter.cpp                   |    8 +-
 src/filters/MosaicFilter.cpp                       |    7 +-
 test/unit/CacheFilterTest.cpp                      |    2 +-
 test/unit/CropFilterTest.cpp                       |    2 +-
 test/unit/DecimationFilterTest.cpp                 |    2 +-
 test/unit/FauxReaderTest.cpp                       |    4 +-
 test/unit/FauxWriterTest.cpp                       |    2 +-
 test/unit/LasReaderTest.cpp                        |   12 +-
 test/unit/LasWriterTest.cpp                        |   10 +-
 test/unit/LiblasReaderTest.cpp                     |   13 +-
 test/unit/LiblasWriterTest.cpp                     |    4 +-
 test/unit/MosaicFilterTest.cpp                     |    2 +-
 test/unit/SpatialReferenceTest.cpp                 |   59 ++--
 60 files changed, 915 insertions(+), 597 deletions(-)

diffs (truncated from 2848 to 300 lines):

diff -r 7f1b39cf6d36 -r b5679e136165 apps/pc2pc.cpp
--- a/apps/pc2pc.cpp	Mon Apr 25 10:49:33 2011 -0500
+++ b/apps/pc2pc.cpp	Mon Apr 25 14:28:56 2011 -0700
@@ -131,7 +131,7 @@
     
         const boost::uint64_t numPoints = reader.getNumPoints();
         
-        libpc::drivers::oci::Options options;
+        libpc::Options options = libpc::drivers::oci::GetDefaultOptions();
         boost::property_tree::ptree& tree = options.GetPTree();
         
         boost::uint32_t capacity = 10000;
@@ -157,7 +157,7 @@
         else if (hasOption("oracle-reader"))
         {
     #ifdef LIBPC_HAVE_ORACLE
-            libpc::drivers::oci::Options options;
+            libpc::Options options = libpc::drivers::oci::GetDefaultOptions();
             boost::property_tree::ptree& tree = options.GetPTree();
             tree.put("capacity", 12);
             tree.put("connection", "lidar/lidar at oracle.hobu.biz/orcl");
diff -r 7f1b39cf6d36 -r b5679e136165 include/libpc/Options.hpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/libpc/Options.hpp	Mon Apr 25 14:28:56 2011 -0700
@@ -0,0 +1,67 @@
+/******************************************************************************
+* 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_OPTIONS_HPP
+#define INCLUDED_OPTIONS_HPP
+
+#include <libpc/libpc.hpp>
+#include <libpc/Bounds.hpp>
+#include <boost/property_tree/ptree.hpp>
+
+
+namespace libpc
+{
+
+class LIBPC_DLL Options
+{
+
+private:
+    boost::property_tree::ptree m_tree;
+
+public:
+
+    Options();
+    bool IsDebug() const;
+    bool Is3d() const;
+    bool IsSolid() const;
+    boost::property_tree::ptree& GetPTree() {return m_tree; }
+    boost::property_tree::ptree const& GetPTree() const {return m_tree; }
+};
+
+
+LIBPC_DLL std::ostream& operator<<(std::ostream& ostr, const Options&);
+
+} // namespace libpc
+
+#endif
diff -r 7f1b39cf6d36 -r b5679e136165 include/libpc/Stage.hpp
--- a/include/libpc/Stage.hpp	Mon Apr 25 10:49:33 2011 -0500
+++ b/include/libpc/Stage.hpp	Mon Apr 25 14:28:56 2011 -0700
@@ -43,6 +43,7 @@
 #include <libpc/Bounds.hpp>
 #include <libpc/SpatialReference.hpp>
 #include <libpc/MetadataRecord.hpp>
+#include <libpc/Options.hpp>
 
 namespace libpc
 {
@@ -63,7 +64,8 @@
     // as the name of the stage.  Use upper camel case, with spaces between
     // words.  The last word should generally be "Reader" or "Filter".
     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;
diff -r 7f1b39cf6d36 -r b5679e136165 include/libpc/Writer.hpp
--- a/include/libpc/Writer.hpp	Mon Apr 25 10:49:33 2011 -0500
+++ b/include/libpc/Writer.hpp	Mon Apr 25 14:28:56 2011 -0700
@@ -51,10 +51,6 @@
     Writer(Stage& prevStage);
     virtual ~Writer() {}
 
-    // Implement this in your concrete classes to return a constant string
-    // as the name of the stage.  Use upper camel case, with spaces between
-    // words.  The last word should generally be "Writer".
-    virtual const std::string& getName() const = 0;
 
     // size of the PointBuffer buffer to use
     void setChunkSize(boost::uint32_t);
diff -r 7f1b39cf6d36 -r b5679e136165 include/libpc/drivers/faux/Reader.hpp
--- a/include/libpc/drivers/faux/Reader.hpp	Mon Apr 25 10:49:33 2011 -0500
+++ b/include/libpc/drivers/faux/Reader.hpp	Mon Apr 25 14:28:56 2011 -0700
@@ -77,8 +77,9 @@
     Reader(const Bounds<double>&, int numPoints, Mode mode);
     Reader(const Bounds<double>&, int numPoints, Mode mode, const std::vector<Dimension>& dimensions);
 
+    const std::string& getDescription() const;
     const std::string& getName() const;
-
+    
     Mode getMode() const;
     
     bool supportsIterator (StageIteratorType t) const
diff -r 7f1b39cf6d36 -r b5679e136165 include/libpc/drivers/faux/Writer.hpp
--- a/include/libpc/drivers/faux/Writer.hpp	Mon Apr 25 10:49:33 2011 -0500
+++ b/include/libpc/drivers/faux/Writer.hpp	Mon Apr 25 14:28:56 2011 -0700
@@ -54,8 +54,9 @@
 public:
     Writer(Stage& prevStage);
 
+    const std::string& getDescription() const;
     const std::string& getName() const;
-
+    
     // retrieve the summary info
     double getMinX() const { return m_minimumX; }
     double getMinY() const { return m_minimumY; }
diff -r 7f1b39cf6d36 -r b5679e136165 include/libpc/drivers/las/Header.hpp
--- a/include/libpc/drivers/las/Header.hpp	Mon Apr 25 10:49:33 2011 -0500
+++ b/include/libpc/drivers/las/Header.hpp	Mon Apr 25 14:28:56 2011 -0700
@@ -221,12 +221,6 @@
     /// for the LAS 1.0 format and 227 bytes for the LAS 1.1 format.
     void SetDataOffset(boost::uint32_t v);
 
-    /// Get number of variable-length records.
-    boost::uint32_t GetRecordsCount() const;
-
-    /// Set number of variable-length records.
-    void SetRecordsCount(boost::uint32_t v);
-    
     /// Get identifier of point data (record) format.
     PointFormat getPointFormat() const;
 
@@ -308,22 +302,8 @@
     const Bounds<double>& getBounds() const { return m_bounds; }
     void setBounds(const Bounds<double>& bounds) { m_bounds = bounds; }
 
-    ///// Adds a variable length record to the header
-    //void AddVLR(VariableRecord const& v);
-    //
-    ///// Returns a VLR 
-    //VariableRecord const& GetVLR(boost::uint32_t index) const;
-    //
-    ///// Returns all of the VLRs
-    //const std::vector<VariableRecord>& GetVLRs() const;
-
-    ///// Removes a VLR from the the header.
-    //void DeleteVLR(boost::uint32_t index);
-    //void DeleteVLRs(std::string const& name, boost::uint16_t id);
-
-    ///// Rewrite variable-length record with georeference infomation, if available.
-    //void SetGeoreference();
-    
+    const VLRList& getVLRs() const;
+    VLRList& getVLRs();
 
     /// Returns a property_tree that contains 
     /// all of the header data in a structured format.
@@ -336,9 +316,6 @@
     /// Sets whether or not the points are compressed.
     void SetCompressed(bool b);
 
-    const std::vector<VariableLengthRecord>& getVLRs() const;
-    std::vector<VariableLengthRecord>& getVLRsRef();
-
     void setSpatialReference(const SpatialReference&);
     const SpatialReference& getSpatialReference() const;
 
@@ -383,7 +360,6 @@
     boost::uint16_t m_createYear;
     boost::uint16_t m_headerSize;
     boost::uint32_t m_dataOffset;
-    boost::uint32_t m_recordsCount;
     boost::uint32_t m_pointRecordsCount;
     RecordsByReturnArray m_pointRecordsByReturn;
     PointScales m_scales;
@@ -394,7 +370,7 @@
 
     Bounds<double> m_bounds;
 
-    std::vector<VariableLengthRecord> m_vlrs;
+    VLRList m_vlrList;
 
     SpatialReference m_spatialReference;
 
diff -r 7f1b39cf6d36 -r b5679e136165 include/libpc/drivers/las/Reader.hpp
--- a/include/libpc/drivers/las/Reader.hpp	Mon Apr 25 10:49:33 2011 -0500
+++ b/include/libpc/drivers/las/Reader.hpp	Mon Apr 25 14:28:56 2011 -0700
@@ -56,6 +56,7 @@
 public:
     LasReader(const std::string& filename);
 
+    const std::string& getDescription() const;
     const std::string& getName() const;
 
     const std::string& getFileName() const;
@@ -83,6 +84,7 @@
 
     boost::uint64_t getPointDataOffset() const;
 
+    // we shouldn't have to expose this
     const std::vector<VariableLengthRecord>& getVLRs() const;
 
 protected:
@@ -94,6 +96,7 @@
 private:
     const std::string m_filename;
     LasHeader m_lasHeader;
+    std::vector<MetadataRecord> m_metadataRecords;
 
     LasReader& operator=(const LasReader&); // not implemented
     LasReader(const LasReader&); // not implemented
diff -r 7f1b39cf6d36 -r b5679e136165 include/libpc/drivers/las/VariableLengthRecord.hpp
--- a/include/libpc/drivers/las/VariableLengthRecord.hpp	Mon Apr 25 10:49:33 2011 -0500
+++ b/include/libpc/drivers/las/VariableLengthRecord.hpp	Mon Apr 25 14:28:56 2011 -0700
@@ -49,25 +49,24 @@
 namespace libpc { namespace drivers { namespace las {
     
 
-class LIBPC_DLL VariableLengthRecord : public MetadataRecord
+class LIBPC_DLL VariableLengthRecord
 {
 public:
     // makes a local copy of the bytes buffer, which is a shared ptr among by all copes of the metadata record
     VariableLengthRecord(boost::uint16_t reserved,
-                         boost::uint8_t* userId,   // always 16 bytes
+                         std::string userId,
                          boost::uint16_t recordId,
-                         boost::uint8_t* description, // always 32 bytes
-                         const boost::uint8_t* bytes, std::size_t len);
+                         std::string description,
+                         const boost::uint8_t* bytes,
+                         std::size_t len);
     VariableLengthRecord(const VariableLengthRecord&);
     ~VariableLengthRecord();
 
     boost::uint16_t getReserved() const { return m_reserved; }
-    boost::uint8_t* getUserId() const { return (boost::uint8_t*)m_userId; }
+    std::string getUserId() const { return m_userId; }
     boost::uint16_t getRecordId() const { return m_recordId; }
-    boost::uint8_t* getDescription() const { return (boost::uint8_t*)m_description; }
+    std::string getDescription() const { return m_description; }
 
-    static void setSRSFromVLRs(const std::vector<VariableLengthRecord>& vlrs, SpatialReference& srs);
-    static void setVLRsFromSRS(const SpatialReference& srs, std::vector<VariableLengthRecord>& vlrs);
     bool isGeoVLR() const;
     enum GeoVLRType
     {
@@ -81,13 +80,52 @@
     bool operator==(const VariableLengthRecord&) const;
     VariableLengthRecord& operator=(const VariableLengthRecord&);
 
+    const boost::uint8_t* getBytes() const;
+    std::size_t getLength() const;
+
     static const int s_headerLength = 54;
 
+    static void setSRSFromVLRs_X(const std::vector<VariableLengthRecord>& vlrs, SpatialReference& srs);
+    static void setVLRsFromSRS_X(const SpatialReference& srs, std::vector<VariableLengthRecord>& vlrs);
+
+    static std::string bytes2string(boost::uint8_t* bytes, boost::uint32_t len);
+


More information about the Liblas-commits mailing list