Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Limit extent reprojection workaround to vector layers (followup 51fe632
…; fixes #13735; refs #7596)
  • Loading branch information
jef-n committed Nov 12, 2015
1 parent fd9f0b5 commit d8f5dbe
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion python/core/qgsmaprendererjob.sip
Expand Up @@ -110,7 +110,7 @@ class QgsMapRendererJob : QObject
* source CRS coordinates, and if it was split, returns true, and
* also sets the contents of the r2 parameter
*/
static bool reprojectToLayerExtent( const QgsCoordinateTransform* ct, bool layerCrsGeographic, QgsRectangle& extent, QgsRectangle& r2 );
static bool reprojectToLayerExtent( const QgsMapLayer *ml, const QgsCoordinateTransform *ct, QgsRectangle &extent, QgsRectangle &r2 );

//! @note not available in python bindings
// LayerRenderJobs prepareJobs( QPainter* painter, QgsPalLabeling* labelingEngine );
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsmaprenderercustompainterjob.cpp
Expand Up @@ -331,7 +331,7 @@ void QgsMapRendererJob::drawOldLabeling( const QgsMapSettings& settings, QgsRend
{
ct = settings.layerTransform( ml );
if ( ct )
reprojectToLayerExtent( ct, ml->crs().geographicFlag(), r1, r2 );
reprojectToLayerExtent( ml, ct, r1, r2 );
}

renderContext.setCoordinateTransform( ct );
Expand Down
8 changes: 4 additions & 4 deletions src/core/qgsmaprendererjob.cpp
Expand Up @@ -63,7 +63,7 @@ const QgsMapSettings& QgsMapRendererJob::mapSettings() const
}


bool QgsMapRendererJob::reprojectToLayerExtent( const QgsCoordinateTransform* ct, bool layerCrsGeographic, QgsRectangle& extent, QgsRectangle& r2 )
bool QgsMapRendererJob::reprojectToLayerExtent( const QgsMapLayer *ml, const QgsCoordinateTransform *ct, QgsRectangle &extent, QgsRectangle &r2 )
{
bool split = false;

Expand All @@ -79,9 +79,9 @@ bool QgsMapRendererJob::reprojectToLayerExtent( const QgsCoordinateTransform* ct
// extent separately.
static const double splitCoord = 180.0;

if ( layerCrsGeographic )
if ( ml->crs().geographicFlag() )
{
if ( !ct->destCRS().geographicFlag() )
if ( ml->type() == QgsMapLayer::VectorLayer && !ct->destCRS().geographicFlag() )
{
// if we transform from a projected coordinate system check
// check if transforming back roughly returns the input
Expand Down Expand Up @@ -221,7 +221,7 @@ LayerRenderJobs QgsMapRendererJob::prepareJobs( QPainter* painter, QgsPalLabelin
ct = mSettings.layerTransform( ml );
if ( ct )
{
reprojectToLayerExtent( ct, ml->crs().geographicFlag(), r1, r2 );
reprojectToLayerExtent( ml, ct, r1, r2 );
}
QgsDebugMsg( "extent: " + r1.toString() );
if ( !r1.isFinite() || !r2.isFinite() )
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsmaprendererjob.h
Expand Up @@ -147,7 +147,7 @@ class CORE_EXPORT QgsMapRendererJob : public QObject
* source CRS coordinates, and if it was split, returns true, and
* also sets the contents of the r2 parameter
*/
static bool reprojectToLayerExtent( const QgsCoordinateTransform* ct, bool layerCrsGeographic, QgsRectangle& extent, QgsRectangle& r2 );
static bool reprojectToLayerExtent( const QgsMapLayer *ml, const QgsCoordinateTransform *ct, QgsRectangle &extent, QgsRectangle &r2 );

//! @note not available in python bindings
LayerRenderJobs prepareJobs( QPainter* painter, QgsPalLabeling* labelingEngine, QgsLabelingEngineV2* labelingEngine2 );
Expand Down

0 comments on commit d8f5dbe

Please sign in to comment.