[Liblas-commits] hg-main-tree: add Field_Alpha. Calls to setNumericScale that are...

liblas-commits at liblas.org liblas-commits at liblas.org
Wed May 11 11:50:09 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/973ca0f83b2e
changeset: 706:973ca0f83b2e
user:      Howard Butler <hobu.inc at gmail.com>
date:      Wed May 11 10:49:20 2011 -0500
description:
add Field_Alpha. Calls to setNumericScale that are not 0.0 imply the dimension is fixed precision
Subject: hg-main-tree: add Field_Alpha name

details:   http://hg.libpc.orghg-main-tree/rev/79e38c1ca368
changeset: 707:79e38c1ca368
user:      Howard Butler <hobu.inc at gmail.com>
date:      Wed May 11 10:49:38 2011 -0500
description:
add Field_Alpha name
Subject: hg-main-tree: add a (not yet working) TerraSolid reader

details:   http://hg.libpc.orghg-main-tree/rev/e8f2efe44b86
changeset: 708:e8f2efe44b86
user:      Howard Butler <hobu.inc at gmail.com>
date:      Wed May 11 10:49:55 2011 -0500
description:
add a (not yet working) TerraSolid reader

diffstat:

 include/libpc/Dimension.hpp                   |    8 +
 include/libpc/drivers/terrasolid/Iterator.hpp |   80 ++++
 include/libpc/drivers/terrasolid/Reader.hpp   |  187 ++++++++++
 src/CMakeLists.txt                            |   20 +
 src/Dimension.cpp                             |    1 +
 src/drivers/terrasolid/Iterator.cpp           |  118 ++++++
 src/drivers/terrasolid/Reader.cpp             |  471 ++++++++++++++++++++++++++
 test/unit/CMakeLists.txt                      |    1 +
 test/unit/TerraSolidTest.cpp                  |  159 ++++++++
 9 files changed, 1045 insertions(+), 0 deletions(-)

diffs (truncated from 1112 to 300 lines):

diff -r 07bb72893e39 -r e8f2efe44b86 include/libpc/Dimension.hpp
--- a/include/libpc/Dimension.hpp	Fri May 06 15:42:22 2011 -0500
+++ b/include/libpc/Dimension.hpp	Wed May 11 10:49:55 2011 -0500
@@ -85,6 +85,7 @@
         Field_WaveformXt,
         Field_WaveformYt,
         Field_WaveformZt,
+        Field_Alpha,
         // ...
 
         // add more here
@@ -219,6 +220,13 @@
     }
     inline void setNumericScale(double v)
     {
+        // If you set a scale that isn't 0, you just made the dimension 
+        // finite precision by default.
+        if ( !Utils::compare_approx(v, 0.0, (std::numeric_limits<double>::min)()))
+        {
+            m_precise = true;
+        }        
+
         m_numericScale = v;
     }
 
