diff --git a/CMakeLists.txt b/CMakeLists.txt index 87fec7f1887..f7b1072ba0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -351,7 +351,13 @@ IF(WITH_CORE) MESSAGE(STATUS "Found zlib: ${ZLIB_LIBRARIES}") FIND_PACKAGE(ZSTD REQUIRED) # for decompression of point clouds + IF (ZSTD_FOUND) + SET(HAVE_ZSTD TRUE) # used in qgsconfig.h + ENDIF (ZSTD_FOUND) FIND_PACKAGE(LazPerf REQUIRED) # for decompression of point clouds + IF (LazPerf_FOUND) + SET(HAVE_LAZPERF TRUE) # used in qgsconfig.h + ENDIF (LazPerf_FOUND) # optional IF (WITH_POSTGRESQL) @@ -380,6 +386,7 @@ IF(WITH_CORE) ELSE (WITH_QTWEBKIT) MESSAGE(STATUS "Qt WebKit support DISABLED.") ENDIF(WITH_QTWEBKIT) + ############################################################# # search for Qt5 SET(QT_MIN_VERSION 5.9.0) diff --git a/cmake_templates/qgsconfig.h.in b/cmake_templates/qgsconfig.h.in index 38e93ac35ad..94b7965a8b6 100644 --- a/cmake_templates/qgsconfig.h.in +++ b/cmake_templates/qgsconfig.h.in @@ -76,5 +76,9 @@ #cmakedefine HAVE_STATIC_PROVIDERS +#cmakedefine HAVE_ZSTD + +#cmakedefine HAVE_LAZPERF + #endif diff --git a/src/core/providers/ept/qgseptdecoder.cpp b/src/core/providers/ept/qgseptdecoder.cpp index 2dc264456c4..97966bb82ec 100644 --- a/src/core/providers/ept/qgseptdecoder.cpp +++ b/src/core/providers/ept/qgseptdecoder.cpp @@ -18,13 +18,19 @@ #include "qgseptdecoder.h" #include "qgseptpointcloudindex.h" #include "qgsvector3d.h" +#include "qgsconfig.h" -#include #include #include +#if defined ( HAVE_ZSTD ) +#include +#endif + +#if defined ( HAVE_LAZPERF ) #include "laz-perf/io.hpp" #include "laz-perf/common/common.hpp" +#endif ///@cond PRIVATE @@ -60,7 +66,7 @@ QVector QgsEptDecoder::decompressBinaryClasses( const QString &filename, i Q_ASSERT( r ); int count = f.size() / pointRecordSize; - QVector classes(count); + QVector classes( count ); for ( int i = 0; i < count; ++i ) { QByteArray bytes = f.read( pointRecordSize ); @@ -78,6 +84,8 @@ QVector QgsEptDecoder::decompressBinaryClasses( const QString &filename, i /* *************************************************************************************** */ +#if defined(HAVE_ZSTD) + QByteArray decompressZtdStream( const QByteArray &dataCompressed ) { // NOTE: this is very primitive implementation because we expect the uncompressed @@ -135,8 +143,18 @@ QVector QgsEptDecoder::decompressZStandard( const QString &filename, int return data; } +#else // defined(HAVE_ZSTD) +QVector QgsEptDecoder::decompressZStandard( const QString &filename, int pointRecordSize ) +{ + //TODO graceful error + Q_ASSERT( false ); +} + +#endif // defined(HAVE_ZSTD) + /* *************************************************************************************** */ +#if defined ( HAVE_LAZPERF ) QVector QgsEptDecoder::decompressLaz( const QString &filename ) { std::ifstream file( filename.toLatin1().constData(), std::ios::binary ); @@ -165,4 +183,12 @@ QVector QgsEptDecoder::decompressLaz( const QString &filename ) return data; } +#else // defined ( HAVE_LAZPERF ) +QVector QgsEptDecoder::decompressLaz( const QString &filename ) +{ + //TODO graceful return and error message + Q_ASSERT( false ); +} +#endif + ///@endcond