Themes(narrowboat): more work on locks and access

This commit is contained in:
Pieter Vander Vennet 2024-10-03 16:52:10 +02:00
parent a238e9b7bd
commit 6909f56d22
8 changed files with 162 additions and 90 deletions

View file

@ -1,20 +1,7 @@
{
"credits": "Pieter Vander Vennet",
"minzoom": 15,
"pointRendering": [
{
"location": [
"point",
"centroid"
],
"marker": [
{
"icon": "circle",
"color": "white"
}
]
}
],
"pointRendering": null,
"tagRenderings": [
"images",
{

View file

@ -11,6 +11,7 @@
"and": [
"motorboat!=no",
"boat!=no",
"type=",
{
"or": [
"waterway=river",
@ -63,6 +64,18 @@
],
"tagRenderings": [
"images",
{
"id": "name",
"question": {
"en": "What is the name of this waterway?"
},
"render": {
"en": "This waterway is named {name}"
},
"freeform": {
"key": "name"
}
},
"wikipedia",
{
"id": "type",
@ -94,7 +107,10 @@
"question": {
"en": "Are boats allowed on this waterway?"
},
"id": "3_vyksl7ofya7m97l",
"label": [
"access"
],
"id": "boats_allowed",
"questionHint": {
"en": "A boat is a floating craft of which the hull is less then 20 meter long (without rudder or bowsprit)"
},
@ -117,11 +133,15 @@
}
]
},
{
"question": {
"en": "Are motorboats allowed on this waterway?"
},
"id": "4_yuodfwdyocflwg8",
"id": "motorboats_allowed",
"label": [
"access"
],
"mappings": [
{
"if": "motorboat=yes",
@ -136,9 +156,32 @@
}
}
]
},
{
"question": {
"en": "Are canoes, kayaks and other small, manually powered craft allowed on this waterway?"
},
"id": "canoes_allowed",
"label": [
"access"
],
"mappings": [
{
"if": "canoe=yes",
"then": {
"en": "Canoes, kayaks and manually powered craft are allowed here"
}
},
{
"if": "canoe=no",
"then": {
"en": "Canoes, kayaks and other manually powered craft are <b>not</b> allowed"
}
}
]
}
],
"allowMove": false,
"credits": "Pieter Vander Vennet",
"credits:uid": 3818858
}
}

View file

@ -65,11 +65,39 @@
],
"tagRenderings": [
"images",
"opening_hours_24_7",
{
"question": {
"en": "What VHF channel should be used to communicate with the control room of this lock?"
},
"id": "vhf",
"render": {
"en": "The VHF channel is {vhf}"
},
"freeform": {
"key": "vhf"
},
"condition": {
"or": [
"automated=yes",
"automated="
]
}
},
"phone",
{
"builtin": "website",
"override": {
"question": {
"en": "On what website can one find more information about this lock?"
}
}
},
{
"question": {
"en": "What is the maximum width (beam) of boats using this lock?"
},
"id": "max_length",
"id": "max_width",
"render": {
"en": "This lock permits boats with a maximum width of {maxwidth}"
},
@ -86,7 +114,7 @@
"question": {
"en": "What is the maximum length of boats that may use this lock?"
},
"id": "2_qyvwk0kx77jcmh2",
"id": "maxlength",
"multiAnswer": false,
"freeform": {
"key": "maxlength"
@ -99,11 +127,29 @@
},
"condition": "waterway!=derelict_canal"
},
{
"question": {
"en": "What is the maximum draft of boats using this lock?",
"nl": "Wat is de maximale toegestane diepgang in deze sluis?"
},
"id": "max_depth",
"questionHint": {
"en": "Omit units if designated in meters. Feet and inches maybe indicated with apostrophes and quotation marks."
},
"multiAnswer": false,
"render": {
"en": "The maximum draft of boats using this lock is {draft}."
},
"freeform": {
"key": "draft"
},
"condition": "waterway!=derelict_canal"
},
{
"question": {
"en": "How far does this lock raise or lower a boat?"
},
"id": "3_sm4v6ow91r2i4kd",
"id": "lock_height_difference",
"questionHint": {
"en": "Omit units if designated in meters. Feet and inches maybe indicated with apostrophes and quotation marks."
},
@ -121,7 +167,7 @@
"question": {
"en": "Is this lock automated?"
},
"id": "4_pwnx07go36rzk54",
"id": "automated",
"mappings": [
{
"if": "automated=yes",
@ -147,20 +193,15 @@
},
{
"question": {
"en": "What is the maximum draft of boats using this lock?"
"en": "What is the name of the waterway that this lock is on?"
},
"id": "5_1sz01guflvjeyx7",
"questionHint": {
"en": "Omit units if designated in meters. Feet and inches maybe indicated with apostrophes and quotation marks."
},
"multiAnswer": false,
"id": "lock_waterway_name",
"render": {
"en": "The maximum draft of boats using this lock is {draft}."
"en": "The waterway is name <b>{name}</b>"
},
"freeform": {
"key": "draft"
},
"condition": "waterway!=derelict_canal"
"key": "name"
}
},
{
"question": {
@ -191,40 +232,9 @@
"key": "lock_ref"
}
},
{
"question": {
"en": "What VHF channel should be used to communicate with the control room of this lock?"
},
"id": "vhf",
"render": {
"en": "The VHF channelnis {vhf}"
},
"freeform": {
"key": "vhf"
},
"condition": {
"or": [
"automated=yes",
"automated="
]
}
},
"opening_hours_24_7",
"phone",
{
"question": {
"en": "What is the name of the waterway that this lock is on?"
},
"id": "waterway_name",
"render": {
"en": "The waterway is name <b>{name}</b>"
},
"freeform": {
"key": "name"
}
}
"waterway.access"
],
"allowMove": false,
"credits": "Pieter Vander Vennet",
"credits:uid": 3818858
}
}

