From 4f01cc22b5f9ebc8392842b7b57fd25e9a0373e0 Mon Sep 17 00:00:00 2001 From: BOUTIER Charly Date: Tue, 24 Sep 2024 11:41:51 +0200 Subject: [PATCH] Updates the Geographical display of NADs to spread the nodes, helping visibility. Signed-off-by: BOUTIER Charly --- .../com/powsybl/sld/server/NetworkAreaDiagramService.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/powsybl/sld/server/NetworkAreaDiagramService.java b/src/main/java/com/powsybl/sld/server/NetworkAreaDiagramService.java index 9ca5456..3c286c5 100644 --- a/src/main/java/com/powsybl/sld/server/NetworkAreaDiagramService.java +++ b/src/main/java/com/powsybl/sld/server/NetworkAreaDiagramService.java @@ -15,6 +15,7 @@ import com.powsybl.nad.NadParameters; import com.powsybl.nad.NetworkAreaDiagram; import com.powsybl.nad.build.iidm.VoltageLevelFilter; +import com.powsybl.nad.layout.BasicForceLayout; import com.powsybl.nad.layout.GeographicalLayoutFactory; import com.powsybl.nad.layout.LayoutParameters; import com.powsybl.nad.svg.SvgParameters; @@ -51,6 +52,9 @@ class NetworkAreaDiagramService { @Autowired private GeoDataService geoDataService; + private static final int SCALING_FACTOR = 450000; + private static final double RADIUS_FACTOR = 300; + public SvgAndMetadata generateNetworkAreaDiagramSvg(UUID networkUuid, String variantId, List voltageLevelsIds, int depth, boolean withGeoData) { Network network = DiagramUtils.getNetwork(networkUuid, variantId, networkStoreService, PreloadingStrategy.COLLECTION); List existingVLIds = voltageLevelsIds.stream().filter(vl -> network.getVoltageLevel(vl) != null).toList(); @@ -75,7 +79,7 @@ public SvgAndMetadata generateNetworkAreaDiagramSvg(UUID networkUuid, String var //get voltage levels' positions on depth+1 to be able to locate lines on depth List voltageLevels = VoltageLevelFilter.createVoltageLevelsDepthFilter(network, existingVLIds, depth + 1).getVoltageLevels().stream().toList(); assignGeoDataCoordinates(network, networkUuid, variantId, voltageLevels); - nadParameters.setLayoutFactory(new GeographicalLayoutFactory(network)); + nadParameters.setLayoutFactory(new GeographicalLayoutFactory(network, SCALING_FACTOR, RADIUS_FACTOR, BasicForceLayout::new)); } nadParameters.setStyleProviderFactory(n -> new TopologicalStyleProvider(network));