Skip to content

Commit

Permalink
Merge pull request #467 from AuScope/AUS-4299
Browse files Browse the repository at this point in the history
AUS-4299 Check if the polygon already in roiNameList.
  • Loading branch information
laughing0li authored Dec 12, 2024
2 parents 93d9607 + 7a430e5 commit 3ef367e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/app/cesium-map/csmap.clipboard.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export class CsMapClipboardComponent implements OnInit {
public isFilterLayerShown: boolean;
public isDrawingPolygon: boolean;
kmlFileName = '';
roiNameList = [];



constructor(private csClipboardService: CsClipboardService, private userStateService: UserStateService, private downloadWfsService: DownloadWfsService) {
Expand Down Expand Up @@ -56,9 +58,11 @@ export class CsMapClipboardComponent implements OnInit {
onRoiSave(event) {

Check warning on line 58 in src/app/cesium-map/csmap.clipboard.component.ts

View workflow job for this annotation

GitHub Actions / build

'event' is defined but never used
if (this.polygonBBox === null) return;
let roiPolygon= this.polygonBBox;

Check warning on line 60 in src/app/cesium-map/csmap.clipboard.component.ts

View workflow job for this annotation

GitHub Actions / build

'roiPolygon' is never reassigned. Use 'const' instead
let strToday=new Date();
let dt= new Date(strToday).toISOString();
roiPolygon.name = 'ROI-' + dt.slice(0,dt.lastIndexOf('.'));
if (this.roiNameList.includes(roiPolygon.name)) {
console.log('existed already:'+ roiPolygon.name);
return;
}
this.roiNameList.push(roiPolygon.name);
this.userStateService.roiList.push(roiPolygon);
this.userStateService.saveROI();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,11 @@ export class FilterPanelComponent implements OnInit, AfterViewInit {
if (optFilter['value'] && optFilter['type'] === 'OPTIONAL.POLYGONBBOX') {
const geometry = optFilter['value'];
const swappedGeometry = this.csClipboardService.swapGeometry(geometry);
let strToday=new Date();
let dt= new Date(strToday).toISOString();
const name = 'Polygon-' + dt.slice(0,dt.lastIndexOf('.'));
const newPolygon:Polygon = {
name: 'Polygon created',
name: name,
srs: 'EPSG:4326',
geometryType: GeometryType.POLYGON,
coordinates: swappedGeometry
Expand Down

0 comments on commit 3ef367e

Please sign in to comment.