Skip to content

Commit 3d8529c

Browse files
committed
Added new model classes and interfaces
1 parent e878c50 commit 3d8529c

File tree

6 files changed

+51
-2
lines changed

6 files changed

+51
-2
lines changed

src/model/BoundingBox.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
export interface BoundingBox {
3+
top: number;
4+
left: number;
5+
right: number;
6+
bottom: number;
7+
}

src/model/Category.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
export class Category {
3+
4+
constructor(id: string, label: string, backGroundColor: string) {
5+
this.id = id;
6+
this.label = label;
7+
this.backgroundColor = backGroundColor;
8+
}
9+
10+
public id: string;
11+
public label: string;
12+
public backgroundColor: string;
13+
}

src/model/NetworkNode.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export interface NetworkNode {
2+
id: string;
3+
label: string;
4+
position: {
5+
x: number,
6+
y: number
7+
};
8+
boundingBox: {
9+
top: number,
10+
left: number,
11+
right: number,
12+
bottom: number
13+
};
14+
}

src/model/Node.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
1-
import { NodeType, Project } from "@model";
1+
import { BoundingBox, NodeType, Position, Project } from "@model";
22
import { Config } from "@src";
33

44
export class Node {
55
private config: Config = new Config();
6-
constructor(id: string, name: string, isRoot: boolean, nodeType: NodeType = NodeType.none) {
6+
constructor(id: string, name: string, isRoot: boolean, nodeType: NodeType = NodeType.none, position: Position | undefined = undefined, boundingBox: BoundingBox | undefined = undefined, attributes: { name: string, value: string}[] = []) {
77
this.id = id;
88
this.name = name;
99
this.isRoot = isRoot;
1010
this.nodeType = nodeType;
11+
this.position = position;
12+
this.boundingBox = boundingBox;
13+
this.attributes = attributes;
1114
}
1215
public id: string;
1316
public name: string;
1417
public isRoot: boolean;
18+
public position: Position | undefined;
19+
public boundingBox: BoundingBox | undefined;
1520
public nodeType: NodeType;
21+
public attributes: { name: string, value: string}[];
1622

1723
public toJsonString(): string {
1824
let nodeColorAttr = '';

src/model/Position.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
export interface Position {
3+
x: number;
4+
y: number;
5+
}

src/model/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
export * from './ArrowType';
2+
export * from './BoundingBox';
3+
export * from './Category';
24
export * from './Component';
35
export * from './Edge';
46
export * from './NamedEntity';
7+
export * from './NetworkNode';
58
export * from './Node';
69
export * from './NodeType';
10+
export * from './Position';
711
export * from './Project';

0 commit comments

Comments
 (0)