Skip to content

Commit b18fcc0

Browse files
committedJul 16, 2016
Remove QgsCoordinateTransform::clone()
Just use direct copies instead
1 parent 736aab1 commit b18fcc0

7 files changed

+5
-17
lines changed
 

‎doc/api_break.dox

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ This page tries to maintain a list with incompatible changes that happened in pr
2323
<ul>
2424
<li>QgsCoordinateTransform is no longer a QObject. readXml, writeXml and initialise are all normal public members now,
2525
not slots. The invalidTransformInput() signal has been removed.</li>
26+
<li>QgsCoordinateTransform::clone() has been removed. Just use direct copies instead.</li>
2627
<li>sourceCrs() and destCrs() now return a copy instead of a reference to the CRS. This has no effect on PyQGIS code, but c++
2728
plugins calling these methods will need to be updated.</li>
2829
</ul>

‎python/core/qgscoordinatetransform.sip

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ class QgsCoordinateTransform
6464
//! destructor
6565
~QgsCoordinateTransform();
6666

67-
QgsCoordinateTransform* clone() const /Factory/;
68-
6967
/*!
7068
* Set the source (layer) QgsCoordinateReferenceSystem
7169
* @param theCRS QgsCoordinateReferenceSystem representation of the layer's coordinate system

‎src/core/qgscoordinatetransform.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,6 @@ QgsCoordinateTransform::QgsCoordinateTransform( long sourceSrid,
7474
d = new QgsCoordinateTransformPrivate( sourceCrs, QgsCRSCache::instance()->crsByWkt( destinationWkt ) );
7575
}
7676

77-
QgsCoordinateTransform* QgsCoordinateTransform::clone() const
78-
{
79-
QgsCoordinateTransform* tr = new QgsCoordinateTransform( sourceCrs(), destCRS() );
80-
tr->setSourceDatumTransform( sourceDatumTransform() );
81-
tr->setDestinationDatumTransform( destinationDatumTransform() );
82-
tr->initialise();
83-
return tr;
84-
}
85-
8677
void QgsCoordinateTransform::setSourceCrs( const QgsCoordinateReferenceSystem& crs )
8778
{
8879
d.detach();

‎src/core/qgscoordinatetransform.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ class CORE_EXPORT QgsCoordinateTransform
8585
const QString& theDestWkt,
8686
QgsCoordinateReferenceSystem::CrsType theSourceCRSType = QgsCoordinateReferenceSystem::PostgisCrsId );
8787

88-
QgsCoordinateTransform* clone() const;
89-
9088
/*!
9189
* Set the source (layer) QgsCoordinateReferenceSystem
9290
* @param theCRS QgsCoordinateReferenceSystem representation of the layer's coordinate system

‎src/core/qgsdiagramrendererv2.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ QgsDiagramLayerSettings::QgsDiagramLayerSettings( const QgsDiagramLayerSettings&
5454
, obstacle( rh.obstacle )
5555
, dist( rh.dist )
5656
, renderer( rh.renderer ? rh.renderer->clone() : nullptr )
57-
, ct( rh.ct ? rh.ct->clone() : nullptr )
57+
, ct( rh.ct ? new QgsCoordinateTransform( *rh.ct ): nullptr )
5858
, xform( rh.xform )
5959
, fields( rh.fields )
6060
, xPosColumn( rh.xPosColumn )
@@ -75,7 +75,7 @@ QgsDiagramLayerSettings&QgsDiagramLayerSettings::operator=( const QgsDiagramLaye
7575
obstacle = rh.obstacle;
7676
dist = rh.dist;
7777
renderer = rh.renderer ? rh.renderer->clone() : nullptr;
78-
ct = rh.ct ? rh.ct->clone() : nullptr;
78+
ct = rh.ct ? new QgsCoordinateTransform( *rh.ct ) : nullptr;
7979
xform = rh.xform;
8080
fields = rh.fields;
8181
xPosColumn = rh.xPosColumn;

‎src/core/qgsvectorlayerdiagramprovider.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ bool QgsVectorLayerDiagramProvider::prepare( const QgsRenderContext& context, QS
163163
{
164164
if ( context.coordinateTransform() )
165165
// this is context for layer rendering - use its CT as it includes correct datum transform
166-
s2.setCoordinateTransform( context.coordinateTransform()->clone() );
166+
s2.setCoordinateTransform( new QgsCoordinateTransform( *context.coordinateTransform() ) );
167167
else
168168
// otherwise fall back to creating our own CT - this one may not have the correct datum transform!
169169
s2.setCoordinateTransform( new QgsCoordinateTransform( mLayerCrs, mapSettings.destinationCrs() ) );

‎src/core/qgsvectorlayerlabelprovider.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ bool QgsVectorLayerLabelProvider::prepare( const QgsRenderContext& context, QStr
233233
{
234234
if ( context.coordinateTransform() )
235235
// this is context for layer rendering - use its CT as it includes correct datum transform
236-
lyr.ct = context.coordinateTransform()->clone();
236+
lyr.ct = new QgsCoordinateTransform( *context.coordinateTransform() );
237237
else
238238
// otherwise fall back to creating our own CT - this one may not have the correct datum transform!
239239
lyr.ct = new QgsCoordinateTransform( mCrs, mapSettings.destinationCrs() );

0 commit comments

Comments
 (0)
Please sign in to comment.