From 3dbd33dbf19527de3bf045a3053bce0c6ba34f80 Mon Sep 17 00:00:00 2001 From: Marko Luukkainen Date: Tue, 2 Feb 2021 13:02:03 +0200 Subject: [PATCH] Export Connection's children as child SVG elements. Fix for previous change, connection graphics were exported twice. gitlab #673 Change-Id: I601bca0029725fdef36f221580ced099366880cf --- .../org/simantics/modeling/SCLScenegraph.java | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLScenegraph.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLScenegraph.java index 675c4e525..70461571d 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLScenegraph.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLScenegraph.java @@ -891,8 +891,6 @@ public class SCLScenegraph { svg = printSVGDocument(doc); parentBuilder.append(SELECTION_MASK_SECTION, svg); - parentBuilder.append(SELECTION_MASK_SECTION, "\n"); - parentBuilder.append(SELECTION_SECTION, "\n"); senBuilders.put((ConnectionNode)node, new RenderSVGContext()); @@ -1106,20 +1104,24 @@ public class SCLScenegraph { RenderSVGContext b = senBuilders.get(sen); String content = b.get(MAIN_SECTION); if(content.isEmpty()) { - if(sen.getKey() != null) { - - for(SelectionNode n : NodeUtil.collectNodes(node, SelectionNode.class)) { - n.setIgnore(true); - } - - Element doc = renderSVGNode(svgGenerator, (IG2DNode)node); - String svg = printSVGDocument(doc); - parentBuilder.append(MAIN_SECTION, svg); - } +// Handling connection the same way as SingleElementNode would draw connection twice.. +// if(sen.getKey() != null) { +// +// for(SelectionNode n : NodeUtil.collectNodes(node, SelectionNode.class)) { +// n.setIgnore(true); +// } +// +// Element doc = renderSVGNode(svgGenerator, (IG2DNode)node); +// String svg = printSVGDocument(doc); +// parentBuilder.append(MAIN_SECTION, svg); +// } } else { parentBuilder.append(b); } - parentBuilder.append(MAIN_SECTION, "\n"); + parentBuilder.append(SELECTION_MASK_SECTION, "\n"); + parentBuilder.append(SELECTION_SECTION, "\n"); + parentBuilder.append(MAIN_SECTION, "\n"); + } else if (node instanceof G2DParentNode) { RenderSVGContext parentBuilder = getParentBuilder(node); -- 2.45.2