Skip to content
Permalink
Browse files

Apply z scale/offset when calculating attribute range in renderer wid…

…gets
  • Loading branch information
nyalldawson committed Dec 16, 2020
1 parent 7b141e9 commit 92c932b017c1126dbe4dc8edd6534f043556198b
@@ -25,6 +25,7 @@
#include "qgspointcloudclassifiedrenderer.h"
#include "qgsdoublevalidator.h"
#include "qgspointcloudclassifiedrendererwidget.h"
#include "qgspointcloudlayerelevationproperties.h"

QgsPointCloud3DSymbolWidget::QgsPointCloud3DSymbolWidget( QgsPointCloudLayer *layer, QgsPointCloud3DSymbol *symbol, QWidget *parent )
: QWidget( parent )
@@ -463,6 +464,11 @@ void QgsPointCloud3DSymbolWidget::rampAttributeChanged()
mProviderMin = std::numeric_limits< double >::quiet_NaN();
mProviderMax = std::numeric_limits< double >::quiet_NaN();
}

const double zScale = static_cast< const QgsPointCloudLayerElevationProperties * >( mLayer->elevationProperties() )->zScale();
const double zOffset = static_cast< const QgsPointCloudLayerElevationProperties * >( mLayer->elevationProperties() )->zOffset();
mProviderMin = mProviderMin * zScale + zOffset;
mProviderMax = mProviderMax * zScale + zOffset;
}
mScalarRecalculateMinMaxButton->setEnabled( !std::isnan( mProviderMin ) && !std::isnan( mProviderMax ) );
emitChangedSignal();
@@ -21,6 +21,7 @@
#include "qgspointcloudattributebyramprenderer.h"
#include "qgsdoublevalidator.h"
#include "qgsstyle.h"
#include "qgspointcloudlayerelevationproperties.h"

///@cond PRIVATE

@@ -103,6 +104,15 @@ void QgsPointCloudAttributeByRampRendererWidget::attributeChanged()
mProviderMin = std::numeric_limits< double >::quiet_NaN();
mProviderMax = std::numeric_limits< double >::quiet_NaN();
}

if ( mAttributeComboBox->currentAttribute().compare( QLatin1String( "z" ), Qt::CaseInsensitive ) == 0 )
{
const double zScale = static_cast< const QgsPointCloudLayerElevationProperties * >( mLayer->elevationProperties() )->zScale();
const double zOffset = static_cast< const QgsPointCloudLayerElevationProperties * >( mLayer->elevationProperties() )->zOffset();
mProviderMin = mProviderMin * zScale + zOffset;
mProviderMax = mProviderMax * zScale + zOffset;
}

}
mScalarRecalculateMinMaxButton->setEnabled( !std::isnan( mProviderMin ) && !std::isnan( mProviderMax ) );
emitWidgetChanged();
@@ -167,7 +167,7 @@
<item row="2" column="0" colspan="2">
<widget class="QgsColorRampShaderWidget" name="mColorRampShaderWidget" native="true"/>
</item>
<item row="1" column="0" colspan="2">
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1,0,1,0">
<item>
<widget class="QLabel" name="label_3">

0 comments on commit 92c932b

Please sign in to comment.
You can’t perform that action at this time.