| 
									
										
										
										
											2023-04-20 01:52:23 +02:00
										 |  |  | import { Store, UIEventSource } from "../Logic/UIEventSource"; | 
					
						
							|  |  |  | import BaseUIElement from "./BaseUIElement"; | 
					
						
							|  |  |  | import LayoutConfig from "../Models/ThemeConfig/LayoutConfig"; | 
					
						
							|  |  |  | import { IndexedFeatureSource, WritableFeatureSource } from "../Logic/FeatureSource/FeatureSource"; | 
					
						
							|  |  |  | import { OsmConnection } from "../Logic/Osm/OsmConnection"; | 
					
						
							|  |  |  | import { Changes } from "../Logic/Osm/Changes"; | 
					
						
							|  |  |  | import { ExportableMap, MapProperties } from "../Models/MapProperties"; | 
					
						
							|  |  |  | import LayerState from "../Logic/State/LayerState"; | 
					
						
							| 
									
										
										
										
											2023-04-20 18:58:31 +02:00
										 |  |  | import { Feature, Geometry, Point } from "geojson"; | 
					
						
							| 
									
										
										
										
											2023-04-20 01:52:23 +02:00
										 |  |  | import FullNodeDatabaseSource from "../Logic/FeatureSource/TiledFeatureSource/FullNodeDatabaseSource"; | 
					
						
							|  |  |  | import { MangroveIdentity } from "../Logic/Web/MangroveReviews"; | 
					
						
							|  |  |  | import { GeoIndexedStoreForLayer } from "../Logic/FeatureSource/Actors/GeoIndexedStore"; | 
					
						
							|  |  |  | import LayerConfig from "../Models/ThemeConfig/LayerConfig"; | 
					
						
							|  |  |  | import FeatureSwitchState from "../Logic/State/FeatureSwitchState"; | 
					
						
							|  |  |  | import { MenuState } from "../Models/MenuState"; | 
					
						
							| 
									
										
										
										
											2023-04-20 03:58:31 +02:00
										 |  |  | import OsmObjectDownloader from "../Logic/Osm/OsmObjectDownloader"; | 
					
						
							| 
									
										
										
										
											2023-05-21 23:27:01 +02:00
										 |  |  | import {RasterLayerPolygon} from "../Models/RasterLayers"; | 
					
						
							| 
									
										
										
										
											2023-03-28 05:13:48 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * The state needed to render a special Visualisation. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | export interface SpecialVisualizationState { | 
					
						
							| 
									
										
										
										
											2023-04-06 01:33:08 +02:00
										 |  |  |     readonly guistate: MenuState | 
					
						
							| 
									
										
										
										
											2023-03-28 05:13:48 +02:00
										 |  |  |     readonly layout: LayoutConfig | 
					
						
							| 
									
										
										
										
											2023-04-02 02:59:20 +02:00
										 |  |  |     readonly featureSwitches: FeatureSwitchState | 
					
						
							| 
									
										
										
										
											2023-03-28 05:13:48 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     readonly layerState: LayerState | 
					
						
							|  |  |  |     readonly featureProperties: { getStore(id: string): UIEventSource<Record<string, string>> } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     readonly indexedFeatures: IndexedFeatureSource | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-06 01:33:08 +02:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Some features will create a new element that should be displayed. | 
					
						
							|  |  |  |      * These can be injected by appending them to this featuresource (and pinging it) | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     readonly newFeatures: WritableFeatureSource | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-20 18:58:31 +02:00
										 |  |  |     readonly historicalUserLocations: WritableFeatureSource<Feature<Point>> | 
					
						
							| 
									
										
										
										
											2023-03-28 05:13:48 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     readonly osmConnection: OsmConnection | 
					
						
							|  |  |  |     readonly featureSwitchUserbadge: Store<boolean> | 
					
						
							|  |  |  |     readonly featureSwitchIsTesting: Store<boolean> | 
					
						
							|  |  |  |     readonly changes: Changes | 
					
						
							| 
									
										
										
										
											2023-04-20 03:58:31 +02:00
										 |  |  |     readonly osmObjectDownloader: OsmObjectDownloader | 
					
						
							| 
									
										
										
										
											2023-03-28 05:13:48 +02:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * State of the main map | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2023-04-19 03:20:49 +02:00
										 |  |  |     readonly mapProperties: MapProperties & ExportableMap | 
					
						
							| 
									
										
										
										
											2023-03-28 05:13:48 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     readonly selectedElement: UIEventSource<Feature> | 
					
						
							| 
									
										
										
										
											2023-04-06 01:33:08 +02:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Works together with 'selectedElement' to indicate what properties should be displayed | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     readonly selectedLayer: UIEventSource<LayerConfig> | 
					
						
							| 
									
										
										
										
											2023-03-28 05:13:48 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * If data is currently being fetched from external sources | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     readonly dataIsLoading: Store<boolean> | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Only needed for 'ReplaceGeometryAction' | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     readonly fullNodeDatabase?: FullNodeDatabaseSource | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     readonly perLayer: ReadonlyMap<string, GeoIndexedStoreForLayer> | 
					
						
							| 
									
										
										
										
											2023-03-31 03:28:11 +02:00
										 |  |  |     readonly userRelatedState: { | 
					
						
							| 
									
										
										
										
											2023-05-11 02:17:41 +02:00
										 |  |  |         readonly showTags:  UIEventSource<"no" | undefined | "always" | "yes">; | 
					
						
							| 
									
										
										
										
											2023-03-31 03:28:11 +02:00
										 |  |  |         readonly mangroveIdentity: MangroveIdentity | 
					
						
							|  |  |  |         readonly showAllQuestionsAtOnce: UIEventSource<boolean> | 
					
						
							| 
									
										
										
										
											2023-04-15 02:28:24 +02:00
										 |  |  |         readonly preferencesAsTags: Store<Record<string, string>> | 
					
						
							| 
									
										
										
										
											2023-06-06 00:03:50 +02:00
										 |  |  |         readonly language: UIEventSource<string> | 
					
						
							| 
									
										
										
										
											2023-03-31 03:28:11 +02:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-04-06 01:33:08 +02:00
										 |  |  |     readonly lastClickObject: WritableFeatureSource | 
					
						
							| 
									
										
										
										
											2023-05-21 23:27:01 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     readonly availableLayers: Store<RasterLayerPolygon[]> | 
					
						
							| 
									
										
										
										
											2023-03-28 05:13:48 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2022-10-28 04:33:05 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | export interface SpecialVisualization { | 
					
						
							| 
									
										
										
										
											2023-03-29 18:54:00 +02:00
										 |  |  |     readonly funcName: string | 
					
						
							|  |  |  |     readonly docs: string | BaseUIElement | 
					
						
							|  |  |  |     readonly example?: string | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							| 
									
										
										
										
											2023-05-30 02:52:22 +02:00
										 |  |  |      * Indicates that this special visualisation will make requests to the 'alLNodesDatabase' and that it thus should be included | 
					
						
							| 
									
										
										
										
											2023-03-29 18:54:00 +02:00
										 |  |  |      */ | 
					
						
							|  |  |  |     readonly needsNodeDatabase?: boolean | 
					
						
							|  |  |  |     readonly args: { | 
					
						
							|  |  |  |         name: string | 
					
						
							|  |  |  |         defaultValue?: string | 
					
						
							|  |  |  |         doc: string | 
					
						
							|  |  |  |         required?: false | boolean | 
					
						
							|  |  |  |     }[] | 
					
						
							|  |  |  |     readonly getLayerDependencies?: (argument: string[]) => string[] | 
					
						
							| 
									
										
										
										
											2023-03-29 17:21:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     structuredExamples?(): { feature: Feature<Geometry, Record<string, string>>; args: string[] }[] | 
					
						
							| 
									
										
										
										
											2023-03-28 05:13:48 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     constr( | 
					
						
							|  |  |  |         state: SpecialVisualizationState, | 
					
						
							|  |  |  |         tagSource: UIEventSource<Record<string, string>>, | 
					
						
							|  |  |  |         argument: string[], | 
					
						
							| 
									
										
										
										
											2023-03-31 03:28:11 +02:00
										 |  |  |         feature: Feature, | 
					
						
							|  |  |  |         layer: LayerConfig | 
					
						
							| 
									
										
										
										
											2023-03-28 05:13:48 +02:00
										 |  |  |     ): BaseUIElement | 
					
						
							| 
									
										
										
										
											2022-10-28 04:33:05 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2023-03-29 17:21:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | export type RenderingSpecification = | 
					
						
							|  |  |  |     | string | 
					
						
							|  |  |  |     | { | 
					
						
							|  |  |  |           func: SpecialVisualization | 
					
						
							|  |  |  |           args: string[] | 
					
						
							|  |  |  |           style: string | 
					
						
							|  |  |  |       } |