Skip to content

Commit

Permalink
inital implementation of local COPC reading
Browse files Browse the repository at this point in the history
  • Loading branch information
NEDJIMAbelgacem authored and wonder-sk committed Mar 31, 2022
1 parent 995c290 commit cc9f5fb
Show file tree
Hide file tree
Showing 17 changed files with 1,254 additions and 2 deletions.
11 changes: 11 additions & 0 deletions CMakeLists.txt
Expand Up @@ -286,6 +286,8 @@ if(WITH_CORE)

set (WITH_EPT TRUE CACHE BOOL "Determines whether Entwine Point Cloud (EPT) support should be built")

set (WITH_COPC TRUE CACHE BOOL "Determines whether Cloud Optimized Point Cloud (COPC) support should be built")

set (WITH_THREAD_LOCAL TRUE CACHE BOOL "Determines whether std::thread_local should be used")
mark_as_advanced(WITH_THREAD_LOCAL)

Expand Down Expand Up @@ -418,6 +420,15 @@ if(WITH_CORE)
set(HAVE_EPT TRUE) # used in qgsconfig.h
endif()

if (WITH_COPC) # COPC provider
find_package(ZSTD REQUIRED) # for decompression of point clouds
find_package(LazPerf) # for decompression of point clouds
if (NOT LazPerf_FOUND)
message(STATUS "Using embedded laz-perf")
endif()
set(HAVE_COPC TRUE) # used in qgsconfig.h
endif()

if (WITH_PDAL)
if (NOT WITH_EPT)
message(FATAL_ERROR "PDAL provider cannot be built with EPT disabled")
Expand Down
2 changes: 2 additions & 0 deletions cmake_templates/qgsconfig.h.in
Expand Up @@ -98,6 +98,8 @@

#cmakedefine HAVE_EPT

#cmakedefine HAVE_COPC

#cmakedefine HAVE_PDAL_QGIS
#define PDAL_VERSION "${PDAL_VERSION}"
#define PDAL_VERSION_MAJOR_INT ${PDAL_VERSION_MAJOR}
Expand Down
63 changes: 63 additions & 0 deletions src/core/CMakeLists.txt
Expand Up @@ -1973,6 +1973,55 @@ if (WITH_EPT)
add_definitions( -DWITH_EPT )
endif()

if (WITH_COPC)
include_directories(providers/copc)

include_directories(SYSTEM
${ZSTD_INCLUDE_DIR}
)

if (LazPerf_FOUND)
# Use system laz-perf
include_directories(SYSTEM
${LazPerf_INCLUDE_DIR}
)
else()
# Use embedded laz-perf from external/laz-perf
include_directories(SYSTEM
)

set(QGIS_CORE_SRCS ${QGIS_CORE_SRCS}
${CMAKE_SOURCE_DIR}/external/lazperf/charbuf.cpp
${CMAKE_SOURCE_DIR}/external/lazperf/filestream.cpp
${CMAKE_SOURCE_DIR}/external/lazperf/header.cpp
${CMAKE_SOURCE_DIR}/external/lazperf/lazperf.cpp
${CMAKE_SOURCE_DIR}/external/lazperf/readers.cpp
${CMAKE_SOURCE_DIR}/external/lazperf/vlr.cpp
${CMAKE_SOURCE_DIR}/external/lazperf/detail/field_byte10.cpp
${CMAKE_SOURCE_DIR}/external/lazperf/detail/field_byte14.cpp
${CMAKE_SOURCE_DIR}/external/lazperf/detail/field_gpstime10.cpp
${CMAKE_SOURCE_DIR}/external/lazperf/detail/field_nir14.cpp
${CMAKE_SOURCE_DIR}/external/lazperf/detail/field_point10.cpp
${CMAKE_SOURCE_DIR}/external/lazperf/detail/field_point14.cpp
${CMAKE_SOURCE_DIR}/external/lazperf/detail/field_rgb10.cpp
${CMAKE_SOURCE_DIR}/external/lazperf/detail/field_rgb14.cpp
)
endif()

set(QGIS_CORE_SRCS ${QGIS_CORE_SRCS}
providers/copc/qgscopcprovider.cpp
pointcloud/qgseptdecoder.cpp
pointcloud/qgscopcpointcloudindex.cpp
)
set(QGIS_CORE_HDRS ${QGIS_CORE_HDRS}
providers/copc/qgscopcprovider.h
pointcloud/qgseptdecoder.h
pointcloud/qgscopcpointcloudindex.h
)

add_definitions( -DWITH_COPC )
endif()

if (APPLE)
# Libtasn1 is for DER-encoded PKI ASN.1 parsing/extracting workarounds
include_directories(SYSTEM
Expand Down Expand Up @@ -2109,6 +2158,11 @@ if (WITH_EPT)
${CMAKE_SOURCE_DIR}/src/core/providers/ept)
endif()

if (WITH_COPC)
target_include_directories(qgis_core PUBLIC
${CMAKE_SOURCE_DIR}/src/core/providers/copc)
endif()

GENERATE_EXPORT_HEADER(
qgis_core
BASE_NAME CORE
Expand Down Expand Up @@ -2229,6 +2283,15 @@ if (WITH_EPT)
endif()
endif()

if (WITH_COPC)
target_link_libraries(qgis_core
${ZSTD_LIBRARY}
)
if (LazPerf_FOUND)
target_link_libraries(qgis_core ${LazPerf_LIBRARY})
endif()
endif()

if (WITH_PDAL)
target_link_libraries(qgis_core
${PDAL_LIBRARIES}
Expand Down

0 comments on commit cc9f5fb

Please sign in to comment.