Class Selector.ChildOrParentSelector
- java.lang.Object
-
- org.openstreetmap.josm.gui.mappaint.mapcss.Selector.ChildOrParentSelector
-
- All Implemented Interfaces:
Selector
- Enclosing interface:
- Selector
public static class Selector.ChildOrParentSelector extends java.lang.Object implements Selector
Represents a child selector or a parent selector.
In addition to the standard CSS notation for child selectors, JOSM also supports an "inverse" notation:
selector_a > selector_b { ... } // the standard notation (child selector) relation[type=route] > way { ... } // example (all ways of a route) selector_a < selector_b { ... } // the inverse notation (parent selector) node[traffic_calming] < way { ... } // example (way that has a traffic calming node)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
Selector.ChildOrParentSelector.AbstractFinder
private class
Selector.ChildOrParentSelector.ContainsFinder
Finds elements which are inside the right element, collects those inchildren
private class
Selector.ChildOrParentSelector.CrossingFinder
private class
Selector.ChildOrParentSelector.InsideOrEqualFinder
Finds elements which are inside the left element, or in other words, it finds elements enclosing e.osm.private class
Selector.ChildOrParentSelector.MatchingReferrerFinder
Finds the first referrer matchingleft
private class
Selector.ChildOrParentSelector.MultipolygonOpenEndFinder
-
Nested classes/interfaces inherited from interface org.openstreetmap.josm.gui.mappaint.mapcss.Selector
Selector.AbstractSelector, Selector.ChildOrParentSelector, Selector.ChildOrParentSelectorType, Selector.GeneralSelector, Selector.LinkSelector
-
-
Field Summary
Fields Modifier and Type Field Description Selector
left
Selector.LinkSelector
link
Selector
right
Selector.ChildOrParentSelectorType
type
-
Fields inherited from interface org.openstreetmap.josm.gui.mappaint.mapcss.Selector
BASE_ANY, BASE_AREA, BASE_CANVAS, BASE_META, BASE_NODE, BASE_RELATION, BASE_SETTING, BASE_SETTINGS, BASE_WAY
-
-
Constructor Summary
Constructors Constructor Description ChildOrParentSelector(Selector a, Selector.LinkSelector link, Selector b, Selector.ChildOrParentSelectorType type)
Constructs a newChildOrParentSelector
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete 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.private static boolean
isArea(IPrimitive p)
boolean
matches(Environment e)
Apply the selector to the primitive and check if it matches.java.lang.String
toString()
private void
visitBBox(Environment e, Selector.ChildOrParentSelector.AbstractFinder finder)
-
-
-
Field Detail
-
link
public final Selector.LinkSelector link
-
type
public final Selector.ChildOrParentSelectorType type
-
-
Constructor Detail
-
ChildOrParentSelector
public ChildOrParentSelector(Selector a, Selector.LinkSelector link, Selector b, Selector.ChildOrParentSelectorType type)
Constructs a newChildOrParentSelector
.- Parameters:
a
- the first selectorlink
- linkb
- the second selectortype
- the selector type
-
-
Method Detail
-
getConditions
public java.util.List<Condition> getConditions()
Description copied from interface:Selector
Returns the list of conditions.- Specified by:
getConditions
in interfaceSelector
- Returns:
- the list of conditions
-
visitBBox
private void visitBBox(Environment e, Selector.ChildOrParentSelector.AbstractFinder finder)
-
isArea
private static boolean isArea(IPrimitive p)
-
matches
public boolean matches(Environment e)
Description copied from interface:Selector
Apply the selector to the primitive and check if it matches.- Specified by:
matches
in interfaceSelector
- Parameters:
e
- 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
public Subpart getSubpart()
Description copied from interface:Selector
Returns the subpart, if supported. A subpart identifies different rendering layers (::subpart
syntax).- Specified by:
getSubpart
in interfaceSelector
- Returns:
- the subpart, if supported
-
getRange
public Range getRange()
Description copied from interface:Selector
Returns the scale range, an interval of the form "lower < x <= upper" where 0 <= lower < upper.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-