diff --git a/assets/layers/maxspeed/maxspeed.json b/assets/layers/maxspeed/maxspeed.json index 6f8629560..2e255a31c 100644 --- a/assets/layers/maxspeed/maxspeed.json +++ b/assets/layers/maxspeed/maxspeed.json @@ -102,7 +102,13 @@ "render": "#000000", "mappings": [ { - "if": "maxspeed=", + "if": { + "and": [ + "maxspeed=", + "maxspeed:forward=", + "maxspeed:backward=" + ] + }, "then": "#ff0000" } ] @@ -112,6 +118,7 @@ ], "tagRenderings": [ { + "id": "maxspeed-maxspeed", "render": { "en": "The maximum allowed speed on this road is {canonical(maxspeed)}", "de": "Die zulässige Höchstgeschwindigkeit auf dieser Straße beträgt {canonical(maxspeed)}", @@ -135,7 +142,10 @@ }, "freeform": { "key": "maxspeed", - "type": "pnat" + "type": "pnat", + "addExtraTags": [ + "_forward_backward=no" + ] }, "mappings": [ { @@ -162,9 +172,70 @@ "maxspeed=20" ], "hideInAnswer": "_country!=be" + }, + { + "if": { + "and": [ + "maxspeed=", + "_forward_backward=yes" + ] + }, + "then": { + "en": "The maximum allowed speed on this road depends on the direction a vehicle goes" + } } ], - "id": "maxspeed-maxspeed" + "condition": { + "or": [ + "maxspeed~*", + { + "and": [ + "maxspeed:forward=", + "maxspeed:backward=" + ] + } + ] + } + }, + { + "id": "maxspeed-forward", + "condition": { + "or": [ + "maxspeed:backward~*", + "maxspeed:forward~*", + "_forward_backward=yes" + ] + }, + "question": { + "en": "What is the maximum allowed speed when travelling {direction_absolute()}?" + }, + "render": { + "en": "The maximum allowed speed when travelling {direction_absolute()} on this road is {canonical(maxspeed:forward)}" + }, + "freeform": { + "key": "maxspeed:forward", + "type": "pnat" + } + }, + { + "id": "maxspeed-backward", + "condition": { + "or": [ + "maxspeed:forward~*", + "maxspeed:backward~*", + "_forward_backward=yes" + ] + }, + "question": { + "en": "What is the maximum allowed speed when travelling {direction_absolute(,180)}?" + }, + "render": { + "en": "The maximum allowed speed when travelling {direction_absolute(,180)} on this road is {canonical(maxspeed:backward)}" + }, + "freeform": { + "key": "maxspeed:backward", + "type": "pnat" + } } ], "allowMove": false, @@ -177,6 +248,20 @@ "denominations": [ "mph" ] + }, + "maxspeed:forward": { + "quantity": "speed", + "canonical": "kmh", + "denominations": [ + "mph" + ] + }, + "maxspeed:backward": { + "quantity": "speed", + "canonical": "kmh", + "denominations": [ + "mph" + ] } } ] diff --git a/src/Logic/Osm/Changes.ts b/src/Logic/Osm/Changes.ts index 34a498afc..ed2b8c1f4 100644 --- a/src/Logic/Osm/Changes.ts +++ b/src/Logic/Osm/Changes.ts @@ -445,6 +445,10 @@ export class Changes { // Apply tag changes for (const kv of change.tags ?? []) { const k = kv.k + if (k.startsWith("_")) { + // These values are ignored later on anyways + continue + } let v = kv.v if (v === "") { diff --git a/src/UI/Popup/TagHint.svelte b/src/UI/Popup/TagHint.svelte index 49549507c..3954d8ef2 100644 --- a/src/UI/Popup/TagHint.svelte +++ b/src/UI/Popup/TagHint.svelte @@ -14,6 +14,8 @@ {#if tags?.length > 0} +
+ {#each tags as tag}
{#if tag["value"] === ""} @@ -25,6 +27,7 @@ {/if}
{/each} +
{:else} diff --git a/src/UI/SpecialVisualizations.ts b/src/UI/SpecialVisualizations.ts index 6bd8753bd..0c1c89f30 100644 --- a/src/UI/SpecialVisualizations.ts +++ b/src/UI/SpecialVisualizations.ts @@ -1,11 +1,7 @@ import { FixedUiElement } from "./Base/FixedUiElement" import BaseUIElement from "./BaseUIElement" import { default as FeatureTitle } from "./Popup/Title.svelte" -import { - RenderingSpecification, - SpecialVisualization, - SpecialVisualizationState, -} from "./SpecialVisualization" +import { RenderingSpecification, SpecialVisualization, SpecialVisualizationState } from "./SpecialVisualization" import { HistogramViz } from "./Popup/HistogramViz" import { UploadToOsmViz } from "./Popup/UploadToOsmViz" import { MultiApplyViz } from "./Popup/MultiApplyViz" @@ -40,8 +36,11 @@ import { UISpecialVisualisations } from "./SpecialVisualisations/UISpecialVisual import { SettingsVisualisations } from "./SpecialVisualisations/SettingsVisualisations" import { ReviewSpecialVisualisations } from "./SpecialVisualisations/ReviewSpecialVisualisations" import { DataImportSpecialVisualisations } from "./SpecialVisualisations/DataImportSpecialVisualisations" -import TagrenderingManipulationSpecialVisualisations from "./SpecialVisualisations/TagrenderingManipulationSpecialVisualisations" -import { WebAndCommunicationSpecialVisualisations } from "./SpecialVisualisations/WebAndCommunicationSpecialVisualisations" +import TagrenderingManipulationSpecialVisualisations + from "./SpecialVisualisations/TagrenderingManipulationSpecialVisualisations" +import { + WebAndCommunicationSpecialVisualisations +} from "./SpecialVisualisations/WebAndCommunicationSpecialVisualisations" import ClearGPSHistory from "./BigComponents/ClearGPSHistory.svelte" import AllFeaturesStatistics from "./Statistics/AllFeaturesStatistics.svelte" @@ -524,6 +523,11 @@ export default class SpecialVisualizations { doc: "The attribute containing the degrees", defaultValue: "_direction:centerpoint", }, + { + name: "offset", + doc: "Offset value that is added to the actual value, e.g. `180` to indicate the opposite (backward) direction", + defaultValue: "0" + } ], constr( @@ -532,6 +536,8 @@ export default class SpecialVisualizations { args: string[] ): BaseUIElement { const key = args[0] === "" ? "_direction:centerpoint" : args[0] + const offset = args[1] === "" ? 0 : Number(args[1]) + return new VariableUiElement( tagSource .map((tags) => { @@ -540,7 +546,7 @@ export default class SpecialVisualizations { }) .mapD((value) => { const dir = GeoOperations.bearingToHuman( - GeoOperations.parseBearing(value) + GeoOperations.parseBearing(value) + offset ) console.log("Human dir", dir) return Translations.t.general.visualFeedback.directionsAbsolute[dir]