mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
unset QgsMapRenderer mCachedTrForLayer on setDestinationCrs and always check layer->crs against mCachedTr destCRS
This commit is contained in:
parent
a6df30c99f
commit
9a9b53bb94
@ -159,11 +159,11 @@ class QgsCoordinateReferenceSystem
|
||||
/*! Overloaded == operator used to compare to CRS's.
|
||||
* Internally it will delegate to the equals method described below
|
||||
*/
|
||||
bool operator==(const QgsCoordinateReferenceSystem &theSrs);
|
||||
bool operator==(const QgsCoordinateReferenceSystem &theSrs) const;
|
||||
/*! Overloaded != operator used to compare to CRS's.
|
||||
* Returns opposite bool value to operator ==
|
||||
*/
|
||||
bool operator!=(const QgsCoordinateReferenceSystem &theSrs);
|
||||
bool operator!=(const QgsCoordinateReferenceSystem &theSrs) const;
|
||||
/*! Overloaded == operator used to compare to CRS's.
|
||||
* Internally it will use OGR isSameCRS() or isSameGeoCRS() methods as appropriate.
|
||||
* Additionally logic may also be applied if the result from the OGR methods
|
||||
|
@ -979,12 +979,12 @@ long QgsCoordinateReferenceSystem::findMatchingProj()
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool QgsCoordinateReferenceSystem::operator==( const QgsCoordinateReferenceSystem &theSrs )
|
||||
bool QgsCoordinateReferenceSystem::operator==( const QgsCoordinateReferenceSystem &theSrs ) const
|
||||
{
|
||||
return mIsValidFlag && theSrs.mIsValidFlag && toWkt() == theSrs.toWkt();
|
||||
}
|
||||
|
||||
bool QgsCoordinateReferenceSystem::operator!=( const QgsCoordinateReferenceSystem &theSrs )
|
||||
bool QgsCoordinateReferenceSystem::operator!=( const QgsCoordinateReferenceSystem &theSrs ) const
|
||||
{
|
||||
return !( *this == theSrs );
|
||||
}
|
||||
|
@ -201,11 +201,11 @@ class CORE_EXPORT QgsCoordinateReferenceSystem
|
||||
/*! Overloaded == operator used to compare to CRS's.
|
||||
* Internally it will delegate to the equals method described below
|
||||
*/
|
||||
bool operator==( const QgsCoordinateReferenceSystem &theSrs );
|
||||
bool operator==( const QgsCoordinateReferenceSystem &theSrs ) const;
|
||||
/*! Overloaded != operator used to compare to CRS's.
|
||||
* Returns opposite bool value to operator ==
|
||||
*/
|
||||
bool operator!=( const QgsCoordinateReferenceSystem &theSrs );
|
||||
bool operator!=( const QgsCoordinateReferenceSystem &theSrs ) const;
|
||||
/*! Overloaded == operator used to compare to CRS's.
|
||||
* Internally it will use OGR isSameCRS() or isSameGeoCRS() methods as appropriate.
|
||||
* Additionally logic may also be applied if the result from the OGR methods
|
||||
|
@ -680,6 +680,7 @@ void QgsMapRenderer::setDestinationCrs( const QgsCoordinateReferenceSystem& crs
|
||||
QgsDebugMsg( "* DestCRS.srsid() = " + QString::number( crs.srsid() ) );
|
||||
if ( *mDestCRS != crs )
|
||||
{
|
||||
mCachedTrForLayer = 0;
|
||||
QgsDebugMsg( "Setting DistArea CRS to " + QString::number( crs.srsid() ) );
|
||||
mDistArea->setSourceCrs( crs.srsid() );
|
||||
*mDestCRS = crs;
|
||||
@ -754,6 +755,9 @@ bool QgsMapRenderer::splitLayersExtent( QgsMapLayer* layer, QgsRectangle& extent
|
||||
|
||||
QgsRectangle QgsMapRenderer::layerExtentToOutputExtent( QgsMapLayer* theLayer, QgsRectangle extent )
|
||||
{
|
||||
QgsDebugMsg( QString( "sourceCrs = " + tr( theLayer )->sourceCrs().authid() ) );
|
||||
QgsDebugMsg( QString( "destCRS = " + tr( theLayer )->destCRS().authid() ) );
|
||||
QgsDebugMsg( QString( "extent = " + extent.toString() ) );
|
||||
if ( hasCrsTransformEnabled() )
|
||||
{
|
||||
try
|
||||
@ -770,6 +774,7 @@ QgsRectangle QgsMapRenderer::layerExtentToOutputExtent( QgsMapLayer* theLayer, Q
|
||||
{
|
||||
// leave extent unchanged
|
||||
}
|
||||
QgsDebugMsg( QString( "proj extent = " + extent.toString() ) );
|
||||
|
||||
return extent;
|
||||
}
|
||||
@ -1102,7 +1107,8 @@ void QgsMapRenderer::setLabelingEngine( QgsLabelingEngineInterface* iface )
|
||||
|
||||
QgsCoordinateTransform *QgsMapRenderer::tr( QgsMapLayer *layer )
|
||||
{
|
||||
if ( mCachedTrForLayer != layer )
|
||||
// mCachedTrForLayer is unset by setDestinationCrs(), but layer->crs may also be changed after CRS was cached -> check it - the question is, how efficient now the caching is, because crs == operator is not cheap
|
||||
if ( mCachedTrForLayer != layer || layer->crs() != mCachedTr->sourceCrs() )
|
||||
{
|
||||
delete mCachedTr;
|
||||
mCachedTr = new QgsCoordinateTransform( layer->crs(), *mDestCRS );
|
||||
|
Loading…
x
Reference in New Issue
Block a user