[Liblas-commits] hg: add beginning point format stuff
liblas-commits at liblas.org
liblas-commits at liblas.org
Mon Jan 18 14:45:39 EST 2010
changeset b9d6c3ed8f42 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=b9d6c3ed8f42
summary: add beginning point format stuff
diffstat:
include/Makefile.am | 1 +
include/liblas/detail/format.hpp | 111 +++++++++++++++++++++++++++++++++++++++
include/liblas/lasheader.hpp | 3 +-
src/Makefile.am | 1 +
src/detail/format.cpp | 91 +++++++++++++++++++++++++++++++
5 files changed, 206 insertions(+), 1 deletions(-)
diffs (245 lines):
diff -r 4021e1c06b5f -r b9d6c3ed8f42 include/Makefile.am
--- a/include/Makefile.am Fri Jan 15 23:56:55 2010 -0500
+++ b/include/Makefile.am Mon Jan 18 13:24:49 2010 -0600
@@ -22,6 +22,7 @@
liblas/detail/endian.hpp \
liblas/detail/file.hpp \
liblas/detail/fwd.hpp \
+ liblas/detail/format.hpp \
liblas/detail/reader.hpp \
liblas/detail/reader10.hpp \
liblas/detail/reader11.hpp \
diff -r 4021e1c06b5f -r b9d6c3ed8f42 include/liblas/detail/format.hpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/include/liblas/detail/format.hpp Mon Jan 18 13:24:49 2010 -0600
@@ -0,0 +1,111 @@
+/******************************************************************************
+ * $Id$
+ *
+ * Project: libLAS - http://liblas.org - A BSD library for LAS format data.
+ * Purpose: LAS 1.0 writer implementation for C++ libLAS
+ * Author: Mateusz Loskot, mateusz at loskot.net
+ *
+ ******************************************************************************
+ * Copyright (c) 2008, Mateusz Loskot
+ *
+ * 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 the Martin Isenburg or Iowa Department
+ * of Natural Resources 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 LIBLAS_DETAIL_FORMAT_HPP_INCLUDED
+#define LIBLAS_DETAIL_FORMAT_HPP_INCLUDED
+
+#include <liblas/detail/fwd.hpp>
+#include <liblas/cstdint.hpp>
+#include <liblas/lasheader.hpp>
+// std
+#include <iosfwd>
+
+namespace liblas { namespace detail {
+
+class Format
+{
+public:
+
+ Format(liblas::uint8_t major, liblas::uint8_t minor, liblas::LASHeader::PointSize& size);
+ virtual ~Format();
+
+ virtual liblas::LASHeader::PointSize GetByteSize() const = 0;
+ virtual void SetByteSize(liblas::LASHeader::PointSize& size) const = 0;
+
+ liblas::uint8_t GetVersionMajor() { return m_versionmajor; }
+ void SetVersionMajor(liblas::uint8_t v) {m_versionmajor = v; }
+
+ liblas::uint8_t GetVersionMinor() { return m_versionminor; }
+ void SetVersionMinor(liblas::uint8_t v) {m_versionminor = v; }
+
+ bool IsCompressed() { return m_compressed; }
+ void SetCompressed(bool v) {m_compressed = v;}
+
+ virtual bool HasColor() const = 0;
+ virtual bool HasTime() const = 0;
+
+
+protected:
+
+ liblas::LASHeader::PointSize m_size;
+ uint8_t m_versionminor;
+ uint8_t m_versionmajor;
+ bool m_compressed;
+
+private:
+
+ // Blocked copying operations, declared but not defined.
+ Format(Format const& other);
+ Format& operator=(Format const& rhs);
+
+
+};
+
+class PointFormat : public Format
+{
+public:
+
+ typedef Format Base;
+
+ PointFormat(liblas::uint8_t major, liblas::uint8_t minor, liblas::LASHeader::PointSize& size);
+ bool HasColor() { return m_hasColor; }
+ bool HasTime() { return m_hasTime; }
+ bool IsCompressed() { return false; }
+
+private:
+
+ bool m_hasColor;
+ bool m_hasTime;
+};
+
+}} // namespace liblas::detail
+
+#endif // LIBLAS_DETAIL_FORMAT_HPP_INCLUDED
diff -r 4021e1c06b5f -r b9d6c3ed8f42 include/liblas/lasheader.hpp
--- a/include/liblas/lasheader.hpp Fri Jan 15 23:56:55 2010 -0500
+++ b/include/liblas/lasheader.hpp Mon Jan 18 13:24:49 2010 -0600
@@ -92,7 +92,8 @@
ePointSize0 = 20, ///< Size of point record in data format \e 0
ePointSize1 = 28, ///< Size of point record in data format \e 1
ePointSize2 = 26, ///< Size of point record in data format \e 2
- ePointSize3 = 34 ///< Size of point record in data format \e 3
+ ePointSize3 = 34, ///< Size of point record in data format \e 3
+ ePointSizeUnknown = -99
};
/// Official signature of ASPRS LAS file format, always \b "LASF".
diff -r 4021e1c06b5f -r b9d6c3ed8f42 src/Makefile.am
--- a/src/Makefile.am Fri Jan 15 23:56:55 2010 -0500
+++ b/src/Makefile.am Mon Jan 18 13:24:49 2010 -0600
@@ -37,6 +37,7 @@
lasfile.cpp \
las_c_api.cpp \
lasspatialreference.cpp \
+ detail/format.cpp \
detail/reader.cpp \
detail/reader10.cpp \
detail/reader11.cpp \
diff -r 4021e1c06b5f -r b9d6c3ed8f42 src/detail/format.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/detail/format.cpp Mon Jan 18 13:24:49 2010 -0600
@@ -0,0 +1,91 @@
+/******************************************************************************
+ * $Id$
+ *
+ * Project: libLAS - http://liblas.org - A BSD library for LAS format data.
+ * Purpose: LAS 1.0 writer implementation for C++ libLAS
+ * Author: Mateusz Loskot, mateusz at loskot.net
+ *
+ ******************************************************************************
+ * Copyright (c) 2008, Mateusz Loskot
+ *
+ * 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 the Martin Isenburg or Iowa Department
+ * of Natural Resources 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.
+ ****************************************************************************/
+
+#include <liblas/detail/format.hpp>
+#include <liblas/detail/utility.hpp>
+#include <liblas/lasheader.hpp>
+#include <liblas/laspoint.hpp>
+#include <liblas/liblas.hpp>
+// std
+#include <vector>
+#include <fstream>
+#include <stdexcept>
+#include <cstdlib> // std::size_t
+#include <cassert>
+
+namespace liblas { namespace detail {
+
+Format::Format( liblas::uint8_t major,
+ liblas::uint8_t minor,
+ liblas::LASHeader::PointSize& size) :
+ m_size(size),
+ m_versionminor(minor),
+ m_versionmajor(major),
+ m_compressed(false)
+{
+
+}
+
+PointFormat::PointFormat( liblas::uint8_t major,
+ liblas::uint8_t minor,
+ liblas::LASHeader::PointSize& size) :
+ Base(major, minor, size),
+ m_hasColor(false),
+ m_hasTime(false)
+{
+ // PointFormat is assumed to be used for the standard point formats
+ // that are specified in the specification. They have standard byte
+ // sizes of the following:
+ // ePointSize0 = 20 -> point data format 0
+ // ePointSize1 = 28 -> point data format 1
+ // ePointSize2 = 26 -> point data format 2
+ // ePointSize3 = 34 -> point data format 3
+
+ // If the size we were given is not one of these values, we are not
+ // going to be able to determine automatically whether or not the record
+ // has color or time values.
+
+ if (size == LASHeader::ePointSize0) {
+
+ }
+}
+
+}} // namespace liblas::detail
More information about the Liblas-commits
mailing list