Skip to content

Commit

Permalink
Merge pull request #408 from chrisvpeters/AUS-4139
Browse files Browse the repository at this point in the history
AUS-4139
  • Loading branch information
vjf authored Jun 21, 2024
2 parents 2bb0692 + 59d090b commit 236f857
Show file tree
Hide file tree
Showing 6 changed files with 187 additions and 58 deletions.
10 changes: 7 additions & 3 deletions src/app/menupanel/activelayers/activelayerspanel.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
<button class="btn btn-primary btn-sm legend" [disabled]="isLegendShown(layer.id)" (click)="showLegend(layer)">Legend</button>
<!-- Display status button -->
<button class="btn btn-primary btn-sm status" (click)="openStatusReport(getUILayerModel(layer.id)); $event.stopPropagation();">Status</button>
<!-- Display info button -->
<button (click)="displayRecordInformation(layer)" type="button" class="btn btn-primary btn-sm info" title="Information" [ngClass]="{'active': getUILayerModel(layer.id)?.tabpanel.infopanel.expanded}">Info</button>
</div>
</div>
<!-- Map split controls -->
Expand All @@ -53,7 +55,7 @@
<div class="card-header">
<ul id="card-tab">
<!-- Layer Styling tab -->
<li (click)="selectTabPanel(layer.id,'filterpanel')" [ngClass]="{'active': !getUILayerModel(layer.id)?.tabpanel.downloadpanel.expanded}" class="tab-item">
<li *ngIf="hasFilters(layer.id)" (click)="selectTabPanel(layer.id,'filterpanel')" [ngClass]="{'active': !getUILayerModel(layer.id)?.tabpanel.downloadpanel.expanded}" class="tab-item">
<a>
<span class="d-none tab-link d-sm-inline">Layer Styling</span>
</a>
Expand All @@ -73,9 +75,11 @@
<button *ngIf="isUserLoggedIn() && isLayerBookmarked(layer.id)" (click)="removeLayerBookmark(layer.id)" class="btn-info" title="Remove Layer Bookmark"><i class="fa fa-sm fa-bookmark"></i></button>
<!-- Info button -->
<!-- <button (click)="displayRecordInformation(layer)" type="button" class="btn-info" title="Information" [ngClass]="{'active': getUILayerModel(layer.id)?.tabpanel.filterpanel.expanded}">Info</button> -->
<!--
<div class="rh_info">
<button (click)="displayRecordInformation(layer)" type="button" class="btn-info" title="Information" [ngClass]="{'active': getUILayerModel(layer.id)?.tabpanel.infopanel.expanded}">Info</button>
</div>
-->
</div>
</div>
<div id="card-tab-content" class="tab-content">
Expand All @@ -84,8 +88,8 @@
<app-filter-panel *ngIf="getUILayerModel(layer.id)?.tabpanel.filterpanel.expanded" [layer]=layer></app-filter-panel>
</div>
<!-- Panel for layer download -->
<div class="tab-pane fade" [ngClass]="{'show active': getUILayerModel(layer.id)?.tabpanel.downloadpanel.expanded}">
<app-download-panel *ngIf="getUILayerModel(layer.id)?.tabpanel.downloadpanel.expanded" [layer]=layer></app-download-panel>
<div class="tab-pane fade" [ngClass]="{'show active': !hasFilters(layer.id) || getUILayerModel(layer.id)?.tabpanel.downloadpanel.expanded}">
<app-download-panel *ngIf="!hasFilters(layer.id) || getUILayerModel(layer.id)?.tabpanel.downloadpanel.expanded" [layer]=layer></app-download-panel>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
margin-bottom: 0.3rem;
align-items: center;

.legend, .status {
.legend, .status, .info {
font-size: 0.8rem;
padding: 0 2px;
margin-left: 12px;
Expand Down
78 changes: 53 additions & 25 deletions src/app/menupanel/activelayers/activelayerspanel.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Input, ViewChildren, QueryList, AfterViewInit } from '@angular/core';
import { Component, Input, ViewChildren, QueryList, AfterViewInit, ChangeDetectorRef } from '@angular/core';
import { CsMapService, LayerModel, ResourceType, UtilitiesService } from '@auscope/portal-core-ui';
import { ManageStateService, LayerHandlerService, CsClipboardService } from '@auscope/portal-core-ui';
import { SplitDirection } from 'cesium';
Expand Down Expand Up @@ -54,11 +54,13 @@ export class ActiveLayersPanelComponent implements AfterViewInit {
private legendUiService: LegendUiService, private modalService: BsModalService,
private layerHandlerService: LayerHandlerService, private csClipboardService: CsClipboardService,
private userStateService: UserStateService, private manageStateService: ManageStateService,
private authService: AuthService, private activeModalService: NgbModal) {
this.csClipboardService.filterLayersBS.subscribe(filterLayers => {
this.areLayersPolygonFiltered = filterLayers;
});
}
private authService: AuthService, private activeModalService: NgbModal, private ref: ChangeDetectorRef) {
this.csClipboardService.filterLayersBS.subscribe(filterLayers => {
this.areLayersPolygonFiltered = filterLayers;
});
}

public isDownloadExpanded: boolean = false;

/**
* Open or close sidebar
Expand Down Expand Up @@ -113,10 +115,35 @@ export class ActiveLayersPanelComponent implements AfterViewInit {
next: (bookMarkList: Bookmark[]) => {
me.bookmarks = [];
for (const bookMark of bookMarkList) {
me.bookmarks.push(bookMark);
me.bookmarks.push(bookMark);
}
}
});
});

}

/**
* check if a layer has filters - used to hide the tab "Layer Styling"
*
* @param layerId
* @returns boolean
*/
public hasFilters(layerId: string): boolean {

let filterState = this.layerManagerService.getFilters(layerId);
/*
// if the layer has no filters then set it to display the download tab
if (this.getUILayerModel(layerId)) {
this.selectTabPanel(layerId,'filterpanel');
//this.getUILayerModel(layerId).tabpanel.downloadpanel.expanded = false;
if (!filterState) {
this.selectTabPanel(layerId,'downloadpanel');
//this.getUILayerModel(layerId).tabpanel.downloadpanel.expanded = true;
}
}
*/

return filterState;
}

/**
Expand Down Expand Up @@ -144,10 +171,10 @@ export class ActiveLayersPanelComponent implements AfterViewInit {
this.layerHandlerService.getLayerModelsForIds([layerId]).subscribe(layers => {
for (const layerModel of layers) {
// This adds layer to the map
me.layerManagerService.addLayer(layerModel,
layerStateObj[layerId].optionalFilters,
layerStateObj[layerId].filterCollection,
layerStateObj[layerId].time);
me.layerManagerService.addLayer(layerModel,
layerStateObj[layerId].optionalFilters,
layerStateObj[layerId].filterCollection,
layerStateObj[layerId].time);
setTimeout(() => {
const layerFilterPanel: FilterPanelComponent = me.filterComponents.find(fc => fc.layer.id === layerId);
if (layerFilterPanel) {
Expand Down Expand Up @@ -225,7 +252,7 @@ export class ActiveLayersPanelComponent implements AfterViewInit {
*/
public getShowSplitMapButtons(layer: LayerModel): boolean {
return this.csMapService.getSplitMapShown() &&
(this.getUILayerModel(layer.id).statusMap.getRenderStarted() || this.getUILayerModel(layer.id).statusMap.getRenderComplete());
(this.getUILayerModel(layer.id).statusMap.getRenderStarted() || this.getUILayerModel(layer.id).statusMap.getRenderComplete());
}

/**
Expand Down Expand Up @@ -262,7 +289,7 @@ export class ActiveLayersPanelComponent implements AfterViewInit {
public getLayerSplitDirection(layerId: string): string {
let splitDir = "none";
if (this.csMapService.getLayerModel(layerId) !== undefined) {
switch(this.csMapService.getLayerModel(layerId).splitDirection) {
switch (this.csMapService.getLayerModel(layerId).splitDirection) {
case SplitDirection.LEFT:
splitDir = "left";
break;
Expand All @@ -286,8 +313,8 @@ export class ActiveLayersPanelComponent implements AfterViewInit {
/**
* Open the modal that display the status of the render
*/
public openStatusReport(uiLayerModel: UILayerModel) {
this.bsModalRef = this.modalService.show(NgbdModalStatusReportComponent, {class: 'modal-lg'});
public openStatusReport(uiLayerModel: UILayerModel) {
this.bsModalRef = this.modalService.show(NgbdModalStatusReportComponent, { class: 'modal-lg' });
uiLayerModel.statusMap.getStatusBSubject().subscribe((value) => {
this.bsModalRef.content.resourceMap = value.resourceMap;
});
Expand Down Expand Up @@ -361,6 +388,7 @@ export class ActiveLayersPanelComponent implements AfterViewInit {
*/
public selectTabPanel(layerId: string, panelType: string) {
this.getUILayerModel(layerId).tabpanel.setPanelOpen(panelType);
this.isDownloadExpanded = this.getUILayerModel(layerId).tabpanel.downloadpanel.expanded;
}

/**
Expand All @@ -386,9 +414,9 @@ export class ActiveLayersPanelComponent implements AfterViewInit {
* @param layer layer to check
* @returns true if supported layer, false otherwise
*/
public isMapSupportedLayer(layer: LayerModel): boolean {
return this.csMapService.isMapSupportedLayer(layer);
}
public isMapSupportedLayer(layer: LayerModel): boolean {
return this.csMapService.isMapSupportedLayer(layer);
}

/**
* Check to see if a layer supports downloading
Expand Down Expand Up @@ -456,11 +484,11 @@ export class ActiveLayersPanelComponent implements AfterViewInit {
this.csClipboardService.toggleFilterLayers(false);
}

/**
* Display the record information dialog
*
* @param layer layer for information
*/
/**
* Display the record information dialog
*
* @param layer layer for information
*/
public displayRecordInformation(layer: any) {
if (layer) {
const modelRef = this.activeModalService.open(InfoPanelComponent, {
Expand Down Expand Up @@ -561,7 +589,7 @@ export class ActiveLayersPanelComponent implements AfterViewInit {
return;
}
this.userStateService.addBookmark(layerId);
const bookmark: Bookmark = { 'fileIdentifier': layerId, serviceId: ''};
const bookmark: Bookmark = { 'fileIdentifier': layerId, serviceId: '' };
this.bookmarks.push(bookmark);
}

Expand Down
Loading

0 comments on commit 236f857

Please sign in to comment.