Fix themes, fix tests

This commit is contained in:
Pieter Vander Vennet 2023-11-13 13:45:22 +01:00
parent 255347fc06
commit edf7dba9e3
16 changed files with 350 additions and 297 deletions

View file

@ -232,7 +232,7 @@
]
}
],
"pointRendering": [],
"pointRendering": null,
"lineRendering": [
{
"width": {
@ -549,7 +549,7 @@
},
"title": "Service road",
"tagRenderings": [],
"pointRendering": [],
"pointRendering": null,
"lineRendering": [ {
"width": 4,
"color": "#888888"
@ -594,7 +594,7 @@
"tagRenderings": [
"all_tags"
],
"pointRendering": [],
"pointRendering": null,
"lineRendering": [
{
"color": "#ccc",

View file

@ -1,253 +0,0 @@
{
"id": "grb_fixme",
"title": {
"nl": "GRB Fixup"
},
"description": {
"nl": "Gebouwen met een FIXME - wss GRB-import die gefixed moeten worden"
},
"shortDescription": {
"nl": "Grb Fixup"
},
"icon": "./assets/svg/bug.svg",
"startZoom": 14,
"startLat": 51.2132,
"startLon": 3.231,
"defaultBackgroundId": "AGIVFlandersGRB",
"hideFromOverview": true,
"layers": [
{
"id": "osm-buildings-fixme",
"name": "OSM-buildings with a fixme",
"source": {
"osmTags": {
"and": [
"building~*",
"fixme~*"
]
},
"maxCacheAge": 0
},
"calculatedTags": [
"_grbNumber=(feat.properties.fixme?.match(/GRB thinks that this has number ([0-9a-zA-Z;]+)/) ?? ['','none']) [1]"
],
"title": "OSM-gebouw",
"tagRenderings": [
{
"id": "building type",
"freeform": {
"key": "building"
},
"render": "The building type is <b>{building}</b>",
"question": {
"en": "What kind of building is this?",
"de": "Was ist das für ein Gebäude?",
"es": "¿Qué tipo de este edificio es este?",
"nl": "Wat voor soort gebouw is dit?",
"fr": "De quel type de bâtiment sagit-il ?",
"nb_NO": "Hva slags bygning er dette?",
"da": "Hvad er det for en bygning?",
"cs": "Jaký druh budovy je toto?",
"ca": "Quin tipus d'edifici és aquest?",
"pl": "Jaki to rodzaj budynku?"
},
"mappings": [
{
"if": "building=house",
"then": "A normal house"
},
{
"if": "building=detached",
"then": "A house detached from other building"
},
{
"if": "building=semidetached_house",
"then": "A house sharing only one wall with another house"
},
{
"if": "building=apartments",
"then": "An apartment building (a highrise building for living)"
},
{
"if": "building=office",
"then": "An office building - highrise for work"
},
{
"if": "building=shed",
"then": "A small shed, e.g. in a garden"
},
{
"if": "building=garage",
"then": "A single garage to park a car"
},
{
"if": "building=garages",
"then": "A building containing only garages; typically they are all identical"
},
{
"if": "building=yes",
"then": "A building - no specification"
}
]
},
{
"id": "grb-housenumber",
"render": {
"nl": "Het huisnummer is <b>{addr:housenumber}</b>"
},
"question": {
"nl": "Wat is het huisnummer?"
},
"freeform": {
"key": "addr:housenumber"
},
"mappings": [
{
"if": {
"and": [
"not:addr:housenumber=yes",
"addr:housenumber="
]
},
"then": {
"nl": "Geen huisnummer"
}
},
{
"if": {
"and": [
"addr:housenumber:={_grbNumber}",
"fixme="
]
},
"then": "Het huisnummer is <b>{_grbNumber}</b>, wat overeenkomt met het GRB",
"hideInAnswer": {
"or": [
"_grbNumber=",
"_grbNumber=none",
"_grbNumber=no number"
]
}
},
{
"if": {
"and": [
"addr:housenumber=",
"not:addr:housenumber=yes",
"fixme="
]
},
"then": "Dit gebouw heeft geen nummer, net zoals in het GRB",
"hideInAnswer": "_grbNumber!=no number"
}
]
},
{
"id": "grb-unit",
"question": "Wat is de wooneenheid-aanduiding?",
"render": {
"nl": "De wooneenheid-aanduiding is <b>{addr:unit}</b> "
},
"freeform": {
"key": "addr:unit"
},
"mappings": [
{
"if": "addr:unit=",
"then": "Geen wooneenheid-nummer"
}
]
},
{
"id": "grb-street",
"render": {
"nl": "De straat is <b>{addr:street}</b>"
},
"freeform": {
"key": "addr:street"
},
"question": {
"nl": "Wat is de straat?"
}
},
{
"id": "grb-fixme",
"render": {
"nl": "De fixme is <b>{fixme}</b>"
},
"question": {
"nl": "Wat zegt de fixme?"
},
"freeform": {
"key": "fixme"
},
"mappings": [
{
"if": {
"and": [
"fixme="
]
},
"then": {
"nl": "Geen fixme"
}
}
]
},
{
"id": "grb-min-level",
"render": {
"nl": "Dit gebouw begint maar op de {building:min_level} verdieping"
},
"question": {
"nl": "Hoeveel verdiepingen ontbreken?"
},
"freeform": {
"key": "building:min_level",
"type": "pnat"
}
},
{
"id": "fix_verdieping",
"render": "{tag_apply(fixme=;building:min_level=1,De eerste verdieping ontbreekt)}",
"condition": "fixme=verdieping, correct the building tag, add building:level and building:min_level before upload in JOSM!"
},
"all_tags"
],
"minzoom": 14,
"pointRendering": [],
"lineRendering": [
{}
]
},
{
"builtin": "address",
"override": {
"minzoom": 18
}
},
{
"builtin": "crab_address",
"override": {
"minzoom": 18,
"+tagRenderings": [
{
"id": "import-button",
"render": "{import_button(address, addr:street=$STRAATNM; addr:housenumber=$HUISNR,Import this address)}"
}
]
}
}
],
"overrideAll": {
"source": {
"maxCacheAge": 0
}
},
"widenFactor": 2,
"overpassMaxZoom": 15,
"osmApiTileSize": 17,
"clustering": {
"maxZoom": 15
}
}

View file

@ -124,9 +124,22 @@
}
},
"isShown": "_country=be",
"pointRendering": [],
"pointRendering": [
{
"label": "<div class='text-xl bg-white rounded-full pl-2 pr-2 break-normal'>{postal_code}</div>",
"location": [
"point",
"centroid"
]
}
],
"lineRendering": [
{}
{
"color": "#00f",
"width": "4",
"fill": "no",
"dashArray": "8 8"
}
]
},
{
@ -140,9 +153,12 @@
}
},
"title": "Boundary relation with addr:postcode={addr:postcode}",
"pointRendering": [],
"pointRendering": null,
"lineRendering": [
{}
{
"color": "#f00",
"width": 1
}
]
},
{
@ -197,13 +213,24 @@
}
},
"isShown": "_country=be",
"pointRendering": [],
"lineRendering": [
{}
"pointRendering": [
{
"marker": [
{
"icon": "./assets/themes/postal_codes/townhall.svg"
}
],
"iconSize": "40,40",
"location": [
"point",
"centroid"
],
"anchor": "center"
}
]
}
],
"overpassTimeout": 180,
"widenFactor": 0.05,
"clustering": false
}
}

