From 5d1fab319807d96b3b5b65a74e9365a3058137bb Mon Sep 17 00:00:00 2001 From: Jean-Romain Date: Tue, 21 Nov 2023 05:02:59 -0500 Subject: [PATCH] Propagate stream order --- src/LASlib/lasreader.cpp | 2 ++ src/LASlib/lasreader.hpp | 1 + src/LASlib/lasreadermerged.cpp | 9 +++++++++ src/LASlib/lasreadermerged.hpp | 13 +++++++------ src/LASzip/lascopc.hpp | 2 +- 5 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/LASlib/lasreader.cpp b/src/LASlib/lasreader.cpp index 94ba4a3..f850529 100644 --- a/src/LASlib/lasreader.cpp +++ b/src/LASlib/lasreader.cpp @@ -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; @@ -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]); diff --git a/src/LASlib/lasreader.hpp b/src/LASlib/lasreader.hpp index 14a90d2..5a60a68 100644 --- a/src/LASlib/lasreader.hpp +++ b/src/LASlib/lasreader.hpp @@ -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; diff --git a/src/LASlib/lasreadermerged.cpp b/src/LASlib/lasreadermerged.cpp index acefc8b..1bb45e5 100644 --- a/src/LASlib/lasreadermerged.cpp +++ b/src/LASlib/lasreadermerged.cpp @@ -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) @@ -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); } } diff --git a/src/LASlib/lasreadermerged.hpp b/src/LASlib/lasreadermerged.hpp index 1949379..8e32daa 100644 --- a/src/LASlib/lasreadermerged.hpp +++ b/src/LASlib/lasreadermerged.hpp @@ -2,9 +2,9 @@ =============================================================================== FILE: lasreadermerged.hpp - + CONTENTS: - + Reads LiDAR points from the LAS format from more than one file. PROGRAMMERS: @@ -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 @@ -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(); diff --git a/src/LASzip/lascopc.hpp b/src/LASzip/lascopc.hpp index 26f9196..526b9d3 100644 --- a/src/LASzip/lascopc.hpp +++ b/src/LASzip/lascopc.hpp @@ -191,7 +191,7 @@ class EPToctree std::unordered_map registry; }; -class COPCindex : private EPToctree +class COPCindex : public EPToctree { public: COPCindex(const LASheader& header);