1 /* 2 =============================================================================== 3 4 FILE: lasreadpoint.hpp 5 6 CONTENTS: 7 8 Common interface for the classes that read points raw or compressed. 9 10 PROGRAMMERS: 11 12 martin.isenburg@rapidlasso.com - http://rapidlasso.com 13 14 COPYRIGHT: 15 16 (c) 2007-2017, martin isenburg, rapidlasso - fast tools to catch reality 17 18 This is free software; you can redistribute and/or modify it under the 19 terms of the GNU Lesser General Licence as published by the Free Software 20 Foundation. See the COPYING file for more information. 21 22 This software is distributed WITHOUT ANY WARRANTY and without even the 23 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 24 25 CHANGE HISTORY: 26 27 28 August 2017 -- moving 'context' from global development hack to interface 28 18 July 2017 -- bug fix for spatial-indexed reading of native compressed LAS 1.4 29 19 April 2017 -- support for selective decompression for new LAS 1.4 points 30 23 August 2016 -- layering of items for selective decompression in LAS 1.4 31 6 September 2014 -- removed inheritance of EntropyEncoder and EntropyDecoder 32 24 August 2014 -- delay read of chunk table until first read() or seek() is called 33 6 October 2011 -- large file support & reading with missing chunk table 34 9 May 2011 -- the chunked compressor now allows variable chunk sizes 35 25 April 2011 -- added chunked laszip for random access decompression 36 10 January 2011 -- licensing change for LGPL release and liblas integration 37 7 December 2010 -- adapted from LASpointReader for better code modularity 38 3 December 2010 -- updated to (somewhat) support LAS format 1.3 39 7 September 2008 -- updated to support LAS format 1.2 40 22 February 2007 -- created about an hour before henna's birthday 41 42 =============================================================================== 43 */ 44 #ifndef LAS_READ_POINT_HPP 45 #define LAS_READ_POINT_HPP 46 47 #include "mydefs.hpp" 48 #include "laszip.hpp" 49 #include "laszip_decompress_selective_v3.hpp" 50 #include "bytestreamin.hpp" 51 52 class LASreadItem; 53 class ArithmeticDecoder; 54 55 class LASreadPoint 56 { 57 public: 58 LASreadPoint(U32 decompress_selective=LASZIP_DECOMPRESS_SELECTIVE_ALL); 59 ~LASreadPoint(); 60 61 // should only be called *once* 62 BOOL setup(const U32 num_items, const LASitem* items, const LASzip* laszip=0); 63 64 BOOL init(ByteStreamIn* instream); 65 BOOL seek(const U32 current, const U32 target); 66 BOOL read(U8* const * point); 67 BOOL check_end(); 68 BOOL done(); 69 error() const70 inline const CHAR* error() const { return last_error; }; warning() const71 inline const CHAR* warning() const { return last_warning; }; 72 73 private: 74 ByteStreamIn* instream; 75 U32 num_readers; 76 LASreadItem** readers; 77 LASreadItem** readers_raw; 78 LASreadItem** readers_compressed; 79 ArithmeticDecoder* dec; 80 BOOL layered_las14_compression; 81 // used for chunking 82 U32 chunk_size; 83 U32 chunk_count; 84 U32 current_chunk; 85 U32 number_chunks; 86 U32 tabled_chunks; 87 I64* chunk_starts; 88 U32* chunk_totals; 89 BOOL init_dec(); 90 BOOL read_chunk_table(); 91 U32 search_chunk_table(const U32 index, const U32 lower, const U32 upper); 92 // used for selective decompression (new LAS 1.4 point types only) 93 U32 decompress_selective; 94 // used for seeking 95 I64 point_start; 96 U32 point_size; 97 U8** seek_point; 98 // used for error and warning reporting 99 CHAR* last_error; 100 CHAR* last_warning; 101 }; 102 103 #endif 104