[Liblas-commits] laszip: fixed for windows

liblas-commits at liblas.org liblas-commits at liblas.org
Sun Jan 30 08:15:07 EST 2011


details:   http://hg.liblas.orglaszip/rev/322077dc0b65
changeset: 163:322077dc0b65
user:      isenburg
date:      Sun Jan 30 05:14:53 2011 -0800
description:
fixed for windows

diffstat:

 tools/laszippertest.cpp |  697 ++++++++++++++++++++++-------------------------
 1 files changed, 329 insertions(+), 368 deletions(-)

diffs (truncated from 867 to 300 lines):

diff -r 2b5efddcdb54 -r 322077dc0b65 tools/laszippertest.cpp
--- a/tools/laszippertest.cpp	Sat Jan 29 20:18:26 2011 -0600
+++ b/tools/laszippertest.cpp	Sun Jan 30 05:14:53 2011 -0800
@@ -1,46 +1,28 @@
-/******************************************************************************
- *
- * Project:  integrating laszip into liblas - http://liblas.org -
- * Purpose:
- * Author:   Martin Isenburg
- *           isenburg at cs.unc.edu
- *
- ******************************************************************************
- * Copyright (c) 2010, Martin Isenburg
- *
- * This is free software; you can redistribute and/or modify it under
- * the terms of the GNU Lesser General Licence as published
- * by the Free Software Foundation.
- *
- * See the COPYING file for more information.
- *
- ****************************************************************************/
-
 /*
 ===============================================================================
 
-  FILE:  laszippertest.cpp
+  FILE    laszippertest.cpp
   
-  CONTENTS:
+  CONTENTS  
   
-    This tool reads and writes point data in the LAS 1.X format compressed
-    or uncompressed to test the laszipper and lasunzipper interfaces.
+  This tool reads and writes point data in the LAS 1.X format compressed
+  or uncompressed to test the laszipper and lasunzipper interfaces.
 
-  PROGRAMMERS:
+  PROGRAMMERS  
   
-    martin isenburg at cs.unc.edu
+  martin isenburg at cs.unc.edu
   
-  COPYRIGHT:
+  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.
+  copyright (C) 2010 martin isenburg at cs.unc.edu
   
-  CHANGE HISTORY:
+  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.
   
-    13 December 2010 -- created to test the remodularized laszip compressor
+  CHANGE HISTORY  
+  
+  13 December 2010 -- created to test the remodularized laszip compressor
   
 ===============================================================================
 */
@@ -58,11 +40,10 @@
 
 #include <time.h>
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #include <stdarg.h>
 
-//#define LASZIP_HAVE_RANGECODER
-
-
 //---------------------------------------------------------------------------
 
 static double taketime()
@@ -70,182 +51,180 @@
   return (double)(clock())/CLOCKS_PER_SEC;
 }
 
-
 //---------------------------------------------------------------------------
 // abstractions for doing I/O, which support VC6 streams, modern streams, and FILE*
 
