Skip to content

Commit

Permalink
Avoid svg components duplication #44 (#160) (#194)
Browse files Browse the repository at this point in the history
Correction in the defs section generation when using the parameter
avoidSVGComponentDuplication

Signed-off-by: Franck LECUYER <franck.lecuyer@rte-france.com>
  • Loading branch information
FranckLecuyer authored and geofjamg committed Oct 8, 2019
1 parent 2cb2b9e commit 1dadde8
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 813 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public GraphMetadata write(Graph graph,
globalStyle.ifPresent(graphStyle::append);
graphStyle.append(componentLibrary.getStyleSheet());

List<String> listUsedComponentSVG = new ArrayList<>();
Set<String> listUsedComponentSVG = new HashSet<>();

graph.getNodes().forEach(n -> {
Optional<String> nodeStyle = styleProvider.getNodeStyle(n, layoutParameters.isAvoidSVGComponentsDuplication());
Expand Down Expand Up @@ -274,7 +274,7 @@ public GraphMetadata write(SubstationGraph graph,
Document document = domImpl.createDocument("http://www.w3.org/2000/svg", "svg", null);
Element style = document.createElement("style");

List<String> listUsedComponentSVG = new ArrayList<>();
Set<String> listUsedComponentSVG = new HashSet<>();

StringBuilder graphStyle = new StringBuilder();
for (Graph vlGraph : graph.getNodes()) {
Expand Down Expand Up @@ -1139,7 +1139,7 @@ private void shiftFeedersPosition(Graph graph, double scaleShiftFeederNames) {
/**
* Creation of the defs area for the SVG components
*/
protected void createDefsSVGComponents(Document document, List<String> listUsedComponentSVG) {
protected void createDefsSVGComponents(Document document, Set<String> listUsedComponentSVG) {
if (layoutParameters.isAvoidSVGComponentsDuplication()) {
Element defs = document.createElement("defs");

Expand Down
Loading

0 comments on commit 1dadde8

Please sign in to comment.