Skip to content
Permalink
Browse files

QgsMapLayer::crs() now returns a copy, not a reference

(desirable because QgsCoordinateReferenceSystem is implicitly shared)
  • Loading branch information
nyalldawson committed Jul 14, 2016
1 parent a2efab0 commit 726569c6bca581a23fd3adb978a726264556efb5
Showing with 9 additions and 4 deletions.
  1. +6 −0 doc/api_break.dox
  2. +1 −1 python/core/qgsmaplayer.sip
  3. +1 −1 src/core/qgsmaplayer.cpp
  4. +1 −2 src/core/qgsmaplayer.h
@@ -41,6 +41,12 @@ objects are implicitly shared, returning a copy helps simplify and make code mor
only affects third party c++ providers, and does not affect PyQGIS scripts.</li>
</ul>

\subsection qgis_api_break_3_0_QgsMapLayer QgsMapLayer

<ul>
<li>crs() now returns a QgsCoordinateReferenceSystem object, not a reference. This change has no effect for PyQGIS code.</li>
</ul>

\subsection qgis_api_break_3_0_QgsVectorLayerImport QgsVectorLayerImport

<ul>
@@ -359,7 +359,7 @@ class QgsMapLayer : QObject
/** Returns layer's spatial reference system
@note This was introduced in QGIS 1.4
*/
const QgsCoordinateReferenceSystem& crs() const;
QgsCoordinateReferenceSystem crs() const;

/** Sets layer's spatial reference system */
void setCrs( const QgsCoordinateReferenceSystem& srs, bool emitSignal = true );
@@ -1008,7 +1008,7 @@ void QgsMapLayer::setSubLayerVisibility( const QString& name, bool vis )
// NOOP
}

const QgsCoordinateReferenceSystem& QgsMapLayer::crs() const
QgsCoordinateReferenceSystem QgsMapLayer::crs() const
{
return mCRS;
}
@@ -378,8 +378,7 @@ class CORE_EXPORT QgsMapLayer : public QObject
/** Returns layer's spatial reference system
@note This was introduced in QGIS 1.4
*/
//TODO QGIS 3.0 - return QgsCoordinateReferenceSystem object, not reference (since they are implicitly shared)
const QgsCoordinateReferenceSystem& crs() const;
QgsCoordinateReferenceSystem crs() const;

/** Sets layer's spatial reference system */
void setCrs( const QgsCoordinateReferenceSystem& srs, bool emitSignal = true );

0 comments on commit 726569c

Please sign in to comment.
You can’t perform that action at this time.