Strict ordering of action in a style rule file.

Hi I have now made the change to introduce strict ordering to the action in a style rule file. Previously the actions where not triggered in any particular order and they were all run before any matching took place. In the new code, the actions are run strictly in the order that they occur in the file. Actions only affect matching of rules later in the file, never rules earlier. So for example if you have an element with highway=primary then the following set of rules will result in 0x2 and not 0x1 which would be the case currently. highway=primary {set marker=1} marker=2 [0x1] highway=primary {set marker=2} marker=2 [0x2] I've not looked at the performance and have one thing to do to possibly improve it, but the functionality is working as far as I can tell with some simple test. For everyone with complex rules, could you please give it a go. It is on the style branch in subversion, or you can download one I prepared earlier here: http://www.mkgmap.org.uk/snapshots/mkgmap-style.jar If you see any case where the rules and actions do not appear to run in the order that they appear in the file is a bug and should be reported. ..Steve

Steve Ratcliffe wrote:
Hi
I have now made the change to introduce strict ordering to the action in a style rule file.
Previously the actions where not triggered in any particular order and they were all run before any matching took place. In the new code, the actions are run strictly in the order that they occur in the file. Actions only affect matching of rules later in the file, never rules earlier.
So for example if you have an element with highway=primary then the following set of rules will result in 0x2 and not 0x1 which would be the case currently.
highway=primary {set marker=1} marker=2 [0x1] highway=primary {set marker=2} marker=2 [0x2]
I've not looked at the performance and have one thing to do to possibly improve it, but the functionality is working as far as I can tell with some simple test.
For everyone with complex rules, could you please give it a go. It is on the style branch in subversion, or you can download one I prepared earlier here:
http://www.mkgmap.org.uk/snapshots/mkgmap-style.jar
If you see any case where the rules and actions do not appear to run in the order that they appear in the file is a bug and should be reported.
..Steve _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Is the style branch otherwise identical to normal branch or lagging behind?

Steve Ratcliffe wrote:
Hi
Is the style branch otherwise identical to normal branch or lagging behind?
It branched at 1186 and does not contain any changes to trunk since then. I can merge trunk in if it would help.
o.k. that would have been fine (anything above 1140) it was just about not being more than a few weeks old. However the continue patch can't be applied anyhow. I don't know how to merge the: "public GType resolveType(Element el, GType pre) {" with my old lines. Without the "continue"/"multiple_garmin_elements" patch the strict ordering makes not much sense and I can't really test it properly (only with standard style-files, with which it works) Maybe you could adapt the patch so it merges? (anyhow I think it would be fine to add the "continue" patch to trunk, as there are quite a lot of people using it, and any substantial changes to the style system will break it.... I have not had any problems with it, and if not using it it also does not decrease performance. ).
..Steve _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Moin, today I had the time to try out the style-brunch: With a cleaned-up version of my style the result was ok. Compared to the trunk version all known problem cases came out allright. But I am in the same situation as Felix: My styles rely heavily on the creation of multiple elements per stop/continue scheme. So I can not test the new ordering with my full style rules. Gruss Torsten

Hi On 23/09/09 18:54, Torsten Leistikow wrote:
today I had the time to try out the style-brunch: With a cleaned-up version of my style the result was ok. Compared to the trunk version all known problem cases came out allright.
OK that is good thanks for trying that out.
But I am in the same situation as Felix: My styles rely heavily on the creation of multiple elements per stop/continue scheme. So I can not test the new ordering with my full style rules.
Right, I can add a continue function. Would it be possible for you or Felix to send me a complete file with those rule so I can see how they are really used in practice? Regards, ..Steve

