2021-04-12 13:46:28 +02:00
|
|
|
import { EventEmitter, Injectable } from '@angular/core';
|
2019-06-24 06:24:38 -07:00
|
|
|
import { Subject } from 'rxjs';
|
|
|
|
|
2020-11-09 13:50:24 +01:00
|
|
|
@Injectable({
|
2021-04-12 13:15:45 +02:00
|
|
|
providedIn: 'root',
|
2020-11-09 13:50:24 +01:00
|
|
|
})
|
2019-08-21 06:32:44 -07:00
|
|
|
export class MapSettingsService {
|
2021-04-12 13:15:45 +02:00
|
|
|
public symbolScalingSubject: Subject<boolean> = new Subject<boolean>();
|
2019-06-24 06:24:38 -07:00
|
|
|
|
2021-04-12 13:15:45 +02:00
|
|
|
public isScrollDisabled = new Subject<boolean>();
|
|
|
|
public isMapLocked = new Subject<boolean>();
|
|
|
|
public isTopologySummaryVisible: boolean = true;
|
|
|
|
public isLogConsoleVisible: boolean = false;
|
|
|
|
public isLayerNumberVisible: boolean = false;
|
|
|
|
public logConsoleSubject = new Subject<boolean>();
|
|
|
|
public mapRenderedEmitter = new EventEmitter<boolean>();
|
2021-04-30 01:08:48 +02:00
|
|
|
public openReadme: boolean;
|
2021-04-12 13:15:45 +02:00
|
|
|
public showInterfaceLabels: boolean = true;
|
|
|
|
public integrateLinkLabelsToLinks: boolean = true;
|
2021-05-11 14:57:42 +02:00
|
|
|
public openConsolesInWidget: boolean = false;
|
2020-07-13 17:28:35 +02:00
|
|
|
|
2021-04-12 13:15:45 +02:00
|
|
|
constructor() {
|
|
|
|
this.isLayerNumberVisible = localStorage.getItem('layersVisibility') === 'true' ? true : false;
|
|
|
|
if (localStorage.getItem('integrateLinkLabelsToLinks'))
|
|
|
|
this.integrateLinkLabelsToLinks = localStorage.getItem('integrateLinkLabelsToLinks') === 'true' ? true : false;
|
2021-05-11 14:57:42 +02:00
|
|
|
if (localStorage.getItem('openConsolesInWidget'))
|
|
|
|
this.openConsolesInWidget = localStorage.getItem('openConsolesInWidget') === 'true' ? true : false;
|
2021-04-12 13:15:45 +02:00
|
|
|
let isSymbolScalingEnabled = true;
|
|
|
|
if (localStorage.getItem('symbolScaling')) {
|
|
|
|
isSymbolScalingEnabled = localStorage.getItem('symbolScaling') === 'true' ? true : false;
|
|
|
|
} else {
|
|
|
|
localStorage.setItem('symbolScaling', 'true');
|
2019-06-24 06:24:38 -07:00
|
|
|
}
|
2021-04-30 01:08:48 +02:00
|
|
|
|
|
|
|
if (localStorage.getItem('openReadme')) {
|
|
|
|
this.openReadme = localStorage.getItem('openReadme') === 'true' ? true : false;
|
|
|
|
} else {
|
|
|
|
localStorage.setItem('openReadme', 'false');
|
|
|
|
}
|
2021-04-12 13:15:45 +02:00
|
|
|
}
|
2019-08-21 06:32:44 -07:00
|
|
|
|
2021-04-12 13:15:45 +02:00
|
|
|
public getSymbolScaling(): boolean {
|
|
|
|
return localStorage.getItem('symbolScaling') === 'true' ? true : false;
|
|
|
|
}
|
2020-09-22 18:01:31 +02:00
|
|
|
|
2021-04-12 13:15:45 +02:00
|
|
|
public setSymbolScaling(value: boolean) {
|
|
|
|
if (value) {
|
|
|
|
localStorage.setItem('symbolScaling', 'true');
|
|
|
|
} else {
|
|
|
|
localStorage.setItem('symbolScaling', 'false');
|
2020-09-22 18:01:31 +02:00
|
|
|
}
|
2021-04-12 13:15:45 +02:00
|
|
|
this.symbolScalingSubject.next(value);
|
|
|
|
}
|
2020-09-22 18:01:31 +02:00
|
|
|
|
2021-04-12 13:15:45 +02:00
|
|
|
changeMapLockValue(value: boolean) {
|
|
|
|
this.isMapLocked.next(value);
|
|
|
|
}
|
2019-08-26 05:17:50 -07:00
|
|
|
|
2021-04-12 13:15:45 +02:00
|
|
|
setConsoleContextMenuAction(action: string) {
|
|
|
|
localStorage.setItem('consoleContextMenu', action);
|
|
|
|
}
|
2019-09-06 08:18:26 -07:00
|
|
|
|
2021-04-12 13:15:45 +02:00
|
|
|
getConsoleContextManuAction(): string {
|
|
|
|
return localStorage.getItem('consoleContextMenu');
|
|
|
|
}
|
2019-10-23 03:00:40 -07:00
|
|
|
|
2021-04-12 13:15:45 +02:00
|
|
|
toggleTopologySummary(value: boolean) {
|
|
|
|
this.isTopologySummaryVisible = value;
|
|
|
|
}
|
2020-08-06 15:20:28 +02:00
|
|
|
|
2021-04-12 13:15:45 +02:00
|
|
|
toggleLogConsole(value: boolean) {
|
|
|
|
this.isLogConsoleVisible = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
toggleLayers(value: boolean) {
|
|
|
|
this.isLayerNumberVisible = value;
|
|
|
|
}
|
2020-10-22 00:18:56 +02:00
|
|
|
|
2021-04-12 13:15:45 +02:00
|
|
|
toggleShowInterfaceLabels(value: boolean) {
|
|
|
|
this.showInterfaceLabels = value;
|
|
|
|
}
|
2020-08-06 15:20:28 +02:00
|
|
|
|
2021-04-12 13:15:45 +02:00
|
|
|
toggleIntegrateInterfaceLabels(value: boolean) {
|
|
|
|
this.integrateLinkLabelsToLinks = value;
|
|
|
|
localStorage.removeItem('integrateLinkLabelsToLinks');
|
|
|
|
if (value) {
|
|
|
|
localStorage.setItem('integrateLinkLabelsToLinks', 'true');
|
|
|
|
} else {
|
|
|
|
localStorage.setItem('integrateLinkLabelsToLinks', 'false');
|
2020-10-22 00:18:56 +02:00
|
|
|
}
|
2021-04-12 13:15:45 +02:00
|
|
|
}
|
2021-04-16 12:51:51 +02:00
|
|
|
|
|
|
|
toggleOpenReadme(value: boolean) {
|
2021-05-13 16:01:23 +02:00
|
|
|
this.openReadme = value;
|
|
|
|
localStorage.removeItem('openReadme');
|
|
|
|
if (value) {
|
|
|
|
localStorage.setItem('openReadme', 'true');
|
|
|
|
} else {
|
|
|
|
localStorage.setItem('openReadme', 'false');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-11 14:57:42 +02:00
|
|
|
toggleOpenConsolesInWidget(value: boolean) {
|
|
|
|
this.openConsolesInWidget = value;
|
|
|
|
localStorage.removeItem('openConsolesInWidget');
|
|
|
|
if (value) {
|
|
|
|
localStorage.setItem('openConsolesInWidget', 'true');
|
|
|
|
} else {
|
|
|
|
localStorage.setItem('openConsolesInWidget', 'false');
|
|
|
|
}
|
2021-04-16 12:51:51 +02:00
|
|
|
}
|
2019-06-24 06:24:38 -07:00
|
|
|
}
|