[mkgmap-dev] Support for seamark tags in default style

2010-01-27 Thread Mark Burton

Hi Marko,

I haven't changed the seamark style stuff for a while now so I wonder
if the attached rules could be incorporated into the default style so
that anyone can generate maps with lights  buoys, etc.

Mark

PS - did you try the patch I posted yesterday to fix the error messages
you were seeing when generating sea?




# begin seamark marine objects


# add mkgmap:xt- tags

seamark:light:ref=* { add mkgmap:xt-int-desig='${seamark:light:ref}'; }
seamark:beacon_lateral:ref=* { add 
mkgmap:xt-int-desig='${seamark:beacon_lateral:ref}'; }
seamark:buoy_lateral:ref=* { add 
mkgmap:xt-int-desig='${seamark:buoy_lateral:ref}'; }

seamark:light:height=* { add 
mkgmap:xt-height-above-datum='${seamark:light:height}'; }
seamark:light:colour=* { add mkgmap:xt-light='${seamark:light:colour}'; }
seamark:light:period=* { add mkgmap:xt-period='${seamark:light:period}'; }
seamark:light:sequence=* { add mkgmap:xt-note='Sequence: 
${seamark:light:sequence}'; }
seamark:light:group=* { add mkgmap:xt-note='Group: ${seamark:light:group}'; }

# deprecated
seamark:light:signal:period=* { add 
mkgmap:xt-period='${seamark:light:signal:period}'; }
seamark:light:signal:sequence=* { add 
mkgmap:xt-note='${seamark:light:signal:sequence}'; }

seamark:buoy_special_purpose:colour=* { add 
mkgmap:xt-colour='${seamark:buoy_special_purpose:colour}'; }
seamark:buoy_lateral:colour=* { add 
mkgmap:xt-colour='${seamark:buoy_lateral:colour}'; }
seamark:buoy_lateral:category=port { add mkgmap:xt-colour='red'; }
seamark:buoy_lateral:category=starboard { add mkgmap:xt-colour='green'; }

seamark:buoy_lateral:category=preferred_channel_port { add 
mkgmap:xt-colour='green-red-green'; }
seamark:buoy_lateral:category=preferred_channel_starboard { add 
mkgmap:xt-colour='red-green-red'; }

seamark:buoy_safe_water:colour='red,white,red' { add 
mkgmap:xt-colour='red-white'; }
seamark:buoy_safe_water:colour=* { add 
mkgmap:xt-colour='${seamark:buoy_safe_water:colour}'; }

seamark:buoy_race:colour=* { add 
mkgmap:xt-colour='${seamark:buoy_race:colour}'; }

seamark:beacon_isolated_danger:colour=* { add 
mkgmap:xt-colour='${seamark:beacon_isolated_danger:colour}'; }
seamark:beacon_special_purpose:colour=* { add 
mkgmap:xt-colour='${seamark:beacon_special_purpose:colour}'; }
seamark:beacon_safe_water:colour=* { add 
mkgmap:xt-colour='${seamark:beacon_safe_water:colour}'; }
seamark:beacon_lateral:colour=* { add 
mkgmap:xt-colour='${seamark:beacon_lateral:colour}'; }

##
# define types

seamark:buoy_lateral:shape=spar [0x010207 resolution 22]
seamark:buoy_lateral:category=port [0x010209 resolution 22]
seamark:buoy_lateral:category=starboard [0x01020a resolution 22]
seamark:buoy_lateral:shape=* [0x010200 resolution 22]
seamark:buoy_lateral:category=* [0x010200 resolution 22]

seamark:buoy_cardinal:category=north { add mkgmap:xt-colour='black-yellow'; } 
[0x010202 resolution 22]
seamark:buoy_cardinal:category=south { add mkgmap:xt-colour='yellow-black'; } 
[0x010203 resolution 22]
seamark:buoy_cardinal:category=east { add 
mkgmap:xt-colour='black-yellow-black'; } [0x010204 resolution 22]
seamark:buoy_cardinal:category=west { add 
mkgmap:xt-colour='yellow-black-yellow'; } [0x010205 resolution 22]

seamark:buoy_special_purpose:shape=pillar [0x010207 resolution 22]
seamark:buoy_special_purpose:shape=spar [0x010207 resolution 22]
seamark:buoy_special_purpose:shape=barrel [0x01020d resolution 22]
seamark:buoy_special_purpose:shape=* [0x01020b resolution 22]

seamark:buoy_safe_water:shape=* [0x01020c resolution 22]

seamark:buoy_race:shape=* { add mkgmap:xt-note='Race Buoy' } [0x010200 
resolution 22]

seamark=lighthouse  seamark:light:colour='red' [0x010107 resolution 20]
seamark=lighthouse  seamark:light:colour='green' [0x010108 resolution 20]
# approved?
seamark:lighthouse:colour='red,white,red'  seamark:lighthouse:light='yes' { 
add mkgmap:xt-light='red'; } [0x010107 resolution 20]
seamark:lighthouse:colour='green,white,green'  seamark:lighthouse:light='yes' 
{ add mkgmap:xt-light='green'; } [0x010108 resolution 20]

seamark=lighthouse [0x010100 resolution 20]

seamark:beacon_cardinal:category=north { add mkgmap:xt-colour='black-yellow'; } 
[0x01020e resolution 20]
seamark:beacon_cardinal:category=south { add mkgmap:xt-colour='yellow-black'; } 
[0x01020f resolution 20]
seamark:beacon_cardinal:category=east { add 
mkgmap:xt-colour='black-yellow-black'; } [0x010210 resolution 20]
seamark:beacon_cardinal:category=west { add 
mkgmap:xt-colour='yellow-black-yellow'; } [0x010211 resolution 20]

seamark:beacon:category=port [0x010213 resolution 20]
seamark:beacon:category=starboard [0x010214 resolution 20]
seamark:beacon:category=* [0x010206 resolution 20]
seamark:beacon_lateral:category=* [0x010206 resolution 20]
seamark:beacon_lateral:shape=* [0x010206 resolution 20]
seamark:beacon_special_purpose:colour=* [0x010215 resolution 20]

Re: [mkgmap-dev] Support for seamark tags in default style

2010-01-27 Thread Mark Burton

Marko,

 I wonder if the seamark stuff could be a style on its own and
 resources/styles/default/info could say:
 
 base-style: seamark
 
 That would allow someone to build seamarks on a separate map layer
 without cherry-picking definitions from the default style.

Err, I've never heard of base-style.

If it does what I think it would do, that would be fine.

So we could have a marine style that has the rules I sent to you but
then goes on to include all the default stuff?

How do you specify which style to be used?

Mark
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


Re: [mkgmap-dev] Support for seamark tags in default style

2010-01-27 Thread Mark Burton

Hi Marko,

 Sorry, I was busy with something else.  Coincidentally, I did it while you
 were asking. :-)  Sorry, your patch did not remove the messages.

