forked from MapComplete/MapComplete
Fix: remove unneeded URL parameter
This commit is contained in:
parent
7b6b375ff9
commit
365d573b7c
4 changed files with 52 additions and 46 deletions
|
@ -1,14 +1,14 @@
|
|||
import { Store, UIEventSource } from "../Logic/UIEventSource"
|
||||
import {Store, UIEventSource} from "../Logic/UIEventSource"
|
||||
import LayerConfig from "./ThemeConfig/LayerConfig"
|
||||
import { OsmConnection } from "../Logic/Osm/OsmConnection"
|
||||
import { LocalStorageSource } from "../Logic/Web/LocalStorageSource"
|
||||
import { QueryParameters } from "../Logic/Web/QueryParameters"
|
||||
import { FilterConfigOption } from "./ThemeConfig/FilterConfig"
|
||||
import { TagsFilter } from "../Logic/Tags/TagsFilter"
|
||||
import { Utils } from "../Utils"
|
||||
import { TagUtils } from "../Logic/Tags/TagUtils"
|
||||
import { And } from "../Logic/Tags/And"
|
||||
import { GlobalFilter } from "./GlobalFilter"
|
||||
import {OsmConnection} from "../Logic/Osm/OsmConnection"
|
||||
import {LocalStorageSource} from "../Logic/Web/LocalStorageSource"
|
||||
import {QueryParameters} from "../Logic/Web/QueryParameters"
|
||||
import {FilterConfigOption} from "./ThemeConfig/FilterConfig"
|
||||
import {TagsFilter} from "../Logic/Tags/TagsFilter"
|
||||
import {Utils} from "../Utils"
|
||||
import {TagUtils} from "../Logic/Tags/TagUtils"
|
||||
import {And} from "../Logic/Tags/And"
|
||||
import {GlobalFilter} from "./GlobalFilter"
|
||||
|
||||
export default class FilteredLayer {
|
||||
/**
|
||||
|
@ -72,6 +72,10 @@ export default class FilteredLayer {
|
|||
return JSON.stringify(values)
|
||||
}
|
||||
|
||||
public static queryParameterKey(layer: LayerConfig) {
|
||||
return "layer-" + layer.id
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a FilteredLayer which is tied into the QueryParameters and/or user preferences
|
||||
*/
|
||||
|
@ -100,7 +104,7 @@ export default class FilteredLayer {
|
|||
)
|
||||
} else {
|
||||
isDisplayed = QueryParameters.GetBooleanQueryParameter(
|
||||
"layer-" + layer.id,
|
||||
FilteredLayer.queryParameterKey(layer),
|
||||
layer.shownByDefault,
|
||||
"Whether or not layer " + layer.id + " is shown"
|
||||
)
|
||||
|
|
|
@ -1,27 +1,23 @@
|
|||
import LayoutConfig from "./ThemeConfig/LayoutConfig"
|
||||
import { SpecialVisualizationState } from "../UI/SpecialVisualization"
|
||||
import { Changes } from "../Logic/Osm/Changes"
|
||||
import { ImmutableStore, Store, UIEventSource } from "../Logic/UIEventSource"
|
||||
import {
|
||||
FeatureSource,
|
||||
IndexedFeatureSource,
|
||||
WritableFeatureSource,
|
||||
} from "../Logic/FeatureSource/FeatureSource"
|
||||
import { OsmConnection } from "../Logic/Osm/OsmConnection"
|
||||
import { ExportableMap, MapProperties } from "./MapProperties"
|
||||
import {SpecialVisualizationState} from "../UI/SpecialVisualization"
|
||||
import {Changes} from "../Logic/Osm/Changes"
|
||||
import {ImmutableStore, Store, UIEventSource} from "../Logic/UIEventSource"
|
||||
import {FeatureSource, IndexedFeatureSource, WritableFeatureSource,} from "../Logic/FeatureSource/FeatureSource"
|
||||
import {OsmConnection} from "../Logic/Osm/OsmConnection"
|
||||
import {ExportableMap, MapProperties} from "./MapProperties"
|
||||
import LayerState from "../Logic/State/LayerState"
|
||||
import { Feature, Point, Polygon } from "geojson"
|
||||
import {Feature, Point, Polygon} from "geojson"
|
||||
import FullNodeDatabaseSource from "../Logic/FeatureSource/TiledFeatureSource/FullNodeDatabaseSource"
|
||||
import { Map as MlMap } from "maplibre-gl"
|
||||
import {Map as MlMap} from "maplibre-gl"
|
||||
import InitialMapPositioning from "../Logic/Actors/InitialMapPositioning"
|
||||
import { MapLibreAdaptor } from "../UI/Map/MapLibreAdaptor"
|
||||
import { GeoLocationState } from "../Logic/State/GeoLocationState"
|
||||
import {MapLibreAdaptor} from "../UI/Map/MapLibreAdaptor"
|
||||
import {GeoLocationState} from "../Logic/State/GeoLocationState"
|
||||
import FeatureSwitchState from "../Logic/State/FeatureSwitchState"
|
||||
import { QueryParameters } from "../Logic/Web/QueryParameters"
|
||||
import {QueryParameters} from "../Logic/Web/QueryParameters"
|
||||
import UserRelatedState from "../Logic/State/UserRelatedState"
|
||||
import LayerConfig from "./ThemeConfig/LayerConfig"
|
||||
import GeoLocationHandler from "../Logic/Actors/GeoLocationHandler"
|
||||
import { AvailableRasterLayers, RasterLayerPolygon, RasterLayerUtils } from "./RasterLayers"
|
||||
import {AvailableRasterLayers, RasterLayerPolygon, RasterLayerUtils} from "./RasterLayers"
|
||||
import LayoutSource from "../Logic/FeatureSource/Sources/LayoutSource"
|
||||
import StaticFeatureSource from "../Logic/FeatureSource/Sources/StaticFeatureSource"
|
||||
import FeaturePropertiesStore from "../Logic/FeatureSource/Actors/FeaturePropertiesStore"
|
||||
|
@ -32,27 +28,26 @@ import TitleHandler from "../Logic/Actors/TitleHandler"
|
|||
import ChangeToElementsActor from "../Logic/Actors/ChangeToElementsActor"
|
||||
import PendingChangesUploader from "../Logic/Actors/PendingChangesUploader"
|
||||
import SelectedElementTagsUpdater from "../Logic/Actors/SelectedElementTagsUpdater"
|
||||
import { BBox } from "../Logic/BBox"
|
||||
import {BBox} from "../Logic/BBox"
|
||||
import Constants from "./Constants"
|
||||
import Hotkeys from "../UI/Base/Hotkeys"
|
||||
import Translations from "../UI/i18n/Translations"
|
||||
import { GeoIndexedStoreForLayer } from "../Logic/FeatureSource/Actors/GeoIndexedStore"
|
||||
import { LastClickFeatureSource } from "../Logic/FeatureSource/Sources/LastClickFeatureSource"
|
||||
import { MenuState } from "./MenuState"
|
||||
import {GeoIndexedStoreForLayer} from "../Logic/FeatureSource/Actors/GeoIndexedStore"
|
||||
import {LastClickFeatureSource} from "../Logic/FeatureSource/Sources/LastClickFeatureSource"
|
||||
import {MenuState} from "./MenuState"
|
||||
import MetaTagging from "../Logic/MetaTagging"
|
||||
import ChangeGeometryApplicator from "../Logic/FeatureSource/Sources/ChangeGeometryApplicator"
|
||||
import { NewGeometryFromChangesFeatureSource } from "../Logic/FeatureSource/Sources/NewGeometryFromChangesFeatureSource"
|
||||
import {NewGeometryFromChangesFeatureSource} from "../Logic/FeatureSource/Sources/NewGeometryFromChangesFeatureSource"
|
||||
import OsmObjectDownloader from "../Logic/Osm/OsmObjectDownloader"
|
||||
import ShowOverlayRasterLayer from "../UI/Map/ShowOverlayRasterLayer"
|
||||
import { Utils } from "../Utils"
|
||||
import { EliCategory } from "./RasterLayerProperties"
|
||||
import {Utils} from "../Utils"
|
||||
import {EliCategory} from "./RasterLayerProperties"
|
||||
import BackgroundLayerResetter from "../Logic/Actors/BackgroundLayerResetter"
|
||||
import SaveFeatureSourceToLocalStorage from "../Logic/FeatureSource/Actors/SaveFeatureSourceToLocalStorage"
|
||||
import BBoxFeatureSource from "../Logic/FeatureSource/Sources/TouchesBboxFeatureSource"
|
||||
import ThemeViewStateHashActor from "../Logic/Web/ThemeViewStateHashActor"
|
||||
import NoElementsInViewDetector, {
|
||||
FeatureViewState,
|
||||
} from "../Logic/Actors/NoElementsInViewDetector"
|
||||
import NoElementsInViewDetector, {FeatureViewState,} from "../Logic/Actors/NoElementsInViewDetector"
|
||||
import FilteredLayer from "./FilteredLayer";
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -160,7 +155,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
rasterInfo.defaultState ?? true,
|
||||
"Wether or not overlayer layer " + rasterInfo.id + " is shown"
|
||||
)
|
||||
const state = { isDisplayed }
|
||||
const state = {isDisplayed}
|
||||
overlayLayerStates.set(rasterInfo.id, state)
|
||||
new ShowOverlayRasterLayer(rasterInfo, this.map, this.mapProperties, state)
|
||||
}
|
||||
|
@ -378,7 +373,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
|
||||
private initHotkeys() {
|
||||
Hotkeys.RegisterHotkey(
|
||||
{ nomod: "Escape", onUp: true },
|
||||
{nomod: "Escape", onUp: true},
|
||||
Translations.t.hotkeyDocumentation.closeSidebar,
|
||||
() => {
|
||||
this.selectedElement.setData(undefined)
|
||||
|
@ -399,7 +394,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
)
|
||||
|
||||
Hotkeys.RegisterHotkey(
|
||||
{ shift: "O" },
|
||||
{shift: "O"},
|
||||
Translations.t.hotkeyDocumentation.selectMapnik,
|
||||
() => {
|
||||
this.mapProperties.rasterLayer.setData(AvailableRasterLayers.osmCarto)
|
||||
|
@ -418,17 +413,17 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
}
|
||||
|
||||
Hotkeys.RegisterHotkey(
|
||||
{ nomod: "O" },
|
||||
{nomod: "O"},
|
||||
Translations.t.hotkeyDocumentation.selectOsmbasedmap,
|
||||
() => setLayerCategory("osmbasedmap")
|
||||
)
|
||||
|
||||
Hotkeys.RegisterHotkey({ nomod: "M" }, Translations.t.hotkeyDocumentation.selectMap, () =>
|
||||
Hotkeys.RegisterHotkey({nomod: "M"}, Translations.t.hotkeyDocumentation.selectMap, () =>
|
||||
setLayerCategory("map")
|
||||
)
|
||||
|
||||
Hotkeys.RegisterHotkey(
|
||||
{ nomod: "P" },
|
||||
{nomod: "P"},
|
||||
Translations.t.hotkeyDocumentation.selectAerial,
|
||||
() => setLayerCategory("photo")
|
||||
)
|
||||
|
@ -496,7 +491,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
),
|
||||
range: new StaticFeatureSource(
|
||||
this.mapProperties.maxbounds.map((bbox) =>
|
||||
bbox === undefined ? empty : <Feature[]>[bbox.asGeoJson({ id: "range" })]
|
||||
bbox === undefined ? empty : <Feature[]>[bbox.asGeoJson({id: "range"})]
|
||||
)
|
||||
),
|
||||
current_view: this.currentView,
|
||||
|
@ -526,9 +521,14 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
})
|
||||
}
|
||||
|
||||
this.layerState.filteredLayers
|
||||
const rangeFLayer: FilteredLayer = this.layerState.filteredLayers
|
||||
.get("range")
|
||||
?.isDisplayed?.syncWith(this.featureSwitches.featureSwitchIsTesting, true)
|
||||
|
||||
const rangeIsDisplayed = rangeFLayer?.isDisplayed
|
||||
|
||||
if (!QueryParameters.wasInitialized(FilteredLayer.queryParameterKey(rangeFLayer.layerDef))) {
|
||||
rangeIsDisplayed?.syncWith(this.featureSwitches.featureSwitchIsTesting, true)
|
||||
}
|
||||
|
||||
this.layerState.filteredLayers.forEach((flayer) => {
|
||||
const id = flayer.layerDef.id
|
||||
|
|
|
@ -458,6 +458,7 @@ export default class ShowDataLayer {
|
|||
features: FeatureSource,
|
||||
doShowLayer?: Store<boolean>
|
||||
): ShowDataLayer {
|
||||
|
||||
return new ShowDataLayer(map, {
|
||||
layer: ShowDataLayer.rangeLayer,
|
||||
features,
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
"title": null,
|
||||
"source": "special",
|
||||
"name": null,
|
||||
"shownByDefault": false,
|
||||
"mapRendering": [
|
||||
{
|
||||
"width": 3,
|
||||
|
|
Loading…
Reference in a new issue