View file

@ -247,11 +247,87 @@
}
],
"allowSplit": true,
"pointRendering": [],
"pointRendering": [
{
"location": [
"start",
"end"
],
"marker": [
{
"icon": "circle:#ccc"
}
],
"iconSize": "3,3",
"anchor": "center"
}
],
"lineRendering": [
{}
{
"#": "The center line",
"color": "#ffffff55",
"width": 8,
"lineCap": "butt"
},
{
"#": "left",
"color": "#888",
"dashArray": {
"render": "",
"mappings": [
{
"if": "sidewalk:left=",
"then": "1,12"
}
]
},
"width": {
"render": 6,
"mappings": [
{
"if": {
"or": [
"sidewalk:left=no",
"sidewalk:left=separate"
]
},
"then": 0
}
]
},
"offset": -6,
"lineCap": "butt"
},
{
"color": "#888",
"dashArray": {
"render": "",
"mappings": [
{
"if": "sidewalk:right=",
"then": "1,12"
}
]
},
"width": {
"render": 6,
"mappings": [
{
"if": {
"or": [
"sidewalk:right=no",
"sidewalk:right=separate"
]
},
"then": 0
}
]
},
"lineCap": "butt",
"offset": 6
}
]
}
],
"widenFactor": 0.05
}
}

