import { Component , Input } from '@angular/core' ; import { HsLayerEditorSublayerService , KeyBooleanDict , } from './layer-editor.sub-layer.service' ; import { HsLayerManagerService } from '../layermanager.service' ; @ Component ( { selector : 'hs-layer-editor-sub-layer-checkbox' , templateUrl : './sub-layer-checkboxes.html' , } ) export class HsLayerEditorSubLayerCheckboxesComponent { @ Input ( ) subLayer : any ; expanded = false ; checkedSubLayers : KeyBooleanDict ; withChildren : KeyBooleanDict ; constructor ( public HsLayerEditorSublayerService , public HsLayerManagerService ) { this . checkedSubLayers = this . HsLayerEditorSublayerService . checkedSubLayers ; this . withChildren = this . HsLayerEditorSublayerService . withChildren ; } getSubLayers ( ) { return this . HsLayerEditorSublayerService . getSubLayers ( ) ; } subLayerIsString ( subLayer ) { return typeof subLayer == 'string' ; } toggleExpanded ( ) { this . expanded = ! this . expanded ; } description param { object } sublayer param { object } state subLayerSelected ( sublayer ? , state ? ) { if ( sublayer != undefined && sublayer . Layer ) { for ( const children of sublayer . Layer ) { Object . assign ( this . checkedSubLayers , { [ children . Name ] : state , } ) ; this . HsLayerEditorSublayerService . checkedSubLayersTmp [ children . Name ] = state ; } } if ( this . checkedSubLayers [ sublayer . Name ] != undefined ) { this . HsLayerEditorSublayerService . checkedSubLayersTmp [ sublayer . Name ] = state ; } else { this . HsLayerEditorSublayerService . withChildrenTmp [ sublayer . Name ] = state ; } return this . HsLayerEditorSublayerService . subLayerSelected ( ) ; } }