Move hotel to 'tourism_accomodation', include hostels, fix #2070

This commit is contained in:
Pieter Vander Vennet 2024-08-12 23:49:46 +02:00
parent fde4e24abe
commit 8277bd3a1c
34 changed files with 647 additions and 754 deletions

View file

@ -1,68 +0,0 @@
{
"minzoom": 12,
"pointRendering": [
{id":
"location": [
"point",
"centroid"
],
"marker": [
{
"icon": "circle",
"color": "white"
},
{
"icon": "./assets/layers/hostels/hostel.svg"
}
]
}
],
"tagRenderings": [
"images",
"reviews",
{
"id": "name",
"question": {
"en": "What is the name of this hostel?"
},
"render": {
"en": "This hostel is called {name}"
},
"freeform": {
"key": "name"
}
},
{
"builtin": "brand",
"override": {
"question": {
"en": "Is this hostel part of a bigger brand?"
}
}
},
"contact",
"internet-all",
"dog-access"
],
"lineRendering": [
{
"width": 1,
"color": "blue"
}
],
"name": {
"en": "Hostels"
},
"id": "hostel",
"description": {
"en": "A hostel is a type of tourist accomodation where people can sleep in a room shared with strangers"
},
"source": {
"osmTags": "tourism=hostel"
},
"title": {
"render": {
"en": "Hostel {name}"
}
}
}

View file

@ -1,109 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
id="svg2"
viewBox="0 0 16 16"
height="16"
width="16"
version="1.1"
sodipodi:docname="hostel.svg"
inkscape:version="0.92.2 5c3e80d, 2017-08-06">
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1242"
inkscape:window-height="733"
id="namedview4592"
showgrid="false"
inkscape:zoom="16.857143"
inkscape:cx="7"
inkscape:cy="4.6271186"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="svg2" />
<metadata
id="metadata8">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs6" />
<rect
style="visibility:hidden;fill:none;stroke:none;stroke-width:1.14285719"
id="canvas"
y="2.3841858e-07"
x="8.5149496e-09"
height="16"
width="16" />
<path
id="hostel"
d="m 4,1.1428573 c -0.9467737,0 -1.7142857,0.7675121 -1.7142857,1.7142858 0,0.9467736 0.767512,1.7142856 1.7142857,1.7142856 0.9467737,0 1.7142857,-0.767512 1.7142857,-1.7142856 C 5.7142857,1.9103694 4.9467737,1.1428573 4,1.1428573 Z m 2.8571428,1.1428572 v 2.2857142 h 6.8571432 c 0,-1.1428571 -1.1842,-2.2857142 -2.285714,-2.2857142 z M 4,8.0000001 c -0.9467737,0 -1.7142857,0.767512 -1.7142857,1.7142857 0,0.9467742 0.767512,1.7142852 1.7142857,1.7142852 0.9467737,0 1.7142857,-0.767511 1.7142857,-1.7142852 C 5.7142857,8.7675121 4.9467737,8.0000001 4,8.0000001 Z m 2.8571428,1.1428571 v 2.2857138 l 6.8571432,0.01473 c 0,-1.157577 -1.1842,-2.3004346 -2.285714,-2.3004346 z"
style="fill:#0092da;stroke-width:1.14285719"
inkscape:connector-curvature="0" />
<rect
y="1.1428573"
x="8.5149496e-09"
height="14.857142"
width="1.1428571"
id="rect814"
style="opacity:1;fill:#0092da;fill-opacity:1;stroke:none;stroke-width:0.13977952;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill" />
<rect
ry="0.5714286"
y="2.3841858e-07"
x="-5.9604645e-08"
height="14.857142"
width="1.1428571"
id="rect814-7"
style="opacity:1;fill:#0092da;fill-opacity:1;stroke:none;stroke-width:0.13977952;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill" />
<rect
y="4.5714283"
x="14.857142"
height="11.428571"
width="1.1428571"
id="rect814-3"
style="opacity:1;fill:#0092da;fill-opacity:1;stroke:none;stroke-width:0.12259473;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill" />
<rect
ry="0.5714286"
y="2.2857144"
x="14.857142"
height="13.714286"
width="1.1428571"
id="rect814-7-2"
style="opacity:1;fill:#0092da;fill-opacity:1;stroke:none;stroke-width:0.13429582;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill" />
<rect
transform="rotate(90)"
y="-14.857142"
x="5.7142859"
height="14.857142"
width="1.1428572"
id="rect814-2"
style="opacity:1;fill:#0092da;fill-opacity:1;stroke:none;stroke-width:0.13977952;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill" />
<rect
transform="rotate(90)"
y="-14.857142"
x="12.571429"
height="14.857142"
width="1.1428572"
id="rect814-2-7"
style="opacity:1;fill:#0092da;fill-opacity:1;stroke:none;stroke-width:0.13977952;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill" />
</svg>

Before

Width:  |  Height:  |  Size: 4.4 KiB

View file

@ -1,2 +0,0 @@
SPDX-FileCopyrightText: OSM-Carto
SPDX-License-Identifier: CC0-1.0

View file

@ -1,12 +0,0 @@
[
{
"path": "hostel.svg",
"license": "CC0-1.0",
"authors": [
"OSM-Carto"
],
"sources": [
"https://wiki.openstreetmap.org/wiki/File:Hostel-16.svg"
]
}
]

View file

@ -1,145 +0,0 @@
{
"id": "hotel",
"name": {
"en": "Hotels",
"nl": "Hotels",
"de": "Hotels",
"pa_PK": "ہوٹل",
"ru": "Гостиницы",
"fr": "Hôtels",
"ca": "Hotels",
"cs": "Hotely",
"pl": "Hotele"
},
"description": {
"en": "Layer showing all hotels",
"nl": "Laag die alle hotels toont",
"de": "Eine Ebene mit Hotels",
"fr": "Couche affichant les hôtels",
"ca": "Capa que mostra tots els hotels",
"cs": "Vrstva zobrazující všechny hotely",
"pl": "Warstwa pokazująca wszystkie hotele"
},
"source": {
"osmTags": "tourism=hotel"
},
"minzoom": 13,
"title": {
"render": {
"en": "Hotel",
"nl": "Hotel",
"de": "Hotel",
"pa_PK": "ہوٹل",
"fr": "Hôtel",
"ca": "Hotel",
"cs": "Hotel",
"pl": "Hotel"
},
"mappings": [
{
"if": "name~*",
"then": {
"en": "Hotel {name}",
"nl": "Hotel {name}",
"de": "Hotel {name}",
"fr": "Hôtel {name}",
"ca": "Hotel {name}",
"cs": "Hotel {name}",
"pl": "Hotel {name}"
}
}
]
},
"pointRendering": [
{
"location": [
"point",
"centroid"
],
"iconSize": "40,40",
"anchor": "center",
"marker": [
{
"icon": "circle",
"color": "white"
},
{
"icon": "./assets/layers/hotel/hotel.svg"
}
]
}
],
"lineRendering": [],
"presets": [
{
"title": {
"en": "a hotel",
"nl": "een hotel",
"de": "ein Hotel",
"ca": "un hotel",
"ru": "гостиница",
"fr": "un hôtel",
"cs": "hotel",
"pl": "hotel"
},
"tags": [
"tourism=hotel"
]
}
],
"tagRenderings": [
"images",
"reviews",
{
"id": "name",
"freeform": {
"key": "name",
"placeholder": {
"en": "Name of the hotel",
"nl": "Naam van het hotel",
"de": "Name des Hotels",
"ru": "Название гостиницы",
"fr": "Nom de l'hôtel",
"ca": "Nom de l'hotel",
"cs": "Název hotelu",
"pl": "Nazwa hotelu"
}
},
"question": {
"en": "What is the name of this hotel?",
"nl": "Wat is de naam van dit hotel?",
"de": "Wie lautet der Name des Hotels?",
"ru": "Как называется эта гостиница?",
"fr": "Quel est le nom de cet hôtel ?",
"ca": "Quin és el nom d'aquest hotel?",
"cs": "Jak se tento hotel jmenuje?",
"pl": "Jak nazywa się ten hotel?"
},
"render": {
"en": "This hotel is called {name}",
"nl": "Dit hotel heet {name}",
"de": "Der Name des Hotels lautet {name}",
"ca": "Aquest hotel es diu {name}",
"fr": "Cet hôtel s'appelle {name}",
"cs": "Tento hotel se jmenuje {name}",
"pl": "Nazwa tego hotelu to {name}"
}
},
{
"builtin": "brand",
"override": {
"question": {
"en": "Is this hotel part of a bigger brand?"
}
}
},
"contact",
"wheelchair-access",
"internet-all",
"dog-access"
],
"allowMove": {
"enableImproveAccuracy": true,
"enableRelocation": true
}
}

View file

@ -1,45 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="500"
height="500"
viewBox="0 0 500 500"
version="1.1"
id="svg4"
sodipodi:docname="hotel.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="defs8" />
<sodipodi:namedview
id="namedview6"
pagecolor="#ffffff"
bordercolor="#111111"
borderopacity="1"
inkscape:pageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="1"
showgrid="false"
showguides="true"
inkscape:guide-bbox="true"
inkscape:zoom="0.5912918"
inkscape:cx="43.125915"
inkscape:cy="341.6249"
inkscape:window-width="1920"
inkscape:window-height="1007"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg4">
<sodipodi:guide
position="-213.39489,250.02313"
orientation="0,-1"
id="guide827" />
</sodipodi:namedview>
<path
d="m 20.793355,103.8662 c -9.838754,0 -17.7594848,7.92073 -17.7594848,17.75948 v 17.75948 142.07589 35.51898 17.75949 53.27845 H 38.552842 V 334.73952 316.98003 H 464.78049 v 53.27845 17.75949 h 17.7595 17.75948 v -17.75949 -53.27845 -35.51898 -71.03793 -17.75949 c 0,-9.83876 -7.92073,-17.75949 -17.75948,-17.75949 -9.83876,0 -17.7595,7.92073 -17.7595,17.75949 v 17.75949 71.03793 H 38.552842 V 139.38516 121.62568 c 0,-9.83875 -7.920731,-17.75948 -17.759487,-17.75948 z m 106.556915,35.51896 c -29.424876,0 -53.278458,23.85359 -53.278458,53.27847 0,29.42487 23.853582,53.27845 53.278458,53.27845 29.42487,0 53.27845,-23.85358 53.27845,-53.27845 0,-29.42488 -23.85358,-53.27847 -53.27845,-53.27847 z m 88.79743,35.51898 v 71.03794 h 213.11382 c 0,-35.51896 -36.80387,-71.03794 -71.03793,-71.03794 z"
id="path2"
style="stroke-width:35.519" />
</svg>

