| 1 |
|
|---|
| 2 | meta {
|
|---|
| 3 | title: "Hiking routes";
|
|---|
| 4 | description: "Limited hiking routes example for standard JOSM (unpatched), see comments below";
|
|---|
| 5 | version: "0.1_2011-12-15";
|
|---|
| 6 | }
|
|---|
| 7 |
|
|---|
| 8 | /*
|
|---|
| 9 | * Limitations:
|
|---|
| 10 | * - multiple relations with same color not displayed (there's one example with blue to test
|
|---|
| 11 | * against previous matches, but there's no unique tag that would be reliable to do so)
|
|---|
| 12 | * - selector duplication by the need to use two "passes" for counting and actual execution
|
|---|
| 13 | * - declaration repetitions with only the color changing by the need to distinguish multiple
|
|---|
| 14 | * matching relations by exact value
|
|---|
| 15 | * - no symbols
|
|---|
| 16 | */
|
|---|
| 17 |
|
|---|
| 18 | way::osmc {
|
|---|
| 19 | _width: 12;
|
|---|
| 20 | _opacity: 0.7;
|
|---|
| 21 | _dashes_width: 6;
|
|---|
| 22 | _font_size: 9;
|
|---|
| 23 | _text_offset: 11;
|
|---|
| 24 |
|
|---|
| 25 | _count: 0;
|
|---|
| 26 | }
|
|---|
| 27 |
|
|---|
| 28 | /*
|
|---|
| 29 | * First "pass": Count matching parent relations and set dashes size accordingly
|
|---|
| 30 | * Note: selectors must match with those of the second pass.
|
|---|
| 31 | */
|
|---|
| 32 |
|
|---|
| 33 | relation[osmc:symbol=~/^blue:/] > way::osmc {
|
|---|
| 34 | _index_blue: prop(_count);
|
|---|
| 35 | _count: prop(_count) + 1;
|
|---|
| 36 | _name_blue1: parent_tag(name);
|
|---|
| 37 | }
|
|---|
| 38 | relation[osmc:symbol=~/^blue:/][eval(!(tag(name) == prop(_name_blue1)))] > way::osmc {
|
|---|
| 39 | _index_blue2: prop(_count);
|
|---|
| 40 | _count: prop(_count) + 1;
|
|---|
| 41 | }
|
|---|
| 42 | relation[osmc:symbol=~/^yellow:/] > way::osmc {
|
|---|
| 43 | _index_yellow: prop(_count);
|
|---|
| 44 | _count: prop(_count) + 1;
|
|---|
| 45 | }
|
|---|
| 46 | relation[osmc:symbol=~/^green:/] > way::osmc {
|
|---|
| 47 | _index_green: prop(_count);
|
|---|
| 48 | _count: prop(_count) + 1;
|
|---|
| 49 | }
|
|---|
| 50 | relation[osmc:symbol=~/^red:/] > way::osmc {
|
|---|
| 51 | _index_red: prop(_count);
|
|---|
| 52 | _count: prop(_count) + 1;
|
|---|
| 53 | }
|
|---|
| 54 | relation[osmc:symbol=~/^black:/] > way::osmc {
|
|---|
| 55 | _index_black: prop(_count);
|
|---|
| 56 | _count: prop(_count) + 1;
|
|---|
| 57 | }
|
|---|
| 58 | relation[!osmc:symbol][type=route][route=hiking] > way::osmc,
|
|---|
| 59 | relation[!osmc:symbol][type=route][route=foot] > way::osmc {
|
|---|
| 60 | _index_none: prop(_count);
|
|---|
| 61 | _count: prop(_count) + 1;
|
|---|
| 62 | }
|
|---|
| 63 |
|
|---|
| 64 | way::osmc {
|
|---|
| 65 | _dashes_space: (prop(_count) > 1) ? 2 : 0;
|
|---|
| 66 | _dashes: list(prop(_dashes_width), (prop(_dashes_width) * (prop(_count) - 1)) + prop(_dashes_space));
|
|---|
| 67 | }
|
|---|
| 68 |
|
|---|
| 69 | /*
|
|---|
| 70 | * Second "pass": dashed route lines + text
|
|---|
| 71 | * Note: selectors must match with those of the first pass.
|
|---|
| 72 | */
|
|---|
| 73 |
|
|---|
| 74 | relation[osmc:symbol=~/^blue:/] > way::osmc_blue {
|
|---|
| 75 | color: darkblue;
|
|---|
| 76 | dashes: prop(_dashes, osmc);
|
|---|
| 77 | dashes-offset: prop(_index_blue, osmc) * prop(_dashes_width, osmc);
|
|---|
| 78 | width: prop(_width, osmc);
|
|---|
| 79 | opacity: prop(_opacity, osmc);
|
|---|
| 80 | z-index: -1;
|
|---|
| 81 |
|
|---|
| 82 | text: eval(parent_tag("name"));
|
|---|
| 83 | text-color: blue;
|
|---|
| 84 | text-offset: prop(_text_offset, osmc) * (prop(_index_blue, osmc) + 1);
|
|---|
| 85 | font-size: prop(_font_size, osmc);
|
|---|
| 86 | }
|
|---|
| 87 |
|
|---|
| 88 | relation[osmc:symbol=~/^blue:/][eval(!(tag(name) == prop(_name_blue1, osmc)))] > way::osmc_blue2 {
|
|---|
| 89 | color: darkblue;
|
|---|
| 90 | dashes: prop(_dashes, osmc);
|
|---|
| 91 | dashes-offset: prop(_index_blue2, osmc) * prop(_dashes_width, osmc);
|
|---|
| 92 | width: prop(_width, osmc);
|
|---|
| 93 | opacity: prop(_opacity, osmc);
|
|---|
| 94 | z-index: -1;
|
|---|
| 95 |
|
|---|
| 96 | text: eval(parent_tag("name"));
|
|---|
| 97 | text-color: blue;
|
|---|
| 98 | text-offset: prop(_text_offset, osmc) * (prop(_index_blue2, osmc) + 1);
|
|---|
| 99 | font-size: prop(_font_size, osmc);
|
|---|
| 100 | }
|
|---|
| 101 |
|
|---|
| 102 | relation[osmc:symbol=~/^yellow:/] > way::osmc_yellow {
|
|---|
| 103 | color: gold;
|
|---|
| 104 | dashes: prop(_dashes, osmc);
|
|---|
| 105 | dashes-offset: prop(_index_yellow, osmc) * prop(_dashes_width, osmc);
|
|---|
| 106 | width: prop(_width, osmc);
|
|---|
| 107 | opacity: prop(_opacity, osmc);
|
|---|
| 108 | z-index: -1;
|
|---|
| 109 |
|
|---|
| 110 | text: eval(parent_tag("name"));
|
|---|
| 111 | text-color: yellow;
|
|---|
| 112 | text-offset: prop(_text_offset, osmc) * (prop(_index_yellow, osmc) + 1);
|
|---|
| 113 | font-size: prop(_font_size, osmc);
|
|---|
| 114 | }
|
|---|
| 115 |
|
|---|
| 116 | relation[osmc:symbol=~/^green:/] > way::osmc_green {
|
|---|
| 117 | color: darkgreen;
|
|---|
| 118 | dashes: prop(_dashes, osmc);
|
|---|
| 119 | dashes-offset: prop(_index_green, osmc) * prop(_dashes_width, osmc);
|
|---|
| 120 | width: prop(_width, osmc);
|
|---|
| 121 | opacity: prop(_opacity, osmc);
|
|---|
| 122 | z-index: -1;
|
|---|
| 123 |
|
|---|
| 124 | text: eval(parent_tag("name"));
|
|---|
| 125 | text-color: green;
|
|---|
| 126 | text-offset: prop(_text_offset, osmc) * (prop(_index_green, osmc) + 1);
|
|---|
| 127 | font-size: prop(_font_size, osmc);
|
|---|
| 128 | }
|
|---|
| 129 |
|
|---|
| 130 | relation[osmc:symbol=~/^red:/] > way::osmc_red {
|
|---|
| 131 | color: darkred;
|
|---|
| 132 | dashes: prop(_dashes, osmc);
|
|---|
| 133 | dashes-offset: prop(_index_red, osmc) * prop(_dashes_width, osmc);
|
|---|
| 134 | width: prop(_width, osmc);
|
|---|
| 135 | opacity: prop(_opacity, osmc);
|
|---|
| 136 | z-index: -1;
|
|---|
| 137 |
|
|---|
| 138 | text: eval(parent_tag("name"));
|
|---|
| 139 | text-color: red;
|
|---|
| 140 | text-offset: prop(_text_offset, osmc) * (prop(_index_red, osmc) + 1);
|
|---|
| 141 | font-size: prop(_font_size, osmc);
|
|---|
| 142 | }
|
|---|
| 143 |
|
|---|
| 144 | relation[osmc:symbol=~/^black:/] > way::osmc_black {
|
|---|
| 145 | /* can't use black because of black background in JOSM */
|
|---|
| 146 | color: darkgray;
|
|---|
| 147 | dashes: prop(_dashes, osmc);
|
|---|
| 148 | dashes-offset: prop(_index_black, osmc) * prop(_dashes_width, osmc);
|
|---|
| 149 | width: prop(_width, osmc);
|
|---|
| 150 | opacity: prop(_opacity, osmc);
|
|---|
| 151 | z-index: -1;
|
|---|
| 152 |
|
|---|
| 153 | text: eval(parent_tag("name"));
|
|---|
| 154 | text-color: white;
|
|---|
| 155 | text-offset: prop(_text_offset, osmc) * (prop(_index_black, osmc) + 1);
|
|---|
| 156 | font-size: prop(_font_size, osmc);
|
|---|
| 157 | }
|
|---|
| 158 |
|
|---|
| 159 | relation[!osmc:symbol][type=route][route=hiking] > way::osmc_none,
|
|---|
| 160 | relation[!osmc:symbol][type=route][route=foot] > way::osmc_none {
|
|---|
| 161 | color: dimgrey;
|
|---|
| 162 | dashes: prop(_dashes, osmc);
|
|---|
| 163 | dashes-offset: prop(_index_none, osmc) * prop(_dashes_width, osmc);
|
|---|
| 164 | width: prop(_width, osmc);
|
|---|
| 165 | opacity: prop(_opacity, osmc);
|
|---|
| 166 | z-index: -1;
|
|---|
| 167 |
|
|---|
| 168 | text: eval(parent_tag("name"));
|
|---|
| 169 | text-color: grey;
|
|---|
| 170 | text-offset: prop(_text_offset, osmc) * (prop(_index_none, osmc) + 1);
|
|---|
| 171 | font-size: prop(_font_size, osmc);
|
|---|
| 172 | }
|
|---|
| 173 |
|
|---|