Skip to content
Permalink
Browse files

Fix scale dependant rendering of diagrams (fix #10700)

  • Loading branch information
nyalldawson committed Apr 13, 2015
1 parent 946ca07 commit 18e4a0c8cb6e6f68060d58ac6817ae136fa0552a
Showing with 21 additions and 9 deletions.
  1. +0 −7 src/core/diagram/qgstextdiagram.cpp
  2. +21 −2 src/core/qgspallabeling.cpp
@@ -109,13 +109,6 @@ void QgsTextDiagram::renderDiagram( const QgsFeature& feature, QgsRenderContext&
return;
}

double scaleDenominator = c.rendererScale();
if (( s.minScaleDenominator != -1 && scaleDenominator < s.minScaleDenominator )
|| ( s.maxScaleDenominator != -1 && scaleDenominator > s.maxScaleDenominator ) )
{
return;
}

//convert from mm / map units to painter units
QSizeF spu = sizePainterUnits( s.size, s, c );
double w = spu.width();
@@ -3424,6 +3424,26 @@ void QgsPalLabeling::registerDiagramFeature( const QString& layerID, QgsFeature&
return;
}

QgsDiagramRendererV2* dr = layerIt.value().renderer;
if ( dr )
{
QList<QgsDiagramSettings> settingList = dr->diagramSettings();
if ( settingList.size() > 0 )
{
double minScale = settingList.at( 0 ).minScaleDenominator;
if ( minScale > 0 && context.rendererScale() < minScale )
{
return;
}

double maxScale = settingList.at( 0 ).maxScaleDenominator;
if ( maxScale > 0 && context.rendererScale() > maxScale )
{
return;
}
}
}

//convert geom to geos
QgsGeometry* geom = feat.geometry();

@@ -3462,7 +3482,6 @@ void QgsPalLabeling::registerDiagramFeature( const QString& layerID, QgsFeature&

double diagramWidth = 0;
double diagramHeight = 0;
QgsDiagramRendererV2* dr = layerIt.value().renderer;
if ( dr )
{
QSizeF diagSize = dr->sizeMapUnits( feat, context );
@@ -4013,7 +4032,7 @@ void QgsPalLabeling::drawLabeling( QgsRenderContext& context )
feature.setFields( &dit.value().fields );
palGeometry->feature( feature );
QgsPoint outPt = xform.transform(( *it )->getX(), ( *it )->getY() );
dit.value().renderer->renderDiagram( feature, context, QPointF( outPt.x(), outPt.y() ) );
dit.value().renderer->renderDiagram( feature, context, outPt.toQPointF() );
}
}

0 comments on commit 18e4a0c

Please sign in to comment.
You can’t perform that action at this time.