From ef8b9ae8901178cdb521dcc6dcc55abbbf09e693 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Fiti=C3=A9?= Date: Sun, 21 Jun 2020 21:30:54 +0200 Subject: improvement:layout: Improve Car Dark layout colors, bring all layers up to date with Car Light, automate changes in all layers with script (#1026) * Improve Car Dark layout colors, bring all layers up to date with Car Light, automate changes in all layers with script * Icon colors * CodeFactor hates cats ... * Comment --- navit/navit_layout_car_dark_shipped.xml | 1005 ++++++++++++++++++----------- navit/navit_layout_car_generatedarkxml.sh | 121 ++-- navit/navit_layout_car_shipped.xml | 17 +- 3 files changed, 719 insertions(+), 424 deletions(-) diff --git a/navit/navit_layout_car_dark_shipped.xml b/navit/navit_layout_car_dark_shipped.xml index f858078ea..1c8ef041c 100644 --- a/navit/navit_layout_car_dark_shipped.xml +++ b/navit/navit_layout_car_dark_shipped.xml @@ -66,16 +66,15 @@ + - @@ -541,716 +540,988 @@ - - + + - - + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - - + + - - - + + + - - - + + + - - - + + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - - + + + + + + - - + + + + + + + + + + + + + + + + + - - + + - - + + - - - - - + + - - - - - + + - + + - - + + - - + + - - + + - - + + + - - + + + - - + + + - - + + + - - + + + - + + - + + - + + - + + - + + + - + + + - + + + - + + + - + + + - + + - + + - + + - + + + - + + + - + + + - + + + - + + - + + - + + - + + - + + + - + + + - + + + - + + + - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + + - - + + + + - - + + + + - - + + + + - - + + + + - - + + - - + + + - + + - + + - + + - + + - + + - + + + - + + + - + + + - + + + - + + + - + - - - + + - - + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + + + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - - - + + + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1260,46 +1531,46 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1312,7 +1583,7 @@ - + @@ -1321,12 +1592,12 @@ - - - + + + @@ -1336,6 +1607,9 @@ + + + @@ -1360,12 +1634,6 @@ - - @@ -1507,6 +1775,9 @@ + + + @@ -1535,7 +1806,7 @@ - + @@ -1595,19 +1866,19 @@ - - + + - - + + - + - - + + @@ -1681,9 +1952,6 @@ - - - @@ -1708,9 +1976,6 @@ - - - @@ -1756,10 +2021,16 @@ + + + + + + - + @@ -1772,6 +2043,9 @@ + + + @@ -1781,6 +2055,9 @@ + + + @@ -1805,10 +2082,16 @@ + + + - - + + + + + diff --git a/navit/navit_layout_car_generatedarkxml.sh b/navit/navit_layout_car_generatedarkxml.sh index 9c3aa70ca..16a6ce04b 100755 --- a/navit/navit_layout_car_generatedarkxml.sh +++ b/navit/navit_layout_car_generatedarkxml.sh @@ -1,6 +1,6 @@ #!/bin/bash -# This script automatically converts the rgb colors used for the polygons in the +# This script automatically converts the rgb colors used for the layers in # navit_layout_car_shipped.xml to the values appropriate for the dark layout in # navit_layout_car_dark_shipped.xml. # It's a bit of a mess, but gets the job done. @@ -14,78 +14,91 @@ ifd=navit_layout_car_dark_shipped.xml # Temporary dark output file ofd=$ifd.new -# Create new temporary dark output file -[ -f $ofd ] && rm -f $ofd -touch $ofd +# Iterate over all layers in dark input file +grep \.* ]]; then - inpolygons=true - getpolygons=true - fi + # Init: not in layer + inlayer=false + getlayer=false - # Check to see if inside polygons layer - close tag - if [[ $l =~ .*\.* ]]; then - inpolygons=false - fi + # Read dark input file + while read -r l + do - # Trigger once when polygons open tag found in dark input file - if [ $getpolygons == true ]; then + # Check to see if inside layer - open tag + if [[ $l =~ .*\.* ]]; then + inlayer=true + getlayer=true + fi - getpolygons=false # Just triggered - inpolygons=false # Now used for light input file + # Check to see if inside layer - close tag + if [[ $l =~ .*\.* ]]; then + inlayer=false + fi - # Insert data from light input file - while read -r l - do + # Trigger once when open tag found in dark input file + if [ $getlayer == true ]; then - # Check to see if inside polygons layer - if [[ $l =~ .*\.* ]]; then - inpolygons=true - fi + getlayer=false # Just triggered + inlayer=false # Now used for light input file - if [[ $l =~ .*\.* ]]; then - inpolygons=false - fi + # Insert data from light input file + while read -r l + do - # Inside polygons layer - if [ $inpolygons == true ]; then + # Check to see if inside layer - open tag + if [[ $l =~ .*\.* ]]; then + inlayer=true + fi - if [[ $l =~ .*color=\"#[0-9a-fA-F]{6}.* ]]; then # Contains rgb(a) color - coll=$(echo $l | cut -d# -f2 | cut -c-6) # Get rgb color and convert - cold=$( printf '%02x' $(echo $(printf "%d" 0x${coll:0:2})/16+16 | bc)) - cold=$cold$(printf '%02x' $(echo $(printf "%d" 0x${coll:2:2})/10+14 | bc)) - cold=$cold$(printf '%02x' $(echo $(printf "%d" 0x${coll:4:2})/8+12 | bc)) - l=$(echo $l | sed "s/#$coll/#$cold/") # Replace color + # Check to see if inside layer - close tag + if [[ $l =~ .*\.* ]]; then + inlayer=false fi - l=$(echo $l | sed "s/> $ofd # (Modified) line from light input file to dark output file + # Modify color + if [[ $l =~ .*color=\"#[0-9a-fA-F]{6}.* ]]; then # Contains rgb(a) color + coll=$(echo $l | cut -d# -f2 | cut -c-6) # Get rgb color and convert + cold=$( printf '%02x' $(echo $(printf "%d" 0x${coll:0:2})/16+16 | bc)) + cold=$cold$(printf '%02x' $(echo $(printf "%d" 0x${coll:2:2})/10+14 | bc)) + cold=$cold$(printf '%02x' $(echo $(printf "%d" 0x${coll:4:2})/8+12 | bc)) + l=$(echo $l | sed "s/#$coll/#$cold/") # Replace color + fi - fi + # Misc. modifications + l=$(echo $l | sed -r "s/_bk\./_wh\./") # Black to white icons + l=$(echo $l | sed -r "s/(> $ofd # Modified line from light input file to dark output file + + fi + + done < $ifl # Read light input file + inlayer=true # Done inserting, still in layer in dark input file - done < $ifl # Read light input file - inpolygons=true # Done inserting, still in polygons layer in dark input file + else - else + # Outside layer + if [ $inlayer == false ]; then + echo $l >> $ofd # Just copy as-is to dark output file + fi - # Outside polygons layer - if [ $inpolygons == false ]; then - echo $l >> $ofd # Just copy as-is to dark output file fi - fi + done < $ifd # Read dark input file -done < $ifd # Read dark input file + cp $ofd $ifd # Replace + rm -f $ofd # Clean up -cp $ofd $ifd # Replace -rm -f $ofd # Clean up +done # Next layer in dark input file diff --git a/navit/navit_layout_car_shipped.xml b/navit/navit_layout_car_shipped.xml index 064bc2dbc..0603fc40f 100644 --- a/navit/navit_layout_car_shipped.xml +++ b/navit/navit_layout_car_shipped.xml @@ -66,16 +66,15 @@ + - -- cgit v1.2.1 From 567521f2f80c707225ec8e2a7f5fe4c677fd6013 Mon Sep 17 00:00:00 2001 From: Stefan Wildemann Date: Sun, 21 Jun 2020 22:48:53 +0200 Subject: fix:maptool:better map aerodroms and military areas (#1022) * fix:maptool:better map aerodroms and military areas This commit uses more complex rule set to map aerodromes and military landuses depending on tag combination avoiding duplication of the area in binfile. For example military airports are quite often tagged: landuse=military military=airfield aeroway=aerodrome which caused the airport to be tripled in map. This is now resolved. * Enhancement:layout_car:add stripesto military areas * Fix:maptool:treat archaeological_site limes special archaeological_site tag is used on way despite outruled by OSM wiki on limes archaeological site. But there is a special tagging scheme for Limes. Use that to fix rendering of Limes in map. --- navit/item_def.h | 1 + navit/maptool/osm.c | 17 ++++++++ navit/navit_layout_car_dark_shipped.xml | 12 ++++-- navit/navit_layout_car_shipped.xml | 12 ++++-- navit/textures/diagonal-stripes-gray.svg | 70 ++++++++++++++++++++++++++++++++ 5 files changed, 106 insertions(+), 6 deletions(-) create mode 100644 navit/textures/diagonal-stripes-gray.svg diff --git a/navit/item_def.h b/navit/item_def.h index b82d1907d..82f49d2a0 100644 --- a/navit/item_def.h +++ b/navit/item_def.h @@ -528,6 +528,7 @@ ITEM(former_itinerary) ITEM(former_itinerary_part) ITEM(cliff) ITEM(sports_track) +ITEM(archaeological_site) /* Area */ ITEM2(0xc0000000,area) ITEM2(0xc0000001,area_unspecified) diff --git a/navit/maptool/osm.c b/navit/maptool/osm.c index cbe13cc6f..288a227be 100644 --- a/navit/maptool/osm.c +++ b/navit/maptool/osm.c @@ -581,6 +581,9 @@ static char *attrmap= { "w aerialway=chair_lift lift_chair\n" "w aerialway=drag_lift lift_drag\n" "w aeroway=aerodrome poly_airport\n" + /* airport wins over military landuse and specifier if given */ + "w aeroway=aerodrome,landuse=military poly_airfield\n" + "w aeroway=aerodrome,landuse=military,military=* poly_airfield\n" "w aeroway=apron poly_apron\n" "w aeroway=runway aeroway_runway\n" "w aeroway=taxiway aeroway_taxiway\n" @@ -675,6 +678,10 @@ static char *attrmap= { "w highway=unsurfaced track_gravelled\n" "w highway=steps steps\n" "w historic=archaeological_site poly_archaeological_site\n" + /* Albeit historic=archaeological_site should not be used on ways (only on areas) according to OSM wiki, + * it is at least done so for the Limes in germany. Luckily we can sort the Limes out as it has it's own + * tag scheme.*/ + "w historic=archaeological_site,site_type=fortification,fortification_type=limes archaeological_site\n" "w historic=battlefield poly_battlefield\n" "w historic=ruins poly_ruins\n" "w historic=town_gate poly_building\n" @@ -692,7 +699,15 @@ static char *attrmap= { "w landuse=greenfield poly_greenfield\n" "w landuse=industrial poly_industry\n" "w landuse=landfill poly_landfill\n" + /* landuse=military plus military tag */ "w landuse=military poly_military\n" + "w landuse=military,military=* poly_military\n" + "w landuse=military,military=airfield poly_airfield\n" + "w landuse=military,military=barracks poly_barracks\n" + "w landuse=military,military=danger_area poly_danger_area\n" + "w landuse=military,military=naval_base poly_naval_base\n" + "w landuse=military,military=range poly_range\n" + "w landuse=military,military=training_area poly_military_zone\n" "w landuse=meadow poly_meadow\n" "w landuse=plaza poly_plaza\n" "w landuse=quarry poly_quarry\n" @@ -729,11 +744,13 @@ static char *attrmap= { "w leisure=track sports_track\n" "w leisure=water_park poly_water_park\n" "w leisure=swimming_pool poly_swimming_pool\n" + /* military tag without further info */ "w military=airfield poly_airfield\n" "w military=barracks poly_barracks\n" "w military=danger_area poly_danger_area\n" "w military=naval_base poly_naval_base\n" "w military=range poly_range\n" + "w military=training_area poly_military_zone\n" "w natural=beach poly_beach\n" "w natural=coastline water_line\n" "w natural=fell poly_fell\n" diff --git a/navit/navit_layout_car_dark_shipped.xml b/navit/navit_layout_car_dark_shipped.xml index 1c8ef041c..80727d4ff 100644 --- a/navit/navit_layout_car_dark_shipped.xml +++ b/navit/navit_layout_car_dark_shipped.xml @@ -477,6 +477,10 @@ + + + + @@ -522,15 +526,17 @@ - - + + + - + + diff --git a/navit/navit_layout_car_shipped.xml b/navit/navit_layout_car_shipped.xml index 0603fc40f..3c25259c1 100644 --- a/navit/navit_layout_car_shipped.xml +++ b/navit/navit_layout_car_shipped.xml @@ -477,6 +477,10 @@ + + + + @@ -522,15 +526,17 @@ - - + + + - + + diff --git a/navit/textures/diagonal-stripes-gray.svg b/navit/textures/diagonal-stripes-gray.svg new file mode 100644 index 000000000..7b6858521 --- /dev/null +++ b/navit/textures/diagonal-stripes-gray.svg @@ -0,0 +1,70 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + -- cgit v1.2.1 From 17f516a150c90aa25a42e3fe21398e137c14b2af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Fiti=C3=A9?= Date: Wed, 24 Jun 2020 15:44:40 +0200 Subject: improvement:layout:car-dark Improve Car-Dark layout colors (#1028) * Improve Car-Dark layout colors * Color tweak * Circle text bg color * Variable * Small script cleanups --- navit/navit_layout_car_dark_shipped.xml | 1178 ++++++++++++++--------------- navit/navit_layout_car_generatedarkxml.sh | 38 +- 2 files changed, 619 insertions(+), 597 deletions(-) diff --git a/navit/navit_layout_car_dark_shipped.xml b/navit/navit_layout_car_dark_shipped.xml index 80727d4ff..768962a3f 100644 --- a/navit/navit_layout_car_dark_shipped.xml +++ b/navit/navit_layout_car_dark_shipped.xml @@ -79,1151 +79,1151 @@ - + - - + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - - + + - + - + - + - + - - + + - - + + - + - + - + - + - + - + - + - - + + - + - + - + - + - - + + - + - - + + - + - - + + - + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - - + + - + - + - + - - + + - + - + - + - + - + - - + + - + - - + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - - + + - - + + - - - + + + - - - + + + - - - + + + - + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - + + - - + + - - + + - - + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - + + - - + + - - + + - - - + + + - - - + + + - - - + + + - - - + + + - - + + - - + + - - + + - - + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - + - - + + - - + + - - + + - - + + - - + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - + + - - + + - - + + - - + + - - + + - - + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - + - - + + - - + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - - - + + + + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1235,206 +1235,206 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + @@ -1537,46 +1537,46 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1872,19 +1872,19 @@ - - + + - - + + - + - - + + @@ -2094,10 +2094,10 @@ - + - + diff --git a/navit/navit_layout_car_generatedarkxml.sh b/navit/navit_layout_car_generatedarkxml.sh index 16a6ce04b..7b659b20d 100755 --- a/navit/navit_layout_car_generatedarkxml.sh +++ b/navit/navit_layout_car_generatedarkxml.sh @@ -5,6 +5,10 @@ # navit_layout_car_dark_shipped.xml. # It's a bit of a mess, but gets the job done. +# Variables +textcolor='55c4bd' + +# Settings IFS='' # Keep whitespace # Light and dark input files @@ -68,23 +72,41 @@ do # Modify color if [[ $l =~ .*color=\"#[0-9a-fA-F]{6}.* ]]; then # Contains rgb(a) color - coll=$(echo $l | cut -d# -f2 | cut -c-6) # Get rgb color and convert - cold=$( printf '%02x' $(echo $(printf "%d" 0x${coll:0:2})/16+16 | bc)) - cold=$cold$(printf '%02x' $(echo $(printf "%d" 0x${coll:2:2})/10+14 | bc)) - cold=$cold$(printf '%02x' $(echo $(printf "%d" 0x${coll:4:2})/8+12 | bc)) - l=$(echo $l | sed "s/#$coll/#$cold/") # Replace color + + # Get hexadecimal color + coll=$(echo $l | cut -d# -f2 | cut -c-6) + + # Get color values in decimal + cr=$(printf "%d" 0x${coll:0:2}) + cg=$(printf "%d" 0x${coll:2:2}) + cb=$(printf "%d" 0x${coll:4:2}) + + # Modify decimal color values + crn=$(echo $cr/16+$cg/32+$cb/32+16 | bc) + cgn=$(echo $cr/24+$cg/12+$cb/24+12 | bc) + cbn=$(echo $cr/16+$cg/16+$cb/ 8+ 8 | bc) + + # Convert new decimal color values to hexadecimal + cold=$( printf '%02x' $crn) + cold=$cold$(printf '%02x' $cgn) + cold=$cold$(printf '%02x' $cbn) + + # Replace old color with new hexadecimal color values + l=$(echo $l | sed "s/#$coll/#$cold/") + fi - # Misc. modifications + # Miscellaneous modifications l=$(echo $l | sed -r "s/_bk\./_wh\./") # Black to white icons - l=$(echo $l | sed -r "s/(> $ofd # Modified line from light input file to dark output file fi done < $ifl # Read light input file + inlayer=true # Done inserting, still in layer in dark input file else -- cgit v1.2.1