From 5c549c58519d4aa3f60c5ebfea5836b501a1eb1e Mon Sep 17 00:00:00 2001 From: Willem Dantuma Date: Tue, 27 Jul 2021 08:51:56 +0200 Subject: [PATCH] Use route parameters here also --- .../common-map/src/fm-map/effects/map.effects.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/projects/common-map/src/fm-map/effects/map.effects.ts b/projects/common-map/src/fm-map/effects/map.effects.ts index edf501e..abf6ba0 100644 --- a/projects/common-map/src/fm-map/effects/map.effects.ts +++ b/projects/common-map/src/fm-map/effects/map.effects.ts @@ -1,4 +1,5 @@ import { Injectable } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; import { Store, Action } from '@ngrx/store'; import { Effect, Actions,ofType } from '@ngrx/effects'; @@ -34,6 +35,8 @@ import { TemporalItemLayer } from '../models/item.layer' export class MapEffects { private _geojsonFormat: GeoJSON; private _wktFormat: WKT; + public _overrideSelectedItemLayer: boolean = false; + public _overrideOverlayLayers: boolean = false; private toPointFeature(updateEvent:commonActions.DeviceUpdateEvent): Feature { var f = this._wktFormat.readFeature(updateEvent.attributes["geometry"],{ @@ -138,7 +141,7 @@ export class MapEffects { let actions =[]; actions.push(new commonActions.SetMenuVisible(false)); let extent = createEmpty(); - if (!action.query.bboxFilter) { + if (!action.query.bboxFilter && !this._overrideSelectedItemLayer) { if (extent) { for (let f of action.features) { extend(extent, (f as Feature).getGeometry().getExtent()); @@ -386,8 +389,13 @@ export class MapEffects { } })); - constructor(private actions$: Actions, private store$: Store, private folderService$: FolderService, private itemService$: ItemService,private featureIconService$:FeatureIconService,private itemTypeService$:ItemTypeService) { + constructor(private actions$: Actions, private store$: Store, private folderService$: FolderService, private itemService$: ItemService,private featureIconService$:FeatureIconService,private itemTypeService$:ItemTypeService, private route: ActivatedRoute) { this._geojsonFormat = new GeoJSON(); this._wktFormat = new WKT(); - } + if(route && route.snapshot && route.snapshot.data && route.snapshot.data["fm-map-map"]) { + let params = route.snapshot.data["fm-map-map"]; + this._overrideSelectedItemLayer = params["overrideSelectedItemlayer"] ? params["overrideSelectedItemlayer"] : false; + this._overrideOverlayLayers = params["overrideOverlayLayers"] ? params["overrideOverlayLayers"] : false; + } + } }