From 12cd2c8aca7f0f51412e230a6be8646490bb2331 Mon Sep 17 00:00:00 2001 From: LE SAULNIER Kevin Date: Wed, 9 Oct 2024 10:11:50 +0200 Subject: [PATCH] fix: PR remarks, renamings Signed-off-by: LE SAULNIER Kevin --- .../java/com/powsybl/sld/svg/DefaultSVGWriter.java | 4 ++-- .../main/java/com/powsybl/sld/svg/GraphMetadata.java | 12 ++++++------ .../main/java/com/powsybl/sld/svg/SvgParameters.java | 12 ++++++------ .../com/powsybl/sld/iidm/TestCase12GraphWith3WT.java | 6 +++--- .../com/powsybl/sld/iidm/TestUnknownComponent.java | 2 +- .../java/com/powsybl/sld/svg/GraphMetadataTest.java | 2 +- .../java/com/powsybl/sld/svg/SvgParametersTest.java | 4 ++-- .../resources/TestSldClassSubstationMetadata.json | 2 +- .../src/test/resources/TestSldClassVlMetadata.json | 2 +- .../src/test/resources/substDiag_metadata.json | 2 +- .../resources/substDiag_with_hvdc_line_metadata.json | 2 +- .../src/test/resources/vlDiag_metadata.json | 2 +- 12 files changed, 26 insertions(+), 26 deletions(-) diff --git a/single-line-diagram/single-line-diagram-core/src/main/java/com/powsybl/sld/svg/DefaultSVGWriter.java b/single-line-diagram/single-line-diagram-core/src/main/java/com/powsybl/sld/svg/DefaultSVGWriter.java index 8a754db0d..83b8966c6 100644 --- a/single-line-diagram/single-line-diagram-core/src/main/java/com/powsybl/sld/svg/DefaultSVGWriter.java +++ b/single-line-diagram/single-line-diagram-core/src/main/java/com/powsybl/sld/svg/DefaultSVGWriter.java @@ -132,7 +132,7 @@ private double getDiagramWidth(Graph graph, LayoutParameters layoutParameters) { private double getDiagramHeight(Graph graph, LayoutParameters layoutParameters) { double height = graph.getHeight() + layoutParameters.getDiagramPadding().getTop() + layoutParameters.getDiagramPadding().getBottom(); - if (graph instanceof VoltageLevelGraph && svgParameters.isAddNodesInfos()) { + if (graph instanceof VoltageLevelGraph && svgParameters.isBusesLegendAdded()) { height += 6 * CIRCLE_RADIUS_NODE_INFOS_SIZE; } return height; @@ -263,7 +263,7 @@ protected void drawVoltageLevel(VoltageLevelGraph graph, // Drawing the nodes outside the voltageLevel graphs (multi-terminal nodes) drawNodes(root, graph, new Point(0, 0), metadata, initProvider, styleProvider, graph.getMultiTermNodes()); - if (graph.isForVoltageLevelDiagram() && svgParameters.isAddNodesInfos()) { + if (graph.isForVoltageLevelDiagram() && svgParameters.isBusesLegendAdded()) { drawBusesLegend(root, graph, metadata, initProvider, styleProvider); } } diff --git a/single-line-diagram/single-line-diagram-core/src/main/java/com/powsybl/sld/svg/GraphMetadata.java b/single-line-diagram/single-line-diagram-core/src/main/java/com/powsybl/sld/svg/GraphMetadata.java index 9636e3067..1d4eeca7d 100644 --- a/single-line-diagram/single-line-diagram-core/src/main/java/com/powsybl/sld/svg/GraphMetadata.java +++ b/single-line-diagram/single-line-diagram-core/src/main/java/com/powsybl/sld/svg/GraphMetadata.java @@ -349,7 +349,7 @@ public String getId() { private final Map feederInfoMetadataMap = new HashMap<>(); - private final Map electricalNodeInfoMetadataMap = new HashMap<>(); + private final Map busLegendInfoMetadataMap = new HashMap<>(); private final Map busInfoMetadataMap = new HashMap<>(); @@ -537,17 +537,17 @@ public List getBusInfoMetadata() { public void addBusLegendInfoMetadata(BusLegendInfoMetadata metadata) { Objects.requireNonNull(metadata); - electricalNodeInfoMetadataMap.put(metadata.getId(), metadata); + busLegendInfoMetadataMap.put(metadata.getId(), metadata); } - public BusLegendInfoMetadata getElectricalNodeInfoMetadata(String id) { + public BusLegendInfoMetadata getBusLegendInfoMetadata(String id) { Objects.requireNonNull(id); - return electricalNodeInfoMetadataMap.get(id); + return busLegendInfoMetadataMap.get(id); } @JsonProperty("busLegendInfos") - public List getElectricalNodeInfoMetadata() { - return ImmutableList.copyOf(electricalNodeInfoMetadataMap.values()); + public List getBusLegendInfoMetadata() { + return ImmutableList.copyOf(busLegendInfoMetadataMap.values()); } @JsonProperty("layoutParams") diff --git a/single-line-diagram/single-line-diagram-core/src/main/java/com/powsybl/sld/svg/SvgParameters.java b/single-line-diagram/single-line-diagram-core/src/main/java/com/powsybl/sld/svg/SvgParameters.java index ca88fe10a..4cd2ce71d 100644 --- a/single-line-diagram/single-line-diagram-core/src/main/java/com/powsybl/sld/svg/SvgParameters.java +++ b/single-line-diagram/single-line-diagram-core/src/main/java/com/powsybl/sld/svg/SvgParameters.java @@ -32,7 +32,7 @@ public class SvgParameters { private double feederInfosIntraMargin = 10; private double feederInfosOuterMargin = 20; private boolean feederInfoSymmetry = false; - private boolean addNodesInfos = false; + private boolean busesLegendAdded = false; private boolean useName = false; private double angleLabelShift = 15.; private boolean labelCentered = false; @@ -72,7 +72,7 @@ public SvgParameters(SvgParameters other) { this.feederInfosIntraMargin = other.feederInfosIntraMargin; this.feederInfosOuterMargin = other.feederInfosOuterMargin; this.feederInfoSymmetry = other.feederInfoSymmetry; - this.addNodesInfos = other.addNodesInfos; + this.busesLegendAdded = other.busesLegendAdded; this.useName = other.useName; this.angleLabelShift = other.angleLabelShift; this.labelCentered = other.labelCentered; @@ -227,12 +227,12 @@ public SvgParameters setFeederInfoSymmetry(boolean feederInfoSymmetry) { return this; } - public boolean isAddNodesInfos() { - return addNodesInfos; + public boolean isBusesLegendAdded() { + return busesLegendAdded; } - public SvgParameters setAddNodesInfos(boolean addNodesInfos) { - this.addNodesInfos = addNodesInfos; + public SvgParameters setBusesLegendAdded(boolean busesLegendAdded) { + this.busesLegendAdded = busesLegendAdded; return this; } diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase12GraphWith3WT.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase12GraphWith3WT.java index 25af34837..31590fa0f 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase12GraphWith3WT.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase12GraphWith3WT.java @@ -257,7 +257,7 @@ void testMetadata() { // Optimize SVG by avoiding duplication svgParameters.setAvoidSVGComponentsDuplication(true) - .setAddNodesInfos(true); + .setBusesLegendAdded(true); // compare metadata of voltage level diagram with reference VoltageLevelGraph graph = graphBuilder.buildVoltageLevelGraph(vl1.getId()); @@ -270,7 +270,7 @@ void testMetadata() { void testNodesInfosNominalVoltageStyle() { separateBusVoltages(); - svgParameters.setAddNodesInfos(true); + svgParameters.setBusesLegendAdded(true); // build voltage level 1 graph VoltageLevelGraph g1 = graphBuilder.buildVoltageLevelGraph(vl1.getId()); @@ -287,7 +287,7 @@ void testNodesInfosTopologicalStyle() { separateBusVoltages(); //parametrize diagram - svgParameters.setAddNodesInfos(true); + svgParameters.setBusesLegendAdded(true); VoltageLevelGraph g1 = graphBuilder.buildVoltageLevelGraph(vl1.getId()); voltageLevelGraphLayout(g1); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestUnknownComponent.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestUnknownComponent.java index 88181acde..af5e68452 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestUnknownComponent.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestUnknownComponent.java @@ -37,7 +37,7 @@ protected ResourcesComponentLibrary getResourcesComponentLibrary() { @Test void test() { - svgParameters.setAddNodesInfos(true); + svgParameters.setBusesLegendAdded(true); // build voltage level 1 graph VoltageLevelGraph g1 = graphBuilder.buildVoltageLevelGraph("vl1"); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/svg/GraphMetadataTest.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/svg/GraphMetadataTest.java index 12dd870c7..dca3e7d0a 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/svg/GraphMetadataTest.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/svg/GraphMetadataTest.java @@ -107,7 +107,7 @@ void test() throws IOException { assertEquals("user_id", metadata2.getFeederInfoMetadata("id1").getUserDefinedId()); assertEquals("COMPONENT_TYPE", metadata2.getFeederInfoMetadata("id1").getComponentType()); - assertNotNull(metadata2.getElectricalNodeInfoMetadata("id1")); + assertNotNull(metadata2.getBusLegendInfoMetadata("id1")); assertNotNull(metadata2.getBusInfoMetadata("id6")); assertEquals("busNodeId1", metadata2.getBusInfoMetadata("id6").getBusNodeId()); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/svg/SvgParametersTest.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/svg/SvgParametersTest.java index 49a75704c..78028ab4b 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/svg/SvgParametersTest.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/svg/SvgParametersTest.java @@ -33,7 +33,7 @@ void test() { .setFeederInfosIntraMargin(21) .setFeederInfosOuterMargin(25) .setFeederInfoSymmetry(true) - .setAddNodesInfos(true) + .setBusesLegendAdded(true) .setUseName(true) .setAngleLabelShift(42) .setLabelCentered(true) @@ -66,7 +66,7 @@ void test() { assertEquals(svgParameters0.getFeederInfosIntraMargin(), svgParameters1.getFeederInfosIntraMargin(), 0); assertEquals(svgParameters0.getFeederInfosOuterMargin(), svgParameters1.getFeederInfosOuterMargin(), 0); assertEquals(svgParameters0.isFeederInfoSymmetry(), svgParameters1.isFeederInfoSymmetry()); - assertEquals(svgParameters0.isAddNodesInfos(), svgParameters1.isAddNodesInfos()); + assertEquals(svgParameters0.isBusesLegendAdded(), svgParameters1.isBusesLegendAdded()); assertEquals(svgParameters0.isUseName(), svgParameters1.isUseName()); assertEquals(svgParameters0.getAngleLabelShift(), svgParameters1.getAngleLabelShift(), 0); assertEquals(svgParameters0.isLabelCentered(), svgParameters1.isLabelCentered()); diff --git a/single-line-diagram/single-line-diagram-core/src/test/resources/TestSldClassSubstationMetadata.json b/single-line-diagram/single-line-diagram-core/src/test/resources/TestSldClassSubstationMetadata.json index 254ed4271..4c31d7296 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/resources/TestSldClassSubstationMetadata.json +++ b/single-line-diagram/single-line-diagram-core/src/test/resources/TestSldClassSubstationMetadata.json @@ -584,7 +584,7 @@ "feederInfosIntraMargin" : 10.0, "feederInfosOuterMargin" : 20.0, "feederInfoSymmetry" : false, - "addNodesInfos" : false, + "busesLegendAdded" : false, "useName" : false, "angleLabelShift" : 15.0, "labelCentered" : false, diff --git a/single-line-diagram/single-line-diagram-core/src/test/resources/TestSldClassVlMetadata.json b/single-line-diagram/single-line-diagram-core/src/test/resources/TestSldClassVlMetadata.json index 64a881528..63049ebb2 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/resources/TestSldClassVlMetadata.json +++ b/single-line-diagram/single-line-diagram-core/src/test/resources/TestSldClassVlMetadata.json @@ -343,7 +343,7 @@ "feederInfosIntraMargin" : 10.0, "feederInfosOuterMargin" : 20.0, "feederInfoSymmetry" : false, - "addNodesInfos" : false, + "busesLegendAdded" : false, "useName" : false, "angleLabelShift" : 15.0, "labelCentered" : false, diff --git a/single-line-diagram/single-line-diagram-core/src/test/resources/substDiag_metadata.json b/single-line-diagram/single-line-diagram-core/src/test/resources/substDiag_metadata.json index a5e296d0e..c239b3c0f 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/resources/substDiag_metadata.json +++ b/single-line-diagram/single-line-diagram-core/src/test/resources/substDiag_metadata.json @@ -2966,7 +2966,7 @@ "feederInfosIntraMargin" : 10.0, "feederInfosOuterMargin" : 20.0, "feederInfoSymmetry" : false, - "addNodesInfos" : false, + "busesLegendAdded" : false, "useName" : true, "angleLabelShift" : 15.0, "labelCentered" : false, diff --git a/single-line-diagram/single-line-diagram-core/src/test/resources/substDiag_with_hvdc_line_metadata.json b/single-line-diagram/single-line-diagram-core/src/test/resources/substDiag_with_hvdc_line_metadata.json index 159480573..c7308242e 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/resources/substDiag_with_hvdc_line_metadata.json +++ b/single-line-diagram/single-line-diagram-core/src/test/resources/substDiag_with_hvdc_line_metadata.json @@ -314,7 +314,7 @@ "feederInfosIntraMargin" : 10.0, "feederInfosOuterMargin" : 20.0, "feederInfoSymmetry" : false, - "addNodesInfos" : false, + "busesLegendAdded" : false, "useName" : true, "angleLabelShift" : 15.0, "labelCentered" : false, diff --git a/single-line-diagram/single-line-diagram-core/src/test/resources/vlDiag_metadata.json b/single-line-diagram/single-line-diagram-core/src/test/resources/vlDiag_metadata.json index 7f1e41de9..939534960 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/resources/vlDiag_metadata.json +++ b/single-line-diagram/single-line-diagram-core/src/test/resources/vlDiag_metadata.json @@ -1499,7 +1499,7 @@ "feederInfosIntraMargin" : 10.0, "feederInfosOuterMargin" : 20.0, "feederInfoSymmetry" : false, - "addNodesInfos" : true, + "busesLegendAdded" : true, "useName" : true, "angleLabelShift" : 15.0, "labelCentered" : false,