From 2388968f2aeed0f05338bff26ab6391582d049b0 Mon Sep 17 00:00:00 2001 From: Willem Dantuma Date: Tue, 3 Mar 2020 19:24:01 +0100 Subject: [PATCH] Fix layer selection --- .../aol/item-layers/item-layers.component.ts | 2 +- .../selected-item-geotiff.component.html | 8 +- .../selected-item-shape.component.html | 6 +- .../selected-item-shape.component.ts | 62 +++++++------ .../selected-item-temporal.component.html | 8 +- .../selected-item-temporal.component.ts | 2 - .../src/fm-map/models/item.layer.ts | 3 +- .../src/fm-map/reducers/map.reducer.ts | 88 +++++++++++++++---- 8 files changed, 117 insertions(+), 62 deletions(-) diff --git a/projects/common-map/src/fm-map/components/aol/item-layers/item-layers.component.ts b/projects/common-map/src/fm-map/components/aol/item-layers/item-layers.component.ts index 5bccd13..cb51398 100644 --- a/projects/common-map/src/fm-map/components/aol/item-layers/item-layers.component.ts +++ b/projects/common-map/src/fm-map/components/aol/item-layers/item-layers.component.ts @@ -278,7 +278,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange itemLayers.forEach((itemLayer, index) => { if(itemLayer.item.itemType == 'vnd.farmmaps.itemtype.temporal') { let il = itemLayer as ITemporalItemLayer; - let previousLayer = this.addOrUpdateOlLayer(il.previousItemLayer,newLayers.length); + let previousLayer = this.addOrUpdateOlLayer(il.previousItemLayer,newLayers.length); if(previousLayer) newLayers.push(previousLayer); let selectedLayer = this.addOrUpdateOlLayer(il.selectedItemLayer,newLayers.length); if(selectedLayer) newLayers.push(selectedLayer); diff --git a/projects/common-map/src/fm-map/components/selected-item-geotiff/selected-item-geotiff.component.html b/projects/common-map/src/fm-map/components/selected-item-geotiff/selected-item-geotiff.component.html index 25e1951..75adccd 100644 --- a/projects/common-map/src/fm-map/components/selected-item-geotiff/selected-item-geotiff.component.html +++ b/projects/common-map/src/fm-map/components/selected-item-geotiff/selected-item-geotiff.component.html @@ -9,18 +9,18 @@
diff --git a/projects/common-map/src/fm-map/components/selected-item-shape/selected-item-shape.component.html b/projects/common-map/src/fm-map/components/selected-item-shape/selected-item-shape.component.html index 1507e8d..63ff300 100644 --- a/projects/common-map/src/fm-map/components/selected-item-shape/selected-item-shape.component.html +++ b/projects/common-map/src/fm-map/components/selected-item-shape/selected-item-shape.component.html @@ -9,18 +9,18 @@
diff --git a/projects/common-map/src/fm-map/components/selected-item-shape/selected-item-shape.component.ts b/projects/common-map/src/fm-map/components/selected-item-shape/selected-item-shape.component.ts index 1a0a445..2b54f5b 100644 --- a/projects/common-map/src/fm-map/components/selected-item-shape/selected-item-shape.component.ts +++ b/projects/common-map/src/fm-map/components/selected-item-shape/selected-item-shape.component.ts @@ -1,32 +1,30 @@ -import { Component, Input, Injectable, OnInit } from '@angular/core'; -import { Location } from '@angular/common'; -import { Feature } from 'ol'; -import { Store } from '@ngrx/store'; -import * as mapReducers from '../../reducers/map.reducer'; -import { commonReducers, ItemTypeService, IItem, Item, ItemService, FolderService, IListItem} from '@farmmaps/common'; -import * as mapActions from '../../actions/map.actions'; -import { Router, ActivatedRoute, ParamMap, Event } from '@angular/router'; -import { ForItemType } from '../for-item/for-itemtype.decorator'; -import { AbstractSelectedItemComponent } from '../selected-item/selected-item.component'; -import { Observable } from 'rxjs'; - - -@ForItemType("vnd.farmmaps.itemtype.shape.processed") -@Injectable() -@Component({ - selector: 'fm-map-selected-item-shape', - templateUrl: './selected-item-shape.component.html', - styleUrls: ['./selected-item-shape.component.scss'] -}) -export class SelectedItemShapeComponent extends AbstractSelectedItemComponent { - - constructor(store: Store, itemTypeService: ItemTypeService, location: Location, router: Router, private itemService$: ItemService,private folderService$: FolderService) { - super(store, itemTypeService,location,router); - } - public selectedLayer: number = 0; - - onLayerChanged(layerIndex: number) { - this.selectedLayer = layerIndex; - this.store.dispatch(new mapActions.SetLayerIndex(layerIndex)); - } -} +import { Component, Input, Injectable, OnInit } from '@angular/core'; +import { Location } from '@angular/common'; +import { Feature } from 'ol'; +import { Store } from '@ngrx/store'; +import * as mapReducers from '../../reducers/map.reducer'; +import { commonReducers, ItemTypeService, IItem, Item, ItemService, FolderService, IListItem} from '@farmmaps/common'; +import * as mapActions from '../../actions/map.actions'; +import { Router, ActivatedRoute, ParamMap, Event } from '@angular/router'; +import { ForItemType } from '../for-item/for-itemtype.decorator'; +import { AbstractSelectedItemComponent } from '../selected-item/selected-item.component'; +import { Observable } from 'rxjs'; + + +@ForItemType("vnd.farmmaps.itemtype.shape.processed") +@Injectable() +@Component({ + selector: 'fm-map-selected-item-shape', + templateUrl: './selected-item-shape.component.html', + styleUrls: ['./selected-item-shape.component.scss'] +}) +export class SelectedItemShapeComponent extends AbstractSelectedItemComponent { + + constructor(store: Store, itemTypeService: ItemTypeService, location: Location, router: Router, private itemService$: ItemService,private folderService$: FolderService) { + super(store, itemTypeService,location,router); + } + + onLayerChanged(layerIndex: number) { + this.store.dispatch(new mapActions.SetLayerIndex(layerIndex)); + } +} diff --git a/projects/common-map/src/fm-map/components/selected-item-temporal/selected-item-temporal.component.html b/projects/common-map/src/fm-map/components/selected-item-temporal/selected-item-temporal.component.html index b718c92..ed64370 100644 --- a/projects/common-map/src/fm-map/components/selected-item-temporal/selected-item-temporal.component.html +++ b/projects/common-map/src/fm-map/components/selected-item-temporal/selected-item-temporal.component.html @@ -10,17 +10,17 @@