mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-01 00:46:20 -05:00
Make a correct copy of QgsCoordinateTransform for labeling (hope it fixes #9600)
This commit is contained in:
parent
42a4e75536
commit
34f79cf1ff
@ -127,6 +127,15 @@ QgsCoordinateTransform::~QgsCoordinateTransform()
|
||||
}
|
||||
}
|
||||
|
||||
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& theCRS )
|
||||
{
|
||||
mSourceCRS = theCRS;
|
||||
|
@ -88,6 +88,8 @@ class CORE_EXPORT QgsCoordinateTransform : public QObject
|
||||
//! destructor
|
||||
~QgsCoordinateTransform();
|
||||
|
||||
QgsCoordinateTransform* clone() const;
|
||||
|
||||
//! Enum used to indicate the direction (forward or inverse) of the transform
|
||||
enum TransformDirection
|
||||
{
|
||||
|
@ -3297,10 +3297,15 @@ int QgsPalLabeling::prepareLayer( QgsVectorLayer* layer, QSet<int>& attrIndices,
|
||||
lyr.fieldIndex = fldIndex;
|
||||
|
||||
lyr.xform = mMapRenderer->coordinateTransform();
|
||||
lyr.ct = 0;
|
||||
if ( mMapRenderer->hasCrsTransformEnabled() )
|
||||
lyr.ct = new QgsCoordinateTransform( layer->crs(), mMapRenderer->destinationCrs() );
|
||||
else
|
||||
lyr.ct = NULL;
|
||||
{
|
||||
const QgsCoordinateTransform* tr = mMapRenderer->transformation( layer );
|
||||
if ( tr )
|
||||
{
|
||||
lyr.ct = tr->clone();
|
||||
}
|
||||
}
|
||||
lyr.ptZero = lyr.xform->toMapCoordinates( 0, 0 );
|
||||
lyr.ptOne = lyr.xform->toMapCoordinates( 1, 0 );
|
||||
|
||||
@ -3318,10 +3323,15 @@ int QgsPalLabeling::addDiagramLayer( QgsVectorLayer* layer, QgsDiagramLayerSetti
|
||||
l->setArrangementFlags( s->placementFlags );
|
||||
|
||||
s->palLayer = l;
|
||||
s->ct = 0;
|
||||
if ( mMapRenderer->hasCrsTransformEnabled() )
|
||||
s->ct = new QgsCoordinateTransform( layer->crs(), mMapRenderer->destinationCrs() );
|
||||
else
|
||||
s->ct = NULL;
|
||||
{
|
||||
const QgsCoordinateTransform* tr = mMapRenderer->transformation( layer );
|
||||
if ( tr )
|
||||
{
|
||||
s->ct = tr->clone();
|
||||
}
|
||||
}
|
||||
s->xform = mMapRenderer->coordinateTransform();
|
||||
mActiveDiagramLayers.insert( layer, *s );
|
||||
return 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user