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 authored and wonder-sk committed Jan 8, 2025
1 parent 9f773aa commit 2a8cd53
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 51 deletions.
30 changes: 15 additions & 15 deletions python/PyQt6/core/auto_additions/qgis.py
Original file line number Diff line number Diff line change
Expand Up @@ -11116,21 +11116,6 @@
# --
Qgis.MeshRangeExtent.baseClass = Qgis
# monkey patching scoped based enum
Qgis.PointCloudZoomOutRenderBehavior.RenderExtents.__doc__ = "Render only point cloud extents when zoomed out"
Qgis.PointCloudZoomOutRenderBehavior.RenderOverview.__doc__ = "Render overview point cloud when zoomed out"
Qgis.PointCloudZoomOutRenderBehavior.RenderOverviewAndExtents.__doc__ = "Render point cloud extents over overview point cloud"
Qgis.PointCloudZoomOutRenderBehavior.__doc__ = """Point cloud zoom out options

.. versionadded:: 3.42

* ``RenderExtents``: Render only point cloud extents when zoomed out
* ``RenderOverview``: Render overview point cloud when zoomed out
* ``RenderOverviewAndExtents``: Render point cloud extents over overview point cloud

"""
# --
Qgis.PointCloudZoomOutRenderBehavior.baseClass = Qgis
# monkey patching scoped based enum
Qgis.PointCloudAccessType.Local.__doc__ = "Local means the source is a local file on the machine"
Qgis.PointCloudAccessType.Remote.__doc__ = "Remote means it's loaded through a protocol like HTTP"
Qgis.PointCloudAccessType.__doc__ = """The access type of the data, local is for local files and remote for remote files (over HTTP).
Expand All @@ -11145,6 +11130,21 @@
"""
# --
Qgis.PointCloudAccessType.baseClass = Qgis
# monkey patching scoped based enum
Qgis.PointCloudZoomOutRenderBehavior.RenderExtents.__doc__ = "Render only point cloud extents when zoomed out"
Qgis.PointCloudZoomOutRenderBehavior.RenderOverview.__doc__ = "Render overview point cloud when zoomed out"
Qgis.PointCloudZoomOutRenderBehavior.RenderOverviewAndExtents.__doc__ = "Render point cloud extents over overview point cloud"
Qgis.PointCloudZoomOutRenderBehavior.__doc__ = """Point cloud zoom out options

.. versionadded:: 3.42

* ``RenderExtents``: Render only point cloud extents when zoomed out
* ``RenderOverview``: Render overview point cloud when zoomed out
* ``RenderOverviewAndExtents``: Render point cloud extents over overview point cloud

"""
# --
Qgis.PointCloudZoomOutRenderBehavior.baseClass = Qgis
try:
Qgis.__attribute_docs__ = {'QGIS_DEV_VERSION': 'The development version', 'DEFAULT_SEARCH_RADIUS_MM': 'Identify search radius in mm', 'DEFAULT_MAPTOPIXEL_THRESHOLD': 'Default threshold between map coordinates and device coordinates for map2pixel simplification', 'DEFAULT_HIGHLIGHT_COLOR': 'Default highlight color. The transparency is expected to only be applied to polygon\nfill. Lines and outlines are rendered opaque.', 'DEFAULT_HIGHLIGHT_BUFFER_MM': 'Default highlight buffer in mm.', 'DEFAULT_HIGHLIGHT_MIN_WIDTH_MM': 'Default highlight line/stroke minimum width in mm.', 'SCALE_PRECISION': 'Fudge factor used to compare two scales. The code is often going from scale to scale\ndenominator. So it looses precision and, when a limit is inclusive, can lead to errors.\nTo avoid that, use this factor instead of using <= or >=.\n\n.. deprecated:: 3.40\n\n No longer used by QGIS and will be removed in QGIS 4.0.', 'DEFAULT_Z_COORDINATE': 'Default Z coordinate value.\nThis value have to be assigned to the Z coordinate for the vertex.', 'DEFAULT_M_COORDINATE': 'Default M coordinate value.\nThis value have to be assigned to the M coordinate for the vertex.\n\n.. versionadded:: 3.20', 'UI_SCALE_FACTOR': 'UI scaling factor. This should be applied to all widget sizes obtained from font metrics,\nto account for differences in the default font sizes across different platforms.', 'DEFAULT_SNAP_TOLERANCE': 'Default snapping distance tolerance.', 'DEFAULT_SNAP_UNITS': 'Default snapping distance units.'}
Qgis.version = staticmethod(Qgis.version)
Expand Down
12 changes: 6 additions & 6 deletions python/PyQt6/core/auto_generated/qgis.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -3249,19 +3249,19 @@ The development version
UpdatedCanvas,
};

