forked from MapComplete/MapComplete
refactoring: Remove more obsoleted code, add copyright tab
This commit is contained in:
parent
f8d34648a0
commit
042d400dc4
20 changed files with 44 additions and 342 deletions
|
@ -1,4 +1,4 @@
|
|||
import { FeatureSource , FeatureSourceForLayer } from "../FeatureSource"
|
||||
import { FeatureSource, FeatureSourceForLayer } from "../FeatureSource"
|
||||
import { Feature } from "geojson"
|
||||
import { BBox } from "../../BBox"
|
||||
import { GeoOperations } from "../../GeoOperations"
|
||||
|
@ -26,9 +26,12 @@ export default class GeoIndexedStore implements FeatureSource {
|
|||
public GetFeaturesWithin(bbox: BBox): Feature[] {
|
||||
// TODO optimize
|
||||
const bboxFeature = bbox.asGeoJson({})
|
||||
return this.features.data.filter(
|
||||
(f) => GeoOperations.intersect(f, bboxFeature) !== undefined
|
||||
)
|
||||
return this.features.data.filter((f) => {
|
||||
if (f.geometry.type === "Point") {
|
||||
return bbox.contains(<[number, number]>f.geometry.coordinates)
|
||||
}
|
||||
return GeoOperations.intersect(f, bboxFeature) !== undefined
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue