| 
									
										
										
										
											2020-07-18 20:40:51 +02:00
										 |  |  | import {LayerDefinition} from "../LayerDefinition"; | 
					
						
							|  |  |  | import FixedText from "../Questions/FixedText"; | 
					
						
							|  |  |  | import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload"; | 
					
						
							|  |  |  | import {TagRenderingOptions} from "../TagRendering"; | 
					
						
							|  |  |  | import {And, Tag} from "../../Logic/TagsFilter"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export class InformationBoard extends LayerDefinition { | 
					
						
							|  |  |  |     constructor() { | 
					
						
							|  |  |  |         super({ | 
					
						
							|  |  |  |             name: "Informatiebord", | 
					
						
							| 
									
										
										
										
											2020-07-26 02:01:34 +02:00
										 |  |  |             description: "Een informatiebord of kaart", | 
					
						
							| 
									
										
										
										
											2020-07-18 20:40:51 +02:00
										 |  |  |             minzoom: 12, | 
					
						
							|  |  |  |             overpassFilter: new Tag("tourism", "information"), | 
					
						
							| 
									
										
										
										
											2020-07-29 18:35:46 +02:00
										 |  |  |             presets: [{ | 
					
						
							|  |  |  |                 title: "Informatiebord", | 
					
						
							|  |  |  |                 icon: "/assets/nature/info.png", | 
					
						
							|  |  |  |                 tags: [new Tag("tourism", "information")] | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |                 { | 
					
						
							|  |  |  |                     title: "Kaart", | 
					
						
							|  |  |  |                     icon: "/assets/map.svg", | 
					
						
							|  |  |  |                     tags: [new Tag("tourism", "information"), new Tag("information", "map")] | 
					
						
							|  |  |  |                 }], | 
					
						
							| 
									
										
										
										
											2020-07-18 20:40:51 +02:00
										 |  |  |             maxAllowedOverlapPercentage: 0, | 
					
						
							|  |  |  |             icon: "assets/nature/info.png", | 
					
						
							|  |  |  |         }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         const isMap = new Tag("information", "map"); | 
					
						
							|  |  |  |         const isOsmSource = new Tag("map_source", "OpenStreetMap"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         this.title = new TagRenderingOptions({ | 
					
						
							|  |  |  |             mappings: [ | 
					
						
							|  |  |  |                 {k: isMap, txt: "Kaart"}, | 
					
						
							|  |  |  |                 {k:null, txt: "Informatiebord"} | 
					
						
							|  |  |  |             ] | 
					
						
							|  |  |  |         }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         this.style = (properties) => { | 
					
						
							|  |  |  |             let icon = "assets/nature/info.png"; | 
					
						
							|  |  |  |             if (isMap.matchesProperties(properties)) { | 
					
						
							|  |  |  |                 icon = "assets/map.svg"; | 
					
						
							|  |  |  |                 if (isOsmSource.matchesProperties(properties)) { | 
					
						
							|  |  |  |                     icon = "assets/osm-logo-white-bg.svg"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     const attr = properties["map_source:attribution"]; | 
					
						
							|  |  |  |                     if (attr == "sticker") { | 
					
						
							|  |  |  |                         icon = "assets/map-stickered.svg" | 
					
						
							|  |  |  |                     } else if (attr == "no") { | 
					
						
							|  |  |  |                         icon = "assets/osm-logo-buggy-attr.svg" | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             return { | 
					
						
							|  |  |  |                 color: "#000000", | 
					
						
							| 
									
										
										
										
											2020-07-26 02:01:34 +02:00
										 |  |  |                 icon: { | 
					
						
							|  |  |  |                     iconUrl: icon, | 
					
						
							|  |  |  |                     iconSize: [50, 50] | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2020-07-18 20:40:51 +02:00
										 |  |  |             }; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         this.elementsToShow = [ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             new ImageCarouselWithUploadConstructor(), | 
					
						
							|  |  |  |              | 
					
						
							|  |  |  |             new TagRenderingOptions({ | 
					
						
							|  |  |  |                 question: "Heeft dit informatiebord een kaart?", | 
					
						
							|  |  |  |                 mappings: [ | 
					
						
							|  |  |  |                     {k: new Tag("information","board"), txt: "Dit is een informatiebord"}, | 
					
						
							|  |  |  |                     {k: isMap, txt: "Dit is een kaart"} | 
					
						
							|  |  |  |                 ] | 
					
						
							|  |  |  |             }), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             new TagRenderingOptions({ | 
					
						
							|  |  |  |                 question: "Is this map based on OpenStreetMap?", | 
					
						
							|  |  |  |                 mappings: [ | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         k: isOsmSource, | 
					
						
							|  |  |  |                         txt: "This map is based on OpenStreetMap" | 
					
						
							|  |  |  |                     }, | 
					
						
							| 
									
										
										
										
											2020-07-19 00:13:45 +02:00
										 |  |  |                     { | 
					
						
							|  |  |  |                         k: new And([new Tag("map_source:attribution", ""), new Tag("map_source","")]), | 
					
						
							|  |  |  |                         txt: "Unknown" | 
					
						
							|  |  |  |                     }, | 
					
						
							| 
									
										
										
										
											2020-07-18 20:40:51 +02:00
										 |  |  |                 ], | 
					
						
							|  |  |  |                 freeform: { | 
					
						
							|  |  |  |                     key: "map_source", | 
					
						
							| 
									
										
										
										
											2020-07-19 00:13:45 +02:00
										 |  |  |                     extraTags: new Tag("map_source:attribution", ""), | 
					
						
							| 
									
										
										
										
											2020-07-18 20:40:51 +02:00
										 |  |  |                     renderTemplate: "The map data is based on {map_source}", | 
					
						
							|  |  |  |                     template: "The map data is based on $$$" | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             }).OnlyShowIf(isMap), | 
					
						
							|  |  |  |             new TagRenderingOptions({ | 
					
						
							|  |  |  |                 question: "Is the attribution present?", | 
					
						
							|  |  |  |                 mappings: [ | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         k: new Tag("map_source:attribution", "yes"), | 
					
						
							|  |  |  |                         txt: "OpenStreetMap is clearly attribute, including the ODBL-license" | 
					
						
							|  |  |  |                     }, | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         k: new Tag("map_source:attribution", "incomplete"), | 
					
						
							|  |  |  |                         txt: "OpenStreetMap is clearly attribute, but the license is not mentioned" | 
					
						
							|  |  |  |                     }, | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         k: new Tag("map_source:attribution", "sticker"), | 
					
						
							|  |  |  |                         txt: "OpenStreetMap wasn't mentioned, but someone put an OpenStreetMap-sticker on it" | 
					
						
							|  |  |  |                     }, | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         k: new Tag("map_source:attribution", "no"), | 
					
						
							|  |  |  |                         txt: "There is no attribution at all" | 
					
						
							|  |  |  |                     }, | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         k: new Tag("map_source:attribution", "none"), | 
					
						
							|  |  |  |                         txt: "There is no attribution at all" | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                 ] | 
					
						
							|  |  |  |             }).OnlyShowIf(new Tag("map_source", "OpenStreetMap")) | 
					
						
							|  |  |  |         ] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |