File

src/services/panelsEventEmitter.service.ts

Index

Properties
Methods

Constructor

constructor(localStoragePersister: LocalStoragePersister)
Parameters :
Name Type Optional
localStoragePersister LocalStoragePersister No

Methods

clearRowOnTablePanel
clearRowOnTablePanel()

The function "clearRowOnTablePanel" emits an event to clear a row on a table panel.

Returns : void
dataPanelOpen
dataPanelOpen()

The dataPanelOpen function emits an event to indicate that the data panel should be opened.

Returns : void
dataPanelToggle
dataPanelToggle()

The dataPanelToggle function emits an event to toggle the data panel.

Returns : void
graphPanelOpen
graphPanelOpen(id: string, newSelected: boolean)

The function graphPanelOpen emits events to open a graph panel and update the selected state. panel. It is used to uniquely identify the graph panel that needs to be opened or modified. a new item has been selected.

Parameters :
Name Type Optional Description
id string No
  • The id parameter is a string that represents the identifier of the graph panel. It is used to uniquely identify the graph panel that needs to be opened or modified.
newSelected boolean No
  • The newSelected parameter is a boolean value that indicates whether a new item has been selected.
Returns : void
graphPanelToggle
graphPanelToggle(id: string, newSelected: boolean)

The function graphPanelToggle emits events to toggle a graph panel and update the selected state. new item has been selected or not.

Parameters :
Name Type Optional Description
id string No
  • A string representing the ID of the graph panel that needs to be toggled.
newSelected boolean No
  • The newSelected parameter is a boolean value that indicates whether a new item has been selected or not.
Returns : void
layerControlPanel
layerControlPanel()

The function "layerControlPanel" emits an event to invoke the layer control panel.

Returns : void
selectItem
selectItem(id: string)

The selectItem function emits an event with the provided id as a parameter. needs to be selected.

Parameters :
Name Type Optional Description
id string No
  • The id parameter is a string that represents the identifier of the item that needs to be selected.
Returns : void
selectRowOnTablePanel
selectRowOnTablePanel(id: string, feature: string)

The function "selectRowOnTablePanel" emits events to toggle a table panel and select a row on the table. action related to a row in a table.

Parameters :
Name Type Optional Description
id string No
  • The id parameter is a string that represents the identifier of the table panel.
feature string No
  • The "feature" parameter is a string that represents a specific feature or action related to a row in a table.
Returns : void
Public setTimeSeriesPopupLayerIdUrl
setTimeSeriesPopupLayerIdUrl(layerId: string, url: string | null)

The function sets the URL for a time series popup layer and updates the local storage with the layer ID. series popup layer. series popup layer. It can be either a valid URL or null if there is no URL associated with the layer.

Parameters :
Name Type Optional Description
layerId string No
  • The layerId parameter is a string that represents the identifier of a time series popup layer.
url string | null No
  • The url parameter is a string that represents the URL of a time series popup layer. It can be either a valid URL or null if there is no URL associated with the layer.
Returns : void
setTogglePanelRef
setTogglePanelRef(togglePanel: MatExpansionPanel)

The function sets a reference to a Material Expansion Panel. is used to reference the MatExpansionPanel component that you want to set.

Parameters :
Name Type Optional Description
togglePanel MatExpansionPanel No
  • The togglePanel parameter is of type MatExpansionPanel. It is used to reference the MatExpansionPanel component that you want to set.
Returns : void
tablePanelToggle
tablePanelToggle(id: string, newSelected: boolean)

The function tablePanelToggle emits events to toggle a table panel and update the selected state. new item has been selected or not.

Parameters :
Name Type Optional Description
id string No
  • The id parameter is a string that represents the identifier of the table panel.
newSelected boolean No
  • The newSelected parameter is a boolean value that indicates whether a new item has been selected or not.
Returns : void
visibleOn
visibleOn(viewType: ViewType)

