lasunzipper.hpp | lasunzipper.hpp | |||
---|---|---|---|---|
skipping to change at line 27 | skipping to change at line 27 | |||
This is free software; you can redistribute and/or modify it under the | 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 Softwa re | terms of the GNU Lesser General Licence as published by the Free Softwa re | |||
Foundation. See the COPYING file for more information. | Foundation. See the COPYING file for more information. | |||
This software is distributed WITHOUT ANY WARRANTY and without even the | This software is distributed WITHOUT ANY WARRANTY and without even the | |||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . | |||
CHANGE HISTORY: | CHANGE HISTORY: | |||
23 April 2011 -- changed interface for easier future compressor support | ||||
10 January 2011 -- licensing change for LGPL release and liblas integra tion | 10 January 2011 -- licensing change for LGPL release and liblas integra tion | |||
12 December 2010 -- created from LASwriter/LASreader after Howard got p ushy (-; | 12 December 2010 -- created from LASwriter/LASreader after Howard got p ushy (-; | |||
=========================================================================== ==== | =========================================================================== ==== | |||
*/ | */ | |||
#ifndef LAS_UNZIPPER_H | #ifndef LAS_UNZIPPER_HPP | |||
#define LAS_UNZIPPER_H | #define LAS_UNZIPPER_HPP | |||
#include <stdio.h> | #include <stdio.h> | |||
#include "laszip.hpp" | #include "laszip.hpp" | |||
#ifdef LZ_WIN32_VC6 | #ifdef LZ_WIN32_VC6 | |||
#include <fstream.h> | #include <fstream.h> | |||
#else | #else | |||
#include <istream> | #include <istream> | |||
#include <fstream> | #include <fstream> | |||
using namespace std; | using namespace std; | |||
#endif | #endif | |||
class ByteStreamIn; | class ByteStreamIn; | |||
class LASreadPoint; | class LASreadPoint; | |||
class LASZIP_DLL LASunzipper | class LASZIP_DLL LASunzipper | |||
{ | { | |||
public: | public: | |||
unsigned int open(FILE* file, unsigned int num_items, const LASitem items | bool open(FILE* file, const LASzip* laszip); | |||
[], LASzip::Algorithm algorithm); | bool open(istream& stream, const LASzip* laszip); | |||
unsigned int open(istream& stream, unsigned int num_items, const LASitem | ||||
items[], LASzip::Algorithm algorithm); | unsigned int tell() const; | |||
bool seek(const unsigned int position); | ||||
bool read(unsigned char * const * point); | bool read(unsigned char * const * point); | |||
unsigned int close(); | bool close(); | |||
LASunzipper(); | LASunzipper(); | |||
~LASunzipper(); | ~LASunzipper(); | |||
// in case a function returns false this string describes the problem | ||||
const char* get_error() const; | ||||
private: | private: | |||
int count; | unsigned int count; | |||
ByteStreamIn* stream; | ByteStreamIn* stream; | |||
LASreadPoint* reader; | LASreadPoint* reader; | |||
bool return_error(const char* err); | ||||
char* error_string; | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 7 change blocks. | ||||
8 lines changed or deleted | 15 lines changed or added | |||
laszip.hpp | laszip.hpp | |||
---|---|---|---|---|
skipping to change at line 17 | skipping to change at line 17 | |||
Contains LASitem and LASchunk structs as well as the IDs of the current ly | Contains LASitem and LASchunk structs as well as the IDs of the current ly | |||
supported entropy coding scheme | supported entropy coding scheme | |||
PROGRAMMERS: | PROGRAMMERS: | |||
martin.isenburg@gmail.com | martin.isenburg@gmail.com | |||
COPYRIGHT: | COPYRIGHT: | |||
(c) 2010-2011, Martin Isenburg, LASSO - tools to catch reality | (c) 2007-2011, Martin Isenburg, LASSO - tools to catch reality | |||
This is free software; you can redistribute and/or modify it under the | 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 Softwa re | terms of the GNU Lesser General Licence as published by the Free Softwa re | |||
Foundation. See the COPYING file for more information. | Foundation. See the COPYING file for more information. | |||
This software is distributed WITHOUT ANY WARRANTY and without even the | This software is distributed WITHOUT ANY WARRANTY and without even the | |||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . | |||
CHANGE HISTORY: | CHANGE HISTORY: | |||
20 March 2011 -- incrementing LASZIP_VERSION to 2.0 for improved compre | 23 June 2011 -- turned on LASzip version 2.0 compressor with chunking | |||
ssion | 8 May 2011 -- added an option for variable chunking via chunk() | |||
23 April 2011 -- changed interface for simplicity and chunking support | ||||
20 March 2011 -- incrementing LASZIP_VERSION to 1.2 for improved compre | ||||
ssion | ||||
10 January 2011 -- licensing change for LGPL release and liblas integra tion | 10 January 2011 -- licensing change for LGPL release and liblas integra tion | |||
12 December 2010 -- refactored from lasdefinitions after movies with si lke | 12 December 2010 -- refactored from lasdefinitions after movies with si lke | |||
=========================================================================== ==== | =========================================================================== ==== | |||
*/ | */ | |||
#ifndef LASZIP_HPP | #ifndef LASZIP_HPP | |||
#define LASZIP_HPP | #define LASZIP_HPP | |||
#if defined(_MSC_VER) && (_MSC_VER < 1300) | #if defined(_MSC_VER) && (_MSC_VER < 1300) | |||
#define LZ_WIN32_VC6 | #define LZ_WIN32_VC6 | |||
typedef __int64 SIGNED_INT64; | typedef __int64 SIGNED_INT64; | |||
#else | #else | |||
typedef long long SIGNED_INT64; | typedef long long SIGNED_INT64; | |||
#endif | #endif | |||
#define LASZIP_VERSION_MAJOR 1 | #define LASZIP_VERSION_MAJOR 2 | |||
#define LASZIP_VERSION_MINOR 2 | #define LASZIP_VERSION_MINOR 0 | |||
#define LASZIP_VERSION_REVISION 0 | #define LASZIP_VERSION_REVISION 0 | |||
#include "laszipexport.hpp" | #define LASZIP_COMPRESSOR_NONE 0 | |||
#define LASZIP_COMPRESSOR_POINTWISE 1 | ||||
#define LASZIP_COMPRESSOR_POINTWISE_CHUNKED 2 | ||||
#define LASZIP_COMPRESSOR_TOTAL_NUMBER_OF 3 | ||||
class LASZIP_DLL LASitem | #define LASZIP_COMPRESSOR_CHUNKED LASZIP_COMPRESSOR_POINTWISE_CHUNKED | |||
{ | #define LASZIP_COMPRESSOR_NOT_CHUNKED LASZIP_COMPRESSOR_POINTWISE | |||
public: | ||||
enum Type { BYTE = 0, SHORT, INT, LONG, FLOAT, DOUBLE, POINT10, GPSTIME11 | ||||
, RGB12, WAVEPACKET13 } type; | ||||
// number parameter only used when setting to BYTE | #define LASZIP_COMPRESSOR_DEFAULT LASZIP_COMPRESSOR_CHUNKED | |||
void set(LASitem::Type t, unsigned short number=1); | ||||
bool is_type(LASitem::Type t) const; | #define LASZIP_CODER_ARITHMETIC 0 | |||
bool supported_type() const; | #define LASZIP_CODER_TOTAL_NUMBER_OF 1 | |||
bool supported_size() const; | ||||
bool supported_version() const; | ||||
bool supported() const; | ||||
const char* get_name() const; | #define LASZIP_CHUNK_SIZE_DEFAULT 50000 | |||
#include "laszipexport.hpp" | ||||
class LASitem | ||||
{ | ||||
public: | public: | |||
enum Type { BYTE = 0, SHORT, INT, LONG, FLOAT, DOUBLE, POINT10, GPSTIME11 , RGB12, WAVEPACKET13 } type; | ||||
unsigned short size; | unsigned short size; | |||
unsigned short version; | unsigned short version; | |||
bool is_type(LASitem::Type t) const; | ||||
const char* get_name() const; | ||||
}; | }; | |||
class LASZIP_DLL LASzip | class LASZIP_DLL LASzip | |||
{ | { | |||
public: | public: | |||
enum Algorithm | // supported version control | |||
{ | bool check_compressor(const unsigned short compressor); | |||
POINT_BY_POINT_RAW = 0, | bool check_coder(const unsigned short coder); | |||
POINT_BY_POINT_ARITHMETIC = 1, | bool check_item(const LASitem* item); | |||
POINT_BY_POINT_ARITHMETIC_V2 = 2, // temporary fix | bool check_items(const unsigned short num_items, const LASitem* items); | |||
DEFAULT_COMPRESSION = POINT_BY_POINT_ARITHMETIC, | bool check(); | |||
DEFAULT_COMPRESSION_V2 = POINT_BY_POINT_ARITHMETIC_V2, // temporary | ||||
fix | ||||
DEFAULT_RAW = POINT_BY_POINT_RAW | ||||
}; | ||||
LASzip(); | // go back and forth between item array and point type & size | |||
~LASzip(); | bool setup(unsigned short* num_items, LASitem** items, const unsigned cha | |||
r point_type, const unsigned short point_size, const unsigned short compres | ||||
sor=LASZIP_COMPRESSOR_NONE); | ||||
bool is_standard(const unsigned short num_items, const LASitem* items, un | ||||
signed char* point_type=0, unsigned short* record_length=0); | ||||
bool is_standard(unsigned char* point_type=0, unsigned short* record_leng | ||||
th=0); | ||||
Algorithm algorithm; | // pack to and unpack from VLR | |||
unsigned char* bytes; | ||||
bool unpack(const unsigned char* bytes, const int num); | ||||
bool pack(unsigned char*& bytes, int& num); | ||||
// setup | ||||
bool setup(const unsigned char point_type, const unsigned short point_siz | ||||
e, const unsigned short compressor=LASZIP_COMPRESSOR_DEFAULT); | ||||
bool setup(const unsigned short num_items, const LASitem* items, const un | ||||
signed short compressor); | ||||
bool set_chunk_size(const unsigned int chunk_size); /* for co | ||||
mpressor only */ | ||||
bool request_version(const unsigned short requested_version); /* for co | ||||
mpressor only */ | ||||
// in case a function returns false this string describes the problem | ||||
const char* get_error() const; | ||||
// stored in LASzip VLR data section | ||||
unsigned short compressor; | ||||
unsigned short coder; | ||||
unsigned char version_major; | unsigned char version_major; | |||
unsigned char version_minor; | unsigned char version_minor; | |||
unsigned short version_revision; | unsigned short version_revision; | |||
unsigned int options; | unsigned int options; | |||
unsigned int num_items; | unsigned int chunk_size; | |||
unsigned int num_chunks; /* not used yet ... */ | ||||
SIGNED_INT64 num_points; /* not mandatory ... -1 if unknown */ | SIGNED_INT64 num_points; /* not mandatory ... -1 if unknown */ | |||
SIGNED_INT64 num_bytes; /* not mandatory ... -1 if unknown */ | SIGNED_INT64 num_bytes; /* not mandatory ... -1 if unknown */ | |||
unsigned short num_items; | ||||
LASitem* items; | LASitem* items; | |||
}; | ||||
/* | LASzip(); | |||
struct LASchunk | ~LASzip(); | |||
{ | ||||
unsigned int count; | private: | |||
unsigned int bytes; | bool return_error(const char* err); | |||
char* error_string; | ||||
}; | }; | |||
*/ | ||||
#endif | #endif | |||
End of changes. 19 change blocks. | ||||
41 lines changed or deleted | 68 lines changed or added | |||
laszipper.hpp | laszipper.hpp | |||
---|---|---|---|---|
skipping to change at line 27 | skipping to change at line 27 | |||
This is free software; you can redistribute and/or modify it under the | 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 Softwa re | terms of the GNU Lesser General Licence as published by the Free Softwa re | |||
Foundation. See the COPYING file for more information. | Foundation. See the COPYING file for more information. | |||
This software is distributed WITHOUT ANY WARRANTY and without even the | This software is distributed WITHOUT ANY WARRANTY and without even the | |||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . | |||
CHANGE HISTORY: | CHANGE HISTORY: | |||
8 May 2011 -- added an option for variable chunking via chunk() | ||||
23 April 2011 -- changed interface for simplicity and chunking support | ||||
10 January 2011 -- licensing change for LGPL release and liblas integra tion | 10 January 2011 -- licensing change for LGPL release and liblas integra tion | |||
12 December 2010 -- created from LASwriter/LASreader after Howard got p ushy (-; | 12 December 2010 -- created from LASwriter/LASreader after Howard got p ushy (-; | |||
=========================================================================== ==== | =========================================================================== ==== | |||
*/ | */ | |||
#ifndef LAS_ZIPPER_H | #ifndef LAS_ZIPPER_HPP | |||
#define LAS_ZIPPER_H | #define LAS_ZIPPER_HPP | |||
#include <stdio.h> | #include <stdio.h> | |||
#include "laszip.hpp" | #include "laszip.hpp" | |||
#ifdef LZ_WIN32_VC6 | #ifdef LZ_WIN32_VC6 | |||
#include <fstream.h> | #include <fstream.h> | |||
#else | #else | |||
#include <istream> | #include <istream> | |||
#include <fstream> | #include <fstream> | |||
using namespace std; | using namespace std; | |||
#endif | #endif | |||
class ByteStreamOut; | class ByteStreamOut; | |||
class LASwritePoint; | class LASwritePoint; | |||
class LASZIP_DLL LASzipper | class LASZIP_DLL LASzipper | |||
{ | { | |||
public: | public: | |||
unsigned int open(FILE* outfile, unsigned int num_items, LASitem items[], | bool open(FILE* outfile, const LASzip* laszip); | |||
LASzip::Algorithm algorithm); | bool open(ostream& outstream, const LASzip* laszip); | |||
unsigned int open(ostream& outstream, unsigned int num_items, LASitem ite | ||||
ms[], LASzip::Algorithm algorithm); | ||||
bool write(const unsigned char* const * point); | bool write(const unsigned char* const * point); | |||
unsigned int close(); | bool chunk(); | |||
bool close(); | ||||
LASzipper(); | LASzipper(); | |||
~LASzipper(); | ~LASzipper(); | |||
// in case a function returns false this string describes the problem | ||||
const char* get_error() const; | ||||
private: | private: | |||
int count; | unsigned int count; | |||
ByteStreamOut* stream; | ByteStreamOut* stream; | |||
LASwritePoint* writer; | LASwritePoint* writer; | |||
bool return_error(const char* err); | ||||
char* error_string; | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 7 change blocks. | ||||
8 lines changed or deleted | 15 lines changed or added | |||