Before

Width:  |  Height:  |  Size: 2 KiB

View file

@ -1,2 +0,0 @@
SPDX-FileCopyrightText: Andy Allan; Michael Glanznig; Adamant36; Paul Dicker
SPDX-License-Identifier: CC0-1.0

View file

@ -1,15 +0,0 @@
[
{
"path": "hotel.svg",
"license": "CC0-1.0",
"authors": [
"Andy Allan",
"Michael Glanznig",
"Adamant36",
"Paul Dicker"
],
"sources": [
"https://github.com/gravitystorm/openstreetmap-carto/blob/master/symbols/tourism/hotel.svg"
]
}
]

View file

@ -42,7 +42,7 @@
], ],
"marker": [ "marker": [
{ {
"icon": "./assets/layers/hotel/hotel.svg" "icon": "./assets/layers/tourism_accomodation/hotel.svg"
} }
], ],
"iconSize": "27,27" "iconSize": "27,27"

View file

@ -2906,14 +2906,16 @@
{ {
"id": "brand", "id": "brand",
"question": { "question": {
"en": "Is this part of a bigger brand?" "en": "Is {title()} part of a bigger brand?"
}, },
"render": { "render": {
"en": "Part of {brand}" "en": "Part of {brand}"
}, },
"freeform": { "freeform": {
"key": "brand", "key": "brand",
"addExtraTags": ["nobrand="] "addExtraTags": [
"nobrand="
]
}, },
"mappings": [ "mappings": [
{ {

View file

@ -0,0 +1,130 @@
{
"minzoom": 12,
"pointRendering": [
{
"location": [
"point",
"centroid"
],
"marker": [
{
"icon": "circle",
"color": "white"
},
{
"icon": {
"mappings": [
{
"if": "tourism=hostel",
"then": "./assets/layers/tourism_accomodation/hostel.svg"
},
{
"if": "tourism=hotel",
"then": "./assets/layers/tourism_accomodation/hotel.svg"
}
],
"render": "./assets/layers/tourism_accomodation/hostel.svg"
}
}
]
}
],
"tagRenderings": [
"images",
"reviews",
{
"id": "name",
"question": {
"en": "What is the name of this {title()}?"
},
"render": {
"en": "{name}"
},
"freeform": {
"key": "name"
}
},
"{preset_type_select()}",
"brand",
"contact",
"wheelchair-access",
"internet-all",
"dog-access"
],
"lineRendering": [
{
"width": 1,
"color": "blue"
}
],
"name": {
"en": "Tourism accomodation"
},
"id": "tourism_accomodation",
"description": {},
"presets": [
{
"title": {
"en": "a hotel",
"nl": "een hotel",
"de": "ein Hotel",
"ca": "un hotel",
"ru": "гостиница",
"fr": "un hôtel",
"cs": "hotel",
"pl": "hotel"
},
"description": {
"en": "A hotel is an establishment that provides paid lodging, usually on a short-term basis. Rooms are not shared with strangers."
},
"tags": [
"tourism=hotel"
]
},
{
"tags": [
"tourism=hostel"
],
"title": {
"en": "a hostel"
},
"description": {
"en": "A hostel is a type of tourist accommodation where people can sleep in a room shared with strangers"
}
}
],
"source": {
"osmTags": {
"or": [
"tourism=hostel",
"tourism=hotel"
]
}
},
"title": {
"mappings": [
{
"if": "tourism=hotel",
"then": {
"en": "Hotel {name}",
"nl": "Hotel {name}",
"de": "Hotel {name}",
"fr": "Hôtel {name}",
"ca": "Hotel {name}",
"cs": "Hotel {name}",
"pl": "Hotel {name}"
}
},
{
"if": "tourism=hostel",
"then": {
"en": "Hostel {name}"
}
}
],
"render": {
"en": "Tourist accomodation {name}"
}
},
"allowMove": true
}

View file

@ -45,7 +45,9 @@
}, },
{ {
"id": "profile-title", "id": "profile-title",
"labels": ["hidden"], "labels": [
"hidden"
],
"icon": "user_circle", "icon": "user_circle",
"render": { "render": {
"*": "<h3>{_name}</h3>" "*": "<h3>{_name}</h3>"
@ -63,7 +65,8 @@
{ {
"id": "profile-description", "id": "profile-description",
"labels": [ "labels": [
"profile-content","hidden" "profile-content",
"hidden"
], ],
"render": { "render": {
"*": "{_description_html}" "*": "{_description_html}"
@ -71,7 +74,6 @@
"mappings": [ "mappings": [
{ {
"if": "_description=", "if": "_description=",
"then": { "then": {
"special": { "special": {
"type": "link", "type": "link",
@ -98,7 +100,8 @@
{ {
"id": "edit-profile", "id": "edit-profile",
"labels": [ "labels": [
"profile-content","hidden" "profile-content",
"hidden"
], ],
"condition": "_description!=", "condition": "_description!=",
"render": { "render": {
@ -126,7 +129,8 @@
{ {
"id": "verified-mastodon", "id": "verified-mastodon",
"labels": [ "labels": [
"profile-content","hidden" "profile-content",
"hidden"
], ],
"mappings": [ "mappings": [
{ {
@ -157,7 +161,8 @@
{ {
"id": "cscount-thanks", "id": "cscount-thanks",
"labels": [ "labels": [
"profile-content","hidden" "profile-content",
"hidden"
], ],
"mappings": [ "mappings": [
{ {
@ -180,7 +185,8 @@
{ {
"id": "translation-thanks", "id": "translation-thanks",
"labels": [ "labels": [
"profile-content","hidden" "profile-content",
"hidden"
], ],
"mappings": [ "mappings": [
{ {
@ -197,7 +203,8 @@
{ {
"id": "contributor-thanks", "id": "contributor-thanks",
"labels": [ "labels": [
"profile-content","hidden" "profile-content",
"hidden"
], ],
"mappings": [ "mappings": [
{ {

View file

@ -29,13 +29,12 @@
"pl": "Na tej mapie znajdziesz hotele w Twojej okolicy", "pl": "Na tej mapie znajdziesz hotele w Twojej okolicy",
"it": "Su questa mappa, troverai gli hotel della tua zona" "it": "Su questa mappa, troverai gli hotel della tua zona"
}, },
"icon": "./assets/layers/hotel/hotel.svg", "icon": "./assets/layers/tourism_accomodation/hotel.svg",
"startZoom": 13, "startZoom": 13,
"startLat": 50.8552, "startLat": 50.8552,
"startLon": 4.3755, "startLon": 4.3755,
"layers": [ "layers": [
"hotel", "tourism_accomodation",
"hostel",
{ {
"builtin": [ "builtin": [
"love_hotel" "love_hotel"

View file

@ -291,7 +291,7 @@
}, },
{ {
"if": "theme=hotels", "if": "theme=hotels",
"then": "./assets/layers/hotel/hotel.svg" "then": "./assets/layers/tourism_accomodation/hotel.svg"
}, },
{ {
"if": "theme=icecream", "if": "theme=icecream",
@ -317,10 +317,6 @@
"if": "theme=lighthouses", "if": "theme=lighthouses",
"then": "./assets/themes/lighthouses/lighthouse.svg" "then": "./assets/themes/lighthouses/lighthouse.svg"
}, },
{
"if": "theme=mapcomplete-changes",
"then": "./assets/svg/logo.svg"
},
{ {
"if": "theme=maproulette", "if": "theme=maproulette",
"then": "./assets/layers/maproulette/logomark.svg" "then": "./assets/layers/maproulette/logomark.svg"

View file

@ -422,7 +422,7 @@
} }
}, },
{ {
"builtin": "hotel", "builtin": "tourism_accomodation",
"override": { "override": {
"minzoom": 15, "minzoom": 15,
"shownByDefault": false, "shownByDefault": false,
@ -505,7 +505,7 @@
"geoJson": "https://maproulette.org/api/v2/challenge/view/28012" "geoJson": "https://maproulette.org/api/v2/challenge/view/28012"
}, },
"calculatedTags": [ "calculatedTags": [
"_closest_osm_hotel=closest(feat)('hotel')?.properties?.id", "_closest_osm_hotel=closest(feat)('tourism_accomodation')?.properties?.id",
"_closest_osm_hotel_distance=distanceTo(feat)(feat.properties._closest_osm_hotel)", "_closest_osm_hotel_distance=distanceTo(feat)(feat.properties._closest_osm_hotel)",
"_has_closeby_feature=Number(feat.properties._closest_osm_hotel_distance) < 50 ? 'yes' : 'no'" "_has_closeby_feature=Number(feat.properties._closest_osm_hotel_distance) < 50 ? 'yes' : 'no'"
], ],
@ -516,7 +516,7 @@
"render": { "render": {
"special": { "special": {
"type": "import_button", "type": "import_button",
"targetLayer": "hotel", "targetLayer": "tourism_accomodation",
"tags": "tags", "tags": "tags",
"text": { "text": {
"en": "Import", "en": "Import",

View file

@ -261,7 +261,7 @@
}, },
"love_hotel", "love_hotel",
{ {
"builtin": "hotel", "builtin": "tourism_accomodation",
"override": { "override": {
"minzoom": 17, "minzoom": 17,
"+tagRenderings": [ "+tagRenderings": [

View file

@ -699,6 +699,11 @@
"takeImages": "Take images of the tree to automatically detect the tree type", "takeImages": "Take images of the tree to automatically detect the tree type",
"tryAgain": "Select a different species" "tryAgain": "Select a different species"
}, },
"preset_type": {
"question": "Of what type is this object?",
"typeDescription": "This is a {title}. {description}",
"typeTitle": "This is a {title}"
},
"privacy": { "privacy": {
"editingIntro": "When you make a change to the map, this change is recorded on OpenStreetMap and is publicly available to anyone. A changeset made with MapComplete includes the following data:", "editingIntro": "When you make a change to the map, this change is recorded on OpenStreetMap and is publicly available to anyone. A changeset made with MapComplete includes the following data:",
"editingOutro": "Please refer to <a href='https://wiki.osmfoundation.org/wiki/Privacy_Policy' target='_blank'>the privacy policy on OpenStreetMap.org</a> for detailed information. We'd like to remind you that you can use a fictional name when signing up.", "editingOutro": "Please refer to <a href='https://wiki.osmfoundation.org/wiki/Privacy_Policy' target='_blank'>the privacy policy on OpenStreetMap.org</a> for detailed information. We'd like to remind you that you can use a fictional name when signing up.",

View file

@ -4162,32 +4162,6 @@
"render": "Hospital" "render": "Hospital"
} }
}, },
"hotel": {
"description": "Capa que mostra tots els hotels",
"name": "Hotels",
"presets": {
"0": {
"title": "un hotel"
}
},
"tagRenderings": {
"name": {
"freeform": {
"placeholder": "Nom de l'hotel"
},
"question": "Quin és el nom d'aquest hotel?",
"render": "Aquest hotel es diu {name}"
}
},
"title": {
"mappings": {
"0": {
"then": "Hotel {name}"
}
},
"render": "Hotel"
}
},
"hydrant": { "hydrant": {
"description": "Una capa que mostra hidrants.", "description": "Una capa que mostra hidrants.",
"name": "Mapa d'hidrants", "name": "Mapa d'hidrants",
@ -7972,6 +7946,20 @@
"render": "Lavabo a la instal·lació" "render": "Lavabo a la instal·lació"
} }
}, },
"tourism_accomodation": {
"presets": {
"0": {
"title": "un hotel"
}
},
"title": {
"mappings": {
"0": {
"then": "Hotel {name}"
}
}
}
},
"trail": { "trail": {
"description": "Rutes marcades", "description": "Rutes marcades",
"name": "Camins", "name": "Camins",
@ -8468,6 +8456,13 @@
} }
} }
}, },
"edit-profile": {
"render": {
"special": {
"text": "Editeu la descripció del vostre perfil"
}
}
},
"fixate-north": { "fixate-north": {
"mappings": { "mappings": {
"0": { "0": {
@ -8529,6 +8524,17 @@
}, },
"question": "Sota quina llicència vols publicar les teves fotos?" "question": "Sota quina llicència vols publicar les teves fotos?"
}, },
"profile-description": {
"mappings": {
"0": {
"then": {
"special": {
"text": "Afegeix una descripció del perfil"
}
}
}
}
},
"settings-link": { "settings-link": {
"render": { "render": {
"special": { "special": {

View file

@ -4301,32 +4301,6 @@
"render": "Nemocnice" "render": "Nemocnice"
} }
}, },
"hotel": {
"description": "Vrstva zobrazující všechny hotely",
"name": "Hotely",
"presets": {
"0": {
"title": "hotel"
}
},
"tagRenderings": {
"name": {
"freeform": {
"placeholder": "Název hotelu"
},
"question": "Jak se tento hotel jmenuje?",
"render": "Tento hotel se jmenuje {name}"
}
},
"title": {
"mappings": {
"0": {
"then": "Hotel {name}"
}
},
"render": "Hotel"
}
},
"hydrant": { "hydrant": {
"description": "Mapová vrstva zobrazující požární hydranty.", "description": "Mapová vrstva zobrazující požární hydranty.",
"name": "Mapa hydrantů", "name": "Mapa hydrantů",
@ -8272,6 +8246,20 @@
"render": "Toaleta v objektu" "render": "Toaleta v objektu"
} }
}, },
"tourism_accomodation": {
"presets": {
"0": {
"title": "hotel"
}
},
"title": {
"mappings": {
"0": {
"then": "Hotel {name}"
}
}
}
},
"trail": { "trail": {
"name": "Stezky", "name": "Stezky",
"tagRenderings": { "tagRenderings": {
@ -8723,6 +8711,13 @@
} }
} }
}, },
"edit-profile": {
"render": {
"special": {
"text": "Úprava popisu vašeho profilu"
}
}
},
"fixate-north": { "fixate-north": {
"mappings": { "mappings": {
"0": { "0": {
@ -8784,6 +8779,17 @@
}, },
"question": "Pod jakou licencí chcete své fotografie zveřejnit?" "question": "Pod jakou licencí chcete své fotografie zveřejnit?"
}, },
"profile-description": {
"mappings": {
"0": {
"then": {
"special": {
"text": "Přidat popis profilu"
}
}
}
}
},
"settings-link": { "settings-link": {
"render": { "render": {
"special": { "special": {

View file

@ -2485,6 +2485,13 @@
} }
} }
}, },
"edit-profile": {
"render": {
"special": {
"text": "Ret din profilbeskrivelse"
}
}
},
"fixate-north": { "fixate-north": {
"mappings": { "mappings": {
"0": { "0": {

View file

@ -5497,32 +5497,6 @@
"render": "Krankenhaus" "render": "Krankenhaus"
} }
}, },
"hotel": {
"description": "Eine Ebene mit Hotels",
"name": "Hotels",
"presets": {
"0": {
"title": "ein Hotel"
}
},
"tagRenderings": {
"name": {
"freeform": {
"placeholder": "Name des Hotels"
},
"question": "Wie lautet der Name des Hotels?",
"render": "Der Name des Hotels lautet {name}"
}
},
"title": {
"mappings": {
"0": {
"then": "Hotel {name}"
}
},
"render": "Hotel"
}
},
"hydrant": { "hydrant": {
"description": "Kartenebene zur Anzeige von Hydranten.", "description": "Kartenebene zur Anzeige von Hydranten.",
"name": "Hydranten", "name": "Hydranten",
@ -10492,6 +10466,20 @@
"render": "Werkzeugbibliothek {name}" "render": "Werkzeugbibliothek {name}"
} }
}, },
"tourism_accomodation": {
"presets": {
"0": {
"title": "ein Hotel"
}
},
"title": {
"mappings": {
"0": {
"then": "Hotel {name}"
}
}
}
},
"trail": { "trail": {
"description": "Markierte Wanderwege", "description": "Markierte Wanderwege",
"name": "Wanderwege", "name": "Wanderwege",
@ -11119,6 +11107,13 @@
} }
} }
}, },
"edit-profile": {
"render": {
"special": {
"text": "Eigene Profilbeschreibung bearbeiten"
}
}
},
"fixate-north": { "fixate-north": {
"mappings": { "mappings": {
"0": { "0": {
@ -11207,6 +11202,17 @@
}, },
"question": "Unter welcher Lizenz möchten Sie Ihre Bilder veröffentlichen?" "question": "Unter welcher Lizenz möchten Sie Ihre Bilder veröffentlichen?"
}, },
"profile-description": {
"mappings": {
"0": {
"then": {
"special": {
"text": "Profilbeschreibung hinzufügen"
}
}
}
}
},
"settings-link": { "settings-link": {
"render": { "render": {
"special": { "special": {

View file

@ -5534,32 +5534,6 @@
"render": "Hospital" "render": "Hospital"
} }
}, },
"hotel": {
"description": "Layer showing all hotels",
"name": "Hotels",
"presets": {
"0": {
"title": "a hotel"
}
},
"tagRenderings": {
"name": {
"freeform": {
"placeholder": "Name of the hotel"
},
"question": "What is the name of this hotel?",
"render": "This hotel is called {name}"
}
},
"title": {
"mappings": {
"0": {
"then": "Hotel {name}"
}
},
"render": "Hotel"
}
},
"hydrant": { "hydrant": {
"description": "Map layer to show fire hydrants.", "description": "Map layer to show fire hydrants.",
"name": "Map of hydrants", "name": "Map of hydrants",
@ -7788,6 +7762,15 @@
}, },
"questions": { "questions": {
"tagRenderings": { "tagRenderings": {
"brand": {
"mappings": {
"0": {
"then": "Not part of a bigger brand"
}
},
"question": "Is {title()} part of a bigger brand?",
"render": "Part of {brand}"
},
"check_date": { "check_date": {
"mappings": { "mappings": {
"0": { "0": {
@ -10532,6 +10515,35 @@
"render": "Tool library {name}" "render": "Tool library {name}"
} }
}, },
"tourism_accomodation": {
"name": "Tourism accomodation",
"presets": {
"0": {
"title": "a hotel"
},
"1": {
"description": "A hostel is a type of tourist accommodation where people can sleep in a room shared with strangers",
"title": "a hostel"
}
},
"tagRenderings": {
"name": {
"question": "What is the name of this {title()}?",
"render": "{name}"
}
},
"title": {
"mappings": {
"0": {
"then": "Hotel {name}"
},
"1": {
"then": "Hostel {name}"
}
},
"render": "Tourist accomodation {name}"
}
},
"trail": { "trail": {
"description": "Waymarked trails", "description": "Waymarked trails",
"name": "Trails", "name": "Trails",
@ -11170,6 +11182,13 @@
"debug-title": { "debug-title": {
"render": "<h3>Debugging options</h3>" "render": "<h3>Debugging options</h3>"
}, },
"edit-profile": {
"render": {
"special": {
"text": "Edit your profile description"
}
}
},
"fixate-north": { "fixate-north": {
"mappings": { "mappings": {
"0": { "0": {
@ -11258,6 +11277,17 @@
}, },
"question": "Under what license do you want to publish your pictures?" "question": "Under what license do you want to publish your pictures?"
}, },
"profile-description": {
"mappings": {
"0": {
"then": {
"special": {
"text": "Add a profile description"
}
}
}
}
},
"settings-link": { "settings-link": {
"render": { "render": {
"special": { "special": {

View file

@ -122,6 +122,26 @@
} }
}, },
"usersettings": { "usersettings": {
"tagRenderings": {
"edit-profile": {
"render": {
"special": {
"text": "Muokkaa profiilin kuvausta"
}
}
},
"profile-description": {
"mappings": {
"0": {
"then": {
"special": {
"text": "Lisää profiilin kuvaus"
}
}
}
}
}
},
"title": { "title": {
"render": "Asetukset" "render": "Asetukset"
} }

View file

@ -3676,32 +3676,6 @@
} }
} }
}, },
"hotel": {
"description": "Couche affichant les hôtels",
"name": "Hôtels",
"presets": {
"0": {
"title": "un hôtel"
}
},
"tagRenderings": {
"name": {
"freeform": {
"placeholder": "Nom de l'hôtel"
},
"question": "Quel est le nom de cet hôtel ?",
"render": "Cet hôtel s'appelle {name}"
}
},
"title": {
"mappings": {
"0": {
"then": "Hôtel {name}"
}
},
"render": "Hôtel"
}
},
"hydrant": { "hydrant": {
"description": "Couche des bornes incendie.", "description": "Couche des bornes incendie.",
"name": "Carte des bornes incendie", "name": "Carte des bornes incendie",
@ -6524,6 +6498,20 @@
} }
} }
}, },
"tourism_accomodation": {
"presets": {
"0": {
"title": "un hôtel"
}
},
"title": {
"mappings": {
"0": {
"then": "Hôtel {name}"
}
}
}
},
"trail": { "trail": {
"name": "Sentiers", "name": "Sentiers",
"tagRenderings": { "tagRenderings": {
@ -6925,6 +6913,13 @@
} }
} }
}, },
"edit-profile": {
"render": {
"special": {
"text": "Modifier ton profil"
}
}
},
"fixate-north": { "fixate-north": {
"mappings": { "mappings": {
"0": { "0": {

View file

@ -842,6 +842,17 @@
}, },
"usersettings": { "usersettings": {
"tagRenderings": { "tagRenderings": {
"profile-description": {
"mappings": {
"0": {
"then": {
"special": {
"text": "Legg til profilbeskrivelse"
}
}
}
}
},
"translation-completeness": { "translation-completeness": {
"render": "Oversettelsen for {_theme} i {_language} har {_translation_percentage}% dekning: {_translation_translated_count} strenger av {_translation_total} har blitt oversatt" "render": "Oversettelsen for {_theme} i {_language} har {_translation_percentage}% dekning: {_translation_translated_count} strenger av {_translation_total} har blitt oversatt"
} }

View file

@ -4542,32 +4542,6 @@
"render": "Ziekenhuis" "render": "Ziekenhuis"
} }
}, },
"hotel": {
"description": "Laag die alle hotels toont",
"name": "Hotels",
"presets": {
"0": {
"title": "een hotel"
}
},
"tagRenderings": {
"name": {
"freeform": {
"placeholder": "Naam van het hotel"
},
"question": "Wat is de naam van dit hotel?",
"render": "Dit hotel heet {name}"
}
},
"title": {
"mappings": {
"0": {
"then": "Hotel {name}"
}
},
"render": "Hotel"
}
},
"hydrant": { "hydrant": {
"description": "Kaartlaag met brandkranen.", "description": "Kaartlaag met brandkranen.",
"name": "Kaart van brandkranen", "name": "Kaart van brandkranen",
@ -8367,6 +8341,20 @@
"render": "Toilet in een voorziening" "render": "Toilet in een voorziening"
} }
}, },
"tourism_accomodation": {
"presets": {
"0": {
"title": "een hotel"
}
},
"title": {
"mappings": {
"0": {
"then": "Hotel {name}"
}
}
}
},
"trail": { "trail": {
"description": "Aangeduide wandeltochten", "description": "Aangeduide wandeltochten",
"name": "Wandeltochten", "name": "Wandeltochten",
@ -8871,6 +8859,13 @@
} }
} }
}, },
"edit-profile": {
"render": {
"special": {
"text": "Pas je profielbeschrijving aan"
}
}
},
"fixate-north": { "fixate-north": {
"mappings": { "mappings": {
"0": { "0": {
@ -8959,6 +8954,17 @@
}, },
"question": "Met welke licentie wil je je afbeeldingen toevoegen?" "question": "Met welke licentie wil je je afbeeldingen toevoegen?"
}, },
"profile-description": {
"mappings": {
"0": {
"then": {
"special": {
"text": "Voeg een profielbeschrijving toe"
}
}
}
}
},
"settings-link": { "settings-link": {
"render": { "render": {
"special": { "special": {

View file

@ -135,12 +135,6 @@
"render": "ہسپتال" "render": "ہسپتال"
} }
}, },
"hotel": {
"name": "ہوٹل",
"title": {
"render": "ہوٹل"
}
},
"hydrant": { "hydrant": {
"title": { "title": {
"render": "ہائڈرنٹ" "render": "ہائڈرنٹ"

View file

@ -1875,32 +1875,6 @@
"render": "Szpital" "render": "Szpital"
} }
}, },
"hotel": {
"description": "Warstwa pokazująca wszystkie hotele",
"name": "Hotele",
"presets": {
"0": {
"title": "hotel"
}
},
"tagRenderings": {
"name": {
"freeform": {
"placeholder": "Nazwa hotelu"
},
"question": "Jak nazywa się ten hotel?",
"render": "Nazwa tego hotelu to {name}"
}
},
"title": {
"mappings": {
"0": {
"then": "Hotel {name}"
}
},
"render": "Hotel"
}
},
"hydrant": { "hydrant": {
"description": "Warstwa mapy pokazująca hydranty.", "description": "Warstwa mapy pokazująca hydranty.",
"name": "Mapa hydrantów", "name": "Mapa hydrantów",
@ -3304,6 +3278,20 @@
} }
} }
}, },
"tourism_accomodation": {
"presets": {
"0": {
"title": "hotel"
}
},
"title": {
"mappings": {
"0": {
"then": "Hotel {name}"
}
}
}
},
"trolley_bay": { "trolley_bay": {
"tagRenderings": { "tagRenderings": {
"denominations": { "denominations": {
@ -3338,6 +3326,28 @@
} }
} }
}, },
"usersettings": {
"tagRenderings": {
"edit-profile": {
"render": {
"special": {
"text": "Edytuj opis swojego profilu"
}
}
},
"profile-description": {
"mappings": {
"0": {
"then": {
"special": {
"text": "Dodaj opis profilu"
}
}
}
}
}
}
},
"walls_and_buildings": { "walls_and_buildings": {
"description": "Specjalna warstwa zabudowana zapewniająca wszystkie mury i budynki. Warstwa ta jest przydatna w ustawieniach wstępnych obiektów, które można umieścić przy ścianach (np. AED, skrzynki pocztowe, wejścia, adresy, kamery monitorujące itp.). Warstwa ta jest domyślnie niewidoczna i użytkownik nie może jej przełączać." "description": "Specjalna warstwa zabudowana zapewniająca wszystkie mury i budynki. Warstwa ta jest przydatna w ustawieniach wstępnych obiektów, które można umieścić przy ścianach (np. AED, skrzynki pocztowe, wejścia, adresy, kamery monitorujące itp.). Warstwa ta jest domyślnie niewidoczna i użytkownik nie może jej przełączać."
}, },

View file

@ -1768,6 +1768,13 @@
} }
} }
}, },
"edit-profile": {
"render": {
"special": {
"text": "Editar a descrição do seu perfil"
}
}
},
"picture-license": { "picture-license": {
"mappings": { "mappings": {
"0": { "0": {
@ -1785,6 +1792,17 @@
}, },
"question": "Sob que licença você deseja publicar suas fotos?" "question": "Sob que licença você deseja publicar suas fotos?"
}, },
"profile-description": {
"mappings": {
"0": {
"then": {
"special": {
"text": "Adicionar uma descrição do perfil"
}
}
}
}
},
"show_debug": { "show_debug": {
"mappings": { "mappings": {
"0": { "0": {

View file

@ -906,22 +906,6 @@
"render": "Больница" "render": "Больница"
} }
}, },
"hotel": {
"name": "Гостиницы",
"presets": {
"0": {
"title": "гостиница"
}
},
"tagRenderings": {
"name": {
"freeform": {
"placeholder": "Название гостиницы"
},
"question": "Как называется эта гостиница?"
}
}
},
"hydrant": { "hydrant": {
"description": "Слой карты, отображающий пожарные гидранты.", "description": "Слой карты, отображающий пожарные гидранты.",
"name": "Карта пожарных гидрантов", "name": "Карта пожарных гидрантов",
@ -1790,6 +1774,13 @@
} }
} }
}, },
"tourism_accomodation": {
"presets": {
"0": {
"title": "гостиница"
}
}
},
"trail": { "trail": {
"name": "Тропы", "name": "Тропы",
"title": { "title": {

View file

@ -782,6 +782,24 @@
}, },
"usersettings": { "usersettings": {
"tagRenderings": { "tagRenderings": {
"edit-profile": {
"render": {
"special": {
"text": "編輯你的個人檔敘述"
}
}
},
"profile-description": {
"mappings": {
"0": {
"then": {
"special": {
"text": "新增個人檔敘述"
}
}
}
}
},
"translation-completeness": { "translation-completeness": {
"render": "{_theme} 的 {_language} 翻譯目前是 {_translation_percentage}%{_translation_total} 中的 {_translation_translated_count} 已經翻譯了" "render": "{_theme} 的 {_language} 翻譯目前是 {_translation_percentage}%{_translation_total} 中的 {_translation_translated_count} 已經翻譯了"
}, },

View file

@ -36,6 +36,10 @@ export class AllKnownLayoutsLazy {
return this.raw.get(key) return this.raw.get(key)
} }
public size(){
return this.raw.size
}
public get(key: string): LayoutConfig { public get(key: string): LayoutConfig {
const cached = this.dict.get(key) const cached = this.dict.get(key)
if (cached !== undefined) { if (cached !== undefined) {

View file

@ -108,6 +108,9 @@ export default class DetermineLayout {
).data ).data
const id = layoutId?.toLowerCase() const id = layoutId?.toLowerCase()
const layouts = AllKnownLayouts.allKnownLayouts const layouts = AllKnownLayouts.allKnownLayouts
if(layouts.size() == 0){
throw "Build failed or running, no layouts are known at all"
}
if (layouts.getConfig(id) === undefined) { if (layouts.getConfig(id) === undefined) {
const alternatives = Utils.sortedByLevenshteinDistance(id, Array.from(layouts.keys()), i => i).slice(0, 3) const alternatives = Utils.sortedByLevenshteinDistance(id, Array.from(layouts.keys()), i => i).slice(0, 3)
const msg = (`No builtin map theme with name ${layoutId} exists. Perhaps you meant one of ${alternatives.join(", ")}`) const msg = (`No builtin map theme with name ${layoutId} exists. Perhaps you meant one of ${alternatives.join(", ")}`)

View file

@ -23,7 +23,7 @@ import { ImageCarousel } from "./Image/ImageCarousel"
import { VariableUiElement } from "./Base/VariableUIElement" import { VariableUiElement } from "./Base/VariableUIElement"
import { Utils } from "../Utils" import { Utils } from "../Utils"
import Wikidata, { WikidataResponse } from "../Logic/Web/Wikidata" import Wikidata, { WikidataResponse } from "../Logic/Web/Wikidata"
import { Translation } from "./i18n/Translation" import { Translation, TypedTranslation } from "./i18n/Translation"
import Translations from "./i18n/Translations" import Translations from "./i18n/Translations"
import OpeningHoursVisualization from "./OpeningHours/OpeningHoursVisualization" import OpeningHoursVisualization from "./OpeningHours/OpeningHoursVisualization"
import { SubtleButton } from "./Base/SubtleButton" import { SubtleButton } from "./Base/SubtleButton"
@ -100,6 +100,7 @@ import PendingChangesIndicator from "./BigComponents/PendingChangesIndicator.sve
import QrCode from "./Popup/QrCode.svelte" import QrCode from "./Popup/QrCode.svelte"
import ClearCaches from "./Popup/ClearCaches.svelte" import ClearCaches from "./Popup/ClearCaches.svelte"
import GroupedView from "./Popup/GroupedView.svelte" import GroupedView from "./Popup/GroupedView.svelte"
import { QuestionableTagRenderingConfigJson } from "../Models/ThemeConfig/Json/QuestionableTagRenderingConfigJson"
class NearbyImageVis implements SpecialVisualization { class NearbyImageVis implements SpecialVisualization {
// Class must be in SpecialVisualisations due to weird cyclical import that breaks the tests // Class must be in SpecialVisualisations due to weird cyclical import that breaks the tests
@ -126,7 +127,7 @@ class NearbyImageVis implements SpecialVisualization {
tags: UIEventSource<Record<string, string>>, tags: UIEventSource<Record<string, string>>,
args: string[], args: string[],
feature: Feature, feature: Feature,
layer: LayerConfig layer: LayerConfig,
): SvelteUIElement { ): SvelteUIElement {
const isOpen = args[0] === "open" const isOpen = args[0] === "open"
const readonly = args[1] === "readonly" const readonly = args[1] === "readonly"
@ -193,7 +194,7 @@ class StealViz implements SpecialVisualization {
selectedElement: otherFeature, selectedElement: otherFeature,
state, state,
layer, layer,
}) }),
) )
} }
if (elements.length === 1) { if (elements.length === 1) {
@ -201,8 +202,8 @@ class StealViz implements SpecialVisualization {
} }
return new Combine(elements).SetClass("flex flex-col") return new Combine(elements).SetClass("flex flex-col")
}, },
[state.indexedFeatures.featuresById] [state.indexedFeatures.featuresById],
) ),
) )
} }
@ -259,7 +260,7 @@ class CloseNoteViz implements SpecialVisualization {
idkey, idkey,
comment, comment,
minZoom, minZoom,
zoomButton zoomButton,
} = Utils.ParseVisArgs(this.args, args) } = Utils.ParseVisArgs(this.args, args)
@ -271,7 +272,7 @@ class CloseNoteViz implements SpecialVisualization {
message: comment, message: comment,
text: Translations.T(text), text: Translations.T(text),
minzoom: minZoom, minzoom: minZoom,
zoomMoreMessage: zoomButton zoomMoreMessage: zoomButton,
}) })
} }
} }
@ -301,7 +302,7 @@ export class QuestionViz implements SpecialVisualization {
tags: UIEventSource<Record<string, string>>, tags: UIEventSource<Record<string, string>>,
args: string[], args: string[],
feature: Feature, feature: Feature,
layer: LayerConfig layer: LayerConfig,
): SvelteUIElement { ): SvelteUIElement {
const labels = args[0] const labels = args[0]
?.split(";") ?.split(";")
@ -347,7 +348,7 @@ export default class SpecialVisualizations {
defaultArg = "_empty string_" defaultArg = "_empty string_"
} }
return [arg.name, defaultArg, arg.doc] return [arg.name, defaultArg, arg.doc]
}) }),
) )
: undefined, : undefined,
"#### Example usage of " + viz.funcName, "#### Example usage of " + viz.funcName,
@ -357,14 +358,14 @@ export default class SpecialVisualizations {
public static constructSpecification( public static constructSpecification(
template: string, template: string,
extraMappings: SpecialVisualization[] = [] extraMappings: SpecialVisualization[] = [],
): RenderingSpecification[] { ): RenderingSpecification[] {
return SpecialVisualisationUtils.constructSpecification(template, extraMappings) return SpecialVisualisationUtils.constructSpecification(template, extraMappings)
} }
public static HelpMessage(): string { public static HelpMessage(): string {
const helpTexts: string[] = SpecialVisualizations.specialVisualizations.map((viz) => const helpTexts: string[] = SpecialVisualizations.specialVisualizations.map((viz) =>
SpecialVisualizations.DocumentationFor(viz) SpecialVisualizations.DocumentationFor(viz),
) )
const firstPart = new Combine([ const firstPart = new Combine([
@ -397,10 +398,10 @@ export default class SpecialVisualizations {
}, },
}, },
null, null,
" " " ",
) ),
).SetClass("code"), ).SetClass("code"),
'In other words: use `{ "before": ..., "after": ..., "special": {"type": ..., "argname": ...argvalue...}`. The args are in the `special` block; an argvalue can be a string, a translation or another value. (Refer to class `RewriteSpecial` in case of problems)', "In other words: use `{ \"before\": ..., \"after\": ..., \"special\": {\"type\": ..., \"argname\": ...argvalue...}`. The args are in the `special` block; an argvalue can be a string, a translation or another value. (Refer to class `RewriteSpecial` in case of problems)",
]) ])
.SetClass("flex flex-col") .SetClass("flex flex-col")
.AsMarkdown() .AsMarkdown()
@ -438,10 +439,10 @@ export default class SpecialVisualizations {
assignTo: state.userRelatedState.language, assignTo: state.userRelatedState.language,
availableLanguages: languages, availableLanguages: languages,
preferredLanguages: state.osmConnection.userDetails.map( preferredLanguages: state.osmConnection.userDetails.map(
(ud) => ud.languages (ud) => ud.languages,
), ),
}) })
}) }),
) )
}, },
}, },
@ -480,7 +481,7 @@ export default class SpecialVisualizations {
state: SpecialVisualizationState, state: SpecialVisualizationState,
tagSource: UIEventSource<Record<string, string>>, tagSource: UIEventSource<Record<string, string>>,
args: string[], args: string[],
feature: Feature feature: Feature,
): SvelteUIElement { ): SvelteUIElement {
return new SvelteUIElement(MinimapViz, { state, args, feature, tagSource }) return new SvelteUIElement(MinimapViz, { state, args, feature, tagSource })
}, },
@ -492,7 +493,7 @@ export default class SpecialVisualizations {
constr( constr(
state: SpecialVisualizationState, state: SpecialVisualizationState,
tagSource: UIEventSource<Record<string, string>> tagSource: UIEventSource<Record<string, string>>,
): BaseUIElement { ): BaseUIElement {
return new VariableUiElement( return new VariableUiElement(
tagSource tagSource
@ -502,7 +503,7 @@ export default class SpecialVisualizations {
return new SvelteUIElement(SplitRoadWizard, { id, state }) return new SvelteUIElement(SplitRoadWizard, { id, state })
} }
return undefined return undefined
}) }),
) )
}, },
}, },
@ -516,7 +517,7 @@ export default class SpecialVisualizations {
tagSource: UIEventSource<Record<string, string>>, tagSource: UIEventSource<Record<string, string>>,
argument: string[], argument: string[],
feature: Feature, feature: Feature,
layer: LayerConfig layer: LayerConfig,
): BaseUIElement { ): BaseUIElement {
if (feature.geometry.type !== "Point") { if (feature.geometry.type !== "Point") {
return undefined return undefined
@ -539,7 +540,7 @@ export default class SpecialVisualizations {
tagSource: UIEventSource<Record<string, string>>, tagSource: UIEventSource<Record<string, string>>,
argument: string[], argument: string[],
feature: Feature, feature: Feature,
layer: LayerConfig layer: LayerConfig,
): BaseUIElement { ): BaseUIElement {
if (!layer.deletion) { if (!layer.deletion) {
return undefined return undefined
@ -567,7 +568,7 @@ export default class SpecialVisualizations {
state: SpecialVisualizationState, state: SpecialVisualizationState,
tagSource: UIEventSource<Record<string, string>>, tagSource: UIEventSource<Record<string, string>>,
argument: string[], argument: string[],
feature: Feature feature: Feature,
): BaseUIElement { ): BaseUIElement {
const [lon, lat] = GeoOperations.centerpointCoordinates(feature) const [lon, lat] = GeoOperations.centerpointCoordinates(feature)
return new SvelteUIElement(CreateNewNote, { return new SvelteUIElement(CreateNewNote, {
@ -630,7 +631,7 @@ export default class SpecialVisualizations {
.map((tags) => tags[args[0]]) .map((tags) => tags[args[0]])
.map((wikidata) => { .map((wikidata) => {
wikidata = Utils.NoEmpty( wikidata = Utils.NoEmpty(
wikidata?.split(";")?.map((wd) => wd.trim()) ?? [] wikidata?.split(";")?.map((wd) => wd.trim()) ?? [],
)[0] )[0]
const entry = Wikidata.LoadWikidataEntry(wikidata) const entry = Wikidata.LoadWikidataEntry(wikidata)
return new VariableUiElement( return new VariableUiElement(
@ -640,9 +641,9 @@ export default class SpecialVisualizations {
} }
const response = <WikidataResponse>e["success"] const response = <WikidataResponse>e["success"]
return Translation.fromMap(response.labels) return Translation.fromMap(response.labels)
}) }),
) )
}) }),
), ),
}, },
new MapillaryLinkVis(), new MapillaryLinkVis(),
@ -656,7 +657,7 @@ export default class SpecialVisualizations {
tags: UIEventSource<Record<string, string>>, tags: UIEventSource<Record<string, string>>,
_, _,
__, __,
layer: LayerConfig layer: LayerConfig,
) => new SvelteUIElement(AllTagsPanel, { tags, layer }), ) => new SvelteUIElement(AllTagsPanel, { tags, layer }),
}, },
{ {
@ -678,7 +679,7 @@ export default class SpecialVisualizations {
return new ImageCarousel( return new ImageCarousel(
AllImageProviders.LoadImagesFor(tags, imagePrefixes), AllImageProviders.LoadImagesFor(tags, imagePrefixes),
tags, tags,
state state,
) )
}, },
}, },
@ -735,7 +736,7 @@ export default class SpecialVisualizations {
nameKey: nameKey, nameKey: nameKey,
fallbackName, fallbackName,
}, },
state.featureSwitchIsTesting state.featureSwitchIsTesting,
) )
return new SvelteUIElement(StarsBarIcon, { return new SvelteUIElement(StarsBarIcon, {
score: reviews.average, score: reviews.average,
@ -769,7 +770,7 @@ export default class SpecialVisualizations {
nameKey: nameKey, nameKey: nameKey,
fallbackName, fallbackName,
}, },
state.featureSwitchIsTesting state.featureSwitchIsTesting,
) )
return new SvelteUIElement(ReviewForm, { reviews, state, tags, feature, layer }) return new SvelteUIElement(ReviewForm, { reviews, state, tags, feature, layer })
}, },
@ -802,7 +803,7 @@ export default class SpecialVisualizations {
nameKey: nameKey, nameKey: nameKey,
fallbackName, fallbackName,
}, },
state.featureSwitchIsTesting state.featureSwitchIsTesting,
) )
return new SvelteUIElement(AllReviews, { reviews, state, tags, feature, layer }) return new SvelteUIElement(AllReviews, { reviews, state, tags, feature, layer })
}, },
@ -820,7 +821,7 @@ export default class SpecialVisualizations {
constr( constr(
state: SpecialVisualizationState, state: SpecialVisualizationState,
_: UIEventSource<Record<string, string>>, _: UIEventSource<Record<string, string>>,
argument: string[] argument: string[],
): BaseUIElement { ): BaseUIElement {
const [text] = argument const [text] = argument
return new SvelteUIElement(ImportReviewIdentity, { state, text }) return new SvelteUIElement(ImportReviewIdentity, { state, text })
@ -877,7 +878,7 @@ export default class SpecialVisualizations {
constr( constr(
state: SpecialVisualizationState, state: SpecialVisualizationState,
tags: UIEventSource<Record<string, string>>, tags: UIEventSource<Record<string, string>>,
args: string[] args: string[],
): SvelteUIElement { ): SvelteUIElement {
const keyToUse = args[0] const keyToUse = args[0]
const prefix = args[1] const prefix = args[1]
@ -914,17 +915,17 @@ export default class SpecialVisualizations {
return undefined return undefined
} }
const allUnits: Unit[] = [].concat( const allUnits: Unit[] = [].concat(
...(state?.layout?.layers?.map((lyr) => lyr.units) ?? []) ...(state?.layout?.layers?.map((lyr) => lyr.units) ?? []),
) )
const unit = allUnits.filter((unit) => const unit = allUnits.filter((unit) =>
unit.isApplicableToKey(key) unit.isApplicableToKey(key),
)[0] )[0]
if (unit === undefined) { if (unit === undefined) {
return value return value
} }
const getCountry = () => tagSource.data._country const getCountry = () => tagSource.data._country
return unit.asHumanLongValue(value, getCountry) return unit.asHumanLongValue(value, getCountry)
}) }),
) )
}, },
}, },
@ -941,7 +942,7 @@ export default class SpecialVisualizations {
new Combine([ new Combine([
t.downloadFeatureAsGeojson.SetClass("font-bold text-lg"), t.downloadFeatureAsGeojson.SetClass("font-bold text-lg"),
t.downloadGeoJsonHelper.SetClass("subtle"), t.downloadGeoJsonHelper.SetClass("subtle"),
]).SetClass("flex flex-col") ]).SetClass("flex flex-col"),
) )
.onClick(() => { .onClick(() => {
console.log("Exporting as Geojson") console.log("Exporting as Geojson")
@ -954,7 +955,7 @@ export default class SpecialVisualizations {
title + "_mapcomplete_export.geojson", title + "_mapcomplete_export.geojson",
{ {
mimetype: "application/vnd.geo+json", mimetype: "application/vnd.geo+json",
} },
) )
}) })
.SetClass("w-full") .SetClass("w-full")
@ -990,7 +991,7 @@ export default class SpecialVisualizations {
constr: (state) => { constr: (state) => {
return new SubtleButton( return new SubtleButton(
new SvelteUIElement(Trash).SetClass("h-6"), new SvelteUIElement(Trash).SetClass("h-6"),
Translations.t.general.removeLocationHistory Translations.t.general.removeLocationHistory,
).onClick(() => { ).onClick(() => {
state.historicalUserLocations.features.setData([]) state.historicalUserLocations.features.setData([])
state.selectedElement.setData(undefined) state.selectedElement.setData(undefined)
@ -1028,10 +1029,10 @@ export default class SpecialVisualizations {
.filter((c) => c.text !== "") .filter((c) => c.text !== "")
.map( .map(
(c, i) => (c, i) =>
new NoteCommentElement(c, state, i, comments.length) new NoteCommentElement(c, state, i, comments.length),
) ),
).SetClass("flex flex-col") ).SetClass("flex flex-col")
}) }),
), ),
}, },
{ {
@ -1065,7 +1066,7 @@ export default class SpecialVisualizations {
tagsSource: UIEventSource<Record<string, string>>, tagsSource: UIEventSource<Record<string, string>>,
_: string[], _: string[],
feature: Feature, feature: Feature,
layer: LayerConfig layer: LayerConfig,
) => ) =>
new VariableUiElement( new VariableUiElement(
tagsSource.map((tags) => { tagsSource.map((tags) => {
@ -1085,7 +1086,7 @@ export default class SpecialVisualizations {
}) })
.SetClass("px-1") .SetClass("px-1")
.setSpan() .setSpan()
}) }),
), ),
}, },
{ {
@ -1101,8 +1102,8 @@ export default class SpecialVisualizations {
const challenge = Stores.FromPromise( const challenge = Stores.FromPromise(
Utils.downloadJsonCached<MaprouletteTask>( Utils.downloadJsonCached<MaprouletteTask>(
`${Maproulette.defaultEndpoint}/challenge/${parentId}`, `${Maproulette.defaultEndpoint}/challenge/${parentId}`,
24 * 60 * 60 * 1000 24 * 60 * 60 * 1000,
) ),
) )
return new VariableUiElement( return new VariableUiElement(
@ -1127,7 +1128,7 @@ export default class SpecialVisualizations {
} else { } else {
return [title, new List(listItems)] return [title, new List(listItems)]
} }
}) }),
) )
}, },
docs: "Fetches the metadata of MapRoulette campaign that this task is part of and shows those details (namely `title`, `description` and `instruction`).\n\nThis reads the property `mr_challengeId` to detect the parent campaign.", docs: "Fetches the metadata of MapRoulette campaign that this task is part of and shows those details (namely `title`, `description` and `instruction`).\n\nThis reads the property `mr_challengeId` to detect the parent campaign.",
@ -1141,15 +1142,15 @@ export default class SpecialVisualizations {
"\n" + "\n" +
"```json\n" + "```json\n" +
"{\n" + "{\n" +
' "id": "mark_duplicate",\n' + " \"id\": \"mark_duplicate\",\n" +
' "render": {\n' + " \"render\": {\n" +
' "special": {\n' + " \"special\": {\n" +
' "type": "maproulette_set_status",\n' + " \"type\": \"maproulette_set_status\",\n" +
' "message": {\n' + " \"message\": {\n" +
' "en": "Mark as not found or false positive"\n' + " \"en\": \"Mark as not found or false positive\"\n" +
" },\n" + " },\n" +
' "status": "2",\n' + " \"status\": \"2\",\n" +
' "image": "close"\n' + " \"image\": \"close\"\n" +
" }\n" + " }\n" +
" }\n" + " }\n" +
"}\n" + "}\n" +
@ -1225,7 +1226,7 @@ export default class SpecialVisualizations {
(l) => (l) =>
l.name !== null && l.name !== null &&
l.title && l.title &&
state.perLayer.get(l.id) !== undefined state.perLayer.get(l.id) !== undefined,
) )
.map( .map(
(l) => { (l) => {
@ -1235,8 +1236,8 @@ export default class SpecialVisualizations {
const fsBboxed = new BBoxFeatureSourceForLayer(fs, bbox) const fsBboxed = new BBoxFeatureSourceForLayer(fs, bbox)
return new StatisticsPanel(fsBboxed) return new StatisticsPanel(fsBboxed)
}, },
[state.mapProperties.bounds] [state.mapProperties.bounds],
) ),
) )
}, },
}, },
@ -1300,13 +1301,13 @@ export default class SpecialVisualizations {
{ {
name: "icon", name: "icon",
doc: "If set, show this icon next to the link. You might want to combine this with `class: button`", doc: "If set, show this icon next to the link. You might want to combine this with `class: button`",
} },
], ],
constr( constr(
state: SpecialVisualizationState, state: SpecialVisualizationState,
tagSource: UIEventSource<Record<string, string>>, tagSource: UIEventSource<Record<string, string>>,
args: string[] args: string[],
): BaseUIElement { ): BaseUIElement {
let [text, href, classnames, download, ariaLabel, icon] = args let [text, href, classnames, download, ariaLabel, icon] = args
if (download === "") { if (download === "") {
@ -1318,8 +1319,8 @@ export default class SpecialVisualizations {
(tags) => (tags) =>
Utils.SubstituteKeys(href, tags).replaceAll( Utils.SubstituteKeys(href, tags).replaceAll(
/ /g, / /g,
"%20" "%20",
) /* Chromium based browsers eat the spaces */ ), /* Chromium based browsers eat the spaces */
) )
return new SvelteUIElement(DynLink, { return new SvelteUIElement(DynLink, {
text: textStore, text: textStore,
@ -1328,7 +1329,7 @@ export default class SpecialVisualizations {
download: tagSource.map((tags) => Utils.SubstituteKeys(download, tags)), download: tagSource.map((tags) => Utils.SubstituteKeys(download, tags)),
ariaLabel: tagSource.map((tags) => Utils.SubstituteKeys(ariaLabel, tags)), ariaLabel: tagSource.map((tags) => Utils.SubstituteKeys(ariaLabel, tags)),
newTab: new ImmutableStore(newTab), newTab: new ImmutableStore(newTab),
icon: tagSource.map((tags) => Utils.SubstituteKeys(icon, tags)) icon: tagSource.map((tags) => Utils.SubstituteKeys(icon, tags)),
}).setSpan() }).setSpan()
}, },
}, },
@ -1350,7 +1351,7 @@ export default class SpecialVisualizations {
}, },
}, },
null, null,
" " " ",
) + ) +
"\n```", "\n```",
args: [ args: [
@ -1374,7 +1375,7 @@ export default class SpecialVisualizations {
featureTags: UIEventSource<Record<string, string>>, featureTags: UIEventSource<Record<string, string>>,
args: string[], args: string[],
feature: Feature, feature: Feature,
layer: LayerConfig layer: LayerConfig,
) { ) {
const [key, tr, classesRaw] = args const [key, tr, classesRaw] = args
let classes = classesRaw ?? "" let classes = classesRaw ?? ""
@ -1392,7 +1393,7 @@ export default class SpecialVisualizations {
"Could not create a special visualization for multi(", "Could not create a special visualization for multi(",
args.join(", ") + ")", args.join(", ") + ")",
"no properties found for object", "no properties found for object",
feature.properties.id feature.properties.id,
) )
return undefined return undefined
} }
@ -1408,7 +1409,7 @@ export default class SpecialVisualizations {
elements.push(subsTr) elements.push(subsTr)
} }
return elements return elements
}) }),
) )
}, },
}, },
@ -1428,7 +1429,7 @@ export default class SpecialVisualizations {
tagSource: UIEventSource<Record<string, string>>, tagSource: UIEventSource<Record<string, string>>,
argument: string[], argument: string[],
feature: Feature, feature: Feature,
layer: LayerConfig layer: LayerConfig,
): BaseUIElement { ): BaseUIElement {
return new VariableUiElement( return new VariableUiElement(
tagSource.map((tags) => { tagSource.map((tags) => {
@ -1440,7 +1441,7 @@ export default class SpecialVisualizations {
console.error("Cannot create a translation for", v, "due to", e) console.error("Cannot create a translation for", v, "due to", e)
return JSON.stringify(v) return JSON.stringify(v)
} }
}) }),
) )
}, },
}, },
@ -1460,7 +1461,7 @@ export default class SpecialVisualizations {
tagSource: UIEventSource<Record<string, string>>, tagSource: UIEventSource<Record<string, string>>,
argument: string[], argument: string[],
feature: Feature, feature: Feature,
layer: LayerConfig layer: LayerConfig,
): BaseUIElement { ): BaseUIElement {
const key = argument[0] const key = argument[0]
const validator = new FediverseValidator() const validator = new FediverseValidator()
@ -1470,7 +1471,7 @@ export default class SpecialVisualizations {
.map((fediAccount) => { .map((fediAccount) => {
fediAccount = validator.reformat(fediAccount) fediAccount = validator.reformat(fediAccount)
const [_, username, host] = fediAccount.match( const [_, username, host] = fediAccount.match(
FediverseValidator.usernameAtServer FediverseValidator.usernameAtServer,
) )
const normalLink = new SvelteUIElement(Link, { const normalLink = new SvelteUIElement(Link, {
@ -1485,7 +1486,7 @@ export default class SpecialVisualizations {
] ]
console.log( console.log(
"LoggedinContributorMastodon", "LoggedinContributorMastodon",
loggedInContributorMastodon loggedInContributorMastodon,
) )
if (!loggedInContributorMastodon) { if (!loggedInContributorMastodon) {
return normalLink return normalLink
@ -1501,7 +1502,7 @@ export default class SpecialVisualizations {
newTab: true, newTab: true,
}).SetClass("button"), }).SetClass("button"),
]) ])
}) }),
) )
}, },
}, },
@ -1521,7 +1522,7 @@ export default class SpecialVisualizations {
tagSource: UIEventSource<Record<string, string>>, tagSource: UIEventSource<Record<string, string>>,
args: string[], args: string[],
feature: Feature, feature: Feature,
layer: LayerConfig layer: LayerConfig,
): BaseUIElement { ): BaseUIElement {
return new FixedUiElement("{" + args[0] + "}") return new FixedUiElement("{" + args[0] + "}")
}, },
@ -1542,7 +1543,7 @@ export default class SpecialVisualizations {
tagSource: UIEventSource<Record<string, string>>, tagSource: UIEventSource<Record<string, string>>,
argument: string[], argument: string[],
feature: Feature, feature: Feature,
layer: LayerConfig layer: LayerConfig,
): BaseUIElement { ): BaseUIElement {
const key = argument[0] ?? "value" const key = argument[0] ?? "value"
return new VariableUiElement( return new VariableUiElement(
@ -1562,10 +1563,10 @@ export default class SpecialVisualizations {
"Could not parse this tag: " + "Could not parse this tag: " +
JSON.stringify(value) + JSON.stringify(value) +
" due to " + " due to " +
e e,
).SetClass("alert") ).SetClass("alert")
} }
}) }),
) )
}, },
}, },
@ -1586,7 +1587,7 @@ export default class SpecialVisualizations {
tagSource: UIEventSource<Record<string, string>>, tagSource: UIEventSource<Record<string, string>>,
argument: string[], argument: string[],
feature: Feature, feature: Feature,
layer: LayerConfig layer: LayerConfig,
): BaseUIElement { ): BaseUIElement {
const giggityUrl = argument[0] const giggityUrl = argument[0]
return new SvelteUIElement(Giggity, { tags: tagSource, state, giggityUrl }) return new SvelteUIElement(Giggity, { tags: tagSource, state, giggityUrl })
@ -1602,12 +1603,12 @@ export default class SpecialVisualizations {
_: UIEventSource<Record<string, string>>, _: UIEventSource<Record<string, string>>,
argument: string[], argument: string[],
feature: Feature, feature: Feature,
layer: LayerConfig layer: LayerConfig,
): BaseUIElement { ): BaseUIElement {
const tags = (<ThemeViewState>( const tags = (<ThemeViewState>(
state state
)).geolocation.currentUserLocation.features.map( )).geolocation.currentUserLocation.features.map(
(features) => features[0]?.properties (features) => features[0]?.properties,
) )
return new Combine([ return new Combine([
new SvelteUIElement(OrientationDebugPanel, {}), new SvelteUIElement(OrientationDebugPanel, {}),
@ -1629,7 +1630,7 @@ export default class SpecialVisualizations {
tagSource: UIEventSource<Record<string, string>>, tagSource: UIEventSource<Record<string, string>>,
argument: string[], argument: string[],
feature: Feature, feature: Feature,
layer: LayerConfig layer: LayerConfig,
): BaseUIElement { ): BaseUIElement {
return new SvelteUIElement(MarkAsFavourite, { return new SvelteUIElement(MarkAsFavourite, {
tags: tagSource, tags: tagSource,
@ -1649,7 +1650,7 @@ export default class SpecialVisualizations {
tagSource: UIEventSource<Record<string, string>>, tagSource: UIEventSource<Record<string, string>>,
argument: string[], argument: string[],
feature: Feature, feature: Feature,
layer: LayerConfig layer: LayerConfig,
): BaseUIElement { ): BaseUIElement {
return new SvelteUIElement(MarkAsFavouriteMini, { return new SvelteUIElement(MarkAsFavouriteMini, {
tags: tagSource, tags: tagSource,
@ -1669,7 +1670,7 @@ export default class SpecialVisualizations {
tagSource: UIEventSource<Record<string, string>>, tagSource: UIEventSource<Record<string, string>>,
argument: string[], argument: string[],
feature: Feature, feature: Feature,
layer: LayerConfig layer: LayerConfig,
): BaseUIElement { ): BaseUIElement {
return new SvelteUIElement(DirectionIndicator, { state, feature }) return new SvelteUIElement(DirectionIndicator, { state, feature })
}, },
@ -1683,10 +1684,10 @@ export default class SpecialVisualizations {
state: SpecialVisualizationState, state: SpecialVisualizationState,
tags: UIEventSource<Record<string, string>>, tags: UIEventSource<Record<string, string>>,
argument: string[], argument: string[],
feature: Feature feature: Feature,
): SvelteUIElement { ): SvelteUIElement {
return new SvelteUIElement(QrCode , {state, tags, feature} ) return new SvelteUIElement(QrCode, { state, tags, feature })
} },
}, },
{ {
funcName: "direction_absolute", funcName: "direction_absolute",
@ -1702,7 +1703,7 @@ export default class SpecialVisualizations {
constr( constr(
state: SpecialVisualizationState, state: SpecialVisualizationState,
tagSource: UIEventSource<Record<string, string>>, tagSource: UIEventSource<Record<string, string>>,
args: string[] args: string[],
): BaseUIElement { ): BaseUIElement {
const key = args[0] === "" ? "_direction:centerpoint" : args[0] const key = args[0] === "" ? "_direction:centerpoint" : args[0]
return new VariableUiElement( return new VariableUiElement(
@ -1713,11 +1714,11 @@ export default class SpecialVisualizations {
}) })
.mapD((value) => { .mapD((value) => {
const dir = GeoOperations.bearingToHuman( const dir = GeoOperations.bearingToHuman(
GeoOperations.parseBearing(value) GeoOperations.parseBearing(value),
) )
console.log("Human dir", dir) console.log("Human dir", dir)
return Translations.t.general.visualFeedback.directionsAbsolute[dir] return Translations.t.general.visualFeedback.directionsAbsolute[dir]
}) }),
) )
}, },
}, },
@ -1747,7 +1748,7 @@ export default class SpecialVisualizations {
tagSource: UIEventSource<Record<string, string>>, tagSource: UIEventSource<Record<string, string>>,
args: string[], args: string[],
feature: Feature, feature: Feature,
layer: LayerConfig layer: LayerConfig,
): BaseUIElement { ): BaseUIElement {
const url = args[0] const url = args[0]
const readonly = args[3] === "yes" const readonly = args[3] === "yes"
@ -1773,12 +1774,12 @@ export default class SpecialVisualizations {
tagSource: UIEventSource<Record<string, string>>, tagSource: UIEventSource<Record<string, string>>,
args: string[], args: string[],
feature: Feature, feature: Feature,
layer: LayerConfig layer: LayerConfig,
): BaseUIElement { ): BaseUIElement {
return new Toggle( return new Toggle(
undefined, undefined,
new SvelteUIElement(LoginButton, { osmConnection: state.osmConnection }), new SvelteUIElement(LoginButton, { osmConnection: state.osmConnection }),
state.osmConnection.isLoggedIn state.osmConnection.isLoggedIn,
) )
}, },
}, },
@ -1816,7 +1817,7 @@ export default class SpecialVisualizations {
tags: UIEventSource<Record<string, string>>, tags: UIEventSource<Record<string, string>>,
argument: string[], argument: string[],
feature: Feature, feature: Feature,
layer: LayerConfig layer: LayerConfig,
): BaseUIElement { ): BaseUIElement {
const key = argument[0] ?? "website" const key = argument[0] ?? "website"
const useProxy = argument[1] !== "no" const useProxy = argument[1] !== "no"
@ -1843,11 +1844,11 @@ export default class SpecialVisualizations {
const features = const features =
await LinkedDataLoader.fetchVeloparkEntry( await LinkedDataLoader.fetchVeloparkEntry(
url, url,
loadAll loadAll,
) )
const feature = const feature =
features.find( features.find(
(f) => f.properties["ref:velopark"] === url (f) => f.properties["ref:velopark"] === url,
) ?? features[0] ) ?? features[0]
const properties = feature.properties const properties = feature.properties
properties["ref:velopark"] = url properties["ref:velopark"] = url
@ -1857,7 +1858,7 @@ export default class SpecialVisualizations {
console.error(e) console.error(e)
throw e throw e
} }
})() })(),
) )
} }
return Stores.FromPromiseWithErr( return Stores.FromPromiseWithErr(
@ -1866,27 +1867,27 @@ export default class SpecialVisualizations {
return await LinkedDataLoader.fetchJsonLd( return await LinkedDataLoader.fetchJsonLd(
url, url,
{ country }, { country },
useProxy ? "proxy" : "fetch-lod" useProxy ? "proxy" : "fetch-lod",
) )
} catch (e) { } catch (e) {
console.log( console.log(
"Could not get with proxy/download LOD, attempting to download directly. Error for ", "Could not get with proxy/download LOD, attempting to download directly. Error for ",
url, url,
"is", "is",
e e,
) )
return await LinkedDataLoader.fetchJsonLd( return await LinkedDataLoader.fetchJsonLd(
url, url,
{ country }, { country },
"fetch-raw" "fetch-raw",
) )
} }
})() })(),
) )
}) })
externalData.addCallbackAndRunD((lod) => externalData.addCallbackAndRunD((lod) =>
console.log("linked_data_from_website received the following data:", lod) console.log("linked_data_from_website received the following data:", lod),
) )
return new Toggle( return new Toggle(
@ -1901,7 +1902,7 @@ export default class SpecialVisualizations {
collapsed: isClosed, collapsed: isClosed,
}), }),
undefined, undefined,
url.map((url) => !!url) url.map((url) => !!url),
) )
}, },
}, },
@ -1921,7 +1922,7 @@ export default class SpecialVisualizations {
tagSource: UIEventSource<Record<string, string>>, tagSource: UIEventSource<Record<string, string>>,
argument: string[], argument: string[],
feature: Feature, feature: Feature,
layer: LayerConfig layer: LayerConfig,
): BaseUIElement { ): BaseUIElement {
const text = argument[0] const text = argument[0]
const cssClasses = argument[1] const cssClasses = argument[1]
@ -1943,7 +1944,7 @@ export default class SpecialVisualizations {
tagSource: UIEventSource<Record<string, string>>, tagSource: UIEventSource<Record<string, string>>,
argument: string[], argument: string[],
feature: Feature, feature: Feature,
layer: LayerConfig layer: LayerConfig,
): BaseUIElement { ): BaseUIElement {
const translation = tagSource.map((tags) => { const translation = tagSource.map((tags) => {
const presets = state.layout.getMatchingLayer(tags)?.presets const presets = state.layout.getMatchingLayer(tags)?.presets
@ -1977,25 +1978,51 @@ export default class SpecialVisualizations {
}, },
}, },
{ {
funcName:"pending_changes", funcName: "preset_type_select",
docs: "An editable tag rendering which allows to change the type",
args: [],
constr(state: SpecialVisualizationState, tags: UIEventSource<Record<string, string>>, argument: string[], selectedElement: Feature, layer: LayerConfig): SvelteUIElement {
const t = Translations.t.preset_type
const question: QuestionableTagRenderingConfigJson = {
id: layer.id + "-type",
question: t.question.translations,
mappings: layer.presets.map(pr => {
return {
if: new And(pr.tags).asJson(),
then: (pr.description ? t.typeDescription : t.typeTitle).Subs({
title: pr.title,
description: pr.description,
}).translations,
}
}),
}
const config = new TagRenderingConfig(question)
return new SvelteUIElement(TagRenderingEditable, {
config,
tags, selectedElement, state, layer,
})
},
},
{
funcName: "pending_changes",
docs: "A module showing the pending changes, with the option to clear the pending changes", docs: "A module showing the pending changes, with the option to clear the pending changes",
args:[], args: [],
constr(state: SpecialVisualizationState, tagSource: UIEventSource<Record<string, string>>, argument: string[], feature: Feature, layer: LayerConfig): BaseUIElement { constr(state: SpecialVisualizationState, tagSource: UIEventSource<Record<string, string>>, argument: string[], feature: Feature, layer: LayerConfig): BaseUIElement {
return new SvelteUIElement(PendingChangesIndicator, {state, compact: false}) return new SvelteUIElement(PendingChangesIndicator, { state, compact: false })
}, },
}, },
{ {
funcName: "clear_caches", funcName: "clear_caches",
docs: "A button which clears the locally downloaded data and the service worker. Login status etc will be kept", docs: "A button which clears the locally downloaded data and the service worker. Login status etc will be kept",
args:[ args: [
{ {
name: "text", name: "text",
required: true, required: true,
doc: "The text to show on the button" doc: "The text to show on the button",
} },
], ],
constr(state: SpecialVisualizationState, tagSource: UIEventSource<Record<string, string>>, argument: string[], feature: Feature, layer: LayerConfig): SvelteUIElement { constr(state: SpecialVisualizationState, tagSource: UIEventSource<Record<string, string>>, argument: string[], feature: Feature, layer: LayerConfig): SvelteUIElement {
return new SvelteUIElement<any, any, any>(ClearCaches, {msg: argument[0] ?? "Clear local caches"}) return new SvelteUIElement<any, any, any>(ClearCaches, { msg: argument[0] ?? "Clear local caches" })
}, },
}, },
{ {
@ -2004,21 +2031,21 @@ export default class SpecialVisualizations {
args: [ args: [
{ {
name: "header", name: "header",
doc: "The _identifier_ of a single tagRendering. This will be used as header" doc: "The _identifier_ of a single tagRendering. This will be used as header",
}, },
{ {
name: "labels", name: "labels",
doc: "A `;`-separated list of either identifiers or label names. All tagRenderings matching this value will be shown in the accordion" doc: "A `;`-separated list of either identifiers or label names. All tagRenderings matching this value will be shown in the accordion",
} },
], ],
constr(state: SpecialVisualizationState, tags: UIEventSource<Record<string, string>>, argument: string[], selectedElement: Feature, layer: LayerConfig): SvelteUIElement { constr(state: SpecialVisualizationState, tags: UIEventSource<Record<string, string>>, argument: string[], selectedElement: Feature, layer: LayerConfig): SvelteUIElement {
const [header, labelsStr] = argument const [header, labelsStr] = argument
const labels = labelsStr.split(";").map(x => x.trim()) const labels = labelsStr.split(";").map(x => x.trim())
return new SvelteUIElement<any, any, any>(GroupedView, { return new SvelteUIElement<any, any, any>(GroupedView, {
state, tags, selectedElement, layer, header, labels state, tags, selectedElement, layer, header, labels,
}) })
} },
} },
] ]
specialVisualizations.push(new AutoApplyButton(specialVisualizations)) specialVisualizations.push(new AutoApplyButton(specialVisualizations))
@ -2030,7 +2057,7 @@ export default class SpecialVisualizations {
throw ( throw (
"Invalid special visualisation found: funcName is undefined for " + "Invalid special visualisation found: funcName is undefined for " +
invalid.map((sp) => sp.i).join(", ") + invalid.map((sp) => sp.i).join(", ") +
'. Did you perhaps type \n funcName: "funcname" // type declaration uses COLON\ninstead of:\n funcName = "funcName" // value definition uses EQUAL' ". Did you perhaps type \n funcName: \"funcname\" // type declaration uses COLON\ninstead of:\n funcName = \"funcName\" // value definition uses EQUAL"
) )
} }