Skip to content

Commit a575711

Browse files
committedJan 3, 2013
use project projections instead of WGS84 for WMS crs preselection (fixes #6939)
1 parent 5fefe38 commit a575711

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed
 

‎src/providers/wms/qgswmssourceselect.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ QgsWMSSourceSelect::QgsWMSSourceSelect( QWidget * parent, Qt::WFlags fl, bool ma
5959
, mManagerMode( managerMode )
6060
, mEmbeddedMode( embeddedMode )
6161
, mCurrentTileset( 0 )
62+
, mDefaultCRS( GEO_EPSG_CRS_AUTHID )
6263
{
6364
setupUi( this );
6465

@@ -117,7 +118,7 @@ QgsWMSSourceSelect::QgsWMSSourceSelect( QWidget * parent, Qt::WFlags fl, bool ma
117118
QgsCoordinateReferenceSystem currentRefSys( currentCRS, QgsCoordinateReferenceSystem::InternalCrsId );
118119
if ( currentRefSys.isValid() )
119120
{
120-
mCRS = currentRefSys.authid();
121+
mDefaultCRS = mCRS = currentRefSys.authid();
121122
}
122123
}
123124

@@ -409,6 +410,8 @@ bool QgsWMSSourceSelect::populateLayerList( QgsWmsProvider *wmsProvider )
409410
lstLayers->expandItem( lstLayers->topLevelItem( 0 ) );
410411
}
411412

413+
on_lstLayers_itemSelectionChanged();
414+
412415
return true;
413416
}
414417

@@ -741,7 +744,6 @@ void QgsWMSSourceSelect::on_lstLayers_itemSelectionChanged()
741744
mCurrentSelection = lstLayers->selectedItems();
742745
lstLayers->blockSignals( false );
743746

744-
745747
// selected layers with styles
746748
QStringList layers;
747749
QStringList styles;
@@ -801,7 +803,7 @@ void QgsWMSSourceSelect::on_lstLayers_itemSelectionChanged()
801803
defaultCRS = *it;
802804

803805
// prefer value of DEFAULT_GEO_EPSG_CRS_ID if available
804-
if ( *it == GEO_EPSG_CRS_AUTHID )
806+
if ( *it == mDefaultCRS )
805807
defaultCRS = *it;
806808
}
807809

@@ -813,7 +815,7 @@ void QgsWMSSourceSelect::on_lstLayers_itemSelectionChanged()
813815
}
814816

815817
}
816-
else if ( mCRSs.isEmpty() )
818+
else if ( layers.isEmpty() || mCRSs.isEmpty() )
817819
{
818820
mCRS = "";
819821
labelCoordRefSys->setText( "" );

‎src/providers/wms/qgswmssourceselect.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ class QgsWMSSourceSelect : public QDialog, private Ui::QgsWMSSourceSelectBase
133133
//! Selected CRS
134134
QString mCRS;
135135

136+
//! Default CRS
137+
QString mDefaultCRS;
138+
136139
//! Common CRSs for selected layers
137140
QSet<QString> mCRSs;
138141

0 commit comments

Comments
 (0)
Please sign in to comment.