Skip to content

Commit 7536578

Browse files
committed
models: node: add isCollapsed attribute
-first step to transform trainrunSection.nbOfStops, in actual nodes
1 parent 7785dea commit 7536578

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/app/data-structures/business.data.structures.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ export interface NodeDto {
173173
fullName: string; // full name of the trainrun eg. BN => Bern Wankdorf
174174
positionX: number; // coordinate X
175175
positionY: number; // coordinate Y
176+
isCollapsed: boolean; // flag to collapse the node
176177

177178
ports: PortDto[]; // all ports aligned to the node
178179
transitions: TransitionDto[]; // all tranisitons aligned to the node

src/app/models/node.model.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export class Node {
3838
private warnings: WarningDto[];
3939
private isSelected: boolean;
4040
private labelIds: number[];
41+
private isCollapsed: boolean;
4142

4243
constructor(
4344
{
@@ -56,6 +57,7 @@ export class Node {
5657
symmetryAxis,
5758
warnings,
5859
labelIds,
60+
isCollapsed,
5961
}: NodeDto = {
6062
id: Node.incrementId(),
6163
betriebspunktName: $localize`:@@app.models.node.shortNameDefault:NEW`,
@@ -72,6 +74,7 @@ export class Node {
7274
symmetryAxis: null,
7375
warnings: null,
7476
labelIds: [],
77+
isCollapsed: false,
7578
},
7679
) {
7780
this.id = id;
@@ -93,6 +96,7 @@ export class Node {
9396
this.warnings = warnings;
9497
this.isSelected = false;
9598
this.labelIds = labelIds;
99+
this.isCollapsed = isCollapsed;
96100

97101
if (Node.currentId < this.id) {
98102
Node.currentId = this.id;
@@ -318,6 +322,14 @@ export class Node {
318322
return currentMaxIndex;
319323
}
320324

325+
getIsCollapsed(): boolean {
326+
return this.isCollapsed;
327+
}
328+
329+
setIsCollapsed(isCollapsed: boolean) {
330+
this.isCollapsed = isCollapsed;
331+
}
332+
321333
computeTransitionRouting(transition: Transition) {
322334
const port1 = this.getPort(transition.getPortId1());
323335
const port2 = this.getPort(transition.getPortId2());
@@ -820,6 +832,7 @@ export class Node {
820832
symmetryAxis: this.symmetryAxis,
821833
warnings: this.warnings,
822834
labelIds: this.labelIds,
835+
isCollapsed: this.isCollapsed,
823836
};
824837
}
825838

0 commit comments

Comments
 (0)