Fix rainbox theme and add improvements
This commit is contained in:
parent
f0df09d0cb
commit
441d8467fe
8 changed files with 135 additions and 18 deletions
|
@ -19,7 +19,7 @@ export class AllKnownLayouts {
|
||||||
|
|
||||||
public static AllPublicLayers(options?: {
|
public static AllPublicLayers(options?: {
|
||||||
includeInlineLayers:true | boolean
|
includeInlineLayers:true | boolean
|
||||||
}) {
|
}) : LayerConfig[] {
|
||||||
const allLayers: LayerConfig[] = []
|
const allLayers: LayerConfig[] = []
|
||||||
const seendIds = new Set<string>()
|
const seendIds = new Set<string>()
|
||||||
AllKnownLayouts.sharedLayers.forEach((layer, key) => {
|
AllKnownLayouts.sharedLayers.forEach((layer, key) => {
|
||||||
|
|
|
@ -191,6 +191,9 @@ export default class LayerConfig extends WithContextLoader {
|
||||||
this.doNotDownload = json.doNotDownload ?? false;
|
this.doNotDownload = json.doNotDownload ?? false;
|
||||||
this.passAllFeatures = json.passAllFeatures ?? false;
|
this.passAllFeatures = json.passAllFeatures ?? false;
|
||||||
this.minzoom = json.minzoom ?? 0;
|
this.minzoom = json.minzoom ?? 0;
|
||||||
|
if(json["minZoom"] !== undefined){
|
||||||
|
throw "At "+context+": minzoom is written all lowercase"
|
||||||
|
}
|
||||||
this.minzoomVisible = json.minzoomVisible ?? this.minzoom;
|
this.minzoomVisible = json.minzoomVisible ?? this.minzoom;
|
||||||
this.shownByDefault = json.shownByDefault ?? true;
|
this.shownByDefault = json.shownByDefault ?? true;
|
||||||
this.forceLoad = json.forceLoad ?? false;
|
this.forceLoad = json.forceLoad ?? false;
|
||||||
|
|
|
@ -364,7 +364,7 @@ export default class TagRenderingConfig {
|
||||||
* Returns true if it is known or not shown, false if the question should be asked
|
* Returns true if it is known or not shown, false if the question should be asked
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
public IsKnown(tags: any): boolean {
|
public IsKnown(tags: Record<string, string>): boolean {
|
||||||
if (this.condition &&
|
if (this.condition &&
|
||||||
!this.condition.matchesProperties(tags)) {
|
!this.condition.matchesProperties(tags)) {
|
||||||
// Filtered away by the condition, so it is kindof known
|
// Filtered away by the condition, so it is kindof known
|
||||||
|
@ -400,7 +400,7 @@ export default class TagRenderingConfig {
|
||||||
* @param tags
|
* @param tags
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
public GetRenderValues(tags: any): { then: Translation, icon?: string, iconClass?: string }[] {
|
public GetRenderValues(tags: Record<string, string>): { then: Translation, icon?: string, iconClass?: string }[] {
|
||||||
if (!this.multiAnswer) {
|
if (!this.multiAnswer) {
|
||||||
return [this.GetRenderValueWithImage(tags)]
|
return [this.GetRenderValueWithImage(tags)]
|
||||||
}
|
}
|
||||||
|
@ -410,7 +410,7 @@ export default class TagRenderingConfig {
|
||||||
let freeformKeyDefined = this.freeform?.key !== undefined;
|
let freeformKeyDefined = this.freeform?.key !== undefined;
|
||||||
let usedFreeformValues = new Set<string>()
|
let usedFreeformValues = new Set<string>()
|
||||||
// We run over all the mappings first, to check if the mapping matches
|
// We run over all the mappings first, to check if the mapping matches
|
||||||
const applicableMappings: { then: TypedTranslation<any>, img?: string }[] = Utils.NoNull((this.mappings ?? [])?.map(mapping => {
|
const applicableMappings: { then: TypedTranslation<Record<string, string>>, img?: string }[] = Utils.NoNull((this.mappings ?? [])?.map(mapping => {
|
||||||
if (mapping.if === undefined) {
|
if (mapping.if === undefined) {
|
||||||
return mapping;
|
return mapping;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,12 +4,11 @@
|
||||||
"en": "Crossings with rainbow paintings"
|
"en": "Crossings with rainbow paintings"
|
||||||
},
|
},
|
||||||
"description": {
|
"description": {
|
||||||
"en": "Crossings with decorative rainbow paintings"
|
"en": "A layer showing pedestrian crossings with rainbow paintings"
|
||||||
},
|
},
|
||||||
"source": {
|
"source": {
|
||||||
"osmTags": {
|
"osmTags":
|
||||||
"highway=crossing"
|
"highway=crossing"
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"minzoom": 17,
|
"minzoom": 17,
|
||||||
"title": {
|
"title": {
|
||||||
|
@ -35,8 +34,10 @@
|
||||||
"snapToLayer": "cycleways_and_roads",
|
"snapToLayer": "cycleways_and_roads",
|
||||||
"maxSnapDistance": 25
|
"maxSnapDistance": 25
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
],
|
||||||
"tagRenderings": [
|
"tagRenderings": [
|
||||||
|
"images",
|
||||||
{
|
{
|
||||||
"id": "crossing-with-rainbow",
|
"id": "crossing-with-rainbow",
|
||||||
"question": {
|
"question": {
|
||||||
|
@ -48,13 +49,26 @@
|
||||||
"if": "crossing:marking=rainbow",
|
"if": "crossing:marking=rainbow",
|
||||||
"then": {
|
"then": {
|
||||||
"en": "This crossing has rainbow paintings"
|
"en": "This crossing has rainbow paintings"
|
||||||
|
},
|
||||||
|
"icon": {
|
||||||
|
"path": "./assets/themes/rainbow_crossings/logo.svg",
|
||||||
|
"class": "medium"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"if": "not:crossing:marking=rainbow",
|
||||||
|
"then": {
|
||||||
|
"en": "No rainbow paintings here"
|
||||||
|
},
|
||||||
|
"icon": "./assets/themes/rainbow_crossings/crossing.svg"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"if": "crossing:marking!=rainbow",
|
"if": "crossing:marking!=rainbow",
|
||||||
"then": {
|
"then": {
|
||||||
"en": "No rainbow paintings here"
|
"en": "No rainbow paintings here"
|
||||||
}
|
},
|
||||||
|
"icon": "./assets/themes/rainbow_crossings/crossing.svg",
|
||||||
|
"hideInAnswer": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -62,16 +76,17 @@
|
||||||
"mapRendering": [
|
"mapRendering": [
|
||||||
{
|
{
|
||||||
"icon": {
|
"icon": {
|
||||||
"render": "./assets/themes/rainbow_crossings/logo.svg"
|
"render": "./assets/themes/rainbow_crossings/crossing.svg",
|
||||||
|
"mappings": [{
|
||||||
|
"if": "crossing:marking=rainbow",
|
||||||
|
"then": "./assets/themes/rainbow_crossings/logo.svg"
|
||||||
|
}]
|
||||||
},
|
},
|
||||||
"iconSize": "40,40,bottom",
|
"iconSize": "40,40,center",
|
||||||
"location": [
|
"location": [
|
||||||
"point",
|
"point",
|
||||||
"centroid"
|
"centroid"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"description": {
|
|
||||||
"en": "A layer showing pedestrian crossings with rainbow paintings"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -279,6 +279,10 @@
|
||||||
"if": "theme=postboxes",
|
"if": "theme=postboxes",
|
||||||
"then": "./assets/themes/postboxes/postbox.svg"
|
"then": "./assets/themes/postboxes/postbox.svg"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"if": "theme=rainbow_crossings",
|
||||||
|
"then": "./assets/themes/rainbow_crossings/logo.svg"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"if": "theme=shops",
|
"if": "theme=shops",
|
||||||
"then": "./assets/themes/shops/shop.svg"
|
"then": "./assets/themes/shops/shop.svg"
|
||||||
|
|
66
assets/themes/rainbow_crossings/crossing.svg
Normal file
66
assets/themes/rainbow_crossings/crossing.svg
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
viewBox="0 0 600 600"
|
||||||
|
version="1.1"
|
||||||
|
id="svg20"
|
||||||
|
sodipodi:docname="crossing.svg"
|
||||||
|
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg">
|
||||||
|
<defs
|
||||||
|
id="defs24" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="namedview22"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#111111"
|
||||||
|
borderopacity="1"
|
||||||
|
inkscape:pageshadow="0"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pagecheckerboard="1"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:zoom="0.75881737"
|
||||||
|
inkscape:cx="-111.35749"
|
||||||
|
inkscape:cy="312.32812"
|
||||||
|
inkscape:window-width="1920"
|
||||||
|
inkscape:window-height="1007"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="svg20" />
|
||||||
|
<rect
|
||||||
|
style="fill:#959a99;fill-opacity:1;stroke-linecap:round"
|
||||||
|
id="rect845"
|
||||||
|
width="602.2915"
|
||||||
|
height="602.07373"
|
||||||
|
x="-1.5249536"
|
||||||
|
y="-1.9649721" />
|
||||||
|
<rect
|
||||||
|
x="51.805016"
|
||||||
|
y="120.82925"
|
||||||
|
width="100"
|
||||||
|
height="400"
|
||||||
|
fill="#ffffff"
|
||||||
|
stroke-width="2"
|
||||||
|
stroke="#000000"
|
||||||
|
id="rect14" />
|
||||||
|
<rect
|
||||||
|
x="251.80501"
|
||||||
|
y="120.82925"
|
||||||
|
width="100"
|
||||||
|
height="400"
|
||||||
|
fill="#ffffff"
|
||||||
|
stroke-width="2"
|
||||||
|
stroke="#000000"
|
||||||
|
id="rect16" />
|
||||||
|
<rect
|
||||||
|
x="451.80502"
|
||||||
|
y="120.82925"
|
||||||
|
width="100"
|
||||||
|
height="400"
|
||||||
|
fill="#ffffff"
|
||||||
|
stroke-width="2"
|
||||||
|
stroke="#000000"
|
||||||
|
id="rect18" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.6 KiB |
|
@ -1,4 +1,12 @@
|
||||||
[
|
[
|
||||||
|
{
|
||||||
|
"path": "crossing.svg",
|
||||||
|
"license": "CC0",
|
||||||
|
"authors": [
|
||||||
|
"bxl-forever"
|
||||||
|
],
|
||||||
|
"sources": []
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "logo.svg",
|
"path": "logo.svg",
|
||||||
"license": "CC0",
|
"license": "CC0",
|
||||||
|
|
|
@ -15,7 +15,28 @@
|
||||||
"startZoom": 16,
|
"startZoom": 16,
|
||||||
"widenFactor": 2,
|
"widenFactor": 2,
|
||||||
"layers": [
|
"layers": [
|
||||||
"rainbow_crossings"
|
"rainbow_crossings",
|
||||||
|
{
|
||||||
|
"builtin": "rainbow_crossings",
|
||||||
|
"override": {
|
||||||
|
"minzoom": 10,
|
||||||
|
"id": "rainbow_crossing_high_zoom",
|
||||||
|
"name": null,
|
||||||
|
"=presets": [],
|
||||||
|
"source": {
|
||||||
|
"osmTags": {
|
||||||
|
"and+": ["crossing:marking=rainbow"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"builtin": "cycleways_and_roads",
|
||||||
|
"override": {
|
||||||
|
"minzoom": 18,
|
||||||
|
"name": null
|
||||||
|
}
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue