Interface Selector
-
- All Known Implementing Classes:
Selector.AbstractSelector
,Selector.ChildOrParentSelector
,Selector.GeneralSelector
,Selector.LinkSelector
public interface Selector
MapCSS selector.A rule has two parts, a selector and a declaration block e.g.
way[highway=residential] { width: 10; color: blue; }
The selector decides, if the declaration block gets applied or not.All implementing classes of Selector are immutable.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Selector.AbstractSelector
Super class ofSelector.GeneralSelector
andSelector.LinkSelector
.static class
Selector.ChildOrParentSelector
Represents a child selector or a parent selector.static class
Selector.ChildOrParentSelectorType
The type of child of parent selector.static class
Selector.GeneralSelector
General selector.static class
Selector.LinkSelector
In a child selector, conditions on the link between a parent and a child object.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
BASE_ANY
selector base that matches anything.static java.lang.String
BASE_AREA
selector base that matches with any area regardless of whether the area border is only modelled with a single way or with a set of ways glued together with a relation.static java.lang.String
BASE_CANVAS
selector base for style information not specific to nodes, ways or relations.static java.lang.String
BASE_META
selector base for special rules containing meta information.static java.lang.String
BASE_NODE
selector base that matches on OSM object node.static java.lang.String
BASE_RELATION
selector base that matches on OSM object relation.static java.lang.String
BASE_SETTING
selector base for artificial bases created to use preferences.static java.lang.String
BASE_SETTINGS
selector base for grouping settings.static java.lang.String
BASE_WAY
selector base that matches on OSM object way.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
getBase()
java.util.List<Condition>
getConditions()
Returns the list of conditions.Range
getRange()
Returns the scale range, an interval of the form "lower < x <= upper" where 0 <= lower < upper.Subpart
getSubpart()
Returns the subpart, if supported.boolean
matches(Environment env)
Apply the selector to the primitive and check if it matches.
-
-
-
Field Detail
-
BASE_ANY
static final java.lang.String BASE_ANY
selector base that matches anything.- See Also:
- Constant Field Values
-
BASE_NODE
static final java.lang.String BASE_NODE
selector base that matches on OSM object node.- See Also:
- Constant Field Values
-
BASE_WAY
static final java.lang.String BASE_WAY
selector base that matches on OSM object way.- See Also:
- Constant Field Values
-
BASE_RELATION
static final java.lang.String BASE_RELATION
selector base that matches on OSM object relation.- See Also:
- Constant Field Values
-
BASE_AREA
static final java.lang.String BASE_AREA
selector base that matches with any area regardless of whether the area border is only modelled with a single way or with a set of ways glued together with a relation.- See Also:
- Constant Field Values
-
BASE_META
static final java.lang.String BASE_META
selector base for special rules containing meta information.- See Also:
- Constant Field Values
-
BASE_CANVAS
static final java.lang.String BASE_CANVAS
selector base for style information not specific to nodes, ways or relations.- See Also:
- Constant Field Values
-
BASE_SETTING
static final java.lang.String BASE_SETTING
selector base for artificial bases created to use preferences.- See Also:
- Constant Field Values
-
BASE_SETTINGS
static final java.lang.String BASE_SETTINGS
selector base for grouping settings.- See Also:
- Constant Field Values
-
-
Method Detail
-
matches
boolean matches(Environment env)
Apply the selector to the primitive and check if it matches.- 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
-
getSubpart
Subpart getSubpart()
Returns the subpart, if supported. A subpart identifies different rendering layers (::subpart
syntax).- Returns:
- the subpart, if supported
- Throws:
java.lang.UnsupportedOperationException
- if not supported
-
getRange
Range getRange()
Returns the scale range, an interval of the form "lower < x <= upper" where 0 <= lower < upper.- Returns:
- the scale range, if supported
- Throws:
java.lang.UnsupportedOperationException
- if not supported
-
getBase
java.lang.String getBase()
-
getConditions
java.util.List<Condition> getConditions()
Returns the list of conditions.- Returns:
- the list of conditions
-
-