diff --git a/src/core/pointcloud/qgspointcloudlayerrenderer.cpp b/src/core/pointcloud/qgspointcloudlayerrenderer.cpp index bdfc7976e8085..7194fe8184876 100644 --- a/src/core/pointcloud/qgspointcloudlayerrenderer.cpp +++ b/src/core/pointcloud/qgspointcloudlayerrenderer.cpp @@ -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 { @@ -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 ) @@ -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() ) diff --git a/src/core/providers/vpc/qgsvirtualpointcloudprovider.cpp b/src/core/providers/vpc/qgsvirtualpointcloudprovider.cpp index 9342c3c37ef5b..5d9d2cc19c9fc 100644 --- a/src/core/providers/vpc/qgsvirtualpointcloudprovider.cpp +++ b/src/core/providers/vpc/qgsvirtualpointcloudprovider.cpp @@ -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(); - 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 ) @@ -225,8 +225,8 @@ void QgsVirtualPointCloudProvider::parseFile() vpcDir.setFilter( QDir::Files ); if ( !vpcDir.entryList().empty() ) { - mOverview = std::make_unique(); - mOverview->load( vpcDir.absoluteFilePath( vpcDir.entryList().first() ) ); + mOverview = QgsPointCloudIndex( new QgsCopcPointCloudIndex() );; + mOverview.load( vpcDir.absoluteFilePath( vpcDir.entryList().first() ) ); } } diff --git a/src/core/providers/vpc/qgsvirtualpointcloudprovider.h b/src/core/providers/vpc/qgsvirtualpointcloudprovider.h index 27bf5736c7513..c9a49bb674f08 100644 --- a/src/core/providers/vpc/qgsvirtualpointcloudprovider.h +++ b/src/core/providers/vpc/qgsvirtualpointcloudprovider.h @@ -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. @@ -90,7 +90,7 @@ class CORE_EXPORT QgsVirtualPointCloudProvider: public QgsPointCloudDataProvider QVector mSubLayers; std::unique_ptr mPolygonBounds; QgsPointCloudAttributeCollection mAttributes; - std::unique_ptr mOverview; + QgsPointCloudIndex mOverview = QgsPointCloudIndex( nullptr ); QStringList mUriList; QgsRectangle mExtent;