diff --git a/resources/mkgmap-version.properties b/resources/mkgmap-version.properties index 7afd29b..eb4a7ce 100644 --- a/resources/mkgmap-version.properties +++ b/resources/mkgmap-version.properties @@ -1,2 +1,2 @@ -svn.version: 4245 -build.timestamp: 2018-10-19T06:22:23+0100 +svn.version: 4257 +build.timestamp: 2018-11-26T14:51:21+0000 diff --git a/resources/styles/default/lines b/resources/styles/default/lines index d0a85a9..3ea9ad6 100644 --- a/resources/styles/default/lines +++ b/resources/styles/default/lines @@ -14,105 +14,100 @@ (aeroway=taxiway | aeroway=taxilane) & highway!=* & is_closed()=false {name '${ref}'} [0x27 resolution 24] # Assign the street name for house number search -highway=* & name=* { set mkgmap:street='${name}' } +highway=* & name=* {set mkgmap:street='${name}'} # Mark highways with the toll flag -highway=* & (toll=yes|toll=true) { set mkgmap:toll=yes } +highway=* & (toll=yes | toll=true) {set mkgmap:toll=yes} # mark multipolygons as area highway=* & mkgmap:mp_created=true {add area=yes} # Hide proposed ways -(highway=proposed | highway=proposal | highway=planned | highway ~ '.*proposed.*') {delete highway;delete junction} +highway=proposed | highway=proposal | highway=planned | highway~'.*proposed.*' {delete highway; delete junction} # Hide removed ways -(highway=razed | highway=dismantled) {deletealltags} +highway=razed | highway=dismantled {deletealltags} # Hide abandoned ways. Abandoned highways have some evidence of their former existence but are no longer used. These # abandoned highways could be useful in topographical maps. # https://wiki.openstreetmap.org/wiki/Key:abandoned: -((abandoned:highway=* & highway!=*) | highway=abandoned) {deletealltags} +(abandoned:highway=* & highway!=*) | highway=abandoned {deletealltags} # Hide other non-existent ways -(highway=unbuilt | highway=neverbuilt | highway=rejected | highway ~ 'x-.*') {delete highway;delete junction} +highway=unbuilt | highway=neverbuilt | highway=rejected | highway~'x-.*' {delete highway; delete junction} # Remove highway tag from ways which are not suitable for routing -highway=traffic_signals | highway=junction | highway=island | highway=centre_line | highway=traffic_island | highway=stopline {delete highway} +highway=traffic_signals | highway=junction | highway=island | highway=centre_line | highway=traffic_island | highway=stopline + {delete highway} highway=piste | highway=ski {delete highway} highway=no | highway=none {delete highway} - + # Hide unaccessible tunnels -highway=* & tunnel=yes & (access=private|access=no) -& foot!=* & bicycle!=* {delete highway;delete junction} +highway=* & tunnel=yes & (access=private | access=no) & foot!=* & bicycle!=* {delete highway; delete junction} # Disable dead-end-checks for unaccessible oneways -highway=* & oneway=yes & (access=private|access=no) -{add mkgmap:dead-end-check=false} +highway=* & oneway=yes & (access=private | access=no) {add mkgmap:dead-end-check=false} # Validation-like checks (uncomment to enable) -#highway=motorway_link & oneway!=yes & oneway!=no { echo "motorway_link lacks oneway" } -highway=motorway|highway=motorway_link { add oneway=yes; add mkgmap:numbers=false } +#highway=motorway_link & oneway!=yes & oneway!=no {echo "motorway_link lacks oneway"} +highway=motorway | highway=motorway_link {add oneway=yes; add mkgmap:numbers=false} # start of rules for process-exits and process-destination options # 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 -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 -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}' | - 'Exit ${mkgmap:exit_hint_exit_to}' | - 'Exit ${mkgmap:exit_hint_name}' | - 'Exit ${mkgmap:exit_hint_ref}'; - } - -# use destination hint and/or exit hint to build name -(mkgmap:exit_hint=true | mkgmap:dest_hint=*) - { name '${exit_hint} ${dest_hint}' | '${dest_hint}' | '${exit_hint}' } +# build destination hint +mkgmap:dest_hint=* { + set tmp: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 +mkgmap:exit_hint=true { + set tmp:exit_hint='Exit ${mkgmap:exit_hint_ref} ${mkgmap:exit_hint_name}' | + 'Exit ${mkgmap:exit_hint_ref} ${mkgmap:exit_hint_exit_to}' | + 'Exit ${mkgmap:exit_hint_exit_to}' | + 'Exit ${mkgmap:exit_hint_name}' | + 'Exit ${mkgmap:exit_hint_ref}'; + } +# use destination hint and/or exit hint to build name +mkgmap:exit_hint=true | mkgmap:dest_hint=* {name '${tmp:exit_hint} ${tmp:dest_hint}' | '${tmp:dest_hint}' | '${tmp:exit_hint}'} # end of rules for process-exits and process-destination options # Flag paved roads -highway=* & (surface=asphalt | surface=paved | surface=sett | - surface=concrete | surface=concrete:lanes | surface=concrete:plates | - surface=paving_stones | surface=cobblestone | - surface=cobblestone:flattened | surface=metal | surface=wood) -{ set mkgmap:unpaved=0 } -highway=* & tracktype=grade1 & surface!=* { set mkgmap:unpaved=0 } +highway=* & (surface=asphalt | surface=paved | surface=sett | + surface=concrete | surface=concrete:lanes | surface=concrete:plates | + surface=paving_stones | surface=cobblestone | + surface=cobblestone:flattened | surface=metal | surface=wood) + {set mkgmap:unpaved=0} +highway=* & tracktype=grade1 & surface!=* {set mkgmap:unpaved=0} # Flag unpaved roads. -highway=* & mkgmap:unpaved!=0 & ( +highway=* & mkgmap:unpaved!=0 & ( surface=* | - mtb:scale=* | - tracktype ~ 'grade[2-6]') -{ add mkgmap:unpaved=1 } + mtb:scale=* | + tracktype~'grade[2-6]') + {add mkgmap:unpaved=1} highway=* & ( - mtb:scale ~ '[2-6].' | - sac_scale ~ '.*(mountain|alpine)_hiking' | + mtb:scale~'[2-6].' | + sac_scale~'.*(mountain|alpine)_hiking' | sport=via_ferrata) -{ set mkgmap:unpaved=1 } -(highway=bridleway | highway=path | highway=track) & mkgmap:unpaved!=0 { add mkgmap:unpaved=1 } -(highway=unsurfaced | highway=via_ferrata) { set mkgmap:unpaved=1 } - -highway=* & mkgmap:unpaved!=1 & smoothness ~ '.*(bad|horrible|impassable)' { add mkgmap:road-speed = '-2' } + {set mkgmap:unpaved=1} +(highway=bridleway | highway=path | highway=track) & mkgmap:unpaved!=0 {add mkgmap:unpaved=1} +(highway=unsurfaced | highway=via_ferrata) {set mkgmap:unpaved=1} + +highway=* & mkgmap:unpaved!=1 & smoothness~'.*(bad|horrible|impassable)' {add mkgmap:road-speed='-2'} # Good ways without relation -highway=* & mkgmap:fast_road!=* & (int_ref=* | network=e-road | network=AH | network=TAH | network=US:I | network=US:US) {add mkgmap:fast_road=yes} +highway=* & mkgmap:fast_road!=* & (int_ref=* | network=e-road | network=AH | network=TAH | network=US:I | network=US:US) + {add mkgmap:fast_road=yes} # Not best for car routing -highway=* & (access=hov | hov=designated | oneway=reversible) {set mkgmap:road-class=-2; set mkgmap:road-speed=-2; delete mkgmap:fast_road} +highway=* & (access=hov | hov=designated | oneway=reversible) + {set mkgmap:road-class=-2; set mkgmap:road-speed=-2; delete mkgmap:fast_road} # Convert generic path to most specific -highway=footway & snowplowing!=no -& (bicycle=yes|bicycle=designated|bicycle=permissive|bicycle=official) -{set highway=cycleway; set bicycle=yes; set foot=yes} -highway=path & snowplowing!=no -& (bicycle=designated|bicycle=permissive|bicycle=official) -{set highway=cycleway; set bicycle=yes} -highway=path & (horse=designated|horse=permissive|horse=official) -{set highway=bridleway; set horse=yes} - -leisure=track & area!=yes -{add highway=footway; name '${name} (${sport})' | '${name}'} -(man_made=pier | man_made=piste:halfpipe) & area!=yes -{add highway=footway; name '${ref} ${name}' | '${ref}' | '${name}' } +highway=footway & snowplowing!=no & (bicycle=yes | bicycle=designated | bicycle=permissive | bicycle=official) + {set highway=cycleway; set bicycle=yes; set foot=yes} +highway=path & snowplowing!=no & (bicycle=designated | bicycle=permissive | bicycle=official) + {set highway=cycleway; set bicycle=yes} +highway=path & (horse=designated | horse=permissive | horse=official) + {set highway=bridleway; set horse=yes} + +leisure=track & area!=yes {add highway=footway; name '${name} (${sport})' | '${name}'} +(man_made=pier | man_made=piste:halfpipe) & area!=yes {add highway=footway; name '${ref} ${name}' | '${ref}' | '${name}'} # Roundabouts junction=roundabout & (highway=trunk | highway=trunk_link) [0x0c road_class=4 road_speed=2 resolution 24 continue] @@ -139,13 +134,12 @@ # Ways that may or may not be useable # Treat ways under construction almost as highway=path, see also extra rule in inc/access -highway=construction { add mkgmap:dead-end-check = false; } -[0x16 road_class=0 road_speed=0 resolution 23] +highway=construction {add mkgmap:dead-end-check=false} [0x16 road_class=0 road_speed=0 resolution 23] # Lower the road speed of ways under some construction. -highway=* & construction=* & maxspeed!=* { add mkgmap:road-speed = '-1' } +highway=* & construction=* & maxspeed!=* {add mkgmap:road-speed='-1'} # Lower the road speed of disused ways. -highway=* & disused=yes & maxspeed!=* { add mkgmap:road-speed = '-2' } +highway=* & disused=yes & maxspeed!=* {add mkgmap:road-speed='-2'} # Ways sorted roughly by descending order of class highway=motorway & mkgmap:fast_road=yes [0x01 road_class=4 road_speed=7 resolution 14] @@ -181,38 +175,35 @@ highway=bridleway [0x07 road_class=0 road_speed=0 resolution 23] highway=byway [0x16 road_class=0 road_speed=0 resolution 23] -highway=service & service=parking_aisle -[0x07 road_class=0 road_speed=1 resolution 24] -highway=service & (service=alley|service=driveway) -[0x07 road_class=0 road_speed=0 resolution 23] +highway=service & service=parking_aisle [0x07 road_class=0 road_speed=1 resolution 24] +highway=service & (service=alley|service=driveway) [0x07 road_class=0 road_speed=0 resolution 23] highway=service [0x07 road_class=0 road_speed=2 resolution 22] highway=cycleway [0x07 road_class=0 road_speed=1 resolution 23] -highway=footway|highway=path|highway=steps [0x16 road_class=0 road_speed=0 resolution 23] +highway=footway | highway=path | highway=steps [0x16 road_class=0 road_speed=0 resolution 23] highway=track [0x0a road_class=0 road_speed=1 resolution 22] highway=unsurfaced [0x0a road_class=0 road_speed=1 resolution 22] -highway=road { add mkgmap:dead-end-check = false} [0x06 road_class=0 road_speed=1 resolution 22] +highway=road {add mkgmap:dead-end-check=false} [0x06 road_class=0 road_speed=1 resolution 22] # Mop up any unrecognised highway types -highway=* & area!=yes [0x07 road_class=0 road_speed=0 resolution 23] +highway=* & area!=yes [0x07 road_class=0 road_speed=0 resolution 23] natural=coastline [0x15 resolution 12] power=line [0x29 resolution 21] railway=abandoned [0x0a road_class=0 road_speed=1 resolution 22] railway=platform [0x16 road_class=0 road_speed=0 resolution 23] -# Railway lines, note that many devices display type 0x14 only at resolution 24 -(railway=rail | railway=tram | railway=disused | railway=subway | railway=narrow_gauge | railway=light_rail | railway=preserved) & !(tunnel=yes) [0x14 resolution 22] - -(man_made=cable|(man_made=* & man_made ~ '.*pipe.*')) & area!=yes & -tunnel!=yes & location != underground -{name '${name} (${operator})' | '${name}' | '${operator}' } -[0x28 resolution 23] +# Railway lines, note that many devices display type 0x14 only at resolution 24 +(railway=rail | railway=tram | railway=disused | railway=subway | railway=narrow_gauge | railway=light_rail | railway=preserved) & !(tunnel=yes) + [0x14 resolution 22] + +(man_made=cable | (man_made=* & man_made~'.*pipe.*')) & area!=yes & tunnel!=yes & location!=underground + {name '${name} (${operator})' | '${name}' | '${operator}'} [0x28 resolution 23] # The following boundary styles are after the highway rules because ways # are frequently tagged with both and we want the highway to take priority. -boundary=administrative { name '${mkgmap:boundary_name}' } +boundary=administrative {name '${mkgmap:boundary_name}'} boundary=administrative & admin_level<3 [0x1e resolution 12] boundary=administrative & admin_level<5 [0x1d resolution 19] boundary=administrative & admin_level<7 [0x1c resolution 21] @@ -221,9 +212,10 @@ boundary=national [0x1e resolution 17] boundary=political [0x1c resolution 19] -route=ferry {set mkgmap:numbers = false } -route=ferry & (motorcar=no | motor_vehicle=no) {add mkgmap:ferry=1} [0x1b road_class=0 road_speed=0 resolution 23] -route=ferry {add mkgmap:ferry=1} [0x1b road_class=3 road_speed=0 resolution 19] +route=ferry & (toll=no | toll=false) {set mkgmap:toll=no} +route=ferry {set mkgmap:numbers=false; set mkgmap:ferry=1; add mkgmap:toll=yes} +route=ferry & (motorcar=no | motor_vehicle=no) [0x1b road_class=0 road_speed=0 resolution 23] +route=ferry [0x1b road_class=3 road_speed=0 resolution 19] (waterway=river | waterway=canal) & intermittent=yes [0x26 resolution 20] (waterway=stream | waterway=drain) & intermittent=yes [0x10A02 resolution 22] @@ -240,24 +232,25 @@ include 'inc/address'; # calculate the road speed based on maxspeed tag -include 'inc/roadspeed'; +include 'inc/roadspeed'; # calculate the access rules include 'inc/access'; #limit artificial cycleways to resolution 24 -mkgmap:synthesised=yes & mkgmap:bicycle=yes { set mkgmap:highest-resolution-only = true } +mkgmap:synthesised=yes & mkgmap:bicycle=yes {set mkgmap:highest-resolution-only=true} # don't add house numbers to unnamed or artifical bicycle ways mkgmap:bicycle=yes & (mkgmap:foot=no & mkgmap:car=no & mkgmap:street!=* | mkgmap:synthesised=yes) {set mkgmap:numbers=false} # Display highway shield for mayor roads if they have a ref and make them searchable by their name -(highway=motorway | highway=trunk) & ref=* { name '${ref|highway-symbol:hbox}'; addlabel '${name}' } -highway=primary & ref=* { name '${ref|highway-symbol:box}'; addlabel '${name}' } -(highway=secondary | highway=tertiary) & ref=* { name '${ref|highway-symbol:oval}'; addlabel '${name}' } - -name=* { name '${name}' } -highway=* & ref=* & highway!=motorway & highway!=trunk & highway!=primary & highway!=secondary & highway!=tertiary { addlabel '${ref}' } - -highway=* & int_ref=* { addlabel '${int_ref}' } -highway=* & nat_ref=* { addlabel '${nat_ref}' } -highway=* & reg_ref=* { addlabel '${reg_ref}' } +(highway=motorway | highway=trunk) & ref=* {name '${ref|highway-symbol:hbox}'; addlabel '${name}'} +highway=primary & ref=* {name '${ref|highway-symbol:box}'; addlabel '${name}'} +(highway=secondary | highway=tertiary) & ref=* {name '${ref|highway-symbol:oval}'; addlabel '${name}'} + +name=* {name '${name}'} +highway=* & ref=* & highway!=motorway & highway!=trunk & highway!=primary & highway!=secondary & highway!=tertiary + {addlabel '${ref}'} + +highway=* & int_ref=* {addlabel '${int_ref}'} +highway=* & nat_ref=* {addlabel '${nat_ref}'} +highway=* & reg_ref=* {addlabel '${reg_ref}'} diff --git a/resources/styles/default/points b/resources/styles/default/points index 1e4435c..e13150b 100644 --- a/resources/styles/default/points +++ b/resources/styles/default/points @@ -9,87 +9,86 @@ # for more information. addr:housenumber=* {set mkgmap:execute_finalize_rules=true} -barrier=* & bicycle=* { set mkgmap:bicycle='${bicycle|subst:private=>no}' } -barrier=* & foot=* { set mkgmap:foot='${foot|subst:private=>no}' } -barrier=* & hgv=* { set mkgmap:truck='${hgv|subst:private=>no}' } -barrier=* & motorcar=* { set mkgmap:car='${motorcar|subst:private=>no}' } -barrier=* & psv=* { set mkgmap:bus='${psv|subst:private=>no}' } -barrier=* & taxi=* { set mkgmap:taxi='${taxi|subst:private=>no}' } -barrier=* & emergency=* { set mkgmap:emergency='${emergency|subst:private=>no}' } -barrier=* & delivery=* { set mkgmap:delivery='${delivery|subst:private=>no}' } -barrier=* & access=* { addaccess '${access|subst:private=>no}' } - -barrier=bollard | barrier=cycle_barrier - { add mkgmap:bicycle=yes; - add mkgmap:foot=yes; - addaccess no; - set mkgmap:road-speed=1; } -barrier=bus_trap - { add mkgmap:bus=yes; - add mkgmap:foot=yes; - add mkgmap:bicycle=yes; - addaccess no; - set mkgmap:road-speed=1; } -barrier=gate - { add mkgmap:bicycle=yes; - add mkgmap:foot=yes; - addaccess no; - set mkgmap:road-speed=0; } -barrier=kissing_gate | barrier=stile | barrier=block - { add mkgmap:foot=yes; - addaccess no; - set mkgmap:road-speed=0; } - -internet_access=yes { name 'Internet ${name}' | 'Internet' } [0x2f12 resolution 24 continue] -internet_access=* & internet_access!=no & internet_access!=yes { name 'Internet(${internet_access}) ${name|def:}' } [0x2f12 resolution 24 continue] + +barrier=* & bicycle=* {set mkgmap:bicycle = '${bicycle|subst:private=>no}'} +barrier=* & foot=* {set mkgmap:foot = '${foot|subst:private=>no}'} +barrier=* & hgv=* {set mkgmap:truck = '${hgv|subst:private=>no}'} +barrier=* & motorcar=* {set mkgmap:car = '${motorcar|subst:private=>no}'} +barrier=* & psv=* {set mkgmap:bus = '${psv|subst:private=>no}'} +barrier=* & taxi=* {set mkgmap:taxi = '${taxi|subst:private=>no}'} +barrier=* & emergency=* {set mkgmap:emergency='${emergency|subst:private=>no}'} +barrier=* & delivery=* {set mkgmap:delivery = '${delivery|subst:private=>no}'} +barrier=* & access=* {addaccess '${access|subst:private=>no}'} + +barrier=bollard | barrier=cycle_barrier { + add mkgmap:bicycle=yes; + add mkgmap:foot=yes; + addaccess no; + set mkgmap:road-speed=1; + } +barrier=bus_trap { + add mkgmap:bus=yes; + add mkgmap:foot=yes; + add mkgmap:bicycle=yes; + addaccess no; + set mkgmap:road-speed=1; + } +barrier=gate { + add mkgmap:bicycle=yes; + add mkgmap:foot=yes; + addaccess no; + set mkgmap:road-speed=0; + } +barrier=kissing_gate | barrier=stile | barrier=block { + add mkgmap:foot=yes; + addaccess no; + set mkgmap:road-speed=0; + } + +internet_access=yes {name 'Internet ${name}' | 'Internet'} [0x2f12 resolution 24 continue] +internet_access=* & internet_access!=no & internet_access!=yes + {name 'Internet(${internet_access}) ${name}' | 'Internet(${internet_access})'} [0x2f12 resolution 24 continue] (public_transport=platform | highway=bus_stop | railway=tram_stop | railway=halt | railway=station) -& (ref=* | route_ref=*) { - set ref='${ref|def:}(${route_ref})'; -} + & (ref=* | route_ref=*) + {set ref='${ref|def:}(${route_ref})'} (public_transport=platform | highway=bus_stop | railway=tram_stop | railway=halt | railway=station) -& lit=yes & (shelter=yes | covered=yes) -{ - set ref='${ref|def:}*'; -} + & lit=yes & (shelter=yes | covered=yes) + {set ref='${ref|def:}*'} (public_transport=platform | highway=bus_stop | railway=tram_stop | railway=halt | railway=station) -& lit!=yes & (shelter=yes | covered=yes) -{ - set ref='${ref|def:}+'; -} + & lit!=yes & (shelter=yes | covered=yes) + {set ref='${ref|def:}+'} (public_transport=platform | highway=bus_stop | railway=tram_stop | railway=halt | railway=station) -& (shelter=no | covered=no) -{ - set ref='${ref|def:}-'; -} + & (shelter=no | covered=no) + {set ref='${ref|def:}-'} include 'inc/name'; -place=city & population > 999999 & name=* {set cityxx=yes} [0x0100 resolution 12 continue with_actions] -place=city & population > 799999 & cityxx!=yes & name=* {set cityxx=yes} [0x0200 resolution 14 continue with_actions] -place=city & population > 399999 & cityxx!=yes & name=* {set cityxx=yes} [0x0300 resolution 15 continue with_actions] -place=city & population > 299999 & cityxx!=yes & name=* {set cityxx=yes} [0x0400 resolution 16 continue with_actions] -place=city & population > 199999 & cityxx!=yes & name=* {set cityxx=yes} [0x0500 resolution 16 continue with_actions] -place=city & population > 99999 & cityxx!=yes & name=* {set cityxx=yes} [0x0600 resolution 17 continue with_actions] -place=city & population > 49999 & cityxx!=yes & name=* {set cityxx=yes} [0x0700 resolution 17 continue with_actions] -place=city & population > 9999 & cityxx!=yes & name=* {set cityxx=yes} [0x0800 resolution 18 continue with_actions] - -place=city & population > 0 & cityxx!=yes & name=* {set cityxx=yes} [0x0800 resolution 18 continue with_actions] -place=city & cityxx!=yes & name=* {set cityxx=yes} [0x0700 resolution 18 continue with_actions] - -place=town & population > 69999 & cityxx!=yes & name=* {set cityxx=yes} [0x0600 resolution 17 continue with_actions] -place=town & population > 19999 & cityxx!=yes & name=* {set cityxx=yes} [0x0700 resolution 18 continue with_actions] -place=town & population > 9999 & cityxx!=yes & name=* {set cityxx=yes} [0x0800 resolution 19 continue with_actions] -place=town & population > 4999 & cityxx!=yes & name=* {set cityxx=yes} [0x0900 resolution 19 continue with_actions] -place=town & population > 999 & cityxx!=yes & name=* {set cityxx=yes} [0x0a00 resolution 19 continue with_actions] -place=town & population > 0 & cityxx!=yes & name=* {set cityxx=yes} [0x0b00 resolution 20 continue with_actions] -place=town & cityxx!=yes & name=* {set cityxx=yes} [0x0800 resolution 19 continue with_actions] - -place=island & cityxx!=yes {set cityxx=yes} [0x650c resolution 20 continue with_actions] -place=islet & cityxx!=yes {set cityxx=yes} [0x650c resolution 22 continue with_actions] -place=village & cityxx!=yes {set cityxx=yes} [0x0900 resolution 22 continue with_actions] -place=suburb & cityxx!=yes {set cityxx=yes} [0x0a00 resolution 22 continue with_actions] -place=hamlet & cityxx!=yes {set cityxx=yes} [0x0b00 resolution 24 continue with_actions] +place=city & population > 999999 & name=* {set tmp:city=yes} [0x0100 resolution 12 continue with_actions] +place=city & population > 799999 & tmp:city!=yes & name=* {set tmp:city=yes} [0x0200 resolution 14 continue with_actions] +place=city & population > 399999 & tmp:city!=yes & name=* {set tmp:city=yes} [0x0300 resolution 15 continue with_actions] +place=city & population > 299999 & tmp:city!=yes & name=* {set tmp:city=yes} [0x0400 resolution 16 continue with_actions] +place=city & population > 199999 & tmp:city!=yes & name=* {set tmp:city=yes} [0x0500 resolution 16 continue with_actions] +place=city & population > 99999 & tmp:city!=yes & name=* {set tmp:city=yes} [0x0600 resolution 17 continue with_actions] +place=city & population > 49999 & tmp:city!=yes & name=* {set tmp:city=yes} [0x0700 resolution 17 continue with_actions] +place=city & population > 9999 & tmp:city!=yes & name=* {set tmp:city=yes} [0x0800 resolution 18 continue with_actions] + +place=city & population > 0 & tmp:city!=yes & name=* {set tmp:city=yes} [0x0800 resolution 18 continue with_actions] +place=city & tmp:city!=yes & name=* {set tmp:city=yes} [0x0700 resolution 18 continue with_actions] + +place=town & population > 69999 & tmp:city!=yes & name=* {set tmp:city=yes} [0x0600 resolution 17 continue with_actions] +place=town & population > 19999 & tmp:city!=yes & name=* {set tmp:city=yes} [0x0700 resolution 18 continue with_actions] +place=town & population > 9999 & tmp:city!=yes & name=* {set tmp:city=yes} [0x0800 resolution 19 continue with_actions] +place=town & population > 4999 & tmp:city!=yes & name=* {set tmp:city=yes} [0x0900 resolution 19 continue with_actions] +place=town & population > 999 & tmp:city!=yes & name=* {set tmp:city=yes} [0x0a00 resolution 19 continue with_actions] +place=town & population > 0 & tmp:city!=yes & name=* {set tmp:city=yes} [0x0b00 resolution 20 continue with_actions] +place=town & tmp:city!=yes & name=* {set tmp:city=yes} [0x0800 resolution 19 continue with_actions] + +place=island & tmp:city!=yes {set tmp:city=yes} [0x650c resolution 20 continue with_actions] +place=islet & tmp:city!=yes {set tmp:city=yes} [0x650c resolution 22 continue with_actions] +place=village & tmp:city!=yes {set tmp:city=yes} [0x0900 resolution 22 continue with_actions] +place=suburb & tmp:city!=yes {set tmp:city=yes} [0x0a00 resolution 22 continue with_actions] +place=hamlet & tmp:city!=yes {set tmp:city=yes} [0x0b00 resolution 24 continue with_actions] #aeroway=airport [0x5900 resolution 22] aeroway=airport [0x2f04 resolution 22] @@ -110,6 +109,7 @@ amenity=car_sharing [0x2f02 resolution 24] amenity=car_wash [0x2f0e resolution 24] amenity=casino [0x2d04 resolution 24] +amenity=charging_station [0x2f01 resolution 24 default_name 'Car charging'] amenity=cinema [0x2d03 resolution 24] amenity=college [0x2c05 resolution 24] amenity=concert_hall [0x2c09 resolution 24] @@ -119,18 +119,22 @@ amenity=community_center [0x3005 resolution 24] amenity=courthouse [0x3004 resolution 24] amenity=drinking_water [0x5000 resolution 24 default_name 'Water'] -amenity=embassy & country=* { set name='${country} ${name|def:}' } [0x3003 resolution 24] +amenity=embassy & country=* {set name='${country} ${name|def:Embassy}'} [0x3003 resolution 24] amenity=embassy & country!=* [0x3003 resolution 24 default_name 'Embassy'] amenity=emergency_phone [0x2f12 resolution 24 default_name 'Emergency Phone'] amenity=ferry_terminal [0x2f08 resolution 22] + amenity=fast_food & cuisine=grill [0x2a03 resolution 24] -amenity=fast_food & cuisine ~ '.*pizza.*' [0x2a0a resolution 24] +amenity=fast_food & cuisine~'.*pizza.*' [0x2a0a resolution 24] +amenity=fast_food & cuisine=* {add name='${cuisine|subst:"_=> "}'} [0x2a07 resolution 24] amenity=fast_food [0x2a07 resolution 24] + amenity=fire_station [0x3008 resolution 24] amenity=food_court [0x2a13 resolution 24] -amenity=fuel & fuel:HGV_diesel=yes [ 0x2f16 resolution 23] -amenity=fuel & shop=convenience [ 0x2e06 resolution 24] +amenity=fuel & fuel:HGV_diesel=yes [0x2f16 resolution 23] +amenity=fuel & shop=convenience [0x2e06 resolution 24] amenity=fuel [0x2f01 resolution 24] +amenity=grave_yard | amenity=crematorium [0x6403 resolution 24] amenity=kindergarten [0x2c05 resolution 24] amenity=library [0x2c03 resolution 24] amenity=nightclub [0x2d02 resolution 24] @@ -139,35 +143,42 @@ amenity=pharmacy [0x2e05 resolution 24] amenity=place_of_worship [0x2c0b resolution 24] amenity=police [0x3001 resolution 24] +amenity=post_box [0x2f15 resolution 24 default_name 'Post box'] amenity=post_office [0x2f05 resolution 24] -amenity=prison [0x3007 resolution 24] +amenity=prison [0x3007 resolution 24 default_name 'Prison'] amenity=pub [0x2d02 resolution 24] amenity=public_building [0x3007 resolution 24] -amenity=recycling [0x2f15 resolution 24] +amenity=recycling [0x2f15 resolution 24 default_name 'Recycling'] + amenity=restaurant & cuisine=american [0x2a01 resolution 24] amenity=restaurant & cuisine=asian [0x2a02 resolution 24] amenity=restaurant & cuisine=bagel [0x2a0d resolution 24] amenity=restaurant & cuisine=barbecue [0x2a03 resolution 24] amenity=restaurant & cuisine=british [0x2a11 resolution 24] -amenity=restaurant & cuisine='cafe/diner' [0x2a0e resolution 24] amenity=restaurant & cuisine=chinese [0x2a04 resolution 24] +amenity=restaurant & cuisine=curry [0x2a02 resolution 24] amenity=restaurant & cuisine=deli [0x2a05 resolution 24] amenity=restaurant & cuisine=french [0x2a0f resolution 24] +amenity=restaurant & cuisine=fish_and_chips [0x2a11 resolution 24] amenity=restaurant & (cuisine=german | cuisine=bavarian) [0x2a10 resolution 24] amenity=restaurant & cuisine=grill [0x2a03 resolution 24] +amenity=restaurant & cuisine=indian [0x2a02 resolution 24] amenity=restaurant & cuisine=international [0x2a06 resolution 24] amenity=restaurant & cuisine=italian [0x2a08 resolution 24] amenity=restaurant & cuisine=japanese [0x2a02 resolution 24] amenity=restaurant & cuisine=korean [0x2a02 resolution 24] amenity=restaurant & cuisine=mexican [0x2a09 resolution 24] -amenity=restaurant & cuisine ~ '.*pizza.*' [0x2a0a resolution 24] +amenity=restaurant & cuisine~'.*pizza.*' [0x2a0a resolution 24] amenity=restaurant & cuisine=sea_food [0x2a0b resolution 24] +# often "seafood" is used instead of official tag "sea_food" +amenity=restaurant & cuisine=seafood [0x2a0b resolution 24] amenity=restaurant & cuisine=spanish [0x2a09 resolution 24] amenity=restaurant & cuisine=speciality [0x2a12 resolution 24] amenity=restaurant & cuisine=steak [0x2a0c resolution 24] amenity=restaurant & cuisine=thai [0x2a02 resolution 24] -amenity=restaurant & cuisine=* [0x2a13 resolution 24] +amenity=restaurant & cuisine=* {add name='${cuisine|subst:"_=> "}'} [0x2a13 resolution 24] amenity=restaurant [0x2a00 resolution 24] + amenity=school [0x2c05 resolution 24] # amenity=shelter is ambiguous; when possible, consider using other tags: # tourism=lean_to or tourism=picnic_site @@ -179,7 +190,7 @@ amenity=telephone [0x2f12 resolution 24 default_name 'Telephone'] amenity=theatre [0x2d01 resolution 24] amenity=toilets & highway=rest_area [0x2f0c resolution 24] -amenity=toilets [0x4e00 resolution 24 default_name 'Toilets' ] +amenity=toilets [0x4e00 resolution 24 default_name 'Toilets'] amenity=townhall [0x3003 resolution 24] amenity=university [0x2c05 resolution 24] # amenity=zoo is superceded by tourism=zoo @@ -206,26 +217,27 @@ leisure=marina [0x4300 resolution 24] leisure=nature_reserve & name=* [0x6612 resolution 24] leisure=park [0x2c06 resolution 24] -leisure=pitch { name '${name} (${sport})' | '${name}' } [0x2c08 resolution 24] -leisure=playground [0x2c06 resolution 24] -leisure=recreation_ground [0x2c08 resolution 24] -leisure=sports_center | leisure=sports_centre { name '${name} (${sport})' | '${name}' } [0x2d0a resolution 24] -leisure=stadium { name '${name} (${sport})' | '${name}' } [0x2c08 resolution 24] -leisure=track { name '${name} (${sport})' | '${name}' } [0x2c08 resolution 24] +leisure=pitch {name '${name} (${sport})' | '${name}'} [0x2c08 resolution 24] +leisure=playground [0x2c06 resolution 24 default_name 'Playground'] +leisure=recreation_ground [0x2c08 resolution 24 default_name 'Rec.'] +leisure=sports_center | leisure=sports_centre {name '${name} (${sport})' | '${name}'} [0x2d0a resolution 24] +leisure=stadium {name '${name} (${sport})' | '${name}'} [0x2c08 resolution 24] +leisure=swimming_pool [0x2d09 resolution 24] +leisure=track {name '${name} (${sport})' | '${name}'} [0x2c08 resolution 24] leisure=water_park [0x2d09 resolution 24] -man_made=tower|man_made=mast|landmark=chimney [0x6411 resolution 24] +man_made=tower | man_made=mast | landmark=chimney [0x6411 resolution 24] # Edge 705 displays 0x650a,0x6511,0x6512,0x6513,0x6603,0x6614 as hollow white circles, no menu natural=cave_entrance [0x6601 resolution 24] natural=cape [0x6606 resolution 24] natural=cliff [0x6607 resolution 24] -natural=peak {name '${name|def:}${ele|height:m=>ft|def:}' } [0x6616 resolution 24] +natural=peak {name '${name|def:}${ele|height:m=>ft|def:}'} [0x6616 resolution 24] natural=rock [0x6614 resolution 24] natural=volcano [0x2c0c resolution 24] railway=station [0x2f08 resolution 22] -( public_transport=platform & rail=yes ) | railway=halt [0x2f08 resolution 23] +(public_transport=platform & rail=yes) | railway=halt [0x2f08 resolution 23] public_transport=platform | highway=bus_stop | railway=tram_stop [0x2f17 resolution 24] shop=bakers [0x2e02 resolution 24] @@ -259,7 +271,7 @@ shop=supermarket [0x2e02 resolution 24] shop=tires [0x2f07 resolution 24] shop=tyres [0x2f07 resolution 24] -shop=* & shop!=no & shop!=none [0x2e0c resolution 24] +shop=* & shop!=no & shop!=none {add name='${shop|subst:"_=> "}'} [0x2e0c resolution 24] sport=9pin [0x2d07 resolution 24] sport=10pin | leisure=bowling_alley [0x2d07 resolution 24] @@ -274,6 +286,7 @@ tourism=attraction [0x2c04 resolution 24] tourism=artwork [0x2c04 resolution 24] tourism=aquarium [0x2c07 resolution 24] +tourism=bed_and_breakfast [0x2b02 resolution 24] tourism=camp_site [0x2b05 resolution 24] tourism=caravan_site [0x2b05 resolution 24] tourism=chalet [0x2b02 resolution 24] @@ -290,11 +303,13 @@ tourism=viewpoint {name '${name} - ${description}' | '${name}'} [0x2c04 resolution 24] tourism=wine_cellar [0x2c0a resolution 24] tourism=zoo [0x2c07 resolution 24] +tourism=* & tourism!=yes & tourism!=no {add name='${tourism|subst:"_=> "}'} +tourism=* & tourism!=no [0x2c0d resolution 24] barrier=bollard | barrier=bus_trap | barrier=gate [0x660f resolution 24] barrier=block | barrier=cycle_barrier | barrier=stile | barrier=kissing_gate [0x660f resolution 24] -landuse=basin|landuse=reservoir [0x650f resolution 24] +landuse=basin | landuse=reservoir [0x650f resolution 24] natural=beach [0x6604 resolution 24] natural=glacier [0x650a resolution 24] @@ -304,10 +319,11 @@ natural=waterfall | waterway=waterfall [0x6508 resolution 24] natural=wetland & name=* [0x6513 resolution 24] -landuse=cemetery|landuse=cemetary|amenity=grave_yard [0x6403 resolution 24] -(landuse=wood|landuse=forest|natural=wood) & name=* [0x6618 resolution 24] +landuse=cemetery | landuse=cemetary | amenity=grave_yard [0x6403 resolution 24] +(landuse=wood | landuse=forest | natural=wood) & name=* [0x6618 resolution 24] # The finalizer section is executed for each element when a rule with an element type matches -name=* { name '${name}' } + +name=* {name '${name}'} include 'inc/address'; diff --git a/resources/styles/default/polygons b/resources/styles/default/polygons index 6b56099..36f5787 100644 --- a/resources/styles/default/polygons +++ b/resources/styles/default/polygons @@ -10,15 +10,15 @@ addr:housenumber=* {set mkgmap:execute_finalize_rules=true} -leisure=* & sport=* & name=* { set name='${name} (${sport})' } -leisure=* & sport=* & name!=* { add name='${sport}' } +leisure=* & sport=* & name=* {set name='${name} (${sport})'} +leisure=* & sport=* & name!=* {add name='${sport}'} include 'inc/name'; aeroway=airport [0x07 resolution 20] aeroway=aerodrome [0x07 resolution 20] aeroway=runway {name '${ref}'} [0x0e resolution 20] -(aeroway=taxiway | aeroway=taxilane) {name '${ref}'} [0x0e resolution 24] +aeroway=taxiway | aeroway=taxilane {name '${ref}'} [0x0e resolution 24] aeroway=heliport [0x07 resolution 20] aeroway=helipad [0x0e resolution 22] @@ -34,8 +34,7 @@ amenity=university [0x0a resolution 21] healthcare=hospital | amenity=hospital | amenity=clinic [0x0b resolution 22] -healthcare=* | amenity=dentist | amenity=doctors | amenity=nursing_home -[0x0b resolution 23] +healthcare=* | amenity=dentist | amenity=doctors | amenity=nursing_home [0x0b resolution 23] leisure=common [0x17 resolution 21] leisure=garden [0x17 resolution 21] @@ -53,7 +52,7 @@ place=village [0x03 resolution 19] -shop=* [0x08 resolution 22] +shop=* {add name='${shop|subst:"_=> "}'} [0x08 resolution 22] # squares and plazas highway=pedestrian & (area=yes | mkgmap:mp_created=true) [0x17 resolution 22] @@ -64,7 +63,7 @@ historic=archaeological_site | historic=ruins [0x1e resolution 21] landuse=basin [0x3f resolution 20] -(landuse=reservoir | (natural=water & water=reservoir)) [0x3f resolution 20] +landuse=reservoir | (natural=water & water=reservoir) [0x3f resolution 20] natural=bay [0x3d resolution 18] natural=glacier [0x4d resolution 18] @@ -73,26 +72,26 @@ natural=wetland [0x51 resolution 20] natural=water [0x3c resolution 18] natural=waterfall | waterway=waterfall [0x47 resolution 21] -natural=sea { add mkgmap:skipSizeFilter=true; set mkgmap:drawLevel=2 } [0x32 resolution 10] +natural=sea {add mkgmap:skipSizeFilter=true; set mkgmap:drawLevel=2} [0x32 resolution 10] waterway=riverbank [0x46 resolution 20] landuse=allotments [0x4e resolution 21] -landuse=cemetery|landuse=cemetary|amenity=grave_yard [0x1a resolution 21] +landuse=cemetery | landuse=cemetary | amenity=grave_yard [0x1a resolution 21] landuse=commercial [0x0c resolution 19] landuse=construction [0x0c resolution 21] -landuse=farm |landuse=farmland [0x4e resolution 20] +landuse=farm | landuse=farmland [0x4e resolution 20] landuse=farmyard [0x10 resolution 22] -landuse=forest|landuse=wood [0x50 resolution 20] +landuse=forest | landuse=wood [0x50 resolution 20] landuse=greenfield [0x17 resolution 20] landuse=meadow | landuse=grass [0x17 resolution 19] landuse=military [0x04 resolution 19] landuse=quarry [0x0c resolution 19] landuse=recreation_ground [0x19 resolution 19] # dedicate resolution 24 for building=* instead of related landuse=* -landuse=industrial [0x0c resolution 23-19] -landuse=residential [0x10 resolution 23-19] -landuse=retail [0x08 resolution 23-20] +landuse=industrial [0x0c resolution 19-23] +landuse=residential [0x10 resolution 19-23] +landuse=retail [0x08 resolution 20-23] landuse=village_green [0x17 resolution 20] landuse=vineyard [0x4e resolution 20] landuse=orchard [0x4e resolution 20] @@ -106,27 +105,26 @@ natural=wood [0x50 resolution 20] # building tag should be last -(building=* | amenity=*) & area!=no & amenity!=grave_yard [0x13 resolution 24] -tourism=* & area!=no & waterway!=* [0x1f resolution 24] +amenity=* & area!=no & amenity!=grave_yard {add name='${amenity|subst:"_=> "}'} [0x13 resolution 24] +building=* & building!=no [0x13 resolution 24] +tourism=* & area!=no & waterway!=* {add name='${tourism|subst:"_=> "}'} [0x1f resolution 24] + # man_made can be used on areas or lines -man_made=* & area!=no -& (man_made!=door & man_made!=embankment & man_made!=breakwater - & man_made!=cable_line & man_made!=cutline & man_made!=cutting - & man_made!=levee & man_made!=trench - & man_made!=groyne & man_made!=reinforced_slope) -[0x13 resolution 24] +man_made=* & area!=no & ( + man_made!=door & man_made!=embankment & man_made!=breakwater & man_made!=cable_line & man_made!=cutline & + man_made!=cutting & man_made!=levee & man_made!=trench & man_made!=groyne & man_made!=reinforced_slope) + {add name='${man_made|subst:"_=> "}'} [0x13 resolution 24] -man_made=* & area=yes -[0x13 resolution 24] +man_made=* & area=yes {add name='${man_made|subst:"_=> "}'} [0x13 resolution 24] -# render small named islands +# render small named islands place=island & name=* & area_size() < 1000000 [0x53 resolution 19] place=islet & name=* [0x53 resolution 20] # The finalizer section is executed for each element when a rule with an element type matches -# we need addrees info from buildings for the address search +# we need address info from buildings for the address search include 'inc/address'; -name=* { name '${name}' } +name=* {name '${name}'} diff --git a/src/uk/me/parabola/imgfmt/app/typ/ColourInfo.java b/src/uk/me/parabola/imgfmt/app/typ/ColourInfo.java index adf2a2d..b0b4059 100644 --- a/src/uk/me/parabola/imgfmt/app/typ/ColourInfo.java +++ b/src/uk/me/parabola/imgfmt/app/typ/ColourInfo.java @@ -282,7 +282,7 @@ // in each of the day/night sections. if (numberOfColours > 4) - return ("Too many colours for a line or polygon"); + return "Too many colours for a line or polygon"; if (numberOfColours == 0) return "Line or polygon cannot have zero colours"; diff --git a/src/uk/me/parabola/mkgmap/combiners/MdrBuilder.java b/src/uk/me/parabola/mkgmap/combiners/MdrBuilder.java index ba0a81b..2571db3 100644 --- a/src/uk/me/parabola/mkgmap/combiners/MdrBuilder.java +++ b/src/uk/me/parabola/mkgmap/combiners/MdrBuilder.java @@ -294,9 +294,6 @@ List roads = mr.getRoads(); for (RoadDef road : roads) { - String name = road.getName(); - if (name == null || name.isEmpty()) - continue; List cities = road.getCities(); if (cities.isEmpty()) mdrFile.addStreet(road, null); diff --git a/src/uk/me/parabola/mkgmap/general/MapRoad.java b/src/uk/me/parabola/mkgmap/general/MapRoad.java index 3e5e85c..55d3317 100644 --- a/src/uk/me/parabola/mkgmap/general/MapRoad.java +++ b/src/uk/me/parabola/mkgmap/general/MapRoad.java @@ -185,6 +185,19 @@ return false; } + public int getLabelPos(String label){ + if (label == null) + return -1; + for (int i = 0; i < labels.length; i++){ + if (labels[i] == null){ + return -1; + } + if (labels[i].equals(label)) + return i; + } + return -1; + } + public String toString(){ if ((getName() == null || getName().isEmpty()) && getStreet() != null) return "id="+this.getRoadDef().getId() + ", (" + this.getStreet() + ")"; diff --git a/src/uk/me/parabola/mkgmap/main/TypCompiler.java b/src/uk/me/parabola/mkgmap/main/TypCompiler.java index a0812f9..cf7371e 100644 --- a/src/uk/me/parabola/mkgmap/main/TypCompiler.java +++ b/src/uk/me/parabola/mkgmap/main/TypCompiler.java @@ -26,6 +26,7 @@ import java.nio.charset.CharacterCodingException; import java.nio.charset.Charset; import java.nio.charset.CharsetEncoder; +import java.nio.charset.StandardCharsets; import java.nio.file.StandardOpenOption; import uk.me.parabola.imgfmt.ExitException; @@ -211,8 +212,13 @@ } private void setCodePage(String codePage) { - this.codePage = codePage; - this.encoder = Charset.forName(codePage).newEncoder(); + if ("cp65001".equalsIgnoreCase(codePage)) { + this.codePage = "utf-8"; + this.encoder = StandardCharsets.UTF_8.newEncoder(); + } else { + this.codePage = codePage; + this.encoder = Charset.forName(codePage).newEncoder(); + } } private String probeCharset(String file) { diff --git a/src/uk/me/parabola/mkgmap/osmstyle/housenumber/HousenumberMatch.java b/src/uk/me/parabola/mkgmap/osmstyle/housenumber/HousenumberMatch.java index 395e643..b1db920 100644 --- a/src/uk/me/parabola/mkgmap/osmstyle/housenumber/HousenumberMatch.java +++ b/src/uk/me/parabola/mkgmap/osmstyle/housenumber/HousenumberMatch.java @@ -312,6 +312,12 @@ return false; if (getSign().equals(other.getSign()) == false) return false; + if (getPlace() != other.getPlace()) { + if (getPlace() == null) + return false; + if (getPlace().equals(other.getPlace()) == false) + return false; + } if (getZipCode() != null && other.getZipCode() != null){ if (getZipCode().equals(other.getZipCode()) == false) return false; diff --git a/src/uk/me/parabola/mkgmap/osmstyle/housenumber/HousenumberRoad.java b/src/uk/me/parabola/mkgmap/osmstyle/housenumber/HousenumberRoad.java index dbc408c..12a0bcf 100644 --- a/src/uk/me/parabola/mkgmap/osmstyle/housenumber/HousenumberRoad.java +++ b/src/uk/me/parabola/mkgmap/osmstyle/housenumber/HousenumberRoad.java @@ -559,11 +559,17 @@ log.info("dropped label",droppedLabel,"for",road,"in preference to correct address search. Labels are now:",Arrays.toString(labels)); } } + if (furtherNames != null){ boolean changed = false; for (String furtherName : furtherNames){ - if (road.addLabel(furtherName)) - changed = true; + if (road.getLabelPos(furtherName) == -1) { + if (road.addLabel(furtherName)) + changed = true; + else { + log.warn("could not add further label",furtherName, "for",road); + } + } } if (changed){ log.info("added further labels for",road,"Labels are now:",Arrays.toString(labels)); diff --git a/src/uk/me/parabola/mkgmap/reader/MapperBasedMapDataSource.java b/src/uk/me/parabola/mkgmap/reader/MapperBasedMapDataSource.java index 3625365..1ea3a56 100644 --- a/src/uk/me/parabola/mkgmap/reader/MapperBasedMapDataSource.java +++ b/src/uk/me/parabola/mkgmap/reader/MapperBasedMapDataSource.java @@ -108,6 +108,7 @@ background.setPoints(mapper.getBounds().toCoords()); background.setType(0x4b); // background type background.setMinResolution(0); // On all levels + background.setFullArea(Long.MAX_VALUE-1); // sea also SEA_SIZE in SeaGenerator mapper.addShape(background); } diff --git a/src/uk/me/parabola/mkgmap/reader/osm/SeaGenerator.java b/src/uk/me/parabola/mkgmap/reader/osm/SeaGenerator.java index 3eaf357..c068cdc 100644 --- a/src/uk/me/parabola/mkgmap/reader/osm/SeaGenerator.java +++ b/src/uk/me/parabola/mkgmap/reader/osm/SeaGenerator.java @@ -104,7 +104,7 @@ /** * When order-by-decreasing-area we need all bit of sea to be output consistently. - * Unless _draworder changes things, having seaSize as BIG causes polygons beyond the + * Unless _draworder changes things, having SEA_SIZE as BIG causes polygons beyond the * coastline to be shown. To hide these and have the sea show up to the high-tide * coastline, can set this to be very small instead (or use _draworder). *

