Skip to content

Commit

Permalink
Address reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
NEDJIMAbelgacem authored and wonder-sk committed Dec 8, 2020
1 parent 14ff8e3 commit 088d30a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/3d/qgspointcloudlayer3drenderer.cpp
Expand Up @@ -147,7 +147,7 @@ void QgsPointCloudLayer3DRenderer::readXml( const QDomElement &elem, const QgsRe

const QString symbolType = elemSymbol.attribute( QStringLiteral( "type" ) );
mMaximumScreenError = elem.attribute( QStringLiteral( "max-screen-error" ), QStringLiteral( "1.0" ) ).toDouble();
mShowBoundingBoxes = elem.attribute( QStringLiteral( "show-bounding-boxes" ), "0" ).toInt();
mShowBoundingBoxes = elem.attribute( QStringLiteral( "show-bounding-boxes" ), QStringLiteral( "0" ) ).toInt();

if ( symbolType == QLatin1String( "single-color" ) )
mSymbol.reset( new QgsSingleColorPointCloud3DSymbol );
Expand Down
31 changes: 9 additions & 22 deletions src/app/3d/qgspointcloud3dsymbolwidget.cpp
Expand Up @@ -99,8 +99,8 @@ QgsPointCloud3DSymbolWidget::QgsPointCloud3DSymbolWidget( QgsPointCloudLayer *la
connect( mColorRampShaderMinEdit, qgis::overload<double>::of( &QDoubleSpinBox::valueChanged ), this, &QgsPointCloud3DSymbolWidget::minMaxChanged );
connect( mColorRampShaderMaxEdit, qgis::overload<double>::of( &QDoubleSpinBox::valueChanged ), this, &QgsPointCloud3DSymbolWidget::minMaxChanged );

connect( mMaxScreenErrorSpinBox, qgis::overload<double>::of( &QDoubleSpinBox::valueChanged ), this, &QgsPointCloud3DSymbolWidget::maximumScreenErrorChanged );
connect( mShowBoundingBoxesCheckBox, &QCheckBox::stateChanged, this, &QgsPointCloud3DSymbolWidget::showBoundingBoxesChanged );
connect( mMaxScreenErrorSpinBox, qgis::overload<double>::of( &QDoubleSpinBox::valueChanged ), this, [&]() { emitChangedSignal(); } );
connect( mShowBoundingBoxesCheckBox, &QCheckBox::stateChanged, [&]() { emitChangedSignal(); } );

This comment has been minimized.

Copy link
@m-kuhn

m-kuhn Dec 8, 2020

Member

FYI, you can also connect signals to signals


rampAttributeChanged();

Expand Down Expand Up @@ -561,33 +561,20 @@ void QgsPointCloud3DSymbolWidget::blueAttributeChanged()

void QgsPointCloud3DSymbolWidget::setMaximumScreenError( double maxScreenError )
{
mMaxScreenErrorSpinBox->setValue( maxScreenError );
mMaximumScreenError = maxScreenError;
whileBlocking( mMaxScreenErrorSpinBox )->setValue( maxScreenError );
}

void QgsPointCloud3DSymbolWidget::maximumScreenErrorChanged( double maxScreenError )
double QgsPointCloud3DSymbolWidget::maximumScreenError() const
{
if ( maxScreenError == mMaximumScreenError )
return;
mMaximumScreenError = maxScreenError;
emitChangedSignal();
return mMaxScreenErrorSpinBox->value();
}

void QgsPointCloud3DSymbolWidget::showBoundingBoxesChanged( int checkBoxState )
void QgsPointCloud3DSymbolWidget::setShowBoundingBoxes( bool showBoundingBoxes )
{
Q_UNUSED( checkBoxState );
bool showBoundingBoxes = mShowBoundingBoxesCheckBox->isChecked();
if ( showBoundingBoxes == mShowBoundingBoxes )
return;
mShowBoundingBoxes = showBoundingBoxes;
emitChangedSignal();
whileBlocking( mShowBoundingBoxesCheckBox )->setChecked( showBoundingBoxes );
}

void QgsPointCloud3DSymbolWidget::setShowBoundingBoxes( bool showBoundingBoxes )
double QgsPointCloud3DSymbolWidget::showBoundingBoxes() const
{
if ( showBoundingBoxes == mShowBoundingBoxes )
return;
mShowBoundingBoxesCheckBox->setChecked( showBoundingBoxes );
mShowBoundingBoxes = showBoundingBoxes;
emitChangedSignal();
return mShowBoundingBoxesCheckBox->isChecked();
}
8 changes: 2 additions & 6 deletions src/app/3d/qgspointcloud3dsymbolwidget.h
Expand Up @@ -35,9 +35,9 @@ class QgsPointCloud3DSymbolWidget : public QWidget, private Ui::QgsPointCloud3DS
QgsPointCloud3DSymbol *symbol() const;

void setMaximumScreenError( double maxScreenError );
double maximumScreenError() const { return mMaximumScreenError; }
double maximumScreenError() const;
void setShowBoundingBoxes( bool showBoundingBoxes );
double showBoundingBoxes() const { return mShowBoundingBoxes; }
double showBoundingBoxes() const;

private slots:
void reloadColorRampShaderMinMax();
Expand All @@ -56,8 +56,6 @@ class QgsPointCloud3DSymbolWidget : public QWidget, private Ui::QgsPointCloud3DS
void redAttributeChanged();
void greenAttributeChanged();
void blueAttributeChanged();
void maximumScreenErrorChanged( double maxScreenError );
void showBoundingBoxesChanged( int state );

signals:
void changed();
Expand All @@ -72,8 +70,6 @@ class QgsPointCloud3DSymbolWidget : public QWidget, private Ui::QgsPointCloud3DS
QgsPointCloudLayer *mLayer = nullptr;

bool mBlockMinMaxChanged = false;
double mMaximumScreenError = 1.0f;
bool mShowBoundingBoxes = false;

double mProviderMin = std::numeric_limits< double >::quiet_NaN();
double mProviderMax = std::numeric_limits< double >::quiet_NaN();
Expand Down
4 changes: 2 additions & 2 deletions src/ui/3d/qgspointcloud3dsymbolwidget.ui
Expand Up @@ -78,7 +78,7 @@
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="mShowBoundingBoxesCheckBox">
<property name="text">
<string>Show point cloud bounding boxes</string>
<string>Show bounding boxes</string>
</property>
</widget>
</item>
Expand All @@ -88,7 +88,7 @@
<item row="2" column="0" colspan="3">
<widget class="QStackedWidget" name="mStackedWidget">
<property name="currentIndex">
<number>4</number>
<number>2</number>
</property>
<widget class="QWidget" name="noRendererPage"/>
<widget class="QWidget" name="singleColorRendererPage">
Expand Down

0 comments on commit 088d30a

Please sign in to comment.