Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid doing invalid range requests if a node has no points #56265

Merged
merged 1 commit into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/3d/symbols/qgspointcloud3dsymbol_p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,9 @@ std::unique_ptr<QgsPointCloudBlock> QgsPointCloud3DSymbolHandler::pointCloudBloc
}
else if ( pc->accessType() == QgsPointCloudIndex::AccessType::Remote )
{
if ( pc->nodePointCount( n ) < 1 )
return block;

bool loopAborted = false;
QEventLoop loop;
QgsPointCloudBlockRequest *req = pc->asyncNodeData( n, request );
Expand Down
3 changes: 3 additions & 0 deletions src/core/pointcloud/qgscopcpointcloudblockrequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ QgsCopcPointCloudBlockRequest::QgsCopcPointCloudBlockRequest( const IndexedPoint
: QgsPointCloudBlockRequest( node, uri, attributes, requestedAttributes, scale, offset, filterExpression, filterRect ),
mBlockOffset( blockOffset ), mBlockSize( blockSize ), mPointCount( pointCount ), mLazInfo( lazInfo )
{
// an empty block size will create an invalid range, causing a full request to the server
Q_ASSERT( mBlockSize > 0 );

QNetworkRequest nr = QNetworkRequest( QUrl( mUri ) );
QgsSetRequestInitiatorClass( nr, QStringLiteral( "QgsCopcPointCloudBlockRequest" ) );
QgsSetRequestInitiatorId( nr, node.toString() );
Expand Down
3 changes: 2 additions & 1 deletion src/core/pointcloud/qgspointcloudlayerprofilegenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,8 @@ QVector<IndexedPointCloudNode> QgsPointCloudLayerProfileGenerator::traverseTree(
if ( !mSearchGeometryInLayerCrsGeometryEngine->intersects( nodeMapGeometry.constGet() ) )
return nodes;

nodes.append( n );
if ( pc->nodePointCount( n ) > 0 )
nodes.append( n );

double childrenErrorPixels = nodeErrorPixels / 2.0;
if ( childrenErrorPixels < maxErrorPixels )
Expand Down
3 changes: 3 additions & 0 deletions src/core/pointcloud/qgspointcloudstatscalculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ struct StatsProcessor

QgsPointCloudStatistics operator()( IndexedPointCloudNode node )
{
if ( mIndex->nodePointCount( node ) < 1 )
return QgsPointCloudStatistics();

std::unique_ptr<QgsPointCloudBlock> block = nullptr;
if ( mIndex->accessType() == QgsPointCloudIndex::Local )
{
Expand Down
2 changes: 2 additions & 0 deletions src/core/pointcloud/qgsremotecopcpointcloudindex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ bool QgsRemoteCopcPointCloudIndex::isValid() const

void QgsRemoteCopcPointCloudIndex::fetchHierarchyPage( uint64_t offset, uint64_t byteSize ) const
{
Q_ASSERT( byteSize > 0 );

QNetworkRequest nr = QNetworkRequest( QUrl( mUri ) );
QgsSetRequestInitiatorClass( nr, QStringLiteral( "QgsRemoteCopcPointCloudIndex" ) );
nr.setAttribute( QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache );
Expand Down
Loading