Themes(maxspeed): support forward/backward, fix #1127
All checks were successful
/ deploy_on_hosted (push) Successful in 20m50s
All checks were successful
/ deploy_on_hosted (push) Successful in 20m50s
This commit is contained in:
parent
45435703f9
commit
5515114be9
4 changed files with 109 additions and 11 deletions
|
@ -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"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
@ -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 === "") {
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
</script>
|
||||
|
||||
{#if tags?.length > 0}
|
||||
<div class="flex gap-x-4">
|
||||
|
||||
{#each tags as tag}
|
||||
<div class="break-words" style="word-break: break-word">
|
||||
{#if tag["value"] === ""}
|
||||
|
@ -25,6 +27,7 @@
|
|||
{/if}
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{:else}
|
||||
<slot name="no-tags">
|
||||
<Tr cls="subtle" t={Translations.t.general.noTagsSelected} />
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Add table
Reference in a new issue