Skip to content

Commit

Permalink
Fix #9396 (deactivate datum transform dialog by default)
Browse files Browse the repository at this point in the history
Added a checkbox in Options > CRS > Default datum transformations to re-enable the dialog when desired
  • Loading branch information
wonder-sk committed Feb 7, 2014
1 parent caf33b6 commit f3166a5
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 31 deletions.
5 changes: 5 additions & 0 deletions src/app/qgsoptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,9 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :

//default datum transformations
settings.beginGroup( "/Projections" );

chkShowDatumTransformDialog->setChecked( settings.value( "showDatumTransformDialog", false ).toBool() );

QStringList projectionKeys = settings.allKeys();

//collect src and dest entries that belong together
Expand Down Expand Up @@ -1197,6 +1200,8 @@ void QgsOptions::saveOptions()
settings.setValue( "/Projections/otfTransformEnabled", radOtfTransform->isChecked() );
settings.setValue( "/Projections/projectDefaultCrs", mDefaultCrs.authid() );

settings.setValue( "/Projections/showDatumTransformDialog", chkShowDatumTransformDialog->isChecked() );

if ( radFeet->isChecked() )
{
settings.setValue( "/qgis/measure/displayunits", QGis::toLiteral( QGis::Feet ) );
Expand Down
7 changes: 7 additions & 0 deletions src/gui/qgsmapcanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1575,6 +1575,13 @@ void QgsMapCanvas::getDatumTransformInfo( const QgsMapLayer* ml, const QString&
const QgsCoordinateReferenceSystem& srcCRS = QgsCRSCache::instance()->crsByAuthId( srcAuthId );
const QgsCoordinateReferenceSystem& destCRS = QgsCRSCache::instance()->crsByAuthId( destAuthId );

if ( !s.value( "/Projections/showDatumTransformDialog", false ).toBool() )
{
// just use the default transform
mMapRenderer->addLayerCoordinateTransform( ml->id(), srcAuthId, destAuthId, -1, -1 );
return;
}

//get list of datum transforms
QList< QList< int > > dt = QgsCoordinateTransform::datumTransformations( srcCRS, destCRS );
if ( dt.size() < 2 )
Expand Down
74 changes: 43 additions & 31 deletions src/ui/qgsoptionsbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>632</width>
<height>612</height>
<width>664</width>
<height>606</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_28">
Expand Down Expand Up @@ -923,9 +923,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-133</y>
<width>655</width>
<height>787</height>
<y>0</y>
<width>674</width>
<height>799</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_22">
Expand Down Expand Up @@ -1250,8 +1250,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>627</width>
<height>585</height>
<width>640</width>
<height>594</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_27">
Expand Down Expand Up @@ -1559,9 +1559,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-175</y>
<width>704</width>
<height>813</height>
<y>0</y>
<width>781</width>
<height>871</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_29">
Expand Down Expand Up @@ -1721,15 +1721,15 @@
</widget>
</item>
<item row="3" column="2">
<widget class="QgsScaleComboBox" name="mSimplifyMaximumScaleComboBox">
<widget class="QgsScaleComboBox" name="mSimplifyMaximumScaleComboBox" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</item>
</layout>
</widget>
</item>
Expand Down Expand Up @@ -2166,8 +2166,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>674</width>
<height>654</height>
<width>640</width>
<height>594</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_25">
Expand Down Expand Up @@ -2501,9 +2501,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-30</y>
<width>658</width>
<height>684</height>
<y>0</y>
<width>690</width>
<height>696</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_30">
Expand Down Expand Up @@ -2913,8 +2913,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>674</width>
<height>654</height>
<width>640</width>
<height>594</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_39">
Expand Down Expand Up @@ -3124,8 +3124,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>674</width>
<height>654</height>
<width>623</width>
<height>656</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_31">
Expand Down Expand Up @@ -3615,8 +3615,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>627</width>
<height>585</height>
<width>640</width>
<height>594</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
Expand Down Expand Up @@ -3745,8 +3745,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>650</width>
<height>679</height>
<width>707</width>
<height>697</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_15">
Expand Down Expand Up @@ -3902,7 +3902,7 @@
<string>Default datum transformations</string>
</property>
<layout class="QGridLayout" name="gridLayout_10">
<item row="0" column="0">
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_38">
<item>
<widget class="QPushButton" name="mAddDefaultTransformButton">
Expand Down Expand Up @@ -3941,7 +3941,7 @@
</item>
</layout>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="QTreeWidget" name="mDefaultDatumTransformTreeWidget">
<column>
<property name="text">
Expand All @@ -3965,6 +3965,13 @@
</column>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="chkShowDatumTransformDialog">
<property name="text">
<string>Ask for datum transformation when no default is defined</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down Expand Up @@ -3992,8 +3999,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>627</width>
<height>585</height>
<width>640</width>
<height>594</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_32">
Expand Down Expand Up @@ -4082,8 +4089,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>611</width>
<height>685</height>
<width>623</width>
<height>703</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_33">
Expand Down Expand Up @@ -4444,6 +4451,11 @@
<extends>QPushButton</extends>
<header>qgscolorbutton.h</header>
</customwidget>
<customwidget>
<class>QgsScaleComboBox</class>
<extends>QWidget</extends>
<header>qgsscalecombobox.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../../images/images.qrc"/>
Expand Down

0 comments on commit f3166a5

Please sign in to comment.