@@ -641,46 +641,6 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString theProj4String
641
641
{
642
642
QgsDebugMsg ( " Projection is not found in databases." );
643
643
setProj4String ( myProj4String );
644
-
645
- // Is the SRS is valid now, we know it's a decent +proj string that can be entered into the srs.db
646
- if ( mIsValidFlag )
647
- {
648
- // but the proj.4 parsed string might already be in our database
649
- myRecord = getRecord ( " select * from tbl_srs where parameters=" + quotedValue ( toProj4 () ) + " order by deprecated" );
650
- if ( myRecord.empty () )
651
- {
652
- // It's not, so try to add it
653
- QgsDebugMsg ( " Projection appears to be valid. Save to database!" );
654
- mIsValidFlag = saveAsUserCRS ();
655
-
656
- if ( mIsValidFlag )
657
- {
658
- // but validate that it's there afterwards
659
- myRecord = getRecord ( " select * from tbl_srs where parameters=" + quotedValue ( toProj4 () ) + " order by deprecated" );
660
- }
661
- }
662
-
663
- if ( !myRecord.empty () )
664
- {
665
- // take the srid from the record
666
- mySrsId = myRecord[" srs_id" ].toLong ();
667
- QgsDebugMsg ( " proj4string match search for srsid returned srsid: " + QString::number ( mySrsId ) );
668
- if ( mySrsId > 0 )
669
- {
670
- createFromSrsId ( mySrsId );
671
- }
672
- else
673
- {
674
- QgsDebugMsg ( QString ( " invalid srid %1 found" ).arg ( mySrsId ) );
675
- mIsValidFlag = false ;
676
- }
677
- }
678
- else
679
- {
680
- QgsDebugMsg ( " Couldn't find newly added proj string?" );
681
- mIsValidFlag = false ;
682
- }
683
- }
684
644
}
685
645
686
646
return mIsValidFlag ;
@@ -1426,7 +1386,7 @@ QString QgsCoordinateReferenceSystem::validationHint()
1426
1386
// / Copied from QgsCustomProjectionDialog ///
1427
1387
// / Please refactor into SQL handler !!! ///
1428
1388
1429
- bool QgsCoordinateReferenceSystem::saveAsUserCRS ()
1389
+ bool QgsCoordinateReferenceSystem::saveAsUserCRS (QString name )
1430
1390
{
1431
1391
if ( ! mIsValidFlag )
1432
1392
{
@@ -1435,9 +1395,6 @@ bool QgsCoordinateReferenceSystem::saveAsUserCRS()
1435
1395
}
1436
1396
1437
1397
QString mySql;
1438
- QString myName = QString ( " * %1 (%2)" )
1439
- .arg ( QObject::tr ( " Generated CRS" , " A CRS automatically generated from layer info get this prefix for description" ) )
1440
- .arg ( toProj4 () );
1441
1398
1442
1399
// if this is the first record we need to ensure that its srs_id is 10000. For
1443
1400
// any rec after that sqlite3 will take care of the autonumering
@@ -1447,7 +1404,7 @@ bool QgsCoordinateReferenceSystem::saveAsUserCRS()
1447
1404
{
1448
1405
mySql = " insert into tbl_srs (srs_id,description,projection_acronym,ellipsoid_acronym,parameters,is_geo) values ("
1449
1406
+ QString::number ( USER_CRS_START_ID )
1450
- + " ," + quotedValue ( myName )
1407
+ + " ," + quotedValue ( name )
1451
1408
+ " ," + quotedValue ( projectionAcronym () )
1452
1409
+ " ," + quotedValue ( ellipsoidAcronym () )
1453
1410
+ " ," + quotedValue ( toProj4 () )
@@ -1456,7 +1413,7 @@ bool QgsCoordinateReferenceSystem::saveAsUserCRS()
1456
1413
else
1457
1414
{
1458
1415
mySql = " insert into tbl_srs (description,projection_acronym,ellipsoid_acronym,parameters,is_geo) values ("
1459
- + quotedValue ( myName )
1416
+ + quotedValue ( name )
1460
1417
+ " ," + quotedValue ( projectionAcronym () )
1461
1418
+ " ," + quotedValue ( ellipsoidAcronym () )
1462
1419
+ " ," + quotedValue ( toProj4 () )
0 commit comments