Skip to content
Permalink
Browse files

added some options

  • Loading branch information
3nids authored and nyalldawson committed Nov 24, 2017
1 parent 2b1f82f commit 3777aade5b9739f6218ba4fc651fcd971d1e642d
@@ -1,4 +1,5 @@
#include "qgsdatumtransformtablemodel.h"
#include "qgscoordinatetransform.h"

QgsDatumTransformTableModel::QgsDatumTransformTableModel( QObject *parent )
: QAbstractTableModel( parent )
@@ -27,8 +28,8 @@ int QgsDatumTransformTableModel::columnCount( const QModelIndex &parent ) const
QVariant QgsDatumTransformTableModel::data( const QModelIndex &index, int role ) const
{
QString sourceCrs;
int sourceTransform = -1;
QString destinationCrs;
int sourceTransform = -1;
int destinationTransform = -1;

if ( index.row() < mTransformContext.sourceDestinationDatumTransforms().count() )
@@ -41,7 +42,6 @@ QVariant QgsDatumTransformTableModel::data( const QModelIndex &index, int role )
destinationTransform = transforms.second;
}


switch ( role )
{
case Qt::DisplayRole:
@@ -50,11 +50,19 @@ QVariant QgsDatumTransformTableModel::data( const QModelIndex &index, int role )
case SourceCrsColumn:
return sourceCrs;
case SourceTransformColumn:
return sourceTransform;
if (sourceTransform != -1)
{
return QgsCoordinateTransform::datumTransformString( sourceTransform );
}
break;
case DestinationCrsColumn:
return destinationCrs;
case DestinationTransformColumn:
return destinationTransform;
if (sourceTransform != -1)
{
return QgsCoordinateTransform::datumTransformString( destinationTransform );
}
break;
default:
break;
}
@@ -457,7 +457,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
//default datum transformations
mSettings->beginGroup( QStringLiteral( "/Projections" ) );

chkShowDatumTransformDialog->setChecked( mSettings->value( QStringLiteral( "showDatumTransformDialog" ), false ).toBool() );
mShowDatumTransformDialogCheckBox->setChecked( mSettings->value( QStringLiteral( "showDatumTransformDialog" ), false ).toBool() );

QStringList projectionKeys = mSettings->allKeys();

@@ -1385,7 +1385,7 @@ void QgsOptions::saveOptions()
mSettings->setValue( QStringLiteral( "/Projections/layerDefaultCrs" ), mLayerDefaultCrs.authid() );
mSettings->setValue( QStringLiteral( "/Projections/projectDefaultCrs" ), mDefaultCrs.authid() );

mSettings->setValue( QStringLiteral( "/Projections/showDatumTransformDialog" ), chkShowDatumTransformDialog->isChecked() );
mSettings->setValue( QStringLiteral( "/Projections/showDatumTransformDialog" ), mShowDatumTransformDialogCheckBox->isChecked() );

//measurement settings

@@ -165,6 +165,9 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa
mDatumTransformTableView->setSelectionBehavior( QAbstractItemView::SelectRows );
connect( mDatumTransformAddButton, &QToolButton::clicked, this, &QgsProjectProperties::addDatumTransform );

bool show = mSettings->value( QStringLiteral( "showDatumTransformDialog" ), false ).toBool();
mShowDatumTransformDialogCheckBox->setChecked( show );

QPolygonF mainCanvasPoly = mapCanvas->mapSettings().visiblePolygon();
QgsGeometry g = QgsGeometry::fromQPolygonF( mainCanvasPoly );
// close polygon
@@ -797,7 +797,9 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_21">
<item>
<widget class="QgsProjectionSelectionTreeWidget" name="projectionSelector" native="true"/>
<widget class="QgsProjectionSelectionTreeWidget" name="projectionSelector" native="true">
<zorder>mDatumTransformGroupBox</zorder>
</widget>
</item>
</layout>
</widget>
@@ -808,7 +810,7 @@
<string>Datum transformations</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="2">
<item row="1" column="2">
<widget class="QToolButton" name="mDatumTransformEditButton">
<property name="text">
<string>...</string>
@@ -819,7 +821,7 @@
</property>
</widget>
</item>
<item row="0" column="1">
<item row="1" column="1">
<widget class="QToolButton" name="mDatumTransformRemoveButton">
<property name="text">
<string>...</string>
@@ -830,7 +832,10 @@
</property>
</widget>
</item>
<item row="0" column="0">
<item row="2" column="0" colspan="4">
<widget class="QTableView" name="mDatumTransformTableView"/>
</item>
<item row="1" column="0">
<widget class="QToolButton" name="mDatumTransformAddButton">
<property name="text">
<string>...</string>
@@ -841,7 +846,7 @@
</property>
</widget>
</item>
<item row="0" column="3">
<item row="1" column="3">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -854,8 +859,15 @@
</property>
</spacer>
</item>
<item row="1" column="0" colspan="4">
<widget class="QTableView" name="mDatumTransformTableView"/>
<item row="0" column="0" colspan="4">
<widget class="QCheckBox" name="mShowDatumTransformDialogCheckBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Ask for datum transformation if several are available (defined in global setting)</string>
</property>
</widget>
</item>
</layout>
<zorder>cbxProjectionEnabled</zorder>
@@ -864,6 +876,7 @@
<zorder>mDatumTransformRemoveButton</zorder>
<zorder>mDatumTransformEditButton</zorder>
<zorder>horizontalSpacer_5</zorder>
<zorder>mShowDatumTransformDialogCheckBox</zorder>
</widget>
</item>
</layout>

0 comments on commit 3777aad

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