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;h=b3a0ff251502a41cc772352710553cfcc64957eb;hp=5f375095fb239db428f53a07040bc58e7b10b21d;hb=bf8a8b92f405dfd96198d5e1b377ce2f1059675b;hpb=39684a05baa1b599b8cc306cdd8a07ea6eb3cfdb 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 5f375095f..b3a0ff251 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLScenegraph.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLScenegraph.java @@ -36,6 +36,7 @@ import org.simantics.db.Resource; import org.simantics.db.common.request.UnaryRead; import org.simantics.db.exception.DatabaseException; import org.simantics.db.exception.RuntimeDatabaseException; +import org.simantics.diagram.elements.DecorationSVGNode; import org.simantics.diagram.elements.DiagramNodeUtil; import org.simantics.diagram.elements.TextGridNode; import org.simantics.diagram.elements.TextNode; @@ -61,7 +62,6 @@ import org.simantics.scenegraph.g2d.nodes.BackgroundNode; import org.simantics.scenegraph.g2d.nodes.BoundsNode; import org.simantics.scenegraph.g2d.nodes.ConnectionNode; import org.simantics.scenegraph.g2d.nodes.DataNode; -import org.simantics.scenegraph.g2d.nodes.DecorationSVGNode; import org.simantics.scenegraph.g2d.nodes.NavigationNode; import org.simantics.scenegraph.g2d.nodes.SVGNode; import org.simantics.scenegraph.g2d.nodes.SelectionNode; @@ -599,6 +599,7 @@ public class SCLScenegraph { } G2DSceneGraph sg = ctx.getSceneGraph(); + sg.performCleanup(); G2DParentNode root = (G2DParentNode) sg.getRootNode(); // rtree is the actual content of the diagram @@ -632,15 +633,20 @@ public class SCLScenegraph { double trX = -1 * content.getX(); double trY = -1 * content.getY(); - result.append(MAIN_SECTION, ""); - - result.append(SELECTION_SECTION, ""); + // NaNs + if(!Double.isFinite(trX)) trX = 0; + if(!Double.isFinite(trY)) trY = 0; + result.append(MAIN_SECTION, ""); + result.append(SELECTION_SECTION, ""); result.append(SELECTION_MASK_SECTION, ""); + + result.append(ALL_SECTIONS, ""); + KeyVisitor keyVisitor = new KeyVisitor(); sg.accept(keyVisitor); @@ -658,16 +664,14 @@ public class SCLScenegraph { } - result.append(SELECTION_SECTION, ""); - result.append(SELECTION_MASK_SECTION, ""); - result.append(MAIN_SECTION, ""); + result.append(ALL_SECTIONS, ""); StringBuilder res = new StringBuilder(); res.append(""); res.append(result.get(MAIN_SECTION)); res.append(result.get(SELECTION_SECTION)); res.append(result.get(SELECTION_MASK_SECTION)); - res.append(result.get("")); + res.append(""); // System.err.println(" == FINAL RESULT == "); // System.err.println(res.toString()); @@ -778,18 +782,24 @@ public class SCLScenegraph { RenderSVGContext parentBuilder2 = getParentBuilder(parentSEN); String key = getKey(parentSEN); + n.setIgnore(false); Element doc = renderSVGNode((IG2DNode)node); + n.setIgnore(true); String svg = printSVGDocument(doc); parentBuilder2.append(SELECTION_SECTION, "\n"); parentBuilder2.append(SELECTION_SECTION, svg); parentBuilder2.append(SELECTION_SECTION, "\n"); parentBuilder2.append(SELECTION_MASK_SECTION, "\n"); Rectangle2D rect = n.getRect(); - parentBuilder2.append(SELECTION_MASK_SECTION,""); + // NaN + if(rect.getHeight() == rect.getHeight() && rect.getWidth() == rect.getWidth()) { + parentBuilder2.append(SELECTION_MASK_SECTION,""); + } parentBuilder2.append(SELECTION_MASK_SECTION,"\n"); + } } else if (node instanceof SVGNode) { SVGNode svg = (SVGNode)node;