Skip to content

Commit

Permalink
Start
Browse files Browse the repository at this point in the history
Progress
Regrouped the obsolete functions
  • Loading branch information
Alex-NRCan committed May 9, 2024
1 parent 34e063e commit 686b44f
Show file tree
Hide file tree
Showing 23 changed files with 770 additions and 711 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,9 @@ export class LegendEventProcessor extends AbstractEventProcessor {

const myLayer = MapEventProcessor.getMapViewerLayerAPI(mapId).geoviewLayers[layerPathNodes[0]];
// TODO: calculateBounds issue will be tackle ASAP in a next PR
newLegendLayer.bounds = myLayer.allLayerStatusAreGreaterThanOrEqualTo('loaded') ? myLayer.calculateBounds(layerPath) : undefined;
newLegendLayer.bounds = myLayer.obsoleteConfigAllLayerStatusAreGreaterThanOrEqualTo('loaded')
? myLayer.calculateBounds(layerPath)
: undefined;
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export function AddNewLayer(): JSX.Element {
// Synchronize the geoviewLayerId.
wmsGeoviewLayerConfig.geoviewLayerId = wmsGeoviewLayerInstance.geoviewLayerId;
setGeoviewLayerInstance(wmsGeoviewLayerInstance);
await wmsGeoviewLayerInstance.createGeoViewLayers();
await wmsGeoviewLayerInstance.obsoleteConfigAndLayerCreateGeoViewLayers();
if (!wmsGeoviewLayerInstance.metadata) throw new Error('Cannot get metadata');
setHasMetadata(true);
const wmsMetadata = wmsGeoviewLayerInstance.metadata;
Expand Down Expand Up @@ -320,7 +320,7 @@ export function AddNewLayer(): JSX.Element {
// Synchronize the geoviewLayerId.
wfsGeoviewLayerConfig.geoviewLayerId = wfsGeoviewLayerInstance.geoviewLayerId;
setGeoviewLayerInstance(wfsGeoviewLayerInstance);
await wfsGeoviewLayerInstance.createGeoViewLayers();
await wfsGeoviewLayerInstance.obsoleteConfigAndLayerCreateGeoViewLayers();
if (!wfsGeoviewLayerInstance.metadata) throw new Error('Cannot get metadata');
setHasMetadata(true);
const wfsMetadata = wfsGeoviewLayerInstance.metadata;
Expand Down Expand Up @@ -363,7 +363,7 @@ export function AddNewLayer(): JSX.Element {
// Synchronize the geoviewLayerId.
ogcFeatureGeoviewLayerConfig.geoviewLayerId = ogcFeatureInstance.geoviewLayerId;
setGeoviewLayerInstance(ogcFeatureInstance);
await ogcFeatureInstance.createGeoViewLayers();
await ogcFeatureInstance.obsoleteConfigAndLayerCreateGeoViewLayers();
const ogcFeatureMetadata = ogcFeatureInstance.metadata!;
if (!ogcFeatureInstance.metadata) throw new Error('Cannot get metadata');
setHasMetadata(true);
Expand Down Expand Up @@ -469,7 +469,7 @@ export function AddNewLayer(): JSX.Element {
// Synchronize the geoviewLayerId.
esriGeoviewLayerConfig.geoviewLayerId = esriGeoviewLayerInstance.geoviewLayerId;
setGeoviewLayerInstance(esriGeoviewLayerInstance);
await esriGeoviewLayerInstance.createGeoViewLayers();
await esriGeoviewLayerInstance.obsoleteConfigAndLayerCreateGeoViewLayers();
const esriMetadata = esriGeoviewLayerInstance.metadata!;
if (!esriMetadata) throw new Error('Cannot get metadata');
setHasMetadata(true);
Expand Down Expand Up @@ -539,7 +539,7 @@ export function AddNewLayer(): JSX.Element {
// Synchronize the geoviewLayerId.
esriImageGeoviewLayerConfig.geoviewLayerId = esriImageGeoviewLayerInstance.geoviewLayerId;
setGeoviewLayerInstance(esriImageGeoviewLayerInstance);
await esriImageGeoviewLayerInstance.createGeoViewLayers();
await esriImageGeoviewLayerInstance.obsoleteConfigAndLayerCreateGeoViewLayers();
const layers = [
new EsriImageLayerEntryConfig({
geoviewLayerConfig: esriImageGeoviewLayerConfig,
Expand Down Expand Up @@ -583,7 +583,7 @@ export function AddNewLayer(): JSX.Element {
// Synchronize the geoviewLayerId.
xyzGeoviewLayerConfig.geoviewLayerId = xyzGeoviewLayerInstance.geoviewLayerId;
setGeoviewLayerInstance(xyzGeoviewLayerInstance);
await xyzGeoviewLayerInstance.createGeoViewLayers();
await xyzGeoviewLayerInstance.obsoleteConfigAndLayerCreateGeoViewLayers();
setHasMetadata(false);
const layers = [
new XYZTilesLayerEntryConfig({
Expand Down Expand Up @@ -621,7 +621,7 @@ export function AddNewLayer(): JSX.Element {
// Synchronize the geoviewLayerId.
csvGeoviewLayerConfig.geoviewLayerId = csvGeoviewLayerInstance.geoviewLayerId;
setGeoviewLayerInstance(csvGeoviewLayerInstance);
await csvGeoviewLayerInstance.createGeoViewLayers();
await csvGeoviewLayerInstance.obsoleteConfigAndLayerCreateGeoViewLayers();
const layers = [
new CsvLayerEntryConfig({
geoviewLayerConfig: csvGeoviewLayerConfig,
Expand Down Expand Up @@ -662,7 +662,7 @@ export function AddNewLayer(): JSX.Element {
// Synchronize the geoviewLayerId.
geojsonGeoviewLayerConfig.geoviewLayerId = geojsonGeoviewLayerInstance.geoviewLayerId;
setGeoviewLayerInstance(geojsonGeoviewLayerInstance);
await geojsonGeoviewLayerInstance.createGeoViewLayers();
await geojsonGeoviewLayerInstance.obsoleteConfigAndLayerCreateGeoViewLayers();
setHasMetadata(true);
if (!geojsonGeoviewLayerInstance.metadata) throw new Error('Cannot get metadata');
const geojsonFeatureMetadata = geojsonGeoviewLayerInstance.metadata!;
Expand All @@ -687,7 +687,7 @@ export function AddNewLayer(): JSX.Element {
// Synchronize the geoviewLayerId.
geojsonGeoviewLayerConfig.geoviewLayerId = geojsonGeoviewLayerInstance.geoviewLayerId;
setGeoviewLayerInstance(geojsonGeoviewLayerInstance);
await geojsonGeoviewLayerInstance.createGeoViewLayers();
await geojsonGeoviewLayerInstance.obsoleteConfigAndLayerCreateGeoViewLayers();
const layers = [
new GeoJSONLayerEntryConfig({
geoviewLayerConfig: geojsonGeoviewLayerConfig,
Expand Down Expand Up @@ -849,9 +849,9 @@ export function AddNewLayer(): JSX.Element {
};

const doneAddedShowMessage = (layerBeingAdded: AbstractGeoViewLayer): void => {
if (layerBeingAdded.allLayerStatusAreGreaterThanOrEqualTo('error'))
if (layerBeingAdded.obsoleteConfigAllLayerStatusAreGreaterThanOrEqualTo('error'))
api.maps[mapId].notifications.showMessage('layers.layerAddedWithError', [layerName]);
else if (layerBeingAdded?.allLayerStatusAreGreaterThanOrEqualTo('loaded'))
else if (layerBeingAdded?.obsoleteConfigAllLayerStatusAreGreaterThanOrEqualTo('loaded'))
api.maps[mapId].notifications.showMessage('layers.layerAdded', [layerName]);
else api.maps[mapId].notifications.showMessage('layers.layerAddedAndLoading', [layerName]);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ export class ConfigBaseClass {
// eslint-disable-next-line no-underscore-dangle
this._layerStatus === 'loaded' &&
this.parentLayerConfig &&
this.geoviewLayerInstance!.allLayerStatusAreGreaterThanOrEqualTo('loaded', [this.parentLayerConfig as GroupLayerEntryConfig])
this.geoviewLayerInstance!.obsoleteConfigAllLayerStatusAreGreaterThanOrEqualTo('loaded', [
this.parentLayerConfig as GroupLayerEntryConfig,
])
)
(this.parentLayerConfig as GroupLayerEntryConfig).layerStatus = 'loaded';
}
Expand All @@ -183,9 +185,6 @@ export class ConfigBaseClass {
* @param {LayerStatusChangedEvent} event The event to emit
* @private
*/
// TODO: refactor - if this emit is privare with #, abstract-base-layer-entry-config.ts:28 Uncaught (in promise) TypeError: Private element is not present on this object
// TD.CONT: this by pass the error, I need to set this public. The problem come from the groupLayer object trying to emit this event but
// TD.CONT: the event is not define so this.onLayerStatus.... failed
#emitLayerStatusChanged(event: LayerStatusChangedEvent): void {
// Emit the event for all handlers
EventHelper.emitEvent(this, this.#onLayerStatusChangedHandlers, event);
Expand Down Expand Up @@ -222,7 +221,7 @@ export class ConfigBaseClass {
// TODO: Check - Move this registerToLayerSets closer to the others, when I comment the line it seems good, except
// TO.DOCONT: for an 'Anonymous' group layer that never got 'loaded'. See if we can fix this elsewhere and remove this.
if (this.entryType !== CONST_LAYER_ENTRY_TYPES.GROUP)
(this.geoviewLayerInstance as AbstractGeoViewLayer).registerToLayerSets(Cast<AbstractBaseLayerEntryConfig>(this));
(this.geoviewLayerInstance as AbstractGeoViewLayer).obsoleteLayerAPIRegisterToLayerSets(Cast<AbstractBaseLayerEntryConfig>(this));

this.layerStatus = 'registered';
return true;
Expand Down
Loading

0 comments on commit 686b44f

Please sign in to comment.