AW-3573
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
FarmMaps/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Willem Dantuma 2022-02-23 11:57:36 +01:00
parent e62c185f35
commit d8730e77ad
5 changed files with 27 additions and 9 deletions

View File

@ -13,7 +13,7 @@
</span> </span>
<a href="#" title="Zoom to extent" class="btn btn-light btn-sm" (click)="handleZoomToExtent($event,itemLayer)"><i class="far fa-search-plus" aria-hidden="true"></i></a> <a href="#" title="Zoom to extent" class="btn btn-light btn-sm" (click)="handleZoomToExtent($event,itemLayer)"><i class="far fa-search-plus" aria-hidden="true"></i></a>
<span *ngIf="firstLayer(itemLayer)"><a href="#" title="Toggle legend" class="btn btn-light btn-sm" (click)="itemLayer.legendVisible=toggleLegend($event,itemLayer.legendVisible)"><i class="far fa-chart-bar" aria-hidden="true"></i></a></span> <span *ngIf="firstLayer(itemLayer)"><a href="#" title="Toggle legend" class="btn btn-light btn-sm" (click)="itemLayer.legendVisible=toggleLegend($event,itemLayer.legendVisible)"><i class="far fa-chart-bar" aria-hidden="true"></i></a></span>
<span class="float-right"><a href="#" title="Remove overlay" class="btn btn-light btn-sm" (click)="handleDelete($event,itemLayer)"><i class="fas fa-layer-minus" aria-hidden="true"></i></a></span> <span *ngIf="!dataLayers" class="float-right"><a href="#" title="Remove overlay" class="btn btn-light btn-sm" (click)="handleDelete($event,itemLayer)"><i class="fas fa-layer-minus" aria-hidden="true"></i></a></span>
</div> </div>
<div *ngIf="itemLayer.legendVisible"> <div *ngIf="itemLayer.legendVisible">
<div class="card legend"> <div class="card legend">

View File

