lasreader.hpp
Go to the documentation of this file.
1 /*
2 ===============================================================================
3 
4  FILE: lasreader.hpp
5 
6  CONTENTS:
7 
8  Interface to read LIDAR points from the LAS format versions 1.0 - 1.3 and
9  per on-the-fly conversion from simple ASCII files.
10 
11  PROGRAMMERS:
12 
13  martin.isenburg@gmail.com
14 
15  COPYRIGHT:
16 
17  (c) 2007-2011, Martin Isenburg, LASSO - tools to catch reality
18 
19  This is free software; you can redistribute and/or modify it under the
20  terms of the GNU Lesser General Licence as published by the Free Software
21  Foundation. See the COPYING file for more information.
22 
23  This software is distributed WITHOUT ANY WARRANTY and without even the
24  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
25 
26  CHANGE HISTORY:
27 
28  5 September 2011 -- support for reading Terrasolid's BIN format
29  11 June 2011 -- billion point support: p_count & npoints are 64 bit counters
30  9 April 2011 -- added capability to read on-the-fly conversion from ASCII
31  24 January 2011 -- introduced LASreadOpener
32  21 January 2011 -- turned into abstract reader to support multiple files
33  3 December 2010 -- updated to (somewhat) support LAS format 1.3
34  7 September 2008 -- updated to support LAS format 1.2
35  18 February 2007 -- created after repairing 2 vacuum cleaners in the garden
36 
37 ===============================================================================
38 */
39 #ifndef LAS_READER_HPP
40 #define LAS_READER_HPP
41 
42 #include "lasdefinitions.hpp"
43 
44 class LASindex;
45 class LASfilter;
46 class LAStransform;
47 class ByteStreamIn;
48 
49 class LASreader
50 {
51 public:
54 
57 
58  virtual I32 get_format() const = 0;
59 
60  void set_index(LASindex* index);
61  LASindex* get_index() const;
62  virtual void set_filter(LASfilter* filter);
63  virtual void set_transform(LAStransform* transform);
64  void reset_filter();
65 
68 
69  virtual BOOL inside_tile(const F32 ll_x, const F32 ll_y, const F32 size);
70  virtual BOOL inside_circle(const F64 center_x, const F64 center_y, const F64 radius);
71  virtual BOOL inside_rectangle(const F64 min_x, const F64 min_y, const F64 max_x, const F64 max_y);
72 
73  virtual BOOL seek(const I64 p_index) = 0;
74  BOOL read_point() { return (this->*read_simple)(); };
75 
76  inline void compute_coordinates() { point.compute_coordinates(); };
77 
78  inline F64 get_min_x() const { return header.min_x; };
79  inline F64 get_min_y() const { return header.min_y; };
80  inline F64 get_min_z() const { return header.min_z; };
81 
82  inline F64 get_max_x() const { return header.max_x; };
83  inline F64 get_max_y() const { return header.max_y; };
84  inline F64 get_max_z() const { return header.max_z; };
85 
86  inline F64 get_x() const { return get_x(point.x); };
87  inline F64 get_y() const { return get_y(point.y); };
88  inline F64 get_z() const { return get_z(point.z); };
89 
90  inline F64 get_x(const I32 x) const { return header.get_x(x); };
91  inline F64 get_y(const I32 y) const { return header.get_y(y); };
92  inline F64 get_z(const I32 z) const { return header.get_z(z); };
93 
94  inline I32 get_x(const F64 x) const { return header.get_x(x); };
95  inline I32 get_y(const F64 y) const { return header.get_y(y); };
96  inline I32 get_z(const F64 z) const { return header.get_z(z); };
97 
98  virtual ByteStreamIn* get_stream() const = 0;
99  virtual void close(BOOL close_stream=TRUE) = 0;
100 
101  LASreader();
102  virtual ~LASreader();
103 
104 protected:
105  virtual BOOL read_point_default() = 0;
107 
108  LASindex* index;
111 
115 
116 private:
119 
129 };
130 
131 #include "laswaveform13reader.hpp"
132 
134 {
135 public:
136  const char* get_file_name() const;
137  void set_file_name(const char* file_name, BOOL unique=FALSE);
138  BOOL add_file_name(const char* file_name, BOOL unique=FALSE);
139  void delete_file_name(U32 file_name_id);
140  BOOL set_file_name_current(U32 file_name_id);
141  U32 get_file_name_number() const;
142  const char* get_file_name(U32 number) const;
143  I32 get_file_format(U32 number) const;
144  void set_merged(const BOOL merged);
145  BOOL get_merged() const;
146  void set_scale_factor(const F64* scale_factor);
147  void set_offset(const F64* offset);
148  void set_translate_intensity(F32 translate_intensity);
149  void set_scale_intensity(F32 scale_intensity);
150  void set_translate_scan_angle(F32 translate_scan_angle);
151  void set_scale_scan_angle(F32 scale_scan_angle);
152  void add_extra_attribute(I32 data_type, const char* name, const char* description=0, F64 scale=1.0, F64 offset=0.0);
153  void set_parse_string(const char* parse_string);
154  void set_skip_lines(I32 skip_lines);
155  void set_populate_header(BOOL populate_header);
156  const char* get_parse_string() const;
157  void usage() const;
158  BOOL parse(int argc, char* argv[]);
159  BOOL piped() const;
160  BOOL has_populated_header() const;
161  BOOL active() const;
162  const LASfilter* get_filter() { return filter; };
163  const LAStransform* get_transform() { return transform; };
164  void reset();
165  LASreader* open();
166  BOOL reopen(LASreader* lasreader);
167  LASwaveform13reader* open_waveform13(const LASheader* lasheader);
168  LASreadOpener();
169  ~LASreadOpener();
170 private:
171 #ifdef _WIN32
172  void add_file_name_windows(const char* file_name, BOOL unique=FALSE);
173 #endif
174  char** file_names;
175  char* file_name;
188  I32 extra_attribute_data_types[10];
189  char* extra_attribute_names[10];
190  char* extra_attribute_descriptions[10];
191  F64 extra_attribute_scales[10];
192  F64 extra_attribute_offsets[10];
197 
198  // optional extras
202 
203  // optional clipping
207 };
208 
209 #endif
int BOOL
Definition: mydefs.hpp:57
virtual BOOL inside_circle(const F64 center_x, const F64 center_y, const F64 radius)
Definition: lasreader.cpp:157
virtual void close(BOOL close_stream=TRUE)=0
F64 c_radius_squared
Definition: lasreader.hpp:114
#define FALSE
Definition: mydefs.hpp:133
virtual ByteStreamIn * get_stream() const =0
F64 get_min_z() const
Definition: lasreader.hpp:80
BOOL read_point_inside_tile()
Definition: lasreader.cpp:213
float F32
Definition: mydefs.hpp:51
LASfilter * filter
Definition: lasreader.hpp:200
F64 get_x() const
Definition: lasreader.hpp:86
F64 * inside_circle
Definition: lasreader.hpp:205
BOOL(LASreader::* read_complex)()
Definition: lasreader.hpp:118
BOOL read_point()
Definition: lasreader.hpp:74
LASheader header
Definition: lasreader.hpp:52
char ** file_names
Definition: lasreader.hpp:174
I32 get_x(const F64 x) const
Definition: lasreader.hpp:94
F64 get_z(const I32 z) const
Definition: lasreader.hpp:92
LASindex * index
Definition: lasreader.hpp:106
BOOL read_point_inside_circle()
Definition: lasreader.cpp:231
F64 get_z() const
Definition: lasreader.hpp:88
LASpoint point
Definition: lasreader.hpp:53
F64 get_y(const I32 y) const
Definition: lasreader.hpp:91
unsigned int U32
Definition: mydefs.hpp:39
I64 p_count
Definition: lasreader.hpp:56
U32 file_name_allocated
Definition: lasreader.hpp:178
virtual BOOL inside_tile(const F32 ll_x, const F32 ll_y, const F32 size)
Definition: lasreader.cpp:128
void compute_coordinates()
Definition: lasreader.hpp:76
virtual BOOL seek(const I64 p_index)=0
F64 get_max_x() const
Definition: lasreader.hpp:82
const LAStransform * get_transform()
Definition: lasreader.hpp:163
F64 c_center_x
Definition: lasreader.hpp:114
virtual ~LASreader()
Definition: lasreader.cpp:71
F32 * inside_tile
Definition: lasreader.hpp:204
LAStransform * transform
Definition: lasreader.hpp:110
BOOL read_point_inside_tile_indexed()
Definition: lasreader.cpp:222
I32 number_extra_attributes
Definition: lasreader.hpp:187
I64 npoints
Definition: lasreader.hpp:55
F64 c_center_y
Definition: lasreader.hpp:114
LAStransform * transform
Definition: lasreader.hpp:201
void use_alternate_reader()
Definition: lasreader.hpp:67
void reset_filter()
Definition: lasreader.cpp:123
F64 * scale_factor
Definition: lasreader.hpp:180
long long I64
Definition: mydefs.hpp:48
BOOL populate_header
Definition: lasreader.hpp:195
virtual BOOL read_point_default()=0
F64 get_y() const
Definition: lasreader.hpp:87
char * file_name
Definition: lasreader.hpp:175
F64 c_radius
Definition: lasreader.hpp:114
F64 get_x(const I32 x) const
Definition: lasreader.hpp:90
const LASfilter * get_filter()
Definition: lasreader.hpp:162
F64 * inside_rectangle
Definition: lasreader.hpp:206
LASindex * index
Definition: lasreader.hpp:199
virtual BOOL inside_rectangle(const F64 min_x, const F64 min_y, const F64 max_x, const F64 max_y)
Definition: lasreader.cpp:185
F64 get_y(const I32 y) const
F64 get_max_y() const
Definition: lasreader.hpp:83
int I32
Definition: mydefs.hpp:35
char * parse_string
Definition: lasreader.hpp:193
void compute_coordinates()
void use_default_reader()
Definition: lasreader.hpp:66
virtual I32 get_format() const =0
I32 get_z(const F64 z) const
Definition: lasreader.hpp:96
I32 get_y(const F64 y) const
Definition: lasreader.hpp:95
U32 file_name_number
Definition: lasreader.hpp:177
F32 translate_scan_angle
Definition: lasreader.hpp:185
virtual void set_filter(LASfilter *filter)
Definition: lasreader.cpp:87
BOOL read_point_inside_rectangle()
Definition: lasreader.cpp:249
F64 get_min_y() const
Definition: lasreader.hpp:79
F64 get_z(const I32 z) const
F64 get_min_x() const
Definition: lasreader.hpp:78
void set_index(LASindex *index)
Definition: lasreader.cpp:76
BOOL read_point_filtered_and_transformed()
Definition: lasreader.cpp:286
U32 file_name_current
Definition: lasreader.hpp:179
LASfilter * filter
Definition: lasreader.hpp:109
BOOL read_point_filtered()
Definition: lasreader.cpp:267
BOOL read_point_transformed()
Definition: lasreader.cpp:276
#define TRUE
Definition: mydefs.hpp:137
LASindex * get_index() const
Definition: lasreader.cpp:82
virtual BOOL read_point_alternate()
Definition: lasreader.hpp:106
F64 get_max_z() const
Definition: lasreader.hpp:84
BOOL use_alternate
Definition: lasreader.hpp:182
std::shared_ptr< HighFive::File > open(const std::string &filename)
Definition: Hdf5Util.cpp:202
F64 get_x(const I32 x) const
BOOL read_point_inside_rectangle_indexed()
Definition: lasreader.cpp:258
virtual void set_transform(LAStransform *transform)
Definition: lasreader.cpp:105
F32 scale_scan_angle
Definition: lasreader.hpp:186
BOOL read_point_inside_circle_indexed()
Definition: lasreader.cpp:240
BOOL(LASreader::* read_simple)()
Definition: lasreader.hpp:117
F32 translate_intensity
Definition: lasreader.hpp:183
double F64
Definition: mydefs.hpp:52
char ** argv


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Mon Feb 28 2022 22:46:07