mirror of
https://github.com/qgis/QGIS.git
synced 2025-11-22 00:14:55 -05:00
remove the use of QgsCustomPointCloudBlock
This commit is contained in:
parent
7a03571fa7
commit
d07a0b9a29
@ -28,7 +28,7 @@ Base class for storing raw data from point cloud nodes
|
||||
public:
|
||||
QgsPointCloudBlock( int count,
|
||||
const QgsPointCloudAttributeCollection &attributes,
|
||||
const QByteArray &data );
|
||||
const QByteArray &data, const QgsVector3D &scale, const QgsVector3D &offset );
|
||||
%Docstring
|
||||
Ctor
|
||||
%End
|
||||
@ -47,34 +47,6 @@ Returns number of points that are stored in the block
|
||||
QgsPointCloudAttributeCollection attributes() const;
|
||||
%Docstring
|
||||
Returns the attributes that are stored in the data block, along with their size
|
||||
%End
|
||||
|
||||
};
|
||||
|
||||
|
||||
class QgsCustomPointCloudBlock : QgsPointCloudBlock
|
||||
{
|
||||
%Docstring(signature="appended")
|
||||
Base class for storing raw data from point cloud nodes that have a custom scale and offset values
|
||||
|
||||
.. note::
|
||||
|
||||
The API is considered EXPERIMENTAL and can be changed without a notice
|
||||
|
||||
.. versionadded:: 3.20
|
||||
%End
|
||||
|
||||
%TypeHeaderCode
|
||||
#include "qgspointcloudblock.h"
|
||||
%End
|
||||
public:
|
||||
QgsCustomPointCloudBlock( int count,
|
||||
const QgsPointCloudAttributeCollection &attributes,
|
||||
const QByteArray &data,
|
||||
const QgsVector3D &scale,
|
||||
const QgsVector3D &offset );
|
||||
%Docstring
|
||||
Ctor
|
||||
%End
|
||||
|
||||
QgsVector3D scale() const;
|
||||
@ -88,6 +60,7 @@ Returns the custom offset of the block.
|
||||
%End
|
||||
};
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* This file has been generated automatically from *
|
||||
* *
|
||||
|
||||
@ -253,13 +253,8 @@ void QgsSingleColorPointCloud3DSymbolHandler::processNode( QgsPointCloudIndex *p
|
||||
const char *ptr = block->data();
|
||||
int count = block->pointCount();
|
||||
const std::size_t recordSize = attributes.pointRecordSize();
|
||||
QgsVector3D blockScale = pc->scale();
|
||||
QgsVector3D blockOffset = pc->offset();
|
||||
if ( QgsCustomPointCloudBlock *customBlock = dynamic_cast<QgsCustomPointCloudBlock *>( block.get() ) )
|
||||
{
|
||||
blockScale = customBlock->scale();
|
||||
blockOffset = customBlock->offset();
|
||||
}
|
||||
const QgsVector3D blockScale = block->scale();
|
||||
const QgsVector3D blockOffset = block->offset();
|
||||
const double zValueScale = context.zValueScale();
|
||||
const double zValueOffset = context.zValueFixedOffset();
|
||||
QgsCoordinateTransform coordinateTransform = context.coordinateTransform();
|
||||
@ -382,13 +377,8 @@ void QgsColorRampPointCloud3DSymbolHandler::processNode( QgsPointCloudIndex *pc,
|
||||
int count = block->pointCount();
|
||||
const std::size_t recordSize = attributes.pointRecordSize();
|
||||
|
||||
QgsVector3D blockScale = pc->scale();
|
||||
QgsVector3D blockOffset = pc->offset();
|
||||
if ( QgsCustomPointCloudBlock *customBlock = dynamic_cast<QgsCustomPointCloudBlock *>( block.get() ) )
|
||||
{
|
||||
blockScale = customBlock->scale();
|
||||
blockOffset = customBlock->offset();
|
||||
}
|
||||
const QgsVector3D blockScale = block->scale();
|
||||
const QgsVector3D blockOffset = block->offset();
|
||||
|
||||
for ( int i = 0; i < count; ++i )
|
||||
{
|
||||
@ -492,13 +482,8 @@ void QgsRGBPointCloud3DSymbolHandler::processNode( QgsPointCloudIndex *pc, const
|
||||
int count = block->pointCount();
|
||||
const std::size_t recordSize = attributes.pointRecordSize();
|
||||
|
||||
QgsVector3D blockScale = pc->scale();
|
||||
QgsVector3D blockOffset = pc->offset();
|
||||
if ( QgsCustomPointCloudBlock *customBlock = dynamic_cast<QgsCustomPointCloudBlock *>( block.get() ) )
|
||||
{
|
||||
blockScale = customBlock->scale();
|
||||
blockOffset = customBlock->offset();
|
||||
}
|
||||
const QgsVector3D blockScale = block->scale();
|
||||
const QgsVector3D blockOffset = block->offset();
|
||||
const double zValueScale = context.zValueScale();
|
||||
const double zValueOffset = context.zValueFixedOffset();
|
||||
QgsCoordinateTransform coordinateTransform = context.coordinateTransform();
|
||||
@ -660,13 +645,8 @@ void QgsClassificationPointCloud3DSymbolHandler::processNode( QgsPointCloudIndex
|
||||
int count = block->pointCount();
|
||||
const std::size_t recordSize = attributes.pointRecordSize();
|
||||
|
||||
QgsVector3D blockScale = pc->scale();
|
||||
QgsVector3D blockOffset = pc->offset();
|
||||
if ( QgsCustomPointCloudBlock *customBlock = dynamic_cast<QgsCustomPointCloudBlock *>( block.get() ) )
|
||||
{
|
||||
blockScale = customBlock->scale();
|
||||
blockOffset = customBlock->offset();
|
||||
}
|
||||
const QgsVector3D blockScale = block->scale();
|
||||
const QgsVector3D blockOffset = block->offset();
|
||||
const double zValueScale = context.zValueScale();
|
||||
const double zValueOffset = context.zValueFixedOffset();
|
||||
QgsCoordinateTransform coordinateTransform = context.coordinateTransform();
|
||||
|
||||
@ -157,13 +157,8 @@ void Qgs3DMapToolIdentify::mouseReleaseEvent( QMouseEvent *event )
|
||||
if ( !block )
|
||||
continue;
|
||||
|
||||
QgsVector3D blockScale = index->scale();
|
||||
QgsVector3D blockOffset = index->offset();
|
||||
if ( QgsCustomPointCloudBlock *customBlock = dynamic_cast<QgsCustomPointCloudBlock *>( block.get() ) )
|
||||
{
|
||||
blockScale = customBlock->scale();
|
||||
blockOffset = customBlock->offset();
|
||||
}
|
||||
const QgsVector3D blockScale = block->scale();
|
||||
const QgsVector3D blockOffset = block->offset();
|
||||
|
||||
const char *ptr = block->data();
|
||||
QgsPointCloudAttributeCollection blockAttributes = block->attributes();
|
||||
|
||||
@ -131,7 +131,7 @@ bool _serialize( char *data, size_t outputPosition, QgsPointCloudAttribute::Data
|
||||
|
||||
// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
QgsPointCloudBlock *_decompressBinary( const QByteArray &dataUncompressed, const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes )
|
||||
QgsPointCloudBlock *_decompressBinary( const QByteArray &dataUncompressed, const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes, const QgsVector3D &scale, const QgsVector3D &offset )
|
||||
{
|
||||
const std::size_t pointRecordSize = attributes.pointRecordSize( );
|
||||
const std::size_t requestedPointRecordSize = requestedAttributes.pointRecordSize();
|
||||
@ -192,12 +192,11 @@ QgsPointCloudBlock *_decompressBinary( const QByteArray &dataUncompressed, const
|
||||
return new QgsPointCloudBlock(
|
||||
count,
|
||||
requestedAttributes,
|
||||
data
|
||||
data, scale, offset
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
QgsPointCloudBlock *QgsEptDecoder::decompressBinary( const QString &filename, const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes )
|
||||
QgsPointCloudBlock *QgsEptDecoder::decompressBinary( const QString &filename, const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes, const QgsVector3D &scale, const QgsVector3D &offset )
|
||||
{
|
||||
if ( ! QFile::exists( filename ) )
|
||||
return nullptr;
|
||||
@ -208,12 +207,12 @@ QgsPointCloudBlock *QgsEptDecoder::decompressBinary( const QString &filename, co
|
||||
return nullptr;
|
||||
|
||||
QByteArray dataUncompressed = f.read( f.size() );
|
||||
return _decompressBinary( dataUncompressed, attributes, requestedAttributes );
|
||||
return _decompressBinary( dataUncompressed, attributes, requestedAttributes, scale, offset );
|
||||
}
|
||||
|
||||
QgsPointCloudBlock *QgsEptDecoder::decompressBinary( const QByteArray &data, const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes )
|
||||
QgsPointCloudBlock *QgsEptDecoder::decompressBinary( const QByteArray &data, const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes, const QgsVector3D &scale, const QgsVector3D &offset )
|
||||
{
|
||||
return _decompressBinary( data, attributes, requestedAttributes );
|
||||
return _decompressBinary( data, attributes, requestedAttributes, scale, offset );
|
||||
}
|
||||
|
||||
/* *************************************************************************************** */
|
||||
@ -246,7 +245,7 @@ QByteArray decompressZtdStream( const QByteArray &dataCompressed )
|
||||
return dataUncompressed;
|
||||
}
|
||||
|
||||
QgsPointCloudBlock *QgsEptDecoder::decompressZStandard( const QString &filename, const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes )
|
||||
QgsPointCloudBlock *QgsEptDecoder::decompressZStandard( const QString &filename, const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes, const QgsVector3D &scale, const QgsVector3D &offset )
|
||||
{
|
||||
if ( ! QFile::exists( filename ) )
|
||||
return nullptr;
|
||||
@ -258,21 +257,23 @@ QgsPointCloudBlock *QgsEptDecoder::decompressZStandard( const QString &filename,
|
||||
|
||||
QByteArray dataCompressed = f.readAll();
|
||||
QByteArray dataUncompressed = decompressZtdStream( dataCompressed );
|
||||
return _decompressBinary( dataUncompressed, attributes, requestedAttributes );
|
||||
return _decompressBinary( dataUncompressed, attributes, requestedAttributes, scale, offset );
|
||||
}
|
||||
|
||||
QgsPointCloudBlock *QgsEptDecoder::decompressZStandard( const QByteArray &data, const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes )
|
||||
QgsPointCloudBlock *QgsEptDecoder::decompressZStandard( const QByteArray &data, const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes, const QgsVector3D &scale, const QgsVector3D &offset )
|
||||
{
|
||||
QByteArray dataUncompressed = decompressZtdStream( data );
|
||||
return _decompressBinary( dataUncompressed, attributes, requestedAttributes );
|
||||
return _decompressBinary( dataUncompressed, attributes, requestedAttributes, scale, offset );
|
||||
}
|
||||
|
||||
/* *************************************************************************************** */
|
||||
|
||||
template<typename FileType>
|
||||
QgsPointCloudBlock *__decompressLaz( FileType &file, const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes )
|
||||
QgsPointCloudBlock *__decompressLaz( FileType &file, const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes, const QgsVector3D &_scale, const QgsVector3D &_offset )
|
||||
{
|
||||
Q_UNUSED( attributes );
|
||||
Q_UNUSED( _scale );
|
||||
Q_UNUSED( _offset );
|
||||
|
||||
if ( ! file.good() )
|
||||
return nullptr;
|
||||
@ -470,7 +471,7 @@ QgsPointCloudBlock *__decompressLaz( FileType &file, const QgsPointCloudAttribut
|
||||
float t = common::since( start );
|
||||
QgsDebugMsgLevel( QStringLiteral( "LAZ-PERF Read through the points in %1 seconds." ).arg( t ), 2 );
|
||||
#endif
|
||||
QgsCustomPointCloudBlock *block = new QgsCustomPointCloudBlock(
|
||||
QgsPointCloudBlock *block = new QgsPointCloudBlock(
|
||||
count,
|
||||
requestedAttributes,
|
||||
data, scale, offset
|
||||
@ -480,20 +481,22 @@ QgsPointCloudBlock *__decompressLaz( FileType &file, const QgsPointCloudAttribut
|
||||
|
||||
QgsPointCloudBlock *QgsEptDecoder::decompressLaz( const QString &filename,
|
||||
const QgsPointCloudAttributeCollection &attributes,
|
||||
const QgsPointCloudAttributeCollection &requestedAttributes )
|
||||
const QgsPointCloudAttributeCollection &requestedAttributes,
|
||||
const QgsVector3D &scale, const QgsVector3D &offset )
|
||||
{
|
||||
const QByteArray arr = filename.toUtf8();
|
||||
std::ifstream file( arr.constData(), std::ios::binary );
|
||||
|
||||
return __decompressLaz<std::ifstream>( file, attributes, requestedAttributes );
|
||||
return __decompressLaz<std::ifstream>( file, attributes, requestedAttributes, scale, offset );
|
||||
}
|
||||
|
||||
QgsPointCloudBlock *QgsEptDecoder::decompressLaz( const QByteArray &byteArrayData,
|
||||
const QgsPointCloudAttributeCollection &attributes,
|
||||
const QgsPointCloudAttributeCollection &requestedAttributes )
|
||||
const QgsPointCloudAttributeCollection &requestedAttributes,
|
||||
const QgsVector3D &scale, const QgsVector3D &offset )
|
||||
{
|
||||
std::istringstream file( byteArrayData.toStdString() );
|
||||
return __decompressLaz<std::istringstream>( file, attributes, requestedAttributes );
|
||||
return __decompressLaz<std::istringstream>( file, attributes, requestedAttributes, scale, offset );
|
||||
}
|
||||
|
||||
///@endcond
|
||||
|
||||
@ -31,12 +31,12 @@
|
||||
|
||||
namespace QgsEptDecoder
|
||||
{
|
||||
QgsPointCloudBlock *decompressBinary( const QString &filename, const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes );
|
||||
QgsPointCloudBlock *decompressBinary( const QByteArray &data, const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes );
|
||||
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 QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes );
|
||||
QgsPointCloudBlock *decompressBinary( const QString &filename, const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes, const QgsVector3D &scale, const QgsVector3D &offset );
|
||||
QgsPointCloudBlock *decompressBinary( const QByteArray &data, const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes, const QgsVector3D &scale, const QgsVector3D &offset );
|
||||
QgsPointCloudBlock *decompressZStandard( const QString &filename, const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes, const QgsVector3D &scale, const QgsVector3D &offset );
|
||||
QgsPointCloudBlock *decompressZStandard( const QByteArray &data, const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes, const QgsVector3D &scale, const QgsVector3D &offset );
|
||||
QgsPointCloudBlock *decompressLaz( const QString &filename, const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes, const QgsVector3D &scale, const QgsVector3D &offset );
|
||||
QgsPointCloudBlock *decompressLaz( const QByteArray &data, const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes, const QgsVector3D &scale, const QgsVector3D &offset );
|
||||
};
|
||||
|
||||
///@endcond
|
||||
|
||||
@ -282,17 +282,17 @@ QgsPointCloudBlock *QgsEptPointCloudIndex::nodeData( const IndexedPointCloudNode
|
||||
if ( mDataType == QLatin1String( "binary" ) )
|
||||
{
|
||||
QString filename = QStringLiteral( "%1/ept-data/%2.bin" ).arg( mDirectory, n.toString() );
|
||||
return QgsEptDecoder::decompressBinary( filename, attributes(), request.attributes() );
|
||||
return QgsEptDecoder::decompressBinary( filename, attributes(), request.attributes(), scale(), offset() );
|
||||
}
|
||||
else if ( mDataType == QLatin1String( "zstandard" ) )
|
||||
{
|
||||
QString filename = QStringLiteral( "%1/ept-data/%2.zst" ).arg( mDirectory, n.toString() );
|
||||
return QgsEptDecoder::decompressZStandard( filename, attributes(), request.attributes() );
|
||||
return QgsEptDecoder::decompressZStandard( filename, attributes(), request.attributes(), scale(), offset() );
|
||||
}
|
||||
else if ( mDataType == QLatin1String( "laszip" ) )
|
||||
{
|
||||
QString filename = QStringLiteral( "%1/ept-data/%2.laz" ).arg( mDirectory, n.toString() );
|
||||
return QgsEptDecoder::decompressLaz( filename, attributes(), request.attributes() );
|
||||
return QgsEptDecoder::decompressLaz( filename, attributes(), request.attributes(), scale(), offset() );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -23,11 +23,13 @@
|
||||
QgsPointCloudBlock::QgsPointCloudBlock(
|
||||
int count,
|
||||
const QgsPointCloudAttributeCollection &attributes,
|
||||
const QByteArray &data
|
||||
const QByteArray &data, const QgsVector3D &scale, const QgsVector3D &offset
|
||||
)
|
||||
: mPointCount( count )
|
||||
, mAttributes( attributes )
|
||||
, mStorage( data )
|
||||
, mScale( scale )
|
||||
, mOffset( offset )
|
||||
{
|
||||
}
|
||||
|
||||
@ -46,12 +48,12 @@ QgsPointCloudAttributeCollection QgsPointCloudBlock::attributes() const
|
||||
return mAttributes;
|
||||
}
|
||||
|
||||
// QgsCustomPointCloudBlock
|
||||
|
||||
QgsCustomPointCloudBlock::QgsCustomPointCloudBlock( int count,
|
||||
const QgsPointCloudAttributeCollection &attributes,
|
||||
const QByteArray &data,
|
||||
const QgsVector3D &scale,
|
||||
const QgsVector3D &offset ) : QgsPointCloudBlock( count, attributes, data ), mScale( scale ), mOffset( offset )
|
||||
QgsVector3D QgsPointCloudBlock::scale() const
|
||||
{
|
||||
return mScale;
|
||||
}
|
||||
|
||||
QgsVector3D QgsPointCloudBlock::offset() const
|
||||
{
|
||||
return mOffset;
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ class CORE_EXPORT QgsPointCloudBlock
|
||||
//! Ctor
|
||||
QgsPointCloudBlock( int count,
|
||||
const QgsPointCloudAttributeCollection &attributes,
|
||||
const QByteArray &data );
|
||||
const QByteArray &data, const QgsVector3D &scale, const QgsVector3D &offset );
|
||||
//! Dtor
|
||||
virtual ~QgsPointCloudBlock() = default;
|
||||
|
||||
@ -54,39 +54,17 @@ class CORE_EXPORT QgsPointCloudBlock
|
||||
//! Returns the attributes that are stored in the data block, along with their size
|
||||
QgsPointCloudAttributeCollection attributes() const;
|
||||
|
||||
//! Returns the custom scale of the block.
|
||||
QgsVector3D scale() const;
|
||||
|
||||
//! Returns the custom offset of the block.
|
||||
QgsVector3D offset() const;
|
||||
private:
|
||||
int mPointCount;
|
||||
QgsPointCloudAttributeCollection mAttributes;
|
||||
QByteArray mStorage;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \ingroup core
|
||||
* \brief Base class for storing raw data from point cloud nodes that have a custom scale and offset values
|
||||
*
|
||||
* \note The API is considered EXPERIMENTAL and can be changed without a notice
|
||||
*
|
||||
* \since QGIS 3.20
|
||||
*/
|
||||
class CORE_EXPORT QgsCustomPointCloudBlock : public QgsPointCloudBlock
|
||||
{
|
||||
public:
|
||||
//! Ctor
|
||||
QgsCustomPointCloudBlock( int count,
|
||||
const QgsPointCloudAttributeCollection &attributes,
|
||||
const QByteArray &data,
|
||||
const QgsVector3D &scale,
|
||||
const QgsVector3D &offset );
|
||||
|
||||
//! Returns the custom scale of the block.
|
||||
QgsVector3D scale() const { return mScale; }
|
||||
|
||||
//! Returns the custom offset of the block.
|
||||
QgsVector3D offset() const { return mOffset; }
|
||||
private:
|
||||
QgsVector3D mScale, mOffset;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // QGSPOINTCLOUDBLOCK_H
|
||||
|
||||
@ -27,8 +27,12 @@
|
||||
|
||||
///@cond PRIVATE
|
||||
|
||||
QgsPointCloudBlockRequest::QgsPointCloudBlockRequest( const IndexedPointCloudNode &node, const QString &Uri, const QString &dataType, const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes )
|
||||
: mNode( node ), mDataType( dataType ), mAttributes( attributes ), mRequestedAttributes( requestedAttributes )
|
||||
QgsPointCloudBlockRequest::QgsPointCloudBlockRequest( const IndexedPointCloudNode &node, const QString &Uri, const QString &dataType,
|
||||
const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes,
|
||||
const QgsVector3D &scale, const QgsVector3D &offset )
|
||||
: mNode( node ), mDataType( dataType ),
|
||||
mAttributes( attributes ), mRequestedAttributes( requestedAttributes ),
|
||||
mScale( scale ), mOffset( offset )
|
||||
{
|
||||
QNetworkRequest nr( Uri );
|
||||
nr.setAttribute( QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache );
|
||||
@ -59,15 +63,15 @@ void QgsPointCloudBlockRequest::blockFinishedLoading()
|
||||
#ifdef WITH_EPT
|
||||
if ( mDataType == QLatin1String( "binary" ) )
|
||||
{
|
||||
mBlock = QgsEptDecoder::decompressBinary( mTileDownloadManagetReply->data(), mAttributes, mRequestedAttributes );
|
||||
mBlock = QgsEptDecoder::decompressBinary( mTileDownloadManagetReply->data(), mAttributes, mRequestedAttributes, mScale, mOffset );
|
||||
}
|
||||
else if ( mDataType == QLatin1String( "zstandard" ) )
|
||||
{
|
||||
mBlock = QgsEptDecoder::decompressZStandard( mTileDownloadManagetReply->data(), mAttributes, mRequestedAttributes );
|
||||
mBlock = QgsEptDecoder::decompressZStandard( mTileDownloadManagetReply->data(), mAttributes, mRequestedAttributes, mScale, mOffset );
|
||||
}
|
||||
else if ( mDataType == QLatin1String( "laszip" ) )
|
||||
{
|
||||
mBlock = QgsEptDecoder::decompressLaz( mTileDownloadManagetReply->data(), mAttributes, mRequestedAttributes );
|
||||
mBlock = QgsEptDecoder::decompressLaz( mTileDownloadManagetReply->data(), mAttributes, mRequestedAttributes, mScale, mOffset );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -46,7 +46,9 @@ class CORE_EXPORT QgsPointCloudBlockRequest : public QObject
|
||||
* QgsPointCloudBlockRequest constructor
|
||||
* Note: It is the responsablitiy of the caller to delete the block if it was loaded correctly
|
||||
*/
|
||||
QgsPointCloudBlockRequest( const IndexedPointCloudNode &node, const QString &Uri, const QString &dataType, const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes );
|
||||
QgsPointCloudBlockRequest( const IndexedPointCloudNode &node, const QString &Uri, const QString &dataType,
|
||||
const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes,
|
||||
const QgsVector3D &scale, const QgsVector3D &offset );
|
||||
|
||||
/**
|
||||
* Returns the requested block. if the returned block is nullptr, that means the data request failed
|
||||
@ -68,6 +70,7 @@ class CORE_EXPORT QgsPointCloudBlockRequest : public QObject
|
||||
std::unique_ptr<QgsTileDownloadManagerReply> mTileDownloadManagetReply = nullptr;
|
||||
QgsPointCloudBlock *mBlock = nullptr;
|
||||
QString mErrorStr;
|
||||
QgsVector3D mScale, mOffset;
|
||||
private slots:
|
||||
void blockFinishedLoading();
|
||||
};
|
||||
|
||||
@ -201,14 +201,6 @@ struct MapIndexedPointCloudNode
|
||||
if ( !block || pointsCount == mPointsLimit )
|
||||
return acceptedPoints;
|
||||
|
||||
QgsVector3D blockScale = mIndexScale;
|
||||
QgsVector3D blockOffset = mIndexOffset;
|
||||
if ( QgsCustomPointCloudBlock *customBlock = dynamic_cast<QgsCustomPointCloudBlock *>( block.get() ) )
|
||||
{
|
||||
blockScale = customBlock->scale();
|
||||
blockOffset = customBlock->offset();
|
||||
}
|
||||
|
||||
const char *ptr = block->data();
|
||||
QgsPointCloudAttributeCollection blockAttributes = block->attributes();
|
||||
const std::size_t recordSize = blockAttributes.pointRecordSize();
|
||||
@ -221,7 +213,7 @@ struct MapIndexedPointCloudNode
|
||||
for ( int i = 0; i < block->pointCount() && pointsCount < mPointsLimit; ++i )
|
||||
{
|
||||
double x, y, z;
|
||||
QgsPointCloudAttribute::getPointXYZ( ptr, i, recordSize, xOffset, xType, yOffset, yType, zOffset, zType, blockScale, blockOffset, x, y, z );
|
||||
QgsPointCloudAttribute::getPointXYZ( ptr, i, recordSize, xOffset, xType, yOffset, yType, zOffset, zType, block->scale(), block->offset(), x, y, z );
|
||||
QgsPoint point( x, y );
|
||||
|
||||
if ( mZRange.contains( z ) && extentEngine->contains( &point ) )
|
||||
|
||||
@ -215,13 +215,12 @@ int QgsPointCloudLayerRenderer::renderNodesSync( const QVector<IndexedPointCloud
|
||||
|
||||
if ( !block )
|
||||
continue;
|
||||
|
||||
QgsVector3D contextScale = context.scale();
|
||||
QgsVector3D contextOffset = context.offset();
|
||||
if ( QgsCustomPointCloudBlock *customBlock = dynamic_cast<QgsCustomPointCloudBlock *>( block.get() ) )
|
||||
{
|
||||
context.setScale( customBlock->scale() );
|
||||
context.setOffset( customBlock->offset() );
|
||||
}
|
||||
|
||||
context.setScale( block->scale() );
|
||||
context.setOffset( block->offset() );
|
||||
|
||||
context.setAttributes( block->attributes() );
|
||||
|
||||
@ -307,11 +306,8 @@ int QgsPointCloudLayerRenderer::renderNodesAsync( const QVector<IndexedPointClou
|
||||
QgsVector3D contextScale = context.scale();
|
||||
QgsVector3D contextOffset = context.offset();
|
||||
|
||||
if ( QgsCustomPointCloudBlock *customBlock = dynamic_cast<QgsCustomPointCloudBlock *>( blockRequests[ i ]->block() ) )
|
||||
{
|
||||
context.setScale( customBlock->scale() );
|
||||
context.setOffset( customBlock->offset() );
|
||||
}
|
||||
context.setScale( blockRequests[ i ]->block()->scale() );
|
||||
context.setOffset( blockRequests[ i ]->block()->offset() );
|
||||
|
||||
context.setAttributes( blockRequests[ i ]->block()->attributes() );
|
||||
|
||||
|
||||
@ -139,7 +139,7 @@ QgsPointCloudBlockRequest *QgsRemoteEptPointCloudIndex::asyncNodeData( const Ind
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return new QgsPointCloudBlockRequest( n, fileUrl, mDataType, attributes(), request.attributes() );
|
||||
return new QgsPointCloudBlockRequest( n, fileUrl, mDataType, attributes(), request.attributes(), scale(), offset() );
|
||||
}
|
||||
|
||||
bool QgsRemoteEptPointCloudIndex::hasNode( const IndexedPointCloudNode &n ) const
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user