Skip to content

Commit

Permalink
Rule-based renderer: respect the original scale range when refining t…
Browse files Browse the repository at this point in the history
…he rule based on scales.

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13711 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Jun 12, 2010
1 parent 7a6fd46 commit da8c2bc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/core/symbology-ng/qgsrulebasedrendererv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 da8c2bc

Please sign in to comment.