An error occurred while loading the file. Please try again.
-
Mathias Chouet authoredff37917e
import { Component, Input, Output, EventEmitter, OnInit, AfterViewInit, ViewChild, Inject, forwardRef, AfterContentInit } from "@angular/core";
import { MatDialog } from "@angular/material/dialog";
import {
PreBarrage, PbBassin, PbBassinParams, PbCloison, CreateStructure, LoiDebit, Structure, Observer, IObservable
} from "jalhyd";
import * as mermaid from "mermaid";
import { I18nService } from "../../services/internationalisation.service";
import { PbSchema } from "../../formulaire/elements/pb-schema";
import { DialogNewPbCloisonComponent } from "../dialog-new-pb-cloison/dialog-new-pb-cloison.component";
import { GenericCalculatorComponent } from "../generic-calculator/calculator.component";
/**
* The interactive schema for calculator type "PreBarrage" (component)
*/
@Component({
selector: "pb-schema",
templateUrl: "./pb-schema.component.html",
styleUrls: [
"./pb-schema.component.scss"
]
})
export class PbSchemaComponent implements AfterViewInit, AfterContentInit, OnInit, Observer {
@Input()
private pbSchema: PbSchema;
@ViewChild("schema", { static: true })
public schema: any;
/** handle on SVG container */
private nativeElement: any;
/** flag de validité du composant */
private _isValid = false;
private upstreamId = "amont";
private downstreamId = "aval";
/** événément de changement de validité */
@Output()
private validChange = new EventEmitter();
/** événément de sélection d'un nœud du graphique Mermaid */
@Output()
private nodeSelected = new EventEmitter();
/** underlying PB */
private model: PreBarrage;
/** Latest clicked item: a PbCloison, a PbBassin or undefined if river "Upstream" or "Downstream" was clicked */
private _selectedItem: PbCloison | PbBassin;
/** Records existing walls as they are built, to detect if multiple walls connect the same pair of basins */
private existingWalls: { [key: string]: number };
/** Stores appropriate number suffix for a given wall uid (related to existingWalls above) */
private wallsSuffixes: { [key: string]: number };
public constructor(
@Inject(forwardRef(() => GenericCalculatorComponent)) private calculatorComponent: GenericCalculatorComponent,
private i18nService: I18nService,
private newPbCloisonDialog: MatDialog
) { }
public get selectedItem(): any {
return this._selectedItem;