forked from MapComplete/MapComplete
		
	Merge master
This commit is contained in:
		
						commit
						5e5528eb7d
					
				
					 13 changed files with 160 additions and 126 deletions
				
			
		|  | @ -58,7 +58,7 @@ export default class FeaturePipeline { | |||
|     private readonly freshnesses = new Map<string, TileFreshnessCalculator>(); | ||||
| 
 | ||||
|     private readonly oldestAllowedDate: Date = new Date(new Date().getTime() - 60 * 60 * 24 * 30 * 1000); | ||||
|     private readonly osmSourceZoomLevel = 14 | ||||
|     private readonly osmSourceZoomLevel = 15 | ||||
| 
 | ||||
|     constructor( | ||||
|         handleFeatureSource: (source: FeatureSourceForLayer & Tiled) => void, | ||||
|  | @ -147,7 +147,7 @@ export default class FeaturePipeline { | |||
|                     // We split them up into tiles anyway as it is an OSM source
 | ||||
|                     TiledFeatureSource.createHierarchy(src, { | ||||
|                         layer: src.layer, | ||||
|                         minZoomLevel: 14, | ||||
|                         minZoomLevel: this.osmSourceZoomLevel, | ||||
|                         dontEnforceMinZoom: true, | ||||
|                         registerTile: (tile) => { | ||||
|                             new RegisteringAllFromFeatureSourceActor(tile) | ||||
|  | @ -155,7 +155,7 @@ export default class FeaturePipeline { | |||
|                             tile.features.addCallbackAndRunD(_ => self.newDataLoadedSignal.setData(tile)) | ||||
|                         } | ||||
|                     }) | ||||
|                 }else{ | ||||
|                 } else { | ||||
|                     new RegisteringAllFromFeatureSourceActor(src) | ||||
|                     perLayerHierarchy.get(id).registerTile(src) | ||||
|                     src.features.addCallbackAndRunD(_ => self.newDataLoadedSignal.setData(src)) | ||||
|  | @ -200,7 +200,7 @@ export default class FeaturePipeline { | |||
|         new PerLayerFeatureSourceSplitter(state.filteredLayers, | ||||
|             (source) => TiledFeatureSource.createHierarchy(source, { | ||||
|                 layer: source.layer, | ||||
|                 minZoomLevel: 14, | ||||
|                 minZoomLevel: source.layer.layerDef.minzoom, | ||||
|                 dontEnforceMinZoom: true, | ||||
|                 maxFeatureCount: state.layoutToUse.clustering.minNeededElements, | ||||
|                 maxZoomLevel: state.layoutToUse.clustering.maxZoom, | ||||
|  | @ -235,7 +235,7 @@ export default class FeaturePipeline { | |||
| 
 | ||||
| 
 | ||||
|         // Whenever fresh data comes in, we need to update the metatagging
 | ||||
|         self.newDataLoadedSignal.stabilized(1000).addCallback(src => { | ||||
|         self.newDataLoadedSignal.stabilized(1000).addCallback(_ => { | ||||
|             self.updateAllMetaTagging() | ||||
|         }) | ||||
| 
 | ||||
|  | @ -276,15 +276,15 @@ export default class FeaturePipeline { | |||
|         const self = this | ||||
|         return this.state.currentBounds.map(bbox => { | ||||
|             if (bbox === undefined) { | ||||
|                 return | ||||
|                 return undefined | ||||
|             } | ||||
|             if (!isSufficientlyZoomed.data) { | ||||
|                 return; | ||||
|                 return undefined; | ||||
|             } | ||||
|             const osmSourceZoomLevel = self.osmSourceZoomLevel | ||||
|             const range = bbox.containingTileRange(osmSourceZoomLevel) | ||||
|             const tileIndexes = [] | ||||
|             if (range.total > 100) { | ||||
|             if (range.total >= 100) { | ||||
|                 // Too much tiles!
 | ||||
|                 return [] | ||||
|             } | ||||
|  | @ -294,7 +294,7 @@ export default class FeaturePipeline { | |||
|                 if (oldestDate !== undefined && oldestDate > this.oldestAllowedDate) { | ||||
|                     console.debug("Skipping tile", osmSourceZoomLevel, x, y, "as a decently fresh one is available") | ||||
|                     // The cached tiles contain decently fresh data
 | ||||
|                     return; | ||||
|                     return undefined; | ||||
|                 } | ||||
|                 tileIndexes.push(i) | ||||
|             }) | ||||
|  | @ -327,28 +327,30 @@ export default class FeaturePipeline { | |||
|             } | ||||
| 
 | ||||
|             const range = bbox.containingTileRange(zoom) | ||||
|             if (range.total > 100) { | ||||
|             if (range.total >= 5000) { | ||||
|                 return false | ||||
|             } | ||||
|             const self = this; | ||||
|             const allFreshnesses = Tiles.MapRange(range, (x, y) => self.freshnessForVisibleLayers(zoom, x, y)) | ||||
|             return allFreshnesses.some(freshness => freshness === undefined || freshness < this.oldestAllowedDate) | ||||
| 
 | ||||
|         }, [state.locationControl]) | ||||
| 
 | ||||
|         const self = this; | ||||
|         const updater = new OverpassFeatureSource(state, | ||||
|             { | ||||
|                 padToTiles: state.locationControl.map(l => Math.min(15, l.zoom + 1)), | ||||
|                 relationTracker: this.relationTracker, | ||||
|                 isActive: useOsmApi.map(b => !b && overpassIsActive.data, [overpassIsActive]), | ||||
|                 onBboxLoaded: ((bbox, date, downloadedLayers) => { | ||||
|                     Tiles.MapRange(bbox.containingTileRange(self.osmSourceZoomLevel), (x, y) => { | ||||
|                 onBboxLoaded: (bbox, date, downloadedLayers, paddedToZoomLevel) => { | ||||
|                     Tiles.MapRange(bbox.containingTileRange(paddedToZoomLevel), (x, y) => { | ||||
|                        const tileIndex =  Tiles.tile_index(paddedToZoomLevel, x, y) | ||||
|                         downloadedLayers.forEach(layer => { | ||||
|                             SaveTileToLocalStorageActor.MarkVisited(layer.id, Tiles.tile_index(this.osmSourceZoomLevel, x, y), date) | ||||
|                             self.freshnesses.get(layer.id).addTileLoad(tileIndex, date) | ||||
|                             SaveTileToLocalStorageActor.MarkVisited(layer.id, tileIndex, date) | ||||
|                         }) | ||||
|                     }) | ||||
| 
 | ||||
|                 }) | ||||
|                 } | ||||
|             }); | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue