Skip to content

Commit

Permalink
Rule-based renderer: show 1:inf instead of 1:0 when there is no max. …
Browse files Browse the repository at this point in the history
…scale denominator

git-svn-id: http://svn.osgeo.org/qgis/trunk@13713 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Jun 12, 2010
1 parent 90ff519 commit 1d26b33
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/gui/symbology-ng/qgsrulebasedrendererv2widget.cpp
Expand Up @@ -387,6 +387,15 @@ void QgsRendererRulesTreeWidget::setGrouping( Grouping g )
populateRules();
}

QString QgsRendererRulesTreeWidget::formatScaleRange( int minDenom, int maxDenom )
{
if ( maxDenom != 0 )
return QString( "<1:%1, 1:%2>" ).arg( minDenom ).arg( maxDenom );
else
return QString( "<1:%1, 1:inf>" ).arg( minDenom );
}


void QgsRendererRulesTreeWidget::populateRules()
{
if ( !mR ) return;
Expand All @@ -412,7 +421,7 @@ void QgsRendererRulesTreeWidget::populateRulesNoGrouping()
if ( txt.isEmpty() ) txt = tr( "(no filter)" );
if ( rule.dependsOnScale() )
{
txt += QString( ", scale <1:%1, 1:%2>" ).arg( rule.scaleMinDenom() ).arg( rule.scaleMaxDenom() );
txt += QString( ", scale " ) + formatScaleRange( rule.scaleMinDenom(), rule.scaleMaxDenom() );
}

item->setText( 0, txt );
Expand All @@ -438,7 +447,7 @@ void QgsRendererRulesTreeWidget::populateRulesGroupByScale()
{
QString txt;
if ( rule.dependsOnScale() )
txt = QString( "scale <1:%1, 1:%2>" ).arg( rule.scaleMinDenom() ).arg( rule.scaleMaxDenom() );
txt = QString( "scale " ) + formatScaleRange( rule.scaleMinDenom(), rule.scaleMaxDenom() );
else
txt = "any scale";

Expand Down
2 changes: 2 additions & 0 deletions src/gui/symbology-ng/qgsrulebasedrendererv2widget.h
Expand Up @@ -43,6 +43,8 @@ class QgsRendererRulesTreeWidget : public QTreeWidget
void populateRulesGroupByScale();
void populateRulesGroupByFilter();

QString formatScaleRange( int minDenom, int maxDenom );

QgsRuleBasedRendererV2* mR;
Grouping mGrouping;
};
Expand Down

0 comments on commit 1d26b33

Please sign in to comment.