@@ -112,7 +112,7 @@ * natural=sea { add mkgmap:skipSizeFilter=true; set mkgmap:drawLevel=2 } [0x32 resolution 10] * which is equivalent to Long.MAX_VALUE-2. */ - private static final long seaSize = Long.MAX_VALUE-2; // sea is BIG + private static final long SEA_SIZE = Long.MAX_VALUE-2; // sea is BIG /** * Sort out options from the command line. @@ -670,7 +670,7 @@ saver.addWay(w); } for (Way w : seaWays) { - w.setFullArea(seaSize); + w.setFullArea(SEA_SIZE); saver.addWay(w); } } else { @@ -680,7 +680,7 @@ // first add the complete bounding box as sea Way sea = new Way(FakeIdGenerator.makeFakeId(),bounds.toCoords()); sea.addTag("natural", "sea"); - sea.setFullArea(seaSize); + sea.setFullArea(SEA_SIZE); for (Way w : landWays) { saver.addWay(w); @@ -954,7 +954,7 @@ ne.getLongitude() + 1)); sea.addPoint(sea.getPoints().get(0)); // close shape sea.addTag("natural", "sea"); - sea.setFullArea(seaSize); + sea.setFullArea(SEA_SIZE); log.info("sea: ", sea); saver.addWay(sea); diff --git a/src/uk/me/parabola/mkgmap/reader/osm/Way.java b/src/uk/me/parabola/mkgmap/reader/osm/Way.java index 6d1b381..4345682 100644 --- a/src/uk/me/parabola/mkgmap/reader/osm/Way.java +++ b/src/uk/me/parabola/mkgmap/reader/osm/Way.java @@ -257,6 +257,11 @@ this.isViaWay = isViaWay; } + /** + * Allows to manipulate the area size which might be used to sort shapes when + * option --order-by-decreasing-area is active. + * @param fullArea + */ public void setFullArea(long fullArea) { this.fullArea = fullArea; } diff --git a/src/uk/me/parabola/mkgmap/typ/CommonSection.java b/src/uk/me/parabola/mkgmap/typ/CommonSection.java index b77b052..0d2658c 100644 --- a/src/uk/me/parabola/mkgmap/typ/CommonSection.java +++ b/src/uk/me/parabola/mkgmap/typ/CommonSection.java @@ -369,6 +369,8 @@ */ protected Xpm readXpm(TokenScanner scanner, String header, boolean simple) { ColourInfo colourInfo = readColourInfo(scanner, header); + xpmCheck(scanner, colourInfo); + String msg = colourInfo.analyseColours(simple); if (msg != null) throw new SyntaxException(scanner, msg); @@ -404,4 +406,12 @@ if (!hasXpm) throw new SyntaxException(scanner, "No XPM tag in section"); } + + /** + * Check the colourInfo against any restrictions that apply to the element type. + * + * Subtypes make checks as appropriate, there are no common restrictions. + */ + protected void xpmCheck(TokenScanner scanner, ColourInfo colourInfo) { + } } diff --git a/src/uk/me/parabola/mkgmap/typ/LineSection.java b/src/uk/me/parabola/mkgmap/typ/LineSection.java index ef40449..c130296 100644 --- a/src/uk/me/parabola/mkgmap/typ/LineSection.java +++ b/src/uk/me/parabola/mkgmap/typ/LineSection.java @@ -12,6 +12,7 @@ */ package uk.me.parabola.mkgmap.typ; +import uk.me.parabola.imgfmt.app.typ.ColourInfo; import uk.me.parabola.imgfmt.app.typ.TypData; import uk.me.parabola.imgfmt.app.typ.TypLine; import uk.me.parabola.mkgmap.scan.SyntaxException; @@ -62,4 +63,14 @@ current.finish(); data.addLine(current); } + + protected void xpmCheck(TokenScanner scanner, ColourInfo colourInfo) { + int width = colourInfo.getWidth(); + + if (width == 0) + return; + + if (width != 32) + throw new SyntaxException(scanner, "Line bitmaps must be 32 bits wide"); + } } diff --git a/src/uk/me/parabola/mkgmap/typ/PolygonSection.java b/src/uk/me/parabola/mkgmap/typ/PolygonSection.java index 66909e3..00d0e7f 100644 --- a/src/uk/me/parabola/mkgmap/typ/PolygonSection.java +++ b/src/uk/me/parabola/mkgmap/typ/PolygonSection.java @@ -12,8 +12,10 @@ */ package uk.me.parabola.mkgmap.typ; +import uk.me.parabola.imgfmt.app.typ.ColourInfo; import uk.me.parabola.imgfmt.app.typ.TypData; import uk.me.parabola.imgfmt.app.typ.TypPolygon; +import uk.me.parabola.mkgmap.scan.SyntaxException; import uk.me.parabola.mkgmap.scan.TokenScanner; /** @@ -45,4 +47,30 @@ validate(scanner); data.addPolygon(current); } + + /** + * Check xmp restrictions for polygons. + * + * The main one is that bitmaps must be 32x32. Only certain numbers of colours are + * allowed as well. + */ + protected void xpmCheck(TokenScanner scanner, ColourInfo colourInfo) { + int width = colourInfo.getWidth(); + int height = colourInfo.getHeight(); + + switch (colourInfo.getNumberOfColours()) { + case 1: + case 2: + case 4: + break; + default: + throw new SyntaxException(scanner, "Polygons must have 1, 2 or 4 colours"); + } + + if (width == 0 && height == 0) + return; + + if (height != 32 || width != 32) + throw new SyntaxException(scanner, "Polygon bitmaps must be 32x32"); + } }