From b414d572678d52684414c408e360080587f8e21c Mon Sep 17 00:00:00 2001 From: jamal-khey Date: Tue, 24 Sep 2024 11:38:56 +0200 Subject: [PATCH] undo useless changes Signed-off-by: jamal-khey --- .../sld/builders/NetworkGraphBuilder.java | 21 +++++++------------ .../sld/model/graphs/VoltageLevelGraph.java | 1 - .../iidm/HighlightLineStateStyleProvider.java | 9 +++----- .../com/powsybl/sld/AbstractTestCase.java | 2 +- 4 files changed, 12 insertions(+), 21 deletions(-) diff --git a/single-line-diagram/single-line-diagram-core/src/main/java/com/powsybl/sld/builders/NetworkGraphBuilder.java b/single-line-diagram/single-line-diagram-core/src/main/java/com/powsybl/sld/builders/NetworkGraphBuilder.java index ab3c28d85..138bef591 100644 --- a/single-line-diagram/single-line-diagram-core/src/main/java/com/powsybl/sld/builders/NetworkGraphBuilder.java +++ b/single-line-diagram/single-line-diagram-core/src/main/java/com/powsybl/sld/builders/NetworkGraphBuilder.java @@ -220,8 +220,7 @@ protected abstract void add3wtFeeder(Middle3WTNode middleNode, FeederNode firstO FeederNode secondOtherLegNode, Terminal terminal); private FeederNode createFeederLineNode(VoltageLevelGraph graph, Line line, TwoSides side) { - FeederNode feederNode = createFeederBranchNode(graph, line, side, LINE); - return feederNode; + return createFeederBranchNode(graph, line, side, LINE); } private FeederNode createFeederTieLineNode(VoltageLevelGraph graph, TieLine tieLine, TwoSides side) { @@ -267,22 +266,20 @@ private FeederNode createFeeder2wtNode(VoltageLevelGraph graph, TwoWindingsTrans TwoSides otherSide = side == TwoSides.ONE ? TwoSides.TWO : TwoSides.ONE; VoltageLevel vlOtherSide = branch.getTerminal(otherSide).getVoltageLevel(); VoltageLevelInfos otherSideVoltageLevelInfos = new VoltageLevelInfos(vlOtherSide.getId(), vlOtherSide.getNameOrId(), vlOtherSide.getNominalV()); - FeederNode transformerNode; + if (graph.isForVoltageLevelDiagram() && isNotInternalToVoltageLevel(branch)) { if (!branch.hasPhaseTapChanger()) { - transformerNode = NodeFactory.createFeeder2WTNode(graph, id, name, equipmentId, NodeSide.valueOf(side.name()), otherSideVoltageLevelInfos); + return NodeFactory.createFeeder2WTNode(graph, id, name, equipmentId, NodeSide.valueOf(side.name()), otherSideVoltageLevelInfos); } else { - transformerNode = NodeFactory.createFeeder2WTNodeWithPhaseShifter(graph, id, name, equipmentId, NodeSide.valueOf(side.name()), otherSideVoltageLevelInfos); + return NodeFactory.createFeeder2WTNodeWithPhaseShifter(graph, id, name, equipmentId, NodeSide.valueOf(side.name()), otherSideVoltageLevelInfos); } } else { if (!branch.hasPhaseTapChanger()) { - transformerNode = NodeFactory.createFeeder2WTLegNode(graph, id, name, equipmentId, NodeSide.valueOf(side.name())); + return NodeFactory.createFeeder2WTLegNode(graph, id, name, equipmentId, NodeSide.valueOf(side.name())); } else { - transformerNode = NodeFactory.createFeeder2WTLegNodeWithPhaseShifter(graph, id, name, equipmentId, NodeSide.valueOf(side.name())); + return NodeFactory.createFeeder2WTLegNodeWithPhaseShifter(graph, id, name, equipmentId, NodeSide.valueOf(side.name())); } } - - return transformerNode; } private void addFeeder3wtNode(VoltageLevelGraph graph, @@ -406,14 +403,13 @@ public void visitStaticVarCompensator(StaticVarCompensator svc) { @Override public void visitTwoWindingsTransformer(TwoWindingsTransformer transformer, TwoSides side) { - FeederNode transformerNode = createFeeder2wtNode(graph, transformer, side); + Node transformerNode = createFeeder2wtNode(graph, transformer, side); addTerminalNode(transformerNode, transformer.getTerminal(side)); } @Override public void visitLine(Line line, TwoSides side) { - FeederNode feederNode = createFeederLineNode(graph, line, side); - addTerminalNode(feederNode, line.getTerminal(side)); + addTerminalNode(createFeederLineNode(graph, line, side), line.getTerminal(side)); } private static VoltageLevelInfos createVoltageLevelInfos(Terminal terminal) { @@ -507,7 +503,6 @@ protected void add3wtFeeder(Middle3WTNode middleNode, FeederNode firstOtherLegNo @Override public void visitBusbarSection(BusbarSection busbarSection) { BusbarSectionPosition extension = busbarSection.getExtension(BusbarSectionPosition.class); - //check if we have a constraint on the busbar section BusNode node = NodeFactory.createBusNode(graph, busbarSection.getId(), busbarSection.getNameOrId()); if (extension != null) { node.setBusBarIndexSectionIndex(extension.getBusbarIndex(), extension.getSectionIndex()); diff --git a/single-line-diagram/single-line-diagram-core/src/main/java/com/powsybl/sld/model/graphs/VoltageLevelGraph.java b/single-line-diagram/single-line-diagram-core/src/main/java/com/powsybl/sld/model/graphs/VoltageLevelGraph.java index 24cfe467d..88decf635 100644 --- a/single-line-diagram/single-line-diagram-core/src/main/java/com/powsybl/sld/model/graphs/VoltageLevelGraph.java +++ b/single-line-diagram/single-line-diagram-core/src/main/java/com/powsybl/sld/model/graphs/VoltageLevelGraph.java @@ -332,7 +332,6 @@ private void insertNode(Node nodeA, Node nodeToInsert, Node nodeB) { addEdge(nodeB, nodeToInsert); addEdge(nodeToInsert, nodeA); } - } public void insertHookNodesAtBuses() { diff --git a/single-line-diagram/single-line-diagram-core/src/main/java/com/powsybl/sld/svg/styles/iidm/HighlightLineStateStyleProvider.java b/single-line-diagram/single-line-diagram-core/src/main/java/com/powsybl/sld/svg/styles/iidm/HighlightLineStateStyleProvider.java index 48e215e04..7104b8d56 100644 --- a/single-line-diagram/single-line-diagram-core/src/main/java/com/powsybl/sld/svg/styles/iidm/HighlightLineStateStyleProvider.java +++ b/single-line-diagram/single-line-diagram-core/src/main/java/com/powsybl/sld/svg/styles/iidm/HighlightLineStateStyleProvider.java @@ -18,7 +18,6 @@ import com.powsybl.sld.svg.styles.StyleClassConstants; import java.util.*; -import java.util.stream.Stream; /** * @author Franck Lecuyer {@literal } @@ -34,11 +33,9 @@ public HighlightLineStateStyleProvider(Network network) { @Override public List getEdgeStyles(Graph graph, Edge edge) { - Optional stateStyle = getHighlightLineStateStyle(graph, edge); - return Stream.of(stateStyle) - .filter(Optional::isPresent) - .map(Optional::get) - .toList(); + return getHighlightLineStateStyle(graph, edge) + .map(List::of) + .orElse(Collections.emptyList()); } @Override diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/AbstractTestCase.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/AbstractTestCase.java index 6fc50206f..6eae71220 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/AbstractTestCase.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/AbstractTestCase.java @@ -34,7 +34,7 @@ public abstract class AbstractTestCase { protected boolean debugJsonFiles = false; - protected boolean debugSvgFiles = true; + protected boolean debugSvgFiles = false; protected boolean overrideTestReferences = false; protected final ResourcesComponentLibrary componentLibrary = getResourcesComponentLibrary();