From 4c63e4c5c1b862f144e4c56b1cb6ab1a0bed8e44 Mon Sep 17 00:00:00 2001 From: "massimo.ferraro" Date: Tue, 30 Apr 2024 11:03:11 +0200 Subject: [PATCH 1/2] Add edge type to metadata in network area diagram SVG Signed-off-by: massimo.ferraro --- .../java/com/powsybl/nad/svg/SvgWriter.java | 9 +- .../nad/svg/metadata/DiagramMetadata.java | 4 +- .../nad/svg/metadata/EdgeMetadata.java | 9 +- .../src/test/resources/3wt.svg | 6 +- .../src/test/resources/3wt_disconnected.svg | 6 +- .../3wt_disconnected_topological.svg | 6 +- .../src/test/resources/3wt_partial.svg | 6 +- .../src/test/resources/IEEE_118_bus.svg | 372 +++++++++--------- .../test/resources/IEEE_118_bus_partial.svg | 96 ++--- .../IEEE_118_bus_partial_non_connected.svg | 58 +-- .../src/test/resources/IEEE_14_bus.svg | 40 +- .../resources/IEEE_14_bus_disconnection.svg | 40 +- .../test/resources/IEEE_14_bus_fictitious.svg | 40 +- .../test/resources/IEEE_14_bus_text_nodes.svg | 40 +- .../resources/IEEE_14_bus_voltage_filter1.svg | 20 +- .../resources/IEEE_14_bus_voltage_filter2.svg | 38 +- .../resources/IEEE_14_bus_voltage_filter3.svg | 22 +- .../resources/IEEE_14_bus_voltage_filter4.svg | 26 +- .../resources/IEEE_14_bus_voltage_filter5.svg | 22 +- .../test/resources/IEEE_14_id_prefixed.svg | 40 +- .../src/test/resources/IEEE_24_bus.svg | 76 ++-- .../src/test/resources/IEEE_30_bus.svg | 82 ++-- .../src/test/resources/IEEE_57_bus.svg | 160 ++++---- .../src/test/resources/current_limits.svg | 4 +- .../resources/dangling_line_connected.svg | 10 +- .../resources/dangling_line_disconnected.svg | 10 +- .../src/test/resources/detailed_text_node.svg | 4 +- .../detailed_text_node_no_legend.svg | 4 +- .../diamond-spring-repulsion-factor-0.0.svg | 32 +- .../diamond-spring-repulsion-factor-0.2.svg | 32 +- .../src/test/resources/edge_info_current.svg | 4 +- .../resources/edge_info_double_labels.svg | 6 +- .../resources/edge_info_missing_label.svg | 4 +- .../edge_info_perpendicular_label.svg | 4 +- .../resources/edge_info_reactive_power.svg | 4 +- .../src/test/resources/edge_info_shift.svg | 10 +- .../src/test/resources/edge_with_id.svg | 10 +- .../src/test/resources/edge_without_id.svg | 10 +- .../src/test/resources/hvdc-vl-depth-1.svg | 2 +- .../src/test/resources/hvdc.svg | 10 +- .../test/resources/parallel_transformers.svg | 6 +- .../src/test/resources/simple-eu-loop100.svg | 36 +- .../src/test/resources/simple-eu-loop80.svg | 36 +- .../src/test/resources/simple-eu.svg | 36 +- .../src/test/resources/tie_line.svg | 8 +- .../src/test/resources/tie_line_filtered.svg | 8 +- .../src/test/resources/vl_description_id.svg | 4 +- .../resources/vl_description_substation.svg | 4 +- .../vl_description_substation_id.svg | 4 +- .../src/test/resources/voltage_limits.svg | 6 +- 50 files changed, 766 insertions(+), 760 deletions(-) diff --git a/network-area-diagram/src/main/java/com/powsybl/nad/svg/SvgWriter.java b/network-area-diagram/src/main/java/com/powsybl/nad/svg/SvgWriter.java index edeaeb919..9ca722f25 100644 --- a/network-area-diagram/src/main/java/com/powsybl/nad/svg/SvgWriter.java +++ b/network-area-diagram/src/main/java/com/powsybl/nad/svg/SvgWriter.java @@ -899,20 +899,21 @@ private void addMetadata(Graph graph, XMLStreamWriter writer) throws XMLStreamEx busNode.getEquipmentId(), String.valueOf(busNode.getNbNeighbouringBusNodes()), String.valueOf(busNode.getIndex()), - getPrefixedId(vlNode.getDiagramId()) - ))); + getPrefixedId(vlNode.getDiagramId())))); graph.getNodesStream().forEach(node -> metadata.addNode(getPrefixedId(node.getDiagramId()), node.getEquipmentId(), getFormattedValue(node.getX()), getFormattedValue(node.getY()))); graph.getBranchEdgeStream().forEach(edge -> metadata.addEdge(getPrefixedId(edge.getDiagramId()), edge.getEquipmentId(), getPrefixedId(graph.getNode1(edge).getDiagramId()), getPrefixedId(graph.getNode2(edge).getDiagramId()), getPrefixedId(graph.getBusGraphNode1(edge).getDiagramId()), - getPrefixedId(graph.getBusGraphNode2(edge).getDiagramId()))); + getPrefixedId(graph.getBusGraphNode2(edge).getDiagramId()), + edge.getType())); graph.getThreeWtEdgesStream().forEach(edge -> metadata.addEdge(getPrefixedId(edge.getDiagramId()), edge.getEquipmentId(), getPrefixedId(graph.getNode1(edge).getDiagramId()), getPrefixedId(graph.getNode2(edge).getDiagramId()), getPrefixedId(graph.getBusGraphNode1(edge).getDiagramId()), - getPrefixedId(graph.getBusGraphNode2(edge).getDiagramId()))); + getPrefixedId(graph.getBusGraphNode2(edge).getDiagramId()), + "ThreeWtEdge")); writer.writeStartElement(METADATA_ELEMENT_NAME); metadata.writeXml(writer); diff --git a/network-area-diagram/src/main/java/com/powsybl/nad/svg/metadata/DiagramMetadata.java b/network-area-diagram/src/main/java/com/powsybl/nad/svg/metadata/DiagramMetadata.java index 664ae3448..c079b6ff4 100644 --- a/network-area-diagram/src/main/java/com/powsybl/nad/svg/metadata/DiagramMetadata.java +++ b/network-area-diagram/src/main/java/com/powsybl/nad/svg/metadata/DiagramMetadata.java @@ -100,7 +100,7 @@ public void addNode(String svgId, String equipmentId, String positionX, String p nodesMetadata.add(new NodeMetadata(svgId, equipmentId, positionX, positionY)); } - public void addEdge(String svgId, String equipmentId, String node1SvgId, String node2SvgId, String busNode1SvgId, String busNode2SvgId) { - edgesMetadata.add(new EdgeMetadata(svgId, equipmentId, node1SvgId, node2SvgId, busNode1SvgId, busNode2SvgId)); + public void addEdge(String svgId, String equipmentId, String node1SvgId, String node2SvgId, String busNode1SvgId, String busNode2SvgId, String edgeType) { + edgesMetadata.add(new EdgeMetadata(svgId, equipmentId, node1SvgId, node2SvgId, busNode1SvgId, busNode2SvgId, edgeType)); } } diff --git a/network-area-diagram/src/main/java/com/powsybl/nad/svg/metadata/EdgeMetadata.java b/network-area-diagram/src/main/java/com/powsybl/nad/svg/metadata/EdgeMetadata.java index 01a641dd6..e3e353a37 100644 --- a/network-area-diagram/src/main/java/com/powsybl/nad/svg/metadata/EdgeMetadata.java +++ b/network-area-diagram/src/main/java/com/powsybl/nad/svg/metadata/EdgeMetadata.java @@ -24,19 +24,22 @@ public class EdgeMetadata extends AbstractMetadataItem { private static final String NODE2_ATTRIBUTE = "node2"; private static final String BUS_NODE1_ATTRIBUTE = "busNode1"; private static final String BUS_NODE2_ATTRIBUTE = "busNode2"; + private static final String EDGE_TYPE_ATTRIBUTE = "type"; private final String node1SvgId; private final String node2SvgId; private final String busNode1SvgId; private final String busNode2SvgId; + private final String edgeType; public EdgeMetadata(String svgId, String equipmentId, String node1SvgId, String node2SvgId, - String busNode1SvgId, String busNode2SvgId) { + String busNode1SvgId, String busNode2SvgId, String edgeType) { super(svgId, equipmentId); this.node1SvgId = node1SvgId; this.node2SvgId = node2SvgId; this.busNode1SvgId = busNode1SvgId; this.busNode2SvgId = busNode2SvgId; + this.edgeType = edgeType; } @Override @@ -51,6 +54,7 @@ void write(XMLStreamWriter writer) throws XMLStreamException { writer.writeAttribute(NODE2_ATTRIBUTE, node2SvgId); writer.writeAttribute(BUS_NODE1_ATTRIBUTE, busNode1SvgId); writer.writeAttribute(BUS_NODE2_ATTRIBUTE, busNode2SvgId); + writer.writeAttribute(EDGE_TYPE_ATTRIBUTE, edgeType); } static class Reader implements MetadataItemReader { @@ -67,8 +71,9 @@ public EdgeMetadata read(XMLStreamReader reader) { String node2 = reader.getAttributeValue(null, NODE2_ATTRIBUTE); String busNode1 = reader.getAttributeValue(null, BUS_NODE1_ATTRIBUTE); String busNode2 = reader.getAttributeValue(null, BUS_NODE2_ATTRIBUTE); + String edgeType = reader.getAttributeValue(null, EDGE_TYPE_ATTRIBUTE); XmlUtil.readEndElementOrThrow(reader); - return new EdgeMetadata(svgId, equipmentId, node1, node2, busNode1, busNode2); + return new EdgeMetadata(svgId, equipmentId, node1, node2, busNode1, busNode2, edgeType); } catch (XMLStreamException e) { throw new UncheckedXmlStreamException(e); } diff --git a/network-area-diagram/src/test/resources/3wt.svg b/network-area-diagram/src/test/resources/3wt.svg index 55f635ec8..d9dacf6c1 100644 --- a/network-area-diagram/src/test/resources/3wt.svg +++ b/network-area-diagram/src/test/resources/3wt.svg @@ -60,9 +60,9 @@ - - - + + + diff --git a/network-area-diagram/src/test/resources/3wt_disconnected.svg b/network-area-diagram/src/test/resources/3wt_disconnected.svg index 10c625c28..cd25944da 100644 --- a/network-area-diagram/src/test/resources/3wt_disconnected.svg +++ b/network-area-diagram/src/test/resources/3wt_disconnected.svg @@ -59,9 +59,9 @@ - - - + + + diff --git a/network-area-diagram/src/test/resources/3wt_disconnected_topological.svg b/network-area-diagram/src/test/resources/3wt_disconnected_topological.svg index 9a3dd754c..0e6ab4f3a 100644 --- a/network-area-diagram/src/test/resources/3wt_disconnected_topological.svg +++ b/network-area-diagram/src/test/resources/3wt_disconnected_topological.svg @@ -124,9 +124,9 @@ - - - + + + diff --git a/network-area-diagram/src/test/resources/3wt_partial.svg b/network-area-diagram/src/test/resources/3wt_partial.svg index c35923652..a5c6982d2 100644 --- a/network-area-diagram/src/test/resources/3wt_partial.svg +++ b/network-area-diagram/src/test/resources/3wt_partial.svg @@ -60,9 +60,9 @@ - - - + + + diff --git a/network-area-diagram/src/test/resources/IEEE_118_bus.svg b/network-area-diagram/src/test/resources/IEEE_118_bus.svg index f820a7e50..16b7ee32c 100644 --- a/network-area-diagram/src/test/resources/IEEE_118_bus.svg +++ b/network-area-diagram/src/test/resources/IEEE_118_bus.svg @@ -354,192 +354,192 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/network-area-diagram/src/test/resources/IEEE_118_bus_partial.svg b/network-area-diagram/src/test/resources/IEEE_118_bus_partial.svg index edc533c43..6aba81e14 100644 --- a/network-area-diagram/src/test/resources/IEEE_118_bus_partial.svg +++ b/network-area-diagram/src/test/resources/IEEE_118_bus_partial.svg @@ -182,54 +182,54 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/network-area-diagram/src/test/resources/IEEE_118_bus_partial_non_connected.svg b/network-area-diagram/src/test/resources/IEEE_118_bus_partial_non_connected.svg index 4cd593821..889d6745a 100644 --- a/network-area-diagram/src/test/resources/IEEE_118_bus_partial_non_connected.svg +++ b/network-area-diagram/src/test/resources/IEEE_118_bus_partial_non_connected.svg @@ -172,35 +172,35 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/network-area-diagram/src/test/resources/IEEE_14_bus.svg b/network-area-diagram/src/test/resources/IEEE_14_bus.svg index fe31b0b9a..a337a3b6e 100644 --- a/network-area-diagram/src/test/resources/IEEE_14_bus.svg +++ b/network-area-diagram/src/test/resources/IEEE_14_bus.svg @@ -78,26 +78,26 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/network-area-diagram/src/test/resources/IEEE_14_bus_disconnection.svg b/network-area-diagram/src/test/resources/IEEE_14_bus_disconnection.svg index 423892422..2222ef37b 100644 --- a/network-area-diagram/src/test/resources/IEEE_14_bus_disconnection.svg +++ b/network-area-diagram/src/test/resources/IEEE_14_bus_disconnection.svg @@ -77,26 +77,26 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/network-area-diagram/src/test/resources/IEEE_14_bus_fictitious.svg b/network-area-diagram/src/test/resources/IEEE_14_bus_fictitious.svg index e64f53913..088ea544d 100644 --- a/network-area-diagram/src/test/resources/IEEE_14_bus_fictitious.svg +++ b/network-area-diagram/src/test/resources/IEEE_14_bus_fictitious.svg @@ -81,26 +81,26 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/network-area-diagram/src/test/resources/IEEE_14_bus_text_nodes.svg b/network-area-diagram/src/test/resources/IEEE_14_bus_text_nodes.svg index 39bc6e985..76fa88246 100644 --- a/network-area-diagram/src/test/resources/IEEE_14_bus_text_nodes.svg +++ b/network-area-diagram/src/test/resources/IEEE_14_bus_text_nodes.svg @@ -81,26 +81,26 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/network-area-diagram/src/test/resources/IEEE_14_bus_voltage_filter1.svg b/network-area-diagram/src/test/resources/IEEE_14_bus_voltage_filter1.svg index ccd99e39b..bb8f14917 100644 --- a/network-area-diagram/src/test/resources/IEEE_14_bus_voltage_filter1.svg +++ b/network-area-diagram/src/test/resources/IEEE_14_bus_voltage_filter1.svg @@ -134,16 +134,16 @@ - - - - - - - - - - + + + + + + + + + + diff --git a/network-area-diagram/src/test/resources/IEEE_14_bus_voltage_filter2.svg b/network-area-diagram/src/test/resources/IEEE_14_bus_voltage_filter2.svg index d4179584d..41f8d6d4a 100644 --- a/network-area-diagram/src/test/resources/IEEE_14_bus_voltage_filter2.svg +++ b/network-area-diagram/src/test/resources/IEEE_14_bus_voltage_filter2.svg @@ -146,25 +146,25 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/network-area-diagram/src/test/resources/IEEE_14_bus_voltage_filter3.svg b/network-area-diagram/src/test/resources/IEEE_14_bus_voltage_filter3.svg index 1e4d2dd8a..32dd26c51 100644 --- a/network-area-diagram/src/test/resources/IEEE_14_bus_voltage_filter3.svg +++ b/network-area-diagram/src/test/resources/IEEE_14_bus_voltage_filter3.svg @@ -140,17 +140,17 @@ - - - - - - - - - - - + + + + + + + + + + + diff --git a/network-area-diagram/src/test/resources/IEEE_14_bus_voltage_filter4.svg b/network-area-diagram/src/test/resources/IEEE_14_bus_voltage_filter4.svg index 3cf62d2e0..ec4c60a0a 100644 --- a/network-area-diagram/src/test/resources/IEEE_14_bus_voltage_filter4.svg +++ b/network-area-diagram/src/test/resources/IEEE_14_bus_voltage_filter4.svg @@ -140,19 +140,19 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/network-area-diagram/src/test/resources/IEEE_14_bus_voltage_filter5.svg b/network-area-diagram/src/test/resources/IEEE_14_bus_voltage_filter5.svg index 010bc34e7..f4f1acbc0 100644 --- a/network-area-diagram/src/test/resources/IEEE_14_bus_voltage_filter5.svg +++ b/network-area-diagram/src/test/resources/IEEE_14_bus_voltage_filter5.svg @@ -136,17 +136,17 @@ - - - - - - - - - - - + + + + + + + + + + + diff --git a/network-area-diagram/src/test/resources/IEEE_14_id_prefixed.svg b/network-area-diagram/src/test/resources/IEEE_14_id_prefixed.svg index 8d565fef5..758bf6f64 100644 --- a/network-area-diagram/src/test/resources/IEEE_14_id_prefixed.svg +++ b/network-area-diagram/src/test/resources/IEEE_14_id_prefixed.svg @@ -81,26 +81,26 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/network-area-diagram/src/test/resources/IEEE_24_bus.svg b/network-area-diagram/src/test/resources/IEEE_24_bus.svg index 4f73ee236..e8aaf08c3 100644 --- a/network-area-diagram/src/test/resources/IEEE_24_bus.svg +++ b/network-area-diagram/src/test/resources/IEEE_24_bus.svg @@ -101,44 +101,44 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/network-area-diagram/src/test/resources/IEEE_30_bus.svg b/network-area-diagram/src/test/resources/IEEE_30_bus.svg index fc9a60eb8..d105110d8 100644 --- a/network-area-diagram/src/test/resources/IEEE_30_bus.svg +++ b/network-area-diagram/src/test/resources/IEEE_30_bus.svg @@ -113,47 +113,47 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/network-area-diagram/src/test/resources/IEEE_57_bus.svg b/network-area-diagram/src/test/resources/IEEE_57_bus.svg index 733c6fb4f..1ab61ab4a 100644 --- a/network-area-diagram/src/test/resources/IEEE_57_bus.svg +++ b/network-area-diagram/src/test/resources/IEEE_57_bus.svg @@ -217,86 +217,86 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/network-area-diagram/src/test/resources/current_limits.svg b/network-area-diagram/src/test/resources/current_limits.svg index e5aa0614c..5e23fdddf 100644 --- a/network-area-diagram/src/test/resources/current_limits.svg +++ b/network-area-diagram/src/test/resources/current_limits.svg @@ -59,8 +59,8 @@ - - + + diff --git a/network-area-diagram/src/test/resources/dangling_line_connected.svg b/network-area-diagram/src/test/resources/dangling_line_connected.svg index 8fd8161fc..80f12d793 100644 --- a/network-area-diagram/src/test/resources/dangling_line_connected.svg +++ b/network-area-diagram/src/test/resources/dangling_line_connected.svg @@ -63,11 +63,11 @@ - - - - - + + + + + diff --git a/network-area-diagram/src/test/resources/dangling_line_disconnected.svg b/network-area-diagram/src/test/resources/dangling_line_disconnected.svg index 2e95fd72f..35b96db74 100644 --- a/network-area-diagram/src/test/resources/dangling_line_disconnected.svg +++ b/network-area-diagram/src/test/resources/dangling_line_disconnected.svg @@ -63,11 +63,11 @@ - - - - - + + + + + diff --git a/network-area-diagram/src/test/resources/detailed_text_node.svg b/network-area-diagram/src/test/resources/detailed_text_node.svg index cf9bcbb5b..a7996b2e2 100644 --- a/network-area-diagram/src/test/resources/detailed_text_node.svg +++ b/network-area-diagram/src/test/resources/detailed_text_node.svg @@ -124,8 +124,8 @@ - - + + diff --git a/network-area-diagram/src/test/resources/detailed_text_node_no_legend.svg b/network-area-diagram/src/test/resources/detailed_text_node_no_legend.svg index 0b83ecd33..9f3476a98 100644 --- a/network-area-diagram/src/test/resources/detailed_text_node_no_legend.svg +++ b/network-area-diagram/src/test/resources/detailed_text_node_no_legend.svg @@ -124,8 +124,8 @@ - - + + diff --git a/network-area-diagram/src/test/resources/diamond-spring-repulsion-factor-0.0.svg b/network-area-diagram/src/test/resources/diamond-spring-repulsion-factor-0.0.svg index 8a770bdca..53882b592 100644 --- a/network-area-diagram/src/test/resources/diamond-spring-repulsion-factor-0.0.svg +++ b/network-area-diagram/src/test/resources/diamond-spring-repulsion-factor-0.0.svg @@ -83,22 +83,22 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/network-area-diagram/src/test/resources/diamond-spring-repulsion-factor-0.2.svg b/network-area-diagram/src/test/resources/diamond-spring-repulsion-factor-0.2.svg index 6e43c02cd..0aefc3cb7 100644 --- a/network-area-diagram/src/test/resources/diamond-spring-repulsion-factor-0.2.svg +++ b/network-area-diagram/src/test/resources/diamond-spring-repulsion-factor-0.2.svg @@ -83,22 +83,22 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/network-area-diagram/src/test/resources/edge_info_current.svg b/network-area-diagram/src/test/resources/edge_info_current.svg index b81262707..3a2180e9d 100644 --- a/network-area-diagram/src/test/resources/edge_info_current.svg +++ b/network-area-diagram/src/test/resources/edge_info_current.svg @@ -59,8 +59,8 @@ - - + + diff --git a/network-area-diagram/src/test/resources/edge_info_double_labels.svg b/network-area-diagram/src/test/resources/edge_info_double_labels.svg index fb7cf7fbc..6f8af3934 100644 --- a/network-area-diagram/src/test/resources/edge_info_double_labels.svg +++ b/network-area-diagram/src/test/resources/edge_info_double_labels.svg @@ -60,9 +60,9 @@ - - - + + + diff --git a/network-area-diagram/src/test/resources/edge_info_missing_label.svg b/network-area-diagram/src/test/resources/edge_info_missing_label.svg index 62a7ae295..337b63ee1 100644 --- a/network-area-diagram/src/test/resources/edge_info_missing_label.svg +++ b/network-area-diagram/src/test/resources/edge_info_missing_label.svg @@ -59,8 +59,8 @@ - - + + diff --git a/network-area-diagram/src/test/resources/edge_info_perpendicular_label.svg b/network-area-diagram/src/test/resources/edge_info_perpendicular_label.svg index 12d7791ed..a7f9a73df 100644 --- a/network-area-diagram/src/test/resources/edge_info_perpendicular_label.svg +++ b/network-area-diagram/src/test/resources/edge_info_perpendicular_label.svg @@ -59,8 +59,8 @@ - - + + diff --git a/network-area-diagram/src/test/resources/edge_info_reactive_power.svg b/network-area-diagram/src/test/resources/edge_info_reactive_power.svg index aa70b4a6c..0a65e3f92 100644 --- a/network-area-diagram/src/test/resources/edge_info_reactive_power.svg +++ b/network-area-diagram/src/test/resources/edge_info_reactive_power.svg @@ -59,8 +59,8 @@ - - + + diff --git a/network-area-diagram/src/test/resources/edge_info_shift.svg b/network-area-diagram/src/test/resources/edge_info_shift.svg index 4ca9e0ffe..13132e77d 100644 --- a/network-area-diagram/src/test/resources/edge_info_shift.svg +++ b/network-area-diagram/src/test/resources/edge_info_shift.svg @@ -63,11 +63,11 @@ - - - - - + + + + + diff --git a/network-area-diagram/src/test/resources/edge_with_id.svg b/network-area-diagram/src/test/resources/edge_with_id.svg index f089ea31d..a521d92db 100644 --- a/network-area-diagram/src/test/resources/edge_with_id.svg +++ b/network-area-diagram/src/test/resources/edge_with_id.svg @@ -63,11 +63,11 @@ - - - - - + + + + + diff --git a/network-area-diagram/src/test/resources/edge_without_id.svg b/network-area-diagram/src/test/resources/edge_without_id.svg index 8fd8161fc..80f12d793 100644 --- a/network-area-diagram/src/test/resources/edge_without_id.svg +++ b/network-area-diagram/src/test/resources/edge_without_id.svg @@ -63,11 +63,11 @@ - - - - - + + + + + diff --git a/network-area-diagram/src/test/resources/hvdc-vl-depth-1.svg b/network-area-diagram/src/test/resources/hvdc-vl-depth-1.svg index 93b70d233..9f0ee0d1c 100644 --- a/network-area-diagram/src/test/resources/hvdc-vl-depth-1.svg +++ b/network-area-diagram/src/test/resources/hvdc-vl-depth-1.svg @@ -57,7 +57,7 @@ - + diff --git a/network-area-diagram/src/test/resources/hvdc.svg b/network-area-diagram/src/test/resources/hvdc.svg index 4503f1678..097d20cc4 100644 --- a/network-area-diagram/src/test/resources/hvdc.svg +++ b/network-area-diagram/src/test/resources/hvdc.svg @@ -63,11 +63,11 @@ - - - - - + + + + + diff --git a/network-area-diagram/src/test/resources/parallel_transformers.svg b/network-area-diagram/src/test/resources/parallel_transformers.svg index c01057415..e1565c473 100644 --- a/network-area-diagram/src/test/resources/parallel_transformers.svg +++ b/network-area-diagram/src/test/resources/parallel_transformers.svg @@ -60,9 +60,9 @@ - - - + + + diff --git a/network-area-diagram/src/test/resources/simple-eu-loop100.svg b/network-area-diagram/src/test/resources/simple-eu-loop100.svg index 1df11c179..7491f39b9 100644 --- a/network-area-diagram/src/test/resources/simple-eu-loop100.svg +++ b/network-area-diagram/src/test/resources/simple-eu-loop100.svg @@ -140,24 +140,24 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/network-area-diagram/src/test/resources/simple-eu-loop80.svg b/network-area-diagram/src/test/resources/simple-eu-loop80.svg index 4e7d9cb8e..dccd94bd6 100644 --- a/network-area-diagram/src/test/resources/simple-eu-loop80.svg +++ b/network-area-diagram/src/test/resources/simple-eu-loop80.svg @@ -140,24 +140,24 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/network-area-diagram/src/test/resources/simple-eu.svg b/network-area-diagram/src/test/resources/simple-eu.svg index ecab39a77..9997b07d2 100644 --- a/network-area-diagram/src/test/resources/simple-eu.svg +++ b/network-area-diagram/src/test/resources/simple-eu.svg @@ -140,24 +140,24 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/network-area-diagram/src/test/resources/tie_line.svg b/network-area-diagram/src/test/resources/tie_line.svg index 73f488bcf..349d052bd 100644 --- a/network-area-diagram/src/test/resources/tie_line.svg +++ b/network-area-diagram/src/test/resources/tie_line.svg @@ -61,10 +61,10 @@ - - - - + + + + diff --git a/network-area-diagram/src/test/resources/tie_line_filtered.svg b/network-area-diagram/src/test/resources/tie_line_filtered.svg index fa0822ae5..3ad1dafb6 100644 --- a/network-area-diagram/src/test/resources/tie_line_filtered.svg +++ b/network-area-diagram/src/test/resources/tie_line_filtered.svg @@ -61,10 +61,10 @@ - - - - + + + + diff --git a/network-area-diagram/src/test/resources/vl_description_id.svg b/network-area-diagram/src/test/resources/vl_description_id.svg index 9ff56fc74..5561b9897 100644 --- a/network-area-diagram/src/test/resources/vl_description_id.svg +++ b/network-area-diagram/src/test/resources/vl_description_id.svg @@ -124,8 +124,8 @@ - - + + diff --git a/network-area-diagram/src/test/resources/vl_description_substation.svg b/network-area-diagram/src/test/resources/vl_description_substation.svg index 2b493c29e..c4a48668c 100644 --- a/network-area-diagram/src/test/resources/vl_description_substation.svg +++ b/network-area-diagram/src/test/resources/vl_description_substation.svg @@ -124,8 +124,8 @@ - - + + diff --git a/network-area-diagram/src/test/resources/vl_description_substation_id.svg b/network-area-diagram/src/test/resources/vl_description_substation_id.svg index 261684798..fa59fbbde 100644 --- a/network-area-diagram/src/test/resources/vl_description_substation_id.svg +++ b/network-area-diagram/src/test/resources/vl_description_substation_id.svg @@ -124,8 +124,8 @@ - - + + diff --git a/network-area-diagram/src/test/resources/voltage_limits.svg b/network-area-diagram/src/test/resources/voltage_limits.svg index 3c29c9010..6d75ea9b9 100644 --- a/network-area-diagram/src/test/resources/voltage_limits.svg +++ b/network-area-diagram/src/test/resources/voltage_limits.svg @@ -60,9 +60,9 @@ - - - + + + From e38096f434d92be11722b0ac3585e59cab26b5ec Mon Sep 17 00:00:00 2001 From: "massimo.ferraro" Date: Fri, 3 May 2024 17:19:11 +0200 Subject: [PATCH 2/2] Add getType to Edge interface in network area diagram Signed-off-by: massimo.ferraro --- .../main/java/com/powsybl/nad/model/AbstractEdge.java | 10 +++++++++- .../main/java/com/powsybl/nad/model/BranchEdge.java | 8 +------- .../src/main/java/com/powsybl/nad/model/Edge.java | 1 + .../src/main/java/com/powsybl/nad/model/TextEdge.java | 4 +++- .../main/java/com/powsybl/nad/model/ThreeWtEdge.java | 4 +++- .../src/main/java/com/powsybl/nad/svg/SvgWriter.java | 2 +- 6 files changed, 18 insertions(+), 11 deletions(-) diff --git a/network-area-diagram/src/main/java/com/powsybl/nad/model/AbstractEdge.java b/network-area-diagram/src/main/java/com/powsybl/nad/model/AbstractEdge.java index 17561fd44..b0b7595aa 100644 --- a/network-area-diagram/src/main/java/com/powsybl/nad/model/AbstractEdge.java +++ b/network-area-diagram/src/main/java/com/powsybl/nad/model/AbstractEdge.java @@ -11,7 +11,15 @@ */ public abstract class AbstractEdge extends AbstractIdentifiable implements Edge { - protected AbstractEdge(String diagramId, String equipmentId, String nameOrId) { + protected final String type; + + protected AbstractEdge(String diagramId, String equipmentId, String nameOrId, String type) { super(diagramId, equipmentId, nameOrId); + this.type = type; + } + + @Override + public String getType() { + return type; } } diff --git a/network-area-diagram/src/main/java/com/powsybl/nad/model/BranchEdge.java b/network-area-diagram/src/main/java/com/powsybl/nad/model/BranchEdge.java index bb848cd96..04625137a 100644 --- a/network-area-diagram/src/main/java/com/powsybl/nad/model/BranchEdge.java +++ b/network-area-diagram/src/main/java/com/powsybl/nad/model/BranchEdge.java @@ -38,15 +38,9 @@ public int getNum() { private List points1 = Collections.emptyList(); private List points2 = Collections.emptyList(); private final boolean[] visible = new boolean[] {true, true}; - private final String type; public BranchEdge(String diagramId, String equipmentId, String nameOrId, String type) { - super(diagramId, equipmentId, nameOrId); - this.type = type; - } - - public String getType() { - return type; + super(diagramId, equipmentId, nameOrId, type); } public boolean isTransformerEdge() { diff --git a/network-area-diagram/src/main/java/com/powsybl/nad/model/Edge.java b/network-area-diagram/src/main/java/com/powsybl/nad/model/Edge.java index 1dbf166cf..80216aaa8 100644 --- a/network-area-diagram/src/main/java/com/powsybl/nad/model/Edge.java +++ b/network-area-diagram/src/main/java/com/powsybl/nad/model/Edge.java @@ -11,4 +11,5 @@ */ public interface Edge extends Identifiable { + String getType(); } diff --git a/network-area-diagram/src/main/java/com/powsybl/nad/model/TextEdge.java b/network-area-diagram/src/main/java/com/powsybl/nad/model/TextEdge.java index adea23d2f..ae0f4590b 100644 --- a/network-area-diagram/src/main/java/com/powsybl/nad/model/TextEdge.java +++ b/network-area-diagram/src/main/java/com/powsybl/nad/model/TextEdge.java @@ -14,10 +14,12 @@ */ public class TextEdge extends AbstractEdge { + public static final String TEXT_EDGE = "TextEdge"; + private Point[] points; public TextEdge(String diagramId) { - super(diagramId, null, null); + super(diagramId, null, null, TEXT_EDGE); } public void setPoints(Point... points) { diff --git a/network-area-diagram/src/main/java/com/powsybl/nad/model/ThreeWtEdge.java b/network-area-diagram/src/main/java/com/powsybl/nad/model/ThreeWtEdge.java index 388089f2a..e117f7465 100644 --- a/network-area-diagram/src/main/java/com/powsybl/nad/model/ThreeWtEdge.java +++ b/network-area-diagram/src/main/java/com/powsybl/nad/model/ThreeWtEdge.java @@ -19,6 +19,8 @@ public enum Side { ONE, TWO, THREE; } + public static final String THREE_WT_EDGE = "ThreeWtEdge"; + private Side side; private List points; @@ -26,7 +28,7 @@ public enum Side { private final boolean visible; public ThreeWtEdge(String diagramId, String equipmentId, String transformerName, Side side, boolean visible) { - super(diagramId, equipmentId, transformerName); + super(diagramId, equipmentId, transformerName, THREE_WT_EDGE); this.side = side; this.visible = visible; } diff --git a/network-area-diagram/src/main/java/com/powsybl/nad/svg/SvgWriter.java b/network-area-diagram/src/main/java/com/powsybl/nad/svg/SvgWriter.java index 9ca722f25..be4316d91 100644 --- a/network-area-diagram/src/main/java/com/powsybl/nad/svg/SvgWriter.java +++ b/network-area-diagram/src/main/java/com/powsybl/nad/svg/SvgWriter.java @@ -913,7 +913,7 @@ private void addMetadata(Graph graph, XMLStreamWriter writer) throws XMLStreamEx getPrefixedId(graph.getNode2(edge).getDiagramId()), getPrefixedId(graph.getBusGraphNode1(edge).getDiagramId()), getPrefixedId(graph.getBusGraphNode2(edge).getDiagramId()), - "ThreeWtEdge")); + edge.getType())); writer.writeStartElement(METADATA_ELEMENT_NAME); metadata.writeXml(writer);