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..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,6 +63,8 @@ export interface GeoWorkspaceQueryOptions { export interface LayersLink { linkId: string; + /** Default value is true */ + 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..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 } 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 +117,28 @@ 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 ?? true, baseLayer: false } as LayerOptions );