|
1 | 1 | import {
|
2 | 2 | Edge as IEdge,
|
3 | 3 | Graph as IGraph,
|
4 |
| - GraphView as IGraphView, |
5 | 4 | ID,
|
6 | 5 | Node as INode,
|
7 |
| - PlainObject, |
8 | 6 | } from '@antv/graphlib';
|
9 | 7 |
|
10 |
| -export interface NodeData extends PlainObject { |
11 |
| - size?: number | number[]; |
12 |
| - bboxSize?: number[]; |
13 |
| - borderLeft?: ID | ID[]; |
14 |
| - borderRight?: ID | ID[]; |
| 8 | +export interface NodeData { |
15 | 9 | x?: number;
|
16 | 10 | y?: number;
|
17 | 11 | z?: number;
|
18 |
| - height?: number; |
19 |
| - width?: number; |
20 |
| - e?: IEdge<EdgeData>; |
21 |
| - selfEdges?: IEdge<EdgeData>[]; |
22 |
| - rank?: number; |
23 |
| - _rank?: number; |
24 |
| - order?: number; |
25 |
| - fixorder?: number; |
26 |
| - minRank?: number; |
27 |
| - maxRank?: number; |
28 |
| - layout?: boolean; |
29 |
| - layer?: number; |
30 |
| - low?: number; |
31 |
| - lim?: number; |
| 12 | + size?: number | number[]; |
| 13 | + [key: string]: any; |
| 14 | +} |
| 15 | + |
| 16 | +export interface EdgeData { |
| 17 | + weight?: number; |
| 18 | + [keys: string]: any; |
32 | 19 | }
|
33 | 20 |
|
34 | 21 | export interface OutNodeData extends NodeData {
|
35 | 22 | x: number;
|
36 | 23 | y: number;
|
37 |
| - z?: number; |
38 | 24 | }
|
39 | 25 |
|
40 |
| -export interface EdgeData extends PlainObject { |
41 |
| - // temp edges e.g. the edge generated for releated collapsed combo |
42 |
| - virtual?: boolean; |
43 |
| - weight?: number; |
44 |
| - x?: number; |
45 |
| - y?: number; |
46 |
| - height?: number; |
47 |
| - width?: number; |
48 |
| - points?: Point[]; |
49 |
| - controlPoints?: Point[]; |
50 |
| - minlen?: number; |
51 |
| - cutvalue?: number; |
52 |
| - labeloffset?: number; |
53 |
| -} |
| 26 | +export interface OutEdgeData extends EdgeData {} |
54 | 27 |
|
55 |
| -/** input node */ |
56 | 28 | export type Node = INode<NodeData>;
|
57 |
| -/** output node */ |
58 |
| -export type OutNode = INode<OutNodeData>; |
59 |
| -/** input and output edge */ |
60 | 29 | export type Edge = IEdge<EdgeData>;
|
61 |
| - |
62 |
| -export type Degree = { |
63 |
| - in: number; |
64 |
| - out: number; |
65 |
| - all: number; |
66 |
| -}; |
| 30 | +export type OutNode = INode<OutNodeData>; |
| 31 | +export type OutEdge = IEdge<OutEdgeData>; |
67 | 32 |
|
68 | 33 | // maps node's id and its index in the nodes array
|
69 | 34 | export type IndexMap = {
|
70 | 35 | [nodeId: string]: number;
|
71 | 36 | };
|
72 | 37 |
|
73 | 38 | export type Graph = IGraph<NodeData, EdgeData>;
|
74 |
| -export type GraphView = IGraphView<NodeData, EdgeData>; |
75 | 39 |
|
76 | 40 | export type PointTuple = [number, number] | [number, number, number];
|
77 | 41 | export type Point = { x: number; y: number; z?: number };
|
78 | 42 | export type Matrix = number[];
|
79 |
| -export type LayoutMapping = { nodes: OutNode[]; edges: Edge[] }; |
| 43 | +export type LayoutMapping = { nodes: OutNode[]; edges: OutEdge[] }; |
80 | 44 |
|
81 | 45 | export interface Layout<LayoutOptions> {
|
82 | 46 | /**
|
@@ -119,10 +83,6 @@ export interface LayoutWithIterations<LayoutOptions>
|
119 | 83 | tick: (iterations?: number) => LayoutMapping;
|
120 | 84 | }
|
121 | 85 |
|
122 |
| -export interface LayoutConstructor<LayoutOptions> { |
123 |
| - new (options?: LayoutOptions): Layout<LayoutOptions>; |
124 |
| -} |
125 |
| - |
126 | 86 | export interface LayoutSupervisor {
|
127 | 87 | execute(): Promise<LayoutMapping>;
|
128 | 88 | stop(): void;
|
|
0 commit comments