- Timestamp:
- 2020-03-02T07:45:51+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java
r15987 r15995 365 365 && left.matches(new Environment(p).withParent(e.osm)) && isArea(p) 366 366 && (toIgnore == null || !toIgnore.contains(p))) { 367 if (area == null) { 368 area = getAreaEastNorth(e.osm, e); 367 visitArea(p); 368 } 369 } 370 } 371 372 private void visitArea(IPrimitive p) { 373 if (area == null) { 374 area = getAreaEastNorth(e.osm, e); 375 } 376 Area otherArea = getAreaEastNorth(p, e); 377 if (area.isEmpty() || otherArea.isEmpty()) { 378 useFindCrossings(p); 379 } else { 380 // we have complete data. This allows to find intersections with shared nodes 381 // See #16707 382 Pair<PolygonIntersection, Area> is = Geometry.polygonIntersectionResult( 383 otherArea, area, Geometry.INTERSECTION_EPS_EAST_NORTH); 384 if (Geometry.PolygonIntersection.CROSSING == is.a) { 385 addToChildren(e, p); 386 // store intersection area to improve highlight and zoom to problem 387 if (e.intersections == null) { 388 e.intersections = new HashMap<>(); 369 389 } 370 Area otherArea = getAreaEastNorth(p, e); 371 if (area.isEmpty() || otherArea.isEmpty()) { 372 if (cellSegments == null) { 373 // lazy initialisation 374 cellSegments = new HashMap<>(); 375 findCrossings(e.osm, cellSegments); // ignore self intersections etc. here 376 } 377 // need a copy 378 final Map<Point2D, List<WaySegment>> tmpCellSegments = new HashMap<>(cellSegments); 379 // calculate all crossings between e.osm and p 380 Map<List<Way>, List<WaySegment>> crossingWays = findCrossings(p, tmpCellSegments); 381 if (!crossingWays.isEmpty()) { 382 addToChildren(e, p); 383 if (e.crossingWaysMap == null) { 384 e.crossingWaysMap = new HashMap<>(); 385 } 386 e.crossingWaysMap.put(p, crossingWays); 387 } 388 } else { 389 // we have complete data. This allows to find intersections with shared nodes 390 // See #16707 391 Pair<PolygonIntersection, Area> is = Geometry.polygonIntersectionResult( 392 otherArea, area, Geometry.INTERSECTION_EPS_EAST_NORTH); 393 if (Geometry.PolygonIntersection.CROSSING == is.a) { 394 addToChildren(e, p); 395 // store intersection area to improve highlight and zoom to problem 396 if (e.intersections == null) { 397 e.intersections = new HashMap<>(); 398 } 399 e.intersections.put(p, is.b); 400 } 401 } 402 } 390 e.intersections.put(p, is.b); 391 } 392 } 393 394 } 395 396 private void useFindCrossings(IPrimitive p) { 397 if (cellSegments == null) { 398 // lazy initialisation 399 cellSegments = new HashMap<>(); 400 findCrossings(e.osm, cellSegments); // ignore self intersections etc. here 401 } 402 // need a copy 403 final Map<Point2D, List<WaySegment>> tmpCellSegments = new HashMap<>(cellSegments); 404 // calculate all crossings between e.osm and p 405 Map<List<Way>, List<WaySegment>> crossingWays = findCrossings(p, tmpCellSegments); 406 if (!crossingWays.isEmpty()) { 407 addToChildren(e, p); 408 if (e.crossingWaysMap == null) { 409 e.crossingWaysMap = new HashMap<>(); 410 } 411 e.crossingWaysMap.put(p, crossingWays); 403 412 } 404 413 }
Note:
See TracChangeset
for help on using the changeset viewer.