Skip to content
Permalink
Browse files
Rule-based renderer: respect the original scale range when refining t…
…he rule based on scales.

git-svn-id: http://svn.osgeo.org/qgis/trunk@13711 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Jun 12, 2010
1 parent 0a4f1c5 commit 1fbb58e0b2dffed239bd66ec43e9cbb794c67e58
Showing with 8 additions and 2 deletions.
  1. +8 −2 src/core/symbology-ng/qgsrulebasedrendererv2.cpp
@@ -355,14 +355,20 @@ QList<QgsRuleBasedRendererV2::Rule> QgsRuleBasedRendererV2::refineRuleRanges( Qg

QList<QgsRuleBasedRendererV2::Rule> QgsRuleBasedRendererV2::refineRuleScales( QgsRuleBasedRendererV2::Rule& initialRule, QList<int> scales )
{
qSort(scales); // make sure the scales are in ascending order
QList<Rule> rules;
int oldScale = 0;
int oldScale = initialRule.scaleMinDenom();
int maxDenom = initialRule.scaleMaxDenom();
foreach( int scale, scales )
{
if ( initialRule.scaleMinDenom() >= scale )
continue; // jump over the first scales out of the interval
if ( maxDenom != 0 && maxDenom <= scale )
break; // ignore the latter scales out of the interval
rules.append( Rule( initialRule.symbol()->clone(), oldScale, scale, initialRule.filterExpression() ) );
oldScale = scale;
}
// last rule
rules.append( Rule( initialRule.symbol()->clone(), oldScale, 0, initialRule.filterExpression() ) );
rules.append( Rule( initialRule.symbol()->clone(), oldScale, maxDenom, initialRule.filterExpression() ) );
return rules;
}

0 comments on commit 1fbb58e

Please sign in to comment.