enum class PointCloudAccessType /BaseType=IntEnum/
{
Local,
Remote
};

enum class PointCloudZoomOutRenderBehavior /BaseType=IntEnum/
{
RenderExtents,
RenderOverview,
RenderOverviewAndExtents
};

enum class PointCloudAccessType /BaseType=IntEnum/
{
Local,
Remote
};

static const double DEFAULT_SEARCH_RADIUS_MM;

static const float DEFAULT_MAPTOPIXEL_THRESHOLD;
Expand Down
30 changes: 15 additions & 15 deletions python/core/auto_additions/qgis.py
Original file line number Diff line number Diff line change
Expand Up @@ -11026,21 +11026,6 @@
# --
Qgis.MeshRangeExtent.baseClass = Qgis
# monkey patching scoped based enum
Qgis.PointCloudZoomOutRenderBehavior.RenderExtents.__doc__ = "Render only point cloud extents when zoomed out"
Qgis.PointCloudZoomOutRenderBehavior.RenderOverview.__doc__ = "Render overview point cloud when zoomed out"
Qgis.PointCloudZoomOutRenderBehavior.RenderOverviewAndExtents.__doc__ = "Render point cloud extents over overview point cloud"
Qgis.PointCloudZoomOutRenderBehavior.__doc__ = """Point cloud zoom out options

.. versionadded:: 3.42

* ``RenderExtents``: Render only point cloud extents when zoomed out
* ``RenderOverview``: Render overview point cloud when zoomed out
* ``RenderOverviewAndExtents``: Render point cloud extents over overview point cloud

"""
# --
Qgis.PointCloudZoomOutRenderBehavior.baseClass = Qgis
# monkey patching scoped based enum
Qgis.PointCloudAccessType.Local.__doc__ = "Local means the source is a local file on the machine"
Qgis.PointCloudAccessType.Remote.__doc__ = "Remote means it's loaded through a protocol like HTTP"
Qgis.PointCloudAccessType.__doc__ = """The access type of the data, local is for local files and remote for remote files (over HTTP).
Expand All @@ -11055,6 +11040,21 @@
"""
# --
Qgis.PointCloudAccessType.baseClass = Qgis
# monkey patching scoped based enum
Qgis.PointCloudZoomOutRenderBehavior.RenderExtents.__doc__ = "Render only point cloud extents when zoomed out"
Qgis.PointCloudZoomOutRenderBehavior.RenderOverview.__doc__ = "Render overview point cloud when zoomed out"
Qgis.PointCloudZoomOutRenderBehavior.RenderOverviewAndExtents.__doc__ = "Render point cloud extents over overview point cloud"
Qgis.PointCloudZoomOutRenderBehavior.__doc__ = """Point cloud zoom out options

.. versionadded:: 3.42

* ``RenderExtents``: Render only point cloud extents when zoomed out
* ``RenderOverview``: Render overview point cloud when zoomed out
* ``RenderOverviewAndExtents``: Render point cloud extents over overview point cloud

"""
# --
Qgis.PointCloudZoomOutRenderBehavior.baseClass = Qgis
from enum import Enum


Expand Down
12 changes: 6 additions & 6 deletions python/core/auto_generated/qgis.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -3249,19 +3249,19 @@ The development version
UpdatedCanvas,
};

enum class PointCloudAccessType
{
Local,
Remote
};

enum class PointCloudZoomOutRenderBehavior
{
RenderExtents,
RenderOverview,
RenderOverviewAndExtents
};

enum class PointCloudAccessType
{
Local,
Remote
};

static const double DEFAULT_SEARCH_RADIUS_MM;

static const float DEFAULT_MAPTOPIXEL_THRESHOLD;
Expand Down
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 2a8cd53

Please sign in to comment.