-struct OStream
+class OStream
 {
 public:
-    OStream(bool use_iostream, const char* filename) :
-      m_use_iostream(use_iostream),
-      m_filename(filename),
-      ofile(NULL),
-      ostream(NULL)
+  OStream(bool use_iostream, const char* filename) :
+    m_use_iostream(use_iostream),
+    m_filename(filename),
+    ofile(NULL),
+    streamo(NULL)
+  {
+    if (m_use_iostream)
     {
-        if (m_use_iostream)
-        {
 #ifdef LZ_WIN32_VC6 
-            ofb.open(filename, ios::out);
-            ofb.setmode(filebuf::binary);
-            ostream = new ostream(&ofb);
+      ofb.open(filename, ios::out);
+      ofb.setmode(filebuf::binary);
+      streamo = new ostream(&ofb);
 #else
-            ostream = new ofstream();
-            ostream->open(filename, std::ios::out | std::ios::binary );
+      streamo = new ofstream();
+      streamo->open(filename, std::ios::out | std::ios::binary );
 #endif 
-        }
-        else
-        {
-            ofile = fopen(filename, "wb");
-        }
+    }
+    else
+    {
+      ofile = fopen(filename, "wb");
+    }
+  };
 
-        return;
+  ~OStream()
+  {
+    if (m_use_iostream)
+    {
+      delete streamo;
+#ifdef LZ_WIN32_VC6 
+      ofb.close();
+#endif
     }
+    else
+    {
+      if (ofile)
+        fclose(ofile);
+    }
+  };
 
-      ~OStream()
-      {
-          if (m_use_iostream)
-          {
-              delete ostream;
+  bool m_use_iostream;
+  const char* m_filename;
+  FILE* ofile;
+  filebuf ofb;
 #ifdef LZ_WIN32_VC6 
-              ofb.close();
-#endif
-          }
-          else
-          {
-              if (ofile)
-                  fclose(ofile);
-          }
-      }
-
-public:
-    bool m_use_iostream;
-    const char* m_filename;
-    FILE* ofile;
-    filebuf ofb;
-#ifdef LZ_WIN32_VC6 
-    ostream* ostream;
+  ostream* streamo;
 #else
-    ofstream* ostream;
+  ofstream* streamo;
 #endif
 };
 
-
 //---------------------------------------------------------------------------
 
 struct IStream
 {
 public:
-    IStream(bool use_iostream, const char* filename) :
-      m_use_iostream(use_iostream),
-      m_filename(filename),
-      ifile(NULL),
-      istream(NULL)
+  IStream(bool use_iostream, const char* filename) :
+    m_use_iostream(use_iostream),
+    m_filename(filename),
+    ifile(NULL),
+    streami(NULL)
+  {
+    if (m_use_iostream)
     {
-        if (m_use_iostream)
-        {
 #ifdef LZ_WIN32_VC6 
-            ifb.open(filename, ios::in);
-            ifb.setmode(filebuf::binary);
-            istream = new istream(&ifb);
+      ifb.open(filename, ios::in);
+      ifb.setmode(filebuf::binary);
+      streami = new istream(&ifb);
 #else
-            istream = new ifstream();
-            istream->open(filename, std::ios::in | std::ios::binary );
+      streami = new ifstream();
+      streami->open(filename, std::ios::in | std::ios::binary);
 #endif 
-        }
-        else
-        {
-            ifile = fopen(filename, "rb");
-        }
-      }
+    }
+    else
+    {
+      ifile = fopen(filename, "rb");
+    }
+  };
 
-      ~IStream()
-      {
-          if (m_use_iostream)
-          {
-              delete istream;
+  ~IStream()
+  {
+    if (m_use_iostream)
+    {
+      delete streami;
 #ifdef LZ_WIN32_VC6 
-              ifb.close();
+      ifb.close();
 #endif
-          }
-          else
-          {
-              if (ifile)
-                  fclose(ifile);
-          }
-      }
+    }
+    else
+    {
+      if (ifile)
+        fclose(ifile);
+    }
+  };
 
-public:
-    const char* m_filename;
-    bool m_use_iostream;
-    FILE* ifile;
-    filebuf ifb;
+  const char* m_filename;
+  bool m_use_iostream;
+  FILE* ifile;
+  filebuf ifb;
 #ifdef LZ_WIN32_VC6 
-    istream* istream;
+  istream* streami;
 #else
-    ifstream* istream;
+  ifstream* streami;
 #endif
 };
 
 
 //---------------------------------------------------------------------------
 
+#define NUM_ITEMS 5
+
 class PointData
 {
 public:
-    PointData()
+  PointData()
+  {
+    num_items = NUM_ITEMS;
+
+    items[0].type = LASitem::POINT10;
+    items[0].size = 20;
+    items[0].version = 0;
+
+    items[1].type = LASitem::GPSTIME11;
+    items[1].size = 8;
+    items[1].version = 0;
+
+    items[2].type = LASitem::RGB12;
+    items[2].size = 6;
+    items[2].version = 0;
+


More information about the Liblas-commits mailing list