Clean up after refactor

This commit is contained in:
David Koňařík 2024-11-25 12:38:18 +01:00 committed by Martin Dobias
parent 6598b21606
commit 0623832d3a
5 changed files with 23 additions and 20 deletions

View File

@ -182,12 +182,12 @@ int QgsPointCloudLayerChunkLoaderFactory::primitivesCount( QgsChunkNode *node )
static QgsBox3D nodeBoundsToBox3D( QgsBox3D nodeBounds, const QgsCoordinateTransform &coordinateTransform, double zValueOffset, double zValueScale ) static QgsBox3D nodeBoundsToBox3D( QgsBox3D nodeBounds, const QgsCoordinateTransform &coordinateTransform, double zValueOffset, double zValueScale )
{ {
QgsVector3D extentMin3D( static_cast<double>( nodeBounds.xMinimum() ), QgsVector3D extentMin3D( nodeBounds.xMinimum(),
static_cast<double>( nodeBounds.yMinimum() ), nodeBounds.yMinimum(),
static_cast<double>( nodeBounds.zMinimum() ) * zValueScale + zValueOffset ); nodeBounds.zMinimum() * zValueScale + zValueOffset );
QgsVector3D extentMax3D( static_cast<double>( nodeBounds.xMaximum() ), QgsVector3D extentMax3D( nodeBounds.xMaximum(),
static_cast<double>( nodeBounds.yMaximum() ), nodeBounds.yMaximum(),
static_cast<double>( nodeBounds.zMaximum() ) * zValueScale + zValueOffset ); nodeBounds.zMaximum() * zValueScale + zValueOffset );
QgsCoordinateTransform extentTransform = coordinateTransform; QgsCoordinateTransform extentTransform = coordinateTransform;
extentTransform.setBallparkTransformsAreAppropriate( true ); extentTransform.setBallparkTransformsAreAppropriate( true );
try try

View File

@ -57,15 +57,12 @@ typedef Qt3DCore::QGeometry Qt3DQGeometry;
#include <delaunator.hpp> #include <delaunator.hpp>
// pick a point that we'll use as origin for coordinates for this node's points // pick a point that we'll use as origin for coordinates for this node's points
static QgsVector3D originFromNodeBounds( QgsPointCloudIndex *pc, const QgsPointCloudNodeId &n, const QgsPointCloud3DRenderContext &context, const QgsPointCloudBlock *block ) static QgsVector3D originFromNodeBounds( QgsPointCloudIndex *pc, const QgsPointCloudNodeId &n, const QgsPointCloud3DRenderContext &context )
{ {
const QgsVector3D blockScale = block->scale();
const QgsVector3D blockOffset = block->offset();
QgsBox3D bounds = pc->getNode( n ).bounds(); QgsBox3D bounds = pc->getNode( n ).bounds();
double nodeOriginX = bounds.xMinimum() * blockScale.x() + blockOffset.x(); double nodeOriginX = bounds.xMinimum();
double nodeOriginY = bounds.yMinimum() * blockScale.y() + blockOffset.y(); double nodeOriginY = bounds.yMinimum();
double nodeOriginZ = ( bounds.zMinimum() * blockScale.z() + blockOffset.z() ) * context.zValueScale() + context.zValueFixedOffset(); double nodeOriginZ = bounds.zMinimum() * context.zValueScale() + context.zValueFixedOffset();
try try
{ {
context.coordinateTransform().transformInPlace( nodeOriginX, nodeOriginY, nodeOriginZ ); context.coordinateTransform().transformInPlace( nodeOriginX, nodeOriginY, nodeOriginZ );
@ -618,7 +615,7 @@ void QgsSingleColorPointCloud3DSymbolHandler::processNode( QgsPointCloudIndex *p
if ( !output ) if ( !output )
output = &outNormal; output = &outNormal;
output->positionsOrigin = originFromNodeBounds( pc, n, context, block.get() ); output->positionsOrigin = originFromNodeBounds( pc, n, context );
for ( int i = 0; i < count; ++i ) for ( int i = 0; i < count; ++i )
{ {
@ -743,7 +740,7 @@ void QgsColorRampPointCloud3DSymbolHandler::processNode( QgsPointCloudIndex *pc,
if ( !output ) if ( !output )
output = &outNormal; output = &outNormal;
output->positionsOrigin = originFromNodeBounds( pc, n, context, block.get() ); output->positionsOrigin = originFromNodeBounds( pc, n, context );
for ( int i = 0; i < count; ++i ) for ( int i = 0; i < count; ++i )
{ {
@ -865,7 +862,7 @@ void QgsRGBPointCloud3DSymbolHandler::processNode( QgsPointCloudIndex *pc, const
if ( !output ) if ( !output )
output = &outNormal; output = &outNormal;
output->positionsOrigin = originFromNodeBounds( pc, n, context, block.get() ); output->positionsOrigin = originFromNodeBounds( pc, n, context );
int ir = 0; int ir = 0;
int ig = 0; int ig = 0;
@ -1035,7 +1032,7 @@ void QgsClassificationPointCloud3DSymbolHandler::processNode( QgsPointCloudIndex
if ( !output ) if ( !output )
output = &outNormal; output = &outNormal;
output->positionsOrigin = originFromNodeBounds( pc, n, context, block.get() ); output->positionsOrigin = originFromNodeBounds( pc, n, context );
const QSet<int> filteredOutValues = context.getFilteredOutValues(); const QSet<int> filteredOutValues = context.getFilteredOutValues();
for ( int i = 0; i < count; ++i ) for ( int i = 0; i < count; ++i )

View File

@ -124,7 +124,7 @@ QgsBox3D QgsPointCloudNode::bounds() const
{ {
const QgsBox3D rootBounds = mIndex.rootNodeBounds(); const QgsBox3D rootBounds = mIndex.rootNodeBounds();
const double d = rootBounds.xMaximum() - rootBounds.xMinimum(); const double d = rootBounds.xMaximum() - rootBounds.xMinimum();
const double dLevel = ( double )d / pow( 2, mId.d() ); const double dLevel = d / pow( 2, mId.d() );
const double xMin = rootBounds.xMinimum() + dLevel * mId.x(); const double xMin = rootBounds.xMinimum() + dLevel * mId.x();
const double xMax = rootBounds.xMinimum() + dLevel * ( mId.x() + 1 ); const double xMax = rootBounds.xMinimum() + dLevel * ( mId.x() + 1 );

View File

@ -158,16 +158,21 @@ uint qHash( const QgsPointCloudCacheKey &key );
class CORE_EXPORT QgsPointCloudNode class CORE_EXPORT QgsPointCloudNode
{ {
public: public:
//! Constructs new node object. Should only be called by QgsPointCloudIndex::getNode()
QgsPointCloudNode( const QgsPointCloudIndex &index, QgsPointCloudNodeId id, qint64 pointCount, QgsPointCloudNode( const QgsPointCloudIndex &index, QgsPointCloudNodeId id, qint64 pointCount,
QList<QgsPointCloudNodeId> childIds ) QList<QgsPointCloudNodeId> childIds )
: mIndex( index ), mId( id ), mPointCount( pointCount ), mChildIds( childIds ) : mIndex( index ), mId( id ), mPointCount( pointCount ), mChildIds( childIds )
{ {
} }
//! Returns node's ID (unique in index)
QgsPointCloudNodeId id() const { return mId; } QgsPointCloudNodeId id() const { return mId; }
//! Returns number of points contained in node data
qint64 pointCount() const { return mPointCount; } qint64 pointCount() const { return mPointCount; }
//! Returns IDs of child nodes
QList<QgsPointCloudNodeId> children() const { return mChildIds; } QList<QgsPointCloudNodeId> children() const { return mChildIds; }
//! Returns node's error in map units (used to determine in whether the node has enough detail for the current view) //! Returns node's error in map units (used to determine in whether the node has enough detail for the current view)
float error() const; float error() const;
//! Returns node's bounding cube in CRS coords
QgsBox3D bounds() const; QgsBox3D bounds() const;
private: private:
@ -247,6 +252,7 @@ class CORE_EXPORT QgsPointCloudIndex
//! Returns whether the octree contain given node //! Returns whether the octree contain given node
virtual bool hasNode( const QgsPointCloudNodeId &n ) const; virtual bool hasNode( const QgsPointCloudNodeId &n ) const;
//! Returns object for a given node
virtual QgsPointCloudNode getNode( const QgsPointCloudNodeId &id ) const; virtual QgsPointCloudNode getNode( const QgsPointCloudNodeId &id ) const;
//! Returns all attributes that are stored in the file //! Returns all attributes that are stored in the file

View File

@ -478,9 +478,9 @@ void TestQgsPointCloud3DRendering::testPointCloudFilteredClassification()
// find a better fix in the future. // find a better fix in the future.
QImage img = Qgs3DUtils::captureSceneImage( engine, scene ); QImage img = Qgs3DUtils::captureSceneImage( engine, scene );
QGSVERIFYIMAGECHECK( "pointcloud_3d_filtered_classification", "pointcloud_3d_filtered_classification", img, QString(), 80, QSize( 0, 0 ), 15 );
mLayer->setSubsetString( "" ); mLayer->setSubsetString( "" );
QGSVERIFYIMAGECHECK( "pointcloud_3d_filtered_classification", "pointcloud_3d_filtered_classification", img, QString(), 80, QSize( 0, 0 ), 15 );
} }
void TestQgsPointCloud3DRendering::testPointCloudFilteredSceneExtent() void TestQgsPointCloud3DRendering::testPointCloudFilteredSceneExtent()