diff --git a/docs/app/geoview-layer/map-config/README.md b/docs/app/geoview-layer/map-config/README.md index cb742ece46b..71e55b9b448 100644 --- a/docs/app/geoview-layer/map-config/README.md +++ b/docs/app/geoview-layer/map-config/README.md @@ -41,7 +41,7 @@ The `navBar` property is optional and its type is `TypeNavBarProps`. It is used ## components -The `components` property is optional and its type is `TypeMapComponents` which is an array whose value domain is `'north-arrow', 'overview-map'`. +The `components` property is optional and its type is `TypeMapComponents[]` which is an array whose value domain is `'north-arrow', 'overview-map'`. ## corePackages diff --git a/docs/app/geoview-layer/map-config/draw.io/TypeMapFeaturesInstance.drawio.svg b/docs/app/geoview-layer/map-config/draw.io/TypeMapFeaturesInstance.drawio.svg index 4d2c478621f..1d80a8a711d 100644 --- a/docs/app/geoview-layer/map-config/draw.io/TypeMapFeaturesInstance.drawio.svg +++ b/docs/app/geoview-layer/map-config/draw.io/TypeMapFeaturesInstance.drawio.svg @@ -1,13 +1,14 @@ - + - + +
-
+

Map Features Instance @@ -22,15 +23,15 @@ - - - + + +
-
+
TypeMapFeaturesInstance
@@ -41,13 +42,12 @@ -
-
+
+ @@ -63,13 +63,12 @@ -
-
+
+ @@ -85,13 +84,12 @@ -
-
+
+ appBar?: TypeAppBarProps @@ -104,13 +102,12 @@ -
-
+
+ navBar?: TypeNavBarProps @@ -123,13 +120,12 @@ -
-
+
+ components?: TypeMapComponents @@ -144,13 +140,12 @@ -
-
+
+ corePackages?: TypeMapCorePackages @@ -163,13 +158,12 @@ -
-
+
+ externalPackages?: TypeExternalPackages @@ -182,13 +176,12 @@ -
-
+
+ @@ -204,10 +197,24 @@ - - - - + + + +
+
+
+ + + suportedLanguages: TypeListOfLocalizedLanguages + +
+
+
+
+ + + suportedLanguages: TypeListOfLocalizedLan... + +
+
diff --git a/packages/geoview-core/public/configs/validator/04-geocore.json b/packages/geoview-core/public/configs/validator/04-geocore.json new file mode 100644 index 00000000000..0e63fc0d609 --- /dev/null +++ b/packages/geoview-core/public/configs/validator/04-geocore.json @@ -0,0 +1,48 @@ +{ + "map": { + "interaction": "dynamic", + "viewSettings": { + "minZoom": 5, + "projection": 3857 + }, + "basemapOptions": { + "basemapId": "transport", + "shaded": false, + "labeled": true + }, + "listOfGeoviewLayerConfig": [ + { + "geoviewLayerId": "12acd145-626a-49eb-b850-0a59c9bc7506", + "isGeocore": true + }, + { + "geoviewLayerId": "ccc75c12-5acc-4a6a-959f-ef6f621147b9", + "isGeocore": true + } + ], + "highlightColor": "black", + "extraOptions": {} + }, + "theme": "geo.ca", + "navBar": [ + "zoom", + "fullscreen", + "home" + ], + "appBar": { + "tabs": { + "core": [ + "geolocator" + ] + } + }, + "overviewMap": { + "hideOnZoom": 0 + }, + "components": [ + "overview-map" + ], + "corePackages": [], + "externalPackages": [], + "schemaVersionUsed": "1.0" +} \ No newline at end of file diff --git a/packages/geoview-core/public/templates/config-sandbox.html b/packages/geoview-core/public/templates/config-sandbox.html index f36b5dda314..1482cb75497 100644 --- a/packages/geoview-core/public/templates/config-sandbox.html +++ b/packages/geoview-core/public/templates/config-sandbox.html @@ -103,6 +103,7 @@

Sandbox Configuration

+ Input Configuration
@@ -112,6 +113,7 @@

Sandbox Configuration

+ Internal configuration: File not validated...
@@ -184,7 +186,7 @@

Sanbox Map

