forked from MapComplete/MapComplete
		
	First attempt to use less resources
This commit is contained in:
		
							parent
							
								
									f3dac0d429
								
							
						
					
					
						commit
						9574259e75
					
				
					 4 changed files with 26 additions and 6 deletions
				
			
		|  | @ -49,7 +49,7 @@ export default class FilteringFeatureSource implements FeatureSourceForLayer, Ti | |||
|             self.update() | ||||
|         }) | ||||
| 
 | ||||
|         this._is_dirty.stabilized(250).addCallbackAndRunD(dirty => { | ||||
|         this._is_dirty.stabilized(1000).addCallbackAndRunD(dirty => { | ||||
|             if (dirty) { | ||||
|                 self.update() | ||||
|             } | ||||
|  |  | |||
|  | @ -54,8 +54,8 @@ export class NewGeometryFromChangesFeatureSource implements FeatureSource { | |||
|                     // In _most_ of the cases, this means that this _isn't_ a new object
 | ||||
|                     // However, when a point is snapped to an already existing point, we have to create a representation for this point!
 | ||||
|                     // For this, we introspect the change
 | ||||
|                     if (allElementStorage.has(change.id)) { | ||||
|                         // const currentTags = allElementStorage.getEventSourceById(change.id).data
 | ||||
|                     if (allElementStorage.has(change.type + "/" + change.id)) { | ||||
|                         // The current point already exists, we don't have to do anything here
 | ||||
|                         continue; | ||||
|                     } | ||||
|                     console.debug("Detected a reused point") | ||||
|  |  | |||
|  | @ -12,6 +12,9 @@ import {BBox} from "../BBox"; | |||
| import FeatureInfoBox from "../../UI/Popup/FeatureInfoBox"; | ||||
| import {FeatureSourceForLayer, Tiled} from "../FeatureSource/FeatureSource"; | ||||
| import MetaTagRecalculator from "../FeatureSource/Actors/MetaTagRecalculator"; | ||||
| import ScrollableFullScreen from "../../UI/Base/ScrollableFullScreen"; | ||||
| import BaseUIElement from "../../UI/BaseUIElement"; | ||||
| import LayerConfig from "../../Models/ThemeConfig/LayerConfig"; | ||||
| 
 | ||||
| export default class FeaturePipelineState extends MapState { | ||||
| 
 | ||||
|  | @ -21,7 +24,8 @@ export default class FeaturePipelineState extends MapState { | |||
|     public readonly featurePipeline: FeaturePipeline; | ||||
|     private readonly featureAggregator: TileHierarchyAggregator; | ||||
|     private readonly metatagRecalculator: MetaTagRecalculator | ||||
| 
 | ||||
|     private readonly popups : Map<string, ScrollableFullScreen> = new Map<string, ScrollableFullScreen>(); | ||||
|      | ||||
|     constructor(layoutToUse: LayoutConfig) { | ||||
|         super(layoutToUse); | ||||
| 
 | ||||
|  | @ -48,7 +52,8 @@ export default class FeaturePipelineState extends MapState { | |||
|                 self.metatagRecalculator.registerSource(source) | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|          | ||||
|          | ||||
|         function registerSource(source: FeatureSourceForLayer & Tiled) { | ||||
| 
 | ||||
|             clusterCounter.addTile(source) | ||||
|  | @ -117,7 +122,7 @@ export default class FeaturePipelineState extends MapState { | |||
|                     doShowLayer: doShowFeatures, | ||||
|                     selectedElement: self.selectedElement, | ||||
|                     state: self, | ||||
|                     popup: (tags, layer) => new FeatureInfoBox(tags, layer, self) | ||||
|                     popup: (tags, layer) => self.CreatePopup(tags, layer) | ||||
|                 } | ||||
|             ) | ||||
|         } | ||||
|  | @ -134,6 +139,15 @@ export default class FeaturePipelineState extends MapState { | |||
|         this.AddClusteringToMap(this.leafletMap) | ||||
| 
 | ||||
|     } | ||||
|      | ||||
|     public CreatePopup(tags:any , layer: LayerConfig): ScrollableFullScreen{ | ||||
|         if(this.popups.has(tags.id)){ | ||||
|             return this.popups.get(tags.id) | ||||
|         } | ||||
|         const popup = new FeatureInfoBox(tags, layer, this) | ||||
|         this.popups.set(tags.id, popup) | ||||
|         return popup | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Adds the cluster-tiles to the given map | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue