forked from MapComplete/MapComplete
refactoring
This commit is contained in:
parent
b94a8f5745
commit
5d0fe31c41
114 changed files with 2412 additions and 2958 deletions
29
Logic/FeatureSource/Sources/TouchesBboxFeatureSource.ts
Normal file
29
Logic/FeatureSource/Sources/TouchesBboxFeatureSource.ts
Normal file
|
@ -0,0 +1,29 @@
|
|||
import FeatureSource, { FeatureSourceForLayer } from "../FeatureSource"
|
||||
import StaticFeatureSource from "./StaticFeatureSource"
|
||||
import { GeoOperations } from "../../GeoOperations"
|
||||
import { BBox } from "../../BBox"
|
||||
import exp from "constants"
|
||||
import FilteredLayer from "../../../Models/FilteredLayer"
|
||||
|
||||
/**
|
||||
* Results in a feature source which has all the elements that touch the given features
|
||||
*/
|
||||
export default class BBoxFeatureSource extends StaticFeatureSource {
|
||||
constructor(features: FeatureSource, mustTouch: BBox) {
|
||||
const bbox = mustTouch.asGeoJson({})
|
||||
super(
|
||||
features.features.mapD((features) =>
|
||||
features.filter((feature) => GeoOperations.intersect(feature, bbox) !== undefined)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export class BBoxFeatureSourceForLayer extends BBoxFeatureSource implements FeatureSourceForLayer {
|
||||
constructor(features: FeatureSourceForLayer, mustTouch: BBox) {
|
||||
super(features, mustTouch)
|
||||
this.layer = features.layer
|
||||
}
|
||||
|
||||
readonly layer: FilteredLayer
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue