Skip to content
Permalink
Browse files
cleanup on e50f042
  • Loading branch information
jef-n committed Sep 15, 2013
1 parent 078a941 commit 5d60b2840c3bb21578c7994fd029b96e0550b9d9
Showing with 23 additions and 21 deletions.
  1. +23 −21 src/core/qgscoordinatereferencesystem.cpp
@@ -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 ( !paramfound.startsWith( "+datum=" ) )
foundParam.append(paramfound);
}
foundParam.sort();
if ( myParam == foundParam)
{
if ( mySrsId > 0 )
{
createFromSrsId( mySrsId );
}
}
else
if ( mySrsId > 0 )
{
// Params differ
mIsValidFlag = false;
createFromSrsId( mySrsId );
}
}
else

0 comments on commit 5d60b28

Please sign in to comment.