Changeset 15064 in josm for trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java
- Timestamp:
- 2019-05-09T10:13:10+02:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java
r14654 r15064 7 7 import java.util.Collection; 8 8 import java.util.Collections; 9 import java.util.LinkedHashSet; 9 10 import java.util.List; 10 11 import java.util.NoSuchElementException; … … 258 259 return !e.osm.equals(p) && p.isUsable(); 259 260 } 261 262 protected void addToChildren(Environment e, IPrimitive p) { 263 if (e.children == null) { 264 e.children = new LinkedHashSet<>(); 265 } 266 e.children.add(p); 267 } 260 268 } 261 269 … … 299 307 @Override 300 308 public void visit(IWay<?> w) { 301 if ( e.child == null &&Objects.equals(layer, OsmUtils.getLayer(w))309 if (Objects.equals(layer, OsmUtils.getLayer(w)) 302 310 && left.matches(new Environment(w).withParent(e.osm)) 303 311 && e.osm instanceof IWay && Geometry.PolygonIntersection.CROSSING.equals( 304 312 Geometry.polygonIntersection(w.getNodes(), ((IWay<?>) e.osm).getNodes()))) { 305 e.child = w;313 addToChildren(e, w); 306 314 } 307 315 } … … 316 324 @Override 317 325 public void visit(INode n) { 318 if ( e.child == null &&left.matches(new Environment(n).withParent(e.osm))326 if (left.matches(new Environment(n).withParent(e.osm)) 319 327 && ((e.osm instanceof IWay && Geometry.nodeInsidePolygon(n, ((IWay<?>) e.osm).getNodes())) 320 328 || (e.osm instanceof Relation && ( 321 329 (Relation) e.osm).isMultipolygon() && Geometry.isNodeInsideMultiPolygon(n, (Relation) e.osm, null)))) { 322 e.child = n;330 addToChildren(e, n); 323 331 } 324 332 } … … 326 334 @Override 327 335 public void visit(IWay<?> w) { 328 if ( e.child == null &&left.matches(new Environment(w).withParent(e.osm))336 if (left.matches(new Environment(w).withParent(e.osm)) 329 337 && ((e.osm instanceof IWay && Geometry.PolygonIntersection.FIRST_INSIDE_SECOND.equals( 330 338 Geometry.polygonIntersection(w.getNodes(), ((IWay<?>) e.osm).getNodes()))) … … 332 340 (Relation) e.osm).isMultipolygon() 333 341 && Geometry.isPolygonInsideMultiPolygon(w.getNodes(), (Relation) e.osm, null)))) { 334 e.child = w;342 addToChildren(e, w); 335 343 } 336 344 } … … 388 396 } 389 397 390 return e.child != null;398 return e.children != null; 391 399 392 400 } else if (ChildOrParentSelectorType.CROSSING == type && e.osm instanceof IWay) { 393 401 e.parent = e.osm; 394 final CrossingFinder crossingFinder = new CrossingFinder(e);395 402 if (right instanceof OptimizedGeneralSelector 396 403 && ((OptimizedGeneralSelector) right).matchesBase(OsmPrimitiveType.WAY)) { 404 final CrossingFinder crossingFinder = new CrossingFinder(e); 397 405 crossingFinder.visit(e.osm.getDataSet().searchWays(e.osm.getBBox())); 398 406 } 399 return e.child != null;407 return e.children != null; 400 408 } else if (ChildOrParentSelectorType.SIBLING == type) { 401 409 if (e.osm instanceof INode) {
Note:
See TracChangeset
for help on using the changeset viewer.