Ajout des features de la carte vide

This commit is contained in:
EpicKiwi 2026-06-14 12:21:50 +02:00
parent 9fbf6daafb
commit 03f5bf0215
Signed by: epickiwi
GPG key ID: C4B28FD2729941CE
2 changed files with 33 additions and 6 deletions

View file

@ -13,7 +13,12 @@ export const FEATURE_ID = Symbol("Feature id")
*/
export class PlaceDatabase extends EventTarget {
/** @type {Object<string, MapFeature>} */
featuresById = {}
/** @type {MapFeature[]} */
featuresShownOnEmptyMap = []
fullTextIndex = null
/**
@ -166,6 +171,9 @@ export class PlaceDatabase extends EventTarget {
buildIndex(){
let database = this;
this.featuresShownOnEmptyMap = []
let showOnEmptyMap = this.featuresShownOnEmptyMap
this.fullTextIndex = lunr(function(){
this.ref("id")
this.field("name")
@ -184,6 +192,10 @@ export class PlaceDatabase extends EventTarget {
synonyms.push(...sym.indexSynonyms)
}
if(feature.properties["show-on-empty-map"]){
showOnEmptyMap.push(feature)
}
this.add({
id,
name: feature.properties.name || sym.genericName,