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

(desirable because QgsCoordinateReferenceSystem is implicitly shared)
This commit is contained in:
Nyall Dawson 2016-07-11 14:46:08 +10:00
parent a2efab0485
commit 726569c6bc
4 changed files with 9 additions and 4 deletions

View File

@ -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>

View File

@ -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 );

View File

@ -1008,7 +1008,7 @@ void QgsMapLayer::setSubLayerVisibility( const QString& name, bool vis )
// NOOP
}
const QgsCoordinateReferenceSystem& QgsMapLayer::crs() const
QgsCoordinateReferenceSystem QgsMapLayer::crs() const
{
return mCRS;
}

View File

@ -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 );