[PATCH] turn restrictions - alpha code for testing (v2)

Hi, The attached v2 patch now notices if the restriction type has not been specified and so it prints a more useful message than before. Don't bother to use this if you already have the first patch unless you want to. Cheers, Mark

Hi Mark, thanks for the patch. I had to add some small error checks to complete the generation of my Bavaria map with turn restrictions. Otherwise I ended up in null pointer exceptions. Please see the attached incremental patch to your v2 one. Still a lot of restrictions to fix but the Nuvi 360 seams to behave well with the remaining ones. Berni. Mark Burton schrieb:
Hi,
The attached v2 patch now notices if the restriction type has not been specified and so it prints a more useful message than before. Don't bother to use this if you already have the first patch unless you want to.
Cheers,
Mark
------------------------------------------------------------------------
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Index: src/uk/me/parabola/mkgmap/reader/osm/RestrictionRelation.java =================================================================== --- src/uk/me/parabola/mkgmap/reader/osm/RestrictionRelation.java (revision 247) +++ src/uk/me/parabola/mkgmap/reader/osm/RestrictionRelation.java (working copy) @@ -171,6 +171,7 @@ bleat += " ('to' way starts at " + toWay.getPoints().get(0).toDegreeString() + ")"; } log.error(bleat); + return false; } if(toWay == null) { @@ -180,6 +181,7 @@ bleat += " ('from' way ends at " + fp.get(fp.size() - 1).toDegreeString() + ")"; } log.error(bleat); + return false; } if(viaCoord == null) { Index: src/uk/me/parabola/mkgmap/general/RoadNetwork.java =================================================================== --- src/uk/me/parabola/mkgmap/general/RoadNetwork.java (revision 247) +++ src/uk/me/parabola/mkgmap/general/RoadNetwork.java (working copy) @@ -186,7 +186,8 @@ assert fromArc != null : "can't locate arc from 'via' node"; assert toArc != null : "can't locate arc to 'via' node"; - vn.addRestriction(new RouteRestriction(fromArc, toArc)); + if(fromArc != null && toArc != null) + vn.addRestriction(new RouteRestriction(fromArc, toArc)); } }

Hi Bernhard,
thanks for the patch. I had to add some small error checks to complete the generation of my Bavaria map with turn restrictions. Otherwise I ended up in null pointer exceptions. Please see the attached incremental patch to your v2 one. Still a lot of restrictions to fix but the Nuvi 360 seams to behave well with the remaining ones.
Thanks for the fixes. The first part of your patch has already been fixed in my current code. The second part puzzles me. You obviously do not have assertions enabled because they would have caught the null arcs. Please try with assertions enabled and see what happens. Cheers, Mark
participants (2)
-
Bernhard Heibler
-
Mark Burton