Skip to content

Commit

Permalink
qgsvectorelevationpropertieswidget: Add support for custom tolerance
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitjano committed Oct 25, 2024
1 parent 2e7d45e commit 22f8f74
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/app/vector/qgsvectorelevationpropertieswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ QgsVectorElevationPropertiesWidget::QgsVectorElevationPropertiesWidget( QgsVecto
mOffsetZSpinBox->setClearValue( 0 );
mScaleZSpinBox->setClearValue( 1 );
mExtrusionSpinBox->setClearValue( 0 );
mToleranceSpinBox->setClearValue( 0 );

mLineStyleButton->setSymbolType( Qgis::SymbolType::Line );
mFillStyleButton->setSymbolType( Qgis::SymbolType::Fill );
Expand Down Expand Up @@ -77,6 +78,7 @@ QgsVectorElevationPropertiesWidget::QgsVectorElevationPropertiesWidget( QgsVecto
connect( mElevationLimitSpinBox, qOverload<double >( &QDoubleSpinBox::valueChanged ), this, &QgsVectorElevationPropertiesWidget::onChanged );
connect( mExtrusionSpinBox, qOverload<double >( &QDoubleSpinBox::valueChanged ), this, &QgsVectorElevationPropertiesWidget::onChanged );
connect( mExtrusionGroupBox, &QGroupBox::toggled, this, &QgsVectorElevationPropertiesWidget::onChanged );
connect( mToleranceSpinBox, qOverload<double >( &QDoubleSpinBox::valueChanged ), this, &QgsVectorElevationPropertiesWidget::onChanged );
connect( mComboClamping, qOverload<int>( &QComboBox::currentIndexChanged ), this, &QgsVectorElevationPropertiesWidget::onChanged );
connect( mComboBinding, qOverload<int>( &QComboBox::currentIndexChanged ), this, &QgsVectorElevationPropertiesWidget::onChanged );
connect( mComboClamping, qOverload<int>( &QComboBox::currentIndexChanged ), this, &QgsVectorElevationPropertiesWidget::clampingChanged );
Expand Down Expand Up @@ -156,6 +158,8 @@ void QgsVectorElevationPropertiesWidget::syncToLayer( QgsMapLayer *layer )
mElevationLimitSpinBox->setValue( props->elevationLimit() );
mExtrusionGroupBox->setChecked( props->extrusionEnabled() );
mExtrusionSpinBox->setValue( props->extrusionHeight() );
mToleranceGroupBox->setChecked( props->customToleranceEnabled() );
mToleranceSpinBox->setValue( props->customTolerance() );
mTypeComboBox->setCurrentIndex( mTypeComboBox->findData( static_cast< int >( props->type() ) ) );
switch ( props->type() )
{
Expand Down Expand Up @@ -235,6 +239,8 @@ void QgsVectorElevationPropertiesWidget::apply()
props->setBinding( static_cast< Qgis::AltitudeBinding >( mComboBinding->currentData().toInt() ) );
props->setExtrusionEnabled( mExtrusionGroupBox->isChecked() );
props->setExtrusionHeight( mExtrusionSpinBox->value() );
props->setCustomToleranceEnabled( mToleranceGroupBox->isChecked() );
props->setCustomTolerance( mToleranceSpinBox->value() );
if ( mElevationLimitSpinBox->value() != mElevationLimitSpinBox->clearValue() )
props->setElevationLimit( mElevationLimitSpinBox->value() );
else
Expand Down
51 changes: 51 additions & 0 deletions src/ui/qgsvectorelevationpropertieswidgetbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,57 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="mToleranceGroupBox">
<property name="toolTip">
<string>If checked, the layer will use this tolerance instead of the one defined in the Elevation Profile widget.</string>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="title">
<string>Custom Tolerance</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="syncGroup" stdset="0">
<string notr="true">vectorgeneral</string>
</property>
<layout class="QGridLayout" name="gridLayout_Tolerance">
<item row="0" column="0">
<widget class="QLabel" name="label_Tolerance">
<property name="text">
<string>Tolerance</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QgsDoubleSpinBox" name="mToleranceSpinBox">
<property name="decimals">
<number>6</number>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>99999999999.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="Line" name="line_Tolerance">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
Expand Down

0 comments on commit 22f8f74

Please sign in to comment.