import { Component , Input , ViewRef } from '@angular/core' ; import { HsDialogComponent } from '../../layout/dialogs/dialog-component.interface' ; import { HsDialogContainerService } from '../../layout/dialogs/dialog-container.service' ; import { HsDrawService } from '../../draw/draw.service' ; import { HsEventBusService } from '../../core/event-bus.service' ; import { HsMapService } from '../../map/map.service' ; @ Component ( { selector : 'hs-layermanager-remove-layer-dialog' , templateUrl : './dialog_remove_layer.html' , } ) export class HsLayerManagerRemoveLayerDialogComponent implements HsDialogComponent { @ Input ( ) data : any ; viewRef : ViewRef ; constructor ( public HsDialogContainerService , public HsEventBusService , public HsDrawService , public HsMapService ) { } removeLayer ( ) { if ( this . HsDrawService . selectedLayer == this . data . olLayer ) { this . HsDrawService . selectedLayer = null ; } this . HsMapService . map . removeLayer ( this . data . olLayer ) ; this . HsDrawService . fillDrawableLayers ( ) ; this . HsEventBusService . layerManagerUpdates . next ( ) ; this . close ( ) ; } close ( ) { this . HsDialogContainerService . destroy ( this ) ; } }