-
Notifications
You must be signed in to change notification settings - Fork 13
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
Modify nad and sld api for better consistency #475
Conversation
SonarCloud Quality Gate failed. |
…d signature to include filter Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
…etrization Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
…arameters Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
Signed-off-by: Thomas ADAM <tadam@silicom.fr>
4bb8f3d
to
030f16d
Compare
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.
Good job! but I think there's still some work/rethinking before it is ready
@@ -0,0 +1,52 @@ | |||
package com.powsybl.nad; |
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.
Copyright and authorship are missing for the new files of this PR
import com.powsybl.nad.svg.StyleProvider; | ||
import com.powsybl.nad.svg.SvgParameters; | ||
|
||
public class NetworkAreaDiagramConfiguration { |
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.
We could simplify this with DiagramConfig
, or just Config
?
LayoutParameters layoutParameters = new LayoutParameters(); | ||
StyleProvider styleProvider; | ||
LabelProvider labelProvider; | ||
BiFunction<Network, SvgParameters, LabelProvider> labelProviderCreator = DefaultLabelProvider::new; |
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.
BiFunction<Network, SvgParameters, LabelProvider> labelProviderCreator = DefaultLabelProvider::new; | |
LabelProviderFactory labelProviderFactory = DefaultLabelProvider::new; |
SvgParameters svgParameters = new SvgParameters(); | ||
LayoutParameters layoutParameters = new LayoutParameters(); | ||
StyleProvider styleProvider; | ||
LabelProvider labelProvider; |
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.
you can remove this parameter, we shouldn't create it before build call.
Or in fact it should maybe be build only when calling config.getLabelProvider()
. Indeed, one would expect one config to be network-agnostic, because you expect when speaking of config to reuse the same config for different networks. That implies that both StyleProvider and LabelProvider are created only when calling config.getLabelProvider(network)
. And then similarly for the idProvider.
private static <R extends LabelProvider> R factory(Network network, SvgParameters svgParameters, BiFunction<Network, SvgParameters, R> function) { | ||
return function.apply(network, svgParameters); | ||
} |
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.
private static <R extends LabelProvider> R factory(Network network, SvgParameters svgParameters, BiFunction<Network, SvgParameters, R> function) { | |
return function.apply(network, svgParameters); | |
} | |
@FunctionalInterface | |
public interface LabelProviderFactory { | |
LabelProvider create(Network network, SvgParameters svgParameters); | |
} |
.withSvgParameters(getSvgParameters()) | ||
.withStyleProvider(getStyleProvider(network)) | ||
.build(); |
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.
indenting isn't right
|
||
protected AbstractDiagramLabelProvider(ComponentLibrary componentLibrary, LayoutParameters layoutParameters) { | ||
protected AbstractDiagramLabelProvider(ComponentLibrary componentLibrary, LayoutParameters layoutParameters, SvgParameters svgParameters) { |
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.
we should be able to get rid of LayoutParameters here...
return this; | ||
} | ||
|
||
public boolean isRemoveFictitiousSwitchNodes() { | ||
return removeFictitiousSwitchNodes; | ||
public double getCgmesScaleFactor() { |
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.
Those cgmes parameters are unexpected here... The smart selector does not allow to pass any parameters, so LayoutParameters were used for cgmes-only parameters.
But ok to keep them in this PR while waiting for another PR to clean that. We could probably delete cmgesUseName
, but cgmesScaleFactor
and cgmesDiagramName
are needed...
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.
I agree, it does not feel like the right place to put those cgmes parameters. It was indeed a quick and dirty way to deal with them.
I created an issue to track that.
@@ -34,8 +34,8 @@ public class DefaultDiagramLabelProvider extends AbstractDiagramLabelProvider { | |||
|
|||
protected final Network network; | |||
|
|||
public DefaultDiagramLabelProvider(Network net, ComponentLibrary componentLibrary, LayoutParameters layoutParameters) { |
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.
As we try to have more consistency between diagrams, we could also take the opportunity to rename this into DefaultLabelProvider
SingleLineDiagramConfiguration singleLineDiagramConfiguration = new SingleLineDiagramConfigurationBuilder(network) | ||
.withLayoutParameters(layoutParameters) | ||
.withComponentLibrary(getResourcesComponentLibrary()) | ||
.withSvgParameters(svgParameters) | ||
.build(); |
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.
To avoid repeating this code block again and again, why don't you factorize it in toSvg
? You could do that similarly to what was done before
Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
…nting Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
Kudos, SonarCloud Quality Gate passed! |
…ers to SvgParameters Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
See new PR #522 |
Please check if the PR fulfills these requirements (please use
'[x]'
to check the checkboxes, or submit the PR and then click the checkboxes)Does this PR already have an issue describing the problem ? If so, link to this issue using
'#XXX'
and skip the rest#469
Does this PR introduce a breaking change or deprecate an API? If yes, check the following: