Class Rule

java.lang.Object
dev.avelar.mapnik.Rule

public final class Rule extends Object
Says which features get which symbolizers: an optional filter and scale range, then what to draw. Rules in a Style are tried in order.
  • Method Details

    • create

      public static Rule create()
    • name

      public Rule name(String name)
    • title

      public Rule title(String title)
    • filter

      public Rule filter(String expression)
      Only features matching this expression, in Mapnik's expression language, for example "[population] > 100000 and [kind] = 'city'". Attribute names go in brackets.
    • elseFilter

      public Rule elseFilter()
      Matches features that no earlier rule in the style matched.
    • alsoFilter

      public Rule alsoFilter()
      Matches only features that an earlier rule in the style already matched: the opposite of elseFilter(). Use it to add a detail to features another rule drew, for example a centre dot. It does nothing in Style.FilterMode.FIRST mode, where a feature stops at its first matching rule.
    • minScaleDenominator

      public Rule minScaleDenominator(double v)
      The rule applies only when the map's scale denominator is at least this (zoomed out less than this).
    • maxScaleDenominator

      public Rule maxScaleDenominator(double v)
      The rule applies only when the map's scale denominator is below this.
    • add

      public Rule add(Symbolizer... symbolizers)
    • name

      public Optional<String> name()
    • title

      public Optional<String> title()
    • filterExpression

      public Optional<String> filterExpression()
      The filter expression, if the rule has one.
    • isElse

      public boolean isElse()
    • isAlso

      public boolean isAlso()
    • minScale

      public Optional<Double> minScale()
    • maxScale

      public Optional<Double> maxScale()
    • symbolizers

      public List<Symbolizer> symbolizers()
    • toXml

      public String toXml()
    • toString

      public String toString()
      Overrides:
      toString in class Object