The function "visibleOn" emits an event to pass the view type of the visible on that triggered it (just 'Map' up to now).

Parameters :
Name Type Optional
viewType ViewType No
Returns : void

Properties

invokeClearRowOnTable
Default value : new EventEmitter()
invokeDataPanelOpen
Default value : new EventEmitter()
invokeDataPanelToggle
Default value : new EventEmitter()
invokeGraphDialogClose
Default value : new EventEmitter()
invokeGraphPanel
Default value : new EventEmitter()
invokeGraphPanelClose
Default value : new EventEmitter()
invokeGraphPanelOpen
Default value : new EventEmitter()
invokeGraphPanelToggle
Default value : new EventEmitter()
invokeLayerControlPanel
Default value : new EventEmitter()
invokeNewSelected
Default value : new EventEmitter()
invokeRowOnTable
Default value : new EventEmitter()
invokeSelectItem
Default value : new EventEmitter()
invokeTableDialogClose
Default value : new EventEmitter()
invokeTablePanel
Default value : new EventEmitter()
invokeTablePanelClose
Default value : new EventEmitter()
invokeTablePanelToggle
Default value : new EventEmitter()
invokeVisibleOn
Default value : new EventEmitter()
subscription
Type : Subscription
Public timeSeriesPopupLayerIdUrlObs
Default value : this.timeSeriesPopupLayerIdUrlSrc.asObservable()
Private timeSeriesPopupLayerIdUrlSrc
Default value : new Subject<[string, string | null]>()
togglePanel
Type : MatExpansionPanel
import { Injectable, EventEmitter } from '@angular/core';
import { MatExpansionPanel } from '@angular/material/expansion';
import { Subject } from 'rxjs';
import { Subscription } from 'rxjs/internal/Subscription';
import { LocalStoragePersister } from './model/persisters/localStoragePersister';
import { LocalStorageVariables } from './model/persisters/localStorageVariables.enum';
import { ViewType } from 'api/webApi/data/viewType.enum';

@Injectable()
export class PanelsEmitterService {

  invokeTablePanelToggle = new EventEmitter();
  invokeRowOnTable = new EventEmitter();
  invokeClearRowOnTable = new EventEmitter();
  invokeTablePanel = new EventEmitter();
  invokeTablePanelClose = new EventEmitter();
  invokeGraphPanelToggle = new EventEmitter();
  invokeGraphPanel = new EventEmitter();
  invokeGraphPanelOpen = new EventEmitter();
  invokeGraphPanelClose = new EventEmitter();
  invokeNewSelected = new EventEmitter();
  invokeSelectItem = new EventEmitter();
  invokeDataPanelOpen = new EventEmitter();
  invokeDataPanelToggle = new EventEmitter();
  invokeLayerControlPanel = new EventEmitter();
  invokeTableDialogClose = new EventEmitter();
  invokeGraphDialogClose = new EventEmitter();
  invokeVisibleOn = new EventEmitter();

  subscription: Subscription;
  togglePanel: MatExpansionPanel;

  private timeSeriesPopupLayerIdUrlSrc = new Subject<[string, string | null]>();
  // eslint-disable-next-line @typescript-eslint/member-ordering
  public timeSeriesPopupLayerIdUrlObs = this.timeSeriesPopupLayerIdUrlSrc.asObservable();

  constructor(
    private readonly localStoragePersister: LocalStoragePersister,
  ) { }

  /**
   * The function `tablePanelToggle` emits events to toggle a table panel and update the selected state.
   * @param {string} id - The id parameter is a string that represents the identifier of the table panel.
   * @param {boolean} newSelected - The newSelected parameter is a boolean value that indicates whether a
   * new item has been selected or not.
   */
  tablePanelToggle(id: string, newSelected: boolean): void {
    this.invokeTablePanelToggle.emit(id);
    this.invokeNewSelected.emit(newSelected);
    this.invokeTablePanel.emit();
  }

