Skip to content
Permalink
Browse files

Do not allow CRS changes in datum transform dialog when it has

been shown as a result of requiring the transform for a specific CRS pair

Sponsored by ICSM
  • Loading branch information
nyalldawson committed Mar 12, 2019
1 parent c534cc4 commit eab08d006cb7415ee3679fdec6ff65fec5c91db2
@@ -82,6 +82,7 @@ passed, the message will be a generic
.. versionadded:: 3.0
%End


signals:

void crsChanged( const QgsCoordinateReferenceSystem & );
@@ -197,7 +197,7 @@ QgsDatumTransformTableWidget::QgsDatumTransformTableWidget( QWidget *parent )

void QgsDatumTransformTableWidget::addDatumTransform()
{
QgsDatumTransformDialog dlg;
QgsDatumTransformDialog dlg( QgsCoordinateReferenceSystem(), QgsCoordinateReferenceSystem(), true );
if ( dlg.exec() )
{
QPair< QPair<QgsCoordinateReferenceSystem, int>, QPair<QgsCoordinateReferenceSystem, int > > dt = dlg.selectedDatumTransforms();
@@ -248,7 +248,7 @@ void QgsDatumTransformTableWidget::editDatumTransform()
if ( sourceCrs.isValid() && destinationCrs.isValid() &&
( sourceTransform != -1 || destinationTransform != -1 ) )
{
QgsDatumTransformDialog dlg( sourceCrs, destinationCrs, qMakePair( sourceTransform, destinationTransform ) );
QgsDatumTransformDialog dlg( sourceCrs, destinationCrs, true, qMakePair( sourceTransform, destinationTransform ) );
if ( dlg.exec() )
{
QPair< QPair<QgsCoordinateReferenceSystem, int>, QPair<QgsCoordinateReferenceSystem, int > > dt = dlg.selectedDatumTransforms();
@@ -28,7 +28,7 @@
#include <QPushButton>

QgsDatumTransformDialog::QgsDatumTransformDialog( const QgsCoordinateReferenceSystem &sourceCrs,
const QgsCoordinateReferenceSystem &destinationCrs,
const QgsCoordinateReferenceSystem &destinationCrs, const bool allowCrsChanges,
QPair<int, int> selectedDatumTransforms,
QWidget *parent,
Qt::WindowFlags f )
@@ -46,6 +46,14 @@ QgsDatumTransformDialog::QgsDatumTransformDialog( const QgsCoordinateReferenceSy

mSourceProjectionSelectionWidget->setCrs( sourceCrs );
mDestinationProjectionSelectionWidget->setCrs( destinationCrs );
if ( !allowCrsChanges )
{
mCrsStackedWidget->setCurrentIndex( 1 );
mSourceProjectionSelectionWidget->setEnabled( false );
mDestinationProjectionSelectionWidget->setEnabled( false );
mSourceCrsLabel->setText( QgsProjectionSelectionWidget::crsOptionText( sourceCrs ) );
mDestCrsLabel->setText( QgsProjectionSelectionWidget::crsOptionText( destinationCrs ) );
}

connect( mHideDeprecatedCheckBox, &QCheckBox::stateChanged, this, [ = ] { load(); } );
connect( mDatumTransformTableWidget, &QTableWidget::currentItemChanged, this, &QgsDatumTransformDialog::tableCurrentItemChanged );
@@ -42,6 +42,7 @@ class GUI_EXPORT QgsDatumTransformDialog : public QDialog, private Ui::QgsDatumT
*/
QgsDatumTransformDialog( const QgsCoordinateReferenceSystem &sourceCrs = QgsCoordinateReferenceSystem(),
const QgsCoordinateReferenceSystem &destinationCrs = QgsCoordinateReferenceSystem(),
bool allowCrsChanges = false,
QPair<int, int> selectedDatumTransforms = qMakePair( -1, -1 ),
QWidget *parent = nullptr,
Qt::WindowFlags f = nullptr );
@@ -7,14 +7,132 @@
<x>0</x>
<y>0</y>
<width>620</width>
<height>490</height>
<height>508</height>
</rect>
</property>
<property name="windowTitle">
<string>Select Datum Transformations</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<layout class="QGridLayout" name="gridLayout" rowstretch="0,3,1,0,0">
<item row="2" column="0">
<widget class="QLabel" name="mLabelSrcDescription">
<property name="text">
<string notr="true">Description</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QDialogButtonBox" name="mButtonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QStackedWidget" name="mCrsStackedWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QGridLayout" name="gridLayout_4" columnstretch="0,1">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Source CRS</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QgsProjectionSelectionWidget" name="mSourceProjectionSelectionWidget" native="true"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Destination CRS</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QgsProjectionSelectionWidget" name="mDestinationProjectionSelectionWidget" native="true"/>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_2">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QGridLayout" name="gridLayout_5" columnstretch="0,1">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Source CRS</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Destination CRS</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="mDestCrsLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="mSourceCrsLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
<item row="3" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
@@ -38,7 +156,7 @@
</item>
</layout>
</item>
<item row="2" column="0" colspan="2">
<item row="1" column="0" colspan="2">
<widget class="QTableWidget" name="mDatumTransformTableWidget">
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
@@ -48,7 +166,7 @@
</property>
</widget>
</item>
<item row="3" column="1">
<item row="2" column="1">
<widget class="QLabel" name="mLabelDstDescription">
<property name="text">
<string notr="true">Description</string>
@@ -61,65 +179,6 @@
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QDialogButtonBox" name="mButtonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="mLabelSrcDescription">
<property name="text">
<string notr="true">Description</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Source CRS</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QgsProjectionSelectionWidget" name="mSourceProjectionSelectionWidget" native="true"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Destination CRS</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QgsProjectionSelectionWidget" name="mDestinationProjectionSelectionWidget" native="true"/>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>

0 comments on commit eab08d0

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