41
41
42
42
43
43
QgsProjectProperties::QgsProjectProperties ( QgsMapCanvas* mapCanvas, QWidget *parent, Qt::WFlags fl )
44
- : QDialog( parent, fl ), mMapCanvas( mapCanvas )
44
+ : QDialog( parent, fl )
45
+ , mMapCanvas( mapCanvas )
45
46
{
46
47
setupUi ( this );
47
48
connect ( buttonBox, SIGNAL ( accepted () ), this , SLOT ( accept () ) );
@@ -63,9 +64,9 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
63
64
cbxProjectionEnabled->setChecked ( myProjectionEnabled );
64
65
btnGrpMapUnits->setEnabled ( !myProjectionEnabled );
65
66
66
- long myCRSID = myRenderer->destinationCrs ().srsid ();
67
- QgsDebugMsg ( " Read project CRSID: " + QString::number ( myCRSID ) );
68
- projectionSelector->setSelectedCrsId ( myCRSID );
67
+ mProjectSrsId = myRenderer->destinationCrs ().srsid ();
68
+ QgsDebugMsg ( " Read project CRSID: " + QString::number ( mProjectSrsId ) );
69
+ projectionSelector->setSelectedCrsId ( mProjectSrsId );
69
70
70
71
// /////////////////////////////////////////////////////////
71
72
// Properties stored in QgsProject
@@ -112,6 +113,19 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
112
113
113
114
const QMap<QString, QgsMapLayer*> &mapLayers = QgsMapLayerRegistry::instance ()->mapLayers ();
114
115
116
+ if ( mMapCanvas ->currentLayer () )
117
+ {
118
+ mLayerSrsId = mMapCanvas ->currentLayer ()->crs ().srsid ();
119
+ }
120
+ else if ( mapLayers.size () > 0 )
121
+ {
122
+ mLayerSrsId = mapLayers.begin ().value ()->crs ().srsid ();
123
+ }
124
+ else
125
+ {
126
+ mLayerSrsId = mProjectSrsId ;
127
+ }
128
+
115
129
twIdentifyLayers->setColumnCount ( 3 );
116
130
twIdentifyLayers->horizontalHeader ()->setVisible ( true );
117
131
twIdentifyLayers->setHorizontalHeaderItem ( 0 , new QTableWidgetItem ( tr ( " Layer" ) ) );
@@ -454,6 +468,17 @@ void QgsProjectProperties::on_pbnCanvasColor_clicked()
454
468
void QgsProjectProperties::on_cbxProjectionEnabled_stateChanged ( int state )
455
469
{
456
470
btnGrpMapUnits->setEnabled ( state == Qt::Unchecked );
471
+
472
+ if ( state != Qt::Checked )
473
+ {
474
+ mProjectSrsId = projectionSelector->selectedCrsId ();
475
+ projectionSelector->setSelectedCrsId ( mLayerSrsId );
476
+ }
477
+ else
478
+ {
479
+ mLayerSrsId = projectionSelector->selectedCrsId ();
480
+ projectionSelector->setSelectedCrsId ( mProjectSrsId );
481
+ }
457
482
}
458
483
459
484
void QgsProjectProperties::setMapUnitsToCurrentProjection ()
@@ -541,7 +566,9 @@ void QgsProjectProperties::on_pbnWMSAddSRS_clicked()
541
566
void QgsProjectProperties::on_pbnWMSRemoveSRS_clicked ()
542
567
{
543
568
foreach ( QListWidgetItem *item, mWMSList ->selectedItems () )
544
- delete item;
569
+ {
570
+ delete item;
571
+ }
545
572
}
546
573
547
574
void QgsProjectProperties::on_pbnWMSSetUsedSRS_clicked ()
0 commit comments