@@ -122,41 +122,31 @@ void QgsConfigParser::appendExGeographicBoundingBox( QDomElement& layerElem,
122122QStringList QgsConfigParser::createCRSListForLayer ( QgsMapLayer* theMapLayer ) const
123123{
124124 QStringList crsNumbers;
125- QgsVectorLayer* theVectorLayer = dynamic_cast <QgsVectorLayer*>( theMapLayer );
126-
127- if ( theVectorLayer ) // append the source SRS. In future, all systems supported by proj4 should be appended
125+ QString myDatabaseFileName = QgsApplication::srsDbFilePath ();
126+ sqlite3 *myDatabase;
127+ const char *myTail;
128+ sqlite3_stmt *myPreparedStatement;
129+ int myResult;
130+
131+ // check the db is available
132+ myResult = sqlite3_open ( myDatabaseFileName.toLocal8Bit ().data (), &myDatabase );
133+ if ( myResult )
128134 {
129- QString myDatabaseFileName = QgsApplication::srsDbFilePath ();
130- sqlite3 *myDatabase;
131- const char *myTail;
132- sqlite3_stmt *myPreparedStatement;
133- int myResult;
134-
135- // check the db is available
136- myResult = sqlite3_open ( myDatabaseFileName.toLocal8Bit ().data (), &myDatabase );
137- if ( myResult )
138- {
139- // if the database cannot be opened, add at least the epsg number of the source coordinate system
140- crsNumbers.push_back ( theMapLayer->crs ().authid () );
141- return crsNumbers;
142- };
143- QString mySql = " select upper(auth_name||':'||auth_id) from tbl_srs" ;
144- myResult = sqlite3_prepare ( myDatabase, mySql.toUtf8 (), mySql.length (), &myPreparedStatement, &myTail );
145- if ( myResult == SQLITE_OK )
135+ // if the database cannot be opened, add at least the epsg number of the source coordinate system
136+ crsNumbers.push_back ( theMapLayer->crs ().authid () );
137+ return crsNumbers;
138+ };
139+ QString mySql = " select upper(auth_name||':'||auth_id) from tbl_srs" ;
140+ myResult = sqlite3_prepare ( myDatabase, mySql.toUtf8 (), mySql.length (), &myPreparedStatement, &myTail );
141+ if ( myResult == SQLITE_OK )
142+ {
143+ while ( sqlite3_step ( myPreparedStatement ) == SQLITE_ROW )
146144 {
147- while ( sqlite3_step ( myPreparedStatement ) == SQLITE_ROW )
148- {
149- crsNumbers.push_back ( QString::fromUtf8 (( char * )sqlite3_column_text ( myPreparedStatement, 0 ) ) );
150- }
145+ crsNumbers.push_back ( QString::fromUtf8 (( char * )sqlite3_column_text ( myPreparedStatement, 0 ) ) );
151146 }
152- sqlite3_finalize ( myPreparedStatement );
153- sqlite3_close ( myDatabase );
154- }
155- else // rasters cannot be reprojected. Use the epsg number of the layers native CRS
156- {
157- crsNumbers.push_back ( theMapLayer->crs ().authid () );
158147 }
159- return crsNumbers;
148+ sqlite3_finalize ( myPreparedStatement );
149+ sqlite3_close ( myDatabase );
160150}
161151
162152bool QgsConfigParser::exGeographicBoundingBox ( const QDomElement& layerElement, QgsRectangle& rect ) const
0 commit comments