forked from MapComplete/MapComplete
refactoring
This commit is contained in:
parent
b94a8f5745
commit
5d0fe31c41
114 changed files with 2412 additions and 2958 deletions
17
Logic/FeatureSource/Sources/ClippedFeatureSource.ts
Normal file
17
Logic/FeatureSource/Sources/ClippedFeatureSource.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
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
|
||||
*/
|
||||
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