-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: LE SAULNIER Kevin <[email protected]>
- Loading branch information
LE SAULNIER Kevin
committed
Nov 14, 2024
1 parent
61165a0
commit 051ed0c
Showing
3 changed files
with
34 additions
and
6 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/main/java/com/powsybl/sld/server/CommonLabelProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.powsybl.sld.server; | ||
|
||
import com.powsybl.iidm.network.Network; | ||
import com.powsybl.iidm.network.VoltageLevel; | ||
import com.powsybl.sld.layout.LayoutParameters; | ||
import com.powsybl.sld.library.ComponentLibrary; | ||
import com.powsybl.sld.model.graphs.VoltageLevelGraph; | ||
import com.powsybl.sld.svg.BusLegendInfo; | ||
import com.powsybl.sld.svg.DefaultLabelProvider; | ||
import com.powsybl.sld.svg.SvgParameters; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
public class CommonLabelProvider extends DefaultLabelProvider { | ||
public CommonLabelProvider(Network network, ComponentLibrary componentLibrary, LayoutParameters layoutParameters, SvgParameters svgParameters) { | ||
super(network, componentLibrary, layoutParameters, svgParameters); | ||
} | ||
|
||
@Override | ||
public List<BusLegendInfo> getBusLegendInfos(VoltageLevelGraph graph) { | ||
VoltageLevel vl = network.getVoltageLevel(graph.getVoltageLevelInfos().getId()); | ||
return vl.getBusView().getBusStream() | ||
.map(b -> new BusLegendInfo(b.getId(), List.of( | ||
new BusLegendInfo.Caption(b.getNameOrId(), "busId"), | ||
new BusLegendInfo.Caption(valueFormatter.formatVoltage(b.getV(), "kV"), "v"), | ||
new BusLegendInfo.Caption(valueFormatter.formatAngleInDegrees(b.getAngle()), "angle") | ||
))) | ||
.collect(Collectors.toList()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters