v2 - split out the non-related changes (they have now been committed so
this patch is based on r1064).

--------------

OK Felix, here's something to play with. This patch allows you to
specify the garmin type of a road's RNP using a mkgmap:rnptype tag. You
can then set that tag in a style file when you match some other tag
values.

Like this (silly) example that makes the RNP generated for a footway to
be a zoo:

highway=footway {add mkgmap:rnptype=0x2c07; add access = no; add foot =
yes} [0x16 road_class=0 road_speed=0 resolution 23]

Alternatively, you could add that tag directly into the OSM XML or
even pre-process the OSM XML to add the tag conditionally.

The patch also contains a couple of other un-related changes that will
be committed separately if they are OK.

Cheers,

Mark

diff --git a/src/uk/me/parabola/mkgmap/general/MapRoad.java b/src/uk/me/parabola/mkgmap/general/MapRoad.java
index 2b0a96a..4c19696 100644
--- a/src/uk/me/parabola/mkgmap/general/MapRoad.java
+++ b/src/uk/me/parabola/mkgmap/general/MapRoad.java
@@ -16,6 +16,9 @@
  */
 package uk.me.parabola.mkgmap.general;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import uk.me.parabola.imgfmt.app.lbl.City;
 import uk.me.parabola.imgfmt.app.lbl.Zip;
 import uk.me.parabola.imgfmt.app.net.RoadDef;
@@ -36,6 +39,7 @@ import uk.me.parabola.imgfmt.app.net.RoadDef;
 public class MapRoad extends MapLine {
 
 	private final RoadDef roadDef;
+	private Map<String, String> attributes;
 
 	public MapRoad(long id, MapLine line) {
 		super(line);
@@ -108,4 +112,14 @@ public class MapRoad extends MapLine {
 	public void setRoadZip(Zip z) {
 		this.roadDef.setZip(z);
 	}
+
+	public void setAttribute(String tag, String val) {
+		if(attributes == null)
+			attributes = new HashMap<String, String>();
+		attributes.put(tag, val);
+	}
+
+	public String getAttribute(String tag) {
+		return (attributes == null)? null : attributes.get(tag);
+	}
 }
diff --git a/src/uk/me/parabola/mkgmap/main/MapMaker.java b/src/uk/me/parabola/mkgmap/main/MapMaker.java
index cd36079..49c4a7d 100644
--- a/src/uk/me/parabola/mkgmap/main/MapMaker.java
+++ b/src/uk/me/parabola/mkgmap/main/MapMaker.java
@@ -236,8 +236,11 @@ public class MapMaker implements MapProcessor {
 				rnpRoads.add(new Sortable<String, MapRoad>(key, r));
 			}
 			Collections.sort(rnpRoads);
-			for(Sortable<String, MapRoad> sr : rnpRoads)
-				src.getPoints().add(makeRoadNamePOI(sr.getValue(), rnpt));
+			for(Sortable<String, MapRoad> sr : rnpRoads) {
+				MapRoad r = sr.getValue();
+				String rnptype = r.getAttribute("rnptype");
+				src.getPoints().add(makeRoadNamePOI(r, (rnptype != null)? Integer.decode(rnptype) : rnpt));
+			}
 		}
 	}
 
diff --git a/src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java b/src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java
index 9197bc0..ae06175 100644
--- a/src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java
+++ b/src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java
@@ -625,6 +625,10 @@ public class StyledConverter implements OsmConverter {
 
 		MapRoad road = new MapRoad(way.getId(), line);
 
+		String rnptype = way.getTag("mkgmap:rnptype");
+		if(rnptype != null)
+			road.setAttribute("rnptype", rnptype);
+
 		// set road parameters.
 		road.setRoadClass(gt.getRoadClass());
 		if (way.isBoolTag("oneway")) {
_______________________________________________
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to