diff --git a/packages/geoview-core/src/core/components/layers/hooks/helpers.ts b/packages/geoview-core/src/core/components/layers/hooks/helpers.ts index 4ccf2b1fb2e..d94d3abc36f 100644 --- a/packages/geoview-core/src/core/components/layers/hooks/helpers.ts +++ b/packages/geoview-core/src/core/components/layers/hooks/helpers.ts @@ -59,6 +59,7 @@ export function useLegendHelpers(): unknown { layerName: 'TEST--TestLayer1', type: CONST_LAYER_TYPES.GEOJSON, layerStatus: 'loaded', + legendQueryStatus: 'queried', querySent: true, children: [], items: layerItems, @@ -70,6 +71,7 @@ export function useLegendHelpers(): unknown { layerName: 'TEST--Layer with groups', type: CONST_LAYER_TYPES.GEOJSON, layerStatus: 'loaded', + legendQueryStatus: 'queried', querySent: true, children: [], items: [], @@ -81,6 +83,7 @@ export function useLegendHelpers(): unknown { layerName: 'TEST--chrisparentlayer1', type: CONST_LAYER_TYPES.GEOJSON, layerStatus: 'loaded', + legendQueryStatus: 'queried', querySent: true, children: [ { @@ -90,6 +93,7 @@ export function useLegendHelpers(): unknown { layerName: 'TEST--chrisparentchild1', type: CONST_LAYER_TYPES.GEOJSON, layerStatus: 'loaded', + legendQueryStatus: 'queried', querySent: true, children: [ { @@ -99,6 +103,7 @@ export function useLegendHelpers(): unknown { layerName: 'TEST--chris parent child2', type: CONST_LAYER_TYPES.GEOJSON, layerStatus: 'error', + legendQueryStatus: 'init', querySent: true, children: [], items: layerItems, @@ -110,6 +115,7 @@ export function useLegendHelpers(): unknown { layerName: 'TEST--chris parent child25555', type: CONST_LAYER_TYPES.GEOJSON, layerStatus: 'processing', + legendQueryStatus: 'init', querySent: true, children: [], items: layerItems, @@ -121,6 +127,7 @@ export function useLegendHelpers(): unknown { layerName: 'TEST--chris parent child3', type: CONST_LAYER_TYPES.GEOJSON, layerStatus: 'newInstance', + legendQueryStatus: 'init', querySent: true, children: [], items: layerItems, @@ -135,6 +142,7 @@ export function useLegendHelpers(): unknown { layerName: 'TEST--chirslyerss', type: CONST_LAYER_TYPES.GEOJSON, layerStatus: 'loaded', + legendQueryStatus: 'queried', querySent: true, children: [], items: layerItems, @@ -146,6 +154,7 @@ export function useLegendHelpers(): unknown { layerName: 'TEST--chris-child32edd', type: CONST_LAYER_TYPES.GEOJSON, layerStatus: 'loaded', + legendQueryStatus: 'queried', querySent: true, children: [], items: layerItems, @@ -183,6 +192,7 @@ export function useLegendHelpers(): unknown { layerName: `TEST---${setData.data?.layerName?.en ?? 'Unknown Layer name'}`, type: setData.data?.type ?? CONST_LAYER_TYPES.IMAGE_STATIC, layerStatus: setData.layerStatus, + legendQueryStatus: 'queried', children: [], items, }; diff --git a/packages/geoview-core/src/geo/layer/layer.ts b/packages/geoview-core/src/geo/layer/layer.ts index 16b4db97943..7141237b230 100644 --- a/packages/geoview-core/src/geo/layer/layer.ts +++ b/packages/geoview-core/src/geo/layer/layer.ts @@ -38,6 +38,7 @@ import { layerConfigIsXYZTiles, XYZTiles } from '@/geo/layer/geoview-layers/rast import { layerConfigIsVectorTiles, VectorTiles } from '@/geo/layer/geoview-layers/raster/vector-tiles'; import { CSV, layerConfigIsCSV } from '@/geo/layer/geoview-layers/vector/csv'; +import { AbstractLayerSet } from '@/geo/layer/layer-sets/abstract-layer-set'; import { HoverFeatureInfoLayerSet } from '@/geo/layer/layer-sets/hover-feature-info-layer-set'; import { AllFeatureInfoLayerSet } from '@/geo/layer/layer-sets/all-feature-info-layer-set'; import { LegendsLayerSet } from '@/geo/layer/layer-sets/legends-layer-set'; @@ -95,6 +96,24 @@ export class LayerApi { // order to load layers initialLayerOrder: Array = []; + // used to access feature and bounding box highlighting + featureHighlight: FeatureHighlight; + + // Legends layer set associated to the map + legendsLayerSet: LegendsLayerSet; + + // Hover feature info layer set associated to the map + hoverFeatureInfoLayerSet: HoverFeatureInfoLayerSet; + + // All feature info layer set associated to the map + allFeatureInfoLayerSet: AllFeatureInfoLayerSet; + + // Feature info layer set associated to the map + featureInfoLayerSet: FeatureInfoLayerSet; + + // All the layer sets + #allLayerSets: AbstractLayerSet[]; + /** Layers with valid configuration for this map. */ #layerEntryConfigs: TypeRegisteredLayers = {}; @@ -113,21 +132,6 @@ export class LayerApi { originalOpacity: undefined, }; - // used to access feature and bounding box highlighting - featureHighlight: FeatureHighlight; - - // Legends layer set associated to the map - legendsLayerSet: LegendsLayerSet; - - // Hover feature info layer set associated to the map - hoverFeatureInfoLayerSet: HoverFeatureInfoLayerSet; - - // All feature info layer set associated to the map - allFeatureInfoLayerSet: AllFeatureInfoLayerSet; - - // Feature info layer set associated to the map - featureInfoLayerSet: FeatureInfoLayerSet; - // Keep all callback delegates references #onLayerAddedHandlers: LayerAddedDelegate[] = []; @@ -144,6 +148,7 @@ export class LayerApi { this.hoverFeatureInfoLayerSet = new HoverFeatureInfoLayerSet(this); this.allFeatureInfoLayerSet = new AllFeatureInfoLayerSet(this); this.featureInfoLayerSet = new FeatureInfoLayerSet(this); + this.#allLayerSets = [this.legendsLayerSet, this.hoverFeatureInfoLayerSet, this.featureInfoLayerSet, this.allFeatureInfoLayerSet]; this.geometry = new GeometryApi(this.mapViewer); this.featureHighlight = new FeatureHighlight(this.mapViewer); @@ -677,7 +682,7 @@ export class LayerApi { // }); // Tell the layer sets about it - [this.legendsLayerSet, this.hoverFeatureInfoLayerSet, this.allFeatureInfoLayerSet, this.featureInfoLayerSet].forEach((layerSet) => { + this.#allLayerSets.forEach((layerSet) => { // Register or Unregister the layer layerSet.registerOrUnregisterLayer(layerConfig, 'add'); }); @@ -819,7 +824,7 @@ export class LayerApi { this.#unregisterFromSwiper(layerConfig); // Tell the layer sets about it - [this.legendsLayerSet, this.hoverFeatureInfoLayerSet, this.allFeatureInfoLayerSet, this.featureInfoLayerSet].forEach((layerSet) => { + this.#allLayerSets.forEach((layerSet) => { // Register or Unregister the layer layerSet.registerOrUnregisterLayer(layerConfig, 'remove'); });