Skip to content
Permalink
Browse files

use one spinbox instead of a slider

  • Loading branch information
NEDJIMAbelgacem authored and wonder-sk committed Feb 10, 2021
1 parent 5de28dd commit dca57c94f30231982ae19dea1e3a2e85540f9341
@@ -273,7 +273,6 @@ void QgsChunkedEntity::update( QgsChunkNode *root, const SceneState &state )
if ( renderedCount > mPrimitivesBudget )
break;


// ensure we have child nodes (at least skeletons) available, if any
if ( node->childCount() == -1 )
{
@@ -88,16 +88,9 @@ QgsPointCloud3DSymbolWidget::QgsPointCloud3DSymbolWidget( QgsPointCloudLayer *la
mRenderingStyleComboBox->setCurrentIndex( 0 );
mStackedWidget->setCurrentIndex( 0 );

mPointBudgetPercentageSlider->setMinimum( 0.0 );
mPointBudgetPercentageSlider->setMaximum( 100.0 );

mPointBudgetPercentage = std::min( 100.0, 100.0 * 1000000.0 / mLayer->pointCount() );
whileBlocking( mPointBudgetPercentageSlider ) ->setValue( mPointBudgetPercentage );
whileBlocking( mPointBudgetPercentageSpinBox ) ->setValue( mPointBudgetPercentage );

whileBlocking( mRenderedPointsSpinBox )->setMinimum( 0 );
whileBlocking( mRenderedPointsSpinBox )->setMaximum( mLayer->pointCount() + 1 );
whileBlocking( mRenderedPointsSpinBox )->setValue( 1000000 );
whileBlocking( mPointBudgetSpinBox )->setMinimum( 0 );
whileBlocking( mPointBudgetSpinBox )->setMaximum( mLayer->pointCount() + 1 );
whileBlocking( mPointBudgetSpinBox )->setValue( 1000000 );

if ( symbol )
setSymbol( symbol );
@@ -112,9 +105,8 @@ QgsPointCloud3DSymbolWidget::QgsPointCloud3DSymbolWidget( QgsPointCloudLayer *la
connect( mColorRampShaderMaxEdit, qgis::overload<double>::of( &QDoubleSpinBox::valueChanged ), this, &QgsPointCloud3DSymbolWidget::minMaxChanged );

connect( mMaxScreenErrorSpinBox, qgis::overload<double>::of( &QDoubleSpinBox::valueChanged ), this, [&]() { emitChangedSignal(); } );
connect( mPointBudgetPercentageSlider, &QSlider::valueChanged, this, &QgsPointCloud3DSymbolWidget::pointBudgetSliderChanged );
connect( mPointBudgetPercentageSpinBox, qgis::overload<double>::of( &QDoubleSpinBox::valueChanged ), this, &QgsPointCloud3DSymbolWidget::pointBudgetSpinBoxChanged );
connect( mShowBoundingBoxesCheckBox, &QCheckBox::stateChanged, [&]() { emitChangedSignal(); } );
connect( mPointBudgetSpinBox, qgis::overload<int>::of( &QSpinBox::valueChanged ), [&]() { emitChangedSignal(); } );

if ( !symbol ) // if we have a symbol, this was already handled in setSymbol above
rampAttributeChanged();
@@ -622,15 +614,12 @@ void QgsPointCloud3DSymbolWidget::setShowBoundingBoxes( bool showBoundingBoxes )

void QgsPointCloud3DSymbolWidget::setPointBudget( int budget )
{
mPointBudgetPercentage = 100.0 * budget / mLayer->pointCount();
whileBlocking( mPointBudgetPercentageSlider )->setValue( mPointBudgetPercentage );
whileBlocking( mPointBudgetPercentageSpinBox )->setValue( mPointBudgetPercentage );
whileBlocking( mRenderedPointsSpinBox )->setValue( budget );
whileBlocking( mPointBudgetSpinBox )->setValue( budget );
}

int QgsPointCloud3DSymbolWidget::pointBudget() const
{
return mPointBudgetPercentage * mLayer->pointCount() / 100.0f;
return mPointBudgetSpinBox->value();
}

double QgsPointCloud3DSymbolWidget::showBoundingBoxes() const
@@ -643,19 +632,3 @@ void QgsPointCloud3DSymbolWidget::connectChildPanels( QgsPanelWidget *parent )
parent->connectChildPanel( mClassifiedRendererWidget );
}

void QgsPointCloud3DSymbolWidget::pointBudgetSliderChanged( int value )
{
whileBlocking( mPointBudgetPercentageSpinBox )->setValue( value );
mPointBudgetPercentage = value;
mRenderedPointsSpinBox->setValue( mPointBudgetPercentage * mLayer->pointCount() / 100.0f );
emitChangedSignal();
}

void QgsPointCloud3DSymbolWidget::pointBudgetSpinBoxChanged( double percentage )
{
mPointBudgetPercentageSlider->setValue( percentage );
mPointBudgetPercentage = percentage;
mRenderedPointsSpinBox->setValue( mPointBudgetPercentage * mLayer->pointCount() / 100.0f );
emitChangedSignal();
}

@@ -65,8 +65,6 @@ class QgsPointCloud3DSymbolWidget : public QWidget, private Ui::QgsPointCloud3DS
void greenAttributeChanged();
void blueAttributeChanged();

void pointBudgetSliderChanged( int value );
void pointBudgetSpinBoxChanged( double budget );

signals:
void changed();
@@ -91,7 +89,7 @@ class QgsPointCloud3DSymbolWidget : public QWidget, private Ui::QgsPointCloud3DS
void minMaxModified();
void setMinMaxValue( const QgsContrastEnhancement *ce, QLineEdit *minEdit, QLineEdit *maxEdit );

double mPointBudgetPercentage;
int mPointBudget = 1000000;
};

#endif // QGSPOINTCLOUD3DSYMBOLWIDGET_H
@@ -43,30 +43,10 @@
</property>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout_7">
<item row="2" column="1">
<widget class="QSlider" name="mPointBudgetPercentageSlider">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Maximum number of rendered points:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelPointBudget">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QLabel" name="label">
<property name="text">
<string>Point budget percentage</string>
<string>Point budget</string>
</property>
</widget>
</item>
@@ -86,10 +66,26 @@
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QSpinBox" name="mRenderedPointsSpinBox">
<item row="2" column="1" colspan="2">
<widget class="QSpinBox" name="mPointBudgetSpinBox">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="maximum">
<number>99999999</number>
</property>
<property name="singleStep">
<number>10000</number>
</property>
<property name="value">
<number>1000000</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Maximum screen space error</string>
</property>
</widget>
</item>
@@ -106,20 +102,6 @@
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QDoubleSpinBox" name="mPointBudgetPercentageSpinBox">
<property name="maximum">
<double>100.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Maximum screen space error</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QgsDoubleSpinBox" name="mMaxScreenErrorSpinBox">
<property name="maximum">

0 comments on commit dca57c9

Please sign in to comment.