From 5abbe6180b52bba0479cd81cd2172701876a86f8 Mon Sep 17 00:00:00 2001 From: Maxime Lamer Date: Wed, 3 Jan 2024 14:30:29 -0500 Subject: [PATCH 1/3] added config for linked layers --- .../layer/shared/layers/layer.interface.ts | 1 + .../mini-basemap.component.ts | 30 +++++++++---------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/packages/geo/src/lib/layer/shared/layers/layer.interface.ts b/packages/geo/src/lib/layer/shared/layers/layer.interface.ts index 11b48831a6..45255570a8 100644 --- a/packages/geo/src/lib/layer/shared/layers/layer.interface.ts +++ b/packages/geo/src/lib/layer/shared/layers/layer.interface.ts @@ -63,6 +63,7 @@ export interface GeoWorkspaceQueryOptions { export interface LayersLink { linkId: string; + showInMiniBaseMap?: boolean; links?: LayersLinkProperties[]; } export interface LayersLinkProperties { diff --git a/packages/geo/src/lib/map/baselayers-switcher/mini-basemap.component.ts b/packages/geo/src/lib/map/baselayers-switcher/mini-basemap.component.ts index 4645eb671b..fd66a198f1 100644 --- a/packages/geo/src/lib/map/baselayers-switcher/mini-basemap.component.ts +++ b/packages/geo/src/lib/map/baselayers-switcher/mini-basemap.component.ts @@ -10,7 +10,7 @@ import { import OlMap from 'ol/Map'; import OlView from 'ol/View'; -import { Layer, LayerOptions } from '../../layer/shared'; +import { Layer, LayerOptions, LayersLink, LayersLinkProperties } from '../../layer/shared'; import { LayerService } from '../../layer/shared/layer.service'; import { IgoMap } from '../shared/map'; @@ -112,31 +112,29 @@ export class MiniBaseMapComponent implements AfterViewInit, OnDestroy { this.handleLinkedBaseLayer(layer); } - private handleLinkedBaseLayer(baselayer: Layer) { - const linkedLayers = baselayer.options.linkedLayers; + private handleLinkedBaseLayer(baselayer: Layer): void { + const linkedLayers: LayersLink = baselayer.options.linkedLayers; if (!linkedLayers) { return; } - const currentLinkedId = linkedLayers.linkId; - const currentLinks = linkedLayers.links; - const isParentLayer = currentLinks ? true : false; - if ( - isParentLayer && - currentLinkedId === baselayer.options.linkedLayers.linkId - ) { + const links: LayersLinkProperties[] = linkedLayers.links; + const isParentLayer: boolean = links ? true : false; + if (isParentLayer) { // search for child layers - currentLinks.map((link) => { - link.linkedIds.map((linkedId) => { - const layerToApply = this.map.layers.find( - (l) => l.options.linkedLayers?.linkId === linkedId + links.map((link: LayersLinkProperties) => { + link.linkedIds.map((linkedId: string) => { + const layerToApply: Layer = this.map.layers.find( + (layer: Layer) => layer.options.linkedLayers?.linkId === linkedId ); if (layerToApply) { - const linkedLayerOptions: any = Object.assign( + const linkedLayerOptions: LayerOptions = Object.assign( Object.create(layerToApply.options), layerToApply.options, { zIndex: 9000, - visible: true, + visible: layerToApply.options.linkedLayers?.showInMiniBaseMap !== undefined + ? layerToApply.options.linkedLayers.showInMiniBaseMap + : true, baseLayer: false } as LayerOptions ); From bde90568b0a5832a95a4aac1a1d6972919ef4fd3 Mon Sep 17 00:00:00 2001 From: Maxime Lamer Date: Mon, 15 Jan 2024 10:08:49 -0500 Subject: [PATCH 2/3] adjustments after comments --- .../src/lib/layer/shared/layers/layer.interface.ts | 2 +- .../baselayers-switcher/mini-basemap.component.ts | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/geo/src/lib/layer/shared/layers/layer.interface.ts b/packages/geo/src/lib/layer/shared/layers/layer.interface.ts index 45255570a8..165a14c752 100644 --- a/packages/geo/src/lib/layer/shared/layers/layer.interface.ts +++ b/packages/geo/src/lib/layer/shared/layers/layer.interface.ts @@ -63,7 +63,7 @@ export interface GeoWorkspaceQueryOptions { export interface LayersLink { linkId: string; - showInMiniBaseMap?: boolean; + showInMiniBaseMap?: boolean; // default value is true links?: LayersLinkProperties[]; } export interface LayersLinkProperties { diff --git a/packages/geo/src/lib/map/baselayers-switcher/mini-basemap.component.ts b/packages/geo/src/lib/map/baselayers-switcher/mini-basemap.component.ts index fd66a198f1..33361d6472 100644 --- a/packages/geo/src/lib/map/baselayers-switcher/mini-basemap.component.ts +++ b/packages/geo/src/lib/map/baselayers-switcher/mini-basemap.component.ts @@ -10,7 +10,12 @@ import { import OlMap from 'ol/Map'; import OlView from 'ol/View'; -import { Layer, LayerOptions, LayersLink, LayersLinkProperties } from '../../layer/shared'; +import { + Layer, + LayerOptions, + LayersLink, + LayersLinkProperties +} from '../../layer/shared'; import { LayerService } from '../../layer/shared/layer.service'; import { IgoMap } from '../shared/map'; @@ -132,9 +137,8 @@ export class MiniBaseMapComponent implements AfterViewInit, OnDestroy { layerToApply.options, { zIndex: 9000, - visible: layerToApply.options.linkedLayers?.showInMiniBaseMap !== undefined - ? layerToApply.options.linkedLayers.showInMiniBaseMap - : true, + visible: + layerToApply.options.linkedLayers?.showInMiniBaseMap ?? true, baseLayer: false } as LayerOptions ); From 5f7d03eac2609fd0aeebed3d6f4d9cf2c61123e9 Mon Sep 17 00:00:00 2001 From: Maxime Lamer Date: Thu, 18 Jan 2024 08:59:19 -0500 Subject: [PATCH 3/3] changed comment type --- packages/geo/src/lib/layer/shared/layers/layer.interface.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/geo/src/lib/layer/shared/layers/layer.interface.ts b/packages/geo/src/lib/layer/shared/layers/layer.interface.ts index 165a14c752..cfd45dd50b 100644 --- a/packages/geo/src/lib/layer/shared/layers/layer.interface.ts +++ b/packages/geo/src/lib/layer/shared/layers/layer.interface.ts @@ -63,7 +63,8 @@ export interface GeoWorkspaceQueryOptions { export interface LayersLink { linkId: string; - showInMiniBaseMap?: boolean; // default value is true + /** Default value is true */ + showInMiniBaseMap?: boolean; links?: LayersLinkProperties[]; } export interface LayersLinkProperties {