From bf883a779fa99707c65becee1b41e153e8f54a3b Mon Sep 17 00:00:00 2001 From: Willem Dantuma Date: Fri, 27 Mar 2020 13:22:11 +0100 Subject: [PATCH] AW-1079 --- .../fm-map/components/map/map.component.html | 2 +- .../selected-item-container.component.ts | 7 ++++++- .../selected-item-geotiff.component.html | 5 ++++- .../selected-item-shape.component.html | 5 ++++- .../selected-item/selected-item.component.html | 16 ++++++++++++---- .../selected-item/selected-item.component.scss | 16 ++++++++++++++++ .../selected-item/selected-item.component.ts | 18 +++++++++++++++++- 7 files changed, 60 insertions(+), 9 deletions(-) diff --git a/projects/common-map/src/fm-map/components/map/map.component.html b/projects/common-map/src/fm-map/components/map/map.component.html index 9567fe2..1d3c233 100644 --- a/projects/common-map/src/fm-map/components/map/map.component.html +++ b/projects/common-map/src/fm-map/components/map/map.component.html @@ -57,7 +57,7 @@
- +
Cannot find {{state.queryState?.query}}
diff --git a/projects/common-map/src/fm-map/components/selected-item-container/selected-item-container.component.ts b/projects/common-map/src/fm-map/components/selected-item-container/selected-item-container.component.ts index 9e7ebef..b909f00 100644 --- a/projects/common-map/src/fm-map/components/selected-item-container/selected-item-container.component.ts +++ b/projects/common-map/src/fm-map/components/selected-item-container/selected-item-container.component.ts @@ -16,7 +16,8 @@ export class SelectedItemContainerComponent { } @Input() item: IItem; - @Input() itemLayer:IItemLayer + @Input() itemLayer:IItemLayer; + @Input() overlayLayers:Array; @ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective; @@ -44,6 +45,7 @@ export class SelectedItemContainerComponent { const componentRef = viewContainerRef.createComponent(componentFactory); (componentRef.instance).item = this.item; (componentRef.instance).itemLayer = this.itemLayer; + (componentRef.instance).overlayLayers = this.overlayLayers; } ngOnChanges(changes: SimpleChanges) { @@ -53,5 +55,8 @@ export class SelectedItemContainerComponent { if (changes["itemLayer"] && changes["itemLayer"].currentValue) { this.loadComponent(); } + if (changes["overlayLayers"] && changes["overlayLayers"].currentValue) { + this.loadComponent(); + } } } 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 bbf3d15..e3d3f1b 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 @@ -20,7 +20,10 @@
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 d1859af..b51ce87 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 @@ -20,7 +20,10 @@ diff --git a/projects/common-map/src/fm-map/components/selected-item/selected-item.component.html b/projects/common-map/src/fm-map/components/selected-item/selected-item.component.html index 1c13e7d..175e1b7 100644 --- a/projects/common-map/src/fm-map/components/selected-item/selected-item.component.html +++ b/projects/common-map/src/fm-map/components/selected-item/selected-item.component.html @@ -9,10 +9,18 @@

{{item.name}}

- View - - Edit - Add as overlay +
diff --git a/projects/common-map/src/fm-map/components/selected-item/selected-item.component.scss b/projects/common-map/src/fm-map/components/selected-item/selected-item.component.scss index 0dd4025..a30d27c 100644 --- a/projects/common-map/src/fm-map/components/selected-item/selected-item.component.scss +++ b/projects/common-map/src/fm-map/components/selected-item/selected-item.component.scss @@ -11,3 +11,19 @@ .card-title { font-size: 1rem; } + +ul { + list-style:none; +} + +li { + margin-top:1rem; +} + +.menu-card { + margin-left: -7px; + padding-left: 7px; + margin-right: -7px; + padding-right: 7px; + margin-bottom: 7px; +} \ No newline at end of file diff --git a/projects/common-map/src/fm-map/components/selected-item/selected-item.component.ts b/projects/common-map/src/fm-map/components/selected-item/selected-item.component.ts index dba89de..5cc1013 100644 --- a/projects/common-map/src/fm-map/components/selected-item/selected-item.component.ts +++ b/projects/common-map/src/fm-map/components/selected-item/selected-item.component.ts @@ -11,7 +11,8 @@ import { IItemLayer } from '../../models/item.layer'; @Injectable() export abstract class AbstractSelectedItemComponent { @Input() item: IItem - @Input() itemLayer: IItemLayer + @Input() itemLayer: IItemLayer; + @Input() overlayLayers: Array; constructor(public store: Store, public itemTypeService: ItemTypeService, private location: Location, public router: Router) { } @@ -39,6 +40,21 @@ export abstract class AbstractSelectedItemComponent { return false; } + handleRemoveLayer(item: IItem,layerIndex:number = -1) { + let itemLayer = this.getItemLayer(item,layerIndex); + if(itemLayer) { + this.store.dispatch(new mapActions.RemoveLayer(itemLayer)); + } + return false; + } + + getItemLayer(item:IItem,layerIndex:number = -1):IItemLayer { + let li = layerIndex==-1?0:layerIndex; + let selected = this.overlayLayers.filter(ol => ol.item.code == item.code && ol.layerIndex == li); + if(selected.length==0) return null; + return selected[0]; + } + handleBackToList(event: MouseEvent) { event.preventDefault(); this.location.back();