forked from MapComplete/MapComplete
		
	Porting repair_station to JSON configuration file
This commit is contained in:
		
							parent
							
								
									b7b1bc13e4
								
							
						
					
					
						commit
						9e9d80c045
					
				
					 18 changed files with 455 additions and 503 deletions
				
			
		|  | @ -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: [], | ||||
|  |  | |||
|  | @ -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); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -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", "") | ||||
| 
 | ||||
|         ]; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue