Class MapCSSRule
- java.lang.Object
-
- org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSRule
-
- All Implemented Interfaces:
java.lang.Comparable<MapCSSRule>
public class MapCSSRule extends java.lang.Object implements java.lang.Comparable<MapCSSRule>
A MapCSS rule. A MapCSS style is simply a list of MapCSS rules. Each rule has a selector and a declaration. Whenever the selector matches the primitive, the declaration block is executed for this primitive.
-
-
Field Summary
Fields Modifier and Type Field Description Declaration
declaration
The instructions for this selectorjava.util.List<Selector>
selectors
The selector.
-
Constructor Summary
Constructors Constructor Description MapCSSRule(java.util.List<Selector> selectors, Declaration declaration)
Constructs a newMapCSSRule
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(MapCSSRule o)
void
execute(Environment env)
Executes the instructions against the environmentenv
boolean
matches(Environment env)
Test whether the selector of this rule applies to the primitive.java.lang.String
toString()
-
-
-
Field Detail
-
selectors
public final java.util.List<Selector> selectors
The selector. If it matches, this rule should be applied
-
declaration
public final Declaration declaration
The instructions for this selector
-
-
Constructor Detail
-
MapCSSRule
public MapCSSRule(java.util.List<Selector> selectors, Declaration declaration)
Constructs a newMapCSSRule
.- Parameters:
selectors
- The selectorsdeclaration
- The declaration
-
-
Method Detail
-
matches
public boolean matches(Environment env)
Test whether the selector of this rule applies to the primitive.- Parameters:
env
- the Environment. env.mc and env.layer are read-only when matching a selector. env.source is not needed. This method will set the matchingReferrers field of env as a side effect! Make sure to clear it before invoking this method.- Returns:
- true, if the selector applies
- See Also:
Selector.matches(org.openstreetmap.josm.gui.mappaint.Environment)
-
execute
public void execute(Environment env)
Executes the instructions against the environment
env
- Parameters:
env
- the environment- See Also:
Declaration.execute(org.openstreetmap.josm.gui.mappaint.Environment)
-
compareTo
public int compareTo(MapCSSRule o)
- Specified by:
compareTo
in interfacejava.lang.Comparable<MapCSSRule>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-