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 75ebba4..c635a83 100644 --- a/projects/common-map/src/fm-map/effects/map.effects.ts +++ b/projects/common-map/src/fm-map/effects/map.effects.ts @@ -35,8 +35,6 @@ 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"],{ @@ -141,7 +139,7 @@ export class MapEffects { let actions =[]; actions.push(new commonActions.SetMenuVisible(false)); let extent = createEmpty(); - if (!action.query.bboxFilter && !this._overrideSelectedItemLayer) { + if (!action.query.bboxFilter) { if (extent) { for (let f of action.features) { extend(extent, (f as Feature).getGeometry().getExtent()); @@ -211,7 +209,12 @@ export class MapEffects { selectItemSuccess$: Observable = this.actions$.pipe( ofType(mapActions.SELECTITEMSUCCESS), switchMap((action:mapActions.SelectItemSuccess) => { - if(!this._overrideSelectedItemLayer) { + let overrideSelectedItemLayer = false; + if(this.route$ && this.route$.snapshot && this.route$.snapshot.data && this.route$.snapshot.data["fm-map-map"]) { + let params = this.route$.snapshot.data["fm-map-map"]; + overrideSelectedItemLayer = params["overrideSelectedItemlayer"] ? params["overrideSelectedItemlayer"] : false; + } + if(!overrideSelectedItemLayer) { return this.itemService$.getFeature(action.item.code, "EPSG:3857").pipe( map((feature: any) => { let f = this._geojsonFormat.readFeature(feature); @@ -393,13 +396,8 @@ export class MapEffects { } })); - constructor(private actions$: Actions, private store$: Store, private folderService$: FolderService, private itemService$: ItemService,private featureIconService$:FeatureIconService,private itemTypeService$:ItemTypeService, private route: ActivatedRoute) { + 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; - } + this._wktFormat = new WKT(); } }