Feature: first working version of inspecting 360° images

This commit is contained in:
Pieter Vander Vennet 2025-03-30 03:10:29 +02:00
parent 7d104b4266
commit 01ba98a820
24 changed files with 330 additions and 436 deletions

View file

@ -1,7 +1,8 @@
import { Store, Stores, UIEventSource } from "../UIEventSource"
import { Store, Stores } from "../UIEventSource"
import BaseUIElement from "../../UI/BaseUIElement"
import { LicenseInfo } from "./LicenseInfo"
import { Utils } from "../../Utils"
import { Feature, Point } from "geojson"
export interface ProvidedImage {
url: string
@ -19,6 +20,17 @@ export interface ProvidedImage {
lat?: number
lon?: number
host?: string
isSpherical?: boolean
}
export interface PanoramaView {
url: string,
/**
* 0 - 359
* Degrees in which the picture is taken, with north = 0; going clockwise
*/
northOffset?: number,
pitchOffset?: number
}
export default abstract class ImageProvider {
@ -89,6 +101,8 @@ export default abstract class ImageProvider {
public abstract apiUrls(): string[]
public abstract getPanoramaInfo(image: { id: string }): Promise<Feature<Point, PanoramaView>> | undefined;
public static async offerImageAsDownload(image: ProvidedImage) {
const response = await fetch(image.url_hd ?? image.url)
const blob = await response.blob()
@ -96,4 +110,5 @@ export default abstract class ImageProvider {
mimetype: "image/jpg",
})
}
}