-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
Min/Max Value Settings for QgsPointCloudLayer #273
Comments
This would be a very much appreciated feature! However, can I request that we approach this in a different way to rasters? The raster approach worked ok-ish in the single-canvas world, but since it was implemented we've now got multi-canvas and 3d canvas at play (also layout maps). And the raster approach just doesn't work well anymore for these use cases. The issue comes from trying to update the renderer values from the calculated values during rendering. I'd much prefer to completely handle this in the renderer code alone, and omit any GUI updates of the calculated ranges. If your use case doesn't require an updated legend text then it would be relatively easy to remove the layer renderer -> renderer widget updates and completely remove refreshRendererIfNeeded. If this IS a requirement, then we need a different approach to handle this. I would instead go for an approach of allowing the layer renderers to report statistics collected during rendering back to the canvas. (There's already a similar mechanism used for handle errors reported by layer renderers, this could be reused with a flexible QVariantMap "calculatedRendererResults" object or similar). Then only the MAIN canvas would handle responding to the gathered statistics and updating the legend accordingly. |
@nyalldawson I think that the legend must be updated or the user won't be able to understand what's displayed, don't you think ? If I understand what you mean, you would prefer that the logic of For the legend update, could you indicate me where there is the mechanism that handle errors reported by layer renderers ? I don't see how I will be able to update the legend and the symbology widget. |
@nyalldawson From my understanding of QGIS, there is only one legend for each layer. How can we fix this without some major changes in code. I think it's out of the scope of this QEP to treat the issue of multiple legend. Is the proposed solution a No Go for you or can I start a PR ? |
That's completely fair enough. But in that case I'd ask that you omit the legend component and add the logic in the QgsPointCloudLayerRenderer class alone, and without any two-way logic to change the layer's renderer settings based on the results of rendering a particular extent. |
QGIS Enhancement: Min/Max Value Settings for QgsPointCloudLayer
Date 2023/05/24
Author Oslandia
Contact jean-marie.kerloch at oslandia dot com
maintainer @jmkerloch
Version QGIS 3.30
Summary
In
QgsRasterLayer
symbology for Multiband color / Singleband gray / Singleband pseudocolor renderers there is an option to define Min/Max values from layer statistics.Here user can define if the statistics are computed from Whole raster / Current canvas / Updated canvas
The goal of this QEP is to implement this behavior but for
QgsPointCloudLayer
. This will be available only for Attribute by Ramp renderer :QgsPointCloudAttributeByRampRenderer
.To avoid further development in the pointcloud interface, some options will not be available:
Proposed Solution
core
All created classes shall be in
src/core/pointcloud
directory.QgsPointCloudMinMaxOrigin
Introduction of new class for option definition :
QgsPointCloudMinMaxOrigin
We can reuse
QgsRasterMinMaxOrigin
class code but we may need to adapt it for PointCloud (noStatAccuracy
use for current statistics compute)There is also no cumulative cut calculation in
QgsPointCloudStatistics
, soCumulativeCut
will be removed.QgsPointCloudStatsCalculator
Adaptation of
QgsPointCloudStatsCalculator
to add option for extent filteringbool calculateStats( QgsFeedback *feedback, const QVector<QgsPointCloudAttribute> &attributes, qint64 pointsLimit = -1 , const QgsRectangle& extent = QgsRectangle());
If the extent is not null, filtering will be applied on the processed node before statistics computation.
QgsPointCloudAttributeByRampRenderer
Update of
QgsPointCloudAttributeByRampRenderer
to addmMinMaxOrigin
attribute, likeQgsRasterRenderer
:QgsPointCloudLayer
Update of
QgsPointCloudLayer
to check if renderer min/max should be calculatedLike QgsRasterLayer, add function
void refreshRendererIfNeeded( QgsPointCloudRenderer *rasterRenderer, const QgsRectangle &extent ) SIP_SKIP;
This will be called in
QgsPointCloudLayerRenderer
.In
void QgsPointCloudLayer::refreshRendererIfNeeded(QgsPointCloudRenderer *pointcloudRenderer, const QgsRectangle &extent)
check if the render is aQgsPointCloudAttributeByRampRenderer
and compute statistics on the displayed point cloud attributeQgsPointCloudLayerRenderer
QgsPointCloudLayerRenderer
must be updated to callrefreshRendererIfNeeded
fromQgsPointCloudLayer
gui
All created classes shall be in
src/gui/pointcloud
directory.QgsPointCloudMinMaxWidget
Introduction of new class for option definition :
QgsPointCloudMinMaxWidget
We can reuse
QgsRasterMinMaxWidget
with some adaptations:void load( int bandNo, double min, double max );
will be replaced byvoid load(const QString& attribute, double min, double max );
that will indicate when new min/max value are computed.For computation of min/max value, new parameter for extent filtering will be used with
QgsPointCloudStatsCalculator
.Statitics compute will be done only if needed, statistics from layer can be use.
QgsPointCloudAttributeByRampRendererWidget
Add
QgsPointCloudMinMaxWidget
inQgsPointCloudAttributeByRampRendererWidgetBase
We will connect to signal
void load(const QString& attribute, double min, double max );
and update user selected value for min/max definitionAffected Files
src/core/pointcloud/qgspointcloudstatscalculator.h
/src/core/pointcloud/qgspointcloudstatscalculator.cpp
Add option for extent filtering.
src/core/pointcloud/qgsattributebyramprenderer.h
Add attribute
mMinMaxOrigin
src/core/pointcloud/qgspointcloudlayer.h
/src/core/pointcloud/qgspointcloudlayer.cpp
Update renderer min/max value if needed
src/core/pointcloud/qgspointcloudlayerrenderer.cpp
Call
refreshRendererIfNeeded
fromQgsPointCloudLayer
src/gui/pointcloud/qgspointcloudattributebyramprendererwidget.h
/src/gui/pointcloud/qgspointcloudattributebyramprendererwidget.cpp
Connect to new
QgsPointCloudMinMaxWidget
widget for min/max definition.Performance Implications
Since we could be computing statistic at each map move with
UpdatedCanvas
extent option, there could be some overload in render.Backwards Compatibility
New option for min/max should be stored in settings. Default value will use None limits so there is no issue for backwards compatibility.
Votes
(required)
The text was updated successfully, but these errors were encountered: