diff --git a/src/app/cesium-map/csmap.clipboard.component.ts b/src/app/cesium-map/csmap.clipboard.component.ts index 225e4863..2b849ece 100644 --- a/src/app/cesium-map/csmap.clipboard.component.ts +++ b/src/app/cesium-map/csmap.clipboard.component.ts @@ -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) { @@ -56,9 +58,11 @@ export class CsMapClipboardComponent implements OnInit { onRoiSave(event) { if (this.polygonBBox === null) return; let roiPolygon= this.polygonBBox; - 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(); } diff --git a/src/app/menupanel/common/filterpanel/filterpanel.component.ts b/src/app/menupanel/common/filterpanel/filterpanel.component.ts index 060e27c9..a85523cc 100644 --- a/src/app/menupanel/common/filterpanel/filterpanel.component.ts +++ b/src/app/menupanel/common/filterpanel/filterpanel.component.ts @@ -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