[Patch] Improve MapMaker.roadsAreJoined()

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Patch] Improve MapMaker.roadsAreJoined()

Gerd Petermann
Hi,

roadsAreJoined() tests all points of one MapLine against all points of another MapLine instance.
It should first check the previously calculated bounding boxes to eliminate many unsuccesfull loops.


Gerd

Index: src/uk/me/parabola/mkgmap/main/MapMaker.java
===================================================================
--- src/uk/me/parabola/mkgmap/main/MapMaker.java (revision 2232)
+++ src/uk/me/parabola/mkgmap/main/MapMaker.java (working copy)
@@ -196,6 +196,8 @@
  private boolean roadsAreJoined(MapLine r1, MapLine r2) {
 
  if(r1 != r2) {
+ if (r1.getBounds().intersects(r2.getBounds()) == false)
+ return false;
  for(Coord c1 : r1.getPoints()) {
  for(Coord c2 : r2.getPoints()) {
  if(c1 == c2 || c1.equals(c2))