cleanup on e50f042

This commit is contained in:
Juergen E. Fischer 2013-09-15 16:55:32 +02:00
parent 078a941f85
commit 5d60b2840c

View File

@ -593,7 +593,6 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString theProj4String
}
}
QStringList myParam;
if ( myRecord.empty() )
{
// match all parameters individually:
@ -608,6 +607,7 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString theProj4String
// split on spaces followed by a plus sign (+) to deal
// also with parameters containing spaces (e.g. +nadgrids)
// make sure result is trimmed (#5598)
QStringList myParams;
foreach ( QString param, myProj4String.split( QRegExp( "\\s+(?=\\+)" ), QString::SkipEmptyParts ) )
{
QString arg = QString( "' '||parameters||' ' LIKE %1" ).arg( quotedValue( QString( "% %1 %" ).arg( param.trimmed() ) ) );
@ -619,7 +619,7 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString theProj4String
{
sql += delim + arg;
delim = " AND ";
myParam.append(param);
myParams << param.trimmed();
}
}
@ -633,32 +633,34 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString theProj4String
// datum might have disappeared in definition - retry without it
myRecord = getRecord( sql + " order by deprecated" );
}
if ( !myRecord.empty() )
{
// Bugfix 8487 : test param lists are equal, except for +datum
QStringList foundParams;
foreach ( QString param, myRecord["parameters"].split( QRegExp( "\\s+(?=\\+)" ), QString::SkipEmptyParts ) )
{
if ( !param.startsWith( "+datum=" ) )
foundParams << param.trimmed();
}
myParams.sort();
foundParams.sort();
if ( myParams != foundParams )
{
myRecord.clear();
}
}
}
if ( !myRecord.empty() )
{
mySrsId = myRecord["srs_id"].toLong();
QgsDebugMsg( "proj4string param match search for srsid returned srsid: " + QString::number( mySrsId ) );
// Bugfix 8487 : test param lists are equal, except for +datum
myParam.sort();
QStringList foundParam;
foreach ( QString paramfound, myRecord["parameters"].split( QRegExp( "\\s+(?=\\+)" ), QString::SkipEmptyParts ) )
if ( mySrsId > 0 )
{
if ( !paramfound.startsWith( "+datum=" ) )
foundParam.append(paramfound);
}
foundParam.sort();
if ( myParam == foundParam)
{
if ( mySrsId > 0 )
{
createFromSrsId( mySrsId );
}
}
else
{
// Params differ
mIsValidFlag = false;
createFromSrsId( mySrsId );
}
}
else