forked from MapComplete/MapComplete
Merge develop
This commit is contained in:
commit
7c5170da15
193 changed files with 4011 additions and 4462 deletions
|
@ -52,7 +52,9 @@ export class AvailableRasterLayers {
|
|||
type: "Feature",
|
||||
properties: {
|
||||
name: "MapTiler",
|
||||
url: "https://api.maptiler.com/maps/15cc8f61-0353-4be6-b8da-13daea5f7432/style.json?key="+Constants.maptilerApiKey,
|
||||
url:
|
||||
"https://api.maptiler.com/maps/15cc8f61-0353-4be6-b8da-13daea5f7432/style.json?key=" +
|
||||
Constants.maptilerApiKey,
|
||||
category: "osmbasedmap",
|
||||
id: "maptiler",
|
||||
type: "vector",
|
||||
|
|
|
@ -156,7 +156,7 @@ export class On<P, T> extends DesugaringStep<T> {
|
|||
|
||||
convert(json: T, context: ConversionContext): T {
|
||||
const key = this.key
|
||||
const value: P = json[key]
|
||||
const value: P = json?.[key]
|
||||
if (value === undefined || value === null) {
|
||||
return json
|
||||
}
|
||||
|
|
|
@ -365,7 +365,7 @@ class AddDependencyLayersToTheme extends DesugaringStep<LayoutConfigJson> {
|
|||
themeId: string
|
||||
): { config: LayerConfigJson; reason: string }[] {
|
||||
const dependenciesToAdd: { config: LayerConfigJson; reason: string }[] = []
|
||||
const loadedLayerIds: Set<string> = new Set<string>(alreadyLoaded.map((l) => l.id))
|
||||
const loadedLayerIds: Set<string> = new Set<string>(alreadyLoaded.map((l) => l?.id))
|
||||
|
||||
// Verify cross-dependencies
|
||||
let unmetDependencies: {
|
||||
|
|
|
@ -82,5 +82,5 @@ export default interface LineRenderingConfigJson {
|
|||
* suggestions: [{if: "./assets/png/oneway.png", then: "Show a oneway error"}]
|
||||
* type: image
|
||||
*/
|
||||
imageAlongWay?: {if: TagConfigJson, then: string}[] | string
|
||||
imageAlongWay?: { if: TagConfigJson; then: string }[] | string
|
||||
}
|
||||
|
|
|
@ -30,7 +30,15 @@ export default interface PointRenderingConfigJson {
|
|||
* multianswer: true
|
||||
* suggestions: return [{if: "value=point",then: "Show an icon for point (node) objects"},{if: "value=centroid",then: "Show an icon for line or polygon (way) objects at their centroid location"}, {if: "value=start",then: "Show an icon for line (way) objects at the start"},{if: "value=end",then: "Show an icon for line (way) object at the end"},{if: "value=projected_centerpoint",then: "Show an icon for line (way) object near the centroid location, but moved onto the line. Does not show an item on polygons"}, ,{if: "value=polygon_centroid",then: "Show an icon at a polygon centroid (but not if it is a way)"}]
|
||||
*/
|
||||
location: ("point" | "centroid" | "start" | "end" | "projected_centerpoint" | "polygon_centroid" | string)[]
|
||||
location: (
|
||||
| "point"
|
||||
| "centroid"
|
||||
| "start"
|
||||
| "end"
|
||||
| "projected_centerpoint"
|
||||
| "polygon_centroid"
|
||||
| string
|
||||
)[]
|
||||
|
||||
/**
|
||||
* The marker for an element.
|
||||
|
|
|
@ -28,8 +28,6 @@ import { ImmutableStore } from "../../Logic/UIEventSource"
|
|||
import { OsmTags } from "../OsmFeature"
|
||||
import Constants from "../Constants"
|
||||
import { QuestionableTagRenderingConfigJson } from "./Json/QuestionableTagRenderingConfigJson"
|
||||
import SvelteUIElement from "../../UI/Base/SvelteUIElement"
|
||||
import Statistics from "../../assets/svg/Statistics.svelte"
|
||||
|
||||
export default class LayerConfig extends WithContextLoader {
|
||||
public static readonly syncSelectionAllowed = ["no", "local", "theme-only", "global"] as const
|
||||
|
|
|
@ -13,7 +13,7 @@ export default class LineRenderingConfig extends WithContextLoader {
|
|||
public readonly fill: TagRenderingConfig
|
||||
public readonly fillColor: TagRenderingConfig
|
||||
public readonly leftRightSensitive: boolean
|
||||
public readonly imageAlongWay: { if?: TagsFilter, then: string }[]
|
||||
public readonly imageAlongWay: { if?: TagsFilter; then: string }[]
|
||||
|
||||
constructor(json: LineRenderingConfigJson, context: string) {
|
||||
super(json, context)
|
||||
|
@ -33,15 +33,13 @@ export default class LineRenderingConfig extends WithContextLoader {
|
|||
for (let i = 0; i < json.imageAlongWay.length; i++) {
|
||||
const imgAlong = json.imageAlongWay[i]
|
||||
const ctx = context + ".imageAlongWay[" + i + "]"
|
||||
if(!imgAlong.then.endsWith(".png")){
|
||||
if (!imgAlong.then.endsWith(".png")) {
|
||||
throw "An imageAlongWay should always be a PNG image"
|
||||
}
|
||||
this.imageAlongWay.push(
|
||||
{
|
||||
if: TagUtils.Tag(imgAlong.if, ctx),
|
||||
then: imgAlong.then,
|
||||
},
|
||||
)
|
||||
this.imageAlongWay.push({
|
||||
if: TagUtils.Tag(imgAlong.if, ctx),
|
||||
then: imgAlong.then,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,10 +38,16 @@ export default class PointRenderingConfig extends WithContextLoader {
|
|||
"start",
|
||||
"end",
|
||||
"projected_centerpoint",
|
||||
"polygon_centroid"
|
||||
"polygon_centroid",
|
||||
])
|
||||
public readonly location: Set<
|
||||
"point" | "centroid" | "start" | "end" | "projected_centerpoint" | "polygon_centroid" | string
|
||||
| "point"
|
||||
| "centroid"
|
||||
| "start"
|
||||
| "end"
|
||||
| "projected_centerpoint"
|
||||
| "polygon_centroid"
|
||||
| string
|
||||
>
|
||||
|
||||
public readonly marker: IconConfig[]
|
||||
|
|
|
@ -90,7 +90,6 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
|
||||
readonly osmConnection: OsmConnection
|
||||
readonly selectedElement: UIEventSource<Feature>
|
||||
readonly selectedElementAndLayer: Store<{ feature: Feature; layer: LayerConfig }>
|
||||
readonly mapProperties: MapLibreAdaptor & MapProperties & ExportableMap
|
||||
readonly osmObjectDownloader: OsmObjectDownloader
|
||||
|
||||
|
@ -119,7 +118,6 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
readonly perLayerFiltered: ReadonlyMap<string, FilteringFeatureSource>
|
||||
|
||||
readonly availableLayers: Store<RasterLayerPolygon[]>
|
||||
readonly selectedLayer: UIEventSource<LayerConfig>
|
||||
readonly userRelatedState: UserRelatedState
|
||||
readonly geolocation: GeoLocationHandler
|
||||
readonly geolocationControl: GeolocationControlState
|
||||
|
@ -185,18 +183,6 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
this.mapProperties.allowRotating.setData(fixated !== "yes")
|
||||
})
|
||||
this.selectedElement = new UIEventSource<Feature | undefined>(undefined, "Selected element")
|
||||
this.selectedLayer = new UIEventSource<LayerConfig>(undefined, "Selected layer")
|
||||
|
||||
this.selectedElementAndLayer = this.selectedElement.mapD(
|
||||
(feature) => {
|
||||
const layer = this.selectedLayer.data
|
||||
if (!layer) {
|
||||
return undefined
|
||||
}
|
||||
return { layer, feature }
|
||||
},
|
||||
[this.selectedLayer]
|
||||
)
|
||||
|
||||
this.geolocation = new GeoLocationHandler(
|
||||
geolocationState,
|
||||
|
@ -438,7 +424,6 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
doShowLayer,
|
||||
metaTags: this.userRelatedState.preferencesAsTags,
|
||||
selectedElement: this.selectedElement,
|
||||
selectedLayer: this.selectedLayer,
|
||||
fetchStore: (id) => this.featureProperties.getStore(id),
|
||||
})
|
||||
})
|
||||
|
@ -446,7 +431,6 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
}
|
||||
|
||||
public openNewDialog() {
|
||||
this.selectedLayer.setData(undefined)
|
||||
this.selectedElement.setData(undefined)
|
||||
|
||||
const { lon, lat } = this.mapProperties.location.data
|
||||
|
@ -507,14 +491,12 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
}
|
||||
const layer = this.layout.getMatchingLayer(toSelect.properties)
|
||||
this.selectedElement.setData(undefined)
|
||||
this.selectedLayer.setData(layer)
|
||||
this.selectedElement.setData(toSelect)
|
||||
})
|
||||
return
|
||||
}
|
||||
const layer = this.layout.getMatchingLayer(toSelect.properties)
|
||||
this.selectedElement.setData(undefined)
|
||||
this.selectedLayer.setData(layer)
|
||||
this.selectedElement.setData(toSelect)
|
||||
}
|
||||
|
||||
|
@ -773,7 +755,6 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
layer: flayer.layerDef,
|
||||
metaTags: this.userRelatedState.preferencesAsTags,
|
||||
selectedElement: this.selectedElement,
|
||||
selectedLayer: this.selectedLayer,
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -781,7 +762,6 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
features: specialLayers.summary,
|
||||
layer: new LayerConfig(<LayerConfigJson>summaryLayer, "summaryLayer"),
|
||||
// doShowLayer: this.mapProperties.zoom.map((z) => z < maxzoom),
|
||||
selectedLayer: this.selectedLayer,
|
||||
selectedElement: this.selectedElement,
|
||||
})
|
||||
}
|
||||
|
@ -792,7 +772,6 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
private initActors() {
|
||||
this.selectedElement.addCallback((selected) => {
|
||||
if (selected === undefined) {
|
||||
this.selectedLayer.setData(undefined)
|
||||
this.focusOnMap()
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue