]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Export Connection's children as child SVG elements. 42/4642/1
authorMarko Luukkainen <marko.luukkainen@semantum.fi>
Tue, 2 Feb 2021 11:02:03 +0000 (13:02 +0200)
committerMarko Luukkainen <marko.luukkainen@semantum.fi>
Tue, 2 Feb 2021 11:02:03 +0000 (13:02 +0200)
Fix for previous change, connection graphics were exported twice.

gitlab #673

Change-Id: I601bca0029725fdef36f221580ced099366880cf

bundles/org.simantics.modeling/src/org/simantics/modeling/SCLScenegraph.java

index 675c4e52581eb81995e4888246011f59b0e30b74..70461571dc32e4de2c5f7804a0c84a6f312f0031 100644 (file)
@@ -891,8 +891,6 @@ public class SCLScenegraph {
                 svg = printSVGDocument(doc);
                 parentBuilder.append(SELECTION_MASK_SECTION, svg);
 
-                parentBuilder.append(SELECTION_MASK_SECTION, "\n</g>");
-                parentBuilder.append(SELECTION_SECTION, "\n</g>");
                 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</g>");
+               parentBuilder.append(SELECTION_MASK_SECTION, "\n</g>");
+                parentBuilder.append(SELECTION_SECTION, "\n</g>");
+                parentBuilder.append(MAIN_SECTION, "\n</g>");
+                
             } else if (node instanceof G2DParentNode) {
                 
                RenderSVGContext parentBuilder = getParentBuilder(node);