X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2FSCLScenegraph.java;fp=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2FSCLScenegraph.java;h=fad803ce41a4a84bdb11991a06f73e0bdc3a3451;hp=40a5265852fa79083df1781db24a563df95d4532;hb=5e7529d05dde6a355305f9af1682de4cc0b31526;hpb=497f90316cb17b5bbd8f8b72af3ab3bb6582a902 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 40a526585..fad803ce4 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLScenegraph.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLScenegraph.java @@ -85,6 +85,7 @@ import org.slf4j.LoggerFactory; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; import org.w3c.dom.Element; +import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class SCLScenegraph { @@ -916,10 +917,21 @@ public class SCLScenegraph { } else if (!(node instanceof RouteGraphNode) && !(node instanceof LinkNode)){ try { Element doc = renderSVGNode(svgGenerator, (IG2DNode)node); - if (doc.getElementsByTagName("g").getLength() == 0) + NodeList gList = doc.getElementsByTagName("g"); + if (gList.getLength() == 0) return; + boolean hasContent = false; + for (int i = 0; i < gList.getLength(); i++) { + Node gNode = gList.item(i); + if (gNode.hasChildNodes()) { + hasContent = true; + break; + } + } + if (!hasContent) + return; String svg = printSVGDocument(doc); - parentBuilder.append(MAIN_SECTION, ""); + parentBuilder.append(MAIN_SECTION, ""); parentBuilder.append(MAIN_SECTION, svg); parentBuilder.append(MAIN_SECTION, "\n"); } catch (Exception e) {