Skip to content

Commit d92b886

Browse files
author
jef
committed
more case-insensitive projection searches
git-svn-id: http://svn.osgeo.org/qgis/trunk@13149 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 17d63d5 commit d92b886

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/gui/qgsprojectionselector.cpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -245,21 +245,21 @@ QString QgsProjectionSelector::ogcWmsCrsFilterAsSqlExpression( QSet<QString> * c
245245
if ( parts.size() < 2 )
246246
continue;
247247

248-
authParts[ parts.at( 0 )].append( parts.at( 1 ) );
248+
authParts[ parts.at( 0 ).toUpper()].append( parts.at( 1 ).toUpper() );
249249
}
250250

251251
if ( authParts.isEmpty() )
252252
return sqlExpression;
253253

254-
if( authParts.size() > 0 )
254+
if ( authParts.size() > 0 )
255255
{
256256
QString prefix = " AND (";
257257
foreach( QString auth_name, authParts.keys() )
258258
{
259-
sqlExpression += QString( "%1(lower(auth_name)=lower('%2') AND auth_id IN ('%3'))" )
260-
.arg( prefix )
261-
.arg( auth_name )
262-
.arg( authParts[auth_name].join( "','" ) );
259+
sqlExpression += QString( "%1(upper(auth_name)='%2' AND upper(auth_id) IN ('%3'))" )
260+
.arg( prefix )
261+
.arg( auth_name )
262+
.arg( authParts[auth_name].join( "','" ) );
263263
prefix = " OR ";
264264
}
265265
sqlExpression += ")";
@@ -620,7 +620,7 @@ long QgsProjectionSelector::selectedPostgresSrId()
620620

621621
QString QgsProjectionSelector::selectedAuthId()
622622
{
623-
return getSelectedExpression( "auth_name||':'||auth_id" );
623+
return getSelectedExpression( "upper(auth_name||':'||auth_id)" );
624624
}
625625

626626

@@ -788,7 +788,7 @@ void QgsProjectionSelector::loadCrsList( QSet<QString> * crsFilter )
788788
// Set up the query to retrieve the projection information needed to populate the list
789789
//note I am giving the full field names for clarity here and in case someone
790790
//changes the underlying view TS
791-
sql = QString( "select description, srs_id, auth_name||':'||auth_id, is_geo, name, parameters, deprecated from vw_srs where %1 order by name,description" )
791+
sql = QString( "select description, srs_id, upper(auth_name||':'||auth_id), is_geo, name, parameters, deprecated from vw_srs where %1 order by name,description" )
792792
.arg( sqlFilter );
793793

794794
rc = sqlite3_prepare( db, sql.toUtf8(), sql.toUtf8().length(), &ppStmt, &pzTail );
@@ -897,24 +897,24 @@ void QgsProjectionSelector::coordinateSystemSelected( QTreeWidgetItem * theItem
897897

898898
void QgsProjectionSelector::hideDeprecated( QTreeWidgetItem *item )
899899
{
900-
if( item->data( 0, Qt::UserRole ).toBool() )
900+
if ( item->data( 0, Qt::UserRole ).toBool() )
901901
{
902902
item->setHidden( cbxHideDeprecated->isChecked() );
903-
if( item->isSelected() && item->isHidden() )
903+
if ( item->isSelected() && item->isHidden() )
904904
{
905905
teProjection->setText( "" );
906906
item->setSelected( false );
907907
}
908908
}
909909

910-
for( int i=0; i < item->childCount(); i++ )
911-
hideDeprecated( item->child(i) );
910+
for ( int i = 0; i < item->childCount(); i++ )
911+
hideDeprecated( item->child( i ) );
912912
}
913913

914914
void QgsProjectionSelector::on_cbxHideDeprecated_stateChanged()
915915
{
916-
for( int i = 0; i<lstCoordinateSystems->topLevelItemCount(); i++ )
917-
hideDeprecated( lstCoordinateSystems->topLevelItem(i) );
916+
for ( int i = 0; i < lstCoordinateSystems->topLevelItemCount(); i++ )
917+
hideDeprecated( lstCoordinateSystems->topLevelItem( i ) );
918918
}
919919

920920
void QgsProjectionSelector::on_pbnPopular1_clicked()
@@ -946,14 +946,14 @@ void QgsProjectionSelector::on_pbnFind_clicked()
946946
QString mySql;
947947
if ( radAuthId->isChecked() )
948948
{
949-
mySql = QString( "select srs_id from tbl_srs where auth_name||':'||auth_id='%1'" ).arg( mySearchString );
949+
mySql = QString( "select srs_id from tbl_srs where upper(auth_name||':'||auth_id)='%1'" ).arg( mySearchString.toUpper() );
950950
}
951951
else if ( radName->isChecked() ) //name search
952952
{
953953
//we need to find what the largest srsid matching our query so we know whether to
954954
//loop backto the beginning
955-
mySql = "select srs_id from tbl_srs where description like '%" + mySearchString + "%'";
956-
if( cbxHideDeprecated->isChecked() )
955+
mySql = "select srs_id from tbl_srs where upper(description) like '%" + mySearchString.toUpper() + "%'";
956+
if ( cbxHideDeprecated->isChecked() )
957957
mySql += " and not deprecated";
958958
mySql += " order by srs_id desc limit 1";
959959
long myLargestSrsId = getLargestCRSIDMatch( mySql );
@@ -963,16 +963,16 @@ void QgsProjectionSelector::on_pbnFind_clicked()
963963
if ( myLargestSrsId <= selectedCrsId() )
964964
{
965965
//roll search around to the beginning
966-
mySql = "select srs_id from tbl_srs where description like '%" + mySearchString + "%'";
967-
if( cbxHideDeprecated->isChecked() )
966+
mySql = "select srs_id from tbl_srs where upper(description) like '%" + mySearchString.toUpper() + "%'";
967+
if ( cbxHideDeprecated->isChecked() )
968968
mySql += " and not deprecated";
969969
mySql += " order by srs_id limit 1";
970970
}
971971
else
972972
{
973973
// search ahead of the current position
974-
mySql = "select srs_id from tbl_srs where description like '%" + mySearchString + "%'";
975-
if( cbxHideDeprecated->isChecked() )
974+
mySql = "select srs_id from tbl_srs where upper(description) like '%" + mySearchString.toUpper() + "%'";
975+
if ( cbxHideDeprecated->isChecked() )
976976
mySql += " and not deprecated";
977977
mySql += " and srs_id > " + QString::number( selectedCrsId() ) + " order by srs_id limit 1";
978978
}

0 commit comments

Comments
 (0)