Skip to content

Commit 9cd3ef0

Browse files
committedJun 6, 2017
Use invalid CRS as default in map settings
I have got caught by the default set to WGS 84 when I loaded a layer in projected CRS, set extent to layer's extent and... nothing got rendered because map renderer was reprojecting to WGS 84. This default is closer to the default in 2.x where reprojection is turned off.
1 parent 362d4f0 commit 9cd3ef0

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed
 

‎doc/api_break.dox

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1598,6 +1598,7 @@ be returned instead of a null pointer if no transformation is required.
15981598
- destinationCrs() now returns a copy instead of a reference to the CRS. This has no effect on PyQGIS code, but c++
15991599
plugins calling this method will need to be updated.
16001600
- setCrsTransformEnabled() and hasCrsTransformEnabled() were removed. CRS transformation is now always enabled.
1601+
- the default destination CRS has changed from WGS 84 to invalid CRS (i.e. undefined, no reprojection will be done).
16011602
- setMapUnits() was removed. The map units are dictated by the units for the destination CRS.
16021603

16031604

‎src/core/qgsmapsettings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ QgsMapSettings::QgsMapSettings()
3737
, mExtent()
3838
, mRotation( 0.0 )
3939
, mMagnificationFactor( 1.0 )
40-
, mDestCRS( QgsCoordinateReferenceSystem::fromSrsId( GEOCRS_ID ) ) // WGS 84
40+
, mDestCRS()
4141
, mDatumTransformStore( mDestCRS )
4242
, mBackgroundColor( Qt::white )
4343
, mSelectionColor( Qt::yellow )

‎tests/src/core/testqgsmapsettings.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class TestQgsMapSettings: public QObject
3434
private slots:
3535
void initTestCase();
3636
void cleanupTestCase();
37+
void testDefaults();
3738
void visibleExtent();
3839
void mapUnitsPerPixel();
3940
void visiblePolygon();
@@ -73,6 +74,12 @@ QString TestQgsMapSettings::toString( const QPolygonF &p, int dec ) const
7374
return s;
7475
}
7576

77+
void TestQgsMapSettings::testDefaults()
78+
{
79+
QgsMapSettings ms;
80+
QCOMPARE( ms.destinationCrs(), QgsCoordinateReferenceSystem() );
81+
}
82+
7683
void TestQgsMapSettings::visibleExtent()
7784
{
7885
QgsMapSettings ms;

0 commit comments

Comments
 (0)
Please sign in to comment.