-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[sld-viewer] Simplify computations for navigation arrow #34
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Florian Dupuy <[email protected]>
Signed-off-by: Florian Dupuy <[email protected]>
Signed-off-by: Florian Dupuy <[email protected]>
Signed-off-by: Florian Dupuy <[email protected]>
e4c1176
to
2606c6e
Compare
Signed-off-by: Florian Dupuy <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this change, the navigation arrows' vertical positions could be different, compared to the current logic's output.
The first loop should be more correctly interpreted as "one map for computing the max ordinate for each node's VL id, one map for computing the min ordinate for each node's VL id" (instead of "one map for computing the max ordinate for each node id, one map for computing the min ordinate for each node id" ).
The two maps contain the max y and min y values for all the VL involved, and these 2 values are the values that are used to place the navigation arrows in the diagram.
With the original logic, all the TOP arrows are aligned on the same top ordinate (likewise, all the BOTTOM arrows will be aligned on the same bottom ordinate)
With the proposed code, the arrows' ordinate values could vary from navigable node to navigable node.
In this example I changed in the svg file the y value of one of the 'navigable' nodes.
Output with the current implementation
Output with the proposed logic
Note that it depends on how the svg was generated: I edited the y value of a node in the svg file by hand, to create this scenario;
With the original svg, the arrows were all aligned at the same ordinate also using the proposed logic.
Indeed! I missed the fact that the map was indexed by the voltage level id... The SVG constructed by powsybl-single-line-diagram has always y position equals for all the feeder nodes within the same voltage level: it corresponds to the top extern cell height or the bottom extern cell heigh which are both constant within a voltage level. So we could keep this simplification anyway |
It's not always the case, apparently. In the SVG created with this code, the two bottom elements have different y:
with the new logic for the diagram-viewer, the bottom arrows are not aligned: |
Quality Gate passedIssues Measures |
Please check if the PR fulfills these requirements
Does this PR already have an issue describing the problem?
No
What kind of change does this PR introduce?
Refactor / simplification
What is the current behavior?
What is the new behavior (if this is a feature change)?
querySelector
would return the same svg element, hence the same ordinate.Set
Does this PR introduce a breaking change or deprecate an API?