  /**
   * The function `graphPanelToggle` emits events to toggle a graph panel and update the selected state.
   * @param {string} id - A string representing the ID of the graph panel that needs to be toggled.
   * @param {boolean} newSelected - The newSelected parameter is a boolean value that indicates whether a
   * new item has been selected or not.
   */
  graphPanelToggle(id: string, newSelected: boolean): void {
    this.invokeGraphPanelToggle.emit(id);
    this.invokeNewSelected.emit(newSelected);
  }

  /**
   * The function `graphPanelOpen` emits events to open a graph panel and update the selected state.
   * @param {string} id - The `id` parameter is a string that represents the identifier of the graph
   * panel. It is used to uniquely identify the graph panel that needs to be opened or modified.
   * @param {boolean} newSelected - The `newSelected` parameter is a boolean value that indicates whether
   * a new item has been selected.
   */
  graphPanelOpen(id: string, newSelected: boolean): void {
    this.invokeGraphPanelOpen.emit(id);
    this.invokeNewSelected.emit(newSelected);
  }

  /**
   * The function "selectRowOnTablePanel" emits events to toggle a table panel and select a row on the
   * table.
   * @param {string} id - The id parameter is a string that represents the identifier of the table panel.
   * @param {string} feature - The "feature" parameter is a string that represents a specific feature or
   * action related to a row in a table.
   */
  selectRowOnTablePanel(id: string, feature: string): void {
    this.invokeTablePanelToggle.emit(id);
    this.invokeRowOnTable.emit(feature);
  }

  /**
   * The function "clearRowOnTablePanel" emits an event to clear a row on a table panel.
   */
  clearRowOnTablePanel(): void {
    this.invokeClearRowOnTable.emit();
  }
  /**
   * The function "visibleOn" emits an event to pass the view type of the visible on that triggered it (just 'Map' up to now).
   */
  visibleOn(viewType: ViewType): void{
    this.invokeVisibleOn.emit(viewType);
  }

  /**
   * The selectItem function emits an event with the provided id as a parameter.
   * @param {string} id - The id parameter is a string that represents the identifier of the item that
   * needs to be selected.
   */
  selectItem(id: string): void {
    this.invokeSelectItem.emit(id);
  }

  /**
   * The dataPanelOpen function emits an event to indicate that the data panel should be opened.
   */
  dataPanelOpen(): void {
    this.invokeDataPanelOpen.emit();
  }

  /**
   * The dataPanelToggle function emits an event to toggle the data panel.
   */
  dataPanelToggle(): void {
    this.invokeDataPanelToggle.emit();
  }

  /**
   * The function sets a reference to a Material Expansion Panel.
   * @param {MatExpansionPanel} togglePanel - The togglePanel parameter is of type MatExpansionPanel. It
   * is used to reference the MatExpansionPanel component that you want to set.
   */
  setTogglePanelRef(togglePanel: MatExpansionPanel): void {
    this.togglePanel = togglePanel;
  }
  /**
   * The function "layerControlPanel" emits an event to invoke the layer control panel.
   */
  layerControlPanel(): void {
    this.invokeLayerControlPanel.emit();
  }

  /**
   * The function sets the URL for a time series popup layer and updates the local storage with the layer
   * ID.
   * @param {string} layerId - The layerId parameter is a string that represents the identifier of a time
   * series popup layer.
   * @param {string | null} url - The `url` parameter is a string that represents the URL of a time
   * series popup layer. It can be either a valid URL or `null` if there is no URL associated with the
   * layer.
   */
  public setTimeSeriesPopupLayerIdUrl(layerId: string, url: string | null): void {
    this.timeSeriesPopupLayerIdUrlSrc.next([layerId, url]);
    this.localStoragePersister.set(LocalStorageVariables.LS_CONFIGURABLES, layerId, false, LocalStorageVariables.LS_TS_POPUP_LAYER_ID);
  }
}

results matching ""

    No results matching ""