Merge branch 'master' into develop

This commit is contained in:
Pieter Vander Vennet 2024-12-09 20:08:03 +01:00
commit 93bbd5d0b8
44 changed files with 1522 additions and 378 deletions

View file

@ -76,10 +76,18 @@ export class GeoOperations {
}
/**
* Returns [lon,lat] coordinates
* Returns [lon,lat] coordinates.
* @param feature
*
* GeoOperations.centerpointCoordinates(undefined) // => undefined
*/
static centerpointCoordinates(feature: undefined | null): undefined ;
static centerpointCoordinates(feature: AllGeoJSON | GeoJSON | undefined): [number, number] | undefined;
static centerpointCoordinates(feature: NonNullable< AllGeoJSON> | NonNullable<GeoJSON>): NonNullable<[number, number]>;
static centerpointCoordinates(feature: AllGeoJSON | GeoJSON): [number, number] {
if(feature === undefined || feature === null){
return undefined
}
return <[number, number]>turf.center(<any>feature).geometry.coordinates
}

View file

@ -170,6 +170,9 @@ export class ImageUploadManager {
}
if (location === undefined || location?.some((l) => l === undefined)) {
feature ??= this._indexedFeatures.featuresById.data.get(featureId)
if(feature === undefined){
throw "ImageUploadManager: no feature given and no feature found in the indexedFeature. Cannot upload this image"
}
location = GeoOperations.centerpointCoordinates(feature)
}
try {

View file

@ -2,7 +2,7 @@ import ChangeTagAction from "./ChangeTagAction"
import { Tag } from "../../Tags/Tag"
import OsmChangeAction from "./OsmChangeAction"
import { ChangeDescription } from "./ChangeDescription"
import { Store, UIEventSource } from "../../UIEventSource"
import { UIEventSource } from "../../UIEventSource"
export default class LinkImageAction extends OsmChangeAction {
private readonly _proposedKey: "image" | "mapillary" | "wiki_commons" | string