Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add point cloud elevation calibration button
  • Loading branch information
NEDJIMAbelgacem authored and nyalldawson committed Feb 16, 2021
1 parent 9eea594 commit 2337520
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 13 deletions.
10 changes: 10 additions & 0 deletions src/app/pointcloud/qgspointcloudelevationpropertieswidget.cpp
Expand Up @@ -33,6 +33,7 @@ QgsPointCloudElevationPropertiesWidget::QgsPointCloudElevationPropertiesWidget(

connect( mOffsetZSpinBox, qgis::overload<double >::of( &QDoubleSpinBox::valueChanged ), this, &QgsPointCloudElevationPropertiesWidget::onChanged );
connect( mScaleZSpinBox, qgis::overload<double >::of( &QDoubleSpinBox::valueChanged ), this, &QgsPointCloudElevationPropertiesWidget::onChanged );
connect( mShifPointCloudZAxisButton, &QPushButton::clicked, this, &QgsPointCloudElevationPropertiesWidget::shiftPointCloudZAxis );
}

void QgsPointCloudElevationPropertiesWidget::syncToLayer( QgsMapLayer *layer )
Expand Down Expand Up @@ -63,6 +64,15 @@ void QgsPointCloudElevationPropertiesWidget::onChanged()
emit widgetChanged();
}

void QgsPointCloudElevationPropertiesWidget::shiftPointCloudZAxis()
{
QgsDoubleRange range = mLayer->elevationProperties()->calculateZRange( mLayer );
if ( !range.isEmpty() )
{
mOffsetZSpinBox->setValue( -range.lower() + mOffsetZSpinBox->value() );
}
}

//
// QgsPointCloudElevationPropertiesWidgetFactory
//
Expand Down
Expand Up @@ -38,7 +38,7 @@ class QgsPointCloudElevationPropertiesWidget : public QgsMapLayerConfigWidget, p
private slots:

void onChanged();

void shiftPointCloudZAxis();
private:

QgsPointCloudLayer *mLayer = nullptr;
Expand Down
34 changes: 22 additions & 12 deletions src/ui/pointcloud/qgspointcloudelevationpropertieswidgetbase.ui
Expand Up @@ -57,6 +57,16 @@
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Elevation scaling and offset can be used to manually correct elevation values in the point cloud at render time.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;The scale is applied to the point cloud elevation values before adding the offset.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
Expand Down Expand Up @@ -84,20 +94,20 @@
</property>
</widget>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="Line" name="line_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Elevation scaling and offset can be used to manually correct elevation values in the point cloud at render time.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;The scale is applied to the point cloud elevation values before adding the offset.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<item row="3" column="0" colspan="2">
<widget class="QPushButton" name="mShifPointCloudZAxisButton">
<property name="toolTip">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
<property name="text">
<string>Shift point cloud Z axis</string>
</property>
</widget>
</item>
Expand All @@ -120,17 +130,17 @@
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QgsDoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header>qgsdoublespinbox.h</header>
</customwidget>
<customwidget>
<class>QgsCollapsibleGroupBox</class>
<extends>QGroupBox</extends>
<header>qgscollapsiblegroupbox.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QgsDoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header>qgsdoublespinbox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
Expand Down

0 comments on commit 2337520

Please sign in to comment.