import { loadIconConfiguration } from './storage' ; import { getTileMarkerCache } from './tileMarkerCache' ; const tileMarkerCache = getTileMarkerCache ( ) ; export function getMarkers ( tilePos ) { const result = tileMarkerCache . get ( tilePos ) ; if ( ! result ) { return [ ] ; } return result ; } export async function getDefaultIconSettings ( ) { const cache = await tileMarkerCache . markerLoadPromise ; const categories = { } ; const result = { categories } ; cache . forEach ( value => { value . forEach ( marker => { if ( ! categories [ marker . category ] ) { categories [ marker . category ] = { category : marker . category , visible : loadIconConfiguration ( marker . category , undefined , 'visible' ) , showLabel : loadIconConfiguration ( marker . category , undefined , 'showLabel' ) , types : { } , } ; } const category = categories [ marker . category ] ! ; if ( ! category . types [ marker . type ] ) { category . types [ marker . type ] = { category : marker . category , type : marker . type , visible : loadIconConfiguration ( marker . category , marker . type , 'visible' ) , showLabel : loadIconConfiguration ( marker . category , marker . type , 'showLabel' ) , } ; } } ) ; } ) ; return result ; }