forked from MapComplete/MapComplete
Merge branch 'develop' into alpha
This commit is contained in:
commit
aa1b33f9e4
11 changed files with 103 additions and 63 deletions
|
@ -22,7 +22,7 @@ export class TileHierarchyAggregator implements FeatureSource {
|
|||
public readonly name;
|
||||
|
||||
private readonly featuresStatic = []
|
||||
private readonly featureProperties: { count: string, tileId: string, id: string };
|
||||
private readonly featureProperties: { count: string, kilocount: string, tileId: string, id: string };
|
||||
|
||||
private constructor(parent: TileHierarchyAggregator, z: number, x: number, y: number) {
|
||||
this._parent = parent;
|
||||
|
@ -36,7 +36,8 @@ export class TileHierarchyAggregator implements FeatureSource {
|
|||
const totals = {
|
||||
id: ""+this._tileIndex,
|
||||
tileId: ""+this._tileIndex,
|
||||
count: ""+0
|
||||
count: `0`,
|
||||
kilocount: "0"
|
||||
}
|
||||
this.featureProperties = totals
|
||||
|
||||
|
@ -108,6 +109,7 @@ export class TileHierarchyAggregator implements FeatureSource {
|
|||
this.features.setData(TileHierarchyAggregator.empty)
|
||||
} else {
|
||||
this.featureProperties.count = "" + total;
|
||||
this.featureProperties.kilocount = "" +Math.floor(total/1000);
|
||||
this.features.data = this.featuresStatic
|
||||
this.features.ping()
|
||||
}
|
||||
|
@ -153,13 +155,18 @@ export class TileHierarchyAggregator implements FeatureSource {
|
|||
}
|
||||
}
|
||||
|
||||
getCountsForZoom(locationControl: UIEventSource<{ zoom : number }>, cutoff: number = 0) : FeatureSource{
|
||||
getCountsForZoom(clusteringConfig: {maxZoom: number}, locationControl: UIEventSource<{ zoom : number }>, cutoff: number = 0) : FeatureSource{
|
||||
const self = this
|
||||
|
||||
const empty = []
|
||||
return new StaticFeatureSource(
|
||||
locationControl.map(loc => {
|
||||
const features = []
|
||||
const targetZoom = loc.zoom
|
||||
|
||||
if(targetZoom > clusteringConfig.maxZoom){
|
||||
return empty
|
||||
}
|
||||
|
||||
const features = []
|
||||
self.visitSubTiles(aggr => {
|
||||
if(aggr.totalValue < cutoff) {
|
||||
return false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue