forked from MapComplete/MapComplete
Full code cleanup
This commit is contained in:
parent
3a4a2a2016
commit
fa971ffbbf
300 changed files with 16352 additions and 19284 deletions
|
@ -49,7 +49,7 @@ export default class ElementsState extends FeatureSwitchState {
|
|||
super(layoutToUse);
|
||||
|
||||
// @ts-ignore
|
||||
this.changes = new Changes(this,layoutToUse?.isLeftRightSensitive() ?? false)
|
||||
this.changes = new Changes(this, layoutToUse?.isLeftRightSensitive() ?? false)
|
||||
{
|
||||
// -- Location control initialization
|
||||
const zoom = UIEventSource.asFloat(
|
||||
|
|
|
@ -20,7 +20,8 @@ export default class FeaturePipelineState extends MapState {
|
|||
*/
|
||||
public readonly featurePipeline: FeaturePipeline;
|
||||
private readonly featureAggregator: TileHierarchyAggregator;
|
||||
private readonly metatagRecalculator : MetaTagRecalculator
|
||||
private readonly metatagRecalculator: MetaTagRecalculator
|
||||
|
||||
constructor(layoutToUse: LayoutConfig) {
|
||||
super(layoutToUse);
|
||||
|
||||
|
@ -33,21 +34,21 @@ private readonly metatagRecalculator : MetaTagRecalculator
|
|||
* We are a bit in a bind:
|
||||
* There is the featurePipeline, which creates some sources during construction
|
||||
* THere is the metatagger, which needs to have these sources registered AND which takes a FeaturePipeline as argument
|
||||
*
|
||||
*
|
||||
* This is a bit of a catch-22 (except that it isn't)
|
||||
* The sources that are registered in the constructor are saved into 'registeredSources' temporary
|
||||
*
|
||||
* The sources that are registered in the constructor are saved into 'registeredSources' temporary
|
||||
*
|
||||
*/
|
||||
const sourcesToRegister = []
|
||||
|
||||
function registerRaw(source: FeatureSourceForLayer & Tiled){
|
||||
if(self.metatagRecalculator === undefined){
|
||||
|
||||
function registerRaw(source: FeatureSourceForLayer & Tiled) {
|
||||
if (self.metatagRecalculator === undefined) {
|
||||
sourcesToRegister.push(source)
|
||||
}else{
|
||||
} else {
|
||||
self.metatagRecalculator.registerSource(source)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function registerSource(source: FeatureSourceForLayer & Tiled) {
|
||||
|
||||
clusterCounter.addTile(source)
|
||||
|
@ -127,7 +128,7 @@ private readonly metatagRecalculator : MetaTagRecalculator
|
|||
this.metatagRecalculator.registerSource(this.currentView, true)
|
||||
|
||||
sourcesToRegister.forEach(source => self.metatagRecalculator.registerSource(source))
|
||||
|
||||
|
||||
new SelectedFeatureHandler(Hash.hash, this)
|
||||
|
||||
this.AddClusteringToMap(this.leafletMap)
|
||||
|
|
|
@ -223,7 +223,7 @@ export default class MapState extends UserRelatedState {
|
|||
private initGpsLocation() {
|
||||
// Initialize the gps layer data. This is emtpy for now, the actual writing happens in the Geolocationhandler
|
||||
let gpsLayerDef: FilteredLayer = this.filteredLayers.data.filter(l => l.layerDef.id === "gps_location")[0]
|
||||
if(gpsLayerDef === undefined){
|
||||
if (gpsLayerDef === undefined) {
|
||||
return
|
||||
}
|
||||
this.currentUserLocation = new SimpleFeatureSource(gpsLayerDef, Tiles.tile_index(0, 0, 0));
|
||||
|
@ -269,7 +269,7 @@ export default class MapState extends UserRelatedState {
|
|||
|
||||
|
||||
let gpsLayerDef: FilteredLayer = this.filteredLayers.data.filter(l => l.layerDef.id === "gps_location_history")[0]
|
||||
if(gpsLayerDef !== undefined){
|
||||
if (gpsLayerDef !== undefined) {
|
||||
this.historicalUserLocations = new SimpleFeatureSource(gpsLayerDef, Tiles.tile_index(0, 0, 0), features);
|
||||
}
|
||||
|
||||
|
@ -299,7 +299,7 @@ export default class MapState extends UserRelatedState {
|
|||
}]
|
||||
})
|
||||
let gpsLineLayerDef: FilteredLayer = this.filteredLayers.data.filter(l => l.layerDef.id === "gps_track")[0]
|
||||
if(gpsLineLayerDef !== undefined){
|
||||
if (gpsLineLayerDef !== undefined) {
|
||||
this.historicalUserLocationsTrack = new SimpleFeatureSource(gpsLineLayerDef, Tiles.tile_index(0, 0, 0), asLine);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,14 +96,14 @@ export default class UserRelatedState extends ElementsState {
|
|||
// We wait till we are logged in
|
||||
return
|
||||
}
|
||||
|
||||
if(self.osmConnection.isLoggedIn.data == false){
|
||||
|
||||
if (self.osmConnection.isLoggedIn.data == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentThemes.some(installed => installed.id === this.layoutToUse.id)) {
|
||||
// Already added to the 'installed theme' list
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("Current installed themes are", this.installedThemes.data)
|
||||
|
@ -115,13 +115,11 @@ export default class UserRelatedState extends ElementsState {
|
|||
})
|
||||
self.installedThemes.ping()
|
||||
console.log("Registered " + self.layoutToUse.id + " as installed themes")
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Important: the favourite layers are initialized _after_ the installed themes, as these might contain an installedTheme
|
||||
this.favouriteLayers = LocalStorageSource.Get("favouriteLayers")
|
||||
.syncWith(this.osmConnection.GetLongPreference("favouriteLayers"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue