forked from MapComplete/MapComplete
Refactoring: move all code files into a src directory
This commit is contained in:
parent
de99f56ca8
commit
e75d2789d2
389 changed files with 0 additions and 12 deletions
19
src/Logic/FeatureSource/Sources/ClippedFeatureSource.ts
Normal file
19
src/Logic/FeatureSource/Sources/ClippedFeatureSource.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import { FeatureSource } from "../FeatureSource"
|
||||
import { Feature, Polygon } from "geojson"
|
||||
import StaticFeatureSource from "./StaticFeatureSource"
|
||||
import { GeoOperations } from "../../GeoOperations"
|
||||
|
||||
/**
|
||||
* Returns a clipped version of the original geojson. Ways which partially intersect the given feature will be split up
|
||||
*
|
||||
* Also @see: GeoOperations.spreadIntoBboxes
|
||||
*/
|
||||
export default class ClippedFeatureSource extends StaticFeatureSource {
|
||||
constructor(features: FeatureSource, clipTo: Feature<Polygon>) {
|
||||
super(
|
||||
features.features.mapD((features) => {
|
||||
return [].concat(features.map((feature) => GeoOperations.clipWith(feature, clipTo)))
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue