Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates the Geographical display of NADs to spread the nodes, helping… #114

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading