Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Svg scripts #745

Merged
merged 4 commits into from
Jul 22, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions roads.mss
Original file line number Diff line number Diff line change
Expand Up @@ -2130,7 +2130,7 @@
shield-size: 10;
shield-fill: #fff;
shield-placement: line;
shield-file: url("symbols/shields/mot_shield[length].svg");
shield-file: url("symbols/shields/motorway_[length]x1.svg");
shield-spacing: 750;
shield-min-distance: 30;
shield-face-name: @bold-fonts;
Expand All @@ -2143,7 +2143,7 @@
shield-size: 10;
shield-fill: #fff;
shield-placement: line;
shield-file: url("symbols/shields/tru_shield[length].svg");
shield-file: url("symbols/shields/trunk_[length]x1.svg");
shield-spacing: 750;
shield-min-distance: 30;
shield-face-name: @bold-fonts;
Expand All @@ -2155,7 +2155,7 @@
shield-size: 10;
shield-fill: #fff;
shield-placement: line;
shield-file: url("symbols/shields/pri_shield[length].svg");
shield-file: url("symbols/shields/primary_[length]x1.svg");
shield-spacing: 750;
shield-min-distance: 30;
shield-face-name: @bold-fonts;
Expand All @@ -2167,7 +2167,7 @@
shield-size: 10;
shield-fill: #fff;
shield-placement: line;
shield-file: url("symbols/shields/sec_shield[length].svg");
shield-file: url("symbols/shields/secondary_[length]x1.svg");
shield-spacing: 750;
shield-min-distance: 30;
shield-face-name: @bold-fonts;
Expand All @@ -2182,7 +2182,7 @@
shield-size: 10;
shield-fill: #fff;
shield-placement: line;
shield-file: url("symbols/shields/mot_shield[length].svg");
shield-file: url("symbols/shields/motorway_[length]x1.svg");
shield-spacing: 750;
shield-min-distance: 30;
shield-face-name: @bold-fonts;
Expand All @@ -2195,7 +2195,7 @@
shield-size: 10;
shield-fill: #fff;
shield-placement: line;
shield-file: url("symbols/shields/tru_shield[length].svg");
shield-file: url("symbols/shields/trunk_[length]x1.svg");
shield-spacing: 750;
shield-min-distance: 30;
shield-face-name: @bold-fonts;
Expand All @@ -2207,7 +2207,7 @@
shield-size: 10;
shield-fill: #fff;
shield-placement: line;
shield-file: url("symbols/shields/pri_shield[length].svg");
shield-file: url("symbols/shields/primary_[length]x1.svg");
shield-spacing: 750;
shield-min-distance: 30;
shield-face-name: @bold-fonts;
Expand All @@ -2219,7 +2219,7 @@
shield-size: 10;
shield-fill: #fff;
shield-placement: line;
shield-file: url("symbols/shields/sec_shield[length].svg");
shield-file: url("symbols/shields/secondary_[length]x1.svg");
shield-spacing: 750;
shield-min-distance: 30;
shield-face-name: @bold-fonts;
Expand All @@ -2231,7 +2231,7 @@
shield-size: 10;
shield-fill: #fff;
shield-placement: line;
shield-file: url("symbols/shields/ter_shield[length].svg");
shield-file: url("symbols/shields/tertiary_[length]x1.svg");
shield-spacing: 750;
shield-min-distance: 30;
shield-face-name: @bold-fonts;
Expand Down
34 changes: 34 additions & 0 deletions scripts/create_shield
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash -e

# A simple script to generate a SVG road shield.
# Copyright 2014 Paul Norman
# Released under the Creative Commons CC0 license

# Syntax
# ./create_shield colour width height xoffset yoffset

# Fixed values
RADIUS=9
OUTERLINE=1.5
WHITELINE=1.5

COLOUR=$1
WIDTH=$2
HEIGHT=$3
XOFFSET=$4
YOFFSET=$5


echo "<svg xmlns='http://www.w3.org/2000/svg' width='100%' height='100%' "\
"viewBox='0 0 $(bc -q <<< "$WIDTH + $XOFFSET") $(bc -q <<< "$HEIGHT + $YOFFSET")'>"

echo "<rect x='$XOFFSET' y='$YOFFSET' height='$HEIGHT' width='$WIDTH' rx='$RADIUS' fill='$COLOUR'/>"

echo "<rect x='$(bc -q <<< "$XOFFSET + $OUTERLINE")' y='$(bc -q <<< "$YOFFSET + $OUTERLINE")' "\
"height='$(bc -q <<< "$HEIGHT - 2*$OUTERLINE")' width='$(bc -q <<< "$WIDTH - 2*$OUTERLINE")' "\
"rx='$(bc -q <<< "$RADIUS - $OUTERLINE")' fill='white'/>"

echo "<rect x='$(bc -q <<< "$XOFFSET + $OUTERLINE + $WHITELINE")' y='$(bc -q <<< "$YOFFSET + $OUTERLINE + $WHITELINE")' "\
"height='$(bc -q <<< "$HEIGHT - 2*$OUTERLINE - 2*$WHITELINE")' width='$(bc -q <<< "$WIDTH - 2*$OUTERLINE - 2*$WHITELINE")' "\
"rx='$(bc -q <<< "$RADIUS - $OUTERLINE - $WHITELINE")' fill='$COLOUR'/>"
echo "</svg>"
45 changes: 45 additions & 0 deletions scripts/create_standard_shields
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash -e

# A simple script that generates the standard road shields.
# Run from the same directory as create_shield
# Copyright 2014 Paul Norman
# Released under the Creative Commons CC0 license

widths='
1:18
2:25.25
3:32.5
4:39
5:46
6:52.5
7:59.25
8:66
9:70.5
10:75.75
11:80.75'

colours='motorway:#7788a1
trunk:#87ab87
primary:#bb7b7f
secondary:#c6ad84
tertiary:#c4c68f'


xoffset=1.25
yoffset=1.75

h='1:18'

for w in $widths; do
xchars=$(echo $w | awk -F ":" '{print $1}')
xpixels=$(echo $w | awk -F ":" '{print $2}')
ychars=$(echo $h | awk -F ":" '{print $1}')
ypixels=$(echo $h | awk -F ":" '{print $2}')

for shield in $colours; do
class=$(echo $shield | awk -F ":" '{print $1}')
colour=$(echo $shield | awk -F ":" '{print $2}')

./create_shield $colour $xpixels $ypixels $xoffset $yoffset > "${class}_${xchars}x${ychars}.svg"
done;
done;
5 changes: 0 additions & 5 deletions symbols/shields/mot_shield1.svg

This file was deleted.

17 changes: 0 additions & 17 deletions symbols/shields/mot_shield10.svg

This file was deleted.

17 changes: 0 additions & 17 deletions symbols/shields/mot_shield11.svg

This file was deleted.

17 changes: 0 additions & 17 deletions symbols/shields/mot_shield2.svg

This file was deleted.

17 changes: 0 additions & 17 deletions symbols/shields/mot_shield3.svg

This file was deleted.

17 changes: 0 additions & 17 deletions symbols/shields/mot_shield4.svg

This file was deleted.

17 changes: 0 additions & 17 deletions symbols/shields/mot_shield5.svg

This file was deleted.

17 changes: 0 additions & 17 deletions symbols/shields/mot_shield6.svg

This file was deleted.

17 changes: 0 additions & 17 deletions symbols/shields/mot_shield7.svg

This file was deleted.

17 changes: 0 additions & 17 deletions symbols/shields/mot_shield8.svg

This file was deleted.

17 changes: 0 additions & 17 deletions symbols/shields/mot_shield9.svg

This file was deleted.

5 changes: 5 additions & 0 deletions symbols/shields/motorway_10x1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions symbols/shields/motorway_11x1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions symbols/shields/motorway_1x1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions symbols/shields/motorway_2x1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions symbols/shields/motorway_3x1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions symbols/shields/motorway_4x1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading