diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 2c46c84..99f5e5f 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -16,11 +16,11 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v2.3.4
- - name: Set up JDK 11
+ - name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'zulu'
- java-version: 11
+ java-version: 17
- name: Build diagram viewer with Maven
run: mvn --file diagram-viewer --batch-mode -P jacoco,checks package
diff --git a/diagram-viewer/pom.xml b/diagram-viewer/pom.xml
index 2be067f..b6889fe 100644
--- a/diagram-viewer/pom.xml
+++ b/diagram-viewer/pom.xml
@@ -15,7 +15,7 @@
com.powsybl
powsybl-parent
- 4
+ 15
@@ -35,7 +35,7 @@
UTF-8
- 11
+ 17
19.0.2.1
0.0.8
2.0.7
@@ -43,7 +43,7 @@
4.13.1
17
17
- 2023.2.0
+ 2023.3.0
diff --git a/diagram-viewer/src/main/java/com/powsybl/diagram/viewer/Model.java b/diagram-viewer/src/main/java/com/powsybl/diagram/viewer/Model.java
index 6297369..642d5e9 100644
--- a/diagram-viewer/src/main/java/com/powsybl/diagram/viewer/Model.java
+++ b/diagram-viewer/src/main/java/com/powsybl/diagram/viewer/Model.java
@@ -28,7 +28,7 @@ public Model(BooleanProperty showNames, NetworkAreaDiagramModel nadModel, Single
this.nadModel = nadModel;
this.sldModel = sldModel;
this.nadModel.getSvgParametersBean().bind(showNames);
- this.sldModel.getLayoutParametersBean().bind(showNames);
+ this.sldModel.getSvgParametersBean().bind(showNames);
}
public void setNetwork(Network network) {
diff --git a/diagram-viewer/src/main/java/com/powsybl/diagram/viewer/nad/NetworkAreaDiagramController.java b/diagram-viewer/src/main/java/com/powsybl/diagram/viewer/nad/NetworkAreaDiagramController.java
index 1792f54..78f5481 100644
--- a/diagram-viewer/src/main/java/com/powsybl/diagram/viewer/nad/NetworkAreaDiagramController.java
+++ b/diagram-viewer/src/main/java/com/powsybl/diagram/viewer/nad/NetworkAreaDiagramController.java
@@ -14,7 +14,9 @@
import com.powsybl.iidm.network.Network;
import com.powsybl.iidm.network.Substation;
import com.powsybl.iidm.network.VoltageLevel;
+import com.powsybl.nad.NadParameters;
import com.powsybl.nad.NetworkAreaDiagram;
+import com.powsybl.nad.build.iidm.VoltageLevelFilter;
import javafx.concurrent.Service;
import javafx.concurrent.Task;
import javafx.fxml.FXML;
@@ -24,6 +26,7 @@
import java.io.IOException;
import java.io.StringWriter;
import java.util.List;
+import java.util.function.Predicate;
import java.util.stream.Collectors;
/**
@@ -54,13 +57,11 @@ protected Task createTask() {
return new Task<>() {
@Override
protected String call() {
- NetworkAreaDiagram nad = getNetworkAreaDiagram(network, model, container);
- nad.draw(writer,
- model.getSvgParameters(),
- model.getLayoutParameters(),
- model.getStyleProvider(network),
- model.getLabelProvider(network),
- model.getLayoutFactory());
+ Predicate vls = getVoltageLevelFilter(network, model, container);
+ NadParameters nadParameters = new NadParameters();
+ nadParameters.setLayoutParameters(model.getLayoutParameters());
+ nadParameters.setSvgParameters(model.getSvgParameters());
+ NetworkAreaDiagram.draw(network, writer, nadParameters, vls);
return writer.toString();
}
};
@@ -75,15 +76,15 @@ protected String call() {
nadService.start();
}
- private static NetworkAreaDiagram getNetworkAreaDiagram(Network network, NetworkAreaDiagramModel model, Container> container) {
+ private static Predicate getVoltageLevelFilter(Network network, NetworkAreaDiagramModel model, Container> container) {
switch (container.getContainerType()) {
case NETWORK:
- return new NetworkAreaDiagram((Network) container);
+ return VoltageLevelFilter.NO_FILTER;
case SUBSTATION:
List vls = ((Substation) container).getVoltageLevelStream().map(VoltageLevel::getId).collect(Collectors.toList());
- return new NetworkAreaDiagram(network, vls, model.getDepth());
+ return VoltageLevelFilter.createVoltageLevelsDepthFilter(network, vls, model.getDepth());
case VOLTAGE_LEVEL:
- return new NetworkAreaDiagram(network, container.getId(), model.getDepth());
+ return VoltageLevelFilter.createVoltageLevelDepthFilter(network, container.getId(), model.getDepth());
default:
throw new AssertionError();
}
diff --git a/diagram-viewer/src/main/java/com/powsybl/diagram/viewer/nad/NetworkAreaDiagramModel.java b/diagram-viewer/src/main/java/com/powsybl/diagram/viewer/nad/NetworkAreaDiagramModel.java
index 2046e79..152294f 100644
--- a/diagram-viewer/src/main/java/com/powsybl/diagram/viewer/nad/NetworkAreaDiagramModel.java
+++ b/diagram-viewer/src/main/java/com/powsybl/diagram/viewer/nad/NetworkAreaDiagramModel.java
@@ -30,7 +30,7 @@ public class NetworkAreaDiagramModel extends DiagramModel {
private static final String TOPOLOGICAL_STYLE_PROVIDER = "Topological";
// Layout Parameters
- private final LayoutParametersBean layoutParameters;
+ private final LayoutParametersBean layoutParametersBean;
// SVG Parameters
private final SvgParametersBean svgParameters;
@@ -67,7 +67,7 @@ public NetworkAreaDiagramModel(ReadOnlyObjectProperty depth,
this.layoutFactory.bind(layout);
// Layout parameters
- layoutParameters = new LayoutParametersBean(textNodesIncluded, springRepulsionFactor);
+ layoutParametersBean = new LayoutParametersBean(textNodesIncluded, springRepulsionFactor);
// SVG parameters
svgParameters = new SvgParametersBean(infoAlongEdge,
@@ -91,7 +91,7 @@ public SvgParameters getSvgParameters() {
}
public LayoutParameters getLayoutParameters() {
- return layoutParameters.getLayoutParameters();
+ return layoutParametersBean.getLayoutParameters();
}
public LabelProvider getLabelProvider(Network network) {
@@ -114,6 +114,6 @@ public SvgParametersBean getSvgParametersBean() {
public void addListener(ChangeListener