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() |             self.update() | ||||||
|         }) |         }) | ||||||
| 
 | 
 | ||||||
|         this._is_dirty.stabilized(250).addCallbackAndRunD(dirty => { |         this._is_dirty.stabilized(1000).addCallbackAndRunD(dirty => { | ||||||
|             if (dirty) { |             if (dirty) { | ||||||
|                 self.update() |                 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
 |                     // 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!
 |                     // 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
 |                     // For this, we introspect the change
 | ||||||
|                     if (allElementStorage.has(change.id)) { |                     if (allElementStorage.has(change.type + "/" + change.id)) { | ||||||
|                         // const currentTags = allElementStorage.getEventSourceById(change.id).data
 |                         // The current point already exists, we don't have to do anything here
 | ||||||
|                         continue; |                         continue; | ||||||
|                     } |                     } | ||||||
|                     console.debug("Detected a reused point") |                     console.debug("Detected a reused point") | ||||||
|  |  | ||||||
|  | @ -12,6 +12,9 @@ import {BBox} from "../BBox"; | ||||||
| import FeatureInfoBox from "../../UI/Popup/FeatureInfoBox"; | import FeatureInfoBox from "../../UI/Popup/FeatureInfoBox"; | ||||||
| import {FeatureSourceForLayer, Tiled} from "../FeatureSource/FeatureSource"; | import {FeatureSourceForLayer, Tiled} from "../FeatureSource/FeatureSource"; | ||||||
| import MetaTagRecalculator from "../FeatureSource/Actors/MetaTagRecalculator"; | 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 { | export default class FeaturePipelineState extends MapState { | ||||||
| 
 | 
 | ||||||
|  | @ -21,6 +24,7 @@ export default class FeaturePipelineState extends MapState { | ||||||
|     public readonly featurePipeline: FeaturePipeline; |     public readonly featurePipeline: FeaturePipeline; | ||||||
|     private readonly featureAggregator: TileHierarchyAggregator; |     private readonly featureAggregator: TileHierarchyAggregator; | ||||||
|     private readonly metatagRecalculator: MetaTagRecalculator |     private readonly metatagRecalculator: MetaTagRecalculator | ||||||
|  |     private readonly popups : Map<string, ScrollableFullScreen> = new Map<string, ScrollableFullScreen>(); | ||||||
|      |      | ||||||
|     constructor(layoutToUse: LayoutConfig) { |     constructor(layoutToUse: LayoutConfig) { | ||||||
|         super(layoutToUse); |         super(layoutToUse); | ||||||
|  | @ -49,6 +53,7 @@ export default class FeaturePipelineState extends MapState { | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|          |          | ||||||
|  |          | ||||||
|         function registerSource(source: FeatureSourceForLayer & Tiled) { |         function registerSource(source: FeatureSourceForLayer & Tiled) { | ||||||
| 
 | 
 | ||||||
|             clusterCounter.addTile(source) |             clusterCounter.addTile(source) | ||||||
|  | @ -117,7 +122,7 @@ export default class FeaturePipelineState extends MapState { | ||||||
|                     doShowLayer: doShowFeatures, |                     doShowLayer: doShowFeatures, | ||||||
|                     selectedElement: self.selectedElement, |                     selectedElement: self.selectedElement, | ||||||
|                     state: self, |                     state: self, | ||||||
|                     popup: (tags, layer) => new FeatureInfoBox(tags, layer, self) |                     popup: (tags, layer) => self.CreatePopup(tags, layer) | ||||||
|                 } |                 } | ||||||
|             ) |             ) | ||||||
|         } |         } | ||||||
|  | @ -135,6 +140,15 @@ export default class FeaturePipelineState extends MapState { | ||||||
| 
 | 
 | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     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 |      * Adds the cluster-tiles to the given map | ||||||
|      * @param leafletMap: a UIEventSource possible having a leaflet map |      * @param leafletMap: a UIEventSource possible having a leaflet map | ||||||
|  |  | ||||||
|  | @ -46,6 +46,12 @@ export default class ShowDataLayer { | ||||||
|     private readonly showDataLayerid: number; |     private readonly showDataLayerid: number; | ||||||
|     private readonly createPopup: (tags: any, layer: LayerConfig) => ScrollableFullScreen |     private readonly createPopup: (tags: any, layer: LayerConfig) => ScrollableFullScreen | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Creates a datalayer. | ||||||
|  |      *  | ||||||
|  |      * If 'createPopup' is set, this function is called every time that 'popupOpen' is called | ||||||
|  |      * @param options | ||||||
|  |      */ | ||||||
|     constructor(options: ShowDataLayerOptions & { layerToShow: LayerConfig }) { |     constructor(options: ShowDataLayerOptions & { layerToShow: LayerConfig }) { | ||||||
|         this._leafletMap = options.leafletMap; |         this._leafletMap = options.leafletMap; | ||||||
|         this.showDataLayerid = ShowDataLayer.dataLayerIds; |         this.showDataLayerid = ShowDataLayer.dataLayerIds; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue