Full code cleanup

This commit is contained in:
Pieter Vander Vennet 2021-11-07 16:34:51 +01:00
parent 8e6ee8c87f
commit bd21212eba
246 changed files with 19418 additions and 11729 deletions

View file

@ -97,7 +97,7 @@ export default class FeaturePipelineState extends MapState {
}, this
);
new SelectedFeatureHandler(Hash.hash, this)
this.AddClusteringToMap(this.leafletMap)
}

View file

@ -146,7 +146,7 @@ export default class FeatureSwitchState {
this.featureSwitchIsTesting = QueryParameters.GetBooleanQueryParameter(
"test",
""+testingDefaultValue,
"" + testingDefaultValue,
"If true, 'dryrun' mode is activated. The app will behave as normal, except that changes to OSM will be printed onto the console instead of actually uploaded to osm.org"
)
@ -158,7 +158,7 @@ export default class FeatureSwitchState {
this.featureSwitchFakeUser = QueryParameters.GetBooleanQueryParameter("fake-user", "false",
"If true, 'dryrun' mode is activated and a fake user account is loaded")
this.overpassUrl = QueryParameters.GetQueryParameter("overpassUrl",
(layoutToUse?.overpassUrl ?? Constants.defaultOverpassUrls).join(","),

View file

@ -14,7 +14,6 @@ import {QueryParameters} from "../Web/QueryParameters";
import * as personal from "../../assets/themes/personal/personal.json";
import FilterConfig from "../../Models/ThemeConfig/FilterConfig";
import ShowOverlayLayer from "../../UI/ShowDataLayer/ShowOverlayLayer";
import {Coord} from "@turf/turf";
/**
* Contains all the leaflet-map related state
@ -123,7 +122,21 @@ export default class MapState extends UserRelatedState {
this.AddAllOverlaysToMap(this.leafletMap)
}
public AddAllOverlaysToMap(leafletMap: UIEventSource<any>) {
const initialized = new Set()
for (const overlayToggle of this.overlayToggles) {
new ShowOverlayLayer(overlayToggle.config, leafletMap, overlayToggle.isDisplayed)
initialized.add(overlayToggle.config)
}
for (const tileLayerSource of this.layoutToUse.tileLayerSources) {
if (initialized.has(tileLayerSource)) {
continue
}
new ShowOverlayLayer(tileLayerSource, leafletMap)
}
}
private lockBounds() {
const layout = this.layoutToUse;
@ -201,21 +214,5 @@ export default class MapState extends UserRelatedState {
return new UIEventSource<FilteredLayer[]>(flayers);
}
public AddAllOverlaysToMap(leafletMap: UIEventSource<any>) {
const initialized = new Set()
for (const overlayToggle of this.overlayToggles) {
new ShowOverlayLayer(overlayToggle.config, leafletMap, overlayToggle.isDisplayed)
initialized.add(overlayToggle.config)
}
for (const tileLayerSource of this.layoutToUse.tileLayerSources) {
if (initialized.has(tileLayerSource)) {
continue
}
new ShowOverlayLayer(tileLayerSource, leafletMap)
}
}
}

View file

@ -64,7 +64,7 @@ export default class UserRelatedState extends ElementsState {
if (layoutToUse?.hideFromOverview) {
this.osmConnection.isLoggedIn.addCallbackAndRunD(loggedIn => {
if(loggedIn){
if (loggedIn) {
this.osmConnection
.GetPreference("hidden-theme-" + layoutToUse?.id + "-enabled")
.setData("true");
@ -129,7 +129,7 @@ export default class UserRelatedState extends ElementsState {
}
return [home.lon, home.lat]
})).map(homeLonLat => {
if(homeLonLat === undefined){
if (homeLonLat === undefined) {
return empty
}
return [{
@ -148,5 +148,5 @@ export default class UserRelatedState extends ElementsState {
this.homeLocation = new StaticFeatureSource(feature, false)
}
}