More work on clustering, more or less finished

This commit is contained in:
Pieter Vander Vennet 2021-09-27 14:45:48 +02:00
parent a3c16d6297
commit 215aebce19
8 changed files with 276 additions and 185 deletions

View file

@ -228,8 +228,8 @@ export interface LayoutConfigJson {
*/
maxZoom?: number,
/**
* The number of elements that should be showed (in total) before clustering starts to happen.
* If clustering is defined, defaults to 0
* The number of elements per tile needed to start clustering
* If clustering is defined, defaults to 25
*/
minNeededElements?: number
},

View file

@ -129,17 +129,12 @@ export default class LayoutConfig {
this.clustering = {
maxZoom: 16,
minNeededElements: 500
minNeededElements: 25
};
if (json.clustering) {
this.clustering = {
maxZoom: json.clustering.maxZoom ?? 18,
minNeededElements: json.clustering.minNeededElements ?? 1
}
for (const layer of this.layers) {
if (layer.wayHandling !== LayerConfig.WAYHANDLING_CENTER_ONLY) {
console.debug("WARNING: In order to allow clustering, every layer must be set to CENTER_ONLY. Layer", layer.id, "does not respect this for layout", this.id);
}
minNeededElements: json.clustering.minNeededElements ?? 25
}
}