Skip to content
Permalink
Browse files

Remove QgsCoordinateTransform::clone()

Just use direct copies instead
  • Loading branch information
nyalldawson committed Jul 16, 2016
1 parent 736aab1 commit b18fcc0ddfa10c0af97addc939d72ca7f7cfdf71
@@ -23,6 +23,7 @@ This page tries to maintain a list with incompatible changes that happened in pr
<ul>
<li>QgsCoordinateTransform is no longer a QObject. readXml, writeXml and initialise are all normal public members now,
not slots. The invalidTransformInput() signal has been removed.</li>
<li>QgsCoordinateTransform::clone() has been removed. Just use direct copies instead.</li>
<li>sourceCrs() and destCrs() now return a copy instead of a reference to the CRS. This has no effect on PyQGIS code, but c++
plugins calling these methods will need to be updated.</li>
</ul>
@@ -64,8 +64,6 @@ class QgsCoordinateTransform
//! destructor
~QgsCoordinateTransform();

QgsCoordinateTransform* clone() const /Factory/;

/*!
* Set the source (layer) QgsCoordinateReferenceSystem
* @param theCRS QgsCoordinateReferenceSystem representation of the layer's coordinate system
@@ -74,15 +74,6 @@ QgsCoordinateTransform::QgsCoordinateTransform( long sourceSrid,
d = new QgsCoordinateTransformPrivate( sourceCrs, QgsCRSCache::instance()->crsByWkt( destinationWkt ) );
}

QgsCoordinateTransform* QgsCoordinateTransform::clone() const
{
QgsCoordinateTransform* tr = new QgsCoordinateTransform( sourceCrs(), destCRS() );
tr->setSourceDatumTransform( sourceDatumTransform() );
tr->setDestinationDatumTransform( destinationDatumTransform() );
tr->initialise();
return tr;
}

void QgsCoordinateTransform::setSourceCrs( const QgsCoordinateReferenceSystem& crs )
{
d.detach();
@@ -85,8 +85,6 @@ class CORE_EXPORT QgsCoordinateTransform
const QString& theDestWkt,
QgsCoordinateReferenceSystem::CrsType theSourceCRSType = QgsCoordinateReferenceSystem::PostgisCrsId );

QgsCoordinateTransform* clone() const;

/*!
* Set the source (layer) QgsCoordinateReferenceSystem
* @param theCRS QgsCoordinateReferenceSystem representation of the layer's coordinate system
@@ -54,7 +54,7 @@ QgsDiagramLayerSettings::QgsDiagramLayerSettings( const QgsDiagramLayerSettings&
, obstacle( rh.obstacle )
, dist( rh.dist )
, renderer( rh.renderer ? rh.renderer->clone() : nullptr )
, ct( rh.ct ? rh.ct->clone() : nullptr )
, ct( rh.ct ? new QgsCoordinateTransform( *rh.ct ): nullptr )
, xform( rh.xform )
, fields( rh.fields )
, xPosColumn( rh.xPosColumn )
@@ -75,7 +75,7 @@ QgsDiagramLayerSettings&QgsDiagramLayerSettings::operator=( const QgsDiagramLaye
obstacle = rh.obstacle;
dist = rh.dist;
renderer = rh.renderer ? rh.renderer->clone() : nullptr;
ct = rh.ct ? rh.ct->clone() : nullptr;
ct = rh.ct ? new QgsCoordinateTransform( *rh.ct ) : nullptr;
xform = rh.xform;
fields = rh.fields;
xPosColumn = rh.xPosColumn;
@@ -163,7 +163,7 @@ bool QgsVectorLayerDiagramProvider::prepare( const QgsRenderContext& context, QS
{
if ( context.coordinateTransform() )
// this is context for layer rendering - use its CT as it includes correct datum transform
s2.setCoordinateTransform( context.coordinateTransform()->clone() );
s2.setCoordinateTransform( new QgsCoordinateTransform( *context.coordinateTransform() ) );
else
// otherwise fall back to creating our own CT - this one may not have the correct datum transform!
s2.setCoordinateTransform( new QgsCoordinateTransform( mLayerCrs, mapSettings.destinationCrs() ) );
@@ -233,7 +233,7 @@ bool QgsVectorLayerLabelProvider::prepare( const QgsRenderContext& context, QStr
{
if ( context.coordinateTransform() )
// this is context for layer rendering - use its CT as it includes correct datum transform
lyr.ct = context.coordinateTransform()->clone();
lyr.ct = new QgsCoordinateTransform( *context.coordinateTransform() );
else
// otherwise fall back to creating our own CT - this one may not have the correct datum transform!
lyr.ct = new QgsCoordinateTransform( mCrs, mapSettings.destinationCrs() );

0 comments on commit b18fcc0

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