mapcomplete/Logic/FeatureSource/FeatureSource.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
766 B
TypeScript
Raw Normal View History

2023-03-28 05:13:48 +02:00
import { Store, UIEventSource } from "../UIEventSource"
import FilteredLayer from "../../Models/FilteredLayer"
import { Feature } from "geojson"
2021-01-03 00:19:42 +01:00
2023-04-20 18:58:31 +02:00
export interface FeatureSource<T extends Feature = Feature> {
features: Store<T[]>
}
2023-04-20 18:58:31 +02:00
export interface WritableFeatureSource<T extends Feature = Feature> extends FeatureSource<T> {
features: UIEventSource<T[]>
2023-03-28 05:13:48 +02:00
}
/**
* A feature source which only contains features for the defined layer
*/
export interface FeatureSourceForLayer<T extends Feature = Feature> extends FeatureSource<T> {
readonly layer: FilteredLayer
}
/**
* A feature source which is aware of the indexes it contains
*/
export interface IndexedFeatureSource extends FeatureSource {
readonly featuresById: Store<Map<string, Feature>>
}