View file

@ -6664,7 +6664,7 @@
"render": "Item in MapRoulette"
}
},
"marinas": {
"marina": {
"description": "Marinas and yacht havens for small craft.",
"name": "Marinas",
"presets": {
@ -12565,7 +12565,7 @@
"description": "Waterways which are navigable by small boats, yachts, ...",
"name": "Navigable waterways",
"tagRenderings": {
"3_vyksl7ofya7m97l": {
"boats_allowed": {
"mappings": {
"0": {
"then": "Boats (<20m) are allowed on this waterway"
@ -12577,7 +12577,18 @@
"question": "Are boats allowed on this waterway?",
"questionHint": "A boat is a floating craft of which the hull is less then 20 meter long (without rudder or bowsprit)"
},
"4_yuodfwdyocflwg8": {
"canoes_allowed": {
"mappings": {
"0": {
"then": "Canoes, kayaks and manually powered craft are allowed here"
},
"1": {
"then": "Canoes, kayaks and other manually powered craft are <b>not</b> allowed"
}
},
"question": "Are canoes, kayaks and other small, manually powered craft allowed on this waterway?"
},
"motorboats_allowed": {
"mappings": {
"0": {
"then": "Motorized boats are allowed"
@ -12588,6 +12599,10 @@
},
"question": "Are motorboats allowed on this waterway?"
},
"name": {
"question": "What is the name of this waterway?",
"render": "This waterway is named {name}"
},
"type": {
"mappings": {
"0": {
@ -12623,17 +12638,7 @@
}
},
"tagRenderings": {
"2_qyvwk0kx77jcmh2": {
"question": "What is the maximum length of boats that may use this lock?",
"questionHint": "Omit units if designated in meters. Feet and inches maybe indicated with apostrophes and quotation marks.",
"render": "Boats with a maximum length of {maxlength} may use this lock."
},
"3_sm4v6ow91r2i4kd": {
"question": "How far does this lock raise or lower a boat?",
"questionHint": "Omit units if designated in meters. Feet and inches maybe indicated with apostrophes and quotation marks.",
"render": "This lock has a drop height of {lock:height}"
},
"4_pwnx07go36rzk54": {
"automated": {
"mappings": {
"0": {
"then": "This lock is automated (operated from control panel or control room)"
@ -12644,32 +12649,47 @@
},
"question": "Is this lock automated?"
},
"5_1sz01guflvjeyx7": {
"question": "What is the maximum draft of boats using this lock?",
"lock_height_difference": {
"question": "How far does this lock raise or lower a boat?",
"questionHint": "Omit units if designated in meters. Feet and inches maybe indicated with apostrophes and quotation marks.",
"render": "The maximum draft of boats using this lock is {draft}."
"render": "This lock has a drop height of {lock:height}"
},
"lock_name": {
"question": "What is the name of this lock?",
"questionHint": "The numerical reference code can be added in a follow-up question ",
"render": "This lock is named {lock_name}"
},
"max_length": {
"lock_waterway_name": {
"question": "What is the name of the waterway that this lock is on?",
"render": "The waterway is name <b>{name}</b>"
},
"max_depth": {
"question": "What is the maximum draft of boats using this lock?",
"questionHint": "Omit units if designated in meters. Feet and inches maybe indicated with apostrophes and quotation marks.",
"render": "The maximum draft of boats using this lock is {draft}."
},
"max_width": {
"question": "What is the maximum width (beam) of boats using this lock?",
"questionHint": "Omit units if designated in meters. Feet and inches maybe indicated with apostrophes and quotation marks.",
"render": "This lock permits boats with a maximum width of {maxwidth}"
},
"maxlength": {
"question": "What is the maximum length of boats that may use this lock?",
"questionHint": "Omit units if designated in meters. Feet and inches maybe indicated with apostrophes and quotation marks.",
"render": "Boats with a maximum length of {maxlength} may use this lock."
},
"ref": {
"question": "Does this lock have a reference number/code?",
"render": "This is lock {lock_ref}"
},
"vhf": {
"question": "What VHF channel should be used to communicate with the control room of this lock?",
"render": "The VHF channelnis {vhf}"
"render": "The VHF channel is {vhf}"
},
"waterway_name": {
"question": "What is the name of the waterway that this lock is on?",
"render": "The waterway is name <b>{name}</b>"
"website": {
"override": {
"question": "On what website can one find more information about this lock?"
}
}
},
"title": {

View file

@ -9867,6 +9867,13 @@
"render": "Afvalbak"
}
},
"waterway_lock": {
"tagRenderings": {
"max_depth": {
"question": "Wat is de maximale toegestane diepgang in deze sluis?"
}
}
},
"windturbine": {
"description": "Windturbines (moderne windmolens die elektriciteit genereren)",
"name": "windturbine",

View file

@ -6,7 +6,7 @@ import { Utils } from "../../Utils"
* UIEventsource-wrapper around indexedDB key-value
*/
export class IdbLocalStorage {
private static readonly _sourceCache: Record<string, UIEventSource<any>> = {}
private static readonly _sourceCache: Record<string, UIEventSource<object>> = {}
public static Get<T>(
key: string,
@ -38,11 +38,11 @@ export class IdbLocalStorage {
return src
}
public static SetDirectly(key: string, value: any): Promise<void> {
public static SetDirectly(key: string, value: object): Promise<void> {
return idb.set(key, value)
}
static GetDirectly(key: string): Promise<any> {
static GetDirectly(key: string): Promise<object> {
return idb.get(key)
}

View file

@ -86,7 +86,7 @@ export class MiscTagRenderingChecks extends DesugaringStep<TagRenderingConfigJso
if (json["question"] && json.freeform?.key === undefined && json.mappings === undefined) {
context.err(
"A question is defined, but no mappings nor freeform (key) are. Add at least one of them"
"A question is defined, but no mappings nor freeform (key) are. Add at least one of them. The question is: "+new Translation(json["question"]).textFor("en")
)
}
if (json["question"] && !json.freeform && (json.mappings?.length ?? 0) == 1) {

View file

@ -596,6 +596,11 @@ class DetectInline extends DesugaringStep<QuestionableTagRenderingConfigJson> {
return json
}
if(!json.render){
context.err("'freeform' is set, but render is not")
return json
}
if(!Object.values(json.render).some(render => render !== "{"+json.freeform.key+"}")){
// We only render the current value, without anything more. Not worth inlining
return json