@itwin/core-backend
Version:
iTwin.js backend components
94 lines • 4.19 kB
TypeScript
import { BeEvent, Id64String } from "@itwin/core-bentley";
import { GeometricElement3dProps, GeometryStreamProps } from "@itwin/core-common";
import { Point3d } from "@itwin/core-geometry";
import { GeometricElement3d, OnElementDependencyArg } from "../Element";
import { IModelDb } from "../IModelDb";
import { ElementDrivesElement, ElementDrivesElementProps, OnDependencyArg } from "../Relationship";
import { Schema } from "../Schema";
import { EditTxn } from "../EditTxn";
export declare class Graph<T> {
private _nodes;
private _edges;
constructor();
addNode(node: T): void;
nodes(): IterableIterator<T>;
edges(): IterableIterator<{
from: T;
to: T;
}>;
addEdge(from: T, to: T | T[]): void;
getEdges(node: T): T[];
clone(): Graph<T>;
toGraphvis(accessor: NodeAccessor<T>): string;
}
export interface NodeAccessor<T> {
getLabel: (node: T) => string;
getId: (node: T) => string;
}
export declare class TopologicalSorter {
private static visit;
static sortDepthFirst<T>(graph: Graph<T>, updated?: T[], failOnCycles?: boolean): T[];
static sortBreadthFirst<T>(graph: Graph<T>, updated?: T[], failOnCycles?: boolean): T[];
static validate<T>(graph: Graph<T>, sorted: T[]): boolean;
}
export interface InputDrivesOutputProps extends ElementDrivesElementProps {
prop: number;
}
export interface NodeElementProps extends GeometricElement3dProps {
op: string;
val: number;
}
export declare class InputDrivesOutput extends ElementDrivesElement {
static readonly events: {
onRootChanged: BeEvent<(arg: OnDependencyArg) => void>;
onDeletedDependency: BeEvent<(arg: OnDependencyArg) => void>;
};
static get className(): string;
protected constructor(props: InputDrivesOutputProps, iModel: IModelDb);
static onRootChangedArg(arg: OnDependencyArg): void;
static onDeletedDependencyArg(arg: OnDependencyArg): void;
}
export declare class NodeElement extends GeometricElement3d {
op: string;
val: number;
static readonly events: {
onAllInputsHandled: BeEvent<(arg: OnElementDependencyArg) => void>;
onBeforeOutputsHandled: BeEvent<(arg: OnElementDependencyArg) => void>;
};
static get className(): string;
protected constructor(props: NodeElementProps, iModel: IModelDb);
toJSON(): GeometricElement3dProps;
protected static onAllInputsHandledArg(arg: OnElementDependencyArg): void;
protected static onBeforeOutputsHandledArg(arg: OnElementDependencyArg): void;
static generateGeometry(radius: number): GeometryStreamProps;
static getCategory(iModelDb: IModelDb): import("../Element").Element;
}
export declare class NetworkSchema extends Schema {
static get schemaName(): string;
static registerSchema(): void;
static importSchema(iModel: IModelDb): Promise<void>;
}
export declare class Engine {
static createGraph(txn: EditTxn, modelId: Id64String, graph: Graph<string>): Promise<Graph<{
id: Id64String;
name: string;
}>>;
static countNodes(iModelDb: IModelDb): number;
static countEdges(iModelDb: IModelDb): number;
static queryEdgesForSource(iModelDb: IModelDb, sourceId: Id64String): InputDrivesOutputProps[];
static queryEdgesForTarget(iModelDb: IModelDb, targetId: Id64String): InputDrivesOutputProps[];
private static createPartition;
private static createModel;
private static createNodeCategory;
static initialize(txn: EditTxn): Promise<{
modelId: string;
categoryId: string;
}>;
static insertNode(txn: EditTxn, modelId: Id64String, name: string, op: string, val: number, location: Point3d, radius?: number): Promise<string>;
static deleteNode(txn: EditTxn, nodeId: Id64String): Promise<void>;
static updateNodeProps(txn: EditTxn, props: Partial<NodeElementProps>): Promise<void>;
static updateNode(txn: EditTxn, userLabel: string): Promise<void>;
static deleteEdge(txn: EditTxn, from: string, to: string): Promise<void>;
static insertEdge(txn: EditTxn, sourceId: Id64String, targetId: Id64String, prop: number): Promise<string>;
}
//# sourceMappingURL=ElementDrivesElement.test.d.ts.map