[Patch] Improve multipolygon validator
I noticed that the multipolygon validator needs a long time
to validate complex polygons, esp. when the outer polygon is very complex and
also inner complex polygons exist.
In my test data the rel 1956189 requires
DEBUG: Test 'Multipolygon' completed in 2 min 46 s
I looked at the code and found that the method
PolygonIntersection org.openstreetmap.josm.tools.Geometry.polygonIntersection(Area a1, Area a2, double eps)
calls the cpu expensive method inter.equals(a1) without checking first
if the bbox of a1 fits into the bbox of a2, which can be done much cheaper.
The same happens with inter.equals(a2)
Attached is a patch that implements the improvement,
in my test case the time was reduced to
DEBUG: Test 'Multipolygon' completed in 47.8 s
Change History
(5)
Resolution: |
→ fixed
|
Status: |
new → closed
|
test data containing complex mp rel