Skip to content

Migration guide v4.0.0

Nicolas Rol edited this page Oct 3, 2023 · 14 revisions

Diagram APIs modification

Rationale

NetworkAreaDiagram and SingleLineDiagram APIs have been modified to:

  • Bring more consistency between both APIs, especially now they share the same github repository;
  • Offer a better user experience for those who want to play around and customize their diagrams.

Main changes

Common

SldParameters and NadParameters are the new classes to use to customize diagrams. Those two classes contain default parameters for each of their components. Users only need to set the components they want to customize.

Example for single-line diagrams:

SldParameters sldParameters = new SldParameters()
                                  .setLayoutParameters(projectCustomizedLayoutParameters)
                                  .setComponentLibrary(projectCustomizedComponentLibrary);

SingleLineDiagram.draw(myNetwork, "myNetwork", pathToSvgFile, sldParameters);

Example for network-area diagrams:

NadParameters nadParameters = new NadParameters()
                                  .setSvgParameters(projectCustomizedSvgParameters)
                                  .setLabelProviderFactory(ProjectCustomizedLabelProvider::new)
                                  .setIdProviderFactory(ProjectCustomizedIntIdProvider::new);


NetworkAreaDiagram.draw(myNetwork, pathToSvgFile, nadParameters, VoltageLevelFilter.NO_FILTER);

If no customization is needed, plain functions are still available.

Examples:

NetworkAreaDiagram.draw(network, pathToSvgFile);
SingleLineDiagram.draw(network, "myNetwork", pathToSvgFile);

SLD

New SvgParameters class

Previous version

Parameters used for layout purposes and parameters used for svg construction purposes were mixed into a single LayoutParameters class

New version

Some parameters from the LayoutParameters class have been migrated to a new SvgParameters class:

  • String prefixId
  • String undefinedValueSymbol
  • String languageTag
  • int voltageValuePrecision
  • int powerValuePrecision
  • int angleValuePrecision
  • int currentValuePrecision
  • double busInfoMargin
  • double feederInfosIntraMargin
  • double feederInfosOuterMargin
  • boolean feederInfoSymmetry
  • boolean addNodesInfos
  • boolean useName
  • double angleLabelShift
  • boolean labelCentered
  • boolean labelDiagonal
  • boolean tooltipEnabled
  • boolean svgWidthAndHeightAdded
  • SvgParameters.CssLocation cssLocation
  • boolean avoidSVGComponentsDuplication
  • String diagramName
  • boolean drawStraightWires
  • boolean showGrid
  • boolean showInternalNodes
  • boolean displayCurrentFeederInfo

NB: the SvgParameters and LayoutParameters distinction was already there for network-area diagrams. Now both diagrams have differenciated LayoutParameters and SvgParameters classes.

NAD

NetworkAreaDiagram draw function is now static

Previous version
NetworkAreaDiagram nad = new NetworkAreaDiagram(...);
nad.draw(...);

New version

NetworkAreaDiagram.draw(...);

NB: the NetworkAreaDiagram class is now similar to the SingleLineDiagram class which has a SingleLineDiagram.draw(...) static function.

CSS changes

In ConvergenceLibrary > components.css

Before

.sld-vsc {stroke: var(--sld-vl-color, blue); font-size: 7.43px; fill: none}

After

.sld-vsc {stroke: var(--sld-vl-color, blue); font-size: 7.43px; fill: none}
.sld-lcc {stroke: var(--sld-vl-color, blue); font-size: 7.43px; fill: none}

In FlatDesignLibrary > components.css

Before

.sld-lcc {fill: var(--sld-vl-color, blue)}

After

.sld-vsc {fill: var(--sld-vl-color, blue)}
.sld-lcc {fill: var(--sld-vl-color, blue)}

Compatibility

Java version support

powsybl-diagram now only supports Java 17 and higher. Please check that your installed SDK is still compatible. If you are using Ubuntu 20.04 LTS and the preinstalled Maven version, you will need to upgrade your Maven version too at least up to a version 3.8.x.