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);
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);
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;
197 
198  // optional extras
202 
203  // optional clipping
207 };
208 
209 #endif
LASheader
Definition: lasdefinitions.hpp:952
LASreadOpener::set_file_name_current
BOOL set_file_name_current(U32 file_name_id)
Definition: lasreader.cpp:1055
LASreader::seek
virtual BOOL seek(const I64 p_index)=0
LASreader::read_point_inside_circle_indexed
BOOL read_point_inside_circle_indexed()
Definition: lasreader.cpp:240
LASheader::min_y
F64 min_y
Definition: lasdefinitions.hpp:978
LASreadOpener::offset
F64 * offset
Definition: lasreader.hpp:181
LASreader::read_point_default
virtual BOOL read_point_default()=0
LASquantizer::get_y
F64 get_y(const I32 y) const
Definition: lasdefinitions.hpp:100
LASreader::set_transform
virtual void set_transform(LAStransform *transform)
Definition: lasreader.cpp:105
LASreadOpener::set_merged
void set_merged(const BOOL merged)
Definition: lasreader.cpp:987
transform
Definition: src/tools/lvr2_transform/Options.cpp:44
LASreader::point
LASpoint point
Definition: lasreader.hpp:53
LASreader::close
virtual void close(BOOL close_stream=TRUE)=0
LASreader::r_min_x
F64 r_min_x
Definition: lasreader.hpp:112
LASreader::inside_circle
virtual BOOL inside_circle(const F64 center_x, const F64 center_y, const F64 radius)
Definition: lasreader.cpp:157
LASreader::get_z
I32 get_z(const F64 z) const
Definition: lasreader.hpp:96
LASpoint
Definition: lasdefinitions.hpp:472
LASreadOpener::file_name
char * file_name
Definition: lasreader.hpp:175
LASreadOpener::get_parse_string
const char * get_parse_string() const
Definition: lasreader.cpp:1118
LASreadOpener::file_name_allocated
U32 file_name_allocated
Definition: lasreader.hpp:178
LASreadOpener::get_file_format
I32 get_file_format(U32 number) const
Definition: lasreader.cpp:959
LASreadOpener::active
BOOL active() const
Definition: lasreader.cpp:1195
LASreader::get_min_y
F64 get_min_y() const
Definition: lasreader.hpp:79
LASreader::r_max_x
F64 r_max_x
Definition: lasreader.hpp:112
I64
long long I64
Definition: mydefs.hpp:48
LASquantizer::get_z
F64 get_z(const I32 z) const
Definition: lasdefinitions.hpp:101
F64
double F64
Definition: mydefs.hpp:52
LASreadOpener::set_scale_factor
void set_scale_factor(const F64 *scale_factor)
Definition: lasreader.cpp:1123
LASreadOpener::use_stdin
BOOL use_stdin
Definition: lasreader.hpp:196
LASreadOpener::piped
BOOL piped() const
Definition: lasreader.cpp:296
LASreadOpener::scale_intensity
F32 scale_intensity
Definition: lasreader.hpp:184
I32
int I32
Definition: mydefs.hpp:35
LASreader::get_y
F64 get_y(const I32 y) const
Definition: lasreader.hpp:91
LASreadOpener::open
LASreader * open()
Definition: lasreader.cpp:312
LASreadOpener::extra_attribute_offsets
F64 extra_attribute_offsets[10]
Definition: lasreader.hpp:192
LASreader::read_point_inside_tile_indexed
BOOL read_point_inside_tile_indexed()
Definition: lasreader.cpp:222
TRUE
#define TRUE
Definition: mydefs.hpp:137
LASreader::get_y
I32 get_y(const F64 y) const
Definition: lasreader.hpp:95
LASreadOpener::add_extra_attribute
void add_extra_attribute(I32 data_type, const char *name, const char *description=0, F64 scale=1.0, F64 offset=0.0)
Definition: lasreader.cpp:1175
LASreader::use_default_reader
void use_default_reader()
Definition: lasreader.hpp:66
LASreader::p_count
I64 p_count
Definition: lasreader.hpp:56
LASreader::npoints
I64 npoints
Definition: lasreader.hpp:55
LASreader::read_point_inside_rectangle
BOOL read_point_inside_rectangle()
Definition: lasreader.cpp:249
LASreader::get_z
F64 get_z() const
Definition: lasreader.hpp:88
LASindex
Definition: lasindex.hpp:45
LASreader::r_min_y
F64 r_min_y
Definition: lasreader.hpp:112
LASreadOpener::number_extra_attributes
I32 number_extra_attributes
Definition: lasreader.hpp:187
LASreadOpener::extra_attribute_descriptions
char * extra_attribute_descriptions[10]
Definition: lasreader.hpp:190
LAStransform
Definition: lastransform.hpp:46
LASreadOpener::transform
LAStransform * transform
Definition: lasreader.hpp:201
LASreader::read_point_transformed
BOOL read_point_transformed()
Definition: lasreader.cpp:276
LASreadOpener::file_name_current
U32 file_name_current
Definition: lasreader.hpp:179
LASreadOpener::filter
LASfilter * filter
Definition: lasreader.hpp:200
LASreader::read_point_filtered_and_transformed
BOOL read_point_filtered_and_transformed()
Definition: lasreader.cpp:286
LASreader::c_radius
F64 c_radius
Definition: lasreader.hpp:114
LASreadOpener::extra_attribute_names
char * extra_attribute_names[10]
Definition: lasreader.hpp:189
LASreader::get_format
virtual I32 get_format() const =0
LASreader::r_max_y
F64 r_max_y
Definition: lasreader.hpp:112
LASreader::t_size
F32 t_size
Definition: lasreader.hpp:113
LASreadOpener::add_file_name
BOOL add_file_name(const char *file_name, BOOL unique=FALSE)
Definition: lasreader.cpp:1006
LASpoint::y
I32 y
Definition: lasdefinitions.hpp:479
LASreader::inside_tile
virtual BOOL inside_tile(const F32 ll_x, const F32 ll_y, const F32 size)
Definition: lasreader.cpp:128
LASreader::get_max_x
F64 get_max_x() const
Definition: lasreader.hpp:82
LASreadOpener::populate_header
BOOL populate_header
Definition: lasreader.hpp:195
LASreadOpener::get_merged
BOOL get_merged() const
Definition: lasreader.cpp:992
LASreader::set_filter
virtual void set_filter(LASfilter *filter)
Definition: lasreader.cpp:87
LASreadOpener::use_alternate
BOOL use_alternate
Definition: lasreader.hpp:182
LASreader::get_z
F64 get_z(const I32 z) const
Definition: lasreader.hpp:92
LASreadOpener::file_names
char ** file_names
Definition: lasreader.hpp:174
LASreadOpener::set_offset
void set_offset(const F64 *offset)
Definition: lasreader.cpp:1139
LASreadOpener::merged
BOOL merged
Definition: lasreader.hpp:176
LASreadOpener::file_name_number
U32 file_name_number
Definition: lasreader.hpp:177
LASreadOpener::extra_attribute_data_types
I32 extra_attribute_data_types[10]
Definition: lasreader.hpp:188
LASreadOpener::get_transform
const LAStransform * get_transform()
Definition: lasreader.hpp:163
LASreader
Definition: lasreader.hpp:49
LASreadOpener::index
LASindex * index
Definition: lasreader.hpp:199
LASreader::get_stream
virtual ByteStreamIn * get_stream() const =0
LASreadOpener::reopen
BOOL reopen(LASreader *lasreader)
Definition: lasreader.cpp:522
LASreadOpener::set_translate_intensity
void set_translate_intensity(F32 translate_intensity)
Definition: lasreader.cpp:1155
LASreadOpener::set_file_name
void set_file_name(const char *file_name, BOOL unique=FALSE)
Definition: lasreader.cpp:997
LASreadOpener::inside_circle
F64 * inside_circle
Definition: lasreader.hpp:205
LASreadOpener::get_file_name
const char * get_file_name() const
Definition: lasreader.cpp:945
LASreadOpener::translate_intensity
F32 translate_intensity
Definition: lasreader.hpp:183
LASheader::max_x
F64 max_x
Definition: lasdefinitions.hpp:975
LASreader::c_radius_squared
F64 c_radius_squared
Definition: lasreader.hpp:114
LASreadOpener::usage
void usage() const
Definition: lasreader.cpp:646
LASreadOpener::set_scale_intensity
void set_scale_intensity(F32 scale_intensity)
Definition: lasreader.cpp:1160
LASreader::reset_filter
void reset_filter()
Definition: lasreader.cpp:123
ByteStreamIn
Definition: bytestreamin.hpp:36
LASreadOpener::set_parse_string
void set_parse_string(const char *parse_string)
Definition: lasreader.cpp:1105
LASreader::index
LASindex * index
Definition: lasreader.hpp:106
LASreadOpener::scale_factor
F64 * scale_factor
Definition: lasreader.hpp:180
LASreadOpener
Definition: lasreader.hpp:133
LASreader::read_point_inside_tile
BOOL read_point_inside_tile()
Definition: lasreader.cpp:213
LASreadOpener::skip_lines
I32 skip_lines
Definition: lasreader.hpp:194
LASreadOpener::set_translate_scan_angle
void set_translate_scan_angle(F32 translate_scan_angle)
Definition: lasreader.cpp:1165
LASreader::compute_coordinates
void compute_coordinates()
Definition: lasreader.hpp:76
LASreader::get_x
F64 get_x() const
Definition: lasreader.hpp:86
laswaveform13reader.hpp
LASreader::use_alternate_reader
void use_alternate_reader()
Definition: lasreader.hpp:67
LASreader::t_ur_x
F32 t_ur_x
Definition: lasreader.hpp:113
LASreader::inside_rectangle
virtual BOOL inside_rectangle(const F64 min_x, const F64 min_y, const F64 max_x, const F64 max_y)
Definition: lasreader.cpp:185
LASreadOpener::extra_attribute_scales
F64 extra_attribute_scales[10]
Definition: lasreader.hpp:191
LASreader::set_index
void set_index(LASindex *index)
Definition: lasreader.cpp:76
BOOL
int BOOL
Definition: mydefs.hpp:57
LASreader::get_index
LASindex * get_index() const
Definition: lasreader.cpp:82
LASreadOpener::open_waveform13
LASwaveform13reader * open_waveform13(const LASheader *lasheader)
Definition: lasreader.cpp:622
LASpoint::z
I32 z
Definition: lasdefinitions.hpp:480
LASwaveform13reader
Definition: laswaveform13reader.hpp:42
LASreadOpener::delete_file_name
void delete_file_name(U32 file_name_id)
Definition: lasreader.cpp:1041
LASreadOpener::translate_scan_angle
F32 translate_scan_angle
Definition: lasreader.hpp:185
LASreadOpener::has_populated_header
BOOL has_populated_header() const
Definition: lasreader.cpp:301
argc
int argc
Definition: tests_high_five_parallel.cpp:27
LASreader::read_point_filtered
BOOL read_point_filtered()
Definition: lasreader.cpp:267
FALSE
#define FALSE
Definition: mydefs.hpp:133
F32
float F32
Definition: mydefs.hpp:51
LASreader::get_max_z
F64 get_max_z() const
Definition: lasreader.hpp:84
LASreadOpener::set_skip_lines
void set_skip_lines(I32 skip_lines)
Definition: lasreader.cpp:1185
LASheader::max_y
F64 max_y
Definition: lasdefinitions.hpp:977
LASreader::get_min_z
F64 get_min_z() const
Definition: lasreader.hpp:80
LASreader::read_point_alternate
virtual BOOL read_point_alternate()
Definition: lasreader.hpp:106
LASreadOpener::~LASreadOpener
~LASreadOpener()
Definition: lasreader.cpp:1235
LASfilter
Definition: lasfilter.hpp:46
LASheader::min_x
F64 min_x
Definition: lasdefinitions.hpp:976
LASreader::filter
LASfilter * filter
Definition: lasreader.hpp:109
LASreader::LASreader
LASreader()
Definition: lasreader.cpp:47
LASreader::c_center_y
F64 c_center_y
Definition: lasreader.hpp:114
LASreadOpener::reset
void reset()
Definition: lasreader.cpp:306
LASreader::transform
LAStransform * transform
Definition: lasreader.hpp:110
LASreader::header
LASheader header
Definition: lasreader.hpp:52
LASreadOpener::scale_scan_angle
F32 scale_scan_angle
Definition: lasreader.hpp:186
LASreader::~LASreader
virtual ~LASreader()
Definition: lasreader.cpp:71
LASreader::get_y
F64 get_y() const
Definition: lasreader.hpp:87
LASreader::get_x
F64 get_x(const I32 x) const
Definition: lasreader.hpp:90
U32
unsigned int U32
Definition: mydefs.hpp:39
LASreader::read_simple
BOOL(LASreader::* read_simple)()
Definition: lasreader.hpp:117
LASreader::get_min_x
F64 get_min_x() const
Definition: lasreader.hpp:78
LASreader::t_ll_x
F32 t_ll_x
Definition: lasreader.hpp:113
LASreadOpener::inside_rectangle
F64 * inside_rectangle
Definition: lasreader.hpp:206
LASquantizer::get_x
F64 get_x(const I32 x) const
Definition: lasdefinitions.hpp:99
LASpoint::x
I32 x
Definition: lasdefinitions.hpp:478
LASheader::max_z
F64 max_z
Definition: lasdefinitions.hpp:979
LASreadOpener::set_scale_scan_angle
void set_scale_scan_angle(F32 scale_scan_angle)
Definition: lasreader.cpp:1170
LASpoint::compute_coordinates
void compute_coordinates()
Definition: lasdefinitions.hpp:819
LASreadOpener::parse
BOOL parse(int argc, char *argv[])
Definition: lasreader.cpp:665
LASreader::get_max_y
F64 get_max_y() const
Definition: lasreader.hpp:83
LASreadOpener::get_file_name_number
U32 get_file_name_number() const
Definition: lasreader.cpp:1100
LASreader::get_x
I32 get_x(const F64 x) const
Definition: lasreader.hpp:94
LASreader::read_point
BOOL read_point()
Definition: lasreader.hpp:74
LASreader::c_center_x
F64 c_center_x
Definition: lasreader.hpp:114
LASreader::t_ll_y
F32 t_ll_y
Definition: lasreader.hpp:113
LASreader::read_point_inside_circle
BOOL read_point_inside_circle()
Definition: lasreader.cpp:231
LASreader::read_point_inside_rectangle_indexed
BOOL read_point_inside_rectangle_indexed()
Definition: lasreader.cpp:258
LASreadOpener::get_filter
const LASfilter * get_filter()
Definition: lasreader.hpp:162
LASreadOpener::parse_string
char * parse_string
Definition: lasreader.hpp:193
argv
char ** argv
Definition: tests_high_five_parallel.cpp:28
LASreadOpener::set_populate_header
void set_populate_header(BOOL populate_header)
Definition: lasreader.cpp:1190
lasdefinitions.hpp
LASreader::t_ur_y
F32 t_ur_y
Definition: lasreader.hpp:113
LASreadOpener::inside_tile
F32 * inside_tile
Definition: lasreader.hpp:204
LASreadOpener::LASreadOpener
LASreadOpener()
Definition: lasreader.cpp:1200
LASheader::min_z
F64 min_z
Definition: lasdefinitions.hpp:980
LASreader::read_complex
BOOL(LASreader::* read_complex)()
Definition: lasreader.hpp:118


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 Wed Mar 2 2022 00:37:23