Steve Ratcliffe schrieb:
Right, I can add a continue function. Would it be possible for you or Felix to send me a complete file with those rule so I can see how they are really used in practice?
Sure, as an example I have attached the lines-file of my topo-base-layer. Note that in this example I have also added [continue] statements to the rules with action part but without conversion part. (This was my try to fix the rule ordering.) I am not sure, whether this really makes sense. I think for such rules the continue-function is the normal behaviour. For my points and polygon files I have simply added a continue order to all conversion rules. Gruss Torsten #ignore all bridges aeroway=* & bridge=yes {set aeroway=ignore} [continue] aeroway=runway [0x27 resolution 18 continue] aeroway=taxiway [0x27 resolution 22 continue] #ignore all bridges aerialway=* & bridge=yes {set aerialway=ignore} [continue] aerialway=cable_car [0x0d resolution 22 continue] aerialway=chair_lift [0x0d resolution 22 continue] aerialway=drag_lift [0x0d resolution 22 continue] boundary=administrative [0x1d resolution 20 continue] boundary=civil [0x1e resolution 20 continue] boundary=political [0x1c resolution 10 continue] boundary=national_park [0x0d resolution 24 continue] # Contours take their name from the elevation setting. contour=elevation | contour_ext=elevation {name '${ele|conv:m=>ft}'} [0x21 resolution 20 continue] #ignore all bridges highway=* & bridge=yes {set highway=ignore} [continue] # Set highway names to include the reference if there is one highway=* & mkmap_name_fixed!=* {name '${name} (${ref})' | '${ref}' | '${name}' ; set mkmap_name_fixed=yes} [continue] #set mkgmap_surface values to paved, unpaved or cobblestone highway=* & surface=paved {set surface=deleted; set mkgmap_surface=paved} [continue] highway=* & surface=unpaved {set surface=deleted; set mkgmap_surface=unpaved} [continue] highway=* & surface=asphalt {set surface=deleted; set mkgmap_surface=paved} [continue] highway=* & surface=cobblestone {set surface=deleted; set mkgmap_surface=paved} [continue] highway=* & surface=concrete {set surface=deleted; set mkgmap_surface=paved} [continue] highway=* & surface=paving_stones {set surface=deleted; set mkgmap_surface=paved} [continue] highway=* & surface=metal {set surface=deleted; set mkgmap_surface=paved} [continue] highway=* & surface=wood {set surface=deleted; set mkgmap_surface=paved} [continue] highway=* & surface=grass_paver {set surface=deleted; set mkgmap_surface=unpaved} [continue] highway=* & surface=gravel {set surface=deleted; set mkgmap_surface=unpaved} [continue] highway=* & surface=pebblestone {set surface=deleted; set mkgmap_surface=unpaved} [continue] highway=* & surface=grass {set surface=deleted; set mkgmap_surface=unpaved} [continue] highway=* & surface=ground {set surface=deleted; set mkgmap_surface=unpaved} [continue] highway=* & surface=earth {set surface=deleted; set mkgmap_surface=unpaved} [continue] highway=* & surface=dirt {set surface=deleted; set mkgmap_surface=unpaved} [continue] highway=* & surface=mud {set surface=deleted; set mkgmap_surface=unpaved} [continue] highway=* & surface=sand {set surface=deleted; set mkgmap_surface=unpaved} [continue] highway=* & surface=ice_road {set surface=deleted; set mkgmap_surface=unpaved} [continue] junction=roundabout & highway=trunk [0x02 resolution 18 continue] junction=roundabout & highway=primary [0x03 resolution 18 continue] junction=roundabout & highway=secondary [0x04 resolution 18 continue] junction=roundabout & highway=tertiary [0x05 resolution 20 continue] junction=roundabout & highway=unclassified [0x06 resolution 22 continue] junction=roundabout & highway=residential [0x06 resolution 22 continue] junction=roundabout & highway=living_street [0x08 resolution 22 continue] highway=bridleway [0x0f resolution 22 continue] highway=byway [0x2c resolution 22 continue] highway=cycleway & cycleway!=track & mkgmap_surface=paved [0x0e resolution 22 continue] highway=cycleway & cycleway!=track & mkgmap_surface!=paved [0x0d resolution 22 continue] highway=footway & mkgmap_surface=paved [0x10 resolution 22 continue] highway=footway & mkgmap_surface!=paved [0x0f resolution 22 continue] highway=path & bicycle!=no & mkgmap_surface=paved [0x0e resolution 22 continue] highway=path & bicycle!=no & mkgmap_surface!=paved [0x0d resolution 22 continue] highway=path & mkgmap_surface=paved [0x10 resolution 22 continue] highway=path & mkgmap_surface!=paved [0x0f resolution 22 continue] highway=living_street [0x08 resolution 22 continue] highway=motorway & tunnel=yes {add oneway = yes } [0x31 resolution 10 continue] highway=motorway & tunnel!=yes {add oneway = yes } [0x01 resolution 10 continue] highway=motorway_link & tunnel=yes [0x31 resolution 10 continue] highway=motorway_link & tunnel!=yes [0x01 resolution 10 continue] highway=pedestrian & area!=yes [0x08 resolution 22 continue] highway=primary & tunnel=yes [0x31 resolution 18 continue] highway=primary & tunnel!=yes [0x03 resolution 18 continue] highway=primary_link & tunnel=yes [0x03 resolution 18 continue] highway=primary_link & tunnel!=yes [0x03 resolution 18 continue] highway=residential & tunnel=yes [0x34 resolution 22 continue] highway=residential & tunnel!=yes & mkgmap_surface=unpaved [0x16 resolution 22 continue] highway=residential & tunnel!=yes & mkgmap_surface!=unpaved [0x06 resolution 22 continue] highway=secondary & tunnel=yes [0x32 resolution 18 continue] highway=secondary & tunnel!=yes [0x04 resolution 18 continue] highway=service & mkgmap_surface=unpaved [0x16 resolution 22 continue] highway=service & mkgmap_surface!=unpaved [0x07 resolution 22 continue] highway=steps [0x09 resolution 22 continue] highway=tertiary & tunnel=yes [0x33 resolution 20 continue] highway=tertiary & tunnel!=yes [0x05 resolution 20 continue] highway=track & tracktype=grade1 & mkgmap_surface!=unpaved & tunnel=yes [0x07 resolution 22 continue] highway=track & tracktype=grade1 & mkgmap_surface!=unpaved & tunnel!=yes [0x34 resolution 22 continue] highway=track & tracktype=grade1 & mkgmap_surface=unpaved & tunnel=yes [0x0b resolution 22 continue] highway=track & tracktype=grade1 & mkgmap_surface=unpaved & tunnel!=yes [0x34 resolution 22 continue] highway=track & tracktype=grade2 & tunnel=yes [0x0b resolution 22 continue] highway=track & tracktype=grade2 & tunnel!=yes [0x34 resolution 22 continue] highway=track & tracktype=grade3 & tunnel=yes [0x0b resolution 22 continue] highway=track & tracktype=grade3 & tunnel!=yes [0x34 resolution 22 continue] highway=track & tracktype=grade4 & tunnel=yes [0x0a resolution 22 continue] highway=track & tracktype=grade4 & tunnel!=yes [0x34 resolution 22 continue] highway=track & tracktype=grade5 & tunnel=yes [0x0a resolution 22 continue] highway=track & tracktype=grade5 & tunnel!=yes [0x34 resolution 22 continue] highway=track & tracktype!=* & tunnel=yes [0x0a resolution 22 continue] highway=track & tracktype!=* & tunnel!=yes [0x34 resolution 22 continue] highway=trunk & tunnel=yes [0x31 resolution 18 continue] highway=trunk & tunnel!=yes [0x02 resolution 18 continue] highway=trunk_link & tunnel=yes [0x31 resolution 18 continue] highway=trunk_link & tunnel!=yes [0x02 resolution 18 continue] highway=unclassified & tunnel=yes [0x34 resolution 22 continue] highway=unclassified & tunnel!=yes & mkgmap_surface=unpaved [0x16 resolution 22 continue] highway=unclassified & tunnel!=yes & mkgmap_surface!=unpaved [0x06 resolution 22 continue] highway=road [0x2c resolution 22 continue] highway=bus_guideway [0x2c resolution 22 continue] highway=construction [0x1b resolution 22 continue] barrier=hedge [0x12 resolution 22 continue] barrier=fence [0x11 resolution 22 continue] barrier=wall [0x13 resolution 22 continue] barrier=ditch [0x18 resolution 22 continue] barrier=retaining_wall [0x13 resolution 22 continue] barrier=city_wall [0x13 resolution 22 continue] natural=coastline [0x15 resolution 10 continue] natural=cliff [0x19 resolution 24 continue] power=line [0x29 resolution 22 continue] #ignore all bridges railway=* & bridge=yes {set railway=ignore} [continue] railway=light_rail & tunnel!=yes [0x2b resolution 20 continue] railway=light_rail & tunnel=yes [0x2c resolution 20 continue] railway=rail & tunnel!=yes [0x14 resolution 18 continue] railway=rail & tunnel=yes [0x2c resolution 18 continue] railway=subway & tunnel!=yes [0x19 resolution 24 continue] railway=subway & tunnel=yes [0x2c resolution 24 continue] railway=tram & tunnel!=yes [0x2c resolution 22 continue] railway=tram & tunnel=yes [0x2c resolution 22 continue] railway=narrow_gauge & tunnel!=yes [0x2c resolution 24 continue] railway=narrow_gauge & tunnel=yes [0x2c resolution 24 continue] railway=preserved & tunnel!=yes [0x19 resolution 24 continue] railway=preserved & tunnel=yes [0x2c resolution 24 continue] railway=disused & tunnel!=yes [0x19 resolution 24 continue] railway=disused & tunnel=yes [0x2c resolution 24 continue] railway=abandoned & tunnel!=yes [0x19 resolution 24 continue] railway=abandoned & tunnel=yes [0x2c resolution 24 continue] railway=monorail & tunnel!=yes [0x19 resolution 22 continue] railway=monorail & tunnel=yes [0x2c resolution 22 continue] #ignore all bridges route=* & bridge=yes {set route=ignore} [continue] route=bus [0x00 resolution 24 continue] route=ferry [0x1a resolution 20 continue] route=flight [0x00 resolution 24 continue] route=subsea [0x00 resolution 24 continue] route=ski [0x00 resolution 24 continue] route=tour [0x00 resolution 24 continue] route=pub_crawl [0x00 resolution 24 continue] #ignore all bridges waterway=* & bridge=yes {set waterway=ignore} [continue] #ignore the waterway tunnels waterway=* & tunnel=yes {set waterway=ignore} [continue] waterway=canal [0x1f resolution 22 continue] waterway=drain [0x18 resolution 22 continue] waterway=river [0x1f resolution 20 continue] waterway=stream [0x18 resolution 22 continue] waterway=weir [0x2a resolution 24 continue] waterway=dam [0x2a resolution 24 continue] mooring=* [0x19 resolution 24 continue] #ignore all bridges man_made=* & bridge=yes {set man_made=ignore} [continue] #ignore the man_made tunnels man_made=* & tunnel=yes {set man_made=ignore} [continue] man_made=pier [0x2c resolution 22 continue] man_made=pipeline [0x19 resolution 22 continue] contour=elevation & contour_ext=elevation_major [0x20 resolution 18] contour=elevation & contour_ext=elevation_medium [0x21 resolution 20] contour=elevation & contour_ext=elevation_minor [0x22 resolution 23] contour=elevation [0x22 resolution 23]
participants (3)
-
Felix Hartmann
-
Steve Ratcliffe
-
Torsten Leistikow