@ -10,6 +10,7 @@ import { IItemLayer } from '../../../models/item.layer';
export class LayerListComponent { export class LayerListComponent {
@Input() itemLayers: IItemLayer[] = []; @Input() itemLayers: IItemLayer[] = [];
@Input() baseLayers: boolean = false; @Input() baseLayers: boolean = false;
@Input() dataLayers: boolean = false;
@Output() onToggleVisibility = new EventEmitter<IItemLayer>(); @Output() onToggleVisibility = new EventEmitter<IItemLayer>();
@Output() onSetOpacity = new EventEmitter<{layer: IItemLayer,opacity:number }>(); @Output() onSetOpacity = new EventEmitter<{layer: IItemLayer,opacity:number }>();
@Output() onDelete = new EventEmitter<IItemLayer>(); @Output() onDelete = new EventEmitter<IItemLayer>();

View File

@ -19,6 +19,13 @@
<fm-map-layer-list [itemLayers]="overlayLayers|async" [selectedLayer]="selectedOverlayLayer|async" (onDelete)="handleOnDelete($event)" (onToggleVisibility)="handleOnToggleVisibility($event)" (onSetOpacity)="handleOnSetOpacity($event)" (onZoomToExtent)="handleZoomToExtent($event)" (onSelectLayer)="handleSelectOverlayLayer($event)"></fm-map-layer-list> <fm-map-layer-list [itemLayers]="overlayLayers|async" [selectedLayer]="selectedOverlayLayer|async" (onDelete)="handleOnDelete($event)" (onToggleVisibility)="handleOnToggleVisibility($event)" (onSetOpacity)="handleOnSetOpacity($event)" (onZoomToExtent)="handleZoomToExtent($event)" (onSelectLayer)="handleSelectOverlayLayer($event)"></fm-map-layer-list>
</div> </div>
</li> </li>
<li class="nav-item py-0" *ngIf="selectedItemLayer$ | async as selectedItemLayer">
<span><i class="fal fa-layer-group" aria-hidden="true"></i>&nbsp;<span i18n>Data</span></span>
<div class="mb-4">
<fm-map-layer-list [dataLayers]="true" [itemLayers]="[selectedItemLayer]" [selectedLayer]="selectedItemLayer" (onToggleVisibility)="handleOnToggleVisibility($event)" (onSetOpacity)="handleOnSetOpacity($event)" (onZoomToExtent)="handleZoomToExtent($event)" (onSelectLayer)="handleSelectOverlayLayer($event)"></fm-map-layer-list>
</div>
</li>
</ul> </ul>
</div> </div>
</div> </div>

View File

@ -16,6 +16,7 @@ export class LayerSwitcher implements OnInit,OnChanges{
public showLayerSwitcher:Observable<boolean>; public showLayerSwitcher:Observable<boolean>;
public overlayLayers: Observable<Array<IItemLayer>>; public overlayLayers: Observable<Array<IItemLayer>>;
public selectedOverlayLayer: Observable<IItemLayer>; public selectedOverlayLayer: Observable<IItemLayer>;
public selectedItemLayer$: Observable<IItemLayer>;
public baseLayers: Observable<Array<IItemLayer>>; public baseLayers: Observable<Array<IItemLayer>>;
public selectedBaseLayer: Observable<IItemLayer>; public selectedBaseLayer: Observable<IItemLayer>;
@ -27,6 +28,7 @@ export class LayerSwitcher implements OnInit,OnChanges{
this.selectedOverlayLayer = this.store.select(mapReducers.selectGetSelectedOverlayLayer); this.selectedOverlayLayer = this.store.select(mapReducers.selectGetSelectedOverlayLayer);
this.baseLayers = this.store.select(mapReducers.selectGetBaseLayers); this.baseLayers = this.store.select(mapReducers.selectGetBaseLayers);
this.selectedBaseLayer = this.store.select(mapReducers.selectGetSelectedBaseLayer); this.selectedBaseLayer = this.store.select(mapReducers.selectGetSelectedBaseLayer);
this.selectedItemLayer$ = this.store.select(mapReducers.selectGetSelectedItemLayer)
this.showLayerSwitcher = this.store.select(mapReducers.selectGetShowLayerSwitcher); this.showLayerSwitcher = this.store.select(mapReducers.selectGetShowLayerSwitcher);
} }

View File

@ -385,17 +385,25 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
} }
case mapActions.SETVISIBILITY: { case mapActions.SETVISIBILITY: {
let a = action as mapActions.SetVisibility; let a = action as mapActions.SetVisibility;
let newLayers = state.overlayLayers.slice(0); if(state.selectedItemLayer == a.itemLayer) {
let i = state.overlayLayers.indexOf(a.itemLayer); return tassign(state,{selectedItemLayer: tassign(state.selectedItemLayer,{visible:a.visibility})});
newLayers[i].visible = a.visibility; } else {
return tassign(state, { overlayLayers: newLayers }); let newLayers = state.overlayLayers.slice(0);
let i = state.overlayLayers.indexOf(a.itemLayer);
newLayers[i].visible = a.visibility;
return tassign(state, { overlayLayers: newLayers });
}
} }
case mapActions.SETOPACITY: { case mapActions.SETOPACITY: {
let a = action as mapActions.SetOpacity; let a = action as mapActions.SetOpacity;
let newLayers = state.overlayLayers.slice(0); if(state.selectedItemLayer == a.itemLayer) {
let i = state.overlayLayers.indexOf(a.itemLayer); return tassign(state,{selectedItemLayer: tassign(state.selectedItemLayer,{opacity:a.opacity})});
newLayers[i].opacity = a.opacity; } else {
return tassign(state, { overlayLayers: newLayers }); let newLayers = state.overlayLayers.slice(0);
let i = state.overlayLayers.indexOf(a.itemLayer);
newLayers[i].opacity = a.opacity;
return tassign(state, { overlayLayers: newLayers });
}
} }
case mapActions.SETLAYERINDEX: { case mapActions.SETLAYERINDEX: {
let a = action as mapActions.SetLayerIndex; let a = action as mapActions.SetLayerIndex;