| 4 | /* |
| 5 | #!/bin/bash |
| 6 | # bash script to generate the stylesheet |
| 7 | |
| 8 | OSMC_CZSK=no |
| 9 | |
| 10 | prevLayer=no |
| 11 | |
| 12 | echo 'meta { |
| 13 | title: "OSMC Hiking"; |
| 14 | description: "Highlight marked hiking trails using OSMC tagging schema."; |
| 15 | version: "0.2.[[revision]]_[[date]]"; |
| 16 | author: "Martin Ždila <martin.zdila@freemap.sk>"; |
| 17 | } |
| 18 | |
| 19 | way::osmc_0 { |
| 20 | offset: 2; |
| 21 | } |
| 22 | ' |
| 23 | |
| 24 | index=1 |
| 25 | |
| 26 | for color in red green blue yellow black brown orange purple white; do |
| 27 | if test "$OSMC_CZSK" == yes; then |
| 28 | # make main trails solid |
| 29 | regexps[0]="^${color}:[^:]*:[^:]+_bar" |
| 30 | styles[0]=""; |
| 31 | |
| 32 | # make all other trails dashed |
| 33 | regexps[1]="^${color}:[^:]*:[^:]+_(?!bar)" |
| 34 | styles[1]=" dashes: 8, 4;" |
| 35 | else |
| 36 | regexps[0]="^${color}:" |
| 37 | styles[0]=""; |
| 38 | fi |
| 39 | |
| 40 | for i in $(seq 0 $((${#regexps[*]} - 1))); do |
| 41 | regexp=${regexps[i]} |
| 42 | echo "way::osmc_$index {" |
| 43 | echo " offset: prop(\"offset\", \"osmc_$((index - 1))\");" |
| 44 | echo "}" |
| 45 | echo |
| 46 | echo "relation[osmc:symbol=~/$regexp/] > way::osmc_$index {" |
| 47 | if test "$color" == black; then |
| 48 | echo " color: gray;" |
| 49 | else |
| 50 | echo " color: $color;" |
| 51 | fi |
| 52 | echo " width: 3;" |
| 53 | echo " offset: prop(\"offset\") + 4;" |
| 54 | echo "${styles[i]}" |
| 55 | echo "}" |
| 56 | echo |
| 57 | |
| 58 | ((index++)) |
| 59 | done |
| 60 | done |
| 61 | */ |
| 62 | |
107 | | relation[osmc:symbol=~/^black:[^:]*:[^:]+_bar/] > way::osmc_9 { |
108 | | color: gray; |
109 | | width: 3; |
110 | | offset: prop("offset") + 4; |
111 | | |
112 | | } |
113 | | |
114 | | way::osmc_10 { |
115 | | offset: prop("offset", "osmc_9"); |
116 | | } |
117 | | |
118 | | relation[osmc:symbol=~/^black:[^:]*:[^:]+_(?!bar)/] > way::osmc_10 { |
119 | | color: gray; |
120 | | width: 3; |
121 | | offset: prop("offset") + 4; |
122 | | dashes: 8, 4; |
123 | | } |
124 | | |
125 | | way::osmc_11 { |
126 | | offset: prop("offset", "osmc_10"); |
127 | | } |
128 | | |
129 | | relation[osmc:symbol=~/^brown:[^:]*:[^:]+_bar/] > way::osmc_11 { |
130 | | color: brown; |
131 | | width: 3; |
132 | | offset: prop("offset") + 4; |
133 | | |
134 | | } |
135 | | |
136 | | way::osmc_12 { |
137 | | offset: prop("offset", "osmc_11"); |
138 | | } |
139 | | |
140 | | relation[osmc:symbol=~/^brown:[^:]*:[^:]+_(?!bar)/] > way::osmc_12 { |
141 | | color: brown; |
142 | | width: 3; |
143 | | offset: prop("offset") + 4; |
144 | | dashes: 8, 4; |
145 | | } |
146 | | |
147 | | way::osmc_13 { |
148 | | offset: prop("offset", "osmc_12"); |
149 | | } |
150 | | |
151 | | relation[osmc:symbol=~/^orange:[^:]*:[^:]+_bar/] > way::osmc_13 { |
152 | | color: orange; |
153 | | width: 3; |
154 | | offset: prop("offset") + 4; |
155 | | |
156 | | } |
157 | | |
158 | | way::osmc_14 { |
159 | | offset: prop("offset", "osmc_13"); |
160 | | } |
161 | | |
162 | | relation[osmc:symbol=~/^orange:[^:]*:[^:]+_(?!bar)/] > way::osmc_14 { |
163 | | color: orange; |
164 | | width: 3; |
165 | | offset: prop("offset") + 4; |
166 | | dashes: 8, 4; |
167 | | } |
168 | | |
169 | | way::osmc_15 { |
170 | | offset: prop("offset", "osmc_14"); |
171 | | } |
172 | | |
173 | | relation[osmc:symbol=~/^purple:[^:]*:[^:]+_bar/] > way::osmc_15 { |
174 | | color: purple; |
175 | | width: 3; |
176 | | offset: prop("offset") + 4; |
177 | | |
178 | | } |
179 | | |
180 | | way::osmc_16 { |
181 | | offset: prop("offset", "osmc_15"); |
182 | | } |
183 | | |
184 | | relation[osmc:symbol=~/^purple:[^:]*:[^:]+_(?!bar)/] > way::osmc_16 { |
185 | | color: purple; |
186 | | width: 3; |
187 | | offset: prop("offset") + 4; |
188 | | dashes: 8, 4; |
189 | | } |
190 | | |
191 | | way::osmc_17 { |
192 | | offset: prop("offset", "osmc_16"); |
193 | | } |
194 | | |
195 | | relation[osmc:symbol=~/^white:[^:]*:[^:]+_bar/] > way::osmc_17 { |
| 166 | relation[osmc:symbol=~/^white:/] > way::osmc_9 { |