[Liblas-commits] laszip: 3 new changesets

liblas-commits at liblas.org liblas-commits at liblas.org
Wed Dec 22 15:51:35 EST 2010


changeset 3e5e0ec93ea6 in /Volumes/Data/www/liblas.org/laszip
details: http://hg.liblas.orglaszip?cmd=changeset;node=3e5e0ec93ea6
summary: pass streams by ref, not as pointers; return status code on open, not bool; declare items parameter as an array

changeset e651d0722c7e in /Volumes/Data/www/liblas.org/laszip
details: http://hg.liblas.orglaszip?cmd=changeset;node=e651d0722c7e
summary: pull-merge

changeset e8f5528c3d30 in /Volumes/Data/www/liblas.org/laszip
details: http://hg.liblas.orglaszip?cmd=changeset;node=e8f5528c3d30
summary: sync w/ Martin's changes

diffstat:

 include/laszip/lasunzipper.hpp    |   89 ++++++++++----------
 include/laszip/laszip.hpp         |  164 +++++++++++++++++++++++++++----------
 include/laszip/laszipper.hpp      |   92 ++++++++++----------
 src/bytestreamin_istream.hpp      |   28 +++---
 src/bytestreamout_ostream.hpp     |   44 +++++-----
 src/lasreaditem.hpp               |    2 +-
 src/lasreaditemcompressed_v1.cpp  |  102 +++++++++++++++++++----
 src/lasreaditemcompressed_v1.hpp  |   43 +++++++--
 src/lasreaditemraw.hpp            |   25 ++++-
 src/lasreadpoint.cpp              |   30 +++---
 src/lasreadpoint.hpp              |    2 +-
 src/lasunzipper.cpp               |   28 +++---
 src/laswriteitem.hpp              |    4 +-
 src/laswriteitemcompressed_v1.cpp |  109 ++++++++++++++++++++----
 src/laswriteitemcompressed_v1.hpp |   51 ++++++++---
 src/laswriteitemraw.hpp           |   33 +++++-
 src/laswritepoint.cpp             |   35 +++++---
 src/laswritepoint.hpp             |    2 +-
 src/laszipper.cpp                 |   33 ++++---
 src/rangedecoder.cpp              |    2 +-
 src/rangeencoder.cpp              |    2 +-
 tools/laszippertest.cpp           |   28 +++---
 22 files changed, 626 insertions(+), 322 deletions(-)

diffs (truncated from 1888 to 300 lines):

diff -r b095ef93a1f2 -r e8f5528c3d30 include/laszip/lasunzipper.hpp
--- a/include/laszip/lasunzipper.hpp	Sat Dec 18 12:29:58 2010 -0800
+++ b/include/laszip/lasunzipper.hpp	Wed Dec 22 11:25:03 2010 -0800
@@ -16,36 +16,36 @@
  *
  ****************************************************************************/
 
-/*
-===============================================================================
-
-  FILE:  LASunzipper.hpp
-  
-  CONTENTS:
-  
-    Reads (optionally compressed) LIDAR points to LAS formats 1.0 - 1.3
-
-  PROGRAMMERS:
-  
-    martin isenburg at cs.unc.edu
-  
-  COPYRIGHT:
-  
-    copyright (C) 2010  martin isenburg at cs.unc.edu
-    
-    This software is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  
-  CHANGE HISTORY:
-  
+/*
+===============================================================================
+
+  FILE:  LASunzipper.hpp
+  
+  CONTENTS:
+  
+    Reads (optionally compressed) LIDAR points to LAS formats 1.0 - 1.3
+
+  PROGRAMMERS:
+  
+    martin isenburg at cs.unc.edu
+  
+  COPYRIGHT:
+  
+    copyright (C) 2010  martin isenburg at cs.unc.edu
+    
+    This software is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  
+  CHANGE HISTORY:
+  
     12 December 2010 -- created from LASwriter/LASreader after Howard got pushy (-;
-  
-===============================================================================
-*/
-#ifndef LAS_UNZIPPER_H
-#define LAS_UNZIPPER_H
-
+  
+===============================================================================
+*/
+#ifndef LAS_UNZIPPER_H
+#define LAS_UNZIPPER_H
+
 #include <stdio.h>
 
 #include "laszip.hpp"
@@ -57,26 +57,25 @@
 #include <fstream>
 using namespace std;
 #endif
-
+
 class ByteStreamIn;
 class LASreadPoint;
 
-class LASunzipper
-{
-public:
-
-  bool open(FILE* file, unsigned int num_items, const LASitem* items, unsigned int compression=0);
-  bool open(istream* stream, unsigned int num_items, const LASitem* items, unsigned int compression=0);
-  bool read(unsigned char** point);
+class LASunzipper
+{
+public:
+  unsigned int open(FILE* file, unsigned int num_items, const LASitem items[], unsigned int compression=0);
+  unsigned int open(istream& stream, unsigned int num_items, const LASitem items[], unsigned int compression=0);
+  bool read(unsigned char * const * point);
   unsigned int close();
-
-  LASunzipper();
-  ~LASunzipper();
-
+
+  LASunzipper();
+  ~LASunzipper();
+
 private:
-  int count;
+  int count;
   ByteStreamIn* stream;
   LASreadPoint* reader;
-};
-
-#endif
+};
+
+#endif
diff -r b095ef93a1f2 -r e8f5528c3d30 include/laszip/laszip.hpp
--- a/include/laszip/laszip.hpp	Sat Dec 18 12:29:58 2010 -0800
+++ b/include/laszip/laszip.hpp	Wed Dec 22 11:25:03 2010 -0800
@@ -49,54 +49,88 @@
 
 #if defined(_MSC_VER) && (_MSC_VER < 1300)
 #define LZ_WIN32_VC6
+typedef __int64   SIGNED_INT64;
+#else
+typedef long long SIGNED_INT64;
 #endif
 
 #define LASZIP_VERSION_MAJOR    1
 #define LASZIP_VERSION_MINOR    0
 #define LASZIP_VERSION_REVISION 0
 
-#define LASZIP_COMPRESSION_NONE 0
-#define LASZIP_COMPRESSION_RANGE 1
-#define LASZIP_COMPRESSION_ARITHMETIC 2
+#define LASZIP_COMPRESSION_NONE       0
+#define LASZIP_COMPRESSION_ARITHMETIC 1
+#define LASZIP_COMPRESSION_RANGE      2
+
+#define LASZIP_COMPRESSION_DEFAULT    1
 
 class LASitem
 {
 public:
 
-  enum Type { BYTE = 0, SHORT, INT, LONG, FLOAT, DOUBLE, POINT10, GPSTIME, RGB, WAVEPACKET } type;
+  enum Type { BYTE = 0, SHORT, INT, LONG, FLOAT, DOUBLE, POINT10, GPSTIME11, RGB12, WAVEPACKET13 } type;
   unsigned short size;
   unsigned short version;
 
-  // convenience function (not done as a ctor, since these items are usually allocated as an array)
-  void set(LASitem::Type type)
+  void set(LASitem::Type t, unsigned int number=1)
   {
-      LASitem& x = *this;
-      switch (type)
-      {
-      case LASitem::POINT10:
-          x.type = LASitem::POINT10;
-          x.size = 20;
-          x.version = 0;
-          break;
-      case LASitem::GPSTIME:
-          x.type = LASitem::GPSTIME;
-          x.size = 8;
-          x.version = 0;
-          break;
-      case LASitem::RGB:
-          x.type = LASitem::RGB;
-          x.size = 6;
-          x.version = 0;
-          break;
-      case LASitem::WAVEPACKET:
-          x.type = LASitem::WAVEPACKET;
-          x.size = 29;
-          x.version = 0;
-          break;
-      default:
-          throw 0; // BUG
-      }
-      return;
+    switch (t)
+    {
+    case LASitem::POINT10:
+        type = LASitem::POINT10;
+        size = 20;
+        version = 0;
+        break;
+    case LASitem::GPSTIME11:
+        type = LASitem::GPSTIME11;
+        size = 8;
+        version = 0;
+        break;
+    case LASitem::RGB12:
+        type = LASitem::RGB12;
+        size = 6;
+        version = 0;
+        break;
+    case LASitem::WAVEPACKET13:
+        type = LASitem::WAVEPACKET13;
+        size = 29;
+        version = 0;
+        break;
+    case LASitem::BYTE:
+        type = LASitem::BYTE;
+        size = number;
+        version = 0;
+        break;
+    default:
+        throw 0; // BUG
+    }
+    return;
+  }
+
+  bool is_type(LASitem::Type t) const
+  {
+    if (t != type) return false;
+    switch (t)
+    {
+    case POINT10:
+      if (size != 20) return false;
+      break;
+    case GPSTIME11:
+      if (size != 8) return false;
+      break;
+    case RGB12:
+      if (size != 6) return false;
+      break;
+    case WAVEPACKET13:
+      if (size != 29) return false;
+      break;
+    case BYTE:
+      if (size < 1) return false;
+      break;
+    default:
+      return false;
+    }
+    return true;
   }
 
   bool supported_type() const
@@ -104,12 +138,14 @@
     switch (type)
     {
     case POINT10:
-    case GPSTIME:
-    case RGB:
-    case WAVEPACKET:
+    case GPSTIME11:
+    case RGB12:
+    case WAVEPACKET13:
     case BYTE:
       return true;
       break;
+    default:
+      return false;
     }
     return false;
   }
@@ -121,13 +157,13 @@
     case POINT10:
       if (size != 20) return false;
       break;
-    case GPSTIME:
+    case GPSTIME11:
       if (size != 8) return false;
       break;
-    case RGB:
+    case RGB12:
       if (size != 6) return false;
       break;
-    case WAVEPACKET:
+    case WAVEPACKET13:
       if (size != 29) return false;
       break;
     case BYTE:
@@ -146,13 +182,13 @@
     case POINT10:
       if (version > 1) return false;
       break;
-    case GPSTIME:
+    case GPSTIME11:
       if (version > 1) return false;
       break;
-    case RGB:
+    case RGB12:
       if (version > 1) return false;
       break;
-    case WAVEPACKET:
+    case WAVEPACKET13:
       if (version > 1) return false;
       break;
     case BYTE:
@@ -172,15 +208,15 @@
       if (size != 20) return false;
       if (version > 1) return false;
       break;
-    case GPSTIME:
+    case GPSTIME11:
       if (size != 8) return false;
       if (version > 1) return false;
       break;
-    case RGB:
+    case RGB12:
       if (size != 6) return false;


More information about the Liblas-commits mailing list