import {Injectable} from '@angular/core'; import { HsDialogContainerService, HsLayoutService, HsPanelComponent, } from 'hslayers-ng'; import {AdjusterLoaderComponent} from './adjuster-loader/adjuster-loader.component'; import {AdjusterPresetsService} from './adjuster-presets.service'; import {AdjusterService} from './adjuster.service'; @Injectable({providedIn: 'root'}) export class AdjusterUIService { constructor( public adjusterService: AdjusterService, public adjusterPresetsService: AdjusterPresetsService, public hsDialogContainerService: HsDialogContainerService, public hsLayoutService: HsLayoutService ) { console.log('creating dialog...'); this.hsDialogContainerService.create(AdjusterLoaderComponent, {}); console.log( '🚀 ~ file: adjuster-ui.service.ts ~ line 24 ~ hsDialogContainerService', hsDialogContainerService ); console.log('dialog creation done?'); } hasDatasets(factor): boolean { return factor.datasets.length > 0; } getLabelInCurrentLang(labels) { return this.adjusterPresetsService.getLabelInCurrentLang(labels); } isVisible(): boolean { return this.hsLayoutService.panelVisible('adjuster-advanced'); } noDataSelected(): boolean { if (this.adjusterService.factors.length === 0) { return true; } let datasetsEffectivelyTurnedOn = []; for (const factor of this.adjusterService.factors) { if (factor.weight === 0) { continue; } datasetsEffectivelyTurnedOn = [ ...datasetsEffectivelyTurnedOn, ...factor.datasets.filter((ds) => ds.included), ]; } return datasetsEffectivelyTurnedOn.length === 0; } noOperationSelected(): boolean { return ( !this.adjusterService.allowIndex && !this.adjusterService.allowClusters ); } /*selectMethod(): void { this.adjusterService.method = this.method; this.adjusterEventService.methodChanged.next(this.method); }*/ }