Use route parameters here also
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Willem Dantuma 2021-07-27 08:51:56 +02:00
parent 3fcf80c1a0
commit 5c549c5851

View File

@ -1,4 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Store, Action } from '@ngrx/store'; import { Store, Action } from '@ngrx/store';
import { Effect, Actions,ofType } from '@ngrx/effects'; import { Effect, Actions,ofType } from '@ngrx/effects';
@ -34,6 +35,8 @@ import { TemporalItemLayer } from '../models/item.layer'
export class MapEffects { export class MapEffects {
private _geojsonFormat: GeoJSON; private _geojsonFormat: GeoJSON;
private _wktFormat: WKT; private _wktFormat: WKT;
public _overrideSelectedItemLayer: boolean = false;
public _overrideOverlayLayers: boolean = false;
private toPointFeature(updateEvent:commonActions.DeviceUpdateEvent): Feature { private toPointFeature(updateEvent:commonActions.DeviceUpdateEvent): Feature {
var f = this._wktFormat.readFeature(updateEvent.attributes["geometry"],{ var f = this._wktFormat.readFeature(updateEvent.attributes["geometry"],{
@ -138,7 +141,7 @@ export class MapEffects {
let actions =[]; let actions =[];
actions.push(new commonActions.SetMenuVisible(false)); actions.push(new commonActions.SetMenuVisible(false));
let extent = createEmpty(); let extent = createEmpty();
if (!action.query.bboxFilter) { if (!action.query.bboxFilter && !this._overrideSelectedItemLayer) {
if (extent) { if (extent) {
for (let f of action.features) { for (let f of action.features) {
extend(extent, (f as Feature).getGeometry().getExtent()); extend(extent, (f as Feature).getGeometry().getExtent());
@ -386,8 +389,13 @@ export class MapEffects {
} }
})); }));
constructor(private actions$: Actions, private store$: Store<mapReducers.State>, private folderService$: FolderService, private itemService$: ItemService,private featureIconService$:FeatureIconService,private itemTypeService$:ItemTypeService) { constructor(private actions$: Actions, private store$: Store<mapReducers.State>, private folderService$: FolderService, private itemService$: ItemService,private featureIconService$:FeatureIconService,private itemTypeService$:ItemTypeService, private route: ActivatedRoute) {
this._geojsonFormat = new GeoJSON(); this._geojsonFormat = new GeoJSON();
this._wktFormat = new WKT(); 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;
}
}
} }