Layout parameters¶
The LayoutParameters class gathers parameters to customize the layout of the graph, i.e. the way the different elements are positioned on the graph.
All parameters have default values.
Name |
Type |
Default value |
|---|---|---|
\(maxSteps\) |
|
1000 |
\(timeoutSeconds\) |
|
15 |
\(textNodesForceLayout\) |
|
false |
\(textNodeFixedShift\) |
|
Point(100, -40) |
\(textNodeEdgeConnectionYShift\) |
|
25 |
\(injectionsAdded\) |
|
false |
Users can customize one or several parameters according to their needs.
In the following example, the maxSteps parameter and the textNodesForceLayout parameter are customized, the other parameters are left to their default values:
LayoutParameters layoutParameters = new LayoutParameters().setMaxSteps(500).setTextNodesForceLayout(true);
Layout parameters are further described below.
Layout algorithm parameters¶
The maxSteps parameter¶
The maxSteps parameter represents the maximum number of iterations that an automatic layout algorithm is permitted to perform. The value assigned to this parameter strikes a balance between speed and rendering quality.
With maxSteps = 1000(default value)
With maxSteps = 100:
LayoutParameters layoutParameters = new LayoutParameters().setMaxSteps(100);
NB1: for a very simple network like the one displayed above, the difference in speed is not significant.
NB2: the maximum number of iterations is not always reached as there are typically other stopping criteria in layout algorithms.
The timeoutSeconds parameter¶
The timeoutSeconds parameter represents the maximum amount of time an automatic layout algorithm may spend.
As a consequence, this parameter will limit the number of iterations performed by the algorithm if the time limit is reached before the maximum number of iterations is reached.
Again, as for maxSteps parameter, the value assigned strikes a balance between speed and rendering quality.
Text node parameters¶
The textNodesForceLayout parameter¶
If the textNodesForceLayout parameter is set to true, the text box nodes are positioned by the force layout algorithm. If the parameter is set to false, the text boxes are fixed in position relative to the voltage level node to which they are attached.
With textNodesForceLayout = false (default value)
With textNodesForceLayout = true
LayoutParameters layoutParameters = new LayoutParameters().setTextNodesForceLayout(true);
The textNodeFixedShift parameter¶
The textNodeFixedShift parameter represents the offset between the text box node and the voltage level node when the text node positions are fixed (i.e. when textNodesForceLayout = false).
With textNodeFixedShift = Point(100, -40) (default value)
With textNodeFixedShift = Point(50, 40)
LayoutParameters layoutParameters = new LayoutParameters().setTextNodeFixedShift(50, 40);
The textNodeEdgeConnectionYShift parameter¶
The textNodeEdgeConnectionYShift parameter is used to customize the position of the edge connection point on the text box.
With textNodeEdgeConnectionYShift = 25 (default value)
With textNodeEdgeConnectionYShift = 50
LayoutParameters layoutParameters = new LayoutParameters().setTextNodeEdgeConnectionYShift(50d);
Injection parameters¶
The injectionsAdded parameter¶
This parameter allows the user to display the injections that are present on the bus nodes of the voltage levels.
With injectionsAdded = false:
With injectionsAdded = true:
LayoutParameters layoutParameters = new LayoutParameters().setInjectionsAdded(true);
The represented injections are listed in the table below.
Icon in the DefaultLibrary |
Injection type |
|---|---|
Unknown component |