diff --git a/Models/ThemeConfig/PointRenderingConfig.ts b/Models/ThemeConfig/PointRenderingConfig.ts index 39dcec156..c0c3cf962 100644 --- a/Models/ThemeConfig/PointRenderingConfig.ts +++ b/Models/ThemeConfig/PointRenderingConfig.ts @@ -13,6 +13,7 @@ import Img from "../../UI/Base/Img"; import Combine from "../../UI/Base/Combine"; import {VariableUiElement} from "../../UI/Base/VariableUIElement"; + export default class PointRenderingConfig extends WithContextLoader { private static readonly allowed_location_codes = new Set(["point", "centroid", "start", "end","projected_centerpoint"]) @@ -126,13 +127,20 @@ export default class PointRenderingConfig extends WithContextLoader { public GetBaseIcon(tags?: any): BaseUIElement { tags = tags ?? {id: "node/-1"} - const rotation = Utils.SubstituteKeys(this.rotation?.GetRenderValue(tags)?.txt ?? "0deg", tags) - const htmlDefs = Utils.SubstituteKeys(this.icon?.GetRenderValue(tags)?.txt, tags) let defaultPin: BaseUIElement = undefined if (this.label === undefined) { defaultPin = Svg.teardrop_with_hole_green_svg() } - return PointRenderingConfig.FromHtmlMulti(htmlDefs, rotation, false, defaultPin) + if(this.icon === undefined){ + return defaultPin; + } + const rotation = Utils.SubstituteKeys(this.rotation?.GetRenderValue(tags)?.txt ?? "0deg", tags) + const htmlDefs = Utils.SubstituteKeys(this.icon?.GetRenderValue(tags)?.txt, tags) + if(htmlDefs === undefined){ + // This layer doesn't want to show an icon right now + return undefined + } + return PointRenderingConfig.FromHtmlMulti(htmlDefs, rotation, false, defaultPin) } public GetSimpleIcon(tags: UIEventSource): BaseUIElement { diff --git a/assets/layers/maxspeed/license_info.json b/assets/layers/maxspeed/license_info.json new file mode 100644 index 000000000..b27ffbc1a --- /dev/null +++ b/assets/layers/maxspeed/license_info.json @@ -0,0 +1,12 @@ +[ + { + "path": "living_street_be.svg", + "license": "CC0", + "authors": [ + "Belgische Wetgever" + ], + "sources": [ + "https://nl.wikipedia.org/wiki/Bestand:Belgian_road_sign_F12a.svg" + ] + } +] \ No newline at end of file diff --git a/assets/layers/maxspeed/living_street_be.svg b/assets/layers/maxspeed/living_street_be.svg new file mode 100644 index 000000000..c026fa216 --- /dev/null +++ b/assets/layers/maxspeed/living_street_be.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/layers/maxspeed/maxspeed.json b/assets/layers/maxspeed/maxspeed.json new file mode 100644 index 000000000..b41fa2476 --- /dev/null +++ b/assets/layers/maxspeed/maxspeed.json @@ -0,0 +1,169 @@ +{ + "id": "maxspeed", + "name": { + "es": "Velocidad", + "ca": "Velocitat", + "en": "Maxspeed" + }, + "source": { + "osmTags": { + "and": [ + { + "or": [ + "highway=residential", + "highway=living_street", + "highway=motorway", + "highway=tertiary", + "highway=unclassified", + "highway=secondary", + "highway=primary", + "highway=trunk", + "highway=motorway", + "highway=tertiary_link", + "highway=secondary_link", + "highway=primary_link", + "highway=trunk_link", + "highway=motorway_link" + ] + }, + "type!=multipolygon", + "area!=yes" + ] + } + }, + "minzoom": 16, + "title": { + "render": { + "*": " {name}" + }, + "mappings": [ + { + "if": "name=", + "then": { + "en": "Road without a name" + } + } + ] + }, + "description": { + "en": "Shows the allowed speed for every road" + }, + "tagRenderings": [ + { + "render": { + "en": "The maximum allowed speed on this road is {maxspeed}" + }, + "question": { + "es": "Qué velocidad tiene", + "ca": "Quina velocitat té", + "en": "What is the legal maximum speed one is allowed to drive on this road?" + }, + "freeform": { + "key": "maxspeed", + "type": "pnat" + }, + "mappings": [ + { + "if": "highway=living_street", + "then": { + "en": "This is a living street, which has a maxspeed of 20km/h", + "nl": "Dit is een woonerf en heeft dus een maximale snelheid van 20km/h" + }, + "icon": { + "path":"./assets/layers/maxspeed/living_street_be.svg", + "size": "large" + }, + "hideInAnswer": "_country!=be" + } + ], + "id": "maxspeed-maxspeed" + } + ], + "allowSplit": true, + "mapRendering": [ + { + "render": null, + "icon": { + "mappings": [ + { + "if": "maxspeed~[1-9]0|1[0-4]0", + "then": "./assets/themes/maxspeed/maxspeed_{maxspeed}.svg" + } + ] + }, + "condition": "maxspeed!=30", + "iconSize": { + "render": "32,32,center" + }, + "location": [ + "point", + "projected_centerpoint" + ] + }, + { + "color": { + "render": "#000000", + "mappings": [ + { + "if": "maxspeed=", + "then": "#ff0000" + } + ] + }, + "width": { + "render": "3" + } + } + ], + "units": [ + { + "applicableUnits": [ + { + "#": "km/h is the default for a maxspeed; should be empty string", + "canonicalDenomination": "", + "alternativeDenomination": [ + "km/u", + "kmh", + "kph" + ], + "default": true, + "human": { + "en": "kilometers/hour", + "ca": "quilòmetres/hora", + "es": "kilómetros/hora", + "nl": "kilometers/uur" + }, + "humanShort": { + "en": "km/h", + "ca": "km/h", + "es": "km/h", + "nl": "km/u" + } + }, + { + "canonicalDenomination": "mph", + "alternativeDenomination": [ + "m/u", + "mh", + "m/ph" + ], + "human": { + "en": "miles/hour", + "ca": "milles/hora", + "es": "millas/hora", + "nl": "miles/uur" + }, + "humanShort": { + "en": "mph", + "ca": "mph", + "es": "mph", + "nl": "mph" + } + } + ], + "appliesToKey": [ + "maxspeed" + ] + } + ] +} \ No newline at end of file diff --git a/assets/themes/maxspeed/maxspeed.json b/assets/themes/maxspeed/maxspeed.json index b89b59d16..9b7edbf3a 100644 --- a/assets/themes/maxspeed/maxspeed.json +++ b/assets/themes/maxspeed/maxspeed.json @@ -6,14 +6,10 @@ "en": "Maxspeed" }, "shortDescription": { - "es": "Completar propiedades de velocidad", - "ca": "Completar propietats de velocitat", - "en": "Complete maxspeed tags" + "en": "This map shows the legally allowed maximum speed on every road." }, "description": { - "es": "Completaremos las propiedades de velocidad de una vía.", - "ca": "Completarem les propietats de la velocitat de la via que faltin.", - "en": "Complete the maxspeed properties of a way." + "en": "This map shows the legally allowed maximum speed on every road. If a maxspeed is missing or wrong, you can correct it here." }, "maintainer": "", "icon": "./assets/themes/maxspeed/maxspeed_logo.svg", @@ -23,205 +19,6 @@ "startZoom": 1, "widenFactor": 0.01, "layers": [ - { - "id": "maxspeed", - "name": { - "es": "Velocidad", - "ca": "Velocitat", - "en": "Maxspeed" - }, - "minzoom": 16, - "title": { - "render": { - "es": "Nombre: {name}", - "ca": "Nom: {name}", - "en": "Name: {name}" - }, - "mappings": [ - { - "if": { - "and": [ - "name=" - ] - }, - "then": { - "es": "Nombre: {name}", - "ca": "Nom: {name}", - "en": "Name: {name}" - } - } - ] - }, - "description": { - "es": "Completar las propiedades que faltan sobre velocidad", - "ca": "Completarem les propietats que falten de velocitat", - "en": "Complete the maxspeed properties of a way." - }, - "tagRenderings": [ - { - "render": { - "es": "Velocidad: {maxspeed}", - "ca": "Velocitat: {maxspeed}", - "en": "Speed: {maxspeed}" - }, - "question": { - "es": "Qué velocidad tiene", - "ca": "Quina velocitat té", - "en": "What is the maxspeed" - }, - "freeform": { - "key": "maxspeed" - }, - "id": "maxspeed-maxspeed" - }, - { - "render": { - "es": "Sentido único: {oneway}", - "ca": "Sentit únic: {oneway}", - "en": "Oneway: {oneway}" - }, - "question": { - "es": "¿La vía es de sentido único?", - "ca": "La via és de sentit únic?", - "en": "Is this road a oneway-road?" - }, - "freeform": { - "key": "oneway" - }, - "mappings": [ - { - "if": { - "and": [ - "oneway=yes" - ] - }, - "then": { - "es": "Sentido único", - "ca": "Sentit únic", - "en": "Oneway road" - } - }, - { - "if": { - "and": [ - "oneway=no" - ] - }, - "then": { - "es": "Doble sentido", - "ca": "Doble sentit", - "en": "Twoway street" - } - } - ], - "id": "maxspeed-oneway" - } - ], - "source": { - "osmTags": { - "or": [ - "highway=residential", - "highway=living_street", - "highway=motorway", - "highway=tertiary", - "highway=service", - "highway=unclassified", - "highway=secondary", - "highway=primary", - "highway=trunk", - "highway=motorway", - "highway=tertiary_link", - "highway=secondary_link", - "highway=primary_link", - "highway=trunk_link", - "highway=motorway_link" - ] - } - }, - "allowSplit": true, - "mapRendering": [ - { - "icon": { - "render": null, - "mappings": [ - { - "if": "maxspeed~[1-9]0|1[0-4]0", - "then": "./assets/themes/maxspeed/maxspeed_{maxspeed}.svg" - } - ] - }, - "iconSize": { - "render": "32,32,center" - }, - "location": [ - "point", - "projected_centerpoint" - ] - }, - { - "color": { - "render": "#000000", - "mappings": [ - { - "if": "maxspeed=", - "then": "#ff0000" - } - ] - }, - "width": { - "render": "3" - } - } - ], - "units": [ - { - "applicableUnits": [ - { - "#": "km/h is the default for a maxspeed; should be empty string", - "canonicalDenomination": "", - "alternativeDenomination": [ - "km/u", - "kmh", - "kph" - ], - "default": true, - "human": { - "en": "kilometers/hour", - "ca": "quilòmetres/hora", - "es": "kilómetros/hora", - "nl": "kilometers/uur" - }, - "humanShort": { - "en": "km/h", - "ca": "km/h", - "es": "km/h", - "nl": "km/u" - } - }, - { - "canonicalDenomination": "mph", - "alternativeDenomination": [ - "m/u", - "mh", - "m/ph" - ], - "human": { - "en": "miles/hour", - "ca": "milles/hora", - "es": "millas/hora", - "nl": "miles/uur" - }, - "humanShort": { - "en": "mph", - "ca": "mph", - "es": "mph", - "nl": "mph" - } - } - ], - "appliesToKey": [ "maxspeed"] - } - ] - } + "maxspeed" ] } \ No newline at end of file