import type { AABB, DisplayObject, TextStyleProps } from '@antv/g';
import type { BaseShape, BaseShapeStyleProps } from '../elements/shapes';
import type { Combo, Edge, Element, Node, NodePortStyleProps, Placement, Point, TriangleDirection } from '../types';
import type { NodeLabelStyleProps, Port } from '../types/node';
/**
* 判断是否是 Node 的实例
*
* Judge whether the instance is Node
* @param shape - 实例 | instance
* @returns 是否是 Node 的实例 | whether the instance is Node
*/
export declare function isNode(shape: DisplayObject | Port): shape is Node;
/**
* 判断是否是 Edge 的实例
*
* Judge whether the instance is Edge
* @param shape - 实例 | instance
* @returns 是否是 Edge 的实例 | whether the instance is Edge
*/
export declare function isEdge(shape: DisplayObject): shape is Edge;
/**
* 判断是否是 Combo 的实例
*
* Judge whether the instance is Combo
* @param shape - 实例 | instance
* @returns 是否是 Combo 的实例 | whether the instance is Combo
*/
export declare function isCombo(shape: any): shape is Combo;
/**
* 判断是否是 Element 的实例
*
* Judge whether the instance is Element
* @param shape - 实例 | instance
* @returns 是否是 Element 的实例 | whether the instance is Element
*/
export declare function isElement(shape: any): shape is Element;
/**
* 判断两个节点是否相同
*
* Whether the two nodes are the same
* @param node1 - 节点1 | Node1
* @param node2 - 节点2 | Node2
* @returns 是否相同 | Whether the same
*/
export declare function isSameNode(node1: Node, node2: Node): boolean;
/**
* Get the Port x, y by `position`.
* @param bbox - BBox of element.
* @param placement - The position relative with element.
* @param portMap - The map of position.
* @param isRelative - Whether the position in MAP is relative.
* @returns [x, y]
*/
export declare function getPortXYByPlacement(bbox: AABB, placement?: Placement, portMap?: Record, isRelative?: boolean): Point;
/**
* 获取节点上的所有连接桩
*
* Get all ports
* @param node - 节点 | Node
* @returns 所有连接桩 | All Ports
*/
export declare function getAllPorts(node: Node): Record;
/**
* 是否为简单连接桩,如果是则不会额外绘制图形
*
* Whether it is a simple port, which will not draw additional graphics
* @param portStyle - 连接桩样式 | Port Style
* @returns 是否是简单连接桩 | Whether it is a simple port
*/
export declare function isSimplePort(portStyle: NodePortStyleProps): boolean;
/**
* 获取连接桩的位置
*
* Get the position of the port
* @param port - 连接桩 | Port
* @returns 连接桩的位置 | Port Position
*/
export declare function getPortPosition(port: Port): Point;
/**
* 查找起始连接桩和目标连接桩
*
* Find the source port and target port
* @param sourceNode - 起始节点 | Source Node
* @param targetNode - 目标节点 | Target Node
* @param sourcePortKey - 起始连接桩的 key | Source Port Key
* @param targetPortKey - 目标连接桩的 key | Target Port Key
* @returns 起始连接桩和目标连接桩 | Source Port and Target Port
*/
export declare function findPorts(sourceNode: Node, targetNode: Node, sourcePortKey?: string, targetPortKey?: string): [Port | undefined, Port | undefined];
/**
* 查找节点上的最有可能连接的连接桩
*
* Find the most likely connected port on the node
* @remarks
* 1. If `portKey` is specified, return the port.
* 2. If `portKey` is not specified, return the port closest to the opposite connection points.
* 3. If the node has no ports, return undefined.
* @param node - 节点 | Node
* @param oppositeNode - 对端节点 | Opposite Node
* @param portKey - 连接桩的键值(key) | Port Key
* @param oppositePortKey - 对端连接桩的 key | Opposite Port Key
* @returns 连接桩 | Port
*/
export declare function findPort(node: Node, oppositeNode: Node, portKey?: string, oppositePortKey?: string): Port | undefined;
/**
* 获取连接点, 即从节点或连接桩中心到另一端的连线在节点或连接桩边界上的交点
*
* Get the connection point
* @param node - 节点或连接桩 | Node or Port
* @param opposite - 对端的具体点或节点 | Opposite Point or Node
* @returns 连接点 | Connection Point
*/
export declare function getConnectionPoint(node: Port | Node | Combo, opposite: Node | Port): Point;
/**
* 获取连接桩的连接点,即从连接桩中心到另一端的连线在连接桩边界上的交点
*
* Get the connection point of the port
* @param port - 连接桩 | Port
* @param opposite - 对端的具体点或节点 | Opposite Point or Node
* // @param oppositePort - 对端连接桩 | Opposite Port
* @returns 连接桩的连接点 | Port Point
*/
export declare function getPortConnectionPoint(port: Port, opposite: Node | Port): Point;
/**
* 获取节点的连接点
*
* Get the Node Connection Point
* @param nodeLike - 节点或组合 | Node or Combo
* @param opposite - 对端的具体点或节点 | Opposite Point or Node
* // @param oppositePort - 对端连接桩 | Opposite Port
* @returns 节点的连接点 | Node Point
*/
export declare function getNodeConnectionPoint(nodeLike: Node | Combo, opposite: Node | Port): Point;
/**
* Get the Text style by `position`.
* @param bbox - BBox of element.
* @param placement - The position relative with element.
* @param offsetX - The offset x.
* @param offsetY - The offset y.
* @param isReverseBaseline - Whether reverse the baseline.
* @returns Partial
*/
export declare function getTextStyleByPlacement(bbox: AABB, placement?: NodeLabelStyleProps['placement'], offsetX?: number, offsetY?: number, isReverseBaseline?: boolean): Partial;
/**
* 获取五角星的顶点
*
* Get Star Points
* @param outerR - 外半径 | outer radius
* @param innerR - 内半径 | inner radius
* @returns 五角星的顶点 | Star Points
*/
export declare function getStarPoints(outerR: number, innerR: number): Point[];
/**
* Get Star Port Point.
* @param outerR - outer radius
* @param innerR - inner radius
* @returns Port points for Star.
*/
export declare function getStarPorts(outerR: number, innerR: number): Record;
/**
* 获取三角形的顶点
*
* Get the points of a triangle
* @param width - 宽度 | width
* @param height - 高度 | height
* @param direction - 三角形的方向 | The direction of the triangle
* @returns 矩形的顶点 | The points of a rectangle
*/
export declare function getTrianglePoints(width: number, height: number, direction: TriangleDirection): Point[];
/**
* 获取三角形的连接桩
*
* Get the Ports of Triangle.
* @param width - 宽度 | width
* @param height - 高度 | height
* @param direction - 三角形的方向 | The direction of the triangle
* @returns 三角形的连接桩 | The Ports of Triangle
*/
export declare function getTrianglePorts(width: number, height: number, direction: TriangleDirection): Record;
/**
* 获取矩形的顶点
*
* Get the points of a rectangle
* @param width - 宽度 | width
* @param height - 高度 | height
* @returns 矩形的顶点 | The points of a rectangle
*/
export declare function getBoundingPoints(width: number, height: number): Point[];
/**
* Get Diamond PathArray.
* @param width - diamond width
* @param height - diamond height
* @returns The PathArray for G
*/
export declare function getDiamondPoints(width: number, height: number): Point[];
/**
* 元素是否可见
*
* Whether the element is visible
* @param element - 元素 | element
* @returns 是否可见 | whether the element is visible
*/
export declare function isVisible(element: DisplayObject): boolean;
/**
* 设置元素属性(优化性能)
*
* Set element attributes (optimize performance)
* @param element - 元素 | element
* @param style - 样式 | style
*/
export declare function setAttributes(element: BaseShape, style: Partial & Record): void;
/**
* 更新图形样式
*
* Update shape style
* @param shape - 图形 | shape
* @param style - 样式 | style
*/
export declare function updateStyle(shape: T, style: Record): void;
/**
* Get Hexagon PathArray
* @param outerR - 外接圆半径 | the radius of circumscribed circle
* @returns The PathArray for G
*/
export declare function getHexagonPoints(outerR: number): Point[];
/**
* 将图形标记为即将销毁,用于在 element controller 中识别要销毁的元素
*
* Mark the element as to be destroyed, used to identify the element to be destroyed in the element controller
* @param element - 图形 | element
*/
export declare function markToBeDestroyed(element: DisplayObject): void;
/**
* 判断图形是否即将销毁
*
* Determine whether the element is to be destroyed
* @param element - 图形 | element
* @returns 是否即将销毁 | whether the element is to be destroyed
*/
export declare function isToBeDestroyed(element: DisplayObject): any;