forked from MapComplete/MapComplete
		
	Merge branch 'develop' into feature/maproulette
This commit is contained in:
		
						commit
						64288ec1b8
					
				
					 20 changed files with 402 additions and 241 deletions
				
			
		|  | @ -24,6 +24,7 @@ import FullNodeDatabaseSource from "./TiledFeatureSource/FullNodeDatabaseSource" | |||
| import MapState from "../State/MapState"; | ||||
| import {ElementStorage} from "../ElementStorage"; | ||||
| import {Feature, Geometry} from "@turf/turf"; | ||||
| import {OsmFeature} from "../../Models/OsmFeature"; | ||||
| 
 | ||||
| 
 | ||||
| /** | ||||
|  | @ -338,15 +339,19 @@ export default class FeaturePipeline { | |||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     public GetAllFeaturesWithin(bbox: BBox): Feature<Geometry, {id: string}>[][] { | ||||
|     public GetAllFeaturesWithin(bbox: BBox): OsmFeature[][] { | ||||
|         const self = this | ||||
|         const tiles = [] | ||||
|         const tiles: OsmFeature[][] = [] | ||||
|         Array.from(this.perLayerHierarchy.keys()) | ||||
|             .forEach(key => tiles.push(...self.GetFeaturesWithin(key, bbox))) | ||||
|             .forEach(key => { | ||||
|                 const fetched : OsmFeature[][] = self.GetFeaturesWithin(key, bbox) | ||||
|                 tiles.push(...fetched); | ||||
|             }) | ||||
|         return tiles; | ||||
|     } | ||||
| 
 | ||||
|     public GetAllFeaturesAndMetaWithin(bbox: BBox, layerIdWhitelist?: Set<string>): {features: any[], layer: string}[] { | ||||
|     public GetAllFeaturesAndMetaWithin(bbox: BBox, layerIdWhitelist?: Set<string>):  | ||||
|         {features: OsmFeature[], layer: string}[] { | ||||
|         const self = this | ||||
|         const tiles :{features: any[], layer: string}[]= [] | ||||
|         Array.from(this.perLayerHierarchy.keys()) | ||||
|  | @ -362,7 +367,11 @@ export default class FeaturePipeline { | |||
|         return tiles; | ||||
|     } | ||||
| 
 | ||||
|     public GetFeaturesWithin(layerId: string, bbox: BBox): any[][] { | ||||
|     /** | ||||
|      * Gets all the tiles which overlap with the given BBOX. | ||||
|      * This might imply that extra features might be shown | ||||
|      */ | ||||
|     public GetFeaturesWithin(layerId: string, bbox: BBox): OsmFeature[][] { | ||||
|         if (layerId === "*") { | ||||
|             return this.GetAllFeaturesWithin(bbox) | ||||
|         } | ||||
|  |  | |||
|  | @ -1,9 +1,11 @@ | |||
| import {Store, UIEventSource} from "../UIEventSource"; | ||||
| import FilteredLayer from "../../Models/FilteredLayer"; | ||||
| import {BBox} from "../BBox"; | ||||
| import {Feature, Geometry} from "@turf/turf"; | ||||
| import {OsmFeature} from "../../Models/OsmFeature"; | ||||
| 
 | ||||
| export default interface FeatureSource { | ||||
|     features: Store<{ feature: any, freshness: Date }[]>; | ||||
|     features: Store<{ feature: OsmFeature, freshness: Date }[]>; | ||||
|     /** | ||||
|      * Mainly used for debuging | ||||
|      */ | ||||
|  | @ -28,12 +30,3 @@ export interface FeatureSourceForLayer extends FeatureSource { | |||
| export interface IndexedFeatureSource extends FeatureSource { | ||||
|     readonly containedIds: Store<Set<string>> | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * A feature source which has some extra data about it's state | ||||
|  */ | ||||
| export interface FeatureSourceState { | ||||
|     readonly sufficientlyZoomed: Store<boolean>; | ||||
|     readonly runningQuery: Store<boolean>; | ||||
|     readonly timeout: Store<number>; | ||||
| } | ||||
|  |  | |||
|  | @ -13,7 +13,7 @@ export default interface TileHierarchy<T extends FeatureSource & Tiled> { | |||
| export class TileHierarchyTools { | ||||
| 
 | ||||
|     public static getTiles<T extends FeatureSource & Tiled>(hierarchy: TileHierarchy<T>, bbox: BBox): T[] { | ||||
|         const result = [] | ||||
|         const result: T[] = [] | ||||
|         hierarchy.loadedTiles.forEach((tile) => { | ||||
|             if (tile.bbox.overlapsWith(bbox)) { | ||||
|                 result.push(tile) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue