| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  | import { GeoOperations } from "../../Logic/GeoOperations" | 
					
						
							|  |  |  | import { ImmutableStore, UIEventSource } from "../../Logic/UIEventSource" | 
					
						
							|  |  |  | import { SpecialVisualization, SpecialVisualizationState } from "../SpecialVisualization" | 
					
						
							|  |  |  | import { Feature } from "geojson" | 
					
						
							| 
									
										
										
										
											2023-03-28 05:13:48 +02:00
										 |  |  | import BaseUIElement from "../BaseUIElement" | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  | import SvelteUIElement from "../Base/SvelteUIElement" | 
					
						
							|  |  |  | import MapillaryLink from "../BigComponents/MapillaryLink.svelte" | 
					
						
							| 
									
										
										
										
											2022-10-28 04:33:05 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | export class MapillaryLinkVis implements SpecialVisualization { | 
					
						
							|  |  |  |     funcName = "mapillary_link" | 
					
						
							|  |  |  |     docs = "Adds a button to open mapillary on the specified location" | 
					
						
							|  |  |  |     args = [ | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             name: "zoom", | 
					
						
							|  |  |  |             doc: "The startzoom of mapillary", | 
					
						
							|  |  |  |             defaultValue: "18", | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |     ] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-28 05:13:48 +02:00
										 |  |  |     public constr( | 
					
						
							|  |  |  |         state: SpecialVisualizationState, | 
					
						
							|  |  |  |         tagsSource: UIEventSource<Record<string, string>>, | 
					
						
							|  |  |  |         args: string[], | 
					
						
							|  |  |  |         feature: Feature | 
					
						
							|  |  |  |     ): BaseUIElement { | 
					
						
							|  |  |  |         const [lon, lat] = GeoOperations.centerpointCoordinates(feature) | 
					
						
							| 
									
										
										
										
											2022-10-28 04:33:05 +02:00
										 |  |  |         let zoom = Number(args[0]) | 
					
						
							|  |  |  |         if (isNaN(zoom)) { | 
					
						
							|  |  |  |             zoom = 18 | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2023-06-06 00:01:01 +02:00
										 |  |  |         return new SvelteUIElement(MapillaryLink, { | 
					
						
							|  |  |  |             mapProperties: { | 
					
						
							| 
									
										
										
										
											2022-10-28 04:33:05 +02:00
										 |  |  |                 lat, | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |                 lon, | 
					
						
							| 
									
										
										
										
											2023-06-06 00:01:01 +02:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |             zoom: new ImmutableStore(zoom), | 
					
						
							| 
									
										
										
										
											2022-10-28 04:33:05 +02:00
										 |  |  |         }) | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |