33 : mNode( node ), mDataType( dataType ),
34 mAttributes( attributes ), mRequestedAttributes( requestedAttributes ),
35 mScale( scale ), mOffset( offset )
37 QNetworkRequest nr( Uri );
38 nr.setAttribute( QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache );
39 nr.setAttribute( QNetworkRequest::CacheSaveControlAttribute,
true );
54 void QgsPointCloudBlockRequest::blockFinishedLoading()
57 if ( mTileDownloadManagetReply->error() == QNetworkReply::NetworkError::NoError )
59 bool invalidDataType =
false;
64 if ( mDataType == QLatin1String(
"binary" ) )
66 mBlock = QgsEptDecoder::decompressBinary( mTileDownloadManagetReply->data(), mAttributes, mRequestedAttributes, mScale, mOffset );
68 else if ( mDataType == QLatin1String(
"zstandard" ) )
70 mBlock = QgsEptDecoder::decompressZStandard( mTileDownloadManagetReply->data(), mAttributes, mRequestedAttributes, mScale, mOffset );
72 else if ( mDataType == QLatin1String(
"laszip" ) )
74 mBlock = QgsEptDecoder::decompressLaz( mTileDownloadManagetReply->data(), mAttributes, mRequestedAttributes, mScale, mOffset );
78 mErrorStr = QStringLiteral(
"unknown data type %1;" ).arg( mDataType );
79 invalidDataType =
true;
83 catch ( std::exception &e )
85 mErrorStr = QStringLiteral(
"Error while decompressing node %1: %2" ).arg( mNode.
toString(), e.what() );
87 if ( invalidDataType && !mBlock )
88 mErrorStr = QStringLiteral(
"Error loading point cloud tile: \" %1 \"" ).arg( mTileDownloadManagetReply->errorString() );
92 mErrorStr = mTileDownloadManagetReply->errorString();
Represents a indexed point cloud node in octree.
QString toString() const
Encode node to string.
static QgsTileDownloadManager * tileDownloadManager()
Returns the application's tile download manager, used for download of map tiles when rendering.
Collection of point cloud attributes.
QString errorStr()
Returns the error message string of the request.
QgsPointCloudBlockRequest(const IndexedPointCloudNode &node, const QString &Uri, const QString &dataType, const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes, const QgsVector3D &scale, const QgsVector3D &offset)
QgsPointCloudBlockRequest constructor Note: It is the responsablitiy of the caller to delete the bloc...
QgsPointCloudBlock * block()
Returns the requested block.
void finished()
Emitted when the request processing has finished.
Base class for storing raw data from point cloud nodes.
void finished()
Emitted when the reply has finished (either with a success or with a failure)