forked from MapComplete/MapComplete
Merge branch 'master' into develop
This commit is contained in:
commit
93bbd5d0b8
44 changed files with 1522 additions and 378 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -59,12 +59,12 @@
|
|||
type: "Feature",
|
||||
geometry: {
|
||||
type: "Point",
|
||||
coordinates: [p4c.coordinates.lng, p4c.coordinates.lat],
|
||||
coordinates: [p4c.coordinates.lng, p4c.coordinates.lat]
|
||||
},
|
||||
properties: {
|
||||
id: p4c.pictureUrl,
|
||||
rotation: p4c.direction,
|
||||
},
|
||||
rotation: p4c.direction
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
|
@ -76,14 +76,14 @@
|
|||
type: "Feature",
|
||||
geometry: {
|
||||
type: "Point",
|
||||
coordinates: [s.coordinates.lng, s.coordinates.lat],
|
||||
coordinates: [s.coordinates.lng, s.coordinates.lat]
|
||||
},
|
||||
properties: {
|
||||
id: s.pictureUrl,
|
||||
selected: "yes",
|
||||
rotation: s.direction,
|
||||
},
|
||||
},
|
||||
rotation: s.direction
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
|
|
@ -108,7 +108,7 @@
|
|||
rotation: state.mapProperties.rotation,
|
||||
pitch: state.mapProperties.pitch,
|
||||
zoom: new UIEventSource<number>(16),
|
||||
location: new UIEventSource({ lon, lat }),
|
||||
location: new UIEventSource({ lon, lat })
|
||||
})
|
||||
|
||||
const geocodedImageLayer = new LayerConfig(<LayerConfigJson>geocoded_image)
|
||||
|
|
@ -118,7 +118,7 @@
|
|||
zoomToFeatures: true,
|
||||
onClick: (feature) => {
|
||||
highlighted.set(feature.properties.id)
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
ShowDataLayer.showMultipleLayers(map, new StaticFeatureSource([feature]), state.theme.layers)
|
||||
|
|
@ -141,8 +141,14 @@
|
|||
layer: geocodedImageLayer,
|
||||
onClick: (feature) => {
|
||||
highlighted.set(feature.properties.id)
|
||||
},
|
||||
}
|
||||
})
|
||||
onDestroy(tags.addCallbackAndRunD(tags => {
|
||||
if (tags.id.startsWith("node/") || tags.id.startsWith("way/") || tags.id.startsWith("relation/")) {
|
||||
return
|
||||
}
|
||||
linkable = false
|
||||
}))
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col">
|
||||
|
|
|
|||
|
|
@ -3,15 +3,17 @@
|
|||
import { Stores } from "../../Logic/UIEventSource"
|
||||
import Tr from "../Base/Tr.svelte"
|
||||
import Translations from "../i18n/Translations"
|
||||
import type { SpecialVisualizationState } from "../SpecialVisualization"
|
||||
import ThemeViewState from "../../Models/ThemeViewState"
|
||||
|
||||
/**
|
||||
* Shows _all_ disabled questions
|
||||
*/
|
||||
export let state
|
||||
let layers = state.layout.layers.filter((l) => l.isNormal())
|
||||
export let state: ThemeViewState
|
||||
let layers = state.theme.layers.filter((l) => l.isNormal())
|
||||
|
||||
let allDisabled = Stores.concat<string>(
|
||||
layers.map((l) => state.userRelatedState.getThemeDisabled(state.layout.id, l.id))
|
||||
layers.map((l) => state.userRelatedState.getThemeDisabled(state.theme.id, l.id))
|
||||
).map((l) => [].concat(...l))
|
||||
const t = Translations.t.general.questions
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
/**
|
||||
* Gives an overview of questions which are disabled for the given theme
|
||||
*/
|
||||
import UserRelatedState from "../../Logic/State/UserRelatedState"
|
||||
import LayerConfig from "../../Models/ThemeConfig/LayerConfig"
|
||||
import ThemeViewState from "../../Models/ThemeViewState"
|
||||
import Tr from "../Base/Tr.svelte"
|
||||
|
|
@ -13,7 +12,7 @@
|
|||
export let layer: LayerConfig
|
||||
export let state: ThemeViewState
|
||||
|
||||
let disabledQuestions = state.userRelatedState.getThemeDisabled(state.layout.id, layer.id)
|
||||
let disabledQuestions = state.userRelatedState.getThemeDisabled(state.theme.id, layer.id)
|
||||
|
||||
function getQuestion(id: string): Translation {
|
||||
return layer.tagRenderings.find((q) => q.id === id).question.Subs({})
|
||||
|
|
|
|||
|
|
@ -1,18 +1,13 @@
|
|||
import { Store, UIEventSource } from "../Logic/UIEventSource"
|
||||
import BaseUIElement from "./BaseUIElement"
|
||||
import ThemeConfig from "../Models/ThemeConfig/ThemeConfig"
|
||||
import {
|
||||
FeatureSource,
|
||||
IndexedFeatureSource,
|
||||
WritableFeatureSource,
|
||||
} from "../Logic/FeatureSource/FeatureSource"
|
||||
import { FeatureSource, IndexedFeatureSource, WritableFeatureSource } from "../Logic/FeatureSource/FeatureSource"
|
||||
import { OsmConnection } from "../Logic/Osm/OsmConnection"
|
||||
import { Changes } from "../Logic/Osm/Changes"
|
||||
import { ExportableMap, MapProperties } from "../Models/MapProperties"
|
||||
import LayerState from "../Logic/State/LayerState"
|
||||
import { Feature, Geometry, Point, Polygon } from "geojson"
|
||||
import FullNodeDatabaseSource from "../Logic/FeatureSource/TiledFeatureSource/FullNodeDatabaseSource"
|
||||
import { MangroveIdentity } from "../Logic/Web/MangroveReviews"
|
||||
import { GeoIndexedStoreForLayer } from "../Logic/FeatureSource/Actors/GeoIndexedStore"
|
||||
import LayerConfig from "../Models/ThemeConfig/LayerConfig"
|
||||
import FeatureSwitchState from "../Logic/State/FeatureSwitchState"
|
||||
|
|
@ -22,14 +17,12 @@ import { ImageUploadManager } from "../Logic/ImageProviders/ImageUploadManager"
|
|||
import FavouritesFeatureSource from "../Logic/FeatureSource/Sources/FavouritesFeatureSource"
|
||||
import { ProvidedImage } from "../Logic/ImageProviders/ImageProvider"
|
||||
import GeoLocationHandler from "../Logic/Actors/GeoLocationHandler"
|
||||
import { SummaryTileSourceRewriter } from "../Logic/FeatureSource/TiledFeatureSource/SummaryTileSource"
|
||||
import ThemeSource from "../Logic/FeatureSource/Sources/ThemeSource"
|
||||
import { Map as MlMap } from "maplibre-gl"
|
||||
import ShowDataLayer from "./Map/ShowDataLayer"
|
||||
import { CombinedFetcher } from "../Logic/Web/NearbyImagesSearch"
|
||||
import SearchState from "../Logic/State/SearchState"
|
||||
import UserRelatedState, { OptionallySyncedHistory } from "../Logic/State/UserRelatedState"
|
||||
import GeocodeResult from "./Search/GeocodeResult.svelte"
|
||||
import UserRelatedState from "../Logic/State/UserRelatedState"
|
||||
import FeaturePropertiesStore from "../Logic/FeatureSource/Actors/FeaturePropertiesStore"
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ class NearbyImageVis implements SpecialVisualization {
|
|||
{
|
||||
name: "readonly",
|
||||
required: false,
|
||||
doc: "If 'readonly', will not show the 'link'-button",
|
||||
doc: "If 'readonly' or 'yes', will not show the 'link'-button",
|
||||
},
|
||||
]
|
||||
docs =
|
||||
|
|
@ -128,7 +128,7 @@ class NearbyImageVis implements SpecialVisualization {
|
|||
layer: LayerConfig
|
||||
): SvelteUIElement {
|
||||
const isOpen = args[0] === "open"
|
||||
const readonly = args[1] === "readonly"
|
||||
const readonly = args[1] === "readonly" || args[1] === "yes"
|
||||
const [lon, lat] = GeoOperations.centerpointCoordinates(feature)
|
||||
return new SvelteUIElement(isOpen ? NearbyImages : NearbyImagesCollapsed, {
|
||||
tags,
|
||||
|
|
@ -744,13 +744,14 @@ export default class SpecialVisualizations {
|
|||
required: false,
|
||||
},
|
||||
],
|
||||
constr: (state, tags, args) => {
|
||||
constr: (state, tags, args, feature) => {
|
||||
const targetKey = args[0] === "" ? undefined : args[0]
|
||||
const noBlur = args[3]?.toLowerCase()?.trim()
|
||||
return new SvelteUIElement(UploadImage, {
|
||||
state,
|
||||
tags,
|
||||
targetKey,
|
||||
feature,
|
||||
labelText: args[1],
|
||||
image: args[2],
|
||||
noBlur: noBlur === "true" || noBlur === "yes",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue