Skip to content

Commit

Permalink
Show datum transform parameters in datum transform selection dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Oct 23, 2013
1 parent e2148bc commit a919eed
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
Binary file modified resources/srs.db
Binary file not shown.
2 changes: 1 addition & 1 deletion src/core/qgscoordinatetransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ class CORE_EXPORT QgsCoordinateTransform : public QObject

/**Returns list of datum transformations for the given src and dest CRS*/
static QList< QList< int > > datumTransformations( const QgsCoordinateReferenceSystem& srcCRS, const QgsCoordinateReferenceSystem& destCRS );
static QString datumTransformString( int datumTransform );

int sourceDatumTransform() const { return mSourceDatumTransform; }
void setSourceDatumTransform( int dt ) { mSourceDatumTransform = dt; }
Expand Down Expand Up @@ -284,7 +285,6 @@ class CORE_EXPORT QgsCoordinateTransform : public QObject
/**Removes +nadgrids and +towgs84 from proj4 string*/
static QString stripDatumTransform( const QString& proj4 );
static void searchDatumTransform( const QString& sql, QList< int >& transforms );
static QString datumTransformString( int datumTransform );
};

//! Output stream operator
Expand Down
15 changes: 7 additions & 8 deletions src/gui/qgsdatumtransformdialog.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "qgsdatumtransformdialog.h"
#include "qgscoordinatetransform.h"

QgsDatumTransformDialog::QgsDatumTransformDialog( const QList< QList< int > >& dt, QWidget* parent, Qt::WindowFlags f ): QDialog( parent, f )
{
Expand All @@ -10,10 +11,11 @@ QgsDatumTransformDialog::QgsDatumTransformDialog( const QList< QList< int > >& d
QString itemText;
for ( int i = 0; i < 2; ++i )
{
itemText = QString::number( it->at( i ) );
if ( itemText.compare( "-1" ) != 0 )
int nr = it->at( i );
if ( nr != -1 )
{
item->setText( i, itemText );
item->setData( i, Qt::UserRole, nr );
item->setText( i, QgsCoordinateTransform::datumTransformString( nr ) );
}
}
mDatumTransformTreeWidget->addTopLevelItem( item );
Expand All @@ -37,15 +39,12 @@ QList< int > QgsDatumTransformDialog::selectedDatumTransform()
{
for ( int i = 0; i < 2; ++i )
{
bool conversionOk = false;
QString itemText = item->text( i );
int transformNr = itemText.toInt( &conversionOk );
if ( !itemText.isEmpty() && conversionOk )
int transformNr = item->data( i, Qt::UserRole ).toInt();
if ( transformNr != -1 )
{
list << transformNr;
}
}
}

return list;
}
9 changes: 7 additions & 2 deletions src/ui/qgsdatumtransformdialogbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string>Select datum transformations</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTreeWidget" name="mDatumTransformTreeWidget">
<column>
<property name="text">
<string/>
<string>src transform</string>
</property>
</column>
<column>
<property name="text">
<string>dst transform</string>
</property>
</column>
<column>
Expand Down

0 comments on commit a919eed

Please sign in to comment.