Changeset 7285 in josm
- Timestamp:
- 2014-07-03T20:42:42+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java
r7280 r7285 277 277 // if right selector also matches relations and if matched primitive is a way which is part of a multipolygon, 278 278 // use the multipolygon for further analysis 279 if (!((GeneralSelector) right).matchesBase(OsmPrimitiveType.RELATION) || !(e.osm instanceof Way)) { 279 if (!(e.osm instanceof Way) 280 || (right instanceof OptimizedGeneralSelector 281 && !((OptimizedGeneralSelector) right).matchesBase(OsmPrimitiveType.RELATION))) { 280 282 throw new NoSuchElementException(); 281 283 } … … 295 297 e.parent = e.osm; 296 298 297 if (left instanceof GeneralSelector) { 298 if (((GeneralSelector) left).matchesBase(OsmPrimitiveType.NODE)) { 299 if (left instanceof OptimizedGeneralSelector) { 300 if (((OptimizedGeneralSelector) left).matchesBase(OsmPrimitiveType.NODE)) { 299 301 containsFinder.visit(e.osm.getDataSet().searchNodes(e.osm.getBBox())); 300 302 } 301 if (((GeneralSelector) left).matchesBase(OsmPrimitiveType.WAY)) { 303 if (((OptimizedGeneralSelector) left).matchesBase(OsmPrimitiveType.WAY)) { 302 304 containsFinder.visit(e.osm.getDataSet().searchWays(e.osm.getBBox())); 303 305 } … … 312 314 e.parent = e.osm; 313 315 final CrossingFinder crossingFinder = new CrossingFinder(e); 314 if (((GeneralSelector) right).matchesBase(OsmPrimitiveType.WAY)) { 316 if (right instanceof OptimizedGeneralSelector 317 && ((OptimizedGeneralSelector) right).matchesBase(OsmPrimitiveType.WAY)) { 315 318 crossingFinder.visit(e.osm.getDataSet().searchWays(e.osm.getBBox())); 316 319 } … … 471 474 } 472 475 473 public boolean matchesBase(OsmPrimitiveType type) {474 if ("*".equals(base)) {475 return true;476 } else if (OsmPrimitiveType.NODE.equals(type)) {477 return "node".equals(base);478 } else if (OsmPrimitiveType.WAY.equals(type)) {479 return "way".equals(base) || "area".equals(base);480 } else if (OsmPrimitiveType.RELATION.equals(type)) {481 return "area".equals(base) || "relation".equals(base) || "canvas".equals(base);482 }483 return false;484 }485 486 public boolean matchesBase(OsmPrimitive p) {487 if (!matchesBase(p.getType())) {488 return false;489 } else {490 if (p instanceof Relation) {491 if ("area".equals(base)) {492 return ((Relation) p).isMultipolygon();493 } else if ("canvas".equals(base)) {494 return p.get("#canvas") != null;495 }496 }497 return true;498 }499 }500 501 public boolean matchesBase(Environment e) {502 return matchesBase(e.osm);503 }504 505 476 public boolean matchesConditions(Environment e) { 506 477 return super.matches(e); … … 565 536 } 566 537 538 public boolean matchesBase(OsmPrimitiveType type) { 539 if ("*".equals(base)) { 540 return true; 541 } else if (OsmPrimitiveType.NODE.equals(type)) { 542 return "node".equals(base); 543 } else if (OsmPrimitiveType.WAY.equals(type)) { 544 return "way".equals(base) || "area".equals(base); 545 } else if (OsmPrimitiveType.RELATION.equals(type)) { 546 return "area".equals(base) || "relation".equals(base) || "canvas".equals(base); 547 } 548 return false; 549 } 550 551 public boolean matchesBase(OsmPrimitive p) { 552 if (!matchesBase(p.getType())) { 553 return false; 554 } else { 555 if (p instanceof Relation) { 556 if ("area".equals(base)) { 557 return ((Relation) p).isMultipolygon(); 558 } else if ("canvas".equals(base)) { 559 return p.get("#canvas") != null; 560 } 561 } 562 return true; 563 } 564 } 565 566 public boolean matchesBase(Environment e) { 567 return matchesBase(e.osm); 568 } 569 567 570 @Override 568 571 public Selector optimizedBaseCheck() {
Note:
See TracChangeset
for help on using the changeset viewer.