Skip to content

Commit

Permalink
Remove the extra QgsCoordinateTransform constructors
Browse files Browse the repository at this point in the history
...and leave only:

QgsCoordinateTransform( const QgsCoordinateReferenceSystem& source,
                        const QgsCoordinateReferenceSystem& destination );

The other constructors were not used anyway in QGIS code,
had awkward/confusing API, and no unit tests.
  • Loading branch information
nyalldawson committed Jul 26, 2016
1 parent 3d6688c commit 4a3924c
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 68 deletions.
3 changes: 3 additions & 0 deletions doc/api_break.dox
Expand Up @@ -129,6 +129,9 @@ called if changes are made to the CRS database.</li>
<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>The extra QgsCoordinateTransform constructors (those not taking QgsCoordinateReferenceSystem arguments) have been
removed. Now, QgsCoordinateTransform must be created using an already existing source and destination
QgsCoordinateReferenceSystem object.</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>
Expand Down
22 changes: 0 additions & 22 deletions python/core/qgscoordinatetransform.sip
Expand Up @@ -39,28 +39,6 @@ class QgsCoordinateTransform
QgsCoordinateTransform( const QgsCoordinateReferenceSystem& source,
const QgsCoordinateReferenceSystem& destination );

/** Constructs a QgsCoordinateTransform using CRS ID of source and destination CRS */
QgsCoordinateTransform( long sourceSrsId, long destinationSrsId );

/*!
* Constructs a QgsCoordinateTransform using the Well Known Text representation
* of the layer and map canvas coordinate systems
* @param sourceWkt WKT, typically of the layer's coordinate system
* @param destinationWkt WKT, typically of the map canvas coordinate system
*/
QgsCoordinateTransform( const QString& sourceWkt, const QString& destinationWkt );

/*!
* Constructs a QgsCoordinateTransform using a Spatial Reference Id
* of the layer and map canvas coordinate system as Wkt
* @param sourceSrid Spatial Ref Id of the layer's coordinate system
* @param destinationWkt Wkt of the map canvas coordinate system
* @param sourceCRSType On of the enum members defined in QgsCoordinateReferenceSystem::CrsType
*/
QgsCoordinateTransform( long sourceSrid,
const QString& destinationWkt,
QgsCoordinateReferenceSystem::CrsType sourceCRSType = QgsCoordinateReferenceSystem::PostgisCrsId );

/*!
* Returns true if the coordinate transform is valid, ie both the source and destination
* CRS have been set and are valid.
Expand Down
23 changes: 0 additions & 23 deletions src/core/qgscoordinatetransform.cpp
Expand Up @@ -50,29 +50,6 @@ QgsCoordinateTransform::QgsCoordinateTransform( const QgsCoordinateReferenceSyst
d = new QgsCoordinateTransformPrivate( source, destination );
}

QgsCoordinateTransform::QgsCoordinateTransform( long sourceSrsId, long destinationSrsId )
{
d = new QgsCoordinateTransformPrivate( QgsCoordinateReferenceSystem::fromSrsId( sourceSrsId ),
QgsCoordinateReferenceSystem::fromSrsId( destinationSrsId ) );
}

QgsCoordinateTransform::QgsCoordinateTransform( const QString& sourceWkt, const QString& destinationWkt )
{
d = new QgsCoordinateTransformPrivate( QgsCoordinateReferenceSystem::fromWkt( sourceWkt ),
QgsCoordinateReferenceSystem::fromWkt( destinationWkt ) );
}


QgsCoordinateTransform::QgsCoordinateTransform( long sourceSrid,
const QString& destinationWkt,
QgsCoordinateReferenceSystem::CrsType sourceCrsType )
{
QgsCoordinateReferenceSystem sourceCrs;
sourceCrs.createFromId( sourceSrid, sourceCrsType );

d = new QgsCoordinateTransformPrivate( sourceCrs, QgsCoordinateReferenceSystem::fromWkt( destinationWkt ) );
}

void QgsCoordinateTransform::setSourceCrs( const QgsCoordinateReferenceSystem& crs )
{
d.detach();
Expand Down
23 changes: 0 additions & 23 deletions src/core/qgscoordinatetransform.h
Expand Up @@ -62,29 +62,6 @@ class CORE_EXPORT QgsCoordinateTransform
QgsCoordinateTransform( const QgsCoordinateReferenceSystem& source,
const QgsCoordinateReferenceSystem& destination );

/** Constructs a QgsCoordinateTransform using CRS ID of source and destination CRS */
QgsCoordinateTransform( long sourceSrsId, long destinationSrsId );

/*!
* Constructs a QgsCoordinateTransform using the Well Known Text representation
* of the layer and map canvas coordinate systems
* @param sourceWkt WKT, typically of the layer's coordinate system
* @param destinationWkt WKT, typically of the map canvas coordinate system
*/
QgsCoordinateTransform( const QString& sourceWkt, const QString& destinationWkt );

/*!
* Constructs a QgsCoordinateTransform using a Spatial Reference Id
* of the layer and map canvas coordinate system as Wkt
* @param sourceSrid Spatial Ref Id of the layer's coordinate system
* @param destinationWkt Wkt of the map canvas coordinate system
* @param sourceCrsType On of the enum members defined in QgsCoordinateReferenceSystem::CrsType
*/
QgsCoordinateTransform( long sourceSrid,
const QString& destinationWkt,
QgsCoordinateReferenceSystem::CrsType sourceCrsType = QgsCoordinateReferenceSystem::PostgisCrsId );


/*!
* Returns true if the coordinate transform is valid, ie both the source and destination
* CRS have been set and are valid.
Expand Down

0 comments on commit 4a3924c

Please sign in to comment.