return res.text(); }) .then((data) => { - document.getElementById('configGeoview').textContent = data; + document.getElementById('configGeoview').value = data; // set default number of lines const textarea = document.querySelector('textarea'); @@ -212,18 +214,18 @@

Sanbox Map

const configArea = document.getElementById('configGeoview'); const configOutput = document.getElementById('configOutput'); - // get config and test if JSON is valid - const mapConfig = cgpv.api.configApi.getMapConfig(configArea.value.replaceAll('"', "'").replaceAll("\\'", "\'"), langue); - configOutput.textContent = mapConfig.getIndentedJsonString(); - - // Generate line numbers - (() => { - const textarea = document.getElementById('configOutput'); - const lineNumbersContainer = document.getElementById('outputLineNumbers'); - const lines = textarea.value.split('\n').length+1; - const lineNumbers = Array.from({ length: lines }, (_, index) => '').join(''); - lineNumbersContainer.innerHTML = lineNumbers; - })(); + // get config and test if JSON is valid + const mapConfig = cgpv.api.configApi.getMapConfig(configArea.value.replaceAll('"', "'").replaceAll("\\'", "\'"), langue); + configOutput.value = mapConfig.getIndentedJsonString(); + + // Generate line numbers + (() => { + const textarea = document.getElementById('configOutput'); + const lineNumbersContainer = document.getElementById('outputLineNumbers'); + const lines = textarea.value.split('\n').length+1; + const lineNumbers = Array.from({ length: lines }, (_, index) => '').join(''); + lineNumbersContainer.innerHTML = lineNumbers; + })(); // set class and message message.classList.add('config-json-valid'); diff --git a/packages/geoview-core/src/api/config/config-api.ts b/packages/geoview-core/src/api/config/config-api.ts index e47e03c46f3..07bed5b8014 100644 --- a/packages/geoview-core/src/api/config/config-api.ts +++ b/packages/geoview-core/src/api/config/config-api.ts @@ -1,8 +1,8 @@ import { CV_DEFAULT_MAP_FEATURE_CONFIG } from '@config/types/config-constants'; import { Cast, TypeJsonValue, TypeJsonObject, toJsonObject, TypeJsonArray } from '@config/types/config-types'; -import { TypeDisplayLanguage } from '@config/types/map-schema-types'; import { MapFeatureConfig } from '@config/types/classes/map-feature-config'; import { UUIDmapConfigReader } from '@config/uuid-config-reader'; +import { TypeDisplayLanguage } from '@config/types/map-schema-types'; import { logger } from '@/core//utils/logger'; /** diff --git a/packages/geoview-core/src/api/config/types/classes/geoview-config/abstract-geoview-layer-config.ts b/packages/geoview-core/src/api/config/types/classes/geoview-config/abstract-geoview-layer-config.ts index 0f0411c6734..c2aba911ff5 100644 --- a/packages/geoview-core/src/api/config/types/classes/geoview-config/abstract-geoview-layer-config.ts +++ b/packages/geoview-core/src/api/config/types/classes/geoview-config/abstract-geoview-layer-config.ts @@ -1,18 +1,15 @@ -// Needs to disable class-methods-use-this because we need to pass the instance reference 'this' to the agregated sublayers. -// eslint-disable-next-line @typescript-eslint/class-methods-use-this import defaultsDeep from 'lodash/defaultsDeep'; import cloneDeep from 'lodash/cloneDeep'; +import { MapFeatureConfig } from '@config/types/classes/map-feature-config'; import { Cast, TypeGeoviewLayerType, TypeJsonObject, TypeJsonArray } from '@config/types/config-types'; import { ConfigBaseClass } from '@config/types/classes/sub-layer-config/config-base-class'; import { TypeDisplayLanguage, TypeLayerInitialSettings } from '@config/types/map-schema-types'; import { normalizeLocalizedString } from '@config/utils'; -import { CV_CONST_SUB_LAYER_TYPES, CV_DEFAULT_LAYER_INITIAL_SETTINGS } from '@config/types/config-constants'; +import { CV_DEFAULT_LAYER_INITIAL_SETTINGS } from '@config/types/config-constants'; import { GroupLayerEntryConfig } from '@config/types/classes/sub-layer-config/group-layer-entry-config'; import { layerEntryIsGroupLayer } from '@config/types/type-guards'; -import { logger } from '@/core/utils/logger'; import { generateId } from '@/core/utils/utilities'; -import { MapFeatureConfig } from '@/api/config/types/classes/map-feature-config'; /** * Base class for the definition of a Geoview layer configuration. @@ -76,14 +73,14 @@ export abstract class AbstractGeoviewLayerConfig { this.initialSettings = Cast( defaultsDeep(this.#originalgeoviewLayerConfig.initialSettings, CV_DEFAULT_LAYER_INITIAL_SETTINGS) ); - // Topmost layer must be a layer group or a leaf node. + // The top layer must be a layer group or a leaf node. if ((this.#originalgeoviewLayerConfig.listOfLayerEntryConfig as TypeJsonArray).length > 1) (this.#originalgeoviewLayerConfig.listOfLayerEntryConfig as TypeJsonArray) = [ { layerId: this.#originalgeoviewLayerConfig.geoviewLayerId, initialSettings: this.initialSettings as TypeJsonObject, layerName: { ...(this.#originalgeoviewLayerConfig.geoviewLayerName as object) }, - entryType: CV_CONST_SUB_LAYER_TYPES.GROUP as TypeJsonObject, + isLayerGroup: true as TypeJsonObject, listOfLayerEntryConfig: this.#originalgeoviewLayerConfig.listOfLayerEntryConfig, }, ]; @@ -108,22 +105,13 @@ export abstract class AbstractGeoviewLayerConfig { * @private */ protected validate(): void { - if (!this.geoviewLayerType) { - logger.logError(`Property geoviewLayerType is mandatory for GeoView layer ${this.geoviewLayerId} of type ${this.geoviewLayerType}.`); - this.propagateError(); - } - if (!this.geoviewLayerId) { - throw new Error(`geoviewLayerId is mandatory for GeoView layer of type ${this.geoviewLayerType}.`); - this.propagateError(); - } - if (!this.geoviewLayerName) { - logger.logError(`Property geoviewLayerName is mandatory for GeoView layer ${this.geoviewLayerId} of type ${this.geoviewLayerType}.`); - this.propagateError(); - } - if (!this.metadataAccessPath) { + if (!this.geoviewLayerType) + throw new Error(`Property geoviewLayerType is mandatory for GeoView layer ${this.geoviewLayerId} of type ${this.geoviewLayerType}.`); + if (!this.geoviewLayerId) throw new Error(`geoviewLayerId is mandatory for GeoView layer of type ${this.geoviewLayerType}.`); + if (!this.geoviewLayerName) + throw new Error(`Property geoviewLayerName is mandatory for GeoView layer ${this.geoviewLayerId} of type ${this.geoviewLayerType}.`); + if (!this.metadataAccessPath) throw new Error(`metadataAccessPath is mandatory for GeoView layer ${this.geoviewLayerId} of type ${this.geoviewLayerType}.`); - this.propagateError(); - } } /** diff --git a/packages/geoview-core/src/api/config/types/classes/geoview-config/raster-config/esri-dynamic-config.ts b/packages/geoview-core/src/api/config/types/classes/geoview-config/raster-config/esri-dynamic-config.ts index 841d667423b..462e2cc18be 100644 --- a/packages/geoview-core/src/api/config/types/classes/geoview-config/raster-config/esri-dynamic-config.ts +++ b/packages/geoview-core/src/api/config/types/classes/geoview-config/raster-config/esri-dynamic-config.ts @@ -3,22 +3,17 @@ import { AbstractGeoviewLayerConfig } from '@config/types/classes/geoview-config import { EsriDynamicLayerEntryConfig } from '@config/types/classes/sub-layer-config/raster-leaf/esri-dynamic-layer-entry-config'; import { ConfigBaseClass } from '@config/types/classes/sub-layer-config/config-base-class'; import { GroupLayerEntryConfig } from '@config/types/classes/sub-layer-config/group-layer-entry-config'; -import { AbstractBaseLayerEntryConfig } from '@config/types/classes/sub-layer-config/abstract-base-layer-entry-config'; -import { TypeGeoviewLayerType, TypeJsonObject } from '@config/types/config-types'; +import { TypeJsonObject } from '@config/types/config-types'; import { TypeDisplayLanguage, TypeLayerInitialSettings } from '@config/types/map-schema-types'; import { isvalidComparedToSchema } from '@config/utils'; -import { MapFeatureConfig } from '@/api/config/types/classes/map-feature-config'; +import { MapFeatureConfig } from '@config/types/classes/map-feature-config'; -/* */ +export type TypeEsriDynamicLayerNode = GroupLayerEntryConfig | EsriDynamicLayerEntryConfig; -export type TypeEsriDynamicLayerNode = GroupLayerEntryConfig | (AbstractBaseLayerEntryConfig & EsriDynamicLayerEntryConfig); - -/** - * The ESRI dynamic geoview layer class. - */ +/** The ESRI dynamic geoview layer class. */ export class EsriDynamicLayerConfig extends AbstractGeoviewLayerConfig { /** Type of GeoView layer. */ - geoviewLayerType: TypeGeoviewLayerType; + geoviewLayerType = CV_CONST_LAYER_TYPES.ESRI_DYNAMIC; /** The layer entries to use from the GeoView layer. */ declare listOfLayerEntryConfig: TypeEsriDynamicLayerNode[]; @@ -32,7 +27,6 @@ export class EsriDynamicLayerConfig extends AbstractGeoviewLayerConfig { */ constructor(layerConfig: TypeJsonObject, language: TypeDisplayLanguage, mapFeatureConfig?: MapFeatureConfig) { super(layerConfig, language, mapFeatureConfig); - this.geoviewLayerType = CV_CONST_LAYER_TYPES.ESRI_DYNAMIC; if (!isvalidComparedToSchema(this.geoviewLayerSchema, layerConfig)) this.propagateError(); if (!isvalidComparedToSchema(this.geoviewLayerSchema, this)) this.propagateError(); this.validate(); diff --git a/packages/geoview-core/src/api/config/types/classes/geoview-config/vector-config/esri-feature-config.ts b/packages/geoview-core/src/api/config/types/classes/geoview-config/vector-config/esri-feature-config.ts index 3a05b43101d..3650b1c2c82 100644 --- a/packages/geoview-core/src/api/config/types/classes/geoview-config/vector-config/esri-feature-config.ts +++ b/packages/geoview-core/src/api/config/types/classes/geoview-config/vector-config/esri-feature-config.ts @@ -3,24 +3,17 @@ import { AbstractGeoviewLayerConfig } from '@config/types/classes/geoview-config import { EsriFeatureLayerEntryConfig } from '@config/types/classes/sub-layer-config/vector-leaf/esri-feature-layer-entry-config'; import { ConfigBaseClass } from '@config/types/classes/sub-layer-config/config-base-class'; import { GroupLayerEntryConfig } from '@config/types/classes/sub-layer-config/group-layer-entry-config'; -import { AbstractBaseLayerEntryConfig } from '@config/types/classes/sub-layer-config/abstract-base-layer-entry-config'; -import { TypeGeoviewLayerType, TypeJsonObject } from '@config/types/config-types'; +import { TypeJsonObject } from '@config/types/config-types'; import { TypeDisplayLanguage, TypeLayerInitialSettings } from '@config/types/map-schema-types'; import { isvalidComparedToSchema } from '@config/utils'; -import { MapFeatureConfig } from '@/api/config/types/classes/map-feature-config'; +import { MapFeatureConfig } from '@config/types/classes/map-feature-config'; -/* */ +export type TypeEsriFeatureLayerNode = GroupLayerEntryConfig | EsriFeatureLayerEntryConfig; -export type TypeEsriFeatureLayerNode = - | (ConfigBaseClass & GroupLayerEntryConfig) - | (ConfigBaseClass & AbstractBaseLayerEntryConfig & EsriFeatureLayerEntryConfig); - -/** - * The ESRI feature geoview layer class. - */ +/** The ESRI feature geoview layer class. */ export class EsriFeatureLayerConfig extends AbstractGeoviewLayerConfig { /** Type of GeoView layer. */ - geoviewLayerType: TypeGeoviewLayerType; + geoviewLayerType = CV_CONST_LAYER_TYPES.ESRI_FEATURE; /** The layer entries to use from the GeoView layer. */ declare listOfLayerEntryConfig: TypeEsriFeatureLayerNode[]; @@ -34,7 +27,6 @@ export class EsriFeatureLayerConfig extends AbstractGeoviewLayerConfig { */ constructor(layerConfig: TypeJsonObject, language: TypeDisplayLanguage, mapFeatureConfig?: MapFeatureConfig) { super(layerConfig, language, mapFeatureConfig); - this.geoviewLayerType = CV_CONST_LAYER_TYPES.ESRI_FEATURE; if (!isvalidComparedToSchema(this.geoviewLayerSchema, layerConfig)) this.propagateError(); if (!isvalidComparedToSchema(this.geoviewLayerSchema, this)) this.propagateError(); this.validate(); diff --git a/packages/geoview-core/src/api/config/types/classes/map-feature-config.ts b/packages/geoview-core/src/api/config/types/classes/map-feature-config.ts index ccc17164675..3113594cff3 100644 --- a/packages/geoview-core/src/api/config/types/classes/map-feature-config.ts +++ b/packages/geoview-core/src/api/config/types/classes/map-feature-config.ts @@ -1,6 +1,23 @@ import cloneDeep from 'lodash/cloneDeep'; import defaultsDeep from 'lodash/defaultsDeep'; +import { AbstractGeoviewLayerConfig } from '@config/types/classes/geoview-config/abstract-geoview-layer-config'; +import { EsriDynamicLayerConfig } from '@config/types/classes/geoview-config/raster-config/esri-dynamic-config'; +import { Cast, TypeJsonArray, TypeJsonObject, toJsonObject } from '@config/types/config-types'; +import { EsriFeatureLayerConfig } from '@config/types/classes/geoview-config/vector-config/esri-feature-config'; +import { + CV_BASEMAP_ID, + CV_BASEMAP_LABEL, + CV_BASEMAP_SHADED, + CV_CONST_LAYER_TYPES, + CV_DEFAULT_MAP_FEATURE_CONFIG, + CV_MAP_CENTER, + CV_MAP_CONFIG_SCHEMA_PATH, + CV_MAP_EXTENTS, + ACCEPTED_SCHEMA_VERSIONS, + VALID_PROJECTION_CODES, +} from '@config/types/config-constants'; +import { isvalidComparedToSchema } from '@config/utils'; import { Extent, TypeAppBarProps, @@ -16,24 +33,7 @@ import { TypeServiceUrls, TypeValidMapProjectionCodes, TypeValidVersions, - VALID_PROJECTION_CODES, - VALID_VERSIONS, } from '@config/types/map-schema-types'; -import { AbstractGeoviewLayerConfig } from '@config/types/classes/geoview-config/abstract-geoview-layer-config'; -import { EsriDynamicLayerConfig } from '@config/types/classes/geoview-config/raster-config/esri-dynamic-config'; -import { Cast, TypeJsonArray, TypeJsonObject, toJsonObject } from '@config/types/config-types'; -import { EsriFeatureLayerConfig } from '@config/types/classes/geoview-config/vector-config/esri-feature-config'; -import { - CV_BASEMAP_ID, - CV_BASEMAP_LABEL, - CV_BASEMAP_SHADED, - CV_CONST_LAYER_TYPES, - CV_DEFAULT_MAP_FEATURE_CONFIG, - CV_MAP_CENTER, - CV_MAP_CONFIG_SCHEMA_PATH, - CV_MAP_EXTENTS, -} from '@config/types/config-constants'; -import { isvalidComparedToSchema } from '@config/utils'; import { isJsonString, removeCommentsFromJSON } from '@/core/utils/utilities'; import { logger } from '@/core//utils/logger'; @@ -292,14 +292,14 @@ export class MapFeatureConfig { this.#validateCenter(); - // zoom cannot be undefined because udefined values were set with default values. + // zoom cannot be undefined because undefined values were set with default values. const zoom = this.map.viewSettings.initialView!.zoomAndCenter![0]; this.map.viewSettings.initialView!.zoomAndCenter![0] = !Number.isNaN(zoom) && zoom >= 0 && zoom <= 28 ? zoom : CV_DEFAULT_MAP_FEATURE_CONFIG.map.viewSettings.initialView!.zoomAndCenter![0]; this.#validateBasemap(); - this.schemaVersionUsed = VALID_VERSIONS.includes(this.schemaVersionUsed!) + this.schemaVersionUsed = ACCEPTED_SCHEMA_VERSIONS.includes(this.schemaVersionUsed!) ? this.schemaVersionUsed : CV_DEFAULT_MAP_FEATURE_CONFIG.schemaVersionUsed!; const minZoom = this.map.viewSettings.minZoom!; diff --git a/packages/geoview-core/src/api/config/types/classes/sub-layer-config/abstract-base-layer-entry-config.ts b/packages/geoview-core/src/api/config/types/classes/sub-layer-config/abstract-base-layer-entry-config.ts index 04f23508679..8c434756e7f 100644 --- a/packages/geoview-core/src/api/config/types/classes/sub-layer-config/abstract-base-layer-entry-config.ts +++ b/packages/geoview-core/src/api/config/types/classes/sub-layer-config/abstract-base-layer-entry-config.ts @@ -1,39 +1,26 @@ import cloneDeep from 'lodash/cloneDeep'; import { Cast, TypeJsonObject } from '@config/types/config-types'; +import { AbstractGeoviewLayerConfig } from '@config/types/classes/geoview-config/abstract-geoview-layer-config'; +import { ConfigBaseClass } from '@config/types/classes/sub-layer-config/config-base-class'; import { - TypeBaseSourceVectorInitialConfig, TypeDisplayLanguage, TypeLayerInitialSettings, - TypeSourceImageEsriInitialConfig, - TypeSourceImageInitialConfig, - TypeSourceImageStaticInitialConfig, - TypeSourceImageWmsInitialConfig, - TypeSourceTileInitialConfig, + TypeBaseSourceInitialConfig, TypeTemporalDimension, - TypeVectorSourceInitialConfig, - TypeVectorTileSourceInitialConfig, + TypeGeometryType, } from '@config/types/map-schema-types'; -import { AbstractGeoviewLayerConfig } from '@config/types/classes/geoview-config/abstract-geoview-layer-config'; -import { ConfigBaseClass } from '@config/types/classes/sub-layer-config/config-base-class'; - -// TODO: Refactor - Instead of listing all the possible types, for the `source` attribute, use a parent type -export type TypeSourceInitialConfig = - | TypeBaseSourceVectorInitialConfig - | TypeSourceTileInitialConfig - | TypeVectorSourceInitialConfig - | TypeVectorTileSourceInitialConfig - | TypeSourceImageInitialConfig - | TypeSourceImageWmsInitialConfig - | TypeSourceImageEsriInitialConfig - | TypeSourceImageStaticInitialConfig; +import { CV_DEFAULT_MAP_FEATURE_CONFIG } from '../../config-constants'; /** * Base type used to define a GeoView sublayer to display on the map. */ export abstract class AbstractBaseLayerEntryConfig extends ConfigBaseClass { + /** The geometry type of the leaf node. */ + geometryType: TypeGeometryType; + /** Source settings to apply to the GeoView vector layer source at creation time. */ - source: TypeSourceInitialConfig; + source?: TypeBaseSourceInitialConfig; /** Optional temporal dimension. */ temporalDimension?: TypeTemporalDimension; @@ -55,12 +42,11 @@ export abstract class AbstractBaseLayerEntryConfig extends ConfigBaseClass { parentNode?: ConfigBaseClass ) { super(layerConfig, initialSettings, language, geoviewLayerConfig, parentNode); + this.geometryType = layerConfig.geometryType as TypeGeometryType; // If the user has provided a source then keep it, else create one using default values. - if (layerConfig.source) this.source = Cast(cloneDeep(layerConfig.source)); - else - this.source = { - maxRecordCount: 0, - }; + // GV: This Cast operation uses a cloned version of the entire configuration, it covers even the child properties. + if (layerConfig.source) this.source = Cast(cloneDeep(layerConfig.source)); + else this.source = Cast({ projection: CV_DEFAULT_MAP_FEATURE_CONFIG.map.viewSettings.projection }); if (layerConfig.temporalDimension) this.temporalDimension = Cast(cloneDeep(layerConfig.temporalDimension)); } } diff --git a/packages/geoview-core/src/api/config/types/classes/sub-layer-config/config-base-class.ts b/packages/geoview-core/src/api/config/types/classes/sub-layer-config/config-base-class.ts index fda124cecfb..264dbc7e1de 100644 --- a/packages/geoview-core/src/api/config/types/classes/sub-layer-config/config-base-class.ts +++ b/packages/geoview-core/src/api/config/types/classes/sub-layer-config/config-base-class.ts @@ -1,9 +1,9 @@ import defaultsDeep from 'lodash/defaultsDeep'; import { TypeGeoviewLayerType, TypeJsonObject } from '@config/types/config-types'; -import { TypeLayerEntryType, TypeLayerInitialSettings, TypeDisplayLanguage, Extent } from '@config/types/map-schema-types'; import { AbstractGeoviewLayerConfig } from '@config/types/classes/geoview-config/abstract-geoview-layer-config'; import { normalizeLocalizedString } from '@config/utils'; +import { TypeLayerEntryType, TypeLayerInitialSettings, TypeDisplayLanguage, Extent } from '@config/types/map-schema-types'; /** * Base type used to define a GeoView sublayer to display on the map. The sublayer can be a group or an abstract sublayer. @@ -19,9 +19,8 @@ export abstract class ConfigBaseClass { /** Parent node (used to compute the layerPath). */ #parentNode: ConfigBaseClass | undefined = undefined; - /** Used internally to distinguish layer groups derived from the metadata. */ - // TODO: Refactor - Add this back? - // #isMetadataLayerGroup?: false; + /** Used to distinguish layer group nodes. */ + isLayerGroup: boolean; /** The identifier of the layer to display on the map. */ layerId: string; @@ -72,6 +71,7 @@ export abstract class ConfigBaseClass { this.layerId = layerConfig.layerId as string; this.layerName = layerConfig.layerName ? normalizeLocalizedString(layerConfig.layerName)![this.#language]! : undefined; + this.isLayerGroup = (layerConfig.isLayerGroup as boolean) || false; this.attributions = (layerConfig.attributions as string[]) || []; this.bounds = layerConfig.bounds as Extent; this.minScale = (layerConfig.minScale as number) || 0; diff --git a/packages/geoview-core/src/api/config/types/classes/sub-layer-config/group-layer-entry-config.ts b/packages/geoview-core/src/api/config/types/classes/sub-layer-config/group-layer-entry-config.ts index b9ec8746dbf..5a153066ad5 100644 --- a/packages/geoview-core/src/api/config/types/classes/sub-layer-config/group-layer-entry-config.ts +++ b/packages/geoview-core/src/api/config/types/classes/sub-layer-config/group-layer-entry-config.ts @@ -1,9 +1,9 @@ import { CV_CONST_SUB_LAYER_TYPES, CV_LAYER_GROUP_SCHEMA_PATH } from '@config/types/config-constants'; import { TypeJsonArray, TypeJsonObject } from '@config/types/config-types'; -import { TypeDisplayLanguage, TypeLayerEntryType, TypeLayerInitialSettings } from '@config/types/map-schema-types'; import { AbstractGeoviewLayerConfig } from '@config/types/classes/geoview-config/abstract-geoview-layer-config'; import { ConfigBaseClass } from '@config/types/classes/sub-layer-config/config-base-class'; import { layerEntryIsGroupLayer } from '@config/types/type-guards'; +import { TypeDisplayLanguage, TypeLayerEntryType, TypeLayerInitialSettings } from '@config/types/map-schema-types'; /** * Type used to define a group of layers. It can be either subgroups or sublayers. diff --git a/packages/geoview-core/src/api/config/types/classes/sub-layer-config/raster-leaf/esri-dynamic-layer-entry-config.ts b/packages/geoview-core/src/api/config/types/classes/sub-layer-config/raster-leaf/esri-dynamic-layer-entry-config.ts index 17edd548af4..fe16a8a5eda 100644 --- a/packages/geoview-core/src/api/config/types/classes/sub-layer-config/raster-leaf/esri-dynamic-layer-entry-config.ts +++ b/packages/geoview-core/src/api/config/types/classes/sub-layer-config/raster-leaf/esri-dynamic-layer-entry-config.ts @@ -2,25 +2,26 @@ // eslint-disable-next-line @typescript-eslint/class-methods-use-this import { CV_CONST_SUB_LAYER_TYPES, CV_CONST_LEAF_LAYER_SCHEMA_PATH } from '@config/types/config-constants'; import { Cast, TypeJsonObject } from '@config/types/config-types'; +import { AbstractGeoviewLayerConfig } from '@config/types/classes/geoview-config/abstract-geoview-layer-config'; +import { AbstractBaseLayerEntryConfig } from '@config/types/classes/sub-layer-config/abstract-base-layer-entry-config'; +import { ConfigBaseClass } from '@config/types/classes/sub-layer-config/config-base-class'; +import { isvalidComparedToSchema } from '@config/utils'; +import { defaultsDeep } from 'lodash'; import { - TypeSourceImageEsriInitialConfig, TypeStyleConfig, - TypeLayerInitialSettings, TypeLayerEntryType, + TypeLayerInitialSettings, TypeDisplayLanguage, TypeEsriFormatParameter, + TypeSourceEsriDynamicInitialConfig, } from '@config/types/map-schema-types'; -import { AbstractGeoviewLayerConfig } from '@config/types/classes/geoview-config/abstract-geoview-layer-config'; -import { AbstractBaseLayerEntryConfig } from '@config/types/classes/sub-layer-config/abstract-base-layer-entry-config'; -import { ConfigBaseClass } from '@config/types/classes/sub-layer-config/config-base-class'; -import { isvalidComparedToSchema } from '@config/utils'; /** * The ESRI dynamic geoview sublayer class. */ export class EsriDynamicLayerEntryConfig extends AbstractBaseLayerEntryConfig { /** Source settings to apply to the GeoView image layer source at creation time. */ - declare source: TypeSourceImageEsriInitialConfig; + declare source: TypeSourceEsriDynamicInitialConfig; /** Style to apply to the raster layer. */ style?: TypeStyleConfig; @@ -42,6 +43,8 @@ export class EsriDynamicLayerEntryConfig extends AbstractBaseLayerEntryConfig { parentNode?: ConfigBaseClass ) { super(layerConfig, initialSettings, language, geoviewLayerConfig, parentNode); + // Set default values. + this.source = defaultsDeep(this.source, { maxRecordCount: 0, format: 'png' }); this.style = layerConfig.style ? { ...Cast(layerConfig.style) } : undefined; if (Number.isNaN(this.layerId)) { throw new Error(`The layer entry with layer path equal to ${this.layerPath} must be an integer string`); diff --git a/packages/geoview-core/src/api/config/types/classes/sub-layer-config/vector-leaf/esri-feature-layer-entry-config.ts b/packages/geoview-core/src/api/config/types/classes/sub-layer-config/vector-leaf/esri-feature-layer-entry-config.ts index 050cba0c33e..5978f35f741 100644 --- a/packages/geoview-core/src/api/config/types/classes/sub-layer-config/vector-leaf/esri-feature-layer-entry-config.ts +++ b/packages/geoview-core/src/api/config/types/classes/sub-layer-config/vector-leaf/esri-feature-layer-entry-config.ts @@ -1,14 +1,12 @@ -// Needs to disable class-methods-use-this because we need to pass the instance reference 'this' to the validator. -// eslint-disable-next-line @typescript-eslint/class-methods-use-this +import { defaultsDeep } from 'lodash'; import { CV_CONST_SUB_LAYER_TYPES, CV_CONST_LEAF_LAYER_SCHEMA_PATH } from '@config/types/config-constants'; import { Cast, TypeJsonObject } from '@config/types/config-types'; import { - TypeSourceImageEsriInitialConfig, TypeStyleConfig, - TypeLayerInitialSettings, TypeLayerEntryType, - TypeEsriFormatParameter, + TypeLayerInitialSettings, TypeDisplayLanguage, + TypeSourceEsriFeatureInitialConfig, } from '@config/types/map-schema-types'; import { AbstractGeoviewLayerConfig } from '@config/types/classes/geoview-config/abstract-geoview-layer-config'; import { AbstractBaseLayerEntryConfig } from '@config/types/classes/sub-layer-config/abstract-base-layer-entry-config'; @@ -19,10 +17,10 @@ import { isvalidComparedToSchema } from '@config/utils'; * The ESRI feature geoview sublayer class. */ export class EsriFeatureLayerEntryConfig extends AbstractBaseLayerEntryConfig { - /** Source settings to apply to the GeoView image layer source at creation time. */ - declare source: TypeSourceImageEsriInitialConfig; + /** Source settings to apply to the GeoView feature layer source at creation time. */ + declare source: TypeSourceEsriFeatureInitialConfig; - /** Style to apply to the raster layer. */ + /** Style to apply to the feature layer. */ style?: TypeStyleConfig; /** @@ -42,11 +40,12 @@ export class EsriFeatureLayerEntryConfig extends AbstractBaseLayerEntryConfig { parentNode?: ConfigBaseClass ) { super(layerConfig, initialSettings, language, geoviewLayerConfig, parentNode); + // Set default values. + this.source = defaultsDeep(this.source, { maxRecordCount: 0, format: 'EsriJSON' }); this.style = layerConfig.style ? { ...Cast(layerConfig.style) } : undefined; if (Number.isNaN(this.layerId)) { throw new Error(`The layer entry with layerId equal to ${this.layerPath} must be an integer string`); } - this.source.format = 'EsriJSON' as TypeEsriFormatParameter; // Set the source.format property if (!isvalidComparedToSchema(this.schemaPath, layerConfig)) this.propagateError(); if (!isvalidComparedToSchema(this.schemaPath, this)) this.propagateError(); } diff --git a/packages/geoview-core/src/api/config/types/config-constants.ts b/packages/geoview-core/src/api/config/types/config-constants.ts index 916d8fbbfe9..110c126098b 100644 --- a/packages/geoview-core/src/api/config/types/config-constants.ts +++ b/packages/geoview-core/src/api/config/types/config-constants.ts @@ -2,8 +2,16 @@ // TO.DOCONT: remove code duplication. import { Cast, LayerEntryTypesKey, LayerTypesKey, TypeGeoviewLayerType } from '@config/types/config-types'; -import { TypeBasemapId, TypeLayerEntryType, TypeValidMapProjectionCodes } from '@config/types/map-schema-types'; import { MapFeatureConfig } from '@config/types/classes/map-feature-config'; +import { + TypeBasemapId, + TypeDisplayLanguage, + TypeDisplayTheme, + TypeInteraction, + TypeLayerEntryType, + TypeValidMapProjectionCodes, + TypeValidVersions, +} from '@config/types/map-schema-types'; /** The default geocore url */ export const CV_CONFIG_GEOCORE_URL = 'https://geocore-stage.api.geo.ca'; @@ -11,6 +19,9 @@ export const CV_CONFIG_GEOCORE_URL = 'https://geocore-stage.api.geo.ca'; /** The default geolocator url */ export const CV_CONFIG_GEOLOCATOR_URL = 'https://geolocator.api.geo.ca?keys=geonames,nominatim,locate'; +/** The default geolocator url */ +export const CV_CONFIG_PROXY_URL = 'https://maps.canada.ca/wmsproxy/ws/wmsproxy/executeFromProxy'; + // Constants for the layer config types export const CV_CONST_SUB_LAYER_TYPES: Record = { VECTOR: 'vector', @@ -18,15 +29,8 @@ export const CV_CONST_SUB_LAYER_TYPES: Record = * Definition of the sub schema to use for each type of Geoview layer */ export const CV_CONST_LEAF_LAYER_SCHEMA_PATH: Record = { - CSV: 'https://cgpv/schema#/definitions/TypeVectorLayerEntryConfig', - ESRI_DYNAMIC: 'https://cgpv/schema#/definitions/TypeEsriDynamicLayerEntryConfig', - ESRI_FEATURE: 'https://cgpv/schema#/definitions/TypeVectorLayerEntryConfig', - ESRI_IMAGE: 'https://cgpv/schema#/definitions/TypeEsriImageLayerEntryConfig', - IMAGE_STATIC: 'https://cgpv/schema#/definitions/TypeImageStaticLayerEntryConfig', - GEOJSON: 'https://cgpv/schema#/definitions/TypeVectorLayerEntryConfig', - GEOPACKAGE: 'https://cgpv/schema#/definitions/TypeVectorLayerEntryConfig', - XYZ_TILES: 'https://cgpv/schema#/definitions/TypeTileLayerEntryConfig', - VECTOR_TILES: 'Thttps://cgpv/schema#/definitions/ypeTileLayerEntryConfig', - OGC_FEATURE: 'https://cgpv/schema#/definitions/TypeVectorLayerEntryConfig', - WFS: 'https://cgpv/schema#/definitions/TypeVectorLayerEntryConfig', - WMS: 'https://cgpv/schema#/definitions/TypeOgcWmsLayerEntryConfig', + CSV: 'https://cgpv/schema#/definitions/VectorLayerEntryConfig', + ESRI_DYNAMIC: 'https://cgpv/schema#/definitions/EsriDynamicLayerEntryConfig', + ESRI_FEATURE: 'https://cgpv/schema#/definitions/EsriFeatureLayerEntryConfig', + ESRI_IMAGE: 'https://cgpv/schema#/definitions/EsriImageLayerEntryConfig', + IMAGE_STATIC: 'https://cgpv/schema#/definitions/ImageStaticLayerEntryConfig', + GEOJSON: 'https://cgpv/schema#/definitions/VectorLayerEntryConfig', + GEOPACKAGE: 'https://cgpv/schema#/definitions/VectorLayerEntryConfig', + XYZ_TILES: 'https://cgpv/schema#/definitions/TileLayerEntryConfig', + VECTOR_TILES: 'Thttps://cgpv/schema#/definitions/TileLayerEntryConfig', + OGC_FEATURE: 'https://cgpv/schema#/definitions/VectorLayerEntryConfig', + WFS: 'https://cgpv/schema#/definitions/VectorLayerEntryConfig', + WMS: 'https://cgpv/schema#/definitions/OgcWmsLayerEntryConfig', }; export const CV_GEOVIEW_SCHEMA_PATH: Record = { CSV: '', - ESRI_DYNAMIC: 'https://cgpv/schema#/definitions/AbstractGeoviewLayerConfig', - ESRI_FEATURE: 'https://cgpv/schema#/definitions/AbstractGeoviewLayerConfig', + ESRI_DYNAMIC: 'https://cgpv/schema#/definitions/EsriDynamicLayerConfig', + ESRI_FEATURE: 'https://cgpv/schema#/definitions/EsriFeatureLayerConfig', ESRI_IMAGE: '', IMAGE_STATIC: '', GEOJSON: '', @@ -80,6 +84,21 @@ export const CV_GEOVIEW_SCHEMA_PATH: Record = { export const CV_MAP_CONFIG_SCHEMA_PATH = 'https://cgpv/schema#/definitions/MapFeatureConfig'; export const CV_LAYER_GROUP_SCHEMA_PATH = 'https://cgpv/schema#/definitions/TypeLayerGroupEntryConfig'; +/** Array of schema versions accepted by the viewer. */ +export const ACCEPTED_SCHEMA_VERSIONS: TypeValidVersions[] = ['1.0']; + +/** Constante mainly use for language validation. */ +export const VALID_DISPLAY_LANGUAGE: TypeDisplayLanguage[] = ['en', 'fr']; + +/** Array of valid geoview themes. */ +export const VALID_DISPLAY_THEME: TypeDisplayTheme[] = ['dark', 'light', 'geo.ca']; + +/** Constante mainly use for interaction validation. */ +export const VALID_INTERACTION: TypeInteraction[] = ['static', 'dynamic']; + +/** Constant mainly used to test if a TypeValidMapProjectionCodes variable is a valid projection codes. */ +export const VALID_PROJECTION_CODES = [3978, 3857]; + /** * Definition of the basemap options type. */ @@ -120,13 +139,22 @@ export const CV_MAP_EXTENTS: Record = { * Definition of the MapFeatureConfig default values. All the default values that applies to the map feature configuration are * defined here. */ +// TODO: Revise default values. +// GV: The Cast operation doesn't create a real MapFeatureConfig instance because methods are missing. +// GV: We do that only to create an object that has the default values who can be accessed using the instance property names. export const CV_DEFAULT_MAP_FEATURE_CONFIG = Cast({ map: { + basemapOptions: { + basemapId: 'transport', + shaded: true, + labeled: true, + }, interaction: 'dynamic', + listOfGeoviewLayerConfig: [], highlightColor: 'black', viewSettings: { initialView: { - zoomAndCenter: [3.5, [-90, 60]], + zoomAndCenter: [4.5, [-90, 67]], }, enableRotation: true, rotation: 0, @@ -135,24 +163,26 @@ export const CV_DEFAULT_MAP_FEATURE_CONFIG = Cast({ maxExtent: [-125, 30, -60, 89], projection: 3978, }, - basemapOptions: { - basemapId: 'transport', - shaded: true, - labeled: true, - }, - listOfGeoviewLayerConfig: [], extraOptions: {}, }, theme: 'geo.ca', + navBar: ['zoom', 'fullscreen', 'home'], + footerBar: { + tabs: { + core: ['legend', 'layers', 'details', 'data-table'], + custom: [], + }, + collapsed: false, + }, components: ['north-arrow', 'overview-map'], appBar: { tabs: { core: ['geolocator'] } }, - navBar: ['zoom', 'fullscreen', 'home'], corePackages: [], - overviewMap: undefined, + overviewMap: { hideOnZoom: 0 }, externalPackages: [], serviceUrls: { geocoreUrl: CV_CONFIG_GEOCORE_URL, geolocator: CV_CONFIG_GEOLOCATOR_URL, + proxyUrl: CV_CONFIG_PROXY_URL, }, schemaVersionUsed: '1.0', }); diff --git a/packages/geoview-core/src/api/config/types/config-types.ts b/packages/geoview-core/src/api/config/types/config-types.ts index 3287b45380a..7769c587323 100644 --- a/packages/geoview-core/src/api/config/types/config-types.ts +++ b/packages/geoview-core/src/api/config/types/config-types.ts @@ -43,7 +43,7 @@ export function toJsonObject(p: unknown): TypeJsonObject { } // Definition of the keys used to create the constants of the GeoView layer -export type LayerEntryTypesKey = 'VECTOR' | 'VECTOR_TILE' | 'RASTER_TILE' | 'RASTER_IMAGE' | 'GROUP' | 'GEOCORE'; +export type LayerEntryTypesKey = 'VECTOR' | 'VECTOR_TILE' | 'RASTER_TILE' | 'RASTER_IMAGE' | 'GROUP'; // Definition of the keys used to create the constants of the GeoView layer export type LayerTypesKey = diff --git a/packages/geoview-core/src/api/config/types/config-validation-schema.json b/packages/geoview-core/src/api/config/types/config-validation-schema.json index 72f165ea2b3..782b344d338 100644 --- a/packages/geoview-core/src/api/config/types/config-validation-schema.json +++ b/packages/geoview-core/src/api/config/types/config-validation-schema.json @@ -4,452 +4,530 @@ "title": "GeoView Core Config Schema", "type": "object", "version": 1.0, - "comments": "This schema is used to validate the JSON representation of the internal instance of map features and geoview layers.", + "comments": "This schema is used to validate the JSON representation of the input configuration and the internal instance of map features and geoview layers.", "additionalProperties": false, "definitions": { - "TypeLocalizedString": { + "MapFeatureConfig": { + "description": "The map feature configuration.", "additionalProperties": false, - "minProperties": 1, "type": "object", "properties": { - "en": { - "type": "string", - "description": "The English version of the string." + "map": { + "$ref": "#/definitions/TypeMapConfig" }, - "fr": { - "type": "string", - "description": "The French version of the string. " + "theme": { + "description": "Theme style the viewer uses.", + "$ref": "#/definitions/TypeDisplayTheme" + }, + "navBar": { + "$ref": "#/definitions/TypeNavBarProps" + }, + "footerBar": { + "$ref": "#/definitions/TypeFooterBarProps" + }, + "appBar": { + "$ref": "#/definitions/TypeAppBarProps" + }, + "overviewMap": { + "$ref": "#/definitions/TypeOverviewMapProps" + }, + "components": { + "$ref": "#/definitions/TypeMapComponents" + }, + "corePackages": { + "$ref": "#/definitions/TypeMapCorePackages" + }, + "externalPackages": { + "$ref": "#/definitions/TypeExternalPackages" + }, + "serviceUrls": { + "$ref": "#/definitions/TypeServiceUrls" + }, + "schemaVersionUsed": { + "$ref": "#/definitions/TypeValidVersions" } - } + }, + "required": ["map"] }, - "TypeFeatureInfoLayerConfig": { + "TypeMapConfig": { "additionalProperties": false, "type": "object", "properties": { - "nameField": { - "type": "string", - "description": "The display field (English/French) of the layer. If it is not present the viewer will make an attempt to find the first valid field." + "basemapOptions": { + "$ref": "#/definitions/TypeBasemapOptions" }, - "outfields": { - "type": "array", - "items": { - "additionalProperties": false, - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The field name." - }, - "alias": { - "type": "string", - "description": "The field alias that replaces the name when comes time to display it." - }, - "type": { - "type": "string", - "description": "The field type." - }, - "domain": { - "type": "array", - "description": "An array of values that constitute the domain." - } - } - } + "interaction": { + "$ref": "#/definitions/TypeInteraction" + }, + "listOfGeoviewLayerConfig": { + "description": "List of GeoView Layers in the order which they should be added to the map.", + "additionalProperties": false, + "$ref": "#/definitions/TypeListOfAbstractGeoviewLayerConfig" + }, + "viewSettings": { + "$ref": "#/definitions/TypeViewSettings" + }, + "highlightColor": { + "$ref": "#/definitions/TypeHighlightColors" + }, + "extraOptions": { + "description": "Additional options used for OpenLayers map options", + "type": "object" } }, - "required": ["nameField", "outfields"] + "required": ["basemapOptions", "interaction", "viewSettings"] }, - "TypeStrokeSymbolConfig": { - "minProperties": 1, + "TypeListOfAbstractGeoviewLayerConfig": { + "description": "The list of geoview layer configurations. The map config validation ends here. The only thing we need to verify for the moment is it must be an array.", + "type": "array" + }, + "TypeDisplayTheme": { + "description": "Valid values for the theme property.", + "additionalProperties": false, + "enum": ["dark", "light", "geo.ca"], + "default": "geo.ca" + }, + "TypeValidNavBarProps": { + "description": "Valid values for the navBar array.", + "additionalProperties": false, + "enum": ["zoom", "fullscreen", "home", "location"] + }, + "TypeNavBarProps": { + "description": "Controls available on the navigation bar.", "additionalProperties": false, + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/TypeValidNavBarProps" + }, + "default": ["zoom", "fullscreen", "home"], + "minItems": 0 + }, + "TypeValidFooterBarTabsCoreProps": { + "description": "Valid values for the footerBar tabs core array.", + "additionalProperties": false, + "enum": ["legend", "layers", "details", "data-table", "time-slider", "geochart"] + }, + "TypeFooterBarTabsCustomProps": { + "description": "Footer bar tabs custom definition.", "type": "object", - "description": "Stroke style for vector features.", + "additionalProperties": false, "properties": { - "color": { + "id": { "type": "string" }, - "lineStyle": { - "enum": [ - "dash", - "dash-dot", - "dash-dot-dot", - "dot", - "longDash", - "longDash-dot", - "null", - "shortDash", - "shortDash-dot", - "shortDash-dot-dot", - "solid" - ] + "defaultTabs": { + "type": "string" }, - "width": { - "type": "number" + "contentHTML": { + "type": "string" } } }, - "TypeLineStringVectorConfig": { - "additionalProperties": false, + "TypeFooterBarProps": { "type": "object", + "additionalProperties": false, "properties": { - "type": { - "enum": ["lineString"] + "tabs": { + "description": "Available tabs", + "type": "object", + "properties": { + "core": { + "description": "Default core tabs of footer bar to use. NOTE: config from packages for time-slider and geochart are in the same loaction as core config (<>-<>.json).", + "type": "array", + "items": { + "$ref": "#/definitions/TypeValidFooterBarTabsCoreProps" + }, + "minItems": 1, + "default": ["legend", "layers", "details", "data-table"], + "uniqueItems": true + }, + "custom": { + "description": "Custom tabs of footer bar to use", + "type": "array", + "items": { + "$ref": "#/definitions/TypeFooterBarTabsCustomProps" + }, + "minItems": 0, + "default": [], + "uniqueItems": true + } + }, + "additionalProperties": false }, - "stroke": { - "$ref": "#/definitions/TypeStrokeSymbolConfig" + "collapsed": { + "description": "State of footer bar when map is loaded (expanded or collapsed)", + "type": "boolean", + "default": false } }, - "required": ["type", "stroke"] + "required": ["tabs"] }, - "TypePolygonVectorConfig": { + "TypeValidAppBarCoreProps": { + "description": "Valid values for the app bar tabs core array.", "additionalProperties": false, + "enum": ["geolocator", "export", "basemap-panel", "geochart", "details", "legend", "guide"] + }, + "TypeAppBarProps": { "type": "object", + "additionalProperties": false, "properties": { - "type": { - "enum": ["filledPolygon"] - }, - "color": { - "type": "string" - }, - "stroke": { - "$ref": "#/definitions/TypeStrokeSymbolConfig" - }, - "paternSize": { - "type": "number", - "description": "Distance between patern lines. Default = 8" - }, - "paternWidth": { - "type": "number", - "description": "Patern line width.default = 1." - }, - "fillStyle": { - "enum": ["solid", "backwardDiagonal", "cross", "diagonalCross", "forwardDiagonal", "horizontal", "null", "vertical"], - "description": "Kind of filling for vector features. Default = solid. " + "tabs": { + "description": "Available tabs - controls", + "type": "object", + "additionalProperties": false, + "properties": { + "core": { + "description": "Default core tabs of app-bar to use. NOTE: config from packages like geochart are in the same loaction as core config (<>-<>.json).", + "type": "array", + "items": { + "$ref": "#/definitions/TypeValidAppBarCoreProps" + }, + "minItems": 0, + "default": ["geolocator"], + "uniqueItems": true + } + } } }, - "required": ["type", "stroke"] + "required": ["tabs"] }, - "TypeSimpleSymbolVectorConfig": { - "additionalProperties": false, + "TypeOverviewMapProps": { "type": "object", + "additionalProperties": false, "properties": { - "type": { - "enum": ["simpleSymbol"] - }, - "rotation": { + "hideOnZoom": { + "description": "Minimum zoom level to show overview map", "type": "number", - "description": "Symbol rotation in radians." - }, - "color": { - "type": "string" - }, - "stroke": { - "$ref": "#/definitions/TypeStrokeSymbolConfig" - }, - "size": { - "type": "number" - }, - "offset": { - "type": "array", - "items": { - "type": "number" - }, - "minItems": 2, - "maxItems": 2 - }, - "symbol": { - "enum": ["circle", "+", "diamond", "square", "triangle", "X", "star"] + "minimum": 0, + "maximum": 10, + "default": 0 } + } + }, + "TypeValidMapComponentProps": { + "description": "Valid values for the map component array.", + "additionalProperties": false, + "enum": ["overview-map", "north-arrow"] + }, + "TypeMapComponents": { + "description": "Core components to initialize on viewer load. The schema for those are inside this file.", + "additionalProperties": false, + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/TypeValidMapComponentProps" }, - "required": ["type", "symbol"] + "default": ["overview-map", "north-arrow"], + "minItems": 0 }, - "TypeIconSymbolVectorConfig": { + "TypeValidMapCorePackageProps": { + "description": "Valid values for the map core package array.", + "additionalProperties": false, + "enum": ["swiper"] + }, + "TypeMapCorePackages": { + "description": "Core map packages to initialize on viewer load. The schema for those are on their own package. NOTE: config from packages are in the same loaction as core config (<>-<>.json).", + "additionalProperties": false, + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/TypeValidMapCorePackageProps" + }, + "default": [], + "minItems": 0 + }, + "TypeExternalPackagesProps": { "additionalProperties": false, "type": "object", "properties": { - "type": { - "enum": ["iconSymbol"] - }, - "mimeType": { + "name": { + "description": "External Package name. The name must be identical to the window external package object to load.", "type": "string" }, - "src": { + "configUrl": { + "description": "The url to the external package configuration setting. The core package will read the configuration and pass it inside the package.", "type": "string" - }, - "width": { - "type": "integer", - "description": "Icon width in pixel." - }, - "height": { - "type": "integer", - "description": "Icon height in pixel." - }, - "rotation": { - "type": "number", - "description": "Icon rotation in radians." - }, - "opacity": { - "type": "number", - "minimum": 0, - "maximum": 1, - "default": 1 - }, - "offset": { - "type": "array", - "items": { - "type": "number" - }, - "minItems": 2, - "maxItems": 2 - }, - "crossOrigin": { - "type": "string", - "description": "The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you want to access pixel data with the Canvas renderer." } }, - "required": ["type", "mimeType", "src"] + "required": ["name"] }, - "TypeSimpleStyleConfig": { + "TypeExternalPackages": { + "description": "List of external packages to initialize on viewer load.", "additionalProperties": false, - "type": "object", - "properties": { - "styleType": { - "enum": ["simple"] - }, - "label": { - "type": "string" - }, - "settings": { - "$ref": "#/definitions/TypeKindOfVectorSettings" - } + "type": "array", + "items": { + "$ref": "#/definitions/TypeExternalPackagesProps" }, - "required": ["styleType", "label", "settings"] + "default": [], + "minItems": 0 }, - "TypeUniqueValueStyleConfig": { + "TypeServiceUrls": { + "description": "Service endpoint urls", "additionalProperties": false, "type": "object", "properties": { - "styleType": { - "enum": ["uniqueValue"] - }, - "defaultLabel": { + "geocoreUrl": { + "description": "Service end point to access API for layers specification (loading and plugins parameters). By default it is GeoCore but can be another endpoint with similar output.", "type": "string", - "description": "Label used if field/value association is not found." - }, - "defaultVisible": { - "type": "boolean", - "description": "Flag used to show/hide features associated to the default label (default: true)." + "default": "https://geocore.api.geo.ca" }, - "defaultSettings": { - "$ref": "#/definitions/TypeKindOfVectorSettings", - "description": "Settings used if field/value association is not found." + "proxyUrl": { + "description": "An optional proxy to be used for dealing with same-origin issues. URL must either be a relative path on the same server or an absolute path on a server which sets CORS headers.", + "type": "string", + "default": "https://maps.canada.ca/wmsproxy/ws/wmsproxy/executeFromProxy" + }, - "fields": { - "type": "array", - "items": { - "type": "string" - }, - "minItems": 1 - }, - "uniqueValueStyleInfo": { - "$ref": "#/definitions/TypeUniqueValueStyleInfo" + "geolocator": { + "description": "Service end point to access geo location of searched value.", + "type": "string", + "default": "https://geolocator.api.geo.ca?keys=geonames,nominatim,locate" } - }, - "required": ["styleType", "fields", "uniqueValueStyleInfo"] + } }, - "TypeUniqueValueStyleInfo": { - "type": "array", - "items": { - "additionalProperties": false, - "type": "object", - "properties": { - "label": { - "type": "string" - }, - "visible": { - "type": "boolean", - "description": "Flag used to show/hide features associated to the label (default: true)." - }, - "values": { - "type": "array", - "items": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "number" - } - ] - }, - "minItems": 1 - }, - "settings": { - "$ref": "#/definitions/TypeKindOfVectorSettings" - } - } - }, - "minItems": 1, - "required": ["label", "values", "options"] + "TypeValidVersions": { + "description": "The schema version that can be used to validate the configuration file. The schema should enumerate the list of versions accepted by this version of the viewer.", + "enum": ["1.0"] }, - "TypeClassBreakStyleConfig": { + "TypeBasemapOptions": { "additionalProperties": false, "type": "object", "properties": { - "styleType": { - "enum": ["classBreaks"] - }, - "defaultLabel": { - "type": "string", - "description": "Label used if field/value association is not found." + "basemapId": { + "$ref": "#/definitions/TypeBasemapId" }, - "defaultVisible": { + "shaded": { + "description": "Enable or disable shaded basemap (if basemap id is set to shaded then this should be false).", "type": "boolean", - "description": "Flag used to show/hide features associated to the default label (default: true)." - }, - "defaultSettings": { - "$ref": "#/definitions/TypeKindOfVectorSettings", - "description": "Settings used if field/value association is not found." - }, - "field": { - "type": "string" + "default": true }, - "classBreakStyleInfo": { - "$ref": "#/definitions/TypeClassBreakStyleInfo" + "labeled": { + "description": "Enable or disable basemap labels", + "type": "boolean", + "default": true } }, - "required": ["styleType", "field", "classBreakStyleInfo"] + "required": ["basemapId", "shaded", "labeled"] + }, + "TypeBasemapId": { + "description": "Id of the basemap to use.", + "enum": ["transport", "osm", "simple", "nogeom", "shaded"], + "default": "transport" }, - "TypeClassBreakStyleInfo": { + "TypeInteraction": { + "description": "If map is dynamic (pan/zoom) or static to act as a thumbnail (no nav bar).", "additionalProperties": false, - "type": "array", - "items": { - "additionalProperties": false, - "type": "object", - "properties": { - "label": { - "type": "string" - }, - "visible": { - "type": "boolean", - "description": "Flag used to show/hide features associated to the label (default: true)." - }, - "minValue": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "number" - } - ] - }, - "maxValue": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "number" - } - ] - }, - "settings": { - "$ref": "#/definitions/TypeKindOfVectorSettings" - } - } - }, - "minItems": 1, - "required": ["label", "minValue", "maxValue", "settings"] + "enum": ["static", "dynamic"], + "default": "dynamic" }, - "TypeKindOfVectorSettings": { - "oneOf": [ - { - "$ref": "#/definitions/TypeLineStringVectorConfig" + "AbstractGeoviewLayerConfig": { + "additionalProperties": false, + "type": "object", + "properties": { + "geoviewLayerId": { + "description": "The id of the layer for referencing within the viewer (does not relate directly to any external service). The id will have the language extension (id-'lang').", + "type": "string" }, - { - "$ref": "#/definitions/TypePolygonVectorConfig" + "geoviewLayerName": { + "description": "The display name of the layer (English/French). If it is not present the viewer will make an attempt to scrape this information.", + "oneOf": [ + { + "description": "Used by the input schema.", + "$ref": "#/definitions/TypeLocalizedString" + }, + { + "description": "Used by the internal schema.", + "type": "string" + } + ] }, - { - "$ref": "#/definitions/TypeSimpleSymbolVectorConfig" + "isGeocore": { + "description": "A flag used to indicate that the layer is a GeoCore layer.", + "type": "boolean" }, - { - "$ref": "#/definitions/TypeIconSymbolVectorConfig" - } - ] - }, - "TypeStyleSettings": { - "oneOf": [ - { - "$ref": "#/definitions/TypeSimpleStyleConfig" + "metadataAccessPath": { + "description": "The GeoView layer service access path (English/French).", + "oneOf": [ + { + "description": "Used by the input schema.", + "$ref": "#/definitions/TypeLocalizedString" + }, + { + "description": "Used by the internal schema.", + "type": "string" + } + ] }, - { - "$ref": "#/definitions/TypeUniqueValueStyleConfig" + "geoviewLayerType": { + "description": "Type of GeoView layer.", + "$ref": "#/definitions/TypeGeoviewLayerType" }, - { - "$ref": "#/definitions/TypeClassBreakStyleConfig" + "serviceDateFormat": { + "description": "Date format used by the service endpoint (default 'DD/MM/YYYY HH:MM:SSZ').", + "type": "string" + }, + "externalDateFormat": { + "description": "Date format used by the getFeatureInfo to output date variable (default 'DD/MM/YYYY HH:MM:SSZ').", + "type": "string" + }, + "initialSettings": { + "description": "Initial settings to apply to the GeoView layer at creation time.", + "$ref": "#/definitions/TypeLayerInitialSettings" + }, + "listOfLayerEntryConfig": { + "description": "The layer entries to use from the GeoView layer.", + "$ref": "#/definitions/TypeListOfLayerEntryConfig" } - ] + }, + "required": ["geoviewLayerId", "geoviewLayerName", "geoviewLayerType", "listOfLayerEntryConfig"] }, - "TypeStyleConfig": { + "TypeListOfLayerEntryConfig": { + "description": "The list of layer configurations. The AbstractGeoviewLayerConfig validation ends here. The only thing we need to verify for the moment is it must be an array of at least one element.", + "type": "array", + "minItems": 1 + }, + "TypeViewSettings": { "additionalProperties": false, "type": "object", "properties": { - "type": { - "enum": ["simple", "uniqueValue", "classBreaks"], - "description": "The type of style used by the layer." + "initialView": { + "description": "Settings for the initial viewing area of the map.", + "$ref": "#/definitions/TypeMapViewSettings" }, - "fields": { + "enableRotation": { + "description": "Enable rotation. If false, a rotation constraint that always sets the rotation to zero is used.", + "type": "boolean", + "default": true + }, + "rotation": { + "description": "The initial rotation for the view in degree (positive rotation clockwise, 0 means North). Will be converted to radiant by the viewer.", + "type": "integer", + "minimum": -360, + "maximum": 360, + "default": 0 + }, + "maxExtent": { + "description": "The extent that constrains the view. Called with [minX, minY, maxX, maxY] extent coordinates.", "type": "array", + "minItems": 4, + "maxItems": 4, "items": { - "type": "string" + "type": "number" }, - "minItems": 1 + "default": [-125, 30, -60, 89] }, - "hasDefault": { - "type": "boolean", - "description": "Flag used to indicate that the symbology has a default value." + "minZoom": { + "description": "The minimum zoom level used to determine the resolution constraint. If not set, will use default from basemap.", + "type": "integer", + "minimum": 0, + "maximum": 50 }, - "info": { - "type": "array", - "description": "Array of style information.", - "items": { - "$ref": "#/definitions/TypeStyleConfigInfo" - } + "maxZoom": { + "description": "The maximum zoom level used to determine the resolution constraint. If not set, will use default from basemap.", + "type": "integer", + "minimum": 0, + "maximum": 50 + }, + "projection": { + "$ref": "#/definitions/TypeValidMapProjectionCodes", + "default": 3978 } } }, - "TypeStyleConfigInfo": { + "TypeHighlightColors": { + "description": "Color to use for feature highlights.", + "additionalProperties": false, + "enum": ["black", "white", "red", "green"], + "default": "black" + }, + "TypeDisplayLanguage": { + "description": "Display languages supported.", + "enum": ["en", "fr"] + }, + "TypeLocalizedString": { "additionalProperties": false, + "minProperties": 1, "type": "object", "properties": { - "visible": { - "type": "boolean", - "description": "Flag used to show/hide features associated to the label (default: true)." + "en": { + "description": "The English version of the string.", + "type": "string" }, - "label": { + "fr": { + "description": "The French version of the string.", "type": "string" + } + } + }, + "TypeGeoviewLayerType": { + "description": "Type of GeoView layer.", + "type": "string", + "items": { + "enum": [ + "CSV", + "esriDynamic", + "esriFeature", + "esriImage", + "GeoJSON", + "imageStatic", + "ogcFeature", + "ogcWfs", + "ogcWms", + "vectorTiles", + "xyzTiles" + ] + } + }, + "TypeLayerInitialSettings": { + "additionalProperties": false, + "type": "object", + "properties": { + "controls": { + "description": "The status of various controls for the layer (available/unavailable).", + "$ref": "#/definitions/TypeLayerControls" }, - "values": { - "description": "Simple type has a single value at index 0; uniqueValue type has many entries (up to 3 for ESRI) and classBreaks type has two entries (index 0 for min and index 1 for max).", + "bounds": { + "description": "The geographic bounding box that contains all the layer's features.", "type": "array", + "minItems": 4, + "maxItems": 4, "items": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "number" - } - ] - }, - "minItems": 1 + "type": "number" + } }, - "settings": { - "$ref": "#/definitions/TypeKindOfVectorSettings" + "extent": { + "description": "The extent that constrains the view. Called with [minX, minY, maxX, maxY] extent coordinates.", + "type": "array", + "minItems": 4, + "maxItems": 4, + "items": { + "type": "number" + } + }, + "minZoom": { + "description": "The minimum view zoom level (exclusive) above which this layer will be visible.", + "type": "integer", + "minimum": 0, + "maximum": 50 + }, + "maxZoom": { + "description": "The maximum view zoom level (inclusive) above which this layer will be visible.", + "type": "integer", + "minimum": 0, + "maximum": 50 + }, + "className": { + "description": "A CSS class name to set to the layer element.", + "type": "string" + }, + "states": { + "description": "The status of initial states for the layer.", + "$ref": "#/definitions/TypeLayerStates" } } }, "TypeLayerControls": { + "description": "Which UI controls are available.", "additionalProperties": false, "type": "object", "properties": { @@ -485,317 +563,150 @@ "type": "boolean", "default": true } - }, - "description": "Which UI controls are available." + } }, "TypeLayerStates": { + "description": "Which UI controls are available.", "additionalProperties": false, "type": "object", "properties": { "visible": { + "description": "Initial visibility setting.", "type": "boolean", - "default": true, - "description": "Initial visibility setting." + "default": true }, "opacity": { + "description": "Initial opacity setting.", "type": "number", "minimum": 0, "maximum": 1, - "default": 1, - "description": "Initial opacity setting." + "default": 1 }, "hoverable": { - "type": "boolean", - "description": "Is the layer hoverable." + "description": "Is the layer hoverable.", + "type": "boolean" }, "queryable": { - "type": "boolean", - "description": "Is the layer queryable." + "description": "Is the layer queryable.", + "type": "boolean" } - }, - "description": "Which UI controls are available." + } }, - "TypeLayerInitialSettings": { - "additionalProperties": false, + "TypeMapViewSettings": { "type": "object", + "maxItems": 1, "properties": { - "controls": { - "$ref": "#/definitions/TypeLayerControls", - "description": "The status of various controls for the layer (available/unavailable)." - }, - "bounds": { - "type": "array", - "minItems": 4, - "maxItems": 4, - "items": { - "type": "number" - }, - "description": "The geographic bounding box that contains all the layer's features." + "zoomAndCenter": { + "$ref": "#/definitions/TypeZoomAndCenter" }, "extent": { + "description": "The extent for the initial view. Called with [minX, minY, maxX, maxY] extent coordinates.", "type": "array", "minItems": 4, "maxItems": 4, "items": { "type": "number" - }, - "description": "The extent that constrains the view. Called with [minX, minY, maxX, maxY] extent coordinates." - }, - "minZoom": { - "type": "integer", - "minimum": 0, - "maximum": 50, - "description": "The minimum view zoom level (exclusive) above which this layer will be visible." - }, - "maxZoom": { - "type": "integer", - "minimum": 0, - "maximum": 50, - "description": "The maximum view zoom level (inclusive) above which this layer will be visible." - }, - "className": { - "type": "string", - "description": "A CSS class name to set to the layer element." - }, - "states": { - "$ref": "#/definitions/TypeLayerStates", - "description": "The status of initial states for the layer." - } - } - }, - "TypeVectorSourceFormats": { - "enum": ["GeoJSON", "EsriJSON", "KML", "WFS", "featureAPI", "GeoPackage", "CSV"], - "description": "The feature format used by the XHR feature loader when access path is set." - }, - "TypeVectorSourceInitialConfig": { - "additionalProperties": false, - "type": "object", - "properties": { - "maxRecordCount": { - "type": "number", - "description": "Maximum number of records to fetch (default: 0)." - }, - "layerFilter": { - "type": "string", - "description": "Filter to apply on features of this layer." - }, - "postSettings": { - "$ref": "#/definitions/TypePostSettings" - }, - "format": { - "$ref": "#/definitions/TypeVectorSourceFormats" - }, - "dataProjection": { - "$ref": "#/definitions/TypeValidMapProjectionCodes", - "description": "The projection code of the source. Used only for GeoJSON format. Default value is EPSG:4326. " - }, - "featureInfo": { - "$ref": "#/definitions/TypeFeatureInfoLayerConfig" - }, - "strategy": { - "enum": ["all", "bbox"], - "default": "all", - "description": "The loading strategy to use. By default an all strategy is used, a one-off strategy which loads all features at once." - }, - "separator": { - "type": "string", - "description": "The character used to separate columns of csv file" - } - } - }, - "TypeSourceImageWmsInitialConfig": { - "additionalProperties": false, - "type": "object", - "properties": { - "crossOrigin": { - "type": "string", - "description": "The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you want to access pixel data with the Canvas renderer." - }, - "projection": { - "$ref": "#/definitions/TypeValidMapProjectionCodes", - "description": "Spatial Reference EPSG code supported (https://epsg.io/). We support Web Mercator and Lambert Conical Conform Canada." - }, - "featureInfo": { - "$ref": "#/definitions/TypeFeatureInfoLayerConfig" - }, - "serverType": { - "$ref": "#/definitions/TypeOfServer", - "description": "The type of the remote WMS server. The default value is mapserver." - }, - "style": { - "oneOf": [ - { - "type": "string", - "description": "Single style to apply" - }, - { - "type": "array", - "items": { - "type": "string" - }, - "description": "Array of style to choose." - } - ] - } - } - }, - "TypeOfServer": { - "enum": ["mapserver", "geoserver", "qgis"], - "description": "The type of the remote WMS server. The default value is mapserver." - }, - "TypeSourceImageStaticInitialConfig": { - "additionalProperties": false, - "type": "object", - "properties": { - "crossOrigin": { - "type": "string", - "description": "The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you want to access pixel data with the Canvas renderer." - }, - "projection": { - "$ref": "#/definitions/TypeValidMapProjectionCodes", - "description": "Spatial Reference EPSG code supported (https://epsg.io/). We support Web Mercator and Lambert Conical Conform Canada." + } }, - "extent": { + "layerIds": { + "description": "ID(s) of layer(s) to use as initial map focus.", "type": "array", - "minItems": 4, - "maxItems": 4, + "minItems": 1, "items": { - "type": "number" - }, - "description": "The extent of the static image. Called with [minX, minY, maxX, maxY] extent coordinates." + "type": "string" + } } } }, - "TypeSourceImageEsriInitialConfig": { - "additionalProperties": false, - "type": "object", - "properties": { - "maxRecordCount": { + "TypeZoomAndCenter": { + "description": "Initial zoom and center coordinates to set map view.", + "type": "array", + "prefixItems": [ + { "type": "number", - "description": "Maximum number of records to fetch (default: 0)." - }, - "layerFilter": { - "type": "string", - "description": "Filter to apply on features of this layer." - }, - "crossOrigin": { - "type": "string", - "description": "The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you want to access pixel data with the Canvas renderer." - }, - "projection": { - "$ref": "#/definitions/TypeValidMapProjectionCodes", - "description": "Spatial Reference EPSG code supported (https://epsg.io/). We support Web Mercator and Lambert Conical Conform Canada." - }, - "featureInfo": { - "$ref": "#/definitions/TypeFeatureInfoLayerConfig" - }, - "format": { - "$ref": "#/definitions/TypeEsriFormatParameter" + "description": "Initial map zoom level. Zoom level are define by the basemap zoom levels. Levels between whole numbers are supported to fine tune initial view.", + "minimum": 0, + "maximum": 28, + "default": 4.5 }, - "transparent": { - "type": "boolean", - "default": true, - "description": "If true, the image will be exported with the background color of the map set as its transparent color. Only the .png and .gif formats support transparency." - } - } + [ + { + "type": "number", + "description": "Initial longitude value for map center.", + "minimum": -160, + "maximum": 160, + "default": -90 + }, + { + "type": "number", + "description": "Initial latitude value for map center.", + "minimum": -80, + "maximum": 80, + "default": 65 + } + ] + ], + "default": [4.5, [-90, 67]] }, - "TypeEsriFormatParameter": { - "enum": ["png", "jpg", "gif", "svg"], - "default": "png", - "description": "The format of the exported image. The default format is png." + "TypeValidMapProjectionCodes": { + "description": "Spatial Reference EPSG code supported (https://epsg.io/). We support Web Mercator and Lambert Conical Conform Canada.", + "enum": [3978, 3857], + "default": 3978 }, - "TypeSourceTileInitialConfig": { - "additionalProperties": false, - "properties": { - "crossOrigin": { - "type": "string", - "description": "The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you want to access pixel data with the Canvas renderer." - }, - "projection": { - "$ref": "#/definitions/TypeValidMapProjectionCodes", - "description": "Spatial Reference EPSG code supported (https://epsg.io/). We support Web Mercator and Lambert Conical Conform Canada." + "EsriDynamicLayerConfig": { + "description": "Structure used by the viewer to describe the configuration of an ESRI dynamic layer.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/AbstractGeoviewLayerConfig" }, - "tileGrid": { - "$ref": "#/definitions/TypeTileGrid" + { + "type": "object", + "properties": { + "geoviewLayerType": { + "enum": ["esriDynamic"] + } + } } - } + ] }, - "TypeTileGrid": { - "additionalProperties": false, + "EsriFeatureLayerConfig": { + "description": "Structure used by the viewer to describe the configuration of an ESRI feature layer.", "type": "object", - "properties": { - "extent": { - "type": "array", - "minItems": 4, - "maxItems": 4, - "items": { - "type": "number" - }, - "description": "The extent that constrains the view. Called with [minX, minY, maxX, maxY] extent coordinates." + "allOf": [ + { + "$ref": "#/definitions/AbstractGeoviewLayerConfig" }, - "origin": { - "type": "array", - "prefixItems": [ - { - "type": "number" - }, - { - "type": "number" + { + "type": "object", + "properties": { + "geoviewLayerType": { + "enum": ["esriFeature"] } - ], - "description": "The tile grid origin, i.e. where the x and y axes meet ([z, 0, 0]). Tile coordinates increase left to right and downwards. If not specified, extent must be provided." - }, - "resolutions": { - "type": "array", - "items": { - "type": "number" - }, - "description": "Resolutions. The array index of each resolution needs to match the zoom level. This means that even if a minZoom is configured, the resolutions array will have a length of maxZoom + 1." - }, - "tileSize": { - "type": "array", - "minItems": 2, - "maxItems": 2, - "items": { - "type": "number" - }, - "default": [256, 256], - "description": "The tile grid origin, i.e. where the x and y axes meet ([z, 0, 0]). Tile coordinates increase left to right and downwards. If not specified, extent must be provided." + } } - }, - "required": ["origin", "resolutions"] - }, - "TypeGeometryType": { - "enum": ["point", "linestring", "polygon"], - "description": "Display languages supported." + ] }, - "TypeVectorLayerEntryConfig": { - "additionalProperties": false, + "ConfigBaseClass": { + "description": "Base class from which we derive all the nodes (group and leaves) in the layer tree.", "type": "object", "properties": { - "entryType": { - "enum": ["vector"] - }, "layerId": { - "type": "string", - "description": "The id of the layer to display on the map." + "description": "The id of the layer to display on the map.", + "type": "string" }, "layerName": { + "description": "The display name of the layer (English/French). If it is not present the viewer will make an attempt to scrape this information.", "oneOf": [ { - "$ref": "#/definitions/TypeLocalizedString", - "description": "Used by the input schema." + "description": "Used by the input schema.", + "$ref": "#/definitions/TypeLocalizedString" }, { - "type": "string", - "description": "Used by the internal schema." + "description": "Used by the internal schema.", + "type": "string" } - ], - "description": "The display name of the layer (English/French). If it is not present the viewer will make an attempt to scrape this information." - }, - "geometryType": { - "$ref": "#/definitions/TypeGeometryType", - "description": "The type of geometry used by the layer." + ] }, "attributions": { "type": "array", @@ -812,35 +723,25 @@ } }, "minScale": { + "description": "Minimum scale the layer can display (default: 0).", "type": "number", - "default": 0, - "description": "Minimum scale the layer can display (default: 0)." + "default": 0 }, "maxScale": { + "description": "Maximum scale the layer can display (default: 0).", "type": "number", - "default": 0, - "description": "Maximum scale the layer can display (default: 0)." + "default": 0 }, "initialSettings": { - "$ref": "#/definitions/TypeLayerInitialSettings", - "description": "Initial settings to apply to the layer entry at creation time. Initial settings are inherited from the parent in the configuration tree." - }, - "temporalDimension": { - "$ref": "#/definitions/TypeTemporalDimension", - "description": "The temporal dimension settings." - }, - "source": { - "$ref": "#/definitions/TypeVectorSourceInitialConfig" - }, - "style": { - "$ref": "#/definitions/TypeStyleConfig" + "description": "Initial settings to apply to the layer entry at creation time. Initial settings are inherited from the parent in the configuration tree.", + "$ref": "#/definitions/TypeLayerInitialSettings" } }, "if": { "properties": { "entryType": { - "enum": ["vector"], - "description": "The entryType property is not defined by the user but by the viewer according to the geoview layer type. It is used as a flag indicating the type of schema used (input/internal)." + "description": "The entryType property is not defined by the user but by the viewer according to the geoview layer type. It is used as a flag indicating the type of schema used (input/internal).", + "enum": ["vector", "raster-image", "group"] } }, "required": ["entryType"] @@ -848,1108 +749,776 @@ "then": { "properties": { "layerName": { - "type": "string", - "description": "Used by the internal schema." + "description": "Used by the internal schema.", + "type": "string" } } }, "else": { "properties": { "layerName": { - "$ref": "#/definitions/TypeLocalizedString", - "description": "Used by the input schema. The display name of the layer (English/French). If it is not present the viewer will make an attempt to scrape this information." + "description": "Used by the input schema. The display name of the layer (English/French). If it is not present the viewer will make an attempt to scrape this information.", + "$ref": "#/definitions/TypeLocalizedString" } } }, "required": ["layerId"] }, - "TypeTemporalDimension": { - "additionalProperties": false, + "AbstractBaseLayerEntryConfig": { + "description": "Base class from which we derive all the leaf nodes in the layer tree.", "type": "object", - "description": "OGC time dimension definition.", - "properties": { - "field": { - "type": "string" - }, - "default": { - "type": "string" - }, - "unitSymbol": { - "type": "string" - }, - "range": { - "$ref": "#/definitions/TypeRangeItems" - }, - "nearestValues": { - "enum": ["discrete", "absolute"] + "allOf": [ + { + "$ref": "#/definitions/ConfigBaseClass" }, - "singleHandle": { - "type": "boolean" + { + "type": "object", + "properties": { + "geometryType": { + "description": "The geometry type of the leaf node.", + "$ref": "#/definitions/TypeGeometryType" + }, + "source": { + "$ref": "#/definitions/TypeBaseSourceInitialConfig" + }, + "temporalDimension": { + "$ref": "#/definitions/TypeTemporalDimension" + } + } } - } + ] }, - "TypeRangeItems": { - "additionalProperties": false, + "EsriDynamicLayerEntryConfig": { + "description": "Class from which we derive all the ESRI Dynamic leaf nodes in the layer tree.", "type": "object", - "description": "Definition of the range object in the OGC time dimension.", - "properties": { - "type": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/AbstractBaseLayerEntryConfig" }, - "range": { - "type": "array", - "items": { - "type": "string" + { + "type": "object", + "properties": { + "source": { + "$ref": "#/definitions/TypeSourceEsriDynamicInitialConfig" + }, + "style": { + "$ref": "#/definitions/TypeStyleConfig" + } } } - } + ] }, - "TypeVectorTileLayerEntryConfig": { - "additionalProperties": false, + "EsriFeatureLayerEntryConfig": { + "description": "Class from which we derive all the ESRI Feature leaf nodes in the layer tree.", "type": "object", - "description": "Layer sources providing vector data divided into a tile grid.", - "properties": { - "entryType": { - "enum": ["vector-tile"] - }, - "layerId": { - "type": "string", - "description": "The id of the layer to display on the map." - }, - "geometryType": { - "$ref": "#/definitions/TypeGeometryType", - "description": "The type of geometry used by the layer." - }, - "attributions": { - "type": "array", - "items": { - "type": "string" - } + "allOf": [ + { + "$ref": "#/definitions/AbstractBaseLayerEntryConfig" }, - "bounds": { - "type": "array", - "minItems": 4, - "maxItems": 4, - "items": { - "type": "number" + { + "type": "object", + "properties": { + "source": { + "$ref": "#/definitions/TypeSourceEsriFeatureInitialConfig" + }, + "style": { + "$ref": "#/definitions/TypeStyleConfig" + } } - }, - "minScale": { - "type": "number", - "default": 0, - "description": "Minimum scale the layer can display (default: 0)." - }, - "maxScale": { - "type": "number", - "default": 0, - "description": "Maximum scale the layer can display (default: 0)." - }, - "initialSettings": { - "$ref": "#/definitions/TypeLayerInitialSettings", - "description": "Initial settings to apply to the layer entry at creation time. Initial settings are inherited from the parent in the configuration tree." - }, - "source": { - "$ref": "#/definitions/TypeVectorTileSourceInitialConfig", - "description": "Information used to configure the source of a vector tile layer." - }, - "style": { - "$ref": "#/definitions/TypeStyleConfig" } - }, - "if": { - "properties": { - "entryType": { - "enum": ["vector-tile"], - "description": "The entryType property is not defined by the user but by the viewer according to the geoview layer type. It is used as a flag indicating the type of schema used (input/internal)." - } + ] + }, + "TypeGeometryType": { + "description": "Valid keys for the geometryType property.", + "enum": ["point", "linestring", "polygon"] + }, + "TypeBaseSourceInitialConfig": { + "description": "Base type from which we derive the source properties for all the leaf nodes in the layer tree.", + "type": "object", + "properties": { + "projection": { + "$ref": "#/definitions/TypeValidMapProjectionCodes" }, - "required": ["entryType"] - }, - "then": { - "properties": { - "layerName": { - "type": "string", - "description": "Used by the internal schema." - } + "crossOrigin": { + "description": "The crossOrigin attribute if needed to load the data.", + "type": "string" } - }, - "else": { - "properties": { - "layerName": { - "$ref": "#/definitions/TypeLocalizedString", - "description": "Used by the input schema. The display name of the layer (English/French). If it is not present the viewer will make an attempt to scrape this information." + } + }, + "TypeSourceTileInitialConfig": { + "description": "Initial settings for tile image sources.", + "additionalProperties": false, + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TypeBaseSourceInitialConfig" + }, + { + "additionalProperties": false, + "type": "object", + "properties": { + "tileGrid": { + "description": "Tile grid parameters to use.", + "$ref": "#/definitions/TypeTileGrid" + } } } - }, - "required": ["layerId"] + ] }, - "TypeVectorTileSourceInitialConfig": { + "TypeSourceImageWmsInitialConfig": { + "description": "Initial settings for tile image sources.", "additionalProperties": false, "type": "object", - "description": "Layer sources providing vector data divided into a tile grid.", - "properties": { - "format": { - "enum": ["GeoJSON", "EsriJSON", "KML", "WFS", "MVT", "featureAPI"], - "description": "The feature format used by the XHR feature loader when access path is set." - }, - "dataProjection": { - "type": "string", - "description": "The projection code of the source. Used only for GeoJSON format. Default value is EPSG:4326." - }, - "featureInfo": { - "$ref": "#/definitions/TypeFeatureInfoLayerConfig" + "allOf": [ + { + "$ref": "#/definitions/TypeBaseSourceInitialConfig" }, - "tileGrid": { - "$ref": "#/definitions/TypeTileGrid" + { + "additionalProperties": false, + "type": "object", + "properties": { + "featureInfo": { + "$ref": "#/definitions/TypeFeatureInfoLayerConfig" + }, + "serverType": { + "$ref": "#/definitions/TypeOfServer", + "description": "The type of the remote WMS server. The default value is mapserver." + }, + "style": { + "oneOf": [ + { + "type": "string", + "description": "Single style to apply" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "description": "Array of style to choose." + } + ] + } + } } - } + ] }, - "TypeOgcWmsLayerEntryConfig": { + "TypeOfServer": { + "description": "The type of the remote WMS server. The default value is mapserver.", + "enum": ["mapserver", "geoserver", "qgis"] + }, + "TypeSourceImageStaticInitialConfig": { + "description": "Initial settings for static image sources.", "additionalProperties": false, "type": "object", - "properties": { - "entryType": { - "enum": ["raster-image"] - }, - "layerId": { - "type": "string", - "description": "The id of the layer to display on the map." + "allOf": [ + { + "$ref": "#/definitions/TypeBaseSourceInitialConfig" }, - "attributions": { - "type": "array", - "items": { - "type": "string" + { + "additionalProperties": false, + "type": "object", + "properties": { + "extent": { + "description": "The extent of the static image. Called with [minX, minY, maxX, maxY] extent coordinates.", + "type": "array", + "minItems": 4, + "maxItems": 4, + "items": { + "type": "number" + } + } } + } + ] + }, + "TypeBaseVectorSourceInitialConfig": { + "description": "Base type from which we derive the source properties for all the vector leaf nodes in the layer tree.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TypeBaseSourceInitialConfig" }, - "bounds": { - "type": "array", - "minItems": 4, - "maxItems": 4, - "items": { - "type": "number" + { + "type": "object", + "properties": { + "maxRecordCount": { + "description": "Maximum number of records to fetch (default: 0).", + "type": "number" + }, + "layerFilter": { + "description": "Filter to apply on features of this layer.", + "type": "string" + }, + "featureInfo": { + "$ref": "#/definitions/TypeFeatureInfoLayerConfig" + }, + "format": { + "$ref": "#/definitions/TypeVectorSourceFormats" + }, + "strategy": { + "enum": ["all", "bbox"], + "default": "all", + "description": "The loading strategy to use. By default an all strategy is used, a one-off strategy which loads all features at once." + } } - }, - "minScale": { - "type": "number", - "default": 0, - "description": "Minimum scale the layer can display (default: 0)." - }, - "maxScale": { - "type": "number", - "default": 0, - "description": "Maximum scale the layer can display (default: 0)." - }, - "initialSettings": { - "$ref": "#/definitions/TypeLayerInitialSettings", - "description": "Initial settings to apply to the layer entry at creation time. Initial settings are inherited from the parent in the configuration tree." - }, - "source": { - "$ref": "#/definitions/TypeSourceImageWmsInitialConfig" - }, - "style": { - "$ref": "#/definitions/TypeStyleConfig" } - }, - "if": { - "properties": { - "entryType": { - "enum": ["raster-image"], - "description": "The entryType property is not defined by the user but by the viewer according to the geoview layer type. It is used as a flag indicating the type of schema used (input/internal)." - } + ] + }, + "TypeVectorSourceInitialConfig": { + "description": "Initial settings to apply to the GeoView vector layer source at creation time.", + "additionalProperties": false, + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TypeBaseVectorSourceInitialConfig" }, - "required": ["entryType"] - }, - "then": { - "properties": { - "layerName": { - "type": "string", - "description": "Used by the internal schema." + { + "type": "object", + "properties": { + "separator": { + "description": "The character used to separate columns of csv file.", + "type": "string" + } } } - }, - "else": { - "properties": { - "layerName": { - "$ref": "#/definitions/TypeLocalizedString", - "description": "Used by the input schema. The display name of the layer (English/French). If it is not present the viewer will make an attempt to scrape this information." + ] + }, + "TypeVectorTileSourceInitialConfig": { + "description": "Initial settings to apply to layer sources providing vector data divided into a tile grid.", + "additionalProperties": false, + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TypeBaseVectorSourceInitialConfig" + }, + { + "type": "object", + "properties": { + "tileGrid": { + "$ref": "#/definitions/TypeTileGrid" + } } } - }, - "required": ["layerId"] + ] }, - "TypeEsriDynamicLayerEntryConfig": { + "TypeTileGrid": { "additionalProperties": false, "type": "object", "properties": { - "entryType": { - "enum": ["raster-image"] - }, - "layerId": { - "type": "string", - "description": "The id of the layer to display on the map." + "extent": { + "description": "The extent that constrains the view. Called with [minX, minY, maxX, maxY] extent coordinates.", + "type": "array", + "minItems": 4, + "maxItems": 4, + "items": { + "type": "number" + } }, - "layerName": { - "oneOf": [ + "origin": { + "description": "The tile grid origin, i.e. where the x and y axes meet ([z, 0, 0]). Tile coordinates increase left to right and downwards. If not specified, extent must be provided.", + "type": "array", + "prefixItems": [ { - "$ref": "#/definitions/TypeLocalizedString", - "description": "Used by the input schema." + "type": "number" }, { - "type": "string", - "description": "Used by the internal schema." + "type": "number" } - ], - "description": "The display name of the layer (English/French). If it is not present the viewer will make an attempt to scrape this information." - }, - "geometryType": { - "$ref": "#/definitions/TypeGeometryType", - "description": "The type of geometry used by the layer." + ] }, - "attributions": { + "resolutions": { + "description": "Resolutions. The array index of each resolution needs to match the zoom level. This means that even if a minZoom is configured, the resolutions array will have a length of maxZoom + 1.", "type": "array", "items": { - "type": "string" + "type": "number" } }, - "bounds": { + "tileSize": { + "description": "The tile grid origin, i.e. where the x and y axes meet ([z, 0, 0]). Tile coordinates increase left to right and downwards. If not specified, extent must be provided.", "type": "array", - "minItems": 4, - "maxItems": 4, + "minItems": 2, + "maxItems": 2, "items": { "type": "number" - } - }, - "minScale": { - "type": "number", - "default": 0, - "description": "Minimum scale the layer can display (default: 0)." - }, - "maxScale": { - "type": "number", - "default": 0, - "description": "Maximum scale the layer can display (default: 0)." - }, - "initialSettings": { - "$ref": "#/definitions/TypeLayerInitialSettings", - "description": "Initial settings to apply to the layer entry at creation time. Initial settings are inherited from the parent in the configuration tree." - }, - "temporalDimension": { - "$ref": "#/definitions/TypeTemporalDimension", - "description": "The temporal dimension settings." - }, - "source": { - "$ref": "#/definitions/TypeSourceImageEsriInitialConfig" - }, - "style": { - "$ref": "#/definitions/TypeStyleConfig" - } - }, - "if": { - "properties": { - "entryType": { - "enum": ["raster-image"], - "description": "The entryType property is not defined by the user but by the viewer according to the geoview layer type. It is used as a flag indicating the type of schema used (input/internal)." - } - }, - "required": ["entryType"] - }, - "then": { - "properties": { - "layerName": { - "type": "string", - "description": "Used by the internal schema." - } - } - }, - "else": { - "properties": { - "layerName": { - "$ref": "#/definitions/TypeLocalizedString", - "description": "Used by the input schema. The display name of the layer (English/French). If it is not present the viewer will make an attempt to scrape this information." - } + }, + "default": [256, 256] } }, - "required": ["layerId"] + "required": ["origin", "resolutions"] }, - "TypeEsriImageLayerEntryConfig": { - "additionalProperties": false, + "TypeVectorSourceFormats": { + "description": "The feature format used by the XHR feature loader when access path is set.", + "enum": ["GeoJSON", "EsriJSON", "KML", "WFS", "featureAPI", "GeoPackage", "CSV"] + }, + "TypeSourceEsriDynamicInitialConfig": { + "description": "Type from which we derive the source properties for all the ESRI dynamic leaf nodes in the layer tree.", "type": "object", - "properties": { - "entryType": { - "enum": ["raster-image"] - }, - "layerId": { - "type": "string", - "description": "The id of the layer to display on the map." + "allOf": [ + { + "$ref": "#/definitions/TypeBaseSourceInitialConfig" }, - "attributions": { - "type": "array", - "items": { - "type": "string" - } - }, - "bounds": { - "type": "array", - "minItems": 4, - "maxItems": 4, - "items": { - "type": "number" + { + "type": "object", + "properties": { + "maxRecordCount": { + "description": "Maximum number of records to fetch (default: 0).", + "type": "number" + }, + "layerFilter": { + "description": "Filter to apply on features of this layer.", + "type": "string" + }, + "featureInfo": { + "$ref": "#/definitions/TypeFeatureInfoLayerConfig" + }, + "format": { + "$ref": "#/definitions/TypeEsriFormatParameter" + }, + "transparent": { + "description": "If true, the image will be exported with the background color of the map set as its transparent color. Only the .png and .gif formats support transparency.", + "type": "boolean", + "default": true + } } - }, - "minScale": { - "type": "number", - "default": 0, - "description": "Minimum scale the layer can display (default: 0)." - }, - "maxScale": { - "type": "number", - "default": 0, - "description": "Maximum scale the layer can display (default: 0)." - }, - "initialSettings": { - "$ref": "#/definitions/TypeLayerInitialSettings", - "description": "Initial settings to apply to the layer entry at creation time. Initial settings are inherited from the parent in the configuration tree." - }, - "source": { - "$ref": "#/definitions/TypeSourceImageEsriInitialConfig" - }, - "style": { - "$ref": "#/definitions/TypeStyleConfig" } - }, - "if": { - "properties": { - "entryType": { - "enum": ["raster-image"], - "description": "The entryType property is not defined by the user but by the viewer according to the geoview layer type. It is used as a flag indicating the type of schema used (input/internal)." - } + ] + }, + "TypeEsriFormatParameter": { + "description": "The format of the exported image. The default format is png.", + "enum": ["png", "jpg", "gif", "svg"], + "default": "png" + }, + "TypeSourceEsriFeatureInitialConfig": { + "description": "Type from which we derive the source properties for all the ESRI feature leaf nodes in the layer tree.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TypeBaseVectorSourceInitialConfig" }, - "required": ["entryType"] - }, - "then": { - "properties": { - "layerName": { - "type": "string", - "description": "Used by the internal schema." + { + "type": "object", + "properties": { + "maxRecordCount": { + "description": "Maximum number of records to fetch (default: 0).", + "type": "number" + }, + "layerFilter": { + "description": "Filter to apply on features of this layer.", + "type": "string" + }, + "featureInfo": { + "$ref": "#/definitions/TypeFeatureInfoLayerConfig" + }, + "format": { + "enum": ["EsriJSON"] + } } } - }, - "else": { - "properties": { - "layerName": { - "$ref": "#/definitions/TypeLocalizedString", - "description": "Used by the input schema. The display name of the layer (English/French). If it is not present the viewer will make an attempt to scrape this information." + ] + }, + "TypeFeatureInfoLayerConfig": { + "type": "object", + "properties": { + "nameField": { + "description": "The display field of the layer. If it is not present the viewer will make an attempt to find the first valid field.", + "type": "string" + }, + "outfields": { + "type": "array", + "items": { + "$ref": "#/definitions/TypeOutfields" } } }, - "required": ["layerId"] + "required": ["nameField", "outfields"] }, - "TypeImageStaticLayerEntryConfig": { - "additionalProperties": false, + "TypeOutfields": { "type": "object", "properties": { - "entryType": { - "enum": ["raster-image"] + "name": { + "description": "The field name.", + "type": "string" }, - "layerId": { - "type": "string", - "description": "The id of the layer to display on the map." + "alias": { + "description": "The field alias that replaces the name when comes time to display it.", + "type": "string" }, - "attributions": { - "type": "array", - "items": { - "type": "string" - } + "type": { + "description": "The field type.", + "type": "string" }, - "bounds": { - "type": "array", - "minItems": 4, - "maxItems": 4, - "items": { - "type": "number" - } + "domain": { + "description": "An array of values that constitute the domain.", + "type": "array" + } + }, + "required": ["name", "alias", "type", "domain"] + }, + "TypeOutfieldsType": { + "description": "The types supported by the outfields object.", + "additionalProperties": false, + "enum": ["string", "number", "date", "url"] + }, + "TypeLayerEntryType": { + "description": "Layer entry data type.", + "enum": ["vector", "vector-tile", "raster-tile", "raster-image", "group"] + }, + "TypeTemporalDimension": { + "additionalProperties": false, + "type": "object", + "description": "OGC time dimension definition.", + "properties": { + "field": { + "type": "string" }, - "minScale": { - "type": "number", - "default": 0, - "description": "Minimum scale the layer can display (default: 0)." + "default": { + "type": "string" }, - "maxScale": { - "type": "number", - "default": 0, - "description": "Maximum scale the layer can display (default: 0)." + "unitSymbol": { + "type": "string" }, - "initialSettings": { - "$ref": "#/definitions/TypeLayerInitialSettings", - "description": "Initial settings to apply to the layer entry at creation time. Initial settings are inherited from the parent in the configuration tree." + "range": { + "$ref": "#/definitions/TypeRangeItems" }, - "source": { - "$ref": "#/definitions/TypeSourceImageStaticInitialConfig" - } - }, - "if": { - "properties": { - "entryType": { - "enum": ["raster-image"], - "description": "The entryType property is not defined by the user but by the viewer according to the geoview layer type. It is used as a flag indicating the type of schema used (input/internal)." - } + "nearestValues": { + "enum": ["discrete", "absolute"] }, - "required": ["entryType"] - }, - "then": { - "properties": { - "layerName": { - "type": "string", - "description": "Used by the internal schema." - } - } - }, - "else": { - "properties": { - "layerName": { - "$ref": "#/definitions/TypeLocalizedString", - "description": "Used by the input schema. The display name of the layer (English/French). If it is not present the viewer will make an attempt to scrape this information." - } + "singleHandle": { + "type": "boolean" } - }, - "required": ["layerId"] + } }, - "TypeTileLayerEntryConfig": { + "TypeRangeItems": { + "description": "Definition of the range object in the OGC time dimension.", "additionalProperties": false, "type": "object", "properties": { - "entryType": { - "enum": ["raster-tile"] - }, - "layerId": { - "type": "string", - "description": "The id of the layer to display on the map." + "type": { + "type": "string" }, - "attributions": { + "range": { "type": "array", "items": { "type": "string" } + } + } + }, + "TypeStyleConfig": { + "type": "object", + "properties": { + "type": { + "description": "The type of style used by the layer.", + "$ref": "#/definitions/TypeStyleConfigType" }, - "bounds": { + "fields": { "type": "array", - "minItems": 4, - "maxItems": 4, "items": { - "type": "number" - } - }, - "minScale": { - "type": "number", - "default": 0, - "description": "Minimum scale the layer can display (default: 0)." - }, - "maxScale": { - "type": "number", - "default": 0, - "description": "Maximum scale the layer can display (default: 0)." - }, - "initialSettings": { - "$ref": "#/definitions/TypeLayerInitialSettings", - "description": "Initial settings to apply to the layer entry at creation time. Initial settings are inherited from the parent in the configuration tree." + "type": "string" + }, + "minItems": 1 }, - "source": { - "$ref": "#/definitions/TypeSourceTileInitialConfig" - } - }, - "if": { - "properties": { - "entryType": { - "enum": ["raster-tile"], - "description": "The entryType property is not defined by the user but by the viewer according to the geoview layer type. It is used as a flag indicating the type of schema used (input/internal)." - } + "hasDefault": { + "description": "Flag used to indicate that the symbology has a default value.", + "type": "boolean" }, - "required": ["entryType"] - }, - "then": { - "properties": { - "layerName": { - "type": "string", - "description": "Used by the internal schema." - } - } - }, - "else": { - "properties": { - "layerName": { - "$ref": "#/definitions/TypeLocalizedString", - "description": "Used by the input schema. The display name of the layer (English/French). If it is not present the viewer will make an attempt to scrape this information." + "info": { + "description": "Array of style information.", + "type": "array", + "items": { + "$ref": "#/definitions/TypeStyleConfigInfo" } } - }, - "required": ["layerId"] + } }, - "TypeLayerEntryType": { - "enum": ["vector", "vector-tile", "raster-tile", "raster-image", "geoCore"], - "description": "Layer entry data type." + "TypeStyleConfigType": { + "description": "Valid keys for the type property of style configurations.", + "enum": ["simple", "uniqueValue", "classBreaks"] }, - "TypeLayerGroupEntryConfig": { - "additionalProperties": false, + "TypeStyleConfigInfo": { "type": "object", - "description": "Entry used to define a layer Group.", "properties": { - "entryType": { - "enum": ["group"] + "visible": { + "description": "Flag used to show/hide features associated to the label (default: true).", + "type": "boolean" }, - "layerId": { - "type": "string", - "description": "The id of the layer group to display on the map." + "label": { + "type": "string" }, - "bounds": { + "values": { + "description": "Simple type has a single value at index 0; uniqueValue type has many entries (up to 3 for ESRI) and classBreaks type has two entries (index 0 for min and index 1 for max).", "type": "array", - "minItems": 4, - "maxItems": 4, "items": { - "type": "number" - } - }, - "initialSettings": { - "$ref": "#/definitions/TypeLayerInitialSettings", - "description": "Initial settings to apply to the layer group entries at creation time. Initial settings are inherited from the parent in the configuration tree." - }, - "listOfLayerEntryConfig": { - "$ref": "#/definitions/TypeListOfLayerEntryConfig", - "description": "The list of layer entry configurations to use from the GeoView layer group." - } - }, - "if": { - "properties": { - "entryType": { - "enum": ["group"], - "description": "The entryType property is not defined by the user but by the viewer according to the geoview layer type. It is used as a flag indicating the type of schema used (input/internal)." - } + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "minItems": 1 }, - "required": ["entryType"] - }, - "then": { - "properties": { - "layerName": { - "type": "string", - "description": "Used by the internal schema." - } - } - }, - "else": { - "properties": { - "layerName": { - "$ref": "#/definitions/TypeLocalizedString", - "description": "Used by the input schema. The display name of the layer (English/French). If it is not present the viewer will make an attempt to scrape this information." - } + "settings": { + "$ref": "#/definitions/TypeKindOfVectorSettings" } - }, - "required": ["layerId", "listOfLayerEntryConfig"] + } }, - "TypeListOfLayerEntryConfig": { - "type": "array", - "minItems": 1 - }, - "TypeMapConfig": { - "additionalProperties": false, - "type": "object", - "properties": { - "basemapOptions": { - "$ref": "#/definitions/TypeBasemapOptions" - }, - "interaction": { - "$ref": "#/definitions/TypeInteraction" - }, - "listOfGeoviewLayerConfig": { - "$ref": "#/definitions/TypeListOfGeoviewLayerConfig" - }, - "viewSettings": { - "$ref": "#/definitions/TypeViewSettings" - }, - "highlightColor": { - "$ref": "#/definitions/TypeHighlightColors" - }, - "extraOptions": { - "type": "object", - "description": "Additional options used for OpenLayers map options" - } - }, - "required": ["basemapOptions", "interaction", "viewSettings"] - }, - "TypeBasemapOptions": { - "additionalProperties": false, - "type": "object", - "properties": { - "basemapId": { - "$ref": "#/definitions/TypeBasemapId" - }, - "shaded": { - "type": "boolean", - "default": true, - "description": "Enable or disable shaded basemap (if basemap id is set to shaded then this should be false)." - }, - "labeled": { - "type": "boolean", - "default": true, - "description": "Enable or disable basemap labels" - } - }, - "required": ["basemapId", "shaded", "labeled"] - }, - "TypeBasemapId": { - "enum": ["transport", "osm", "simple", "nogeom", "shaded"], - "default": "transport", - "description": "Id of the basemap to use." - }, - "TypeInteraction": { - "enum": ["static", "dynamic"], - "default": "dynamic", - "description": "If map is dynamic (pan/zoom) or static to act as a thumbnail (no nav bar)." - }, - "TypeHighlightColors": { - "enum": ["black", "white", "red", "green"], - "default": "black", - "description": "Color to use for feature highlights." - }, - "TypeListOfGeoviewLayerConfig": { - "description": "List of GeoView Layers in the order which they should be added to the map.", - "type": "array", - "additionalProperties": false, - "items": { - "$ref": "#/definitions/AbstractGeoviewLayerConfig" - } - }, - "AbstractGeoviewLayerConfig": { - "additionalProperties": false, - "type": "object", - "properties": { - "geoviewLayerId": { - "type": "string", - "description": "The id of the layer for referencing within the viewer (does not relate directly to any external service). The id will have the language extension (id-'lang')." - }, - "isGeocore": { - "type": "boolean", - "description": "A flag used to indicate that the layer is a GeoCore layer." + "TypeKindOfVectorSettings": { + "description": "The type of geometry settings. It must respect the base type and one of the children types.", + "allOf": [ + { + "description": "Base type for the vector geometry.", + "$ref": "#/definitions/TypeBaseVectorGeometryConfig" }, - "geoviewLayerName": { + { + "description": "One of the chid type.", "oneOf": [ { - "$ref": "#/definitions/TypeLocalizedString", - "description": "Used by the input schema." + "$ref": "#/definitions/TypeLineStringVectorConfig" }, { - "type": "string", - "description": "Used by the internal schema." - } - ], - "description": "The display name of the layer (English/French). If it is not present the viewer will make an attempt to scrape this information." - }, - "metadataAccessPath": { - "oneOf": [ + "$ref": "#/definitions/TypePolygonVectorConfig" + }, { - "$ref": "#/definitions/TypeLocalizedString", - "description": "Used by the input schema." + "$ref": "#/definitions/TypeSimpleSymbolVectorConfig" }, { - "type": "string", - "description": "Used by the internal schema." + "$ref": "#/definitions/TypeIconSymbolVectorConfig" } - ], - "description": "The GeoView layer service access path (English/French)." - }, - "geoviewLayerType": { - "$ref": "#/definitions/TypeGeoviewLayerType", - "description": "Type of GeoView layer." - }, - "serviceDateFormat": { - "type": "string", - "description": "Date format used by the service endpoint (default 'DD/MM/YYYY HH:MM:SSZ')." - }, - "externalDateFormat": { - "type": "string", - "description": "Date format used by the getFeatureInfo to output date variable (default 'DD/MM/YYYY HH:MM:SSZ')." - }, - "initialSettings": { - "$ref": "#/definitions/TypeLayerInitialSettings", - "description": "Initial settings to apply to the GeoView layer at creation time." - }, - "listOfLayerEntryConfig": { - "$ref": "#/definitions/TypeListOfLayerEntryConfig", - "description": "The layer entries to use from the GeoView layer." + ] } - }, - "required": ["geoviewLayerId", "geoviewLayerName", "geoviewLayerType", "listOfLayerEntryConfig"] + ] }, - "TypeGeoviewLayerType": { - "type": "string", - "items": { - "enum": [ - "CSV", - "esriDynamic", - "esriFeature", - "esriImage", - "GeoJSON", - "GeoPackage", - "imageStatic", - "ogcFeature", - "ogcWfs", - "ogcWms", - "vectorTiles", - "xyzTiles" - ] - }, - "description": "Type of GeoView layer." + "TypeBaseVectorGeometryConfig": { + "description": "Base type for the vector geometry types.", + "type": "object", + "properties": { + "type": { + "description": "Type of vector config.", + "$ref": "#/definitions/TypeBaseVectorType" + } + } }, - "TypeGeoCoreLayerType": { - "type": "string", - "items": { - "enum": ["geoCore"] - }, - "description": "Type of GeoCore layer." + "TypeBaseVectorType": { + "description": "Valid values for the type property of the base vector settings.", + "enum": ["lineString", "filledPolygon", "simpleSymbol", "iconSymbol"] }, - "TypeViewSettings": { - "additionalProperties": false, + "TypeLineStringVectorConfig": { + "description": "Definition of the line symbol vector settings type.", "type": "object", - "properties": { - "initialView": { - "$ref": "#/definitions/TypeMapViewSettings", - "description": "Settings for the initial viewing area of the map." - }, - "enableRotation": { - "type": "boolean", - "default": true, - "description": "Enable rotation. If false, a rotation constraint that always sets the rotation to zero is used." - }, - "maxExtent": { - "type": "array", - "minItems": 4, - "maxItems": 4, - "items": { - "type": "number" - }, - "default": [-125, 30, -60, 89], - "description": "The extent that constrains the view. Called with [minX, minY, maxX, maxY] extent coordinates." - }, - "minZoom": { - "type": "integer", - "description": "The minimum zoom level used to determine the resolution constraint. If not set, will use default from basemap.", - "minimum": 0, - "maximum": 50 - }, - "maxZoom": { - "type": "integer", - "description": "The maximum zoom level used to determine the resolution constraint. If not set, will use default from basemap.", - "minimum": 0, - "maximum": 50 - }, - "projection": { - "$ref": "#/definitions/TypeValidMapProjectionCodes" + "allOf": [ + { + "$ref": "#/definitions/TypeBaseVectorGeometryConfig" }, - "rotation": { - "type": "integer", - "minimum": -360, - "maximum": 360, - "default": 0, - "description": "The initial rotation for the view in degree (positive rotation clockwise, 0 means North). Will be converted to radiant by the viewer." + { + "type": "object", + "properties": { + "type": { + "enum": ["lineString"] + }, + "stroke": { + "$ref": "#/definitions/TypeStrokeSymbolConfig" + } + } } - } + ], + "required": ["type", "stroke"] }, - "TypeMapViewSettings": { + "TypeStrokeSymbolConfig": { + "description": "Stroke style for vector features.", + "minProperties": 1, "additionalProperties": false, "type": "object", - "maxItems": 1, "properties": { - "zoomAndCenter": { - "$ref": "#/definitions/TypeZoomAndCenter" + "color": { + "type": "string" }, - "extent": { - "type": "array", - "minItems": 4, - "maxItems": 4, - "items": { - "type": "number" - }, - "description": "The extent for the initial view. Called with [minX, minY, maxX, maxY] extent coordinates." + "lineStyle": { + "$ref": "#/definitions/TypeLineStyle" }, - "layerIds": { - "type": "array", - "minItems": 1, - "items": { - "type": "string" - }, - "description": "ID(s) of layer(s) to use as initial map focus." + "width": { + "type": "number" } } }, - "TypeZoomAndCenter": { - "type": "array", - "prefixItems": [ + "TypeLineStyle": { + "description": "Line style to use for the feature.", + "enum": [ + "dash", + "dash-dot", + "dash-dot-dot", + "dot", + "longDash", + "longDash-dot", + "null", + "shortDash", + "shortDash-dot", + "shortDash-dot-dot", + "solid" + ] + }, + "TypePolygonVectorConfig": { + "description": "Definition of the polygon symbol vector settings type.", + "type": "object", + "allOf": [ { - "type": "number", - "minimum": 0, - "maximum": 28, - "default": 3.5, - "description": "Initial map zoom level. Zoom level are define by the basemap zoom levels. Levels between whole numbers are supported to fine tune initial view." + "$ref": "#/definitions/TypeBaseVectorGeometryConfig" }, - [ - { - "type": "number", - "minimum": -160, - "maximum": 160, - "default": -90, - "description": "Initial longitude value for map center." - }, - { - "type": "number", - "minimum": -80, - "maximum": 80, - "default": 65, - "description": "Initial latitude value for map center." + { + "type": "object", + "properties": { + "type": { + "enum": ["filledPolygon"] + }, + "color": { + "type": "string" + }, + "stroke": { + "$ref": "#/definitions/TypeStrokeSymbolConfig" + }, + "paternSize": { + "description": "Distance between patern lines. Default = 8", + "type": "number" + }, + "paternWidth": { + "description": "Patern line width.default = 1.", + "type": "number" + }, + "fillStyle": { + "description": "Kind of filling for vector features. Default = solid. ", + "$ref": "#/definitions/TypeFillStyle" + } } - ] + } ], - "default": [4.5, [-90, 67]], - "description": "Initial zoom and center coordinates to set map view." - }, - "TypeValidMapProjectionCodes": { - "enum": [3978, 3857], - "default": 3978, - "description": "Spatial Reference EPSG code supported (https://epsg.io/). We support Web Mercator and Lambert Conical Conform Canada." + "required": ["type", "stroke"] }, - "TypeNavBarProps": { - "type": "array", - "uniqueItems": true, - "items": { - "enum": ["zoom", "fullscreen", "home", "location"] - }, - "default": ["zoom", "fullscreen", "home"], - "description": "Controls available on the navigation bar.", - "minItems": 0 + "TypeFillStyle": { + "description": "Valid values to specify fill styles.", + "enum": [ + "null", "solid", "backwardDiagonal", "cross", "diagonalCross", "forwardDiagonal", "horizontal", "vertical" + ] }, - "TypeFooterBarProps": { + "TypeSimpleSymbolVectorConfig": { + "description": " Definition of the simple symbol vector settings type.", "type": "object", - "additionalProperties": false, - "properties": { - "tabs": { + "allOf": [ + { + "$ref": "#/definitions/TypeBaseVectorGeometryConfig" + }, + { "type": "object", - "description": "Available tabs", "properties": { - "core": { - "type": "array", - "items": { - "type": "string", - "enum": ["legend", "layers", "details", "data-table", "time-slider", "geochart"] - }, - "minItems": 1, - "default": ["legend", "layers", "details", "data-table"], - "uniqueItems": true, - "description": "Default core tabs of footer bar to use. NOTE: config from packages for time-slider and geochart are in the same loaction as core config (<>-<>.json)." + "type": { + "enum": ["simpleSymbol"] }, - "custom": { + "rotation": { + "description": "Symbol rotation in radians.", + "type": "number" + }, + "color": { + "type": "string" + }, + "stroke": { + "$ref": "#/definitions/TypeStrokeSymbolConfig" + }, + "size": { + "type": "number" + }, + "offset": { "type": "array", "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "defaultTabs": { - "type": "string" - }, - "contentHTML": { - "type": "string" - } - } + "type": "number" }, - "minItems": 0, - "default": [], - "uniqueItems": true, - "description": "Custom tabs of footer bar to use" + "minItems": 2, + "maxItems": 2 + }, + "symbol": { + "$ref": "#/definitions/TypeSymbol" } - }, - "additionalProperties": false - }, - "collapsed": { - "type": "boolean", - "default": false, - "description": "State of footer bar when map is loaded (expanded or collapsed)" + } } - }, - "required": ["tabs"] + ], + "required": ["type", "symbol"] }, - "TypeAppBarProps": { + "TypeSymbol": { + "description": "Valid values to specify symbol shapes.", + "enum": ["circle", "+", "diamond", "square", "triangle", "X", "star"] + }, + "TypeIconSymbolVectorConfig": { "type": "object", - "additionalProperties": false, - "properties": { - "tabs": { + "allOf": [ + { + "$ref": "#/definitions/TypeBaseVectorGeometryConfig" + }, + { "type": "object", - "description": "Available tabs - controls", "properties": { - "core": { + "type": { + "enum": ["iconSymbol"] + }, + "mimeType": { + "type": "string" + }, + "src": { + "type": "string" + }, + "width": { + "description": "Icon width in pixel.", + "type": "integer" + }, + "height": { + "description": "Icon height in pixel.", + "type": "integer" + }, + "rotation": { + "description": "Icon rotation in radians.", + "type": "number" + }, + "opacity": { + "type": "number", + "minimum": 0, + "maximum": 1, + "default": 1 + }, + "offset": { "type": "array", "items": { - "type": "string", - "enum": ["geolocator", "export", "basemap-panel", "geochart", "details", "legend", "guide"] + "type": "number" }, - "minItems": 0, - "default": ["geolocator"], - "uniqueItems": true, - "description": "Default core tabs of app-bar to use. NOTE: config from packages like geochart are in the same loaction as core config (<>-<>.json)." + "minItems": 2, + "maxItems": 2 + }, + "crossOrigin": { + "description": "The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you want to access pixel data with the Canvas renderer.", + "type": "string" } - }, - "additionalProperties": false - } - }, - "required": ["tabs"] - }, - "TypeOverviewMapProps": { - "type": "object", - "additionalProperties": false, - "properties": { - "hideOnZoom": { - "type": "number", - "minimum": 0, - "maximum": 10, - "default": 0, - "description": "Minimum zoom level to show overview map" - } - } - }, - "TypeMapComponents": { - "type": "array", - "uniqueItems": true, - "items": { - "enum": ["overview-map", "north-arrow"] - }, - "default": ["overview-map", "north-arrow"], - "description": "Core components to initialize on viewer load. The schema for those are inside this file.", - "minItems": 0 - }, - "TypeMapCorePackages": { - "type": "array", - "uniqueItems": true, - "items": { - "enum": ["swiper"] - }, - "default": [], - "description": "Core map packages to initialize on viewer load. The schema for those are on their own package. NOTE: config from packages are in the same loaction as core config (<>-<>.json).", - "minItems": 0 - }, - "TypeExternalPackages": { - "type": "array", - "items": { - "additionalProperties": false, - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "External Package name. The name must be ideintical to the window external package object to load." - }, - "configUrl": { - "type": "string", - "description": "The url to the external package configuration setting. The core package will read the configuration and pass it inside the package." } - }, - "required": ["name"] - }, - "default": [], - "description": "List of external packages to initialize on viewer load.", - "minItems": 0 - }, - "TypeServiceUrls": { - "additionalProperties": false, - "type": "object", - "description": "Service endpoint urls", - "properties": { - "geocoreUrl": { - "type": "string", - "default": "https://geocore.api.geo.ca", - "description": "Service end point to access API for layers specification (loading and plugins parameters). By default it is GeoCore but can be another endpoint with similar output." - }, - "proxyUrl": { - "type": "string", - "description": "An optional proxy to be used for dealing with same-origin issues. URL must either be a relative path on the same server or an absolute path on a server which sets CORS headers." - }, - "geolocator": { - "type": "string", - "description": "Service end point to access geo location of searched value." } - }, - "required": ["geocoreUrl"] + ], + "required": ["type", "mimeType", "src"] }, "TypePostSettings": { + "description": "Definition of the post settings type needed when the GeoView GeoJSON layers need to use a POST instead of a GET.", + "additionalProperties": false, "type": "object", "properties": { "header": { - "type": "object" + "description": "An optional header object with string keys and string values.", + "type": "object", + "additionalProperties": { + "type": "string" + } }, "data": { - "type": "object" + "description": "A required property that can be any type.", + "type": ["object", "array", "string", "number", "boolean", "null"] } - } - }, - "TypeDisplayLanguage": { - "enum": ["en", "fr"], - "description": "Display languages supported." - }, - "TypeLocalizedLanguages": { - "enum": ["en", "fr"], - "description": "ISO 639-1 code indicating the languages supported by the configuration file." - }, - "TypeListOfLocalizedLanguages": { - "type": "array", - "uniqueItems": true, - "items": { - "$ref": "#/definitions/TypeLocalizedLanguages" }, - "default": ["en", "fr"], - "description": "ISO 639-1 code indicating the languages supported by the configuration file. It will use value(s) provided here to access bilangual configuration nodes. For value(s) provided here, each bilingual configuration node MUST provide a value.", - "minItems": 1 - }, - "TypeValidVersions": { - "enum": ["1.0"], - "description": "The schema version that can be used to validate the configuration file. The schema should enumerate the list of versions accepted by this version of the viewer." - }, - "MapFeatureConfig": { - "description": "The map feature configuration.", - "additionalProperties": false, - "type": "object", - "properties": { - "map": { - "$ref": "#/definitions/TypeMapConfig" - }, - "theme": { - "enum": ["dark", "light", "geo.ca"], - "default": "dark", - "description": "Theme style the viewer." - }, - "navBar": { - "$ref": "#/definitions/TypeNavBarProps" - }, - "footerBar": { - "$ref": "#/definitions/TypeFooterBarProps" - }, - "appBar": { - "$ref": "#/definitions/TypeAppBarProps" - }, - "overviewMap": { - "$ref": "#/definitions/TypeOverviewMapProps" - }, - "components": { - "$ref": "#/definitions/TypeMapComponents" - }, - "corePackages": { - "$ref": "#/definitions/TypeMapCorePackages" - }, - "externalPackages": { - "$ref": "#/definitions/TypeExternalPackages" - }, - "serviceUrls": { - "$ref": "#/definitions/TypeServiceUrls" - }, - "schemaVersionUsed": { - "$ref": "#/definitions/TypeValidVersions" - } - }, - "required": ["map"] + "required": ["data"] } } } diff --git a/packages/geoview-core/src/api/config/types/map-schema-types.ts b/packages/geoview-core/src/api/config/types/map-schema-types.ts index a13df75f54d..0c31a60df36 100644 --- a/packages/geoview-core/src/api/config/types/map-schema-types.ts +++ b/packages/geoview-core/src/api/config/types/map-schema-types.ts @@ -1,50 +1,236 @@ -// GV: CONFIG EXTRACTION -// GV: This file was extracted and copied to the geoview config section -// GV: ||||| -// GV: vvvvv import { AbstractGeoviewLayerConfig } from '@config/types/classes/geoview-config/abstract-geoview-layer-config'; -import { AbstractBaseLayerEntryConfig } from '@config/types/classes/sub-layer-config/abstract-base-layer-entry-config'; -import { ConfigBaseClass } from '@config/types/classes/sub-layer-config/config-base-class'; -import { GroupLayerEntryConfig } from '@config/types/classes/sub-layer-config/group-layer-entry-config'; -import { EsriDynamicLayerEntryConfig } from '@config/types/classes/sub-layer-config/raster-leaf/esri-dynamic-layer-entry-config'; -import { EsriFeatureLayerEntryConfig } from '@config/types/classes/sub-layer-config/vector-leaf/esri-feature-layer-entry-config'; -// #region UTILITIES TYPES +// #region UTILITY TYPES -/** - * Definition of the post settings type needed when the GeoView GeoJSON layers need to use a POST instead of a GET. - */ -export type TypePostSettings = { header?: Record; data: unknown }; +/** An array of numbers representing an extent: `[minx, miny, maxx, maxy]`. */ +export type Extent = Array; + +/** ISO 639-1 language code prefix. */ +export type TypeDisplayLanguage = 'en' | 'fr'; -/** - * Definition of a bilingual string. - */ export type TypeLocalizedString = TypeLocalizedStringEnAndFr | TypeLocalizedStringFr | TypeLocalizedStringEn; -/** - * Definition of a bilingual string, only English provided. - */ +/** Definition of a bilingual string, only English provided. */ export type TypeLocalizedStringEn = Pick & Partial>; -/** - * Definition of a bilingual string, only French provided. - */ +/** Definition of a bilingual string, only French provided. */ export type TypeLocalizedStringFr = Pick & Partial>; -/** - * Definition of a bilingual string, both English and French provided. - */ +/** Definition of a bilingual string, both English and French provided. */ export type TypeLocalizedStringEnAndFr = Required>; -// #endregion UTILITIES TYPES -/** - * An array of numbers representing an extent: `[minx, miny, maxx, maxy]`. - */ -export type Extent = Array; +/** Definition of the post settings type needed when the GeoView GeoJSON layers need to use a POST instead of a GET. */ +export type TypePostSettings = { header?: Record; data: unknown }; + +// #region MAP FEATURES + +/** Definition of the map configuration settings. */ +export { MapFeatureConfig } from '@config/types/classes/map-feature-config'; + +/** Supported geoview themes. */ +export type TypeDisplayTheme = 'dark' | 'light' | 'geo.ca'; + +/** Valid values for the navBar array. */ +export type TypeValidNavBarProps = 'zoom' | 'fullscreen' | 'home' | 'location'; + +/** Controls available on the navigation bar. Default = ['zoom', 'fullscreen', 'home']. */ +export type TypeNavBarProps = TypeValidNavBarProps[]; + +/** Supported footer bar tabs */ +export type TypeValidFooterBarTabsCoreProps = 'legend' | 'layers' | 'details' | 'data-table' | 'time-slider' | 'geochart' | 'guide'; + +/** Footer bar tabs custom definition. */ +export type TypeFooterBarTabsCustomProps = { + id: string; + defaultTabs: string; + contentHTML: string; +}; + +/** Configuration available for the footer bar component. */ +export type TypeFooterBarProps = { + tabs: { + core: TypeValidFooterBarTabsCoreProps[]; + custom: TypeFooterBarTabsCustomProps[]; // TODO: support custom tab by creating a Typeobject for it + }; + collapsed: boolean; +}; + +/** Supported app bar values. */ +export type TypeValidAppBarCoreProps = 'geolocator' | 'export' | 'basemap-panel' | 'geochart' | 'guide' | 'legend' | 'details'; + +/** Configuration available on the application bar. Default = ['geolocator']. The about GeoView and notification are always there. */ +export type TypeAppBarProps = { + tabs: { + core: TypeValidAppBarCoreProps[]; + }; +}; + +/** Overview map options. Default none. */ +export type TypeOverviewMapProps = { hideOnZoom: number }; + +/** Supported map component values. */ +export type TypeValidMapComponentProps = 'overview-map' | 'north-arrow'; + +export type TypeMapComponents = TypeValidMapComponentProps[]; + +/** Supported map component values. */ +export type TypeValidMapCorePackageProps = 'swiper'; /** - * Initial settings to apply to the GeoView layer at creation time. + * Core packages to initialize on viewer load. The schema for those are on their own package. NOTE: config from packages are in + * the same loaction as core config (<>-<>.json). + * Default = []. */ +export type TypeMapCorePackages = TypeValidMapCorePackageProps[]; + +/** External package objexct definition. */ +export type TypeExternalPackagesProps = { + /** External Package name. The name must be identical to the window external package object to load. */ + name: string; + /** + * The url to the external package configuration setting. The core package will read the configuration and pass it inside + * the package. + */ + configUrl?: string; +}; + +/** List of external packages to initialize on viewer load. Default = []. */ +export type TypeExternalPackages = TypeExternalPackagesProps[]; + +/** Service endpoint urls. */ +export type TypeServiceUrls = { + /** + * Service end point to access API for layers specification (loading and plugins parameters). By default it is GeoCore but can + * be another endpoint with similar output. Default = CV_CONFIG_GEOCORE_URL ('https://geocore-stage.api.geo.ca'. Used in config-constants). + */ + geocoreUrl: string; + /** + * An optional proxy to be used for dealing with same-origin issues. URL must either be a relative path on the same server + * or an absolute path on a server which sets CORS headers. + */ + proxyUrl?: string; + /** + * An optional geolocator service end point url, which will be used to call to get geo location of address. + * Default = CV_CONFIG_GEOLOCATOR_URL ('https://geolocator.api.geo.ca?keys=geonames,nominatim,locate'. Used in config-constants). + */ + geolocator?: string; +}; + +/** Valid schema version number. */ +export type TypeValidVersions = '1.0'; + +/** Definition of the map configuration settings. */ +export type TypeMapConfig = { + /** Basemap options settings for this map configuration. */ + basemapOptions: TypeBasemapOptions; + /** Type of interaction. */ + interaction: TypeInteraction; + /** List of GeoView Layers in the order which they should be added to the map. */ + listOfGeoviewLayerConfig: AbstractGeoviewLayerConfig[]; + /** View settings. */ + viewSettings: TypeViewSettings; + /** Highlight color. */ + highlightColor?: TypeHighlightColors; + /** Additional options used for OpenLayers map options. */ + extraOptions?: Record; +}; + +/** Definition of the basemap options type. */ +export type TypeBasemapOptions = { + /** Id of the basemap to use. */ + basemapId: TypeBasemapId; + /** Enable or disable shaded basemap (if basemap id is set to shaded then this should be false). */ + shaded: boolean; + /** Enable or disable basemap labels. */ + labeled: boolean; +}; + +/** Definition of the basemap options type. */ +export type TypeBasemapId = 'transport' | 'osm' | 'simple' | 'nogeom' | 'shaded'; + +/** Definition of the valid map interactiom values. If map is dynamic (pan/zoom) or static to act as a thumbnail (no nav bar). */ +export type TypeInteraction = 'static' | 'dynamic'; + +/** Definition of the view settings. */ +export type TypeViewSettings = { + /** Settings for the initial view for map, default is zoomAndCenter of [3.5, [-90, 65]] */ + initialView?: TypeMapViewSettings; + /** Enable rotation. If false, a rotation constraint that always sets the rotation to zero is used. Default = true. */ + enableRotation?: boolean; + /** + * The initial rotation for the view in degree (positive rotation clockwise, 0 means North). Will be converted to radiant by + * the viewer. Domaine = [0..360], default = 0. + */ + rotation?: number; + /** The extent that constrains the view. Called with [minX, minY, maxX, maxY] extent coordinates. + * Default [-125, 30, -60, 89]. + */ + maxExtent?: Extent; + /** + * The minimum zoom level used to determine the resolution constraint. If not set, will use default from basemap. + * Domaine = [0..50]. + */ + minZoom?: number; + /** + * The maximum zoom level used to determine the resolution constraint. If not set, will use default from basemap. + * Domaine = [0..50]. + */ + maxZoom?: number; + /** + * Spatial Reference EPSG code supported (https://epsg.io/). We support Web Mercator and Lambert Conical Conform Canada. + * Default = 3978. + */ + projection: TypeValidMapProjectionCodes; +}; + +/** Definition of the zoomAndCenter properties */ +export type TypeZoomAndCenter = [number, [number, number]]; + +/** Definition of the initial view settings. */ +export type TypeMapViewSettings = { + /** + * Option to set the zoom and center of initial view. + * Zoom and center of the map defined as [zoom, [longitude, latitude]]. Longitude domain = [-160..160], + * Latitude domain = [-80..80]. */ + zoomAndCenter?: TypeZoomAndCenter; + /** + * Option to set initial view by extent. + * Called with [minX, minY, maxX, maxY] extent coordinates. */ + extent?: Extent; + /** IDs of layers to use for initial map extent. */ + layerIds?: string[]; +}; + +/** Type used to define valid projection codes. */ +export type TypeValidMapProjectionCodes = 3978 | 3857; + +/** Type used to define valid highlight colors. */ +export type TypeHighlightColors = 'black' | 'white' | 'red' | 'green'; + +// #region GEOVIEW LAYERS + +/** Parent class of the GeoView layers. */ +export { AbstractGeoviewLayerConfig } from '@config/types/classes/geoview-config/abstract-geoview-layer-config'; + +/** Child classes derived from the AbstractGeoviewLayerConfig. */ +export { EsriDynamicLayerConfig } from '@config/types/classes/geoview-config/raster-config/esri-dynamic-config'; +export { EsriFeatureLayerConfig } from '@config/types/classes/geoview-config/vector-config/esri-feature-config'; + +/** Definition of the geoview layer types accepted by the viewer. */ +export type TypeGeoviewLayerType = + | 'CSV' + | 'esriDynamic' + | 'esriFeature' + | 'esriImage' + | 'GeoJSON' + | 'imageStatic' + | 'ogcFeature' + | 'ogcWfs' + | 'ogcWms' + | 'vectorTiles' + | 'xyzTiles'; + +/** Initial settings to apply to the GeoView layer at creation time. */ export type TypeLayerInitialSettings = { /** Settings for availablity of controls */ controls?: TypeLayerControls; @@ -58,13 +244,11 @@ export type TypeLayerInitialSettings = { maxZoom?: number; /** A CSS class name to set to the layer element. */ className?: string; - /** Settings for availablity of controls */ + /** Settings for availablity of controls. */ states?: TypeLayerStates; }; -/** - * Control settings to use in UI. - */ +/** Control settings to use in UI. */ export type TypeLayerControls = { /** Is highlight control available for layer. Default = true */ highlight?: boolean; @@ -74,7 +258,7 @@ export type TypeLayerControls = { opacity?: boolean; /** Is query control available for layer. Default = true */ query?: boolean; - /** Is remove control available for layer. Default = true */ + /** Is remove control available for layer. Default = false */ remove?: boolean; /** Is table available for layer. Default = true */ table?: boolean; @@ -84,9 +268,7 @@ export type TypeLayerControls = { zoom?: boolean; }; -/** - * Initial settings to apply to the GeoView layer at creation time. - */ +/** Initial settings for availablity of controls. */ export type TypeLayerStates = { /** Is the layer initially visible. Default = true */ visible?: boolean; @@ -94,165 +276,100 @@ export type TypeLayerStates = { opacity?: number; /** Is layer hoverable initially. Domain = [0..1] and default = 1. */ hoverable?: boolean; - /** Is layer queryable initially. Default = true */ + /** Is layer queryable initially. Default = false */ queryable?: boolean; }; -/** - * Type that defines the vector layer source formats. - */ -export type TypeVectorSourceFormats = 'GeoJSON' | 'EsriJSON' | 'KML' | 'WFS' | 'featureAPI' | 'GeoPackage' | 'CSV'; +// #region SUB LAYERS +export { ConfigBaseClass } from '@config/types/classes/sub-layer-config/config-base-class'; -/** - * Type used to configure the feature info for a layer. - */ -export type TypeFeatureInfoLayerConfig = { - /** - * The display field of the layer. If it is not present the viewer will make an attempt to find the first valid - * field. - */ - nameField: string; - /** The list of fields to be displayed by the UI. */ - outfields: TypeOutfields; -}; +export { AbstractBaseLayerEntryConfig } from '@config/types/classes/sub-layer-config/abstract-base-layer-entry-config'; +/** Child classes derived from the AbstractBaseLayerEntryConfig. */ +export { EsriDynamicLayerEntryConfig } from '@config/types/classes/sub-layer-config/raster-leaf/esri-dynamic-layer-entry-config'; +export { EsriFeatureLayerEntryConfig } from '@config/types/classes/sub-layer-config/vector-leaf/esri-feature-layer-entry-config'; -/** - * The definition of the fields to be displayed by the UI. - */ -export type TypeOutfields = { - name: string; - alias: string; - type: TypeOutfieldsType; - domain: unknown[]; -}; +/** Valid keys for the geometryType property. */ +export type TypeGeometryType = 'Point' | 'LineString' | 'Polygon'; -/** The types supported by the outfields object. */ -export type TypeOutfieldsType = 'string' | 'date' | 'number' | 'url'; +/** Type of Style to apply to the GeoView vector layer source at creation time. */ +export type TypeLayerEntryType = 'vector' | 'vector-tile' | 'raster-tile' | 'raster-image' | 'group'; -/** - * Initial settings to apply to the GeoView vector layer source at creation time. - */ -export type TypeBaseSourceVectorInitialConfig = { - /** Maximum number of records to fetch (default: 0). */ - maxRecordCount: number; - /** Filter to apply on features of this layer. */ - layerFilter?: string; - /** Settings to use when loading a GeoJSON layer using a POST instead of a GET */ - postSettings?: TypePostSettings; - /** The feature format used by the XHR feature loader when url is set. */ - format?: TypeVectorSourceFormats | 'MVT'; - /** The projection code of the source. Default value is EPSG:4326. */ - dataProjection?: TypeValidMapProjectionCodes; - /** Definition of the feature information structure that will be used by the getFeatureInfo method. */ - featureInfo?: TypeFeatureInfoLayerConfig; - /** Loading strategy to use (all or bbox). */ - strategy?: 'all' | 'bbox'; +/** Temporal dimension associated to the layer. */ +export type TypeTemporalDimension = { + field: string; + default: string; + unitSymbol: string; + range: TypeRangeItems; + nearestValues: TypeNearestValues; + singleHandle: boolean; }; -/** - * Initial settings to apply to the GeoView vector layer source at creation time. - */ -export interface TypeVectorSourceInitialConfig extends TypeBaseSourceVectorInitialConfig { - /** The feature format used by the XHR feature loader when url is set. */ - format?: TypeVectorSourceFormats; - /** The character used to separate columns of csv file */ - separator?: string; -} - -/** - * Kind of symbol vector settings. - */ -export type TypeKindOfVectorSettings = - | TypeBaseVectorConfig - | TypeLineStringVectorConfig - | TypePolygonVectorConfig - | TypeSimpleSymbolVectorConfig - | TypeIconSymbolVectorConfig; - -/** - * Definition of the line symbol vector settings type. - */ -export type TypeBaseVectorConfig = { - /** Type of vector config */ - type: 'lineString' | 'filledPolygon' | 'simpleSymbol' | 'iconSymbol'; +/** Definition of the range object that is part of the temporal dimension. */ +export type TypeRangeItems = { + type: string; + range: string[]; }; -/** - * Type of Style to apply to the GeoView vector layer source at creation time. - */ -export type TypeLayerEntryType = 'vector' | 'vector-tile' | 'raster-tile' | 'raster-image' | 'group' | 'geoCore'; - -/** - * Type that defines the domain of valid values for the ESRI format parameter. - */ -export type TypeEsriFormatParameter = 'png' | 'jpg' | 'gif' | 'svg'; - -/** - * Type of server. - */ -export type TypeOfServer = 'mapserver' | 'geoserver' | 'qgis'; - -/** - * Initial settings for image sources. - */ -export type TypeSourceImageInitialConfig = - | TypeSourceImageWmsInitialConfig - | TypeSourceImageEsriInitialConfig - | TypeSourceImageStaticInitialConfig; +/** Definition of the domain for the nearestValues property of the temporal dimension. */ +export type TypeNearestValues = 'discrete' | 'absolute'; -/** - * Initial settings for image sources. - */ -export type TypeBaseSourceImageInitialConfig = { +/** Base type from which we derive the source properties for all the leaf nodes in the layer tree. */ +export type TypeBaseSourceInitialConfig = { /** - * The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you want to access pixel data - * with the Canvas renderer. - * */ + * Spatial Reference EPSG code supported (https://epsg.io/). We support Web Mercator and Lambert Conical Conform Canada. + * Default = 3978. + */ + projection: TypeValidMapProjectionCodes; + /** The crossOrigin attribute if needed to load the data. */ crossOrigin?: string; - /** Spatial Reference EPSG code supported (https://epsg.io/). We support Web Mercator and Lambert Conical Conform Canada. */ - projection?: TypeValidMapProjectionCodes; - /** Definition of the feature information structure that will be used by the getFeatureInfo method. */ - featureInfo?: TypeFeatureInfoLayerConfig; }; -/** - * Initial settings for WMS image sources. - */ -export interface TypeSourceImageWmsInitialConfig extends TypeBaseSourceImageInitialConfig { +/** Initial settings for tile image sources. */ +export interface TypeSourceTileInitialConfig extends TypeBaseSourceInitialConfig { + /** Tile grid parameters to use. */ + tileGrid?: TypeTileGrid; +} + +/** Initial settings for WMS image sources. */ +export interface TypeSourceImageWmsInitialConfig extends TypeBaseSourceInitialConfig { + /** Definition of the feature information structure that will be used by the getFeatureInfo method. */ + featureInfo?: TypeFeatureInfoLayerConfig; /** The type of the remote WMS server. The default value is mapserver. */ serverType?: TypeOfServer; /** Style to apply. Default = '' */ style?: string | string[]; } -/** - * Initial settings for static image sources. - */ -export interface TypeSourceImageStaticInitialConfig extends TypeBaseSourceImageInitialConfig { - /** Image extent */ - extent: Extent; -} +/** Type of server. */ +export type TypeOfServer = 'mapserver' | 'geoserver' | 'qgis'; -/** - * Initial settings for WMS image sources. - */ -export interface TypeSourceImageEsriInitialConfig extends TypeBaseSourceImageInitialConfig { +/** Base type from which we derive the source properties for all the vector leaf nodes in the layer tree. */ +export interface TypeBaseVectorSourceInitialConfig extends TypeBaseSourceInitialConfig { /** Maximum number of records to fetch (default: 0). */ maxRecordCount: number; /** Filter to apply on features of this layer. */ - layerFilter: string; - /** The format used by the image layer. */ - format?: TypeEsriFormatParameter; - /** - * If true, the image will be exported with the background color of the map set as its transparent color. Only the .png and - * .gif formats support transparency. Default = true. - */ - transparent?: boolean; + layerFilter?: string; + /** The feature format used by the XHR feature loader when url is set. */ + format?: TypeVectorSourceFormats; + /** Definition of the feature information structure that will be used by the getFeatureInfo method. */ + featureInfo?: TypeFeatureInfoLayerConfig; + /** Loading strategy to use (all or bbox). */ + strategy?: 'all' | 'bbox'; } -/** - * Definition of the tile grid structure. - */ +/** Initial settings to apply to the GeoView vector layer source at creation time. */ +export interface TypeVectorSourceInitialConfig extends TypeBaseVectorSourceInitialConfig { + /** The character used to separate columns of csv file. */ + separator?: string; +} + +/** Initial settings to apply to the GeoView vector tile layer source at creation time. */ +export interface TypeVectorTileSourceInitialConfig extends TypeBaseVectorSourceInitialConfig { + /** Tile grid parameters to use. */ + tileGrid?: TypeTileGrid; +} + +/** Definition of the tile grid structure. */ export type TypeTileGrid = { /** The extent that constrains the view. Called with [minX, minY, maxX, maxY] extent coordinates. */ extent?: Extent; @@ -273,311 +390,116 @@ export type TypeTileGrid = { tileSize?: [number, number]; }; -/** - * Initial settings for tile image sources. - */ -export interface TypeSourceTileInitialConfig extends TypeBaseSourceImageInitialConfig { - /** Tile grid parameters to use. */ - tileGrid?: TypeTileGrid; -} - -/** - * Initial settings to apply to the GeoView vector tile layer source at creation time. - */ -export interface TypeVectorTileSourceInitialConfig extends TypeBaseSourceVectorInitialConfig { - /** Tile grid parameters to use. */ - tileGrid?: TypeTileGrid; -} - -/** - * Layer config type. - */ -export type TypeLayerEntryConfig = - | (ConfigBaseClass & GroupLayerEntryConfig) - | (ConfigBaseClass & AbstractBaseLayerEntryConfig & (EsriDynamicLayerEntryConfig | EsriFeatureLayerEntryConfig)); -// | VectorLayerEntryConfig -// | OgcWmsLayerEntryConfig -// | EsriImageLayerEntryConfig -// | ImageStaticLayerEntryConfig -// | TileLayerEntryConfig - -/** - * Definition of a single Geoview layer configuration. - */ -export type TypeGeoviewLayerConfig = AbstractGeoviewLayerConfig; - -// #region VIEWER CONFIG TYPES -/** - * List of supported geoview theme. - */ -// TODO: Move all the constants in the config-constants file. -export type TypeDisplayTheme = 'dark' | 'light' | 'geo.ca'; -export const VALID_DISPLAY_THEME: TypeDisplayTheme[] = ['dark', 'light', 'geo.ca']; - -/** -/** ISO 639-1 language code prefix. */ -export type TypeDisplayLanguage = 'en' | 'fr'; -/** Constante mainly use for language prefix validation. */ -export const VALID_DISPLAY_LANGUAGE: TypeDisplayLanguage[] = ['en', 'fr']; -/** - * ISO 639-1 code indicating the languages supported by the configuration file. It will use value(s) provided here to access - * bilangual nodes. For value(s) provided here, each bilingual node MUST provide a value. - */ -export type TypeLocalizedLanguages = 'en' | 'fr'; -/** List of languages supported by the map. */ -export type TypeListOfLocalizedLanguages = TypeLocalizedLanguages[]; -/** Constante mainly use for language code validation. */ -export const VALID_LOCALIZED_LANGUAGES: TypeListOfLocalizedLanguages = ['en', 'fr']; - -/** -/** Valid version number. */ -export type TypeValidVersions = '1.0'; -/** Constante mainly use for version validation. */ -export const VALID_VERSIONS: TypeValidVersions[] = ['1.0']; - -/** - * Definition of the basemap options type. - */ -export type TypeBasemapId = 'transport' | 'osm' | 'simple' | 'nogeom' | 'shaded'; - -/** - * Definition of the basemap options type. - */ -export type TypeBasemapOptions = { - /** Id of the basemap to use. */ - basemapId: TypeBasemapId; - /** Enable or disable shaded basemap (if basemap id is set to shaded then this should be false). */ - shaded: boolean; - /** Enable or disable basemap labels. */ - labeled: boolean; -}; - -/** - * Definition of the map configuration settings. - */ -export type TypeMapConfig = { - /** Basemap options settings for this map configuration. */ - basemapOptions: TypeBasemapOptions; - /** Type of interaction. */ - interaction: TypeInteraction; - /** List of GeoView Layers in the order which they should be added to the map. */ - listOfGeoviewLayerConfig: AbstractGeoviewLayerConfig[]; - /** View settings. */ - viewSettings: TypeViewSettings; - /** Highlight color. */ - highlightColor?: TypeHighlightColors; - /** Additional options used for OpenLayers map options. */ - extraOptions?: Record; -}; - -/** - * Definition of the valid map interactiom values. If map is dynamic (pan/zoom) or static to act as a thumbnail (no nav bar). - */ -export type TypeInteraction = 'static' | 'dynamic'; -/** Constante mainly use for interaction validation. */ -export const VALID_INTERACTION: TypeInteraction[] = ['static', 'dynamic']; - -/** - * Definition of the initial view settings. - */ -export type TypeMapViewSettings = { - /** - * Option to set the zoom and center of initial view. - * Zoom and center of the map defined as [zoom, [longitude, latitude]]. Longitude domain = [-160..160], - * Latitude domain = [-80..80]. */ - zoomAndCenter?: [number, [number, number]]; - /** - * Option to set initial view by extent. - * Called with [minX, minY, maxX, maxY] extent coordinates. */ - extent?: Extent; - /** IDs of layers to use for initial map extent. */ - layerIds?: string[]; -}; - -/** ****************************************************************************************************************************** - * Definition of the view settings. - */ -export type TypeViewSettings = { - /** Settings for the initial view for map, default is zoomAndCenter of [3.5, [-90, 65]] */ - initialView?: TypeMapViewSettings; - /** Enable rotation. If false, a rotation constraint that always sets the rotation to zero is used. Default = true. */ - enableRotation?: boolean; - /** - * The initial rotation for the view in degree (positive rotation clockwise, 0 means North). Will be converted to radiant by - * the viewer. Domaine = [0..360], default = 0. - */ - rotation?: number; - /** The extent that constrains the view. Called with [minX, minY, maxX, maxY] extent coordinates. - * Default [-125, 30, -60, 89]. - */ - maxExtent?: Extent; - /** - * The minimum zoom level used to determine the resolution constraint. If not set, will use default from basemap. - * Domaine = [0..50]. - */ - minZoom?: number; - /** - * The maximum zoom level used to determine the resolution constraint. If not set, will use default from basemap. - * Domaine = [0..50]. - */ - maxZoom?: number; - /** - * Spatial Reference EPSG code supported (https://epsg.io/). We support Web Mercator and Lambert Conical Conform Canada. - * Default = 3978. - */ - projection: TypeValidMapProjectionCodes; -}; - -/** - * Type used to define valid highlight colors. - */ -export type TypeHighlightColors = 'black' | 'white' | 'red' | 'green'; +/** Type that defines the vector layer source formats. */ +export type TypeVectorSourceFormats = 'GeoJSON' | 'EsriJSON' | 'KML' | 'WFS' | 'featureAPI' | 'GeoPackage' | 'CSV' | 'MVT'; -/** - * Type used to define valid projection codes. - */ -export type TypeValidMapProjectionCodes = 3978 | 3857; +/** Type from which we derive the source properties for all the ESRI feature leaf nodes in the layer tree. */ +export type TypeSourceEsriFeatureInitialConfig = TypeBaseVectorSourceInitialConfig; -/** - * Constant mainly used to test if a TypeValidMapProjectionCodes variable is a valid projection codes. - */ -export const VALID_PROJECTION_CODES = [3978, 3857]; +/** Type from which we derive the source properties for all the ESRI dynamic leaf nodes in the layer tree. */ +export interface TypeSourceEsriDynamicInitialConfig extends TypeBaseSourceInitialConfig { + /** Maximum number of records to fetch (default: 0). */ + maxRecordCount: number; + /** Filter to apply on features of this layer. */ + layerFilter?: string; + /** Definition of the feature information structure that will be used by the getFeatureInfo method. */ + featureInfo?: TypeFeatureInfoLayerConfig; + /** The format used by the image layer. */ + format: TypeEsriFormatParameter; + /** + * If true, the image will be exported with the background color of the map set as its transparent color. Only the .png + * and .gif formats support transparency. + */ + transparent?: boolean; +} -/** - * Controls available on the navigation bar. Default = ['zoom', 'fullscreen', 'home']. - */ -export type TypeNavBarProps = Array<'zoom' | 'fullscreen' | 'home' | 'location'>; +/** The format used by the image layer. */ +export type TypeEsriFormatParameter = 'png' | 'jpg' | 'gif' | 'svg'; -/** - * Configuration available on the application bar. Default = ['geolocator']. The about GeoView and notification are always there. - */ -export type TypeAppBarProps = { - tabs: { - core: TypeValidAppBarCoreProps; - }; +/** Type used to configure the feature info for a layer. */ +export type TypeFeatureInfoLayerConfig = { + /** + * The display field of the layer. If it is not present the viewer will make an attempt to find the first valid + * field. + */ + nameField: string; + /** The list of fields to be displayed by the UI. */ + outfields: TypeOutfields[]; }; -export type TypeValidAppBarCoreProps = Array<'geolocator' | 'export' | 'basemap-panel' | 'geochart' | 'guide' | 'legend' | 'details'>; -/** - * Configuration available for the footer bar component. - */ -export type TypeFooterBarProps = { - tabs: { - core: TypeValidFooterBarTabsCoreProps; - custom: Array; // TODO: support custom tab by creating a Typeobject for it - }; - collapsed: boolean; +/** The definition of the fields to be displayed by the UI. */ +export type TypeOutfields = { + name: string; + alias: string; + type: TypeOutfieldsType; + domain: unknown[]; }; -export type TypeValidFooterBarTabsCoreProps = Array<'legend' | 'layers' | 'details' | 'data-table' | 'time-slider' | 'geochart' | 'guide'>; - -/** - * Overview map options. Default none. - */ -export type TypeOverviewMapProps = { hideOnZoom: number }; - -/** - * Core components to initialize on viewer load. Default = ['north-arrow', 'overview-map']. - */ -export type TypeMapComponents = Array<'north-arrow' | 'overview-map'>; -/** - * Core packages to initialize on viewer load. The schema for those are on their own package. NOTE: config from packages are in - * the same loaction as core config (<>-<>.json). - * Default = []. - */ -export type TypeMapCorePackages = Array<'swiper'>; +/** The types supported by the outfields object. */ +export type TypeOutfieldsType = 'string' | 'date' | 'number' | 'url'; -/** - * List of external packages to initialize on viewer load. Default = []. - */ -export type TypeExternalPackages = { - /** External Package name. The name must be identical to the window external package object to load. */ - name: string; - /** - * The url to the external package configuration setting. The core package will read the configuration and pass it inside - * the package. - */ - configUrl?: string; -}[]; +/** Type of Style to apply to the GeoView vector layer based on geometry types. */ +export type TypeStyleConfig = { + type: TypeStyleConfigType; + fields: string[]; + hasDefault: boolean; + info: TypeStyleConfigInfo[]; +}; -/** - * Service endpoint urls. Default = 'https://geocore.api.geo.ca'. Used in config-constant - */ -export type TypeServiceUrls = { - /** - * Service end point to access API for layers specification (loading and plugins parameters). By default it is GeoCore but can - * be another endpoint with similar output. - */ - geocoreUrl: string; - /** - * An optional proxy to be used for dealing with same-origin issues. URL must either be a relative path on the same server - * or an absolute path on a server which sets CORS headers. - */ - proxyUrl?: string; +/** Information needed to render the feature. */ +export type TypeStyleConfigInfo = { + /** Flag used to show/hide features associated to the label (default: true). */ + visible: boolean; + /** The label to display for the field. */ + label: string; /** - * An optional geolocator service end point url, which will be used to call to get geo location of address. + * Simple type has a single value at index 0; uniqueValue type has many entries (up to 3 for ESRI) and classBreaks + * type has two entries (index 0 for min and index 1 for max). */ - geolocator?: string; + values: (string | number)[]; + /** The geometry settings. */ + settings: TypeBaseVectorGeometryConfig; }; -// #endregion VIEWER CONFIG TYPES -// #region STYLES TYPES -// TODO: Move all the type guard functions in the typeGuards file. -/** - * type guard function that redefines a TypeBaseVectorConfig as a TypeLineStringVectorConfig if the type attribute of the - * verifyIfConfig parameter is 'lineString'. The type assertion applies only to the true block of the if clause that use - * this function. - * - * @param {TypeBaseVectorConfig} verifyIfConfig Polymorphic object to test in order to determine if the type assertion is valid. - * - * @returns {boolean} true if the type assertion is valid. - */ -export const isLineStringVectorConfig = (verifyIfConfig: TypeBaseVectorConfig): verifyIfConfig is TypeLineStringVectorConfig => { - return verifyIfConfig?.type === 'lineString'; -}; +/** Valid keys for the type property of style configurations. */ +export type TypeStyleConfigType = 'simple' | 'uniqueValue' | 'classBreaks'; -/** - * type guard function that redefines a TypeBaseVectorConfig as a TypePolygonVectorConfig if the type attribute of the - * verifyIfConfig parameter is 'filledPolygon'. The type assertion applies only to the true block of the if clause that use - * this function. - * - * @param {TypeBaseVectorConfig} verifyIfConfig Polymorphic object to test in order to determine if the type assertion is valid. - * - * @returns {boolean} true if the type assertion is valid. - */ -export const isFilledPolygonVectorConfig = (verifyIfConfig: TypeBaseVectorConfig): verifyIfConfig is TypePolygonVectorConfig => { - return verifyIfConfig?.type === 'filledPolygon'; +/** Definition of the line symbol vector settings type. */ +export type TypeBaseVectorGeometryConfig = { + /** Type of vector config. */ + type: TypeBaseVectorType; }; -/** - * type guard function that redefines a TypeBaseVectorConfig as a TypeSimpleSymbolVectorConfig if the type attribute of the - * verifyIfConfig parameter is 'simpleSymbol'. The type assertion applies only to the true block of the if clause that use - * this function. - * - * @param {TypeBaseVectorConfig} verifyIfConfig Polymorphic object to test in order to determine if the type assertion is valid. - * - * @returns {boolean} true if the type assertion is valid. - */ -export const isSimpleSymbolVectorConfig = (verifyIfConfig: TypeBaseVectorConfig): verifyIfConfig is TypeSimpleSymbolVectorConfig => { - return verifyIfConfig?.type === 'simpleSymbol'; -}; +/** Valid values for the type property of the base vector settingd. */ +export type TypeBaseVectorType = 'lineString' | 'filledPolygon' | 'simpleSymbol' | 'iconSymbol'; -/** - * type guard function that redefines a TypeBaseVectorConfig as a TypeIconSymbolVectorConfig if the type attribute of the - * verifyIfConfig parameter is 'iconSymbol'. The type assertion applies only to the true block of the if clause that use - * this function. - * - * @param {TypeBaseVectorConfig} verifyIfConfig Polymorphic object to test in order to determine if the type assertion is valid. - * - * @returns {boolean} true if the type assertion is valid. - */ -export const isIconSymbolVectorConfig = (verifyIfConfig: TypeBaseVectorConfig): verifyIfConfig is TypeIconSymbolVectorConfig => { - return verifyIfConfig?.type === 'iconSymbol'; +/** Kind of symbol vector settings. */ +export type TypeKindOfVectorSettings = + | TypeBaseVectorGeometryConfig + | TypeLineStringVectorConfig + | TypePolygonVectorConfig + | TypeSimpleSymbolVectorConfig + | TypeIconSymbolVectorConfig; + +/** Definition of the line symbol vector settings type. */ +export interface TypeLineStringVectorConfig extends TypeBaseVectorGeometryConfig { + /** Type of vector config */ + type: 'lineString'; + /** Line stroke symbology */ + stroke: TypeStrokeSymbolConfig; +} + +/** Stroke style for vector features. */ +export type TypeStrokeSymbolConfig = { + /** Color to use for vector features. */ + color?: string; + /** Line style to use for the feature. */ + lineStyle?: TypeLineStyle; + /** Width to use for the stroke */ + width?: number; }; -/** - * Valid values to specify line styles. - */ +/** Valid values to specify line styles. */ export type TypeLineStyle = | 'dash' | 'dash-dot' @@ -591,45 +513,8 @@ export type TypeLineStyle = | 'shortDash-dot-dot' | 'solid'; -/** - * Stroke style for vector features. - */ -export type TypeStrokeSymbolConfig = { - /** Color to use for vector features. */ - color?: string; - /** Line style to use for the feature. */ - lineStyle?: TypeLineStyle; - /** Width to use for the stroke */ - width?: number; -}; - -/** - * Definition of the line symbol vector settings type. - */ -export interface TypeLineStringVectorConfig extends TypeBaseVectorConfig { - /** Type of vector config */ - type: 'lineString'; - /** Line stroke symbology */ - stroke: TypeStrokeSymbolConfig; -} - -/** - * Valid values to specify fill styles. - */ -export type TypeFillStyle = - | 'null' - | 'solid' - | 'backwardDiagonal' - | 'cross' - | 'diagonalCross' - | 'forwardDiagonal' - | 'horizontal' - | 'vertical'; - -/** - * Definition of the line symbol vector settings type. - */ -export interface TypePolygonVectorConfig extends TypeBaseVectorConfig { +/** Definition of the polygon symbol vector settings type. */ +export interface TypePolygonVectorConfig extends TypeBaseVectorGeometryConfig { /** Type of vector config */ type: 'filledPolygon'; /** Fill color for vector features. */ @@ -644,15 +529,19 @@ export interface TypePolygonVectorConfig extends TypeBaseVectorConfig { fillStyle: TypeFillStyle; } -/** - * Valid values to specify symbol shapes. - */ -export type TypeSymbol = 'circle' | '+' | 'diamond' | 'square' | 'triangle' | 'X' | 'star'; +/** Valid values to specify fill styles. */ +export type TypeFillStyle = + | 'null' + | 'solid' + | 'backwardDiagonal' + | 'cross' + | 'diagonalCross' + | 'forwardDiagonal' + | 'horizontal' + | 'vertical'; -/** - * Definition of the circle symbol vector settings type. - */ -export interface TypeSimpleSymbolVectorConfig extends TypeBaseVectorConfig { +/** Definition of the circle symbol vector settings type. */ +export interface TypeSimpleSymbolVectorConfig extends TypeBaseVectorGeometryConfig { /** Type of vector config */ type: 'simpleSymbol'; /** Symbol rotation in radians. */ @@ -669,10 +558,11 @@ export interface TypeSimpleSymbolVectorConfig extends TypeBaseVectorConfig { symbol: TypeSymbol; } -/** - * Definition of the icon symbol vector settings type. - */ -export interface TypeIconSymbolVectorConfig extends TypeBaseVectorConfig { +/** Valid values to specify symbol shapes. */ +export type TypeSymbol = 'circle' | '+' | 'diamond' | 'square' | 'triangle' | 'X' | 'star'; + +/** Definition of the icon symbol vector settings type. */ +export interface TypeIconSymbolVectorConfig extends TypeBaseVectorGeometryConfig { /** Type of vector config */ type: 'iconSymbol'; /** Mime type of the icon. */ @@ -695,190 +585,3 @@ export interface TypeIconSymbolVectorConfig extends TypeBaseVectorConfig { */ crossOrigin?: string; } - -/** - * Base style configuration. - */ -export type TypeBaseStyleType = 'simple' | 'uniqueValue' | 'classBreaks'; - -/** - * Base style configuration. - */ -export type TypeBaseStyleConfig = { - /** Type of style. */ - styleType: TypeBaseStyleType; -}; - -/** - * type guard function that redefines a TypeBaseStyleConfig as a TypeSimpleStyleConfig if the type attribute of the - * verifyIfConfig parameter is 'simple'. The type assertion applies only to the true block of the if clause that use - * this function. - * - * @param {TypeStyleSettings | TypeKindOfVectorSettings} verifyIfConfig Polymorphic object to test in order to determine if - * the type assertion is valid. - * - * @returns {boolean} true if the type assertion is valid. - */ -export const isSimpleStyleConfig = ( - verifyIfConfig: TypeStyleSettings | TypeKindOfVectorSettings -): verifyIfConfig is TypeSimpleStyleConfig => { - return (verifyIfConfig as TypeStyleSettings)?.styleType === 'simple'; -}; - -/** - * Simple style configuration. - */ -export interface TypeSimpleStyleConfig extends TypeBaseStyleConfig { - /** Type of style. */ - styleType: 'simple'; - /** Label associated to the style */ - label: string; - /** options associated to the style. */ - settings: TypeKindOfVectorSettings; -} - -/** - * Unique value style information configuration. - */ -export type TypeUniqueValueStyleInfo = { - /** Label used by the style. */ - label: string; - /** Values associated to the style. */ - values: (string | number | Date)[]; - /** Flag used to show/hide features associated to the label (default: yes). */ - visible?: boolean; - /** options associated to the style. */ - settings: TypeKindOfVectorSettings; -}; - -/** - * type guard function that redefines a TypeStyleSettings | TypeKindOfVectorSettings as a TypeUniqueValueStyleConfig if the - * styleType attribute of the verifyIfConfig parameter is 'uniqueValue'. The type assertion applies only to the true block of the - * if clause that use this function. - * - * @param {TypeStyleSettings | TypeKindOfVectorSettings} verifyIfConfig Polymorphic object to test in order to determine if the - * type assertion is valid. - * - * @returns {boolean} true if the type assertion is valid. - */ -export const isUniqueValueStyleConfig = ( - verifyIfConfig: TypeStyleSettings | TypeKindOfVectorSettings -): verifyIfConfig is TypeUniqueValueStyleConfig => { - return (verifyIfConfig as TypeStyleSettings)?.styleType === 'uniqueValue'; -}; - -/** - * Unique value style configuration. - */ -export interface TypeUniqueValueStyleConfig extends TypeBaseStyleConfig { - /** Type of style. */ - styleType: 'uniqueValue'; - /** Label used if field/value association is not found. */ - defaultLabel?: string; - /** Options used if field/value association is not found. */ - defaultSettings?: TypeKindOfVectorSettings; - /** Flag used to show/hide features associated to the default label - * (default: no if ESRI renderer in the metadata has no default symbol defined). */ - defaultVisible?: boolean; - /** Fields used by the style. */ - fields: string[]; - /** Unique value style information configuration. */ - uniqueValueStyleInfo: TypeUniqueValueStyleInfo[]; -} - -/** - * Class break style information configuration. - */ -export type TypeClassBreakStyleInfo = { - /** Label used by the style. */ - label: string; - /** Minimum values associated to the style. */ - minValue: number | string | Date | undefined | null; - /** Flag used to show/hide features associated to the label (default: yes). */ - visible?: boolean; - /** Maximum values associated to the style. */ - maxValue: number | string | Date; - /** options associated to the style. */ - settings: TypeKindOfVectorSettings; -}; - -/** - * type guard function that redefines a TypeStyleSettings | TypeKindOfVectorSettings as a TypeClassBreakStyleConfig if the - * styleType attribute of the verifyIfConfig parameter is 'classBreaks'. The type assertion applies only to the true block of the - * if clause that use this function. - * - * @param {TypeStyleSettings | TypeKindOfVectorSettings} verifyIfConfig Polymorphic object to test in order to determine if the - * type assertion is valid. - * - * @returns {boolean} true if the type assertion is valid. - */ -export const isClassBreakStyleConfig = ( - verifyIfConfig: TypeStyleSettings | TypeKindOfVectorSettings -): verifyIfConfig is TypeClassBreakStyleConfig => { - return (verifyIfConfig as TypeStyleSettings)?.styleType === 'classBreaks'; -}; - -/** - * Class break style configuration. - */ -export interface TypeClassBreakStyleConfig extends TypeBaseStyleConfig { - /** Type of style. */ - styleType: 'classBreaks'; - /** Label used if field/value association is not found. */ - defaultLabel?: string; - /** Options used if field/value association is not found. */ - defaultVisible?: boolean; - /** Flag used to show/hide features associated to the default label (default: yes). */ - defaultSettings?: TypeKindOfVectorSettings; - /** Field used by the style. */ - field: string; - /** Class break style information configuration. */ - classBreakStyleInfo: TypeClassBreakStyleInfo[]; -} - -export type TypeTemporalDimension = { - field: string; - default: string; - unitSymbol: string; - range: TypeRangeItems; - nearestValues: TypeNearestValues; - singleHandle: boolean; -}; - -export type TypeRangeItems = { - type: string; - range: string[]; -}; - -export type TypeNearestValues = 'discrete' | 'absolute'; - -/** - * Type of Style to apply to the GeoView vector layer source at creation time. - */ -export type TypeStyleSettings = TypeBaseStyleConfig | TypeSimpleStyleConfig | TypeUniqueValueStyleConfig | TypeClassBreakStyleConfig; - -/** - * Valid keys for the TypeStyleConfig object. - */ -export type TypeGeometryType = 'Point' | 'LineString' | 'Polygon'; - -/** - * Type of Style to apply to the GeoView vector layer based on geometry types. - */ -export type TypeStyleConfig = { - type: TypeGeometryType; - fields: string[]; - hasDefault: boolean; - info: TypeStyleConfigInfo; -}; - -/** - * Information needed to render the feature. - */ -export type TypeStyleConfigInfo = { - visible: boolean; - label: string; - values: (string | number)[]; - settings: TypeKindOfVectorSettings; -}; -// #endregion STYLES TYPES diff --git a/packages/geoview-core/src/api/config/types/type-guards.ts b/packages/geoview-core/src/api/config/types/type-guards.ts index cc4edaa9af5..564700a2080 100644 --- a/packages/geoview-core/src/api/config/types/type-guards.ts +++ b/packages/geoview-core/src/api/config/types/type-guards.ts @@ -5,8 +5,15 @@ import { EsriDynamicLayerConfig } from '@config/types/classes/geoview-config/ras import { ConfigBaseClass } from '@config/types/classes/sub-layer-config/config-base-class'; import { GroupLayerEntryConfig } from '@config/types/classes/sub-layer-config/group-layer-entry-config'; import { EsriDynamicLayerEntryConfig } from '@config/types/classes/sub-layer-config/raster-leaf/esri-dynamic-layer-entry-config'; -import { CV_CONST_SUB_LAYER_TYPES, CV_CONST_LAYER_TYPES } from '@config/types/config-constants'; +import { CV_CONST_LAYER_TYPES } from '@config/types/config-constants'; import { TypeJsonObject } from '@config/types/config-types'; +import { + TypeBaseVectorGeometryConfig, + TypeIconSymbolVectorConfig, + TypeLineStringVectorConfig, + TypePolygonVectorConfig, + TypeSimpleSymbolVectorConfig, +} from './map-schema-types'; /** * Type guard function that redefines a ConfigBaseClass as a GroupLayerEntryConfig if the entryType attribute of the verifyIfLayer @@ -18,7 +25,7 @@ import { TypeJsonObject } from '@config/types/config-types'; * @returns {boolean} true if the type assertion is valid. */ export const layerEntryIsGroupLayer = (verifyIfLayer: ConfigBaseClass | TypeJsonObject): verifyIfLayer is GroupLayerEntryConfig => { - return verifyIfLayer?.entryType === CV_CONST_SUB_LAYER_TYPES.GROUP; + return verifyIfLayer?.isLayerGroup as boolean; }; /** @@ -159,3 +166,57 @@ export const geoviewConfigIsEsriDynamic = (verifyIfLayer: AbstractGeoviewLayerCo export const layerConfigIsCSV = (verifyIfLayer: AbstractGeoviewLayerConfig): verifyIfLayer is CsvLayerConfig => { return verifyIfLayer?.geoviewLayerType === CV_CONST_LAYER_TYPES.CSV; }; */ + +/** + * type guard function that redefines a TypeBaseVectorGeometryConfig as a TypeLineStringVectorConfig if the type attribute of the + * verifyIfConfig parameter is 'lineString'. The type assertion applies only to the true block of the if clause that use + * this function. + * + * @param {TypeBaseVectorGeometryConfig} verifyIfConfig Polymorphic object to test in order to determine if the type assertion is valid. + * + * @returns {boolean} true if the type assertion is valid. + */ +export const isLineStringVectorConfig = (verifyIfConfig: TypeBaseVectorGeometryConfig): verifyIfConfig is TypeLineStringVectorConfig => { + return verifyIfConfig?.type === 'lineString'; +}; + +/** + * type guard function that redefines a TypeBaseVectorGeometryConfig as a TypePolygonVectorConfig if the type attribute of the + * verifyIfConfig parameter is 'filledPolygon'. The type assertion applies only to the true block of the if clause that use + * this function. + * + * @param {TypeBaseVectorGeometryConfig} verifyIfConfig Polymorphic object to test in order to determine if the type assertion is valid. + * + * @returns {boolean} true if the type assertion is valid. + */ +export const isFilledPolygonVectorConfig = (verifyIfConfig: TypeBaseVectorGeometryConfig): verifyIfConfig is TypePolygonVectorConfig => { + return verifyIfConfig?.type === 'filledPolygon'; +}; + +/** + * type guard function that redefines a TypeBaseVectorGeometryConfig as a TypeSimpleSymbolVectorConfig if the type attribute of the + * verifyIfConfig parameter is 'simpleSymbol'. The type assertion applies only to the true block of the if clause that use + * this function. + * + * @param {TypeBaseVectorGeometryConfig} verifyIfConfig Polymorphic object to test in order to determine if the type assertion is valid. + * + * @returns {boolean} true if the type assertion is valid. + */ +export const isSimpleSymbolVectorConfig = ( + verifyIfConfig: TypeBaseVectorGeometryConfig +): verifyIfConfig is TypeSimpleSymbolVectorConfig => { + return verifyIfConfig?.type === 'simpleSymbol'; +}; + +/** + * type guard function that redefines a TypeBaseVectorGeometryConfig as a TypeIconSymbolVectorConfig if the type attribute of the + * verifyIfConfig parameter is 'iconSymbol'. The type assertion applies only to the true block of the if clause that use + * this function. + * + * @param {TypeBaseVectorGeometryConfig} verifyIfConfig Polymorphic object to test in order to determine if the type assertion is valid. + * + * @returns {boolean} true if the type assertion is valid. + */ +export const isIconSymbolVectorConfig = (verifyIfConfig: TypeBaseVectorGeometryConfig): verifyIfConfig is TypeIconSymbolVectorConfig => { + return verifyIfConfig?.type === 'iconSymbol'; +}; diff --git a/packages/geoview-core/src/api/config/utils.ts b/packages/geoview-core/src/api/config/utils.ts index b27ebffef15..f141c37e03b 100644 --- a/packages/geoview-core/src/api/config/utils.ts +++ b/packages/geoview-core/src/api/config/utils.ts @@ -2,10 +2,10 @@ import Ajv from 'ajv'; import { CV_CONST_SUB_LAYER_TYPES, CV_CONST_LAYER_TYPES } from '@config/types/config-constants'; import { TypeGeoviewLayerType, TypeJsonObject } from '@config/types/config-types'; -import { TypeLayerEntryType, TypeLocalizedString } from '@config/types/map-schema-types'; import schema from '@config/types/config-validation-schema.json'; import { ConfigBaseClass } from '@config/types/classes/sub-layer-config/config-base-class'; import { MapFeatureConfig } from '@config/types/classes/map-feature-config'; +import { TypeLayerEntryType, TypeLocalizedString } from '@config/types/map-schema-types'; import { logger } from '@/core/utils/logger'; type NewType = TypeGeoviewLayerType; 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 207376a1c20..b8eaa630da2 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 @@ -6,8 +6,8 @@ import View, { FitOptions } from 'ol/View'; import { KeyboardPan } from 'ol/interaction'; import { Coordinate } from 'ol/coordinate'; -import { TypeBasemapOptions, TypeInteraction, TypeValidMapProjectionCodes } from '@config/types/map-schema-types'; import { CV_MAP_EXTENTS } from '@config/types/config-constants'; +import { TypeBasemapOptions, TypeInteraction, TypeValidMapProjectionCodes } from '@config/types/map-schema-types'; import { api } from '@/app'; import { LayerApi } from '@/geo/layer/layer'; import { MapViewer, TypeMapState, TypeMapMouseInfo } from '@/geo/map/map-viewer'; diff --git a/packages/geoview-core/src/api/event-processors/event-processor-children/ui-event-processor.ts b/packages/geoview-core/src/api/event-processors/event-processor-children/ui-event-processor.ts index aee6b0ced71..dfa25c79ae2 100644 --- a/packages/geoview-core/src/api/event-processors/event-processor-children/ui-event-processor.ts +++ b/packages/geoview-core/src/api/event-processors/event-processor-children/ui-event-processor.ts @@ -27,7 +27,7 @@ export class UIEventProcessor extends AbstractEventProcessor { return this.getUIState(mapId).activeFooterBarTabId; } - static getAppBarComponents(mapId: string): TypeValidAppBarCoreProps { + static getAppBarComponents(mapId: string): TypeValidAppBarCoreProps[] { return this.getUIState(mapId).appBarComponents; } diff --git a/packages/geoview-core/src/app.tsx b/packages/geoview-core/src/app.tsx index d30f753e44f..892d21e3ab1 100644 --- a/packages/geoview-core/src/app.tsx +++ b/packages/geoview-core/src/app.tsx @@ -10,6 +10,7 @@ import '@/ui/style/vendor.css'; import '@fontsource/roboto/400.css'; import { MapFeatureConfig } from '@config/types/classes/map-feature-config'; +import { TypeDisplayLanguage } from '@config/types/map-schema-types'; import * as UI from '@/ui'; import AppStart from '@/core/app-start'; @@ -20,7 +21,6 @@ import { useWhatChanged } from '@/core/utils/useWhatChanged'; import { addGeoViewStore } from '@/core/stores/stores-managers'; import { logger } from '@/core/utils/logger'; import { removeCommentsFromJSON } from '@/core/utils/utilities'; -import { TypeDisplayLanguage } from './api/config/types/map-schema-types'; // The next export allow to import the exernal-types from 'geoview-core' from outside of the geoview-core package. export * from './core/types/external-types'; diff --git a/packages/geoview-core/src/core/stores/store-interface-and-intial-values/ui-state.ts b/packages/geoview-core/src/core/stores/store-interface-and-intial-values/ui-state.ts index 054ed34dd6f..c730ef42ffc 100644 --- a/packages/geoview-core/src/core/stores/store-interface-and-intial-values/ui-state.ts +++ b/packages/geoview-core/src/core/stores/store-interface-and-intial-values/ui-state.ts @@ -25,7 +25,7 @@ export interface IUIState { activeFooterBarTabId: string; activeTrapGeoView: boolean; activeAppBarTab: ActiveAppBarTabType; - appBarComponents: TypeValidAppBarCoreProps; + appBarComponents: TypeValidAppBarCoreProps[]; corePackagesComponents: TypeMapCorePackages; focusITem: FocusItemProps; mapInfoExpanded: boolean; @@ -214,7 +214,8 @@ export const useUIActiveFocusItem = (): FocusItemProps => useStore(useGeoViewSto export const useUIActiveFooterBarTabId = (): string => useStore(useGeoViewStore(), (state) => state.uiState.activeFooterBarTabId); export const useActiveAppBarTab = (): ActiveAppBarTabType => useStore(useGeoViewStore(), (state) => state.uiState.activeAppBarTab); export const useUIActiveTrapGeoView = (): boolean => useStore(useGeoViewStore(), (state) => state.uiState.activeTrapGeoView); -export const useUIAppbarComponents = (): TypeValidAppBarCoreProps => useStore(useGeoViewStore(), (state) => state.uiState.appBarComponents); +export const useUIAppbarComponents = (): TypeValidAppBarCoreProps[] => + useStore(useGeoViewStore(), (state) => state.uiState.appBarComponents); export const useUICorePackagesComponents = (): TypeMapCorePackages => useStore(useGeoViewStore(), (state) => state.uiState.corePackagesComponents); export const useUIFooterPanelResizeValue = (): number => useStore(useGeoViewStore(), (state) => state.uiState.footerPanelResizeValue); diff --git a/packages/geoview-core/src/core/utils/config/config-validation.ts b/packages/geoview-core/src/core/utils/config/config-validation.ts index 1ed9871923b..d1512b755ab 100644 --- a/packages/geoview-core/src/core/utils/config/config-validation.ts +++ b/packages/geoview-core/src/core/utils/config/config-validation.ts @@ -7,7 +7,7 @@ import { AnyValidateFunction } from 'ajv/dist/types'; import defaultsDeep from 'lodash/defaultsDeep'; -import { TypeDisplayLanguage, TypeLocalizedString, TypeListOfLocalizedLanguages } from '@config/types/map-schema-types'; +import { TypeDisplayLanguage, TypeLocalizedString } from '@config/types/map-schema-types'; // import { layerEntryIsGroupLayer } from '@config/types/type-guards'; import { geoviewEntryIsWMS } from '@/geo/layer/geoview-layers/raster/wms'; @@ -378,7 +378,7 @@ export class ConfigValidation { * to the supported languages array content. * @private */ - static #processLocalizedString(suportedLanguages: TypeListOfLocalizedLanguages, listOfMapConfigLayerEntry?: MapConfigLayerEntry[]): void { + static #processLocalizedString(suportedLanguages: TypeDisplayLanguage[], listOfMapConfigLayerEntry?: MapConfigLayerEntry[]): void { if (suportedLanguages.includes('en') && suportedLanguages.includes('fr') && listOfMapConfigLayerEntry) { const validateLocalizedString = (config: TypeJsonObject): void => { if (typeof config === 'object') { diff --git a/packages/geoview-core/src/core/utils/date-mgt.ts b/packages/geoview-core/src/core/utils/date-mgt.ts index 16031d6b934..9503e8d7783 100644 --- a/packages/geoview-core/src/core/utils/date-mgt.ts +++ b/packages/geoview-core/src/core/utils/date-mgt.ts @@ -5,7 +5,7 @@ import localizedFormat from 'dayjs/plugin/localizedFormat'; import 'dayjs/locale/en-ca'; import 'dayjs/locale/fr-ca'; -import { TypeLocalizedLanguages } from '@config/types/map-schema-types'; +import { TypeDisplayLanguage } from '@config/types/map-schema-types'; import { TypeJsonObject } from '@/core/types/global-types'; dayjs.extend(duration); @@ -377,7 +377,7 @@ export abstract class DateMgt { * @param locale {string} locale to use (fr-CA or en-CA) * @returns {string} locale tooltip */ - static createDateLocaleTooltip(date: string, locale: TypeLocalizedLanguages): string { + static createDateLocaleTooltip(date: string, locale: TypeDisplayLanguage): string { // Handle locale for date label const tooltips = dayjs(date) .locale(`${locale}-CA`) diff --git a/packages/geoview-core/src/geo/layer/geoview-layers/raster/vector-tiles.ts b/packages/geoview-core/src/geo/layer/geoview-layers/raster/vector-tiles.ts index 5c8ef489a0f..7637fadd220 100644 --- a/packages/geoview-core/src/geo/layer/geoview-layers/raster/vector-tiles.ts +++ b/packages/geoview-core/src/geo/layer/geoview-layers/raster/vector-tiles.ts @@ -9,11 +9,11 @@ import { Extent } from 'ol/extent'; import olms, { applyStyle } from 'ol-mapbox-style'; -import { TypeLocalizedString } from '@config/types/map-schema-types'; // import { layerEntryIsGroupLayer } from '@config/types/type-guards'; import Feature from 'ol/Feature'; import { MVT } from 'ol/format'; +import { TypeLocalizedString } from '@config/types/map-schema-types'; import { AbstractGeoViewLayer, CONST_LAYER_TYPES } from '@/geo/layer/geoview-layers/abstract-geoview-layers'; import { AbstractGeoViewRaster, TypeBaseRasterLayer } from '@/geo/layer/geoview-layers/raster/abstract-geoview-raster'; import { diff --git a/packages/geoview-core/src/geo/layer/geoview-layers/vector/csv.ts b/packages/geoview-core/src/geo/layer/geoview-layers/vector/csv.ts index 972060e4a76..7ead400d42c 100644 --- a/packages/geoview-core/src/geo/layer/geoview-layers/vector/csv.ts +++ b/packages/geoview-core/src/geo/layer/geoview-layers/vector/csv.ts @@ -11,6 +11,7 @@ import { ProjectionLike } from 'ol/proj'; // import { layerEntryIsGroupLayer } from '@config/types/type-guards'; +import { Cast, TypeJsonObject } from '@config/types/config-types'; import { AbstractGeoViewLayer, CONST_LAYER_TYPES } from '@/geo/layer/geoview-layers/abstract-geoview-layers'; import { AbstractGeoViewVector } from '@/geo/layer/geoview-layers/vector/abstract-geoview-vector'; import { Projection } from '@/geo/utils/projection'; @@ -29,7 +30,6 @@ import { CsvLayerEntryConfig } from '@/core/utils/config/validation-classes/vect import { VectorLayerEntryConfig } from '@/core/utils/config/validation-classes/vector-layer-entry-config'; import { AbstractBaseLayerEntryConfig } from '@/core/utils/config/validation-classes/abstract-base-layer-entry-config'; import { AppEventProcessor } from '@/api/event-processors/event-processor-children/app-event-processor'; -import { Cast, TypeJsonObject } from '@/api/config/types/config-types'; // GV: CONFIG EXTRACTION // GV: This section of code was extracted and copied to the geoview config section diff --git a/packages/geoview-core/src/geo/map/map-viewer.ts b/packages/geoview-core/src/geo/map/map-viewer.ts index 85436a72690..e75c27bab3a 100644 --- a/packages/geoview-core/src/geo/map/map-viewer.ts +++ b/packages/geoview-core/src/geo/map/map-viewer.ts @@ -15,16 +15,13 @@ import Collection from 'ol/Collection'; import { Source } from 'ol/source'; import queryString from 'query-string'; -import { CV_MAP_EXTENTS } from '@config/types/config-constants'; +import { CV_MAP_EXTENTS, VALID_DISPLAY_LANGUAGE, VALID_DISPLAY_THEME, VALID_PROJECTION_CODES } from '@config/types/config-constants'; import { TypeViewSettings, TypeInteraction, TypeValidMapProjectionCodes, TypeDisplayLanguage, - VALID_DISPLAY_LANGUAGE, TypeDisplayTheme, - VALID_DISPLAY_THEME, - VALID_PROJECTION_CODES, } from '@config/types/map-schema-types'; import { removeGeoviewStore } from '@/core/stores/stores-managers';