Porting repair_station to JSON configuration file

This commit is contained in:
Pieter Vander Vennet 2020-09-05 17:43:30 +02:00
parent b7b1bc13e4
commit 9e9d80c045
18 changed files with 455 additions and 503 deletions

View file

@ -5,19 +5,31 @@ import {TagRenderingConfigJson} from "../../Customizations/JSON/TagRenderingConf
export class GenerateEmpty {
public static createEmptyLayer(): LayerConfigJson {
return {
id: undefined,
name: undefined,
minzoom: 0,
id: "yourlayer",
name: "Layer",
minzoom: 12,
overpassTags: {and: [""]},
title: undefined,
title: "Layer",
description: {},
tagRenderings: [],
icon: {
render: "./assets/bug.svg"
},
width: {
render: "8"
},
iconSize:{
render: "40,40,center"
},
color:{
render: "#00f"
}
}
}
public static createEmptyLayout(): LayoutConfigJson {
return {
id: "",
id: "id",
title: {},
description: {},
language: [],

View file

@ -170,25 +170,29 @@ export default class LayerPanel extends UIElement {
{
title: "Icon",
description: "A visual representation for this layer and for the points on the map.",
disableQuestions: true
disableQuestions: true,
noLanguage: true
});
const size = new TagRenderingPanel(languages, currentlySelected, userDetails,
{
title: "Icon Size",
description: "The size of the icons on the map in pixels. Can vary based on the tagging",
disableQuestions: true
disableQuestions: true,
noLanguage: true
});
const color = new TagRenderingPanel(languages, currentlySelected, userDetails,
{
title: "Way and area color",
description: "The color or a shown way or area. Can vary based on the tagging",
disableQuestions: true
disableQuestions: true,
noLanguage: true
});
const stroke = new TagRenderingPanel(languages, currentlySelected, userDetails,
{
title: "Stroke width",
description: "The width of lines representing ways and the outline of areas. Can vary based on the tags",
disableQuestions: true
disableQuestions: true,
noLanguage: true
});
this.registerTagRendering(iconSelect);
this.registerTagRendering(size);
@ -201,9 +205,9 @@ export default class LayerPanel extends UIElement {
return new SettingsTable([
setting(iconSelect, "icon"),
setting(size, "size"),
setting(size, "iconSize"),
setting(color, "color"),
setting(stroke, "stroke")
setting(stroke, "width")
], currentlySelected);
}

View file

@ -31,7 +31,8 @@ export default class TagRenderingPanel extends InputElement<TagRenderingConfigJs
title?: string,
description?: string,
disableQuestions?: boolean,
isImage?: boolean
isImage?: boolean,
noLanguage?: boolean
}) {
super();
@ -56,8 +57,9 @@ export default class TagRenderingPanel extends InputElement<TagRenderingConfigJs
const questionSettings = [
setting(new MultiLingualTextFields(languages), "question", "Question", "If the key or mapping doesn't match, this question is asked"),
setting(options?.noLanguage ? TextField.StringInput() : new MultiLingualTextFields(languages)
, "question", "Question", "If the key or mapping doesn't match, this question is asked"),
setting(new AndOrTagInput(), "condition", "Condition",
"Only show this tag rendering if these tags matches. Optional field.<br/>Note that the Overpass-tags are already always included in this object"),
@ -76,7 +78,9 @@ export default class TagRenderingPanel extends InputElement<TagRenderingConfigJs
];
const settings: (string | SingleSetting<any>)[] = [
setting(new MultiLingualTextFields(languages), "render", "Value to show", " Renders this value. Note that <span class='literal-code'>{key}</span>-parts are substituted by the corresponding values of the element. If neither 'textFieldQuestion' nor 'mappings' are defined, this text is simply shown as default value."),
setting(
options?.noLanguage ? TextField.StringInput() :
new MultiLingualTextFields(languages), "render", "Value to show", " Renders this value. Note that <span class='literal-code'>{key}</span>-parts are substituted by the corresponding values of the element. If neither 'textFieldQuestion' nor 'mappings' are defined, this text is simply shown as default value."),
questionsNotUnlocked ? `You need at least ${State.userJourney.themeGeneratorFullUnlock} changesets to unlock the 'question'-field and to use your theme to edit OSM data`: "",
...(options?.disableQuestions ? [] : questionSettings),
@ -85,7 +89,7 @@ export default class TagRenderingPanel extends InputElement<TagRenderingConfigJs
setting(new MultiInput<{ if: AndOrTagConfigJson, then: (string | any), hideInAnswer?: boolean }>("Add a mapping",
() => ({if: undefined, then: undefined}),
() => new MappingInput(languages, options?.disableQuestions ?? false)), "mappings",
"Mappings", "")
"If a tag matches, then show the respective text", "")
];

View file

@ -37,7 +37,7 @@ export class SimpleAddUI extends UIElement {
this.ListenTo(State.state.osmConnection.userDetails);
this.ListenTo(State.state.layerUpdater.runningQuery);
this.ListenTo(this._confirmPreset);
this.ListenTo(State.state.locationControl);
this._loginButton = Translations.t.general.add.pleaseLogin.Clone().onClick(() => State.state.osmConnection.AttemptLogin());

View file

@ -51,7 +51,9 @@ export default class Translations {
gl: 'estación de bicicletas (arranxo, bomba de ar ou ambos)'
}),
// title: new T({en: 'Bike station', nl: 'Fietsstation', fr: 'Station vélo', gl: 'Estación de bicicletas'}), Old, non-dynamic title
titlePump: new T({en: 'Bike pump', nl: 'Fietspomp', fr: 'TODO: fr', gl: 'Bomba de ar'}),
titlePump: new T({
}),
titleRepair: new T({
en: 'Bike repair station',
nl: 'Herstelpunt',
@ -64,104 +66,16 @@ export default class Translations {
fr: 'Point station velo avec pompe',
gl: 'Estación de bicicletas (arranxo e bomba de ar)'
}),
manometer: {
question: new T({
en: 'Does the pump have a pressure indicator or manometer?',
nl: 'Heeft deze pomp een luchtdrukmeter?',
fr: 'Est-ce que la pompe à un manomètre integré?',
gl: 'Ten a bomba de ar un indicador de presión ou un manómetro?'
}),
yes: new T({
en: 'There is a manometer',
nl: 'Er is een luchtdrukmeter',
fr: 'Il y a un manomètre',
gl: 'Hai manómetro'
}),
no: new T({
en: 'There is no manometer',
nl: 'Er is geen luchtdrukmeter',
fr: 'Il n\'y a pas de manomètre',
gl: 'Non hai manómetro'
}),
broken: new T({
en: 'There is manometer but it is broken',
nl: 'Er is een luchtdrukmeter maar die is momenteel defect',
fr: 'Il y a un manomètre mais il est cassé',
gl: 'Hai manómetro pero está estragado'
})
},
electric: {
question: new T({
en: 'Is this an electric bike pump?',
nl: 'Is dit een electrische fietspomp?',
fr: 'Est-ce que cette pompe est électrique?',
gl: 'Esta é unha bomba de ar eléctrica?'
}),
manual: new T({
en: 'Manual pump',
nl: 'Manuele pomp',
fr: 'Pompe manuelle',
gl: 'Bomba de ar manual'
}),
electric: new T({
en: 'Electrical pump',
nl: 'Electrische pomp',
fr: 'Pompe électrique',
gl: 'Bomba de ar eléctrica'
})
},
operational: {
question: new T({
en: 'Is the bike pump still operational?',
nl: 'Werkt de fietspomp nog?',
fr: 'Est-ce que cette pompe marche t\'elle toujours?',
gl: 'Segue a funcionar a bomba de ar?'
}),
operational: new T({
en: 'The bike pump is operational',
nl: 'De fietspomp werkt nog',
fr: 'La pompe est opérationnelle',
gl: 'A bomba de ar está operativa'
}),
broken: new T({
en: 'The bike pump is broken',
nl: 'De fietspomp is kapot',
fr: 'La pompe est cassé',
gl: 'A bomba de ar está estragada'
})
},
valves: {
question: new T({
en: 'What valves are supported?',
nl: 'Welke ventielen werken er met de pomp?',
fr: 'Quelles valves sont compatibles?',
gl: 'Que válvulas son compatíbeis?'
}),
default: new T({
en: 'There is a default head, so Dunlop, Sclaverand and auto',
nl: 'Er is een standaard aansluiting, die dus voor Dunlop, Sclaverand en auto\'s werkt',
fr: 'Il y a une valve par défaut, fonctionnant sur les valves Dunlop, Sclaverand et les valves de voitures',
gl: 'Hai un cabezal predeterminado que é compatíbel con Dunlop, Sclaverand e automóbil'
}),
dunlop: new T({en: 'Only Dunlop', nl: 'Enkel Dunlop', fr: 'TODO: fr', gl: 'Só Dunlop'}),
}),
dunlop: new T({}),
sclaverand: new T({
en: 'Only Sclaverand (also known as Presta)',
nl: 'Enkel Sclaverand (ook gekend als Presta)',
fr: 'Seulement Sclaverand (aussi appelé Presta)',
gl: 'Só Sclaverand (tamén coñecido como Presta)'
}),
auto: new T({
en: 'Only for cars',
nl: 'Enkel voor auto\'s',
fr: 'TODO: fr',
gl: 'Só para automóbiles'
}),
render: new T({
en: 'This pump supports the following valves: {valves}',
nl: 'Deze pomp werkt met de volgende ventielen: {valves}',
fr: 'Cette pompe est compatible avec les valves suivantes: {valves}',
gl: 'Esta bomba de ar admite as seguintes válvulas: {valves}'
}),
template: new T({
en: 'Some other valve(s): $$$',
nl: 'Een ander type ventiel(en): $$$',
@ -169,99 +83,6 @@ export default class Translations {
gl: 'Algunha outra válvula: $$$'
})
},
chain: {
question: new T({
en: 'Does this bike repair station have a special tool to repair your bike chain?',
nl: 'Heeft dit herstelpunt een speciale reparatieset voor je ketting?',
fr: 'Est-ce que cette station vélo a un outils specifique pour réparer la chaîne du velo?',
gl: 'Esta estación de arranxo de bicicletas ten unha ferramenta especial para arranxar a cadea da túa bicicleta?'
}),
yes: new T({
en: 'There is a chain tool',
nl: 'Er is een reparatieset voor je ketting',
fr: 'Il y a un outil pour réparer la chaine',
gl: 'Hai unha ferramenta para a cadea'
}),
no: new T({
en: 'There is no chain tool',
nl: 'Er is geen reparatieset voor je ketting',
fr: 'Il n\'y a pas d\'outil pour réparer la chaine',
gl: 'Non hai unha ferramenta para a cadea'
}),
},
operator: {
render: new T({
en: 'This bike station is operated by {operator}',
nl: 'Dit fietspunt wordt beheerd door {operator}',
fr: 'Cette station vélo est opéré par {operator}',
gl: 'Esta estación de bicicletas es operada por {operator}'
}),
template: new T({
en: 'A different operator: $$$',
nl: 'Een andere beheerder: $$$',
fr: 'TODO: fr',
gl: 'Un operador diferente: $$$'
}),
question: new T({
en: 'Who operates this bike station (name of university, shop, city...)?',
nl: 'Wie beheert dit fietsstation (naam universiteit, winkel, stad...)?',
fr: 'Qui opére cette station vélo (nom de l\'université, magasin, ville...)?',
gl: 'Quen opera esta estación de bicicletas (nome da universidade, tenda, concello...)?'
}),
private: new T({
en: 'Operated by a private person',
nl: 'Wordt beheerd door een privépersoon',
fr: 'Operé par un tier privé',
gl: 'Operado por unha persoa privada'
}),
},
services: {
question: new T({
en: "Which services are available at this bike station?",
nl: "Welke functies biedt dit fietspunt?",
fr: "Quels services sont valables à cette station vélo?",
gl: "Que servizos están dispoñíbeis nesta estación de bicicletas?"
}),
pump: new T({
// Note: this previously read: a pump is available. It is not because the pump is present, that it is available (e.g. broken)
en: "There is only a pump present",
nl: "Er is enkel een pomp aanwezig",
fr: "Il y a seulement une pompe",
gl: "Só hai unha bomba de ar presente"
}),
tools: new T({
en: "There are only tools (screwdrivers, pliers...) present",
nl: "Er is enkel gereedschap aanwezig (schroevendraaier, tang...)",
fr: "Il y a seulement des outils (tournevis, pinces...)",
gl: "Só hai ferramentas (desaparafusadores, alicates...) presentes"
}),
both: new T({
en: "There are both tools and a pump present",
nl: "Er is zowel een pomp als gereedschap aanwezig",
fr: "IL y a des outils et une pompe",
gl: "Hai ferramentas e unha bomba de ar presentes"
}),
},
stand: {
question: new T({
en: "Does this bike station have a hook to suspend your bike with or a stand to elevate it?",
nl: "Heeft dit herstelpunt een haak of standaard om je fiets op te hangen/zetten?",
fr: "Est-ce que cette station vélo à un crochet pour suspendre son velo ou une accroche pour l'élevé?",
gl: "Esta estación de bicicletas ten un guindastre para pendurar a túa bicicleta ou un soporte para elevala?"
}),
yes: new T({
en: "There is a hook or stand",
nl: "Er is een haak of standaard",
fr: "Oui il y a un crochet ou une accroche",
gl: "Hai un guindastre ou soporte"
}),
no: new T({
en: "There is no hook or stand",
nl: "Er is geen haak of standaard",
fr: "Non il n'y pas de crochet ou d'accroche",
gl: "Non hai un guindastre ou soporte"
}),
},
},
shop: {
name: new T({