The attached small patch implements a --rhd option that sets a couple
of bits in the map data that tell the GPS that the vehicles are RHD and
that roundabouts are navigated in a clockwise direction. This will make
the little roundabout piccy shown in the top left of the screen (on the
Nuvis, at least) have the correct sense for the few countries that drive
on the left.
Should have done this months ago when it was previously discussed,
sorry.
It could be done automatically by sensing the roundabout direction but
I'm feeling too lazy to write that code for now.
Mark
diff --git a/resources/help/en/options b/resources/help/en/options
index a608abc..2f2f4f6 100644
--- a/resources/help/en/options
+++ b/resources/help/en/options
@@ -178,6 +178,12 @@ Miscellaneous options:
Experimental: Create maps that support routing. This implies --net
(so that --net need not be given if --route is given).
+--rhd
+ By default, the GPS assumes that vehicles are left hand drive and
+ that roundabouts are navigated in a counter clockwise direction.
+ This option specifies that vehicles are right hand drive and,
+ therefore, roundabouts are navigated in a clockwise direction.
+
--ignore-maxspeeds
When reading OSM files, ignore any "maxspeed" tags.
diff --git a/src/uk/me/parabola/imgfmt/app/map/Map.java b/src/uk/me/parabola/imgfmt/app/map/Map.java
index 7ef1941..5f94735 100644
--- a/src/uk/me/parabola/imgfmt/app/map/Map.java
+++ b/src/uk/me/parabola/imgfmt/app/map/Map.java
@@ -116,6 +116,8 @@ public class Map implements InternalFiles, Configurable {
if (props.containsKey("route")) {
addNet();
addNod();
+ if(props.containsKey("rhd"))
+ nodFile.setRhd(true);
} else if (props.containsKey("net")) {
addNet();
}
diff --git a/src/uk/me/parabola/imgfmt/app/net/NODFile.java b/src/uk/me/parabola/imgfmt/app/net/NODFile.java
index b910dfa..21bbe7a 100644
--- a/src/uk/me/parabola/imgfmt/app/net/NODFile.java
+++ b/src/uk/me/parabola/imgfmt/app/net/NODFile.java
@@ -150,4 +150,8 @@ public class NODFile extends ImgFile {
this.roads = roads;
this.boundary = boundary;
}
+
+ public void setRhd(boolean rhd) {
+ nodHeader.setRhd(rhd);
+ }
}
diff --git a/src/uk/me/parabola/imgfmt/app/net/NODHeader.java b/src/uk/me/parabola/imgfmt/app/net/NODHeader.java
index 1623fa7..5f424eb 100644
--- a/src/uk/me/parabola/imgfmt/app/net/NODHeader.java
+++ b/src/uk/me/parabola/imgfmt/app/net/NODHeader.java
@@ -37,6 +37,8 @@ public class NODHeader extends CommonHeader {
private final char align = DEF_ALIGN;
+ private boolean rhd;
+
public NODHeader() {
super(HEADER_LEN, "GARMIN NOD");
}
@@ -62,7 +64,10 @@ public class NODHeader extends CommonHeader {
nodes.writeSectionInfo(writer);
// now sets 0x02 (enable turn restrictions?)
- writer.putInt(0x27);
+ int val = 0x27;
+ if(rhd)
+ val |= 0x0300;
+ writer.putInt(val);
writer.putChar(align);
writer.putChar((char) (align - 1));
@@ -100,4 +105,8 @@ public class NODHeader extends CommonHeader {
public Section getBoundarySection() {
return boundary;
}
+
+ public void setRhd(boolean rhd) {
+ this.rhd = rhd;
+ }
}
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev