Skip to content

Represent subnetworks in network-area diagrams#669

Merged
So-Fras merged 24 commits intomainfrom
nad-subnetwork-highlight
Mar 29, 2025
Merged

Represent subnetworks in network-area diagrams#669
So-Fras merged 24 commits intomainfrom
nad-subnetwork-highlight

Conversation

@quinarygio
Copy link
Copy Markdown
Contributor

@quinarygio quinarygio commented Jan 20, 2025

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Does this PR already have an issue describing the problem?

Fixes #611

What kind of change does this PR introduce?

What is the current behavior?

What is the new behavior (if this is a feature change)?

Does this PR introduce a breaking change or deprecate an API?

  • Yes
  • No

If yes, please check if the following requirements are fulfilled

  • The Breaking Change or Deprecated label has been added
  • The migration steps are described in the following section

What changes might users need to make in their application due to this PR? (migration steps)

Other information:

Signed-off-by: Giovanni Ferrari <giovanni.ferrari@soft.it>
@quinarygio quinarygio marked this pull request as draft January 20, 2025 16:51
Signed-off-by: Giovanni Ferrari <giovanni.ferrari@soft.it>
Signed-off-by: Giovanni Ferrari <giovanni.ferrari@soft.it>
@quinarygio quinarygio marked this pull request as ready for review January 21, 2025 11:55
@So-Fras
Copy link
Copy Markdown
Member

So-Fras commented Jan 24, 2025

Thanks for the work!

As discussed together:

  • It was not mentioned in the issue but it would be great if users could choose whether or not they want to highlight subnetworks. Maybe, via a new SvgParameters boolean attribute? The SvgWriter has already access to the SvgParameters. There can be a if condition using this new SvgParameters boolean that would trigger the duplication of lines and nodes (or not). Furthermore, this way, all the duplicated parts would be grouped together in the svg.

  • The Graph should not be the object to hold information on style (it's only nodes and edges) --> the NetworkGraphBuilder class should not be affected by this PR

  • The StyleProvider "family" should be the one affected by the PR. In the if condition in the SvgWriter mentioned above, we would call a new specific method of the StyleProvider for highlight. Thus, the StyleProvider does not need to "know" whether the user wants to highlight something or not.

Signed-off-by: Giovanni Ferrari <giovanni.ferrari@soft.it>
Signed-off-by: Giovanni Ferrari <giovanni.ferrari@soft.it>
Signed-off-by: Giovanni Ferrari <giovanni.ferrari@soft.it>
Signed-off-by: Giovanni Ferrari <giovanni.ferrari@soft.it>
Copy link
Copy Markdown
Member

@So-Fras So-Fras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes! I think the PR is in line with the code's "philosophy".
There is just a small typo in a name.
As for the unit test barrier, I think you should add tests to cover a few more lines and reach the 90%.

Comment thread network-area-diagram/src/main/java/com/powsybl/nad/svg/SvgParameters.java Outdated
Comment thread network-area-diagram/src/main/java/com/powsybl/nad/svg/SvgParameters.java Outdated
Comment thread network-area-diagram/src/main/java/com/powsybl/nad/svg/SvgParameters.java Outdated
Comment thread network-area-diagram/src/main/java/com/powsybl/nad/svg/SvgParameters.java Outdated
Comment thread network-area-diagram/src/main/java/com/powsybl/nad/svg/SvgWriter.java Outdated
Signed-off-by: Giovanni Ferrari <giovanni.ferrari@soft.it>
So-Fras and others added 2 commits February 28, 2025 09:38
Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
@So-Fras
Copy link
Copy Markdown
Member

So-Fras commented Feb 28, 2025

Now I think about it, we should add some documentation on this feature. I am adding the "do-not-merge" label until then.
@quinarygio I will add the documentation for this PR.

Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
flo-dup added 2 commits March 25, 2025 22:47
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Comment thread network-area-diagram/src/main/java/com/powsybl/nad/svg/SvgWriter.java Outdated
Comment thread network-area-diagram/src/main/java/com/powsybl/nad/svg/SvgWriter.java Outdated
Comment thread network-area-diagram/src/main/java/com/powsybl/nad/svg/SvgWriter.java Outdated
Comment thread network-area-diagram/src/test/resources/subnetwork_highlight.svg Outdated
Comment thread network-area-diagram/src/main/java/com/powsybl/nad/svg/SvgWriter.java Outdated
Comment thread network-area-diagram/src/main/java/com/powsybl/nad/svg/SvgWriter.java Outdated
flo-dup and others added 4 commits March 26, 2025 14:54
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Giovanni Ferrari <giovanni.ferrari@soft.it>
Comment thread network-area-diagram/src/main/java/com/powsybl/nad/svg/SvgWriter.java Outdated
Comment thread network-area-diagram/src/main/java/com/powsybl/nad/svg/SvgWriter.java Outdated
Comment thread network-area-diagram/src/main/java/com/powsybl/nad/svg/SvgParameters.java Outdated
Signed-off-by: Giovanni Ferrari <giovanni.ferrari@soft.it>
Copy link
Copy Markdown
Collaborator

@flo-dup flo-dup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you correct the signoff of the second to last commit 71816fe and then push-force? So that the DCO passes.

@Test
void testSubnetworkHighlight() {
Network network = createWithTieLines();
assertSvgEquals("/subnetwork_highlight.svg", network);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add another test with a partial graph, for instance VoltageLevelFilter.createVoltageLevelDepthFilter(network, "VLHV2", 1)?
So that you test the case of a non-visible edge, and so the coverage will be improved.

Signed-off-by: Giovanni Ferrari <giovanni.ferrari@soft.it>
@quinarygio quinarygio force-pushed the nad-subnetwork-highlight branch from 3015788 to 25eafde Compare March 28, 2025 13:03
quinarygio and others added 4 commits March 28, 2025 14:26
Signed-off-by: Giovanni Ferrari <giovanni.ferrari@soft.it>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
@github-project-automation github-project-automation bot moved this from Waiting for review to Approved in Release 03/2025 Mar 28, 2025
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
@sonarqubecloud
Copy link
Copy Markdown

@So-Fras So-Fras merged commit 222b7b9 into main Mar 29, 2025
8 checks passed
@So-Fras So-Fras deleted the nad-subnetwork-highlight branch March 29, 2025 19:53
@github-project-automation github-project-automation bot moved this from Approved to Done in Release 03/2025 Mar 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

Represent subnetworks in network-area diagrams

3 participants