Skip to content
This repository has been archived by the owner on Nov 18, 2022. It is now read-only.

Commit

Permalink
Smaller node for single-bus voltage level (#55)
Browse files Browse the repository at this point in the history
* Voltage level circle smaller if only one bus
* Update unit tests

Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
  • Loading branch information
flo-dup authored Feb 28, 2022
1 parent ca9ff1d commit edadd25
Show file tree
Hide file tree
Showing 18 changed files with 2,712 additions and 2,708 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/powsybl/nad/svg/SvgParameters.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class SvgParameters {
private double arrowShift = 0.3;
private double arrowLabelShift = 0.12;
private double converterStationWidth = 0.6;
private double voltageLevelCircleRadius = 0.6;
private double voltageLevelCircleRadius = 0.3;
private double fictitiousVoltageLevelCircleRadius = 0.15;
private double transformerCircleRadius = 0.2;
private double nodeHollowWidth = 0.1;
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/com/powsybl/nad/svg/SvgWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,10 @@ protected double getVoltageLevelCircleRadius(VoltageLevelNode vlNode) {
}

protected static double getVoltageLevelCircleRadius(VoltageLevelNode vlNode, SvgParameters svgParameters) {
return vlNode.isFictitious() ? svgParameters.getFictitiousVoltageLevelCircleRadius() : svgParameters.getVoltageLevelCircleRadius();
if (vlNode.isFictitious()) {
return svgParameters.getFictitiousVoltageLevelCircleRadius();
}
int nbBuses = vlNode.getBusNodes().size();
return Math.min(Math.max(nbBuses, 1), 2) * svgParameters.getVoltageLevelCircleRadius();
}
}
24 changes: 12 additions & 12 deletions src/test/resources/3wt.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions src/test/resources/3wt_partial.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit edadd25

Please sign in to comment.