| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  | import Combine from "../Base/Combine" | 
					
						
							|  |  |  | import Toggle from "../Input/Toggle" | 
					
						
							|  |  |  | import MapControlButton from "../MapControlButton" | 
					
						
							|  |  |  | import Svg from "../../Svg" | 
					
						
							|  |  |  | import AllDownloads from "./AllDownloads" | 
					
						
							|  |  |  | import { Store, UIEventSource } from "../../Logic/UIEventSource" | 
					
						
							|  |  |  | import Lazy from "../Base/Lazy" | 
					
						
							|  |  |  | import { VariableUiElement } from "../Base/VariableUIElement" | 
					
						
							| 
									
										
										
										
											2023-01-06 03:44:04 +01:00
										 |  |  | import { DefaultGuiState } from "../DefaultGuiState" | 
					
						
							| 
									
										
										
										
											2021-07-28 16:48:59 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | export default class LeftControls extends Combine { | 
					
						
							| 
									
										
										
										
											2023-01-06 03:44:04 +01:00
										 |  |  |     constructor(state: FeaturePipelineState, guiState: DefaultGuiState) { | 
					
						
							| 
									
										
										
										
											2021-12-10 17:30:50 +01:00
										 |  |  |         const currentViewFL = state.currentView?.layer | 
					
						
							|  |  |  |         const currentViewAction = new Toggle( | 
					
						
							|  |  |  |             new Lazy(() => { | 
					
						
							| 
									
										
										
										
											2023-03-24 19:21:15 +01:00
										 |  |  |                 const feature: Store<any> = state.currentView.features.map((ffs) => ffs[0]) | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  |                 const icon = new VariableUiElement( | 
					
						
							|  |  |  |                     feature.map((feature) => { | 
					
						
							|  |  |  |                         const defaultIcon = Svg.checkbox_empty_svg() | 
					
						
							|  |  |  |                         if (feature === undefined) { | 
					
						
							|  |  |  |                             return defaultIcon | 
					
						
							|  |  |  |                         } | 
					
						
							|  |  |  |                         const tags = { ...feature.properties, button: "yes" } | 
					
						
							|  |  |  |                         const elem = currentViewFL.layerDef.mapRendering[0]?.GetSimpleIcon( | 
					
						
							|  |  |  |                             new UIEventSource(tags) | 
					
						
							|  |  |  |                         ) | 
					
						
							|  |  |  |                         if (elem === undefined) { | 
					
						
							|  |  |  |                             return defaultIcon | 
					
						
							|  |  |  |                         } | 
					
						
							|  |  |  |                         return elem | 
					
						
							|  |  |  |                     }) | 
					
						
							|  |  |  |                 ).SetClass("inline-block w-full h-full") | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-08 02:56:49 +01:00
										 |  |  |                 feature.map((feature) => { | 
					
						
							|  |  |  |                     if (feature === undefined) { | 
					
						
							|  |  |  |                         return undefined | 
					
						
							|  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2022-12-16 13:45:07 +01:00
										 |  |  |                     const tagsSource = state.allElements.getEventSourceById(feature.properties.id) | 
					
						
							| 
									
										
										
										
											2022-12-08 02:56:49 +01:00
										 |  |  |                     return new FeatureInfoBox(tagsSource, currentViewFL.layerDef, state, { | 
					
						
							|  |  |  |                         hashToShow: "currentview", | 
					
						
							|  |  |  |                         isShown: guiState.currentViewControlIsOpened, | 
					
						
							| 
									
										
										
										
											2021-12-10 17:30:50 +01:00
										 |  |  |                     }) | 
					
						
							| 
									
										
										
										
											2022-12-08 02:56:49 +01:00
										 |  |  |                 }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 return new MapControlButton(icon) | 
					
						
							| 
									
										
										
										
											2021-12-11 02:19:28 +01:00
										 |  |  |             }).onClick(() => { | 
					
						
							| 
									
										
										
										
											2021-12-10 17:30:50 +01:00
										 |  |  |                 guiState.currentViewControlIsOpened.setData(true) | 
					
						
							|  |  |  |             }), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             undefined, | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  |             new UIEventSource<boolean>( | 
					
						
							|  |  |  |                 currentViewFL !== undefined && currentViewFL?.layerDef?.tagRenderings !== null | 
					
						
							|  |  |  |             ) | 
					
						
							| 
									
										
										
										
											2021-12-10 17:30:50 +01:00
										 |  |  |         ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-08 02:56:49 +01:00
										 |  |  |         new AllDownloads(guiState.downloadControlIsOpened, state) | 
					
						
							| 
									
										
										
										
											2021-07-28 16:48:59 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-19 03:20:49 +02:00
										 |  |  |         super([currentViewAction]) | 
					
						
							| 
									
										
										
										
											2021-09-09 00:05:51 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-28 16:48:59 +02:00
										 |  |  |         this.SetClass("flex flex-col") | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  | } |