| 
									
										
										
										
											2020-07-17 13:27:09 +02:00
										 |  |  | import {LayerDefinition} from "../LayerDefinition"; | 
					
						
							|  |  |  | import FixedText from "../Questions/FixedText"; | 
					
						
							|  |  |  | import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload"; | 
					
						
							| 
									
										
										
										
											2020-08-30 01:13:18 +02:00
										 |  |  | import {Tag} from "../../Logic/Tags"; | 
					
						
							| 
									
										
										
										
											2020-07-31 17:38:03 +02:00
										 |  |  | import {TagRenderingOptions} from "../TagRenderingOptions"; | 
					
						
							| 
									
										
										
										
											2020-07-17 13:27:09 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | export class Map extends LayerDefinition { | 
					
						
							|  |  |  |     constructor() { | 
					
						
							| 
									
										
										
										
											2020-07-31 04:58:58 +02:00
										 |  |  |         super("map"); | 
					
						
							| 
									
										
										
										
											2020-07-17 13:27:09 +02:00
										 |  |  |         this.name = "Map"; | 
					
						
							|  |  |  |         this.title = new FixedText("Map"); | 
					
						
							|  |  |  |         this.minzoom = 12; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         this.overpassFilter = new Tag("information", "map"); | 
					
						
							| 
									
										
										
										
											2020-07-29 18:35:46 +02:00
										 |  |  |         this.presets = [{ | 
					
						
							|  |  |  |             title: "Map", | 
					
						
							|  |  |  |             tags: [new Tag("tourism", "information"), new Tag("information", "map")] | 
					
						
							|  |  |  |         }]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-17 13:27:09 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         const isOsmSource = new Tag("map_source", "OpenStreetMap"); | 
					
						
							| 
									
										
										
										
											2020-07-29 18:35:46 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-17 13:27:09 +02:00
										 |  |  |         this.style = (properties) => { | 
					
						
							|  |  |  |             let icon = "assets/map.svg"; | 
					
						
							| 
									
										
										
										
											2020-07-29 18:35:46 +02:00
										 |  |  |             if (isOsmSource.matchesProperties(properties)) { | 
					
						
							| 
									
										
										
										
											2020-07-17 13:27:09 +02:00
										 |  |  |                 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-17 13:27:09 +02:00
										 |  |  |             }; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         this.elementsToShow = [ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             new ImageCarouselWithUploadConstructor(), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             new TagRenderingOptions({ | 
					
						
							|  |  |  |                 question: "Is this map based on OpenStreetMap?", | 
					
						
							|  |  |  |                 mappings: [ | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         k: isOsmSource, | 
					
						
							|  |  |  |                         txt: "This map is based on OpenStreetMap" | 
					
						
							|  |  |  |                     }, | 
					
						
							|  |  |  |                 ], | 
					
						
							|  |  |  |                 freeform: { | 
					
						
							|  |  |  |                     key: "map_source", | 
					
						
							|  |  |  |                     renderTemplate: "The map data is based on {map_source}", | 
					
						
							|  |  |  |                     template: "The map data is based on $$$" | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             }), | 
					
						
							|  |  |  |             new TagRenderingOptions({ | 
					
						
							|  |  |  |                 question: "Is the attribution present?", | 
					
						
							|  |  |  |                 mappings: [ | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         k: new Tag("map_source:attribution", "yes"), | 
					
						
							| 
									
										
										
										
											2020-08-07 20:50:46 +02:00
										 |  |  |                         txt: "OpenStreetMap is clearly attributed, including the ODBL-license" | 
					
						
							| 
									
										
										
										
											2020-07-17 13:27:09 +02:00
										 |  |  |                     }, | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         k: new Tag("map_source:attribution", "incomplete"), | 
					
						
							| 
									
										
										
										
											2020-08-07 20:50:46 +02:00
										 |  |  |                         txt: "OpenStreetMap is clearly attributed, but the license is not mentioned" | 
					
						
							| 
									
										
										
										
											2020-07-17 13:27:09 +02:00
										 |  |  |                     }, | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         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" | 
					
						
							|  |  |  |                     }, | 
					
						
							| 
									
										
										
										
											2020-07-17 14:24:31 +02:00
										 |  |  |                     { | 
					
						
							|  |  |  |                         k: new Tag("map_source:attribution", "none"), | 
					
						
							|  |  |  |                         txt: "There is no attribution at all" | 
					
						
							|  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2020-07-17 13:27:09 +02:00
										 |  |  |                 ] | 
					
						
							|  |  |  |             }).OnlyShowIf(new Tag("map_source", "OpenStreetMap")) | 
					
						
							|  |  |  |         ] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |