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 10, 2025
1 parent 7606951 commit 8bb3ffb
Show file tree
Hide file tree
Showing 15 changed files with 148 additions and 79 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 @@ -243,7 +243,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 @@ -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,7 +142,8 @@ 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
MapEventProcessor.getMapViewerLayerAPI(layer.mapId).setLayerEntryConfigObsolete(groupLayerConfig);
// TODO: Officially remove setLayerEntryConfigObsolete once passed testing
// MapEventProcessor.getMapViewerLayerAPI(layer.mapId).setLayerEntryConfigObsolete(groupLayerConfig);

(layer.metadata!.layers[esriIndex].subLayerIds as TypeJsonArray).forEach((layerId) => {
// Make sure to copy the layerConfig source before recycling it in the constructors. This was causing the 'source' value to leak between layer entry configs
Expand All @@ -164,7 +165,8 @@ 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)
MapEventProcessor.getMapViewerLayerAPI(layer.mapId).setLayerEntryConfigObsolete(subLayerEntryConfig);
// TODO: Officially remove setLayerEntryConfigObsolete once passed testing
// MapEventProcessor.getMapViewerLayerAPI(layer.mapId).setLayerEntryConfigObsolete(subLayerEntryConfig);
});

layer.validateListOfLayerEntryConfig(newListOfLayerEntryConfig);
Expand Down
Loading

0 comments on commit 8bb3ffb

Please sign in to comment.