Skip to content
Permalink
Browse files
switch to use QTemporaryFile
  • Loading branch information
NEDJIMAbelgacem authored and wonder-sk committed Apr 8, 2021
1 parent aca1146 commit a297d84077552b50f85ce145a071291abf3f97df
@@ -27,6 +27,7 @@
#include <iostream>
#include <memory>
#include <cstring>
#include <QTemporaryFile>

#include <zstd.h>

@@ -478,12 +479,16 @@ QgsPointCloudBlock *QgsEptDecoder::decompressLaz( const QString &filename,
);
}

#include <QDebug>

QgsPointCloudBlock *QgsEptDecoder::decompressLaz( const QByteArray &byteArrayData,
const QString &nodeStr,
const QgsPointCloudAttributeCollection &attributes,
const QgsPointCloudAttributeCollection &requestedAttributes )
{
QString filename = QDir::tempPath() + QDir::separator() + QStringLiteral( "%1.laz" ).arg( nodeStr );
QTemporaryFile tempFile;
if ( !tempFile.open() )
return nullptr;
QString filename = tempFile.fileName();
std::ofstream file( filename.toStdString(), std::ios::binary | std::ios::out );
if ( file.is_open() )
{
@@ -36,7 +36,7 @@ namespace QgsEptDecoder
QgsPointCloudBlock *decompressZStandard( const QString &filename, const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes );
QgsPointCloudBlock *decompressZStandard( const QByteArray &data, const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes );
QgsPointCloudBlock *decompressLaz( const QString &filename, const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes );
QgsPointCloudBlock *decompressLaz( const QByteArray &data, const QString &nodeStr, const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes );
QgsPointCloudBlock *decompressLaz( const QByteArray &data, const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes );
};

///@endcond
@@ -66,7 +66,7 @@ void QgsPointCloudBlockRequest::blockFinishedLoading()
}
else if ( mDataType == QLatin1String( "laszip" ) )
{
mBlock = QgsEptDecoder::decompressLaz( mTileDownloadManagetReply->data(), mNode.toString(), mAttributes, mRequestedAttributes );
mBlock = QgsEptDecoder::decompressLaz( mTileDownloadManagetReply->data(), mAttributes, mRequestedAttributes );
}
else
{

0 comments on commit a297d84

Please sign in to comment.