[mkgmap] 01/05: Imported Upstream version 0.0.0+svn3676

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Wed May 4 07:04:48 UTC 2016


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository mkgmap.

commit f268957f373f19ecd0776acec58854db161656d5
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Wed May 4 08:44:21 2016 +0200

    Imported Upstream version 0.0.0+svn3676
---
 doc/options.txt                                    |  5 +--
 doc/styles/internal-tags.txt                       |  2 +-
 resources/help/en/options                          |  6 ++--
 resources/mkgmap-version.properties                |  4 +--
 resources/styles/default/lines                     | 18 +++++-----
 src/uk/me/parabola/mkgmap/main/StyleTester.java    | 16 +++++++++
 src/uk/me/parabola/mkgmap/osmstyle/ActionRule.java |  5 +++
 .../parabola/mkgmap/osmstyle/ExpressionRule.java   |  5 +++
 src/uk/me/parabola/mkgmap/osmstyle/RuleSet.java    | 19 +++++++++++
 .../parabola/mkgmap/osmstyle/StyledConverter.java  |  6 +++-
 .../mkgmap/reader/osm/LinkDestinationHook.java     | 38 ++++++++++++++--------
 src/uk/me/parabola/mkgmap/reader/osm/Rule.java     |  2 ++
 12 files changed, 93 insertions(+), 33 deletions(-)

diff --git a/doc/options.txt b/doc/options.txt
index 2a5eea9..a851d7d 100644
--- a/doc/options.txt
+++ b/doc/options.txt
@@ -633,11 +633,12 @@ are ignored for pedestrian-only ways.
 ;--process-destination
 : 	Splits all motorway_link, trunk_link, primary_link, secondary_link,
 and tertiary_link ways tagged with destination into two or three parts where 
-the second part is additionally tagged with mkgmap:dest_hint=true.
+the second part is additionally tagged with mkgmap:dest_hint=*.
 The code checks for the tags destination, destination:lanes, 
 destination:street and some variants with :forward/:backward like
 destination:forward or destination:lanes:backward. If a value for
-destination is found, the tag destination is set to it and the way is split.
+destination is found, the special tag mkgmap:dest_hint is set to  
+it  and the way is split.
 This happens before the style rules are processed.
 This allows to use any routable Garmin type (except 0x08 and 0x09)
 for that part so that the Garmin device tells the name of
diff --git a/doc/styles/internal-tags.txt b/doc/styles/internal-tags.txt
index 2420a07..80643f2 100644
--- a/doc/styles/internal-tags.txt
+++ b/doc/styles/internal-tags.txt
@@ -120,7 +120,7 @@ is used to assign the country location.
 | +mkgmap:exit_hint_name+  | The +name+ tag value of the links exit node | 'process-exits'    
 | +mkgmap:exit_hint_ref+  | The +ref+ tag value of the links exit node | 'process-exits'    
 | +mkgmap:exit_hint_exit_to+  | The +exit_to+ tag value of the links exit node | 'process-exits'    
-| +mkgmap:dest_hint+  | +true+ for the part on link roads that should contain destination information about the link | 'process-destination'    
+| +mkgmap:dest_hint+  | The tag is set to a reasonable destination value for the part on link roads that should contain destination information about the link | 'process-destination'    
 | +mkgmap:synthesised+  | The value is +yes+ if the way was added by the make-opposite-cycleways option | 'make-opposite-cycleways'
 | +mkgmap:mp_created+  | The value is +true+ if the way was created by the internal multi-polygon-relation handling | none
 |=========================================================
diff --git a/resources/help/en/options b/resources/help/en/options
index f3ad0cc..5c579ae 100644
--- a/resources/help/en/options
+++ b/resources/help/en/options
@@ -630,12 +630,12 @@ Miscellaneous options:
 --process-destination
 	Splits all motorway_link, trunk_link, primary_link, secondary_link,
 	and tertiary_link ways tagged with destination into two or three parts where 
-	the second part is additionally tagged with mkgmap:dest_hint=true.
+	the second part is additionally tagged with mkgmap:dest_hint=*.
 	The code checks for the tags destination, destination:lanes, 
 	destination:street and some variants with :forward/:backward like
 	destination:forward or destination:lanes:backward. If a value for
