import { Point } from '../../util/canvas-util'; import { LineShape, LineStyle } from '../../util/line'; import { Side } from '../../util/svg-util'; import { ConnectionTypeConfig, FieldConfig } from '../config/diagram-config'; import { ConnectionLook, ConnectionLookConfig, MarkerImageLook, MarkerImageLookConfig } from '../config/diagram-look-config'; import { PropertySet } from '../property/property'; import { ValueSet } from '../property/value'; import { DiagramElement, DiagramElementSet } from './diagram-element'; import { DiagramEntity, DiagramEntitySet } from './diagram-entity'; import { DiagramModel } from './diagram-model'; import { DiagramPort } from './diagram-port'; /** * Default values of the parameters of a diagram connection. * @private * @see DiagramConnection */ export declare const DIAGRAM_CONNECTION_TYPE_DEFAULTS: { name: string; label: null; look: { color: string; thickness: number; shape: LineShape; style: LineStyle; selected: { color: string; }; highlighted: { thickness: number; }; }; startMarkerLook: undefined; endMarkerLook: undefined; startTypes: never[]; endTypes: never[]; properties: never[]; }; /** * The types allowed for the look of the markers of a connection. * @public * @see Look * @see DiagramConnection */ export type ConnectionMarkerLook = MarkerImageLook; /** * A connection type, which holds properties that connections of this type share in common. * @public * @see ConnectionTypeConfig */ export declare class DiagramConnectionType implements DiagramEntity { id: string; name: string; label: FieldConfig | null; defaultLook: ConnectionLook; selectedLook: ConnectionLook; highlightedLook: ConnectionLook; selectedAndHighlightedLook: ConnectionLook; defaultStartMarkerLook: ConnectionMarkerLook | null; selectedStartMarkerLook: ConnectionMarkerLook | null; highlightedStartMarkerLook: ConnectionMarkerLook | null; selectedAndHighlightedStartMarkerLook: ConnectionMarkerLook | null; defaultEndMarkerLook: ConnectionMarkerLook | null; selectedEndMarkerLook: ConnectionMarkerLook | null; highlightedEndMarkerLook: ConnectionMarkerLook | null; selectedAndHighlightedEndMarkerLook: ConnectionMarkerLook | null; startTypes: string[]; endTypes: string[]; propertySet: PropertySet; constructor(options: ConnectionTypeConfig); canStartFromType(type: string): boolean; canFinishOnType(type: string): boolean; } /** * A connection which goes from one port to another. * @public * @see DiagramPort */ export declare class DiagramConnection extends DiagramElement { #private; get type(): DiagramConnectionType; set type(type: DiagramConnectionType); get typeString(): string; set typeString(typeString: string); /** * Additional properties of this connection. * @public */ valueSet: ValueSet; /** * Variable used to preserve the original data of a connection when importing from a different format. * @public */ originalData: unknown; /** * Port that this connection starts from. * @public */ start?: DiagramPort; /** * Direction that this connection follows at its start. * @public */ startDirection?: Side; /** * Coordinates of the start point of this connection. * @public */ startCoords: Point; /** * Port that this connection ends at. * @public */ end?: DiagramPort; /** * Direction that this connection follows at its end. * @public */ endDirection?: Side; /** * Coordinates of the end point of this connection. * @public */ endCoords: Point; /** * Text at the start of this connection, or `''` if no text. * @public */ startLabel: string; /** * Text at the middle of this connection, or `''` if no text. * @public */ middleLabel: string; /** * Text at the end of this connection, or `''` if no text. * @public */ endLabel: string; /** * Points that this connection must pass through in its route from its start point to its end point, in order. * @public */ points: Point[]; /** * Name of this connection. Alias for this connection's middle label. * @public */ get name(): string; set name(name: string); private _lookConfig?; private _defaultLook?; private _selectedLook?; private _highlightedLook?; private _selectedAndHighlightedLook?; /** * Current look of the connection. * @private */ get look(): ConnectionLook; /** * An alias for the `lookConfig` attribute. * @private */ set look(look: ConnectionLookConfig | undefined); /** * Look configuration used to derive the current look of this connection. * @private */ get lookConfig(): ConnectionLookConfig | undefined; /** * Sets the look configuration of the connection to override the one determined by the type. * `undefined` resets it to the one determined by the type. * @private */ set lookConfig(lookConfig: ConnectionLookConfig | undefined); private _startMarkerLookConfig?; private _defaultStartMarkerLook?; private _selectedStartMarkerLook?; private _highlightedStartMarkerLook?; private _selectedAndHighlightedStartMarkerLook?; /** * Current look of the start marker. * @private */ get startMarkerLook(): MarkerImageLook | null; /** * An alias for the `lookConfig` attribute. * @private */ set startMarkerLook(startMarkerLook: MarkerImageLookConfig | null | undefined); /** * Look configuration used to derive the current look of the start marker of this connection. * @private */ get startMarkerLookConfig(): MarkerImageLookConfig | null | undefined; /** * Sets the look configuration of the start marker to override the one determined by the type. * `null` stands for no marker and `undefined` resets it to the one determined by the type. * @private */ set startMarkerLookConfig(startMarkerLookConfig: MarkerImageLookConfig | null | undefined); private _endMarkerLookConfig?; private _defaultEndMarkerLook?; private _selectedEndMarkerLook?; private _highlightedEndMarkerLook?; private _selectedAndHighlightedEndMarkerLook?; /** * Current look of the end marker. * @private */ get endMarkerLook(): MarkerImageLook | null; /** * An alias for the `lookConfig` attribute. * @private */ set endMarkerLook(endMarkerLook: MarkerImageLookConfig | null | undefined); /** * Look configuration used to derive the current look of the end marker of this connection. * @private */ get endMarkerLookConfig(): MarkerImageLookConfig | null | undefined; /** * Sets the look configuration of the end marker to override the one determined by the type. * `null` stands for no marker and `undefined` resets it to the one determined by the type. * @private */ set endMarkerLookConfig(endMarkerLookConfig: MarkerImageLookConfig | null | undefined); constructor(model: DiagramModel, type: DiagramConnectionType, start: DiagramPort | undefined, end: DiagramPort | undefined, id: string); get removed(): boolean; updateInView(): void; raise(): void; /** * Set the start of this connection to the given port or reset this connection's starting port if `undefined`. * Add or remove this connection from the list of outgoing connections of ports correspondingly. * @public * @param start A port. */ setStart(start?: DiagramPort): void; /** * Set the end of this connection to the given port or reset this connection's ending port if `undefined`. * Add or remove this connection from the list of incoming connections of ports correspondingly. * @public * @param end A port. */ setEnd(end?: DiagramPort): void; /** * Reassign the start and end ports of this connection to ports with less distance between them that have the same root element. * If no ports with less distance between them are found, do nothing. * @public */ tighten(): void; getPriority(): number; } export declare class DiagramConnectionSet extends DiagramElementSet { #private; /** * Set of the possible types of connection that the connections of this set can have. * @public */ readonly types: DiagramEntitySet; /** * Instance a set of connections for the given model. This method is used internally. * @private */ constructor(model: DiagramModel); /** * Instance a new connection and add it to this set. * @public * @param type The type of the connection given as either the type itself or the id of the type. * @param start The start port of the connection. * @param end The end port of the connection. * @param id The id of the connection. Cannot be an empty string. * @returns The instanced connection. */ new(type: DiagramConnectionType | string, start: DiagramPort | undefined, end: DiagramPort | undefined, id: string): DiagramConnection; remove(id: string): void; }