diff --git a/.github/workflows/type-build.yml b/.github/workflows/type-build.yml
index 9f432753adc..1e04329fe4c 100644
--- a/.github/workflows/type-build.yml
+++ b/.github/workflows/type-build.yml
@@ -4,6 +4,10 @@ on:
schedule:
- cron: "42 21 * * 5"
+env:
+ NODE_VERSION: "20.11.0"
+ PNPM_VERSION: "8.15.0"
+
jobs:
update_types:
runs-on: ubuntu-latest
diff --git a/docs/app/geoview-layer/map-config/draw.io/TypeMapConfig.drawio.svg b/docs/app/geoview-layer/map-config/draw.io/TypeMapConfig.drawio.svg
index a4167d14199..8b549cea01b 100644
--- a/docs/app/geoview-layer/map-config/draw.io/TypeMapConfig.drawio.svg
+++ b/docs/app/geoview-layer/map-config/draw.io/TypeMapConfig.drawio.svg
@@ -1097,7 +1097,7 @@
- TypeGeocoreLayerEntryConfig
+ TypeGeoCoreLayerEntryConfig
@@ -1106,7 +1106,7 @@
- TypeGeocoreLayerEntryConfig
+ TypeGeoCoreLayerEntryConfig
diff --git a/packages/geoview-core/public/locales/en/translation.json b/packages/geoview-core/public/locales/en/translation.json
index d36f888b48d..3a448634f78 100644
--- a/packages/geoview-core/public/locales/en/translation.json
+++ b/packages/geoview-core/public/locales/en/translation.json
@@ -157,7 +157,8 @@
"loadfailed": "Layer [__param__] failed to load on map __param__.",
"notfound": "The sublayer __param__ of the GeoView layer __param__ does not exist on the server",
"createtwice": "Can not execute twice the createGeoViewRasterLayers method for the map __param__",
- "usedtwice": "Duplicate use of geoview layer identifier [__param__] on map __param__"
+ "usedtwice": "Duplicate use of geoview layer identifier [__param__] on map __param__",
+ "multipleUUID": "GeoCore layers may only have one GeoCore UUID per layer"
},
"schema": {
"notFound": "A schema error was found, check the console to see what is wrong.",
@@ -219,4 +220,4 @@
"resizeTooltip": "Resize",
"noTab": "No Tab"
}
-}
\ No newline at end of file
+}
diff --git a/packages/geoview-core/public/locales/fr/translation.json b/packages/geoview-core/public/locales/fr/translation.json
index ec8819a6346..e81975d2d1e 100644
--- a/packages/geoview-core/public/locales/fr/translation.json
+++ b/packages/geoview-core/public/locales/fr/translation.json
@@ -157,7 +157,8 @@
"loadfailed": "Le chargement de la couche [__param__] a échoué sur la carte __param__.",
"notfound": "La sous couche __param__ de la couche GeoView __param__ n'existe pas sur le sereur",
"createtwice": "On ne peut exécuter deux fois la méthode createGeoViewRasterLayers pour la carte __param__",
- "usedtwice": "Utilisation en double de l'identifiant de couche geoview [__param__] sur la carte __param__"
+ "usedtwice": "Utilisation en double de l'identifiant de couche geoview [__param__] sur la carte __param__",
+ "multipleUUID": "Les couches GeoCore ne peuvent avoir qu'un seul UUID GeoCore par couche."
},
"schema": {
"notFound": "Une erreur de schéma a été trouvée, vérifiez la console pour voir ce qui ne va pas.",
@@ -219,4 +220,4 @@
"resizeTooltip": "Redimensionner",
"noTab": "Pas d'onglet"
}
-}
\ No newline at end of file
+}
diff --git a/packages/geoview-core/public/templates/layers/geocore.html b/packages/geoview-core/public/templates/layers/geocore.html
index 2e8aa977e98..2ece0cb1e25 100644
--- a/packages/geoview-core/public/templates/layers/geocore.html
+++ b/packages/geoview-core/public/templates/layers/geocore.html
@@ -76,20 +76,23 @@ 1. Many GeoCore Layers
'listOfGeoviewLayerConfig': [
{
'geoviewLayerType': 'geoCore',
+ 'geoviewLayerId': 'airborneRad',
'listOfLayerEntryConfig': [
{
- 'layerId': '0fe65119-e96e-4a57-8bfe-9d9245fba06b',
- 'geocoreLayerName': { 'en': 'HRDEM Mosaic Hillshade' },
+ 'layerId': '21b821cf-0f1c-40ee-8925-eab12d357668',
+ 'geocoreLayerName': { 'en': 'Airborne Radioactivity' },
'listOfLayerEntryConfig': [
{
- 'layerId': 'dsm-hillshade',
- 'layerName': { 'en': 'Map' },
- 'source': {
- 'style': 'hillshade'
- }
+ 'layerId': '0'
}
]
- },
+ }
+ ]
+ },
+ {
+ 'geoviewLayerType': 'geoCore',
+ 'geoviewLayerId': 'commem',
+ 'listOfLayerEntryConfig': [
{
'layerId': 'ccc75c12-5acc-4a6a-959f-ef6f621147b9',
'geocoreLayerName': { 'en': 'Commemorative Map' },
@@ -98,7 +101,13 @@ 1. Many GeoCore Layers
'layerId': '0'
}
]
- },
+ }
+ ]
+ },
+ {
+ 'geoviewLayerType': 'geoCore',
+ 'geoviewLayerId': 'MWQ',
+ 'listOfLayerEntryConfig': [
{
'layerId': '0fca08b5-e9d0-414b-a3c4-092ff9c5e326',
'geocoreLayerName': { 'en': 'Marine Water Quality' },
@@ -107,8 +116,13 @@ 1. Many GeoCore Layers
'layerId': '6'
}
]
-
- },
+ }
+ ]
+ },
+ {
+ 'geoviewLayerType': 'geoCore',
+ 'geoviewLayerId': 'napl',
+ 'listOfLayerEntryConfig': [
{
'layerId': '03ccfb5c-a06e-43e3-80fd-09d4f8f69703',
'geocoreLayerName': { 'en': 'NAPL Temporal Series' },
@@ -160,65 +174,86 @@ 2. GeoCore Layers - with footer bar
triggerReadyCallback="true"
data-lang="en"
data-config="{
- 'map': {
- 'interaction': 'dynamic',
- 'viewSettings': {
- 'zoom': 4,
- 'center': [-100, 60],
- 'projection': 3978
+ 'map': {
+ 'interaction': 'dynamic',
+ 'viewSettings': {
+ 'zoom': 4,
+ 'center': [-100, 60],
+ 'projection': 3978
+ },
+ 'basemapOptions': {
+ 'basemapId': 'transport',
+ 'shaded': false,
+ 'labeled': true
+ },
+ 'listOfGeoviewLayerConfig': [
+ {
+ 'geoviewLayerType': 'geoCore',
+ 'geoviewLayerId': 'airborneRad',
+ 'listOfLayerEntryConfig': [
+ {
+ 'layerId': '21b821cf-0f1c-40ee-8925-eab12d357668',
+ 'geocoreLayerName': { 'en': 'Airborne Radioactivity' },
+ 'listOfLayerEntryConfig': [
+ {
+ 'layerId': '0'
+ }
+ ]
+ }
+ ]
},
- 'basemapOptions': {
- 'basemapId': 'transport',
- 'shaded': false,
- 'labeled': true
+ {
+ 'geoviewLayerType': 'geoCore',
+ 'geoviewLayerId': 'commem',
+ 'listOfLayerEntryConfig': [
+ {
+ 'layerId': 'ccc75c12-5acc-4a6a-959f-ef6f621147b9',
+ 'geocoreLayerName': { 'en': 'Commemorative Map' },
+ 'listOfLayerEntryConfig': [
+ {
+ 'layerId': '0'
+ }
+ ]
+ }
+ ]
},
- 'listOfGeoviewLayerConfig': [
- {
- 'geoviewLayerType': 'geoCore',
- 'listOfLayerEntryConfig': [
- {
- 'layerId': 'ccc75c12-5acc-4a6a-959f-ef6f621147b9',
- 'geocoreLayerName': { 'en': 'Commemorative Map' },
- 'listOfLayerEntryConfig': [
- {
- 'layerId': '0'
- }
- ]
- },
- {
- 'layerId': '0fca08b5-e9d0-414b-a3c4-092ff9c5e326',
- 'geocoreLayerName': { 'en': 'Marine Water Quality' },
- 'listOfLayerEntryConfig': [
- {
- 'layerId': '6'
- }
- ]
-
- },
- {
- 'layerId': '03ccfb5c-a06e-43e3-80fd-09d4f8f69703',
- 'geocoreLayerName': { 'en': 'NAPL Temporal Series' },
- 'listOfLayerEntryConfig': [
- {
- 'layerId': 'regina',
- 'layerName': { 'en': 'Map of Regina' }
- }
- ]
- }
- ]
- }
- ]
- },
- 'components': ['overview-map'],
- 'footerBar': {
- 'tabs': {
- 'core': ['legend', 'layers', 'details', 'data-table']
+ {
+ 'geoviewLayerType': 'geoCore',
+ 'geoviewLayerId': 'MWQ',
+ 'listOfLayerEntryConfig': [
+ {
+ 'layerId': '0fca08b5-e9d0-414b-a3c4-092ff9c5e326',
+ 'geocoreLayerName': { 'en': 'Marine Water Quality' },
+ 'listOfLayerEntryConfig': [
+ {
+ 'layerId': '6'
+ }
+ ]
+ },
+ {
+ 'layerId': '03ccfb5c-a06e-43e3-80fd-09d4f8f69703',
+ 'geocoreLayerName': { 'en': 'NAPL Temporal Series' },
+ 'listOfLayerEntryConfig': [
+ {
+ 'layerId': 'regina',
+ 'layerName': { 'en': 'Map of Regina' }
+ }
+ ]
+ }
+ ]
}
- },
- 'corePackages': [],
- 'theme': 'geo.ca',
- 'suportedLanguages': ['en']
- }"
+ ]
+ },
+ 'components': ['overview-map'],
+ 'footerBar': {
+ 'tabs': {
+ 'core': ['legend', 'layers', 'details', 'data-table']
+ }
+ },
+ 'corePackages': [],
+ 'theme': 'geo.ca',
+ 'suportedLanguages': ['en']
+ }"
>
diff --git a/packages/geoview-core/schema.json b/packages/geoview-core/schema.json
index a96ecf9408c..86170f9c375 100644
--- a/packages/geoview-core/schema.json
+++ b/packages/geoview-core/schema.json
@@ -1110,7 +1110,7 @@
},
"required": ["schemaTag", "entryType", "layerId"]
},
- "TypeGeocoreLayerEntryConfig": {
+ "TypeGeoCoreLayerEntryConfig": {
"additionalProperties": false,
"type": "object",
"description": "Layer where configration is extracted by a configuration snippet stored on a server. The server configuration will handle bilangual informations.",
@@ -1221,7 +1221,7 @@
"$ref": "#/definitions/TypeTileLayerEntryConfig"
},
{
- "$ref": "#/definitions/TypeGeocoreLayerEntryConfig"
+ "$ref": "#/definitions/TypeGeoCoreLayerEntryConfig"
}
]
},
@@ -1396,7 +1396,7 @@
"$ref": "#/definitions/TypeLayerGroupEntryConfig"
},
{
- "$ref": "#/definitions/TypeGeocoreLayerEntryConfig"
+ "$ref": "#/definitions/TypeGeoCoreLayerEntryConfig"
}
]
}
diff --git a/packages/geoview-core/src/api/event-processors/event-processor-children/map-event-processor.ts b/packages/geoview-core/src/api/event-processors/event-processor-children/map-event-processor.ts
index dbcdb0d70dc..947a228aa7a 100644
--- a/packages/geoview-core/src/api/event-processors/event-processor-children/map-event-processor.ts
+++ b/packages/geoview-core/src/api/event-processors/event-processor-children/map-event-processor.ts
@@ -416,15 +416,20 @@ export class MapEventProcessor extends AbstractEventProcessor {
*
* @param {string} mapId The ID of the map to add the layer to.
* @param {TypeGeoviewLayerConfig} geoviewLayerConfig The config of the layer to add.
+ * @param {string} layerPathToReplace The layerPath of the info to replace.
* @return {void}
*/
- static replaceOrderedLayerInfo(mapId: string, geoviewLayerConfig: TypeGeoviewLayerConfig | TypeLayerEntryConfig): void {
+ static replaceOrderedLayerInfo(
+ mapId: string,
+ geoviewLayerConfig: TypeGeoviewLayerConfig | TypeLayerEntryConfig,
+ layerPathToReplace?: string
+ ): void {
const { orderedLayerInfo } = this.getMapStateProtected(mapId);
const layerPath = (geoviewLayerConfig as TypeGeoviewLayerConfig).geoviewLayerId
? `${(geoviewLayerConfig as TypeGeoviewLayerConfig).geoviewLayerId}/${(geoviewLayerConfig as TypeGeoviewLayerConfig).geoviewLayerId}`
: (geoviewLayerConfig as TypeLayerEntryConfig).layerPath;
- const index = this.getMapIndexFromOrderedLayerInfo(mapId, layerPath);
- const replacedLayers = orderedLayerInfo.filter((layerInfo) => layerInfo.layerPath.startsWith(layerPath));
+ const index = this.getMapIndexFromOrderedLayerInfo(mapId, layerPathToReplace || layerPath);
+ const replacedLayers = orderedLayerInfo.filter((layerInfo) => layerInfo.layerPath.startsWith(layerPathToReplace || layerPath));
const newOrderedLayerInfo = api.maps[mapId].layer.generateArrayOfLayerOrderInfo(geoviewLayerConfig);
orderedLayerInfo.splice(index, replacedLayers.length, ...newOrderedLayerInfo);
this.setMapOrderedLayerInfo(mapId, orderedLayerInfo);
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 f8a0f21545f..38a87859ecf 100644
--- a/packages/geoview-core/src/core/components/layers/hooks/helpers.ts
+++ b/packages/geoview-core/src/core/components/layers/hooks/helpers.ts
@@ -1,3 +1,4 @@
+// TODO Remove when no longer needed
import _ from 'lodash';
import { TypeVectorLayerStyles } from '@/geo/layer/geoview-layers/abstract-geoview-layers';
import { api } from '@/app';
diff --git a/packages/geoview-core/src/core/components/layers/left-panel/add-new-layer/add-new-layer.tsx b/packages/geoview-core/src/core/components/layers/left-panel/add-new-layer/add-new-layer.tsx
index 3f754ed4361..1f5bd4a93f2 100644
--- a/packages/geoview-core/src/core/components/layers/left-panel/add-new-layer/add-new-layer.tsx
+++ b/packages/geoview-core/src/core/components/layers/left-panel/add-new-layer/add-new-layer.tsx
@@ -415,11 +415,11 @@ export function AddNewLayer(): JSX.Element {
const geoCoreGeoviewLayerInstance = new GeoCore(mapId);
const layers = await geoCoreGeoviewLayerInstance.createLayersFromUUID(layerURL);
if (layers.length === 1) {
- if (layers[0].length === 1) {
- setLayerName(layers[0][0].geoviewLayerName!.en! as string);
- setLayerEntries(layers[0]);
+ if (layers.length === 1) {
+ setLayerName(layers[0].geoviewLayerName!.en! as string);
+ setLayerEntries(layers);
} else {
- setLayerList(layers[0]);
+ setLayerList(layers);
}
}
} catch (err) {
diff --git a/packages/geoview-core/src/geo/layer/geoview-layers/abstract-geoview-layers.ts b/packages/geoview-core/src/geo/layer/geoview-layers/abstract-geoview-layers.ts
index 2b4bfae02e2..cefa35c5e93 100644
--- a/packages/geoview-core/src/geo/layer/geoview-layers/abstract-geoview-layers.ts
+++ b/packages/geoview-core/src/geo/layer/geoview-layers/abstract-geoview-layers.ts
@@ -249,7 +249,7 @@ export const CONST_GEOVIEW_SCHEMA_BY_TYPE: Record
esriFeature: 'TypeVectorLayerEntryConfig',
esriImage: 'TypeEsriImageLayerEntryConfig',
GeoJSON: 'TypeVectorLayerEntryConfig',
- geoCore: 'TypeGeocoreLayerEntryConfig',
+ geoCore: 'TypeGeoCoreLayerEntryConfig',
GeoPackage: 'TypeVectorLayerEntryConfig',
xyzTiles: 'TypeTileLayerEntryConfig',
vectorTiles: 'TypeTileLayerEntryConfig',
diff --git a/packages/geoview-core/src/geo/layer/layer.ts b/packages/geoview-core/src/geo/layer/layer.ts
index 55af110a905..ddf7eb15ba4 100644
--- a/packages/geoview-core/src/geo/layer/layer.ts
+++ b/packages/geoview-core/src/geo/layer/layer.ts
@@ -9,7 +9,7 @@ import { EVENT_NAMES } from '@/api/events/event-types';
import { MapEventProcessor } from '@/api/event-processors/event-processor-children/map-event-processor';
import { Config } from '@/core/utils/config/config';
-import { generateId, showError, replaceParams, getLocalizedMessage, whenThisThen } from '@/core/utils/utilities';
+import { generateId, showError, replaceParams, getLocalizedMessage, whenThisThen, addNotificationError } from '@/core/utils/utilities';
import {
layerConfigPayload,
payloadIsALayerConfig,
@@ -21,6 +21,7 @@ import { AbstractGeoViewLayer } from '@/geo/layer/geoview-layers/abstract-geovie
import {
TypeGeoviewLayerConfig,
TypeLayerEntryConfig,
+ TypeListOfGeoviewLayerConfig,
TypeListOfLocalizedLanguages,
layerEntryIsGroupLayer,
} from '@/geo/map/map-schema-types';
@@ -100,11 +101,9 @@ export class Layer {
if (layerConfigIsGeoCore(layerConfig)) {
const geoCore = new GeoCore(this.mapId);
- geoCore.createLayers(layerConfig).then((arrayOfListOfGeoviewLayerConfig) => {
- arrayOfListOfGeoviewLayerConfig.forEach((listOfGeoviewLayerConfig) => {
- listOfGeoviewLayerConfig.forEach((geoviewLayerConfig) => {
- this.addGeoviewLayer(geoviewLayerConfig);
- });
+ geoCore.createLayers(layerConfig).then((listOfGeoviewLayerConfig: TypeListOfGeoviewLayerConfig) => {
+ listOfGeoviewLayerConfig.forEach((geoviewLayerConfig) => {
+ this.addGeoviewLayer(geoviewLayerConfig);
});
});
} else if (layerConfigIsGeoJSON(layerConfig)) {
@@ -202,9 +201,23 @@ export class Layer {
* @returns {TypeOrderedLayerInfo[]} The array of ordered layer info.
*/
generateArrayOfLayerOrderInfo(geoviewLayerConfig: TypeGeoviewLayerConfig | TypeLayerEntryConfig): TypeOrderedLayerInfo[] {
- // TODO Add placeholder for geocore and the replacement when the layer is created in geocore.ts
- if ((geoviewLayerConfig as TypeGeoviewLayerConfig).geoviewLayerType === 'geoCore') return [];
- const newOrderedLayerInfos = [];
+ const newOrderedLayerInfos: TypeOrderedLayerInfo[] = [];
+
+ if ((geoviewLayerConfig as TypeGeoviewLayerConfig).geoviewLayerType === 'geoCore') {
+ geoviewLayerConfig.listOfLayerEntryConfig?.forEach((layerEntryConfig) => {
+ const layerInfo: TypeOrderedLayerInfo = {
+ layerPath: layerEntryConfig.layerId,
+ alwaysVisible: false,
+ visible: true,
+ removable: true,
+ queryable: true,
+ hoverable: true,
+ };
+ newOrderedLayerInfos.push(layerInfo);
+ });
+ return newOrderedLayerInfos;
+ }
+
const addSubLayerPathToLayerOrder = (layerEntryConfig: TypeLayerEntryConfig, layerPath: string): void => {
const subLayerPath = layerPath.endsWith(layerEntryConfig.layerId) ? layerPath : `${layerPath}/${layerEntryConfig.layerId}`;
const layerInfo: TypeOrderedLayerInfo = {
@@ -222,6 +235,7 @@ export class Layer {
});
}
};
+
if ((geoviewLayerConfig as TypeGeoviewLayerConfig).geoviewLayerId) {
if ((geoviewLayerConfig as TypeGeoviewLayerConfig).listOfLayerEntryConfig.length > 1) {
const layerPath = `${(geoviewLayerConfig as TypeGeoviewLayerConfig).geoviewLayerId}/${
@@ -257,10 +271,15 @@ export class Layer {
// set order for layers to appear on the map according to config
const orderedLayerInfos: TypeOrderedLayerInfo[] = [];
validGeoviewLayerConfigs.forEach((geoviewLayerConfig) => {
- const layerInfos = this.generateArrayOfLayerOrderInfo(geoviewLayerConfig);
- orderedLayerInfos.push(...layerInfos);
+ if (layerConfigIsGeoCore(geoviewLayerConfig) && geoviewLayerConfig.listOfLayerEntryConfig.length > 1) {
+ logger.logError('GeoCore layers may only have one GeoCore UUID per layer');
+ addNotificationError(this.mapId, getLocalizedMessage(this.mapId, 'validation.layer.multipleUUID'));
+ } else {
+ const layerInfos = this.generateArrayOfLayerOrderInfo(geoviewLayerConfig);
+ orderedLayerInfos.push(...layerInfos);
- api.event.emit(layerConfigPayload(EVENT_NAMES.LAYER.EVENT_ADD_LAYER, this.mapId, geoviewLayerConfig));
+ api.event.emit(layerConfigPayload(EVENT_NAMES.LAYER.EVENT_ADD_LAYER, this.mapId, geoviewLayerConfig));
+ }
});
MapEventProcessor.setMapOrderedLayerInfo(this.mapId, orderedLayerInfos);
}
@@ -441,7 +460,7 @@ export class Layer {
addGeoviewLayerByGeoCoreUUID = async (uuid: string): Promise => {
const geoCoreGeoviewLayerInstance = new GeoCore(this.mapId);
const layers = await geoCoreGeoviewLayerInstance.createLayersFromUUID(uuid);
- layers[0].forEach((geoviewLayerConfig) => {
+ layers.forEach((geoviewLayerConfig) => {
api.maps[this.mapId].layer.addGeoviewLayer(geoviewLayerConfig);
});
};
diff --git a/packages/geoview-core/src/geo/layer/other/geocore.ts b/packages/geoview-core/src/geo/layer/other/geocore.ts
index 78046d5483a..96d49c4f9c8 100644
--- a/packages/geoview-core/src/geo/layer/other/geocore.ts
+++ b/packages/geoview-core/src/geo/layer/other/geocore.ts
@@ -10,7 +10,7 @@ import { MapEventProcessor } from '@/api/event-processors/event-processor-childr
import {
TypeLayerEntryConfig,
TypeGeoviewLayerConfig,
- TypeGeocoreLayerEntryConfig,
+ TypeGeoCoreLayerEntryConfig,
TypeListOfGeoviewLayerConfig,
TypeLocalizedString,
layerEntryIsGroupLayer,
@@ -21,11 +21,11 @@ import { CONST_LAYER_TYPES, TypeGeoviewLayerType } from '../geoview-layers/abstr
export interface TypeGeoCoreLayerConfig extends Omit {
geoviewLayerType: 'geoCore';
- listOfLayerEntryConfig: TypeGeocoreLayerEntryConfig[];
+ listOfLayerEntryConfig: TypeGeoCoreLayerEntryConfig[];
}
/** *****************************************************************************************************************************
- * type guard function that redefines a TypeLayerEntryConfig as a TypeGeocoreLayerEntryConfig if the geoviewLayerType attribute of
+ * type guard function that redefines a TypeLayerEntryConfig as a TypeGeoCoreLayerEntryConfig if the geoviewLayerType attribute of
* the verifyIfGeoViewEntry.geoviewLayerConfig attribute is GEOCORE. The type ascention applies only to the true block of the if
* clause that use this function.
*
@@ -34,7 +34,7 @@ export interface TypeGeoCoreLayerConfig extends Omit {
+export const geoviewEntryIsGeoCore = (verifyIfGeoViewEntry: TypeLayerEntryConfig): verifyIfGeoViewEntry is TypeGeoCoreLayerEntryConfig => {
return verifyIfGeoViewEntry?.geoviewLayerConfig?.geoviewLayerType === CONST_LAYER_TYPES.GEOCORE;
};
@@ -81,12 +81,12 @@ export class GeoCore {
geoviewLayerId: generateId(),
geoviewLayerType: 'geoCore',
listOfLayerEntryConfig: [
- new TypeGeocoreLayerEntryConfig({
+ new TypeGeoCoreLayerEntryConfig({
schemaTag: 'geoCore' as TypeGeoviewLayerType,
entryType: 'geoCore' as TypeLayerEntryType,
layerId: uuid,
- } as TypeGeocoreLayerEntryConfig),
- ] as TypeGeocoreLayerEntryConfig[],
+ } as TypeGeoCoreLayerEntryConfig),
+ ] as TypeGeoCoreLayerEntryConfig[],
} as TypeGeoCoreLayerConfig;
}
@@ -96,7 +96,7 @@ export class GeoCore {
* @param {string} uuid the given uuid to build the Geocore Layer Config with
* @returns {Promise} the GeoCore Layer Config promise
*/
- createLayersFromUUID(uuid: string): Promise {
+ createLayersFromUUID(uuid: string): Promise {
// Create the config
const geocoreConfig = GeoCore.buildGeocoreLayerConfigFromUUID(uuid);
@@ -107,65 +107,58 @@ export class GeoCore {
/**
* Gets GeoView layer configurations list from the UUIDs of the list of layer entry configurations.
*
- * @param {TypeGeocoreLayerEntryConfig} geocoreLayerConfig the layer configuration
+ * @param {TypeGeoCoreLayerEntryConfig} geocoreLayerConfig the layer configuration
* @returns {Promise} list of layer configurations to add to the map
*/
- async createLayers(geocoreLayerConfig: TypeGeoCoreLayerConfig): Promise {
+ async createLayers(geocoreLayerConfig: TypeGeoCoreLayerConfig): Promise {
// Get the map config
const mapConfig = MapEventProcessor.getGeoViewMapConfig(this.mapId);
- // For each layer entry config in the list
- const listOfLayerCreated: TypeListOfGeoviewLayerConfig[] = [];
- for (let i = 0; i < geocoreLayerConfig.listOfLayerEntryConfig.length; i++) {
- // Get the config
- const layerConfig = geocoreLayerConfig.listOfLayerEntryConfig[i];
-
- // Get the language
- const lang = api.maps[this.mapId].getDisplayLanguage();
-
- // Generate the url using metadataAccessPath when specified or using the geocore url
- const url = geocoreLayerConfig.metadataAccessPath?.[lang] || `${mapConfig!.serviceUrls.geocoreUrl}`;
- const uuid = layerConfig.layerId;
-
- try {
- // Get the GV config from UUID and await even if within loop
- // eslint-disable-next-line no-await-in-loop
- const response = await UUIDmapConfigReader.getGVConfigFromUUIDs(url, lang, [uuid]);
-
- // Cumulate
- listOfLayerCreated.push(response.layers);
-
- // For each found layer associated with the Geocore UUIDs
- response.layers.forEach((geoviewLayerConfig) => {
- this.copyConfigSettingsOverGeocoreSettings(layerConfig, geoviewLayerConfig);
- });
- this.configValidation.validateListOfGeoviewLayerConfig(AppEventProcessor.getSupportedLanguages(this.mapId), response.layers);
-
- // For each found geochart associated with the Geocore UUIDs
- response.geocharts?.forEach((geochartConfig) => {
- // Add a GeoChart
- GeochartEventProcessor.addGeochartChart(this.mapId, geochartConfig.layers[0].layerId as string, geochartConfig);
- });
- } catch (error) {
- // Log
- logger.logError(`Failed to get the GeoView layer from UUI ${uuid}`, error);
- const message = replaceParams([error as TypeJsonValue, this.mapId], getLocalizedMessage(this.mapId, 'validation.layer.loadfailed'));
- showError(this.mapId, message);
- }
+ // Get the config
+ const layerConfig = geocoreLayerConfig.listOfLayerEntryConfig[0];
+
+ // Get the language
+ const lang = api.maps[this.mapId].getDisplayLanguage();
+
+ // Generate the url using metadataAccessPath when specified or using the geocore url
+ const url = geocoreLayerConfig.metadataAccessPath?.[lang] || `${mapConfig!.serviceUrls.geocoreUrl}`;
+ const uuid = layerConfig.layerId;
+
+ try {
+ // Get the GV config from UUID and await even if within loop
+ // eslint-disable-next-line no-await-in-loop
+ const response = await UUIDmapConfigReader.getGVConfigFromUUIDs(url, lang, [uuid]);
+
+ // For each found layer associated with the Geocore UUIDs
+ response.layers.forEach((geoviewLayerConfig) => {
+ this.copyConfigSettingsOverGeocoreSettings(layerConfig, geoviewLayerConfig);
+ });
+ this.configValidation.validateListOfGeoviewLayerConfig(AppEventProcessor.getSupportedLanguages(this.mapId), response.layers);
+
+ // For each found geochart associated with the Geocore UUIDs
+ response.geocharts?.forEach((geochartConfig) => {
+ // Add a GeoChart
+ GeochartEventProcessor.addGeochartChart(this.mapId, geochartConfig.layers[0].layerId as string, geochartConfig);
+ });
+
+ return response.layers;
+ } catch (error) {
+ // Log
+ logger.logError(`Failed to get the GeoView layer from UUI ${uuid}`, error);
+ const message = replaceParams([error as TypeJsonValue, this.mapId], getLocalizedMessage(this.mapId, 'validation.layer.loadfailed'));
+ showError(this.mapId, message);
}
-
- // Return the created layers
- return listOfLayerCreated;
+ return Promise.resolve([]);
}
/**
* Copies the config settings over the geocore values (config values have priority).
*
- * @param {TypeGeocoreLayerEntryConfig} geocoreLayerEntryConfig The config file settings
+ * @param {TypeGeoCoreLayerEntryConfig} geocoreLayerEntryConfig The config file settings
* @param {TypeGeoviewLayerConfig} geoviewLayerConfig The settings returned by the geocore service
*/
private copyConfigSettingsOverGeocoreSettings(
- geocoreLayerEntryConfig: TypeGeocoreLayerEntryConfig,
+ geocoreLayerEntryConfig: TypeGeoCoreLayerEntryConfig,
geoviewLayerConfig: TypeGeoviewLayerConfig
) {
if (geocoreLayerEntryConfig.geocoreLayerName)
diff --git a/packages/geoview-core/src/geo/map/map-schema-types.ts b/packages/geoview-core/src/geo/map/map-schema-types.ts
index da09feaeb07..961d14d71f9 100644
--- a/packages/geoview-core/src/geo/map/map-schema-types.ts
+++ b/packages/geoview-core/src/geo/map/map-schema-types.ts
@@ -611,7 +611,7 @@ export const layerEntryIsRasterTile = (verifyIfLayer: TypeLayerEntryConfig): ver
};
/** ******************************************************************************************************************************
- * type guard function that redefines a TypeLayerEntryConfig as a TypeGeocoreLayerEntryConfig if the entryType attribute of
+ * type guard function that redefines a TypeLayerEntryConfig as a TypeGeoCoreLayerEntryConfig if the entryType attribute of
* the verifyIfLayer parameter is 'geocore'. The type ascention applies only to the true block of the if clause that use
* this function.
*
@@ -619,7 +619,7 @@ export const layerEntryIsRasterTile = (verifyIfLayer: TypeLayerEntryConfig): ver
*
* @returns {boolean} true if the type ascention is valid.
*/
-export const layerEntryIsGeocore = (verifyIfLayer: TypeLayerEntryConfig): verifyIfLayer is TypeGeocoreLayerEntryConfig => {
+export const layerEntryIsGeocore = (verifyIfLayer: TypeLayerEntryConfig): verifyIfLayer is TypeGeoCoreLayerEntryConfig => {
return verifyIfLayer?.entryType === ('geoCore' as TypeLayerEntryType);
};
@@ -1385,7 +1385,7 @@ export class TypeTileLayerEntryConfig extends TypeBaseLayerEntryConfig {
* Type used to define a GeoView layer where configration is extracted by a configuration snippet stored on a server. The server
* configuration will handle bilangual informations.
*/
-export class TypeGeocoreLayerEntryConfig extends ConfigBaseClass {
+export class TypeGeoCoreLayerEntryConfig extends ConfigBaseClass {
/** This attribute from ConfigBaseClass is not used by groups. */
declare isMetadataLayerGroup: never;
@@ -1418,9 +1418,9 @@ export class TypeGeocoreLayerEntryConfig extends ConfigBaseClass {
/**
* The class constructor.
- * @param {TypeGeocoreLayerEntryConfig} layerConfig The layer configuration we want to instanciate.
+ * @param {TypeGeoCoreLayerEntryConfig} layerConfig The layer configuration we want to instanciate.
*/
- constructor(layerConfig: TypeGeocoreLayerEntryConfig) {
+ constructor(layerConfig: TypeGeoCoreLayerEntryConfig) {
super(layerConfig);
Object.assign(this, layerConfig);
}
@@ -1531,7 +1531,7 @@ export type TypeLayerEntryConfig =
| TypeImageStaticLayerEntryConfig
| TypeTileLayerEntryConfig
| TypeLayerGroupEntryConfig
- | TypeGeocoreLayerEntryConfig;
+ | TypeGeoCoreLayerEntryConfig;
/** ******************************************************************************************************************************
* List of layers. Corresponds to the layerList defined in the schema.
diff --git a/packages/geoview-core/src/geo/utils/layer-set.ts b/packages/geoview-core/src/geo/utils/layer-set.ts
index ff0109f2682..9c579ad18f7 100644
--- a/packages/geoview-core/src/geo/utils/layer-set.ts
+++ b/packages/geoview-core/src/geo/utils/layer-set.ts
@@ -1,4 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
+import { MapEventProcessor } from '@/api/event-processors/event-processor-children/map-event-processor';
import { EVENT_NAMES } from '@/api/events/event-types';
import {
LayerSetPayload,
@@ -145,6 +146,7 @@ export class LayerSet {
if (this.registrationUserInitialisation) this.registrationUserInitialisation(layerPath);
} else if (action === 'remove' && layerPath in this.resultSet) {
delete this.resultSet[layerPath];
+ MapEventProcessor.removeOrderedLayerInfo(this.mapId, layerPath);
}
api.event.emit(LayerSetPayload.createLayerSetUpdatedPayload(this.layerSetId, this.resultSet, layerPath));
}