Skip to content

Commit

Permalink
Updates the Geographical display of NADs to spread the nodes, helping…
Browse files Browse the repository at this point in the history
… visibility. (#114)

Signed-off-by: BOUTIER Charly <[email protected]>
Co-authored-by: BOUTIER Charly <[email protected]>
  • Loading branch information
EstherDarkish and BOUTIER Charly authored Sep 24, 2024
1 parent c987aea commit c03f44c
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<String> voltageLevelsIds, int depth, boolean withGeoData) {
Network network = DiagramUtils.getNetwork(networkUuid, variantId, networkStoreService, PreloadingStrategy.COLLECTION);
List<String> existingVLIds = voltageLevelsIds.stream().filter(vl -> network.getVoltageLevel(vl) != null).toList();
Expand All @@ -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<VoltageLevel> 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));
Expand Down

0 comments on commit c03f44c

Please sign in to comment.