[mkgmap-dev] Little assist needed from the style code implementors
From WanMil wmgcnfg at web.de on Mon Sep 13 19:59:20 BST 2010
Hi Steve, thanks for the quick help! After reading your suggestions it was quite easy to implement it. WanMil > On 12/09/10 21:08, WanMil wrote: >> Hi, >> >> I have rather finished the changes for the new multipolygon line/polygon >> tag handling (see >> http://www.mkgmap.org.uk/pipermail/mkgmap-dev/2010q3/008977.html). But I >> need some quick help from someone who known the Java internals of the >> style processing. >> >> All line rules should be executed only if the line contains the tag >> "mkgmap:styleusage=line" or if the tag is not set. The same for polygons >> with "mkgmap:styleusage=polygon". >> I think this should be easy with an AndOp? But I don't know how to set >> this rule to the lines/polygons RuleSet in StyleImpl. Any suggestions? > > The way is converted into a garmin element by OsmConverter.convertWay(). > It matches against both line and polygon rules together because normally > it doesn't know if something is a line or a polygon. > > As I understand your change you want to mark ways as being definitely a > polygon or definitely a line and only match against the polygon or line > rules respectively. > > I would do this by adding the hint to the Element (or Way) and then > catching this in convertWay(). > > This incomplete patch shows what I mean: > > Index: src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java > =================================================================== > --- src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java (revision 1677) > +++ src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java (revision ) > @@ -278,7 +278,15 @@ > > preConvertRules(way); > > - wayRules.resolveType(way, new TypeResult() { > + Rule rules; > + if (way.getKind() == GType.POLYLINE) > + rules = lineRules; > + else if (way.getKind() == GType.POLYGON) > + rules = polygonRules; > + else > + rules = wayRules; > + > + rules.resolveType(way, new TypeResult() { > public void add(Element el, GType type) { > if (type.isContinueSearch()) { > // If not already copied, do so now > > In this waysRules exists already and it is the union of linesRules and > polygonRules (you would have to make them available separately). > You set way.kind to be POLYLINE or POLYGON or leave it unset in the > normal case. > > ..Steve > _______________________________________________ > mkgmap-dev mailing list > mkgmap-dev at lists.mkgmap.org.uk > http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev >
- Previous message: [mkgmap-dev] Little assist needed from the style code implementors
- Next message: [mkgmap-dev] Commit: r1681: Move the highway related code out of Osm5XmlHandler.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the mkgmap-dev mailing list