[Liblas-commits] hg: 3 new changesets

liblas-commits at liblas.org liblas-commits at liblas.org
Wed Dec 30 17:31:24 EST 2009


changeset 4dc4b97808ab in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=4dc4b97808ab
summary: Moved LAS file version constants to new file lasversion.hpp

changeset e3358569b174 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=e3358569b174
summary: Added int to uint8_t cast in apps/lascommon.c

changeset 0e4ee1b86c86 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=0e4ee1b86c86
summary: Changed return type of GetVersion methods in readers and writers from std::size_t to LASVersion

diffstat:

 apps/lascommon.c                   |   4 +-
 include/liblas/detail/reader.hpp   |   3 +-
 include/liblas/detail/reader10.hpp |   2 +-
 include/liblas/detail/reader11.hpp |   2 +-
 include/liblas/detail/reader12.hpp |   2 +-
 include/liblas/detail/writer.hpp   |   3 +-
 include/liblas/detail/writer10.hpp |   3 +-
 include/liblas/detail/writer11.hpp |   3 +-
 include/liblas/detail/writer12.hpp |   2 +-
 include/liblas/lasreader.hpp       |   3 +-
 include/liblas/lasversion.hpp      |  63 ++++++++++++++++++++++++++++++++++++++
 include/liblas/laswriter.hpp       |   3 +-
 include/liblas/liblas.hpp          |  11 ------
 src/detail/reader10.cpp            |   2 +-
 src/detail/reader11.cpp            |   2 +-
 src/detail/reader12.cpp            |   2 +-
 src/detail/writer10.cpp            |   2 +-
 src/detail/writer11.cpp            |   3 +-
 src/detail/writer12.cpp            |   3 +-
 src/lasreader.cpp                  |   3 +-
 src/laswriter.cpp                  |   3 +-
 21 files changed, 93 insertions(+), 31 deletions(-)

diffs (truncated from 405 to 300 lines):

diff -r 24ee96f79a09 -r 0e4ee1b86c86 apps/lascommon.c
--- a/apps/lascommon.c	Wed Dec 30 21:21:29 2009 +0000
+++ b/apps/lascommon.c	Wed Dec 30 22:31:00 2009 +0000
@@ -366,7 +366,7 @@
     fprintf(file, "\n Total Pulses: %ld\n", rgpsum); 
 
     for (i = 0; i < 5; i++) {
-        if (LASHeader_GetPointRecordsByReturnCount(header, i) != summary->number_of_points_by_return[i]) 
+        if (LASHeader_GetPointRecordsByReturnCount(header, i) != (uint32_t)summary->number_of_points_by_return[i]) 
         {
             fprintf(file, " \n Actual number of points by return \n is different from header (actual, header):\n"); 
             for (i = 0; i < 5; i++) {
@@ -629,7 +629,7 @@
     for (i = 0; i < 5; i++) {
 
         if (LASHeader_GetPointRecordsByReturnCount(header, i) != 
-            summary->number_of_points_by_return[i]) 
+            (uint8_t)summary->number_of_points_by_return[i]) 
         {
             update_return_counts = TRUE;
             break;
diff -r 24ee96f79a09 -r 0e4ee1b86c86 include/liblas/detail/reader.hpp
--- a/include/liblas/detail/reader.hpp	Wed Dec 30 21:21:29 2009 +0000
+++ b/include/liblas/detail/reader.hpp	Wed Dec 30 22:31:00 2009 +0000
@@ -43,6 +43,7 @@
 #define LIBLAS_DETAIL_READER_HPP_INCLUDED
 
 #include <liblas/cstdint.hpp>
+#include <liblas/lasversion.hpp>
 #include <liblas/lasspatialreference.hpp>
 #include <liblas/detail/fwd.hpp>
 
@@ -64,7 +65,7 @@
 
     Reader(std::istream& ifs);
     virtual ~Reader();
-    virtual std::size_t GetVersion() const = 0;
+    virtual LASVersion GetVersion() const = 0;
     virtual bool ReadHeader(LASHeader& header) = 0;
     virtual bool ReadNextPoint(LASPoint& point, const LASHeader& header) = 0;
     virtual bool ReadPointAt(std::size_t n, LASPoint& point, const LASHeader& header) = 0;
diff -r 24ee96f79a09 -r 0e4ee1b86c86 include/liblas/detail/reader10.hpp
--- a/include/liblas/detail/reader10.hpp	Wed Dec 30 21:21:29 2009 +0000
+++ b/include/liblas/detail/reader10.hpp	Wed Dec 30 22:31:00 2009 +0000
@@ -56,7 +56,7 @@
     typedef Reader Base;
     
     ReaderImpl(std::istream& ifs);
-    std::size_t GetVersion() const;
+    LASVersion GetVersion() const;
     bool ReadHeader(LASHeader& header);
     bool ReadNextPoint(LASPoint& point, const LASHeader& header);
     bool ReadPointAt(std::size_t n, LASPoint& record, const LASHeader& header);
diff -r 24ee96f79a09 -r 0e4ee1b86c86 include/liblas/detail/reader11.hpp
--- a/include/liblas/detail/reader11.hpp	Wed Dec 30 21:21:29 2009 +0000
+++ b/include/liblas/detail/reader11.hpp	Wed Dec 30 22:31:00 2009 +0000
@@ -56,7 +56,7 @@
     typedef Reader Base;
     
     ReaderImpl(std::istream& ifs);
-    std::size_t GetVersion() const;
+    LASVersion GetVersion() const;
     bool ReadHeader(LASHeader& header);
     bool ReadNextPoint(LASPoint& point, const LASHeader& header);
     bool ReadPointAt(std::size_t n, LASPoint& record, const LASHeader& header);
diff -r 24ee96f79a09 -r 0e4ee1b86c86 include/liblas/detail/reader12.hpp
--- a/include/liblas/detail/reader12.hpp	Wed Dec 30 21:21:29 2009 +0000
+++ b/include/liblas/detail/reader12.hpp	Wed Dec 30 22:31:00 2009 +0000
@@ -56,7 +56,7 @@
     typedef Reader Base;
     
     ReaderImpl(std::istream& ifs);
-    std::size_t GetVersion() const;
+    LASVersion GetVersion() const;
     bool ReadHeader(LASHeader& header);
     bool ReadNextPoint(LASPoint& point, LASHeader const& header);
     bool ReadPointAt(std::size_t n, LASPoint& record, LASHeader const& header);
diff -r 24ee96f79a09 -r 0e4ee1b86c86 include/liblas/detail/writer.hpp
--- a/include/liblas/detail/writer.hpp	Wed Dec 30 21:21:29 2009 +0000
+++ b/include/liblas/detail/writer.hpp	Wed Dec 30 22:31:00 2009 +0000
@@ -42,6 +42,7 @@
 #ifndef LIBLAS_DETAIL_WRITER_HPP_INCLUDED
 #define LIBLAS_DETAIL_WRITER_HPP_INCLUDED
 
+#include <liblas/lasversion.hpp>
 #include <liblas/lasspatialreference.hpp>
 #include <liblas/detail/fwd.hpp>
 #include <liblas/detail/utility.hpp>
@@ -62,7 +63,7 @@
 
     Writer(std::ostream& ofs);
     virtual ~Writer();
-    virtual std::size_t GetVersion() const = 0;
+    virtual LASVersion GetVersion() const = 0;
     virtual void WriteHeader(LASHeader& header) = 0;
     virtual void UpdateHeader(LASHeader const& header) = 0;
     virtual void WritePointRecord(LASPoint const& point, const LASHeader& header) = 0;
diff -r 24ee96f79a09 -r 0e4ee1b86c86 include/liblas/detail/writer10.hpp
--- a/include/liblas/detail/writer10.hpp	Wed Dec 30 21:21:29 2009 +0000
+++ b/include/liblas/detail/writer10.hpp	Wed Dec 30 22:31:00 2009 +0000
@@ -42,6 +42,7 @@
 #ifndef LIBLAS_DETAIL_WRITER10_HPP_INCLUDED
 #define LIBLAS_DETAIL_WRITER10_HPP_INCLUDED
 
+#include <liblas/lasversion.hpp>
 #include <liblas/detail/writer.hpp>
 #include <liblas/detail/fwd.hpp>
 #include <liblas/cstdint.hpp>
@@ -57,7 +58,7 @@
     typedef Writer Base;
     
     WriterImpl(std::ostream& ofs);
-    std::size_t GetVersion() const;
+    LASVersion GetVersion() const;
     void WriteHeader(LASHeader& header);
     void UpdateHeader(LASHeader const& header);
     void WritePointRecord(LASPoint const& record, const LASHeader& header);
diff -r 24ee96f79a09 -r 0e4ee1b86c86 include/liblas/detail/writer11.hpp
--- a/include/liblas/detail/writer11.hpp	Wed Dec 30 21:21:29 2009 +0000
+++ b/include/liblas/detail/writer11.hpp	Wed Dec 30 22:31:00 2009 +0000
@@ -42,6 +42,7 @@
 #ifndef LIBLAS_DETAIL_WRITER11_HPP_INCLUDED
 #define LIBLAS_DETAIL_WRITER11_HPP_INCLUDED
 
+#include <liblas/lasversion.hpp>
 #include <liblas/detail/writer.hpp>
 #include <liblas/detail/fwd.hpp>
 #include <liblas/cstdint.hpp>
@@ -57,7 +58,7 @@
     typedef Writer Base;
     
     WriterImpl(std::ostream& ofs);
-    std::size_t GetVersion() const;
+    LASVersion GetVersion() const;
     void WriteHeader(LASHeader& header);
     void UpdateHeader(LASHeader const& header);
     void WritePointRecord(LASPoint const& record, const LASHeader& header);
diff -r 24ee96f79a09 -r 0e4ee1b86c86 include/liblas/detail/writer12.hpp
--- a/include/liblas/detail/writer12.hpp	Wed Dec 30 21:21:29 2009 +0000
+++ b/include/liblas/detail/writer12.hpp	Wed Dec 30 22:31:00 2009 +0000
@@ -57,7 +57,7 @@
     typedef Writer Base;
     
     WriterImpl(std::ostream& ofs);
-    std::size_t GetVersion() const;
+    LASVersion GetVersion() const;
     void WriteHeader(LASHeader& header);
     void UpdateHeader(LASHeader const& header);
     void WritePointRecord(LASPoint const& record, LASHeader const& header);
diff -r 24ee96f79a09 -r 0e4ee1b86c86 include/liblas/lasreader.hpp
--- a/include/liblas/lasreader.hpp	Wed Dec 30 21:21:29 2009 +0000
+++ b/include/liblas/lasreader.hpp	Wed Dec 30 22:31:00 2009 +0000
@@ -43,6 +43,7 @@
 #ifndef LIBLAS_LASREADER_HPP_INCLUDED
 #define LIBLAS_LASREADER_HPP_INCLUDED
 
+#include <liblas/lasversion.hpp>
 #include <liblas/lasheader.hpp>
 #include <liblas/laspoint.hpp>
 #include <liblas/lasvariablerecord.hpp>
@@ -78,7 +79,7 @@
 
     /// Returns version of LAS file being accessed by the reader.
     /// @excepion nothrow
-    std::size_t GetVersion() const;
+    LASVersion GetVersion() const;
     
     /// Provides read-only access to header of LAS file being read.
     /// @excepion nothrow
diff -r 24ee96f79a09 -r 0e4ee1b86c86 include/liblas/lasversion.hpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/liblas/lasversion.hpp	Wed Dec 30 22:31:00 2009 +0000
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * $Id$
+ *
+ * Project:  libLAS - http://liblas.org - A BSD library for LAS format data.
+ * Purpose:  Definition of LAS version constants
+ * 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_LASVERSION_HPP_INCLUDED
+#define LIBLAS_LASVERSION_HPP_INCLUDED
+
+namespace liblas
+{
+
+/// Version numbers of the ASPRS LAS Specification.
+/// Numerical representation of versions is calculated according to 
+/// following formula: <em>major * 100000 + minor</em>
+enum LASVersion
+{
+    eLASVersion10 = 1 * 100000 + 0, ///< LAS Format 1.0
+    eLASVersion11 = 1 * 100000 + 1, ///< LAS Format 1.1
+    eLASVersion12 = 1 * 100000 + 2, ///< LAS Format 1.2
+    eLASVersion20 = 2 * 100000 + 0  ///< LAS Format 2.0
+};
+
+// TODO: LAS Point Format version --mloskot
+
+} // namespace liblas
+
+#endif // LIBLAS_LASVERSION_HPP_INCLUDED
diff -r 24ee96f79a09 -r 0e4ee1b86c86 include/liblas/laswriter.hpp
--- a/include/liblas/laswriter.hpp	Wed Dec 30 21:21:29 2009 +0000
+++ b/include/liblas/laswriter.hpp	Wed Dec 30 22:31:00 2009 +0000
@@ -42,6 +42,7 @@
 #ifndef LIBLAS_LASWRITER_HPP_INCLUDED
 #define LIBLAS_LASWRITER_HPP_INCLUDED
 
+#include <liblas/lasversion.hpp>
 #include <liblas/lasheader.hpp>
 #include <liblas/laspoint.hpp>
 #include <liblas/detail/fwd.hpp>
@@ -62,7 +63,7 @@
     LASWriter(std::ostream& ofs, LASHeader const& header);
     ~LASWriter();
     
-    std::size_t GetVersion() const;
+    LASVersion GetVersion() const;
     LASHeader const& GetHeader() const;
 
     /// \todo TODO: Move point record composition deep into writer implementation.
diff -r 24ee96f79a09 -r 0e4ee1b86c86 include/liblas/liblas.hpp
--- a/include/liblas/liblas.hpp	Wed Dec 30 21:21:29 2009 +0000
+++ b/include/liblas/liblas.hpp	Wed Dec 30 22:31:00 2009 +0000
@@ -59,17 +59,6 @@
 namespace liblas
 {
 
-/// Version numbers of the ASPRS LAS Specification.
-/// Numerical representation of versions is calculated according to 
-/// following formula: <em>major * 100000 + minor</em>
-enum LASFileVersion
-{
-    eLASVersion10 = 1 * 100000 + 0, ///< LAS Format 1.0
-    eLASVersion11 = 1 * 100000 + 1, ///< LAS Format 1.1
-    eLASVersion12 = 1 * 100000 + 2, ///< LAS Format 1.2
-    eLASVersion20 = 2 * 100000 + 0  ///< LAS Format 2.0
-};
-
 /// Open file to read in binary mode.
 /// The input file is also attached to input stream.
 /// \param ifs - reference to input file stream to
diff -r 24ee96f79a09 -r 0e4ee1b86c86 src/detail/reader10.cpp
--- a/src/detail/reader10.cpp	Wed Dec 30 21:21:29 2009 +0000
+++ b/src/detail/reader10.cpp	Wed Dec 30 22:31:00 2009 +0000
@@ -61,7 +61,7 @@
 {
 }
 
-std::size_t ReaderImpl::GetVersion() const
+LASVersion ReaderImpl::GetVersion() const
 {
     return eLASVersion10;
 }
diff -r 24ee96f79a09 -r 0e4ee1b86c86 src/detail/reader11.cpp
--- a/src/detail/reader11.cpp	Wed Dec 30 21:21:29 2009 +0000
+++ b/src/detail/reader11.cpp	Wed Dec 30 22:31:00 2009 +0000
@@ -59,7 +59,7 @@
 {
 }
 
-std::size_t ReaderImpl::GetVersion() const
+LASVersion ReaderImpl::GetVersion() const
 {
     return eLASVersion11;


More information about the Liblas-commits mailing list