-	destination is found, the tag destination is set to it and the way is split.
-	This happens before the style rules are processed.
+	destination is found, the special tag mkgmap:dest_hint is set to 
+	it and the way is split. This happens before the style rules are processed.
 	This allows to use any routable Garmin type (except 0x08 and 0x09)
 	for that part so that the Garmin device tells the name of
 	this part as hint which destination to follow.     
diff --git a/resources/mkgmap-version.properties b/resources/mkgmap-version.properties
index dae105d..d5d1fd0 100644
--- a/resources/mkgmap-version.properties
+++ b/resources/mkgmap-version.properties
@@ -1,2 +1,2 @@
-svn.version: 3674
-build.timestamp: 2016-03-25T23:18:19+0000
+svn.version: 3676
+build.timestamp: 2016-04-02T12:58:33+0100
diff --git a/resources/styles/default/lines b/resources/styles/default/lines
index c1bf020..bb534c4 100644
--- a/resources/styles/default/lines
+++ b/resources/styles/default/lines
@@ -50,14 +50,12 @@ highway=motorway { name '${ref|highway-symbol:hbox} ${name}' | '${ref|highway-sy
 # which may add info to a part of these highway=*_link roads:
 # motorway_link, trunk_link, primary_link, secondary_link, tertiary_link
 # build destination hint 
-dest_hint=* { delete dest_hint }
-mkgmap:dest_hint=true
-  { set dest_hint = '${destination:ref|subst: =>} ${destination|subst:;=> |subst:/=> }' |
-         '${ref|subst: =>} ${destination|subst:;=> |subst:/=> }' | 
-         '${destination|subst:;=> |subst:/=> }';
+mkgmap:dest_hint=*
+  { set dest_hint = '${destination:ref|subst: =>} ${mkgmap:dest_hint|subst:;=> |subst:/=> }' |
+         '${ref|subst: =>} ${mkgmap:dest_hint|subst:;=> |subst:/=> }' | 
+         '${mkgmap:dest_hint|subst:;=> |subst:/=> }';
        }
 # build exit hint 
-exit_hint=* { delete exit_hint }
 mkgmap:exit_hint=true 
   { set exit_hint = 'Exit ${mkgmap:exit_hint_ref} ${mkgmap:exit_hint_name}' | 
          'Exit ${mkgmap:exit_hint_ref} ${mkgmap:exit_hint_exit_to}' | 
@@ -67,7 +65,7 @@ mkgmap:exit_hint=true
        }
   
 # use destination hint and/or exit hint to build name              
-(mkgmap:exit_hint=true | mkgmap:dest_hint=true)
+(mkgmap:exit_hint=true | mkgmap:dest_hint=*)
   {	name '${exit_hint} ${dest_hint}' | 	'${dest_hint}' | 		'${exit_hint}' }
 # end of rules for process-exits and process-destination options	
   
@@ -129,17 +127,17 @@ highway=* & disused=yes & maxspeed!=* { add mkgmap:road-speed = '-2' }
 # Ways sorted roughly by descending order of class
 highway=motorway & network=e-road [0x01 resolution 14-14 continue]
 highway=motorway  [0x01 road_class=4 road_speed=7 resolution 15]
-highway=motorway_link & (mkgmap:exit_hint=true | mkgmap:dest_hint=true) [0x06 road_class=3 road_speed=2 resolution 20]
+highway=motorway_link & (mkgmap:exit_hint=true | mkgmap:dest_hint=*) [0x06 road_class=3 road_speed=2 resolution 20]
 highway=motorway_link [0x09 road_class=3 road_speed=2 resolution 20]
 
 highway=trunk & ( network=e-road | int_ref=* ) [0x02 resolution 15-17 continue]
 highway=trunk [0x02 road_class=4 road_speed=5 resolution 18]
-highway=trunk_link & (mkgmap:exit_hint=true | mkgmap:dest_hint=true) [0x06 road_class=3 road_speed=2 resolution 20]
+highway=trunk_link & (mkgmap:exit_hint=true | mkgmap:dest_hint=*) [0x06 road_class=3 road_speed=2 resolution 20]
 highway=trunk_link [0x09 road_class=3 road_speed=2 resolution 20]
 highway=* & motorroad=yes [0x02 road_class=4 road_speed=4 resolution 18]
 highway=primary & ( network=e-road | int_ref=* ) [0x03 resolution 17-18 continue]
 highway=primary [0x03 road_class=3 road_speed=4 resolution 19]
-highway=primary_link & (mkgmap:exit_hint=true | mkgmap:dest_hint=true)[0x06 road_class=3 road_speed=1 resolution 21]
+highway=primary_link & (mkgmap:exit_hint=true | mkgmap:dest_hint=*)[0x06 road_class=3 road_speed=1 resolution 21]
 highway=primary_link [0x08 road_class=3 road_speed=1 resolution 21]
 highway=secondary & ( network=e-road | int_ref=* ) [0x04 resolution 18-19 continue]
 highway=secondary [0x04 road_class=2 road_speed=3 resolution 20]
diff --git a/src/uk/me/parabola/mkgmap/main/StyleTester.java b/src/uk/me/parabola/mkgmap/main/StyleTester.java
index 5024c47..e2fe865 100644
--- a/src/uk/me/parabola/mkgmap/main/StyleTester.java
+++ b/src/uk/me/parabola/mkgmap/main/StyleTester.java
@@ -686,6 +686,22 @@ public class StyleTester implements OsmConverter {
 			public void printStats(String header) {
 				// TODO Auto-generated method stub
 			}
+
+			@Override
+			public boolean containsExpression(String exp) {
+				if (rules == null) {
+					// this method must be called after prepare() is called so
+					// that we have rules to which the finalize rules can be applied
+					throw new IllegalStateException("First call prepare() before setting the finalize rules");
+				}
+				for (Rule rule : rules){
+					if (rule.containsExpression(exp))
+						return true;
+				}
+				if (getFinalizeRule()!= null && getFinalizeRule().containsExpression(exp))
+					return true;
+				return false;
+			}
 		}
 
 		/**
diff --git a/src/uk/me/parabola/mkgmap/osmstyle/ActionRule.java b/src/uk/me/parabola/mkgmap/osmstyle/ActionRule.java
index 187cee6..9d6185e 100644
--- a/src/uk/me/parabola/mkgmap/osmstyle/ActionRule.java
+++ b/src/uk/me/parabola/mkgmap/osmstyle/ActionRule.java
@@ -184,4 +184,9 @@ public class ActionRule implements Rule {
 		if (statsLog.isInfoEnabled())
 			statsLog.info(header,"stats (rule/evals/true)", this.toString() + "/" + numEval + "/" + numTrue);
 	}
+
+	@Override
+	public boolean containsExpression(String exp) {
+		return expression.toString().contains(exp);
+	}
 }
diff --git a/src/uk/me/parabola/mkgmap/osmstyle/ExpressionRule.java b/src/uk/me/parabola/mkgmap/osmstyle/ExpressionRule.java
index eea666c..cfa586d 100644
--- a/src/uk/me/parabola/mkgmap/osmstyle/ExpressionRule.java
+++ b/src/uk/me/parabola/mkgmap/osmstyle/ExpressionRule.java
@@ -113,4 +113,9 @@ public class ExpressionRule implements Rule {
 		if (statsLog.isInfoEnabled())
 			statsLog.info(header,"stats (rule/evals/true)", this.toString() + "/" + numEval + "/" + numTrue);
 	}
+
+	@Override
+	public boolean containsExpression(String exp) {
+		return expression.toString().contains(exp);
+	}
 }
diff --git a/src/uk/me/parabola/mkgmap/osmstyle/RuleSet.java b/src/uk/me/parabola/mkgmap/osmstyle/RuleSet.java
index b7048b5..3966a53 100644
--- a/src/uk/me/parabola/mkgmap/osmstyle/RuleSet.java
+++ b/src/uk/me/parabola/mkgmap/osmstyle/RuleSet.java
@@ -288,5 +288,24 @@ public class RuleSet implements Rule, Iterable<Rule> {
 		if (finalizeRule != null)
 			finalizeRule.printStats(header);
 	}
+	
+	@Override
+	public boolean containsExpression(String exp) {
+		if (rules == null) {
+			// this method must be called after prepare() is called so
+			// that we have rules to which the finalize rules can be applied
+			throw new IllegalStateException("First call prepare() before setting the finalize rules");
+		}
+		for (Rule rule : rules){
+			if (rule.containsExpression(exp))
+				return true;
+		}
+		if (finalizeRule != null){
+			if (finalizeRule.containsExpression(exp))
+				return true;
+		}
+		return false;
+	}
 
+	
 } 
\ No newline at end of file
diff --git a/src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java b/src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java
index 5dc6287..08f1cb9 100644
--- a/src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java
+++ b/src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java
@@ -172,7 +172,11 @@ public class StyledConverter implements OsmConverter {
 		nodeRules = style.getNodeRules();
 		lineRules = style.getLineRules();
 		polygonRules = style.getPolygonRules();
-		
+		// perform legacy test, older versions of mkgmap used to set mkgmap:dest_hint=true
+		// newer version will set it to a reasonable destination string
+		if (lineRules.containsExpression("$mkgmap:dest_hint='true'")){
+			log.error("At least one 'lines' rule in the style contains the expression mkgmap:dest_hint=true, it should be changed to mkgmap:dest_hint=*");
+		}
 		housenumberGenerator = new HousenumberGenerator(props);
 		
 		driveOn = props.getProperty("drive-on", null);
diff --git a/src/uk/me/parabola/mkgmap/reader/osm/LinkDestinationHook.java b/src/uk/me/parabola/mkgmap/reader/osm/LinkDestinationHook.java
index db2bff1..7430dab 100644
--- a/src/uk/me/parabola/mkgmap/reader/osm/LinkDestinationHook.java
+++ b/src/uk/me/parabola/mkgmap/reader/osm/LinkDestinationHook.java
@@ -153,8 +153,11 @@ public class LinkDestinationHook extends OsmReadingHooksAdaptor {
 							destSourceTagKey = "destination:street";
 							destinationTag = w.getTag(destSourceTagKey);
 						}
-						if (destinationTag != null && "destination".equals(destSourceTagKey) == false){
-							w.addTag("destination", destinationTag);
+						
+					}
+					if (destinationTag != null){
+						w.addTag("mkgmap:dest_hint_work", destinationTag);
+						if ("destination".equals(destSourceTagKey) == false){
 							if (log.isDebugEnabled()){
 								if (destSourceTagKey.startsWith("destination:lanes"))
 									log.debug("Use",destSourceTagKey,"as destination tag because there is one lane information only. Way ",w.getId(),w.toTagString());
@@ -162,9 +165,6 @@ public class LinkDestinationHook extends OsmReadingHooksAdaptor {
 									log.debug("Use",destSourceTagKey,"as destination tag. Way ",w.getId(),w.toTagString());
 							}
 						}
-						
-					}
-					if (destinationTag != null){
 						destinationLinkWays.put(w.getId(), w);
 					}
 				}
@@ -453,7 +453,7 @@ public class LinkDestinationHook extends OsmReadingHooksAdaptor {
 	 * and/or the option process-destination is set and the destination tag is
 	 * set. The mid part way is tagged additionally with the following tags:
 	 * <ul>
-	 * <li>mkgmap:dest_hint=true (for destinations)</li>
+	 * <li>mkgmap:dest_hint=* (for destinations)</li>
 	 * <li>mkgmap:exit_hint=true (for exits)</li>
 	 * <li>mkgmap:exit_hint_ref: Tagged with the ref tag value of the motorway
 	 * junction node</li>
@@ -464,7 +464,7 @@ public class LinkDestinationHook extends OsmReadingHooksAdaptor {
 	 * </ul>
 	 * Style implementors can use the common Garmin code 0x09 for motorway_links
 	 * and any other routable id (except 0x08 and 0x09) for the links with
-	 * mkgmap:exit_hint=true and/or mkgmap:dest_hint=true. The naming of this
+	 * mkgmap:exit_hint=true and/or mkgmap:dest_hint=*. The naming of this
 	 * middle way can be typically assigned from destination, ref, destination:ref, 
 	 * mkgmap:exit_hint_ref, mkgmap:exit_hint_name and/or mkgmap:exit_hint_exit_to.
 	 */
@@ -476,8 +476,7 @@ public class LinkDestinationHook extends OsmReadingHooksAdaptor {
 		log.debug(destinationLinkWays.size(),"links with destination tag");
 		while (linksWithDestination.isEmpty()== false) {
 			Way linkWay = linksWithDestination.poll();
-			String destination = linkWay.getTag("destination");
-
+			String destination = linkWay.getTag("mkgmap:dest_hint_work");
 			if (log.isDebugEnabled())
 				log.debug("Check way",linkWay.getId(),linkWay.toTagString());
 			
@@ -490,7 +489,8 @@ public class LinkDestinationHook extends OsmReadingHooksAdaptor {
 			Set<Way> nextWays = adjacentWays.get(c);
 			if (nextWays != null) {
 				for (Way connectedWay : nextWays) {
-					String nextDest = connectedWay.getTag("destination");
+					String nextDest = connectedWay.getTag("mkgmap:dest_hint_work");
+					
 					if (log.isDebugEnabled())
 						log.debug("Followed by",connectedWay.getId(),connectedWay.toTagString());
 
@@ -615,9 +615,12 @@ public class LinkDestinationHook extends OsmReadingHooksAdaptor {
 								log.info("Way", w, "is too short to cut at least 20m from it. Cannot create exit hint.");
 							} else {
 								hintWay.addTag("mkgmap:exit_hint", "true");
-								
-								if (processDestinations && hintWay.getTag("destination") != null) {
-									hintWay.addTag("mkgmap:dest_hint", "true");
+								if (processDestinations) {
+									String hint = hintWay.getTag("mkgmap:dest_hint_work");
+									if (hint != null){
+										hintWay.deleteTag("mkgmap:dest_hint_work");
+										hintWay.addTag("mkgmap:dest_hint", hint);
+									}
 								}
 								if (exitNode.getTag("ref") != null)
 									hintWay.addTag("mkgmap:exit_hint_ref", exitNode.getTag("ref"));
@@ -705,7 +708,13 @@ public class LinkDestinationHook extends OsmReadingHooksAdaptor {
 					if (hintWay == null) {
 						log.info("Way", w, "is too short to cut at least 20m from it. Cannot create destination hint.");
 					} else {
-						hintWay.addTag("mkgmap:dest_hint", "true");
+						String hint = hintWay.getTag("mkgmap:dest_hint_work");
+						if (hint != null){
+							hintWay.deleteTag("mkgmap:dest_hint_work");
+							hintWay.addTag("mkgmap:dest_hint", hint);
+						} else {
+							log.error("Internal error in process_destination with way",hintWay);
+						}
 						
 						if (log.isInfoEnabled())
 							log.info("Cut off exit hint way", hintWay, hintWay.toTagString());
@@ -758,6 +767,7 @@ public class LinkDestinationHook extends OsmReadingHooksAdaptor {
 		// referenced in the style file
 		Set<String> tags = new HashSet<String>();
 		tags.add("highway");
+		tags.add("destination");
 		tags.add("destination:lanes");
 		tags.add("destination:lanes:forward");
 		tags.add("destination:lanes:backward");
diff --git a/src/uk/me/parabola/mkgmap/reader/osm/Rule.java b/src/uk/me/parabola/mkgmap/reader/osm/Rule.java
index dba5680..85e23ba 100644
--- a/src/uk/me/parabola/mkgmap/reader/osm/Rule.java
+++ b/src/uk/me/parabola/mkgmap/reader/osm/Rule.java
@@ -56,5 +56,7 @@ public interface Rule {
 	public void printStats(String header);
 
 	public Rule getFinalizeRule();
+
+	public boolean containsExpression(String exp);
 	
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/mkgmap.git



More information about the Pkg-grass-devel mailing list