Skip to content
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

Represent subnetworks in network-area diagrams #669

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

quinarygio
Copy link
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:

@quinarygio quinarygio marked this pull request as draft January 20, 2025 16:51
Signed-off-by: Giovanni Ferrari <[email protected]>
Signed-off-by: Giovanni Ferrari <[email protected]>
@quinarygio quinarygio marked this pull request as ready for review January 21, 2025 11:55
@So-Fras
Copy link
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.

Copy link
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%.

@@ -55,7 +55,7 @@ public class SvgParameters {
private EdgeInfoEnum edgeInfoDisplayed = EdgeInfoEnum.ACTIVE_POWER;
private double pstArrowHeadSize = 8;
private String undefinedValueSymbol = "";

private boolean highlightSubnetwors;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
private boolean highlightSubnetwors;
private boolean highlightSubnetworks;

@@ -491,4 +491,13 @@ public SvgParameters setUndefinedValueSymbol(String undefinedValueSymbol) {
this.undefinedValueSymbol = undefinedValueSymbol;
return this;
}

public boolean isHighlightSubnetwors() {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public boolean isHighlightSubnetwors() {
public boolean isHighlightSubnetworks() {

return highlightSubnetwors;
}

public SvgParameters setHighlightSubnetwors(boolean highlightSubnetwors) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public SvgParameters setHighlightSubnetwors(boolean highlightSubnetwors) {
public SvgParameters setHighlightSubnetworks(boolean highlightSubnetworks) {

}

public SvgParameters setHighlightSubnetwors(boolean highlightSubnetwors) {
this.highlightSubnetwors = highlightSubnetwors;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
this.highlightSubnetwors = highlightSubnetwors;
this.highlightSubnetworks = highlightSubnetworks;

@@ -103,18 +105,32 @@ private void writeSvg(Graph graph, OutputStream svgOs) {
XMLStreamWriter writer = XmlUtil.initializeWriter(true, INDENT, svgOs);
addSvgRoot(graph, writer);
addStyle(writer);
boolean higlightSubnetworks = this.svgParameters.isHighlightSubnetwors();
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
boolean higlightSubnetworks = this.svgParameters.isHighlightSubnetwors();
boolean higlightSubnetworks = this.svgParameters.isHighlightSubnetworks();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Represent subnetworks in network-area diagrams
2 participants