Skip to content

Commit

Permalink
Merge branch 'copc'
Browse files Browse the repository at this point in the history
# Conflicts:
#	NEWS.md
  • Loading branch information
Jean-Romain committed Nov 20, 2023
2 parents 69524fe + 76b5685 commit d76f637
Show file tree
Hide file tree
Showing 23 changed files with 7,076 additions and 5,676 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: rlas
Type: Package
Title: Read and Write 'las' and 'laz' Binary File Formats Used for Remote Sensing Data
Version: 1.6.4
Version: 1.7.0
Authors@R: c(
person("Jean-Romain", "Roussel", email = "[email protected]", role = c("aut", "cre", "cph")),
person("Florian", "De Boissieu", email = "", role = c("aut", "ctb"), comment = "Enable the support of .lax file and extra byte attributes"),
Expand Down
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
### rlas v1.6.4
### rlas v1.7.0

- support of Text Area Description [#64](https://github.com/r-lidar/rlas/pull/64)
- `header_create()` now take into account `ScannerChannel`
- Remove Rcpp.h and replace by R.h saves 2:30 min of compilation.
- support of COPC spatial indexed files


### rlas v1.6.3

Expand Down
74 changes: 69 additions & 5 deletions src/LASlib/lasdefinitions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
PROGRAMMERS:
martin.isenburg@rapidlasso.com - http://rapidlasso.com
info@rapidlasso.de - https://rapidlasso.de
COPYRIGHT:
(c) 2005-2018, martin isenburg, rapidlasso - fast tools to catch reality
(c) 2005-2018, rapidlasso GmbH - fast tools to catch reality
This is free software; you can redistribute and/or modify it under the
terms of the GNU Lesser General Licence as published by the Free Software
Expand All @@ -31,6 +31,7 @@
CHANGE HISTORY:
9 November 2022 -- support of COPC VLR and EVLR
19 April 2017 -- support for selective decompression for new LAS 1.4 points
1 February 2017 -- better support for OGC WKT strings in VLRs or EVLRs
22 June 2016 -- set default of VLR header "reserved" to 0 instead of 0xAABB
Expand All @@ -49,7 +50,7 @@
#ifndef LAS_DEFINITIONS_HPP
#define LAS_DEFINITIONS_HPP

#define LAS_TOOLS_VERSION 210117
#define LAS_TOOLS_VERSION 221128

#include <stdio.h>
#include <string.h>
Expand Down Expand Up @@ -84,6 +85,10 @@
#define LAS_TOOLS_IO_IBUFFER_SIZE 262144
#define LAS_TOOLS_IO_OBUFFER_SIZE 262144

#ifndef MAX_PATH // linux
#define MAX_PATH 256
#endif

class LASvlr
{
public:
Expand Down Expand Up @@ -154,6 +159,39 @@ class LASvlr_wave_packet_descr
U8 data[26];
};

class LASvlr_copc_info
{
public:
F64 center_x; // Actual (unscaled) X coordinate of center of octree
F64 center_y; // Actual (unscaled) Y coordinate of center of octree
F64 center_z; // Actual (unscaled) Z coordinate of center of octree
F64 halfsize; // Perpendicular distance from the center to any side of the root node.
F64 spacing; // Space between points at the root node. This value is halved at each octree level
U64 root_hier_offset; // File offset to the first hierarchy page
U64 root_hier_size; // Size of the first hierarchy page in bytes
F64 gpstime_minimum; // Minimum of GPSTime
F64 gpstime_maximum; // Maximum of GPSTime
U64 reserved[11]; // Must be 0
};

class LAScopc_voxelkey
{
public:
I32 depth;
I32 x;
I32 y;
I32 z;
};

class LASvlr_copc_entry
{
public:
LAScopc_voxelkey key;
U64 offset;
I32 byte_size;
I32 point_count;
};

class LASheader : public LASquantizer, public LASattributer
{
public:
Expand Down Expand Up @@ -207,6 +245,11 @@ class LASheader : public LASquantizer, public LASattributer
LASvlr_classification* vlr_classification;
LASvlr_wave_packet_descr** vlr_wave_packet_descr;

// LAZ 1.4 format 6 7 8 with COPC only
U32 number_of_copc_entries;
LASvlr_copc_info* vlr_copc_info;
LASvlr_copc_entry* vlr_copc_entries;

LASzip* laszip;
LASvlr_lastiling* vlr_lastiling;
LASvlr_lasoriginal* vlr_lasoriginal;
Expand Down Expand Up @@ -327,6 +370,10 @@ class LASheader : public LASquantizer, public LASattributer
vlr_classification = 0;
if (vlr_wave_packet_descr) delete [] vlr_wave_packet_descr;
vlr_wave_packet_descr = 0;
if (vlr_copc_info) delete vlr_copc_info;
vlr_copc_info = 0;
if (vlr_copc_entries) delete [] vlr_copc_entries;
vlr_copc_entries = 0;
number_of_variable_length_records = 0;
}
};
Expand Down Expand Up @@ -640,11 +687,11 @@ class LASheader : public LASquantizer, public LASattributer
{
if (keep_existing)
{
i = number_of_variable_length_records;
i = number_of_extended_variable_length_records;
}
else
{
for (i = 0; i < number_of_variable_length_records; i++)
for (i = 0; i < number_of_extended_variable_length_records; i++)
{
if ((strcmp(evlrs[i].user_id, user_id) == 0) && (evlrs[i].record_id == record_id))
{
Expand Down Expand Up @@ -925,6 +972,23 @@ class LASheader : public LASquantizer, public LASattributer
}
}

void del_copc()
{
if (vlr_copc_info)
{
remove_vlr("copc", 1);
delete vlr_copc_info;
vlr_copc_info = 0;
}

if (vlr_copc_entries)
{
remove_evlr("copc", 1000);
delete[] vlr_copc_entries;
vlr_copc_entries = 0;
}
}

void set_geo_ogc_wkt(const I32 num_geo_ogc_wkt, const CHAR* geo_ogc_wkt, BOOL in_evlr=FALSE)
{
I32 null_terminator = 0;
Expand Down
Loading

0 comments on commit d76f637

Please sign in to comment.