Skip to content

Commit

Permalink
Fix issues introduced by PointCloudIndex refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Withalion committed Jan 7, 2025
1 parent f8222ae commit 368b18f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
7 changes: 4 additions & 3 deletions src/core/pointcloud/qgspointcloudlayerrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,12 @@ bool QgsPointCloudLayerRenderer::render()
}
const bool zoomedOut = renderExtent.width() > vpcProvider->averageSubIndexWidth() ||
renderExtent.height() > vpcProvider->averageSubIndexHeight();
QgsPointCloudIndex overviewIndex = vpcProvider->overview();
// if the overview of virtual point cloud exists, and we are zoomed out, we render just overview
if ( vpcProvider->overview() && zoomedOut &&
mRenderer->zoomOutBehavior() == Qgis::PointCloudZoomOutRenderBehavior::RenderOverview )
{
renderIndex( vpcProvider->overview() );
renderIndex( overviewIndex );
}
else
{
Expand All @@ -222,7 +223,7 @@ bool QgsPointCloudLayerRenderer::render()
if ( vpcProvider->overview() && zoomedOut &&
mRenderer->zoomOutBehavior() == Qgis::PointCloudZoomOutRenderBehavior::RenderOverviewAndExtents )
{
renderIndex( vpcProvider->overview() );
renderIndex( overviewIndex );
}
mSubIndexExtentRenderer->startRender( context );
for ( const QgsPointCloudSubIndex &si : visibleIndexes )
Expand All @@ -233,7 +234,7 @@ bool QgsPointCloudLayerRenderer::render()
QgsPointCloudIndex pc = si.index();
// if the index of point cloud is invalid, or we are zoomed out and want extents, we render the point cloud extent
if ( !pc || !pc.isValid() || ( ( mRenderer->zoomOutBehavior() == Qgis::PointCloudZoomOutRenderBehavior::RenderExtents || mRenderer->zoomOutBehavior() == Qgis::PointCloudZoomOutRenderBehavior::RenderOverviewAndExtents ) &&
zoomedOut ) )
zoomedOut ) )
{
mSubIndexExtentRenderer->renderExtent( si.polygonBounds(), context );
if ( mSubIndexExtentRenderer->showLabels() )
Expand Down
8 changes: 4 additions & 4 deletions src/core/providers/vpc/qgsvirtualpointcloudprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ void QgsVirtualPointCloudProvider::parseFile()
// look for vpc overview reference
if ( !mOverview && f["assets"].contains( "overview" ) && f["assets"]["overview"].contains( "href" ) )
{
mOverview = std::make_unique<QgsCopcPointCloudIndex>();
mOverview->load( fInfo.absoluteDir().absoluteFilePath( QString::fromStdString( f["assets"]["overview"]["href"] ) ) );
mOverview = QgsPointCloudIndex( new QgsCopcPointCloudIndex() );
mOverview.load( fInfo.absoluteDir().absoluteFilePath( QString::fromStdString( f["assets"]["overview"]["href"] ) ) );
}
// if it doesn't exist look for overview file in the directory
else if ( !mOverview )
Expand All @@ -225,8 +225,8 @@ void QgsVirtualPointCloudProvider::parseFile()
vpcDir.setFilter( QDir::Files );
if ( !vpcDir.entryList().empty() )
{
mOverview = std::make_unique<QgsCopcPointCloudIndex>();
mOverview->load( vpcDir.absoluteFilePath( vpcDir.entryList().first() ) );
mOverview = QgsPointCloudIndex( new QgsCopcPointCloudIndex() );;
mOverview.load( vpcDir.absoluteFilePath( vpcDir.entryList().first() ) );
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/core/providers/vpc/qgsvirtualpointcloudprovider.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class CORE_EXPORT QgsVirtualPointCloudProvider: public QgsPointCloudDataProvider
* Returns pointer to the overview index. May be NULLPTR if it doesn't exist.
* \since QGIS 3.42
*/
QgsPointCloudIndex *overview() const { return mOverview.get(); }
QgsPointCloudIndex overview() const { return mOverview; }

/**
* Returns the calculated average width of point clouds.
Expand All @@ -90,7 +90,7 @@ class CORE_EXPORT QgsVirtualPointCloudProvider: public QgsPointCloudDataProvider
QVector<QgsPointCloudSubIndex> mSubLayers;
std::unique_ptr<QgsGeometry> mPolygonBounds;
QgsPointCloudAttributeCollection mAttributes;
std::unique_ptr<QgsPointCloudIndex> mOverview;
QgsPointCloudIndex mOverview = QgsPointCloudIndex( nullptr );

QStringList mUriList;
QgsRectangle mExtent;
Expand Down

0 comments on commit 368b18f

Please sign in to comment.