Ticket #20054: 20054.patch
File 20054.patch, 1.9 KB (added by , 5 years ago) |
---|
-
src/org/openstreetmap/josm/tools/Geometry.java
633 633 Area inter = new Area(a1); 634 634 inter.intersect(a2); 635 635 636 boolean b1InsideB2 = a2.getBounds2D().contains(a1.getBounds2D()); 637 boolean b2InsideB1 = a1.getBounds2D().contains(a2.getBounds2D()); 638 636 639 if (inter.isEmpty() || !checkIntersection(inter, eps)) { 637 640 return new Pair<>(PolygonIntersection.OUTSIDE, inter); 638 } else if ( a2.getBounds2D().contains(a1.getBounds2D())&& inter.equals(a1)) {641 } else if (b1InsideB2 && inter.equals(a1)) { 639 642 return new Pair<>(PolygonIntersection.FIRST_INSIDE_SECOND, inter); 640 } else if ( a1.getBounds2D().contains(a2.getBounds2D())&& inter.equals(a2)) {643 } else if (b2InsideB1 && inter.equals(a2)) { 641 644 return new Pair<>(PolygonIntersection.SECOND_INSIDE_FIRST, inter); 642 } else { 643 return new Pair<>(PolygonIntersection.CROSSING, inter); 645 } else if (b1InsideB2) { 646 // see #20054 647 Area doubleCheck = new Area(inter); 648 doubleCheck.subtract(a1); 649 if (doubleCheck.isEmpty() || !checkIntersection(doubleCheck, eps)) { 650 return new Pair<>(PolygonIntersection.FIRST_INSIDE_SECOND, inter); 651 } 652 } else if (b2InsideB1) { 653 // see #20054 654 Area doubleCheck = new Area(inter); 655 doubleCheck.subtract(a2); 656 if (doubleCheck.isEmpty() || !checkIntersection(doubleCheck, eps)) { 657 return new Pair<>(PolygonIntersection.SECOND_INSIDE_FIRST, inter); 658 } 644 659 } 660 return new Pair<>(PolygonIntersection.CROSSING, inter); 645 661 } 646 662 647 663 /**