Skip to content
Permalink
Browse files

able to build without zstd and lazperf

  • Loading branch information
PeterPetrik authored and nyalldawson committed Oct 26, 2020
1 parent 8536c56 commit bb5b625bc4769a56e993f69b804317bed7b4f8d5
Showing with 39 additions and 2 deletions.
  1. +7 −0 CMakeLists.txt
  2. +4 −0 cmake_templates/qgsconfig.h.in
  3. +28 −2 src/core/providers/ept/qgseptdecoder.cpp
@@ -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)
@@ -76,5 +76,9 @@

#cmakedefine HAVE_STATIC_PROVIDERS

#cmakedefine HAVE_ZSTD

#cmakedefine HAVE_LAZPERF

#endif

@@ -18,13 +18,19 @@
#include "qgseptdecoder.h"
#include "qgseptpointcloudindex.h"
#include "qgsvector3d.h"
#include "qgsconfig.h"

#include <zstd.h>
#include <QFile>
#include <iostream>

#if defined ( HAVE_ZSTD )
#include <zstd.h>
#endif

#if defined ( HAVE_LAZPERF )
#include "laz-perf/io.hpp"
#include "laz-perf/common/common.hpp"
#endif

///@cond PRIVATE

@@ -60,7 +66,7 @@ QVector<char> QgsEptDecoder::decompressBinaryClasses( const QString &filename, i
Q_ASSERT( r );

int count = f.size() / pointRecordSize;
QVector<char> classes(count);
QVector<char> classes( count );
for ( int i = 0; i < count; ++i )
{
QByteArray bytes = f.read( pointRecordSize );
@@ -78,6 +84,8 @@ QVector<char> 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<qint32> QgsEptDecoder::decompressZStandard( const QString &filename, int
return data;
}

#else // defined(HAVE_ZSTD)
QVector<qint32> QgsEptDecoder::decompressZStandard( const QString &filename, int pointRecordSize )
{
//TODO graceful error
Q_ASSERT( false );
}

#endif // defined(HAVE_ZSTD)

/* *************************************************************************************** */

#if defined ( HAVE_LAZPERF )
QVector<qint32> QgsEptDecoder::decompressLaz( const QString &filename )
{
std::ifstream file( filename.toLatin1().constData(), std::ios::binary );
@@ -165,4 +183,12 @@ QVector<qint32> QgsEptDecoder::decompressLaz( const QString &filename )
return data;
}

#else // defined ( HAVE_LAZPERF )
QVector<qint32> QgsEptDecoder::decompressLaz( const QString &filename )
{
//TODO graceful return and error message
Q_ASSERT( false );
}
#endif

///@endcond

0 comments on commit bb5b625

Please sign in to comment.
You can’t perform that action at this time.