Changeset 15068 in josm for trunk/src/org
- Timestamp:
- 2019-05-11T09:56:38+02:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java
r15064 r15068 9 9 import java.util.LinkedHashSet; 10 10 import java.util.List; 11 import java.util.NoSuchElementException;12 11 import java.util.Objects; 13 import java.util.Set;14 12 import java.util.function.IntFunction; 15 13 import java.util.function.IntSupplier; … … 21 19 import org.openstreetmap.josm.data.osm.IRelationMember; 22 20 import org.openstreetmap.josm.data.osm.IWay; 23 import org.openstreetmap.josm.data.osm.OsmPrimitive;24 21 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 25 22 import org.openstreetmap.josm.data.osm.OsmUtils; 26 23 import org.openstreetmap.josm.data.osm.Relation; 27 import org.openstreetmap.josm.data.osm.Way;28 24 import org.openstreetmap.josm.data.osm.visitor.PrimitiveVisitor; 29 25 import org.openstreetmap.josm.data.osm.visitor.paint.relations.MultipolygonCache; … … 358 354 } 359 355 360 ContainsFinder containsFinder; 361 try { 362 // if right selector also matches relations and if matched primitive is a way which is part of a multipolygon, 363 // use the multipolygon for further analysis 364 if (!(e.osm instanceof Way) 365 || (right instanceof OptimizedGeneralSelector 366 && !((OptimizedGeneralSelector) right).matchesBase(OsmPrimitiveType.RELATION))) { 367 throw new NoSuchElementException(); 368 } 369 final Relation multipolygon = ((Way) e.osm).referrers(Relation.class) 370 .filter(p -> p.hasTag("type", "multipolygon")) 371 .findFirst() 372 .orElseThrow(NoSuchElementException::new); 373 final Set<OsmPrimitive> members = multipolygon.getMemberPrimitives(); 374 containsFinder = new ContainsFinder(new Environment(multipolygon)) { 375 @Override 376 public boolean isPrimitiveUsable(IPrimitive p) { 377 return super.isPrimitiveUsable(p) && !members.contains(p); 378 } 379 }; 380 } catch (NoSuchElementException ignore) { 381 Logging.trace(ignore); 382 containsFinder = new ContainsFinder(e); 383 } 356 ContainsFinder containsFinder = new ContainsFinder(e); 384 357 e.parent = e.osm; 385 358
Note:
See TracChangeset
for help on using the changeset viewer.