| 
									
										
										
										
											2020-07-29 15:55:50 +02:00
										 |  |  | import {LayerDefinition} from "../LayerDefinition"; | 
					
						
							|  |  |  | import FixedText from "../Questions/FixedText"; | 
					
						
							|  |  |  | import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload"; | 
					
						
							|  |  |  | import Translations from "../../UI/i18n/Translations"; | 
					
						
							|  |  |  | import CafeName from "../Questions/bike/CafeName"; | 
					
						
							|  |  |  | import { Or, And, Tag, anyValueExcept, Regex } from "../../Logic/TagsFilter"; | 
					
						
							|  |  |  | import { PhoneNumberQuestion } from "../Questions/PhoneNumberQuestion"; | 
					
						
							|  |  |  | import Website from "../Questions/Website"; | 
					
						
							|  |  |  | import CafeRepair from "../Questions/bike/CafeRepair"; | 
					
						
							|  |  |  | import CafeDiy from "../Questions/bike/CafeDiy"; | 
					
						
							|  |  |  | import CafePump from "../Questions/bike/CafePump"; | 
					
						
							| 
									
										
										
										
											2020-07-29 19:02:36 +02:00
										 |  |  | import {EmailQuestion} from "../Questions/EmailQuestion"; | 
					
						
							| 
									
										
										
										
											2020-07-29 15:55:50 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export default class BikeCafes extends LayerDefinition { | 
					
						
							|  |  |  |     private readonly to = Translations.t.cyclofix.cafe | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     constructor() { | 
					
						
							| 
									
										
										
										
											2020-07-29 17:16:59 +02:00
										 |  |  |         super() | 
					
						
							|  |  |  |         this.name = this.to.name | 
					
						
							|  |  |  |         this.icon = "./assets/bike/cafe.svg" | 
					
						
							| 
									
										
										
										
											2020-07-29 15:55:50 +02:00
										 |  |  |         this.overpassFilter = new And([ | 
					
						
							| 
									
										
										
										
											2020-07-29 17:16:59 +02:00
										 |  |  |             new Tag("amenity", /^pub|bar|cafe$/), | 
					
						
							| 
									
										
										
										
											2020-07-29 15:55:50 +02:00
										 |  |  |             new Or([ | 
					
						
							| 
									
										
										
										
											2020-07-29 17:16:59 +02:00
										 |  |  |                 new Tag(/^service:bicycle:/, "*"), | 
					
						
							| 
									
										
										
										
											2020-07-29 15:55:50 +02:00
										 |  |  |                 new Tag("pub", "cycling") | 
					
						
							|  |  |  |             ]) | 
					
						
							|  |  |  |         ])  | 
					
						
							| 
									
										
										
										
											2020-07-29 18:35:46 +02:00
										 |  |  |          | 
					
						
							|  |  |  |         this.presets = [ | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 title: Translations.t.cyclofix.cafe.title, | 
					
						
							|  |  |  |                 tags :  [ | 
					
						
							|  |  |  |                     new Tag("amenity", "pub"), | 
					
						
							|  |  |  |                     new Tag("pub", "cycling"), | 
					
						
							|  |  |  |                 ] | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         ] | 
					
						
							|  |  |  |          | 
					
						
							| 
									
										
										
										
											2020-07-29 15:55:50 +02:00
										 |  |  |         this.maxAllowedOverlapPercentage = 10; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-29 17:16:59 +02:00
										 |  |  |         this.minzoom = 13 | 
					
						
							|  |  |  |         this.style = this.generateStyleFunction() | 
					
						
							| 
									
										
										
										
											2020-07-29 15:55:50 +02:00
										 |  |  |         this.title = new FixedText(this.to.title) | 
					
						
							|  |  |  |         this.elementsToShow = [ | 
					
						
							|  |  |  |             new ImageCarouselWithUploadConstructor(), | 
					
						
							|  |  |  |             new CafeName(), | 
					
						
							|  |  |  |             new Website("{name}"), | 
					
						
							| 
									
										
										
										
											2020-07-29 19:02:36 +02:00
										 |  |  |             new PhoneNumberQuestion("{name}"), | 
					
						
							|  |  |  |             new EmailQuestion("{name}"), | 
					
						
							| 
									
										
										
										
											2020-07-29 15:55:50 +02:00
										 |  |  |             new CafeRepair(), | 
					
						
							|  |  |  |             new CafeDiy(), | 
					
						
							|  |  |  |             new CafePump() | 
					
						
							| 
									
										
										
										
											2020-07-29 17:16:59 +02:00
										 |  |  |         ] | 
					
						
							|  |  |  |         this.wayHandling = LayerDefinition.WAYHANDLING_CENTER_AND_WAY | 
					
						
							| 
									
										
										
										
											2020-07-29 15:55:50 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     private generateStyleFunction() { | 
					
						
							| 
									
										
										
										
											2020-07-29 17:16:59 +02:00
										 |  |  |         const self = this | 
					
						
							| 
									
										
										
										
											2020-07-29 15:55:50 +02:00
										 |  |  |         return function (properties: any) { | 
					
						
							|  |  |  |             return { | 
					
						
							|  |  |  |                 color: "#00bb00", | 
					
						
							|  |  |  |                 icon: { | 
					
						
							|  |  |  |                     iconUrl: self.icon, | 
					
						
							|  |  |  |                     iconSize: [50, 50], | 
					
						
							|  |  |  |                     iconAnchor: [25,50] | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2020-07-29 17:16:59 +02:00
										 |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2020-07-29 15:55:50 +02:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2020-07-29 19:02:36 +02:00
										 |  |  | } |