Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into fixing_types
Browse files Browse the repository at this point in the history
  • Loading branch information
Tristan-WorkGH committed Dec 20, 2024
2 parents 5ad261c + 936ab02 commit 718a99a
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 39 deletions.
56 changes: 28 additions & 28 deletions demo/src/diagram-viewers/data/nad-ieee14cdf-solved.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@
"svgId" : "6",
"equipmentId" : "VL12",
"x" : 694.18,
"y" : 76.12
"y" : 76.12,
"fictitious" : true
}, {
"svgId" : "8",
"equipmentId" : "VL13",
Expand All @@ -174,7 +175,8 @@
"svgId" : "12",
"equipmentId" : "VL2",
"x" : 62.4,
"y" : -384.58
"y" : -384.58,
"fictitious" : true
}, {
"svgId" : "14",
"equipmentId" : "VL3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export interface SvgParametersMetadata {
nodeHollowWidth: number;
unknownBusNodeExtraRadius: number;
edgeNameDisplayed: boolean;
fictitiousVoltageLevelCircleRadius: number;
}

export interface BusNodeMetadata {
Expand All @@ -46,6 +47,7 @@ export interface NodeMetadata {
equipmentId: string;
x: number;
y: number;
fictitious?: boolean;
}

export interface EdgeMetadata {
Expand Down
20 changes: 20 additions & 0 deletions src/components/network-area-diagram-viewer/diagram-utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,26 @@ test('getTextNodeMoves', () => {
expect(textNodeMove[1].yNew).toBe(-53.76);
});

test('isVlNodeFictitious', () => {
const nodes: NodeMetadata[] = [
{
svgId: '0',
equipmentId: 'vl',
x: 189.53,
y: 123.47,
},
{
svgId: '2',
equipmentId: 'vl2',
x: -171.8,
y: 131.88,
fictitious: true,
},
];
expect(DiagramUtils.isVlNodeFictitious('0', nodes)).toBe(false);
expect(DiagramUtils.isVlNodeFictitious('2', nodes)).toBe(true);
});

function getSvgNode(): SVGGraphicsElement {
const nodeSvg =
'<g class="nad-vl-nodes"><g transform="translate(-452.59,-274.01)" id="0">' +
Expand Down
5 changes: 5 additions & 0 deletions src/components/network-area-diagram-viewer/diagram-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -521,3 +521,8 @@ export function getTextNodeMoves(
{ xOrig: textNode.connectionShiftX, yOrig: textNode.connectionShiftY, xNew: connXNew, yNew: connYNew },
];
}

export function isVlNodeFictitious(vlNodeId: string, nodes: NodeMetadata[] | undefined): boolean {
const node: NodeMetadata | undefined = nodes?.find((node) => node.svgId == vlNodeId);
return node?.fictitious ?? false;
}
Loading

0 comments on commit 718a99a

Please sign in to comment.