-
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 <kevin.lesaulnier@rte-france.com>
- Loading branch information
1 parent
252f697
commit f9e6df8
Showing
4 changed files
with
139 additions
and
7 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.getId(), "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
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