forked from MapComplete/MapComplete
Fix: load external panoramax images
This commit is contained in:
parent
89d31f54bc
commit
df9c44aaed
3 changed files with 16 additions and 16 deletions
14
package-lock.json
generated
14
package-lock.json
generated
|
@ -63,7 +63,7 @@
|
||||||
"opening_hours": "^3.6.0",
|
"opening_hours": "^3.6.0",
|
||||||
"osm-auth": "^2.5.0",
|
"osm-auth": "^2.5.0",
|
||||||
"osmtogeojson": "^3.0.0-beta.5",
|
"osmtogeojson": "^3.0.0-beta.5",
|
||||||
"panoramax-js": "^0.1.4",
|
"panoramax-js": "^0.1.7",
|
||||||
"panzoom": "^9.4.3",
|
"panzoom": "^9.4.3",
|
||||||
"papaparse": "^5.3.1",
|
"papaparse": "^5.3.1",
|
||||||
"pbf": "^3.2.1",
|
"pbf": "^3.2.1",
|
||||||
|
@ -15994,9 +15994,9 @@
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/panoramax-js": {
|
"node_modules/panoramax-js": {
|
||||||
"version": "0.1.4",
|
"version": "0.1.7",
|
||||||
"resolved": "https://registry.npmjs.org/panoramax-js/-/panoramax-js-0.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/panoramax-js/-/panoramax-js-0.1.7.tgz",
|
||||||
"integrity": "sha512-X7plFMH1ndxiiyVFEluDloNiEBH0nEkurCPJ7zAInxbgv21pp/EGFwu3ynmF5ETyyXB9zu0n309juyjTdJ5pnQ==",
|
"integrity": "sha512-G5m0cs+kODGyxmuLI06m+BcQecey2d6zhk+bajUMTkeXqvIIxP+CUS6NKnmN0WyIntd4q91gdGJeOR0Q2I/jeg==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ogcapi-js/features": "^1.1.1",
|
"@ogcapi-js/features": "^1.1.1",
|
||||||
"@ogcapi-js/shared": "^1.1.1",
|
"@ogcapi-js/shared": "^1.1.1",
|
||||||
|
@ -32056,9 +32056,9 @@
|
||||||
"version": "1.0.0"
|
"version": "1.0.0"
|
||||||
},
|
},
|
||||||
"panoramax-js": {
|
"panoramax-js": {
|
||||||
"version": "0.1.4",
|
"version": "0.1.7",
|
||||||
"resolved": "https://registry.npmjs.org/panoramax-js/-/panoramax-js-0.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/panoramax-js/-/panoramax-js-0.1.7.tgz",
|
||||||
"integrity": "sha512-X7plFMH1ndxiiyVFEluDloNiEBH0nEkurCPJ7zAInxbgv21pp/EGFwu3ynmF5ETyyXB9zu0n309juyjTdJ5pnQ==",
|
"integrity": "sha512-G5m0cs+kODGyxmuLI06m+BcQecey2d6zhk+bajUMTkeXqvIIxP+CUS6NKnmN0WyIntd4q91gdGJeOR0Q2I/jeg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@ogcapi-js/features": "^1.1.1",
|
"@ogcapi-js/features": "^1.1.1",
|
||||||
"@ogcapi-js/shared": "^1.1.1",
|
"@ogcapi-js/shared": "^1.1.1",
|
||||||
|
|
|
@ -205,7 +205,7 @@
|
||||||
"opening_hours": "^3.6.0",
|
"opening_hours": "^3.6.0",
|
||||||
"osm-auth": "^2.5.0",
|
"osm-auth": "^2.5.0",
|
||||||
"osmtogeojson": "^3.0.0-beta.5",
|
"osmtogeojson": "^3.0.0-beta.5",
|
||||||
"panoramax-js": "^0.1.4",
|
"panoramax-js": "^0.1.7",
|
||||||
"panzoom": "^9.4.3",
|
"panzoom": "^9.4.3",
|
||||||
"papaparse": "^5.3.1",
|
"papaparse": "^5.3.1",
|
||||||
"pbf": "^3.2.1",
|
"pbf": "^3.2.1",
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
import { ImageUploader } from "./ImageUploader"
|
import { ImageUploader } from "./ImageUploader"
|
||||||
import { AuthorizedPanoramax, PanoramaxXYZ, ImageData } from "panoramax-js/dist"
|
import { AuthorizedPanoramax, ImageData, Panoramax, PanoramaxXYZ } from "panoramax-js/dist"
|
||||||
import ExifReader from "exifreader"
|
import ExifReader from "exifreader"
|
||||||
import ImageProvider, { ProvidedImage } from "./ImageProvider"
|
import ImageProvider, { ProvidedImage } from "./ImageProvider"
|
||||||
import BaseUIElement from "../../UI/BaseUIElement"
|
import BaseUIElement from "../../UI/BaseUIElement"
|
||||||
import { LicenseInfo } from "./LicenseInfo"
|
import { LicenseInfo } from "./LicenseInfo"
|
||||||
import { Utils } from "../../Utils"
|
|
||||||
import { GeoOperations } from "../GeoOperations"
|
import { GeoOperations } from "../GeoOperations"
|
||||||
import Constants from "../../Models/Constants"
|
import Constants from "../../Models/Constants"
|
||||||
import { Store, Stores, UIEventSource } from "../UIEventSource"
|
import { Store, Stores, UIEventSource } from "../UIEventSource"
|
||||||
|
@ -87,9 +86,9 @@ export default class PanoramaxImageProvider extends ImageProvider {
|
||||||
}
|
}
|
||||||
const cached = PanoramaxImageProvider.knownMeta[id]
|
const cached = PanoramaxImageProvider.knownMeta[id]
|
||||||
if (cached) {
|
if (cached) {
|
||||||
if(new Date().getTime() - cached.time.getTime() < 1000){
|
if (new Date().getTime() - cached.time.getTime() < 1000) {
|
||||||
|
|
||||||
return { data: cached.data, url: undefined }
|
return { data: cached.data, url: undefined }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -100,13 +99,14 @@ export default class PanoramaxImageProvider extends ImageProvider {
|
||||||
try {
|
try {
|
||||||
return await this.getInfoFromXYZ(id)
|
return await this.getInfoFromXYZ(id)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.debug(e)
|
console.debug(e)
|
||||||
}
|
}
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async ExtractUrls(key: string, value: string): Promise<ProvidedImage[]> {
|
public async ExtractUrls(key: string, value: string): Promise<ProvidedImage[]> {
|
||||||
|
if(!Panoramax.isId(value)){
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
return [await this.getInfoFor(value).then(r => this.featureToImage(<any>r))]
|
return [await this.getInfoFor(value).then(r => this.featureToImage(<any>r))]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ export default class PanoramaxImageProvider extends ImageProvider {
|
||||||
const source = UIEventSource.FromPromise(super.getRelevantUrlsFor(tags, prefixes))
|
const source = UIEventSource.FromPromise(super.getRelevantUrlsFor(tags, prefixes))
|
||||||
|
|
||||||
function hasLoading(data: ProvidedImage[]) {
|
function hasLoading(data: ProvidedImage[]) {
|
||||||
if(data === undefined){
|
if (data === undefined) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return data?.some(img => img?.status !== undefined && img?.status !== "ready" && img?.status !== "broken")
|
return data?.some(img => img?.status !== undefined && img?.status !== "ready" && img?.status !== "broken")
|
||||||
|
|
Loading…
Add table
Reference in a new issue