diff -r 07bb72893e39 -r e8f2efe44b86 include/libpc/drivers/terrasolid/Iterator.hpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/libpc/drivers/terrasolid/Iterator.hpp	Wed May 11 10:49:55 2011 -0500
@@ -0,0 +1,80 @@
+/******************************************************************************
+* Copyright (c) 2011, Howard Butler, hobu.inc at gmail.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_DRIVERS_QFIT_ITERATOR_HPP
+#define INCLUDED_DRIVERS_QFIT_ITERATOR_HPP
+
+#include <libpc/libpc.hpp>
+
+#include <libpc/Iterator.hpp>
+#include <iosfwd>
+
+
+namespace libpc { namespace drivers { namespace terrasolid {
+
+class Reader;
+
+class SequentialIterator : public libpc::SequentialIterator
+{
+public:
+    SequentialIterator(const Reader& reader);
+    ~SequentialIterator();
+
+private:
+    boost::uint64_t skipImpl(boost::uint64_t);
+    boost::uint32_t readImpl(PointBuffer&);
+    bool atEndImpl() const;
+
+    const Reader& m_reader;
+    std::istream* m_istream;
+};
+
+
+class RandomIterator : public libpc::RandomIterator
+{
+public:
+    RandomIterator(const Reader& reader);
+    ~RandomIterator();
+
+private:
+    boost::uint64_t seekImpl(boost::uint64_t);
+    boost::uint32_t readImpl(PointBuffer&);
+
+    const Reader& m_reader;
+    std::istream* m_istream;
+};
+
+} } } // namespaces
+
+#endif
diff -r 07bb72893e39 -r e8f2efe44b86 include/libpc/drivers/terrasolid/Reader.hpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/libpc/drivers/terrasolid/Reader.hpp	Wed May 11 10:49:55 2011 -0500
@@ -0,0 +1,187 @@
+/******************************************************************************
+* Copyright (c) 2011, Howard Butler, hobu.inc at gmail.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_LIBPC_DRIVER_TERRASOLID_READER_HPP
+#define INCLUDED_LIBPC_DRIVER_TERRASOLID_READER_HPP
+
+#include <libpc/libpc.hpp>
+
+#include <libpc/Stage.hpp>
+#include <libpc/Options.hpp>
+
+#include <libpc/SchemaLayout.hpp>
+
+#include <libpc/Iterator.hpp>
+#include <libpc/exceptions.hpp>
+
+
+#include <vector>
+
+#include <boost/detail/endian.hpp>
+#include <boost/scoped_ptr.hpp>
+
+
+namespace libpc { namespace drivers { namespace terrasolid {
+
+
+enum TERRASOLID_Format_Type
+{
+TERRASOLID_Format_1 = 20010712,
+TERRASOLID_Format_2 = 20020715,
+TERRASOLID_Format_Unknown = 999999999
+};
+
+struct TerraSolidHeader
+{
+    TerraSolidHeader() :
+        HdrSize(0),
+        HdrVersion(0),
+        RecogVal(0),
+        PntCnt(0),
+        Units(0),
+        OrgX(0),
+        OrgY(0),
+        OrgZ(0),
+        Time(0),
+        Color(0)
+    {}
+
+    boost::int32_t HdrSize;
+    boost::int32_t HdrVersion;
+    boost::int32_t RecogVal;
+    char RecogStr[4];
+    boost::int32_t PntCnt;
+    boost::int32_t Units;
+    double OrgX;
+    double OrgY;
+    double OrgZ;
+    boost::int32_t Time;
+    boost::int32_t Color;
+
+};
+
+typedef boost::scoped_ptr<TerraSolidHeader> TerraSolidHeaderPtr ;
+class terrasolid_error : public libpc_error
+{
+public:
+
+    terrasolid_error(std::string const& msg)
+        : libpc_error(msg)
+    {}
+};
+
+class PointIndexes
+{
+public:
+    PointIndexes(const Schema& schema, TERRASOLID_Format_Type format);
+    int Time;
+    int X;
+    int Y;
+    int Z;
+    
+    int Classification;
+    int PointSourceId;
+    int EchoInt;
+    int ReturnNumber;
+    int Intensity;
+    int Mark;
+    int Flag;
+    int Red;
+    int Green;
+    int Blue;
+    int Alpha;
+    
+};
+
+
+class LIBPC_DLL Reader : public libpc::Stage
+{
+
+public:
+    Reader(Options& options);
+    ~Reader();
+    
+    const std::string& getDescription() const;
+    const std::string& getName() const;
+    std::string getFileName() const;
+
+ 
+    bool supportsIterator (StageIteratorType t) const
+    {   
+        if (t == StageIterator_Sequential ) return true;
+        if (t == StageIterator_Random ) return true;
+        
+        return false;
+    }
+
+    boost::uint64_t getNumPoints() { return 0; }
+    
+    libpc::SequentialIterator* createSequentialIterator() const;
+    libpc::RandomIterator* createRandomIterator() const;
+    
+    Options& getOptions() const { return m_options; }
+
+    std::size_t getPointDataOffset() const { return m_offset; }
+    boost::uint32_t getPointDataSize() const { return m_size; }
+
+    // this is called by the stage's iterator
+    boost::uint32_t processBuffer(PointBuffer& PointBuffer, std::istream& stream, boost::uint64_t numPointsLeft) const;
+
+
+protected:
+    inline TERRASOLID_Format_Type getFormat() const { return m_format; }
+
+private:
+
+    Reader& operator=(const Reader&); // not implemented
+    Reader(const Reader&); // not implemented
+
+    Options& m_options;
+    TerraSolidHeaderPtr m_header;
+    TERRASOLID_Format_Type m_format;
+    std::size_t m_offset;
+    boost::uint32_t m_size;
+    
+    bool m_haveColor;
+    bool m_haveTime;
+    
+    void registerFields();
+
+
+};
+
+}}} // namespace libpc::driver::oci
+
+
+#endif // INCLUDED_LIBPC_DRIVER_OCI_READER_HPP


More information about the Liblas-commits mailing list