| 
									
										
										
										
											2021-06-18 01:25:13 +02:00
										 |  |  | import Combine from "../Base/Combine"; | 
					
						
							|  |  |  | import Attribution from "./Attribution"; | 
					
						
							|  |  |  | import Img from "../Base/Img"; | 
					
						
							| 
									
										
										
										
											2022-06-13 00:51:53 +02:00
										 |  |  | import ImageProvider from "../../Logic/ImageProviders/ImageProvider"; | 
					
						
							| 
									
										
										
										
											2021-09-15 01:33:52 +02:00
										 |  |  | import BaseUIElement from "../BaseUIElement"; | 
					
						
							| 
									
										
										
										
											2021-10-01 02:57:41 +02:00
										 |  |  | import {Mapillary} from "../../Logic/ImageProviders/Mapillary"; | 
					
						
							| 
									
										
										
										
											2022-06-13 00:51:53 +02:00
										 |  |  | import {UIEventSource} from "../../Logic/UIEventSource"; | 
					
						
							| 
									
										
										
										
											2021-06-18 01:25:13 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export class AttributedImage extends Combine { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-06 12:41:24 +02:00
										 |  |  |      constructor(imageInfo: { | 
					
						
							|  |  |  |                     url: string, | 
					
						
							|  |  |  |                     provider?: ImageProvider, | 
					
						
							|  |  |  |                     date?: Date | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |     ) { | 
					
						
							| 
									
										
										
										
											2021-09-15 01:33:52 +02:00
										 |  |  |         let img: BaseUIElement; | 
					
						
							| 
									
										
										
										
											2021-10-01 02:57:41 +02:00
										 |  |  |         img = new Img(imageInfo.url, false, { | 
					
						
							| 
									
										
										
										
											2021-11-07 16:34:51 +01:00
										 |  |  |             fallbackImage: imageInfo.provider === Mapillary.singleton ? "./assets/svg/blocked.svg" : undefined | 
					
						
							| 
									
										
										
										
											2021-10-01 02:57:41 +02:00
										 |  |  |         }); | 
					
						
							| 
									
										
										
										
											2022-05-06 12:41:24 +02:00
										 |  |  |          | 
					
						
							|  |  |  |         let attr: BaseUIElement = undefined | 
					
						
							|  |  |  |         if(imageInfo.provider !== undefined){ | 
					
						
							| 
									
										
										
										
											2022-06-13 00:51:53 +02:00
										 |  |  |             attr = new Attribution(UIEventSource.FromPromise( imageInfo.provider?.DownloadAttribution(imageInfo.url)), | 
					
						
							| 
									
										
										
										
											2022-05-06 12:41:24 +02:00
										 |  |  |                 imageInfo.provider?.SourceIcon(), | 
					
						
							|  |  |  |                 imageInfo.date | 
					
						
							|  |  |  |             ) | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2021-09-15 01:33:52 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         super([img, attr]); | 
					
						
							| 
									
										
										
										
											2021-06-18 01:25:13 +02:00
										 |  |  |         this.SetClass('block relative h-full'); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |