import { EToolName } from '@/constant/tool'; export declare enum EStatus { /** 正在创建 */ Create = 0, /** 正在激活 */ Active = 1, /** 正在编辑, 撤销与激活状态合并 */ Edit = 1, /** 没有操作 */ None = 2 } export declare enum EColor { ActiveArea = "#B3B8FF" } export interface IProps { canvas: HTMLCanvasElement; size: ISize; historyChanged?: (undoEnabled: boolean, redoEnabled: boolean) => void; } /** 曲线分割点数 */ export declare const SEGMENT_NUMBER = 16; export declare const LINE_ORDER_OFFSET: { x: number; y: number; }; export interface IBasicLine { pointA: IPoint; pointB: IPoint; } /** 点半径 */ export declare const POINT_RADIUS = 3; export declare const POINT_ACTIVE_RADIUS = 5; /** 普通点内侧圆的半径 */ export declare const INNER_POINT_RADIUS = 2; declare class LineToolUtils { /** 为参考显示的线条设置样式 */ static setSpecialEdgeStyle: (ctx: CanvasRenderingContext2D) => void; /** 设置特殊边样式 */ static setReferenceCtx: (ctx: CanvasRenderingContext2D) => void; /** * 计算一条线跟多条线的交点,并找到最近距离最近的点 * @param pointList 点列表 * @param matchLine 需要计算交点的线条 * @param matchPoint 计算交点线条的起始点 * @param pointRadius 点的半径 */ static calcOptimalIntersection: (pointList: IPoint[] | ILinePoint[], matchLine: IBasicLine, matchPoint: ICoordinate, pointRadius: number, zoom: number) => { point: ICoordinate; minDistance?: undefined; } | { point: IPoint; minDistance: number; } | undefined; static lineIntersection: (lineA: IBasicLine, lineB: IBasicLine) => false | { x: number; y: number; onLine1: boolean; onLine2: boolean; }; static getAxisDiff: (line: IBasicLine) => { x: number; y: number; }; static calcDistance: (point1: IPoint, point2: IPoint) => number; static lineLengthSum(pointList: IPoint[]): number; static drawCurveLine: (ctx: any, points: ILinePoint[], config: any, applyLineWidth: boolean | undefined, isReference: boolean | undefined, hoverEdgeIndex: number) => void; static calcTwoPointDistance: (pointA: IPoint, pointB: IPoint) => number; /** * 计算在依赖物体目标内与当前线段的交点。 * 支持的依赖工具: 多边形,矩形。 * @param axis 当前鼠标的点 * @param preAxis 上一个标注点 * @param {EDependPattern} dependPattern 依赖模式 * @param dependData 依赖工具的数据 * @param dependConfig 依赖工具的配置 * @param imageSize 图片尺寸 * @param pointRadius 点的半径 * @param zoom 缩放比例 * @param getRenderAxis 转化为渲染坐标 * @param getAbsAxis 转化为绝对坐标 */ static pointOverTarget: (axis: ICoordinate, preAxis: ICoordinate, dependToolName: EToolName | undefined, dependData: any, dependConfig: any, imageSize: ISize, pointRadius: number, zoom: number, getRenderAxis: (coord: ICoordinate) => ICoordinate | ILinePoint, getAbsAxis: (coord: ICoordinate) => ICoordinate | ILinePoint) => ICoordinate; /** * 获取多边形的线段 * @param dependData 多边形数据 * @param dependConfig 多边形配置 */ static getPolygonPointList: (dependData: any, dependConfig: any) => any; static isInLine(checkPoint: ICoordinate, point1: IPoint, point2: IPoint, scope?: number): boolean; static isOnLine: (x: number, y: number, endX: number, endY: number, px: number, py: number) => boolean; static inArea: ({ top, left, right, bottom }: IRectArea, { x, y }: IPoint) => boolean; /** * 获取水平、垂直线的坐标点 * @param isStraight * @param lastPoint * @param nextPoint * @param absNextPoint * @param renderLastPoint */ static getVHPoint: (lastPoint: ICoordinate, nextPoint: ICoordinate, absNextPoint: ICoordinate, renderLastPoint: ICoordinate) => { y: number; x: number; }; static getAngle: (startPoint: ICoordinate, endPoint: ICoordinate) => number; } export default LineToolUtils;