| 
									
										
										
										
											2020-06-24 00:35:19 +02:00
										 |  |  | import {LayerDefinition} from "../LayerDefinition"; | 
					
						
							| 
									
										
										
										
											2020-07-24 14:46:25 +02:00
										 |  |  | import {Or, Tag} from "../../Logic/TagsFilter"; | 
					
						
							| 
									
										
										
										
											2020-07-05 18:59:47 +02:00
										 |  |  | import {AccessTag} from "../Questions/AccessTag"; | 
					
						
							|  |  |  | import {OperatorTag} from "../Questions/OperatorTag"; | 
					
						
							|  |  |  | import {NameQuestion} from "../Questions/NameQuestion"; | 
					
						
							|  |  |  | import {NameInline} from "../Questions/NameInline"; | 
					
						
							| 
									
										
										
										
											2020-07-13 12:10:43 +02:00
										 |  |  | import {DescriptionQuestion} from "../Questions/DescriptionQuestion"; | 
					
						
							| 
									
										
										
										
											2020-07-14 20:18:44 +02:00
										 |  |  | import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload"; | 
					
						
							| 
									
										
										
										
											2020-06-24 00:35:19 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | export class Bos extends LayerDefinition { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     constructor() { | 
					
						
							| 
									
										
										
										
											2020-07-31 04:58:58 +02:00
										 |  |  |         super("bos"); | 
					
						
							| 
									
										
										
										
											2020-07-24 14:46:25 +02:00
										 |  |  |         this.name = "Bos"; | 
					
						
							|  |  |  |         this.icon = ""; | 
					
						
							| 
									
										
										
										
											2020-06-24 00:35:19 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         this.overpassFilter = new Or([ | 
					
						
							|  |  |  |                 new Tag("natural", "wood"), | 
					
						
							|  |  |  |                 new Tag("landuse", "forest"), | 
					
						
							|  |  |  |                 new Tag("natural", "scrub") | 
					
						
							|  |  |  |             ] | 
					
						
							|  |  |  |         ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-29 18:35:46 +02:00
										 |  |  |         this.presets = [{ | 
					
						
							|  |  |  |             title: "Bos", | 
					
						
							|  |  |  |             description: "Voeg een ontbrekend bos toe aan de kaart", | 
					
						
							|  |  |  |             icon: undefined, | 
					
						
							|  |  |  |             tags: [ | 
					
						
							|  |  |  |                 new Tag("landuse", "forest"), | 
					
						
							|  |  |  |                 new Tag("fixme", "Toegevoegd met MapComplete, geometry nog uit te tekenen") | 
					
						
							|  |  |  |             ] | 
					
						
							|  |  |  |         }]; | 
					
						
							| 
									
										
										
										
											2020-06-28 23:33:48 +02:00
										 |  |  |         this.maxAllowedOverlapPercentage = 10; | 
					
						
							| 
									
										
										
										
											2020-06-24 00:35:19 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-01 21:21:29 +02:00
										 |  |  |         this.minzoom = 13; | 
					
						
							| 
									
										
										
										
											2020-06-24 00:35:19 +02:00
										 |  |  |         this.style = this.generateStyleFunction(); | 
					
						
							| 
									
										
										
										
											2020-07-05 18:59:47 +02:00
										 |  |  |         this.title = new NameInline("bos"); | 
					
						
							| 
									
										
										
										
											2020-06-24 00:35:19 +02:00
										 |  |  |         this.elementsToShow = [ | 
					
						
							| 
									
										
										
										
											2020-07-14 20:18:44 +02:00
										 |  |  |             new ImageCarouselWithUploadConstructor(), | 
					
						
							| 
									
										
										
										
											2020-07-05 18:59:47 +02:00
										 |  |  |             new NameQuestion(), | 
					
						
							|  |  |  |             new AccessTag(), | 
					
						
							| 
									
										
										
										
											2020-07-13 12:10:43 +02:00
										 |  |  |             new OperatorTag(), | 
					
						
							|  |  |  |             new DescriptionQuestion("bos") | 
					
						
							| 
									
										
										
										
											2020-06-24 00:35:19 +02:00
										 |  |  |         ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     private generateStyleFunction() { | 
					
						
							|  |  |  |         const self = this; | 
					
						
							|  |  |  |         return function (properties: any) { | 
					
						
							|  |  |  |             let questionSeverity = 0; | 
					
						
							| 
									
										
										
										
											2020-07-05 18:59:47 +02:00
										 |  |  |             for (const qd of self.elementsToShow) { | 
					
						
							| 
									
										
										
										
											2020-07-13 13:17:03 +02:00
										 |  |  |                 if(qd instanceof DescriptionQuestion){ | 
					
						
							|  |  |  |                     continue; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |                  | 
					
						
							| 
									
										
										
										
											2020-07-05 18:59:47 +02:00
										 |  |  |                 if (qd.IsQuestioning(properties)) { | 
					
						
							| 
									
										
										
										
											2020-07-13 12:10:43 +02:00
										 |  |  |                     questionSeverity = Math.max(questionSeverity, qd.Priority()); | 
					
						
							| 
									
										
										
										
											2020-06-24 00:35:19 +02:00
										 |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             let colormapping = { | 
					
						
							|  |  |  |                 0: "#00bb00", | 
					
						
							|  |  |  |                 1: "#00ff00", | 
					
						
							|  |  |  |                 10: "#dddd00", | 
					
						
							|  |  |  |                 20: "#ff0000" | 
					
						
							|  |  |  |             }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             let colour = colormapping[questionSeverity]; | 
					
						
							|  |  |  |             while (colour == undefined) { | 
					
						
							|  |  |  |                 questionSeverity--; | 
					
						
							| 
									
										
										
										
											2020-07-05 18:59:47 +02:00
										 |  |  |                 colour = colormapping[questionSeverity]; | 
					
						
							| 
									
										
										
										
											2020-06-24 00:35:19 +02:00
										 |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             return { | 
					
						
							|  |  |  |                 color: colour, | 
					
						
							| 
									
										
										
										
											2020-07-01 17:38:48 +02:00
										 |  |  |                 icon: undefined | 
					
						
							| 
									
										
										
										
											2020-06-24 00:35:19 +02:00
										 |  |  |             }; | 
					
						
							|  |  |  |         }; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |