-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #349 from AuScope/AUS-4035
AUS-4035 Added ROI(region of interest) for user.
- Loading branch information
Showing
11 changed files
with
225 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<div class="modal-header"> | ||
<h4>Region Of Interest</h4><button class="btn btn-sm btn-outline pull-right" aria-label="Close" (click)="activeModal.close()"><i class="fa fa-times"></i></button> | ||
</div> | ||
<div class="modal-body"> | ||
<table> | ||
<tbody> | ||
<tr *ngFor = "let roi of userStateService.roiList"> | ||
<td>{{roi.name}}</td> | ||
<td class="btn-col" style="white-space: nowrap"> | ||
<a class="btn btn-purple btn-xs" title="add to map" (click) = "onAddToPolyFilter(roi)"><i class="ti-map-alt"></i></a> | ||
<a class="btn btn-light btn-xs" title="delete" (click)="onDelete(roi)"><i class="ti-trash"></i></a> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<form class="text-left"> | ||
<button type="button" class="btn btn-primary" (click)="close()">Close</button> | ||
</form> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { Component, ElementRef, NgModule, OnInit, QueryList, ViewChildren } from '@angular/core'; | ||
import { AbstractControl, UntypedFormArray, UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms'; | ||
import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap'; | ||
import { ConfirmModalComponent } from '../confirm/confirm.modal.component'; | ||
import { CsClipboardService } from '@auscope/portal-core-ui'; | ||
import { CommonModule } from '@angular/common'; | ||
import { UserStateService } from 'app/services/user/user-state.service'; | ||
import { User } from 'app/models/user.model'; | ||
|
||
|
||
|
||
/** | ||
* Modal component used to display a user's ROI lists | ||
*/ | ||
@Component({ | ||
selector: 'app-roi-form', | ||
templateUrl: './roi.modal.component.html' | ||
}) | ||
|
||
|
||
export class ROIModalComponent { | ||
public user: User; | ||
roiFormArray: UntypedFormArray; | ||
editingROI: number = -1; // Keep track of ROI being edited (-1 = none) | ||
constructor(public csClipboardService: CsClipboardService, public userStateService: UserStateService, private formBuilder: UntypedFormBuilder, private modalService: NgbModal, public activeModal: NgbActiveModal) { | ||
|
||
} | ||
/** | ||
* Delete a ROI from user's ROI lists | ||
* @param roi Polygon | ||
*/ | ||
public onDelete(roi:any) { | ||
let index = this.userStateService.roiList.indexOf(roi); | ||
this.userStateService.roiList.splice(index,1); | ||
} | ||
/** | ||
* Add a ROI to ClipboardService | ||
* @param roi Polygon | ||
*/ | ||
public onAddToPolyFilter(roi:any) { | ||
this.csClipboardService.loadPolygonFromROI(roi); | ||
} | ||
/** | ||
* Close the ROI component. | ||
* Save the ROI to storage. | ||
*/ | ||
public close() { | ||
if (this.editingROI !== -1 && this.roiFormArray.controls[this.editingROI].dirty) { | ||
const modalRef = this.modalService.open(ConfirmModalComponent, { | ||
size: 'lg', | ||
backdrop: false | ||
}); | ||
modalRef.componentInstance.title = 'Unsaved Changes'; | ||
modalRef.componentInstance.modalContent = 'You have unsaved changes, do you wish to continue without saving?'; | ||
modalRef.componentInstance.cancelButtonText = 'Cancel'; | ||
modalRef.componentInstance.confirmButtonText = 'OK'; | ||
modalRef.result.then(result => { | ||
if (result && result === 'OK') { | ||
this.activeModal.close(); | ||
} | ||
}); | ||
} else { | ||
// Save the ROI to storage. | ||
this.userStateService.saveROI(); | ||
this.activeModal.close(); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { ROIModalComponent } from './roi.modal.component'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
CommonModule, | ||
], | ||
declarations: [ ROIModalComponent ], | ||
exports: [ ROIModalComponent ] | ||
}) | ||
|
||
export class ROIModule { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.