2021-09-21 02:10:42 +02:00
|
|
|
import { UIEventSource } from "../../UIEventSource"
|
|
|
|
import FilteredLayer from "../../../Models/FilteredLayer"
|
2021-09-22 05:02:09 +02:00
|
|
|
import { FeatureSourceForLayer, Tiled } from "../FeatureSource"
|
2021-09-28 17:30:48 +02:00
|
|
|
import { BBox } from "../../BBox"
|
2021-09-20 17:14:55 +02:00
|
|
|
|
2021-09-22 05:02:09 +02:00
|
|
|
export default class SimpleFeatureSource implements FeatureSourceForLayer, Tiled {
|
2021-11-08 02:36:01 +01:00
|
|
|
public readonly features: UIEventSource<{ feature: any; freshness: Date }[]>
|
2021-09-20 17:14:55 +02:00
|
|
|
public readonly name: string = "SimpleFeatureSource"
|
|
|
|
public readonly layer: FilteredLayer
|
2021-09-22 05:02:09 +02:00
|
|
|
public readonly bbox: BBox = BBox.global
|
2021-09-28 17:30:48 +02:00
|
|
|
public readonly tileIndex: number
|
2021-09-20 17:14:55 +02:00
|
|
|
|
2022-06-05 02:24:14 +02:00
|
|
|
constructor(
|
|
|
|
layer: FilteredLayer,
|
|
|
|
tileIndex: number,
|
|
|
|
featureSource?: UIEventSource<{ feature: any; freshness: Date }[]>
|
|
|
|
) {
|
2021-09-22 05:02:09 +02:00
|
|
|
this.name = "SimpleFeatureSource(" + layer.layerDef.id + ")"
|
2021-09-20 17:14:55 +02:00
|
|
|
this.layer = layer
|
2021-09-28 17:30:48 +02:00
|
|
|
this.tileIndex = tileIndex ?? 0
|
|
|
|
this.bbox = BBox.fromTileIndex(this.tileIndex)
|
2021-11-08 02:36:01 +01:00
|
|
|
this.features = featureSource ?? new UIEventSource<{ feature: any; freshness: Date }[]>([])
|
2021-09-20 17:14:55 +02:00
|
|
|
}
|
|
|
|
}
|