View file

@ -26,9 +26,12 @@
"osmTags": "shadow=yes",
"isOsmCache": false
},
"pointRendering": [],
"pointRendering": null,
"lineRendering": [
{}
{
"color": "#444444",
"width": "1"
}
]
},
{
@ -208,9 +211,24 @@
"questions",
"reviews"
],
"pointRendering": [],
"pointRendering": null,
"lineRendering": [
{}
{
"color": {
"render": "#6d6",
"mappings": [
{
"if": "color~*",
"then": "{color}"
},
{
"if": "colour~*",
"then": "{colour}"
}
]
},
"width": "9"
}
]
}
],
@ -247,4 +265,4 @@
"maxZoom": 6,
"minNeededElements": 100
}
}
}

View file

@ -31,8 +31,7 @@
"override": {
"minzoom": 18,
"passAllFeatures": true,
"=pointRendering": [
]
"=pointRendering": null
}
},
{
@ -86,9 +85,31 @@
"zh_Hant": "顯示火車站的圖層",
"pl": "Warstwa pokazująca stacje kolejowe"
},
"pointRendering": [],
"pointRendering": [
{
"marker": [
{
"icon": "./assets/themes/stations/rail-light.svg"
}
],
"location": [
"point",
"centroid"
],
"label": {
"mappings": [
{
"if": "name~*",
"then": "<div style='background: white; padding: 0.25em; border-radius:0.5em'>{name}</div>"
}
]
}
}
],
"lineRendering": [
{}
{
"color": "green"
}
]
},
{
@ -408,7 +429,19 @@
}
}
],
"pointRendering": [],
"pointRendering": [
{
"marker": [
{
"icon": "./assets/themes/stations/departures_board.svg"
}
],
"location": [
"point",
"centroid"
]
}
],
"lineRendering": [
{}
]

View file

@ -190,9 +190,11 @@
}
],
"allowSplit": true,
"pointRendering": [],
"pointRendering": null,
"lineRendering": [
{}
{
"color": "#ff0"
}
]
},
{
@ -347,9 +349,19 @@
}
],
"allowSplit": true,
"pointRendering": [],
"pointRendering": null,
"lineRendering": [
{}
{
"color": {
"render": "#a9a9a9",
"mappings": [
{
"if": "lit=no",
"then": "#303030"
}
]
}
}
]
}
]

View file

@ -35,9 +35,30 @@
"tagRenderings": [
"all_tags"
],
"pointRendering": [],
"pointRendering": [
{
"location": [
"point",
"centroid"
],
"marker": [
{
"icon": {
"render": "circle:red",
"mappings": [
{
"if": "_has_closeby_feature=yes",
"then": "circle:#008000aa"
}
]
}
}
],
"iconSize": "20,20",
"anchor": "center"
}
],
"lineRendering": [
{}
]
},
{
@ -57,4 +78,4 @@
}
}
]
}
}

View file

