Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable node selection when node moving is disabled in network area diagram viewer #108

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions demo/src/diagram-viewers/add-diagrams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@
*/

import NadSvgExample from './data/nad-eurostag-tutorial-example1.svg';
import NadSvgExampleMeta from './data/nad-eurostag-tutorial-example1_metadata.json';
import NadSvgPstHvdcExample from './data/nad-four-substations.svg';
import NadSvgPstHvdcExampleMeta from './data/nad-four-substations_metadata.json';
import NadSvgMultibusVLNodesExample from './data/nad-ieee9-zeroimpedance-cdf.svg';
import NadSvgMultibusVLNodesExampleMeta from './data/nad-ieee9-zeroimpedance-cdf_metadata.json';
import NadSvgMultibusVLNodes14Example from './data/nad-ieee14cdf-solved.svg';
import NadSvgTrheeWTDanglingLineUnknownBusExample from './data/nad-scada.svg';
import NadSvgMultibusVLNodes14ExampleMeta from './data/nad-ieee14cdf-solved_metadata.json';
import NadSvgThreeWTDanglingLineUnknownBusExample from './data/nad-scada.svg';
import NadSvgThreeWTDanglingLineUnknownBusExampleMeta from './data/nad-scada_metadata.json';
import NadSvgPartialNetworkExample from './data/nad-ieee300cdf-VL9006.svg';
import NadSvgPartialNetworkExampleMeta from './data/nad-ieee300cdf-VL9006_metadata.json';
import SldSvgExample from './data/sld-example.svg';
import SldSvgExampleMeta from './data/sld-example-meta.json';
import SldSvgSubExample from './data/sld-sub-example.svg';
Expand All @@ -36,6 +42,7 @@ export const addNadToDemo = () => {
new NetworkAreaDiagramViewer(
document.getElementById('svg-container-nad')!,
svgContent,
NadSvgExampleMeta,
500,
600,
1000,
Expand All @@ -60,12 +67,13 @@ export const addNadToDemo = () => {
new NetworkAreaDiagramViewer(
document.getElementById('svg-container-nad-no-moving')!,
svgContent,
NadSvgExampleMeta,
500,
600,
1000,
1200,
handleNodeMove,
handleTextNodeMove,
null,
null,
handleNodeSelect,
false,
false,
Expand All @@ -84,6 +92,7 @@ export const addNadToDemo = () => {
new NetworkAreaDiagramViewer(
document.getElementById('svg-container-nad-multibus-vlnodes')!,
svgContent,
NadSvgMultibusVLNodesExampleMeta,
500,
600,
1000,
Expand All @@ -108,6 +117,7 @@ export const addNadToDemo = () => {
new NetworkAreaDiagramViewer(
document.getElementById('svg-container-nad-multibus-vlnodes14')!,
svgContent,
NadSvgMultibusVLNodes14ExampleMeta,
500,
600,
1000,
Expand All @@ -132,6 +142,7 @@ export const addNadToDemo = () => {
new NetworkAreaDiagramViewer(
document.getElementById('svg-container-nad-pst-hvdc')!,
svgContent,
NadSvgPstHvdcExampleMeta,
500,
600,
1000,
Expand All @@ -150,12 +161,13 @@ export const addNadToDemo = () => {
.setAttribute('style', 'border:2px; border-style:solid;');
});

fetch(NadSvgTrheeWTDanglingLineUnknownBusExample)
fetch(NadSvgThreeWTDanglingLineUnknownBusExample)
.then((response) => response.text())
.then((svgContent) => {
new NetworkAreaDiagramViewer(
document.getElementById('svg-container-nad-threewt-dl-ub')!,
svgContent,
NadSvgThreeWTDanglingLineUnknownBusExampleMeta,
500,
600,
1000,
Expand All @@ -180,6 +192,7 @@ export const addNadToDemo = () => {
new NetworkAreaDiagramViewer(
document.getElementById('svg-container-nad-partial-network')!,
svgContent,
NadSvgPartialNetworkExampleMeta,
500,
600,
1000,
Expand Down
53 changes: 14 additions & 39 deletions demo/src/diagram-viewers/data/nad-eurostag-tutorial-example1.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
@@ -0,0 +1,170 @@
{
"layoutParameters" : {
"textNodesForceLayout" : false,
"springRepulsionFactorForceLayout" : 0.0,
"textNodeFixedShift" : {
"x" : 100.0,
"y" : -40.0
},
"maxSteps" : 1000,
"textNodeEdgeConnectionYShift" : 25.0
},
"svgParameters" : {
"diagramPadding" : {
"left" : 200.0,
"top" : 200.0,
"right" : 200.0,
"bottom" : 200.0
},
"insertNameDesc" : false,
"svgWidthAndHeightAdded" : false,
"cssLocation" : "INSERTED_IN_SVG",
"sizeConstraint" : "FIXED_SCALE",
"fixedWidth" : -1,
"fixedHeight" : -1,
"fixedScale" : 0.2,
"arrowShift" : 30.0,
"arrowLabelShift" : 19.0,
"converterStationWidth" : 70.0,
"voltageLevelCircleRadius" : 30.0,
"fictitiousVoltageLevelCircleRadius" : 15.0,
"transformerCircleRadius" : 20.0,
"nodeHollowWidth" : 15.0,
"edgesForkLength" : 80.0,
"edgesForkAperture" : 60.0,
"edgeStartShift" : 0.0,
"unknownBusNodeExtraRadius" : 10.0,
"loopDistance" : 120.0,
"loopEdgesAperture" : 60.0,
"loopControlDistance" : 40.0,
"edgeInfoAlongEdge" : true,
"edgeNameDisplayed" : true,
"interAnnulusSpace" : 5.0,
"svgPrefix" : "",
"idDisplayed" : false,
"substationDescriptionDisplayed" : false,
"arrowHeight" : 10.0,
"busLegend" : true,
"voltageLevelDetails" : false,
"languageTag" : "en",
"voltageValuePrecision" : 1,
"powerValuePrecision" : 0,
"angleValuePrecision" : 1,
"currentValuePrecision" : 0,
"edgeInfoDisplayed" : "ACTIVE_POWER",
"pstArrowHeadSize" : 8.0,
"undefinedValueSymbol" : ""
},
"busNodes" : [ {
"svgId" : "1",
"equipmentId" : "VLGEN_0",
"nbNeighbours" : 0,
"index" : 0,
"vlNode" : "0"
}, {
"svgId" : "3",
"equipmentId" : "VLHV1_0",
"nbNeighbours" : 0,
"index" : 0,
"vlNode" : "2"
}, {
"svgId" : "5",
"equipmentId" : "VLHV2_0",
"nbNeighbours" : 0,
"index" : 0,
"vlNode" : "4"
}, {
"svgId" : "7",
"equipmentId" : "VLLOAD_0",
"nbNeighbours" : 0,
"index" : 0,
"vlNode" : "6"
} ],
"nodes" : [ {
"svgId" : "0",
"equipmentId" : "VLGEN",
"x" : -452.59,
"y" : -274.01
}, {
"svgId" : "2",
"equipmentId" : "VLHV1",
"x" : -245.26,
"y" : 34.3
}, {
"svgId" : "4",
"equipmentId" : "VLHV2",
"x" : 140.33,
"y" : 58.61
}, {
"svgId" : "6",
"equipmentId" : "VLLOAD",
"x" : 430.9,
"y" : -174.05
} ],
"edges" : [ {
"svgId" : "8",
"equipmentId" : "NGEN_NHV1",
"node1" : "0",
"node2" : "2",
"busNode1" : "1",
"busNode2" : "3",
"type" : "TwoWtEdge"
}, {
"svgId" : "9",
"equipmentId" : "NHV1_NHV2_1",
"node1" : "2",
"node2" : "4",
"busNode1" : "3",
"busNode2" : "5",
"type" : "LineEdge"
}, {
"svgId" : "10",
"equipmentId" : "NHV1_NHV2_2",
"node1" : "2",
"node2" : "4",
"busNode1" : "3",
"busNode2" : "5",
"type" : "LineEdge"
}, {
"svgId" : "11",
"equipmentId" : "NHV2_NLOAD",
"node1" : "4",
"node2" : "6",
"busNode1" : "5",
"busNode2" : "7",
"type" : "TwoWtEdge"
} ],
"textNodes" : [ {
"svgId" : "0-textnode",
"equipmentId" : "VLGEN",
"vlNode" : "0",
"shiftX" : 100.0,
"shiftY" : -40.0,
"connectionShiftX" : 100.0,
"connectionShiftY" : -15.0
}, {
"svgId" : "2-textnode",
"equipmentId" : "VLHV1",
"vlNode" : "2",
"shiftX" : 100.0,
"shiftY" : -40.0,
"connectionShiftX" : 100.0,
"connectionShiftY" : -15.0
}, {
"svgId" : "4-textnode",
"equipmentId" : "VLHV2",
"vlNode" : "4",
"shiftX" : 100.0,
"shiftY" : -40.0,
"connectionShiftX" : 100.0,
"connectionShiftY" : -15.0
}, {
"svgId" : "6-textnode",
"equipmentId" : "VLLOAD",
"vlNode" : "6",
"shiftX" : 100.0,
"shiftY" : -40.0,
"connectionShiftX" : 100.0,
"connectionShiftY" : -15.0
} ]
}
Loading
Loading