Skip to content

Commit

Permalink
- Fixed a bug with 'Private property not on object' which was causing…
Browse files Browse the repository at this point in the history
… many issues including one when removing a layer such as (9d96e8c9-22fe-4ad2-b5e8-94a6991b744b), fixing issue #2643.

- Fixed an issue where, when removing layers, the layer configs would be removed from layer registration, but not the actual layer objects
- Added support for EPSG:42101 projection, fixing issue #2645
- Fixed an issue where geocore would respond with a metadata url for a WMS already including 'GetCapabilities' wording.. Now curating that url better, fixing issue #2605.
- Fixed an issue where a WMS layer would show 1 feature (invalid feature) even when the response was empty (no feature)
  • Loading branch information
Alex-NRCan committed Jan 16, 2025
1 parent 61b9e6a commit f0a75a0
Show file tree
Hide file tree
Showing 16 changed files with 168 additions and 71 deletions.
44 changes: 22 additions & 22 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ <h3>Events that will generate notifications:</h3>
const LYR_PATH_FEATURE = "esriFeatureLYR5/0";
const LYR_PATH_GEOCORE = "f4c51eaa-a6ca-48b9-a1fc-b0651da20509";

var CNT_GENERIC_STATUS_CHANGE = 0;
var CNT_SPECIFIC_STATUS_CHANGE = 0;

// Register a handler when the map is init
cgpv.onMapInit((mapId) => {
// !!
Expand Down Expand Up @@ -269,7 +272,7 @@ <h3>Events that will generate notifications:</h3>
// listen to ANY/ALL layer status at ANY time (generic event catcher)
cgpv.api.maps[mapId].layer.legendsLayerSet.onLayerStatusUpdated((sender, payload) => {
//cgpv.api.maps.Map1.notifications.addNotificationSuccess(`${payload.layer.layerPath} (generic event) status changed to ${payload.layer.layerStatus}`);
console.log(`${payload.layer.layerPath} (generic event) status changed to ${payload.layer.layerStatus}`);
console.log(`${payload.layer.layerPath} (generic event ${++CNT_GENERIC_STATUS_CHANGE}) status changed to ${payload.layer.layerStatus}`);
});

// listen to layer item visibility changed event (any layers)
Expand Down Expand Up @@ -298,9 +301,10 @@ <h3>Events that will generate notifications:</h3>
// Check the layer status of the particular layer before registering the hook - to really know at which status the layer is.
// GV If you really want to make sure to track ALL status changes for ANY particular layer, you can use a hook such as:
// `cgpv.api.maps[mapId].layer.legendsLayerSet.onLayerStatusUpdated()`. See example in cgpv.onMapInit handler above.

cgpv.api.maps.Map1.layer.getLayerEntryConfig(LYR_PATH_UNIQUE)?.onLayerStatusChanged((sender, payload) => {
cgpv.api.maps.Map1.notifications.addNotificationSuccess(`${LYR_PATH_UNIQUE} (specific event) status changed to ${payload.layerStatus}`);
console.log(`${LYR_PATH_UNIQUE} (specific event) status changed to ${payload.layerStatus}`);
console.log(`${LYR_PATH_UNIQUE} (specific event ${++CNT_SPECIFIC_STATUS_CHANGE}) status changed to ${payload.layerStatus}`);
});

// listen to individual layer loaded event
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ <h4 id="HMap1">OSDP Integration</h4>

/** OSDP function
* Adds layers to the map.
*
*
* @param layers Array of layers.
*/
function addLayers(layers) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { EsriImageLayerEntryConfig } from '@/core/utils/config/validation-classe
import { OgcWmsLayerEntryConfig } from '@/core/utils/config/validation-classes/raster-validation-classes/ogc-wms-layer-entry-config';
import { GeoPackage, TypeGeoPackageLayerConfig } from '@/geo/layer/geoview-layers/vector/geopackage';
import { GeoCore } from '@/geo/layer/other/geocore';
import { GeoViewLayerAddedResult } from '@/geo/layer/layer';
import { GeoViewLayerAddedResult, LayerApi } from '@/geo/layer/layer';
import {
CONST_LAYER_TYPES,
TypeGeoviewLayerTypeWithGeoCore,
Expand Down Expand Up @@ -216,7 +216,7 @@ export function AddNewLayer(): JSX.Element {
listOfLayerEntryConfig: [] as OgcWmsLayerEntryConfig[],
metadataAccessPath: accessPath,
} as TypeWMSLayerConfig;
const wmsGeoviewLayerInstance = new WmsGeoviewClass(mapId, wmsGeoviewLayerConfig);
const wmsGeoviewLayerInstance = new WmsGeoviewClass(mapId, wmsGeoviewLayerConfig, LayerApi.DEBUG_WMS_LAYER_GROUP_FULL_SUB_LAYERS);
// Synchronize the geoviewLayerId.
wmsGeoviewLayerConfig.geoviewLayerId = wmsGeoviewLayerInstance.geoviewLayerId;
setGeoviewLayerInstance(wmsGeoviewLayerInstance);
Expand Down Expand Up @@ -248,7 +248,7 @@ export function AddNewLayer(): JSX.Element {
geoviewLayerConfig: wmsGeoviewLayerConfig,
layerId: childLayer.Name as string,
layerName: childLayer.Title as string,
} as OgcWmsLayerEntryConfig)
} as unknown as OgcWmsLayerEntryConfig)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ export abstract class ConfigBaseClass {
}
if (newLayerStatus === 'processed' && this.#waitForProcessedBeforeSendingLoaded) this.layerStatus = 'loaded';

// GV For quick debug, uncomment the line
// if (newLayerStatus === 'error') debugger;

// TODO: Cleanup - Commenting this and leaving it here for now.. It turns out that the parentLayerConfig property can't be trusted
// GV due to a bug with different instances of entryconfigs stored in the objects and depending how you navigate the objects, you get
// GV different instances. Example below (where 'parentLayerConfig.listOfLayerEntryConfig[0]' is indeed going back to 'uniqueValueId/uniqueValueId/4')
Expand Down Expand Up @@ -222,6 +225,28 @@ export abstract class ConfigBaseClass {
} as unknown as TypeJsonObject;
}

/**
* Clones the configuration class.
*
* @returns {ConfigBaseClass} The cloned ConfigBaseClass object.
*/
clone(): ConfigBaseClass {
// Redirect to clone the object and return it
return this.onClone();
}

/**
* Overridable function to clone a child of a ConfigBaseClass.
*
* @returns {ConfigBaseClass} The cloned child object of a ConfigBaseClass.
*/
protected onClone(): ConfigBaseClass {
// Crash on purpose.
// GV Make sure to implement a 'protected override onClone(): ConfigBaseClass' in the child-class to
// GV use this cloning feature. See OgcWMSLayerEntryConfig for example.
throw new Error(`Not implemented exception onClone on layer path ${this.layerPath}`);
}

/**
* Recursively checks the list of layer entries to see if all of them are greater than or equal to the provided layer status.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { CONST_LAYER_TYPES } from '@/geo/layer/geoview-layers/abstract-geoview-layers';
import { CONST_LAYER_ENTRY_TYPES, TypeSourceImageWmsInitialConfig } from '@/geo/map/map-schema-types';
import { ConfigBaseClass } from '@/core/utils/config/validation-classes/config-base-class';
import { AbstractBaseLayerEntryConfig } from '@/core/utils/config/validation-classes/abstract-base-layer-entry-config';

/** ******************************************************************************************************************************
Expand Down Expand Up @@ -40,4 +41,13 @@ export class OgcWmsLayerEntryConfig extends AbstractBaseLayerEntryConfig {
// Default value for layerConfig.source.serverType is 'mapserver'.
if (!this.source.serverType) this.source.serverType = 'mapserver';
}

/**
* Clones an instance of a OgcWmsLayerEntryConfig.
*
* @returns {ConfigBaseClass} The cloned OgcWmsLayerEntryConfig instance
*/
protected override onClone(): ConfigBaseClass {
return new OgcWmsLayerEntryConfig(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ export function commonValidateListOfLayerEntryConfig(

// TODO: Refactor: Do not do this on the fly here anymore with the new configs (quite unpredictable)...
// Don't forget to replace the old version in the registered layers
// TODO: TEST GROUP LAYER TEST Officially remove setLayerEntryConfigObsolete once passed testing
MapEventProcessor.getMapViewerLayerAPI(layer.mapId).setLayerEntryConfigObsolete(groupLayerConfig);

(layer.metadata!.layers[esriIndex].subLayerIds as TypeJsonArray).forEach((layerId) => {
Expand All @@ -164,6 +165,7 @@ export function commonValidateListOfLayerEntryConfig(

// FIXME: Temporary patch to keep the behavior until those layer classes don't exist
// TODO: Refactor: Do not do this on the fly here anymore with the new configs (quite unpredictable)... (standardizing this call with the other one above for now)
// TODO: TEST GROUP LAYER TEST Officially remove setLayerEntryConfigObsolete once passed testing
MapEventProcessor.getMapViewerLayerAPI(layer.mapId).setLayerEntryConfigObsolete(subLayerEntryConfig);
});

Expand Down
Loading

0 comments on commit f0a75a0

Please sign in to comment.