@ -43,7 +43,7 @@
"name": {
"en": "Inspire polygons"
},
"pointRendering": [],
"pointRendering": null,
"lineRendering": [
{
"width": 2,

View file

@ -72,6 +72,7 @@
"color": "#452b29"
}
],
"pointRendering":null,
"tagRenderings": [
{
"builtin": "survey_date",

View file

@ -39,9 +39,30 @@
"tagRenderings": [
"all_tags"
],
"pointRendering": [],
"pointRendering": [
{
"location": [
"point",
"centroid"
],
"marker": [
{
"icon": {
"render": "circle:red",
"mappings": [
{
"if": "_has_closeby_feature=yes",
"then": "circle:#008000aa"
}
]
}
}
],
"iconSize": "20,20",
"anchor": "center"
}
],
"lineRendering": [
{}
]
},
"recycling",
@ -66,11 +87,36 @@
"tagRenderings": [
"all_tags"
],
"pointRendering": [],
"pointRendering": [
{
"location": [
"point",
"centroid"
],
"marker": [
{
"icon": {
"render": "circle:red",
"mappings": [
{
"if": "_has_closeby_recycling=yes",
"then": "circle:#008000aa"
},
{
"if": "_has_closeby_waste_disposal=yes",
"then": "circle:#008000aa"
}
]
}
}
],
"iconSize": "20,20",
"anchor": "center"
}
],
"lineRendering": [
{}
]
},
"waste_disposal"
]
}
}

View file

@ -186,9 +186,76 @@
]
}
],
"pointRendering": [],
"pointRendering": [
{
"location": [
"point"
],
"marker": [
{
"icon": "./assets/themes/width/icon.svg"
}
],
"iconSize": "40,40",
"anchor": "center"
}
],
"lineRendering": [
{}
{
"width": "4",
"color": {
"render": "#00f",
"mappings": [
{
"if": {
"or": [
"access=destination",
"highway=pedestrian",
"motor_vehicle=no",
"motor_vehicle=destination"
]
},
"then": "lightgrey"
},
{
"if": {
"and": [
"_width:difference!~-.*",
"_width:difference:no_pedestrians~-.*"
]
},
"then": "orange"
},
{
"if": "_width:difference~-.*",
"then": "#0f0"
},
{
"if": "_width:difference!~-.*",
"then": "#f00"
}
]
},
"dashArray": {
"render": "",
"mappings": [
{
"if": {
"and": [
"oneway=yes",
{
"or": [
"oneway:bicycle=yes",
"oneway:bicycle="
]
}
]
},
"then": "5 6"
}
]
}
}
]
}
],

View file

@ -110,8 +110,7 @@ export class Each<X, Y> extends Conversion<X[], Y[]> {
values[i]?.["id"] !== undefined ? values[i]?.["id"] : ""
)
}
const context_ = c.enter(i)
const r = step.convert(values[i], context_)
const r = step.convert(values[i], c.enter(i))
result.push(r)
}
return result

View file

@ -552,7 +552,7 @@ export class DetectShadowedMappings extends DesugaringStep<TagRenderingConfigJso
* const context = ConversionContext.test()
* const r = new DetectShadowedMappings().convert(tr, context);
* context.getAll("error").length // => 1
* context.getAll("error")[0].message.indexOf("The mapping key=value &x=y is fully matched by a previous mapping (namely 0)") >= 0 // => true
* context.getAll("error")[0].message.indexOf("The mapping key=value & x=y is fully matched by a previous mapping (namely 0)") >= 0 // => true
*/
convert(json: TagRenderingConfigJson, context: ConversionContext): TagRenderingConfigJson {
if (json.mappings === undefined || json.mappings.length === 0) {
@ -1067,7 +1067,12 @@ export class PrevalidateLayer extends DesugaringStep<LayerConfigJson> {
.err("Detected a 'pointRenderingS', it is written singular")
}
if (!(json.pointRendering?.length > 0)) {
if (
!(json.pointRendering?.length > 0) &&
json.pointRendering !== null &&
json.source !== "special" &&
json.source !== "special:library"
) {
context.enter("pointRendering").err("There are no pointRenderings at all...")
}

View file

@ -248,6 +248,7 @@ export interface LayerConfigJson {
/**
* Creates points to render on the map.
* This can render points for point-objects, lineobjects or areaobjects; use 'location' to indicate where it should be rendered
*
* group: pointrendering
*/
pointRendering: PointRenderingConfigJson[]

View file

@ -219,7 +219,7 @@ export default class LayerConfig extends WithContextLoader {
if (json.pointRendering) {
this.mapRendering = Utils.NoNull(json.pointRendering).map(
(r, i) => new PointRenderingConfig(r, `${context}[${i}]`)
(r, i) => new PointRenderingConfig(r, `${context}[${i}](${this.id})`)
)
} else {
this.mapRendering = []