Attached is a patch that removes the handling of the special tag mkgmap:gtype.

WanMil


When looking through mkgmap special tags I found the tag mgkmap:gtype
and wonder if anyone still uses it.

Mark Burton described its functionality:
http://www.mkgmap.org.uk/pipermail/mkgmap-dev/2009q3/003171.html

Is this tag still used or can this be removed?

According to other comments regarding rework of different options we
want to remove all obsolete stuff from mkgmap and I think the style
system is so powerful today that mkgmap:gtype could be removed.

WanMil

Index: resources/styles/builtin-tag-list
===================================================================
--- resources/styles/builtin-tag-list	(revision 2423)
+++ resources/styles/builtin-tag-list	(working copy)
@@ -15,7 +15,6 @@
 int_ref
 junction
 maxspeed
-mkgmap:gtype
 name
 nat_ref
 oneway
Index: src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java
===================================================================
--- src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java	(revision 2423)
+++ src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java	(working copy)
@@ -59,7 +59,6 @@
 import uk.me.parabola.mkgmap.reader.osm.Style;
 import uk.me.parabola.mkgmap.reader.osm.TypeResult;
 import uk.me.parabola.mkgmap.reader.osm.Way;
-import uk.me.parabola.mkgmap.reader.polish.PolishMapDataSource;
 
 /**
  * Convert from OSM to the mkgmap intermediate format using a style.
@@ -176,87 +175,6 @@
 			lineAdder = overlayAdder;
 	}
 
-	private static final Pattern commaPattern = Pattern.compile(",");
-
-	private GType makeGTypeFromTags(Element element) {
-		String[] vals = commaPattern.split(element.getTag("mkgmap:gtype"));
-
-		if(vals.length < 3) {
-			log.error("OSM element " + element.getId() + " has bad mkgmap:gtype value (should be 'kind,code,minres,[maxres],[roadclass],[roadspeed])");
-			log.error("  where kind is " + GType.POINT + "=point, " + GType.POLYLINE + "=polyline, " + GType.POLYGON + "=polygon");
-			return null;
-		}
-
-		String name = element.getTag("name");
-		if(name != null)
-			element.setName(PolishMapDataSource.unescape(name));
-
-		for(int i = 0; i < vals.length; ++i)
-			vals[i] = vals[i].trim();
-
-		int kind;
-		try {
-			kind = Integer.decode(vals[0]);
-		}
-		catch (NumberFormatException nfe) {
-			log.error("OSM element " + element.getId() + " has bad value for kind: " + vals[0]);
-			return null;
-		}
-
-		if(kind != GType.POINT &&
-		   kind != GType.POLYLINE &&
-		   kind != GType.POLYGON) {
-			log.error("OSM element " + element.getId() + " has bad value for kind, is " + kind + " but should be " + GType.POINT + ", " + GType.POLYLINE + " or " + GType.POLYGON);
-			return null;
-		}
-
-		try {
-			Integer.decode(vals[1]);
-		}
-		catch (NumberFormatException nfe) {
-			log.error("OSM element " + element.getId() + " has bad value for type: " + vals[1]);
-			return null;
-		}
-
-		GType gt = new GType(kind, vals[1]);
-
-		try {
-			gt.setMinResolution(Integer.decode(vals[2]));
-		}
-		catch (NumberFormatException nfe) {
-			log.error("OSM element " + element.getId() + " has bad value for minres: " + vals[2]);
-		}
-
-		if(vals.length >= 4 && vals[3].length() > 0) {
-			try {
-				gt.setMaxResolution(Integer.decode(vals[3]));
-			}
-			catch (NumberFormatException nfe) {
-				log.error("OSM element " + element.getId() + " has bad value for maxres tag: " + vals[3]);
-			}
-		}
-
-		if(vals.length >= 5 && vals[4].length() > 0) {
-			try {
-				gt.setRoadClass(Integer.decode(vals[4]));
-			}
-			catch (NumberFormatException nfe) {
-				log.error("OSM element " + element.getId() + " has bad value for roadclass: " + vals[4]);
-			}
-		}
-
-		if(vals.length >= 6 && vals[5].length() > 0) {
-			try {
-				gt.setRoadSpeed(Integer.decode(vals[5]));
-			}
-			catch (NumberFormatException nfe) {
-				log.error("OSM element " + element.getId() + " has bad value for roadspeed: " + vals[5]);
-			}
-		}
-
-		return gt;
-	}
-
 	/**
 	 * This takes the way and works out what kind of map feature it is and makes
 	 * the relevant call to the mapper callback.
@@ -275,14 +193,6 @@
 			return;
 		}
 
-		if(way.getTag("mkgmap:gtype") != null) {
-			GType foundType = makeGTypeFromTags(way);
-			if(foundType == null)
-				return;
-			addConvertedWay(way, foundType);
-			return;
-		}
-
 		preConvertRules(way);
 
 		Rule rules;
@@ -333,15 +243,6 @@
 			return;
 		}
 
-		if(node.getTag("mkgmap:gtype") != null) {
-			GType foundType = makeGTypeFromTags(node);
-			if(foundType == null)
-				return;
-
-			addPoint(node, foundType);
-			return;
-		}
-
 		preConvertRules(node);
 
 		nodeRules.resolveType(node, new TypeResult() {
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to