mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
Add epsg_nr to datum transform table
This commit is contained in:
parent
30900e9b89
commit
f624792255
BIN
resources/srs.db
BIN
resources/srs.db
Binary file not shown.
@ -2032,7 +2032,7 @@ bool QgsCoordinateReferenceSystem::syncDatumTransform( const QString& dbPath )
|
||||
{
|
||||
//not yet in database, do insert
|
||||
QgsDebugMsg( "Trying datum transform insert" );
|
||||
sql = QString( "INSERT INTO tbl_datum_transform ( coord_op_code, source_crs_code, target_crs_code, coord_op_method_code, p1, p2, p3, p4, p5, p6, p7 ) VALUES ( %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11 )" )
|
||||
sql = QString( "INSERT INTO tbl_datum_transform ( epsg_nr, coord_op_code, source_crs_code, target_crs_code, coord_op_method_code, p1, p2, p3, p4, p5, p6, p7 ) VALUES ( %1, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11 )" )
|
||||
.arg( coord_op ).arg( source_crs ).arg( target_crs ).arg( coord_op_method ).arg( p1 ).arg( p2 ).arg( p3 ).arg( p4 ).arg( p5 ).arg( p6 ).arg( p7 );
|
||||
|
||||
}
|
||||
|
@ -932,7 +932,7 @@ QString QgsCoordinateTransform::datumTransformString( int datumTransform )
|
||||
return transformString;
|
||||
}
|
||||
|
||||
bool QgsCoordinateTransform::datumTransformCrsInfo( int datumTransform, QString& srcProjection, QString& dstProjection )
|
||||
bool QgsCoordinateTransform::datumTransformCrsInfo( int datumTransform, int& epsgNr, QString& srcProjection, QString& dstProjection )
|
||||
{
|
||||
sqlite3* db;
|
||||
int openResult = sqlite3_open( QgsApplication::srsDbFilePath().toUtf8().constData(), &db );
|
||||
@ -943,7 +943,7 @@ bool QgsCoordinateTransform::datumTransformCrsInfo( int datumTransform, QString&
|
||||
}
|
||||
|
||||
sqlite3_stmt* stmt;
|
||||
QString sql = QString( "SELECT source_crs_code, target_crs_code FROM tbl_datum_transform WHERE coord_op_code = %1" ).arg( datumTransform );
|
||||
QString sql = QString( "SELECT epsg_nr, source_crs_code, target_crs_code FROM tbl_datum_transform WHERE coord_op_code = %1" ).arg( datumTransform );
|
||||
int prepareRes = sqlite3_prepare( db, sql.toAscii(), sql.size(), &stmt, NULL );
|
||||
if ( prepareRes != SQLITE_OK )
|
||||
{
|
||||
@ -954,8 +954,9 @@ bool QgsCoordinateTransform::datumTransformCrsInfo( int datumTransform, QString&
|
||||
int srcCrsId, destCrsId;
|
||||
if ( sqlite3_step( stmt ) == SQLITE_ROW )
|
||||
{
|
||||
srcCrsId = sqlite3_column_int( stmt, 0 );
|
||||
destCrsId = sqlite3_column_int( stmt, 1 );
|
||||
epsgNr = sqlite3_column_int( stmt, 0 );
|
||||
srcCrsId = sqlite3_column_int( stmt, 1 );
|
||||
destCrsId = sqlite3_column_int( stmt, 2 );
|
||||
}
|
||||
|
||||
QgsCoordinateReferenceSystem srcCrs;
|
||||
|
@ -214,8 +214,9 @@ 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 );
|
||||
/**Gets name of source and dest geographical CRS (to show in a tooltip)*/
|
||||
static bool datumTransformCrsInfo( int datumTransform, QString& srcProjection, QString& dstProjection );
|
||||
/**Gets name of source and dest geographical CRS (to show in a tooltip)
|
||||
@return epsgNr epsg code of the transformation (or 0 if not in epsg db)*/
|
||||
static bool datumTransformCrsInfo( int datumTransform, int& epsgNr, QString& srcProjection, QString& dstProjection );
|
||||
|
||||
int sourceDatumTransform() const { return mSourceDatumTransform; }
|
||||
void setSourceDatumTransform( int dt ) { mSourceDatumTransform = dt; }
|
||||
|
@ -44,9 +44,15 @@ QgsDatumTransformDialog::QgsDatumTransformDialog( const QString& layerName, cons
|
||||
|
||||
//Describe datums in a tooltip
|
||||
QString srcGeoProj, destGeoProj;
|
||||
if ( QgsCoordinateTransform::datumTransformCrsInfo( nr, srcGeoProj, destGeoProj ) )
|
||||
int epsgNr;
|
||||
if ( QgsCoordinateTransform::datumTransformCrsInfo( nr, epsgNr, srcGeoProj, destGeoProj ) )
|
||||
{
|
||||
QString toolTipString = QString( "EPSG Transformations Code: %1\nSource CRS: %2\nDestination CRS: %3" ).arg( nr ).arg( srcGeoProj ).arg( destGeoProj );
|
||||
QString toolTipString;
|
||||
if ( epsgNr > 0 )
|
||||
{
|
||||
toolTipString.append( QString( "EPSG Transformations Code: %1\n" ).arg( epsgNr ) );
|
||||
}
|
||||
toolTipString.append( QString( "Source CRS: %1\nDestination CRS: %2" ).arg( srcGeoProj ).arg( destGeoProj ) );
|
||||
item->setToolTip( i, toolTipString );
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user