diff --git src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj
index 258bfe79e..c6241391b 100644
|
|
TOKEN:
|
215 | 215 | | < FULLSTOP: "." > |
216 | 216 | | < DEG: "°" > |
217 | 217 | | < ELEMENT_OF: "∈" > |
| 218 | | < NOT_ELEMENT_OF: "∉" > |
218 | 219 | | < CROSSING: "⧉" > |
219 | 220 | | < PERCENT: "%" > |
220 | 221 | | < COMMENT_START: "/*" > : COMMENT |
… |
… |
Selector child_selector() :
|
690 | 691 | | |
691 | 692 | <ELEMENT_OF> { type = Selector.ChildOrParentSelectorType.ELEMENT_OF; } |
692 | 693 | | |
| 694 | <NOT_ELEMENT_OF> { type = Selector.ChildOrParentSelectorType.NOT_ELEMENT_OF; } |
| 695 | | |
693 | 696 | <CROSSING> { type = Selector.ChildOrParentSelectorType.CROSSING; } |
694 | 697 | ) |
695 | 698 | w() |
diff --git src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java
index 30f0007a8..441f41573 100644
|
|
public interface Selector {
|
93 | 93 | * @see ChildOrParentSelector |
94 | 94 | */ |
95 | 95 | enum ChildOrParentSelectorType { |
96 | | CHILD, PARENT, ELEMENT_OF, CROSSING, SIBLING |
| 96 | CHILD, PARENT, ELEMENT_OF, NOT_ELEMENT_OF, CROSSING, SIBLING |
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
… |
… |
public interface Selector {
|
312 | 312 | |
313 | 313 | @Override |
314 | 314 | public boolean matches(Environment e) { |
| 315 | if (ChildOrParentSelectorType.ELEMENT_OF == type || |
| 316 | ChildOrParentSelectorType.NOT_ELEMENT_OF == type) { |
| 317 | if (!left.matches(e)) |
| 318 | return false; |
| 319 | boolean is_element_of = false; |
| 320 | // does exist any element in dataset that contains e.osm? |
| 321 | for (IPrimitive p: e.osm.getDataSet().allPrimitives()) { |
| 322 | Environment ne = new Environment(p); |
| 323 | if (!right.matches(ne)) |
| 324 | continue; |
| 325 | ContainsFinder cf = new ContainsFinder(ne); |
| 326 | if (e.osm instanceof IWay) |
| 327 | cf.visit((IWay) e.osm); |
| 328 | if (e.osm instanceof INode) |
| 329 | cf.visit((INode) e.osm); |
| 330 | if (ne.child == e.osm) |
| 331 | is_element_of = true; |
| 332 | } |
| 333 | Logging.log(Logging.LEVEL_INFO, "ELEMENT_OF is " + is_element_of, null); |
| 334 | if (ChildOrParentSelectorType.ELEMENT_OF == type) |
| 335 | return is_element_of; |
| 336 | else |
| 337 | return !is_element_of; |
| 338 | } |
315 | 339 | |
316 | 340 | if (!right.matches(e)) |
317 | 341 | return false; |
318 | 342 | |
319 | 343 | if (ChildOrParentSelectorType.ELEMENT_OF == type) { |
320 | | |
| 344 | /* |
321 | 345 | if (e.osm instanceof INode || e.osm.getDataSet() == null) { |
322 | 346 | // nodes cannot contain elements |
323 | 347 | return false; |
… |
… |
public interface Selector {
|
362 | 386 | } |
363 | 387 | |
364 | 388 | return e.child != null; |
365 | | |
| 389 | */ |
366 | 390 | } else if (ChildOrParentSelectorType.CROSSING == type && e.osm instanceof IWay) { |
367 | 391 | e.parent = e.osm; |
368 | 392 | final CrossingFinder crossingFinder = new CrossingFinder(e); |