/** * @author Martin Karkowski * @email m.karkowski@zema.de * @create date 2020-03-11 16:24:48 * @modify date 2020-03-31 17:59:26 * @desc [description] */ import { IClusters } from './/IClusters'; import { EventEmitter } from 'events'; import { IBaseNodeOptions } from './/IBaseNodeOptions'; import { IBaseEdgeOptions } from './/IBaseEdgeOptions'; import { INetwork } from './/INetwork'; import { IEvent } from './IEvents'; export interface IBaseGraph { /** * The Original VISJS Network */ network: any; /** * Contained Edges */ edges: Array>; /** * Contained Nodes */ nodes: Array>; /** * Contained Data */ data: { edges: any; nodes: any; } /** * Flag to enable / disable the Version Control of Files */ useVersionControl: boolean; /** * The current Version to handle. */ version: string; /** * Emitter */ emitter: EventEmitter; /** * Function to add Node(s) * @param nodes The Node/Nodes */ addNode(nodes: Array> | IBaseNodeOptions): void; /** * Function to Remove a Node * @param id */ removeNode(id: string | number): void; /** * Function to update Node(s) * @param nodes The Node/Nodes */ updateNode(nodes: Array> | IBaseNodeOptions): void; /** * Function to Delete all Nodes */ clearNodes(): void; /** * Function to Get a Node * @param id The Id of the Node */ getNode(id): IBaseNodeOptions; /** * Function to Test, whether the Node exists or not * @param id The Id of the Node */ hasNode(id: string): boolean; /** * Function to add Edge(s) * @param element The Edge(s) */ addEdge(element: Array> | IBaseEdgeOptions): void; /** * Function to Remove the Edge with the given ID * @param id Id of the Edge */ removeEdge(id: string | number): void; /** * Function to Update Edge(s) * @param edges The Updated Content */ updateEdge(edges: Array> | IBaseEdgeOptions): void; /** * Function to delete all Edges */ clearEdges(): void; /** * Function to Get the Edge with the given ID * @param id The Id of the Edge */ getEdge(id): IBaseEdgeOptions /** * Clear the Complete Graph */ clear(): void; /** * Destroy the Graph */ destroy(): void; /** * Fit the Graph * @param options Settings for the Fitting */ fit(options?: { /** Focus the provided Nodes */ nodes?: Array, /** Animate the Fit */ animation?: boolean | { duration?: number, easingFunction?: String } }): void; /** * Function to resize the Element. */ resize(): void; /** * Function, to subscribe to Events * @param eventName Event * @param callback The Callback (see original VISJS Docu) */ on(eventName: IEvent, callback: (...args) => void): () => void; /** * Function, to subscribe to Events but just for one notification * @param eventName Event * @param callback The Callback (see original VISJS Docu) */ once(eventName: IEvent, callback: (...args) => void): () => void; /** * Function to get Cluster-Structure */ getClusters(): IClusters; /** * Function to Load a Cluster-Structure * @param clusters the Cluster-Structure */ readinClusters(clusters: IClusters): void; /** * Function to get the current Graph Data */ getData(name?: string, id?: string, version?: string): INetwork /** * Function to Load / Import the Graph * @param data The Graph Structure * @param overwrite Flag, to overwrite the old Graph or extend it * @param cluster Flag, to determine, whether to load Clusters or not. */ loadData(data: INetwork, overwrite?: boolean, cluster?: boolean): void; } export interface IUndoRedoGraph extends IBaseGraph { /** * Flag to Toggle Loading and disabling * Elements */ disableStoringContent: boolean; /** * Flag, showing whether Undo is Enabled or not */ undoEnabled: boolean; /** * Flag, showing whether Redo is Enabled or not */ redoEnabled: boolean; /** * Function to Save the Current State */ save(): void; /** * Function to Undo the Last Change */ undo(): void; /** * Function to Redo the Last Change */ redo():void; /** * Reset the Complete History */ resetHistory():void; }