Skip to content
Permalink
Browse files

Option to remember selected datum transformations

  • Loading branch information
mhugent committed Nov 11, 2013
1 parent 3278114 commit 7c98970cf4236f0e4356510462268bfd1be94fd0
@@ -53,3 +53,8 @@ QList< int > QgsDatumTransformDialog::selectedDatumTransform()
}
return list;
}

bool QgsDatumTransformDialog::rememberSelection() const
{
return mRememberSelectionCheckBox->isChecked();
}
@@ -10,6 +10,9 @@ class GUI_EXPORT QgsDatumTransformDialog: public QDialog, private Ui::QgsDatumTr
~QgsDatumTransformDialog();

QList< int > selectedDatumTransform();

bool rememberSelection() const;

private:
QgsDatumTransformDialog();
};
@@ -30,6 +30,7 @@ email : sherman at mrcc.com
#include <QPaintEvent>
#include <QPixmap>
#include <QRect>
#include <QSettings>
#include <QTextStream>
#include <QResizeEvent>
#include <QString>
@@ -1555,6 +1556,17 @@ void QgsMapCanvas::getDatumTransformInfo( const QgsMapLayer* ml, const QString&
return;
}

//check if default datum transformation available
QSettings s;
QString settingsString = "/Projections/" + srcAuthId + "//" + destAuthId;
QVariant defaultSrcTransform = s.value( settingsString + "_srcTransform" );
QVariant defaultDestTransform = s.value( settingsString + "_destTransform" );
if ( defaultSrcTransform.isValid() && defaultDestTransform.isValid() )
{
mMapRenderer->addLayerCoordinateTransform( ml->id(), srcAuthId, destAuthId, defaultSrcTransform.toInt(), defaultDestTransform.toInt() );
return;
}

const QgsCoordinateReferenceSystem& srcCRS = QgsCRSCache::instance()->crsByAuthId( srcAuthId );
const QgsCoordinateReferenceSystem& destCRS = QgsCRSCache::instance()->crsByAuthId( destAuthId );

@@ -1581,6 +1593,11 @@ void QgsMapCanvas::getDatumTransformInfo( const QgsMapLayer* ml, const QString&
destTransform = t.at( 1 );
}
mMapRenderer->addLayerCoordinateTransform( ml->id(), srcAuthId, destAuthId, srcTransform, destTransform );
if ( d.rememberSelection() )
{
s.setValue( settingsString + "_srcTransform", srcTransform );
s.setValue( settingsString + "_destTransform", destTransform );
}
}
else
{
@@ -14,6 +14,16 @@
<string>Select datum transformations</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<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">
<widget class="QTreeWidget" name="mDatumTransformTreeWidget">
<column>
@@ -34,12 +44,9 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
<widget class="QCheckBox" name="mRememberSelectionCheckBox">
<property name="text">
<string>Remember selection</string>
</property>
</widget>
</item>

0 comments on commit 7c98970

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