Skip to content

Commit

Permalink
Propagate stream order
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Romain committed Nov 21, 2023
1 parent a2b7f31 commit 5d1fab3
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/LASlib/lasreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ LASreader::LASreader()
read_complex = 0;
index = 0;
copc_index = 0;
copc_stream_order = 0;
copc_resolution = 0;
copc_depth = I32_MAX;
filter = 0;
Expand Down Expand Up @@ -650,6 +651,7 @@ LASreader* LASreadOpener::open(const CHAR* other_file_name, BOOL reset_after_oth
lasreadermerged->set_translate_scan_angle(translate_scan_angle);
lasreadermerged->set_scale_scan_angle(scale_scan_angle);
lasreadermerged->set_io_ibuffer_size(io_ibuffer_size);
lasreadermerged->set_copc_stream_order(copc_stream_order);
if (file_names_ID)
{
for (file_name_current = 0; file_name_current < file_name_number; file_name_current++) lasreadermerged->add_file_name(file_names[file_name_current], file_names_ID[file_name_current]);
Expand Down
1 change: 1 addition & 0 deletions src/LASlib/lasreader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ class LASLIB_DLL LASreader

// optional resolution-of-interest query (copc indexed)
U8 inside_depth; // 0 all, 1 max depth, 2 resolution
U8 copc_stream_order; // 0 normal, 1 spatially, 2 depth
F32 copc_resolution;
I32 copc_depth;

Expand Down
9 changes: 9 additions & 0 deletions src/LASlib/lasreadermerged.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,12 @@ void LASreaderMerged::set_keep_lastiling(BOOL keep_lastiling)
this->keep_lastiling = keep_lastiling;
}

void LASreaderMerged::set_copc_stream_order(U8 order)
{
if (order < 0 || order > 2) order = 0;
copc_stream_order = order;
}

BOOL LASreaderMerged::open()
{
if (file_name_number == 0)
Expand Down Expand Up @@ -1529,6 +1535,9 @@ BOOL LASreaderMerged::open_next_file()
}

COPCindex *copc_index = new COPCindex(lasreaderlas->header);
if (copc_stream_order == 0) copc_index->set_stream_ordered_by_chunk();
else if (copc_stream_order == 1) copc_index->set_stream_ordered_spatially();
else if (copc_stream_order == 2) copc_index->set_stream_ordered_by_depth();
lasreaderlas->set_copcindex(copc_index);
}
}
Expand Down
13 changes: 7 additions & 6 deletions src/LASlib/lasreadermerged.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
===============================================================================
FILE: lasreadermerged.hpp
CONTENTS:
Reads LiDAR points from the LAS format from more than one file.
PROGRAMMERS:
Expand All @@ -21,16 +21,16 @@
This software is distributed WITHOUT ANY WARRANTY and without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
CHANGE HISTORY:
2 May 2023 -- adding support of COPC spatial index standard
4 November 2019 -- add ID to files for subsets of merged '-faf' files
5 September 2018 -- support for reading points from the PLY format
1 December 2017 -- support extra bytes during '-merged' operations
3 May 2015 -- header sets file source ID to 0 when merging flightlines
3 May 2015 -- header sets file source ID to 0 when merging flightlines
20 January 2011 -- created missing Livermore and my Extra Virgin Olive Oil
===============================================================================
*/
#ifndef LAS_READER_MERGED_HPP
Expand Down Expand Up @@ -66,6 +66,7 @@ class LASreaderMerged : public LASreader
void set_skip_lines(I32 skip_lines);
void set_populate_header(BOOL populate_header);
void set_keep_lastiling(BOOL keep_lastiling);
void set_copc_stream_order(U8 order);
BOOL open();
BOOL reopen();

Expand Down
2 changes: 1 addition & 1 deletion src/LASzip/lascopc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class EPToctree
std::unordered_map<EPTkey, EPToctant, EPTKeyHasher> registry;
};

class COPCindex : private EPToctree
class COPCindex : public EPToctree
{
public:
COPCindex(const LASheader& header);
Expand Down

0 comments on commit 5d1fab3

Please sign in to comment.