Please try the attached new patch.

I can guarantee that that message will go away now because I removed the 
message!

Hopefully, the coastline will be OK too.

Mark
diff --git a/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java b/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java
index 67e8a28..0221c58 100644
--- a/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java
+++ b/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java
@@ -838,16 +838,27 @@ class Osm5XmlHandler extends DefaultHandler {
 (minArcLength  0 
  minArcLength  arcLength))) {
 if(previousNode.getOnBoundary()  p.getOnBoundary()) {
-	// both the previous node and this node
-	// are on the boundary
-	if(complainedAbout.get(way) == null) {
-		if(p.equals(previousNode))
-			log.warn(  Way  + way.getTag(name) +  ( + way.toBrowseURL() + ) has consecutive nodes with the same coordinates ( + p.toOSMURL() + ) but they can't be merged because both are boundary nodes!);
-		else
+	if(p.equals(previousNode)) {
+		// the previous node has
+		// identical coordinates to
+		// the current node so it can
+		// be replaced but to avoid
+		// the assertion above we need
+		// to forget that it is on the
+		// boundary
+		previousNode.setOnBoundary(false);
+	}
+	else {
+		// both the previous node and
+		// this node are on the
+		// boundary and they don't
+		// have identical coordinates
+		if(complainedAbout.get(way) == null) {
 			log.warn(  Way  + way.getTag(name) +  ( + way.toBrowseURL() + ) has short arc ( + String.format(%.2f, arcLength) + m) at  + p.toOSMURL() +  - but it can't be removed because both ends of the arc are boundary nodes!);
-		complainedAbout.put(way, way);
+			complainedAbout.put(way, way);
+		}
+		break; // give up with this way
 	}
-	break; // give up with this way
 }
 String thisNodeId = (p.getOnBoundary())? 'boundary node' :  + nodeIdMap.get(p);
 String previousNodeId = (previousNode.getOnBoundary())? 'boundary node' :  + nodeIdMap.get(previousNode);
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev