]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Basic stock, aux and valve symbols for sysdyn.
authorlehtonen <lehtonen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Sun, 20 Jun 2010 10:14:38 +0000 (10:14 +0000)
committerlehtonen <lehtonen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Sun, 20 Jun 2010 10:14:38 +0000 (10:14 +0000)
Sysdyn-specific connections still missing completely.

git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@16247 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/AuxiliaryFactory.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/BorderSceneGraph.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/StockFactory.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/ValveFactory.java

index d946c883078e48694e81a2cbeb6866d936faeea5..09f3595a751516c088a79bad266c662ca2d950b5 100644 (file)
 package org.simantics.sysdyn.ui.elements2;\r
 \r
 import java.awt.BasicStroke;\r
-import java.awt.geom.Rectangle2D;\r
+import java.awt.geom.AffineTransform;\r
+import java.awt.geom.Ellipse2D;\r
+import java.util.ArrayList;\r
+import java.util.Collection;\r
+import java.util.Collections;\r
 \r
+import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
-import org.simantics.db.common.utils.NameUtils;\r
+import org.simantics.db.common.utils.OrderedSetUtils;\r
 import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.diagram.G2DUtils;\r
 import org.simantics.diagram.adapter.SyncElementFactory;\r
+import org.simantics.diagram.content.ResourceTerminal;\r
 import org.simantics.diagram.elements.TextElementHandler;\r
+import org.simantics.diagram.stubs.DiagramResource;\r
+import org.simantics.diagram.stubs.G2DResource;\r
+import org.simantics.diagram.synchronization.CompositeHintSynchronizer;\r
+import org.simantics.diagram.synchronization.IHintSynchronizer;\r
+import org.simantics.diagram.synchronization.SynchronizationHints;\r
+import org.simantics.diagram.synchronization.graph.DiagramGraphUtil;\r
+import org.simantics.diagram.synchronization.graph.TransformSynchronizer;\r
 import org.simantics.g2d.canvas.ICanvasContext;\r
 import org.simantics.g2d.diagram.IDiagram;\r
 import org.simantics.g2d.element.ElementClass;\r
+import org.simantics.g2d.element.ElementUtils;\r
 import org.simantics.g2d.element.IElement;\r
+import org.simantics.g2d.element.handler.impl.BoundsOutline;\r
 import org.simantics.g2d.element.handler.impl.DefaultTransform;\r
+import org.simantics.g2d.element.handler.impl.ObjectTerminal;\r
+import org.simantics.g2d.element.handler.impl.OutlinePick;\r
 import org.simantics.g2d.element.handler.impl.SimpleElementLayers;\r
 import org.simantics.g2d.element.handler.impl.StaticObjectAdapter;\r
+import org.simantics.g2d.element.handler.impl.StaticSymbolImageInitializer;\r
 import org.simantics.g2d.element.handler.impl.StaticSymbolImpl;\r
 import org.simantics.g2d.element.handler.impl.TextColorImpl;\r
 import org.simantics.g2d.element.handler.impl.TextFontImpl;\r
 import org.simantics.g2d.element.handler.impl.TextImpl;\r
 import org.simantics.g2d.image.Image;\r
 import org.simantics.g2d.image.impl.ShapeImage;\r
+import org.simantics.modeling.ModelingResources;\r
+import org.simantics.structural.stubs.StructuralResource2;\r
 \r
 \r
 public class AuxiliaryFactory extends SyncElementFactory {\r
 \r
+    public static final IHintSynchronizer SYNCHRONIZER = new CompositeHintSynchronizer(\r
+            ComponentNameSynchronizer.INSTANCE,\r
+            TransformSynchronizer.INSTANCE);\r
+\r
     @Override\r
     public void load(ReadGraph graph, final ICanvasContext canvas, final IDiagram diagram, final Resource element, final IElement e) throws DatabaseException {\r
-        // TODO: implement\r
+        Builtins b = graph.getBuiltins();\r
+        G2DResource g2d = G2DResource.getInstance(graph);\r
+        DiagramResource dr = DiagramResource.getInstance(graph);\r
+        ModelingResources mr = ModelingResources.getInstance(graph);\r
+\r
+        Resource component = graph.getPossibleObject(element, mr.ElementToComponent);\r
+        String text = null;\r
+        if (component != null) {\r
+            text = (String) graph.getPossibleRelatedValue(component, b.HasName);\r
+        }\r
+        if (text == null)\r
+            text = "[empty]";\r
+\r
+        ElementUtils.setText(e, text);\r
+\r
+        if (graph.isInstanceOf(element, dr.FontProvider)) {\r
+            Resource fontResource = graph.getPossibleObject(element, g2d.HasFont);\r
+            if (fontResource != null)\r
+                ElementUtils.setTextFont(e, G2DUtils.getFont(graph, fontResource));\r
+        }\r
+        if (graph.isInstanceOf(element, dr.ColorProvider)) {\r
+            Resource colorResource = graph.getPossibleObject(element, g2d.HasColor);\r
+            if (colorResource != null)\r
+                ElementUtils.setTextColor(e, G2DUtils.getColor(graph, colorResource));\r
+        }\r
+\r
+        AffineTransform at = DiagramGraphUtil.getAffineTransform(graph, element);\r
+        ElementUtils.setTransform(e, at);\r
+\r
+        // This synchronizes only text and transformation (not font and color)\r
+        e.setHint(SynchronizationHints.HINT_SYNCHRONIZER, SYNCHRONIZER);\r
     }\r
 \r
     @Override\r
     public ElementClass create(ReadGraph graph, ICanvasContext canvas, IDiagram diagram, Resource elementType)\r
     throws DatabaseException {\r
-        String id = "Auxiliary: " + NameUtils.getSafeName(graph, elementType);\r
+        StructuralResource2 sr = StructuralResource2.getInstance(graph);\r
+        DiagramResource dr = DiagramResource.getInstance(graph);\r
+\r
+        Resource definedByList = graph.getPossibleObject(elementType, sr.IsDefinedBy);\r
+        Collection<Resource> definedBy = Collections.emptyList();\r
+        if (definedByList != null)\r
+            definedBy = OrderedSetUtils.toList(graph, definedByList);\r
+        Collection<ObjectTerminal> terminals = new ArrayList<ObjectTerminal>(definedBy.size());\r
+        for (Resource r : definedBy) {\r
+            if (graph.isInstanceOf(r, dr.Terminal)) {\r
+                terminals.add(new ResourceTerminal(r));\r
+            }\r
+        }\r
+\r
         return ElementClass.compile(\r
+                SimpleElementLayers.INSTANCE,\r
+                OutlinePick.INSTANCE,\r
                 TextImpl.INSTANCE,\r
                 TextColorImpl.BLACK,\r
                 TextFontImpl.DEFAULT,\r
-                new StaticObjectAdapter(elementType),\r
                 DefaultTransform.INSTANCE,\r
-                SimpleElementLayers.INSTANCE,\r
+                new StaticObjectAdapter(elementType),\r
+                new StaticSymbolImpl(AUX_STATIC_IMAGE),\r
+                StaticSymbolImageInitializer.INSTANCE,\r
                 TextElementHandler.INSTANCE,\r
-                new StaticSymbolImpl(AUX_STATIC_IMAGE)\r
-        )\r
-        .setId(id)\r
-        ;\r
+                BoundsOutline.INSTANCE,\r
+                new WholeElementTerminals(terminals)\r
+        ).setId(AuxiliaryFactory.class.getSimpleName());\r
     }\r
 \r
-    private static final Image AUX_STATIC_IMAGE = new ShapeImage(new Rectangle2D.Double(-5, -2, 10, 4), null, new BasicStroke(1));\r
+    // TODO: make the static symbol image a text "AUX"\r
+    private static final Image AUX_STATIC_IMAGE = new ShapeImage(new Ellipse2D.Double(-5, -2, 10, 4), null, new BasicStroke(0.1f), true);\r
 \r
 }\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/BorderSceneGraph.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/BorderSceneGraph.java
new file mode 100644 (file)
index 0000000..1a6b388
--- /dev/null
@@ -0,0 +1,38 @@
+package org.simantics.sysdyn.ui.elements2;\r
+\r
+import org.simantics.g2d.element.ElementUtils;\r
+import org.simantics.g2d.element.IElement;\r
+import org.simantics.g2d.element.SceneGraphNodeKey;\r
+import org.simantics.g2d.element.handler.SceneGraph;\r
+import org.simantics.h2d.node.RectangleNode;\r
+import org.simantics.scenegraph.g2d.G2DParentNode;\r
+import org.simantics.utils.datastructures.Callback;\r
+import org.simantics.utils.datastructures.hints.IHintContext.Key;\r
+\r
+public class BorderSceneGraph implements SceneGraph, Callback<RectangleNode> {\r
+\r
+    public static final BorderSceneGraph INSTANCE         = new BorderSceneGraph();\r
+\r
+    private static final long            serialVersionUID = 5544256245734478634L;\r
+\r
+    private static final Key             BORDER_NODE      = new SceneGraphNodeKey(RectangleNode.class, "BORDER_NODE");\r
+\r
+    @Override\r
+    public void init(IElement e, G2DParentNode parent) {\r
+        RectangleNode node = ElementUtils.getOrCreateNode(e, parent, BORDER_NODE, "border", RectangleNode.class, this);\r
+\r
+        // Calculate borders from text node bounds.\r
+        node.init(ElementUtils.getElementBounds(e));\r
+    }\r
+\r
+    @Override\r
+    public void run(RectangleNode node) {\r
+        node.setZIndex(-10);\r
+    }\r
+\r
+    @Override\r
+    public void cleanup(IElement e) {\r
+        ElementUtils.removePossibleNode(e, BORDER_NODE);\r
+    }\r
+\r
+}\r
index 6c1941c82e569f40e3699fc855438cebd7fbb4ca..98f9ae1d56fc575a924103732262f9596df33632 100644 (file)
@@ -12,7 +12,6 @@
 package org.simantics.sysdyn.ui.elements2;\r
 \r
 import java.awt.BasicStroke;\r
-import java.awt.Shape;\r
 import java.awt.geom.AffineTransform;\r
 import java.awt.geom.Rectangle2D;\r
 import java.util.ArrayList;\r
@@ -40,9 +39,7 @@ import org.simantics.g2d.diagram.IDiagram;
 import org.simantics.g2d.element.ElementClass;\r
 import org.simantics.g2d.element.ElementUtils;\r
 import org.simantics.g2d.element.IElement;\r
-import org.simantics.g2d.element.SceneGraphNodeKey;\r
-import org.simantics.g2d.element.handler.Outline;\r
-import org.simantics.g2d.element.handler.SceneGraph;\r
+import org.simantics.g2d.element.handler.impl.BoundsOutline;\r
 import org.simantics.g2d.element.handler.impl.DefaultTransform;\r
 import org.simantics.g2d.element.handler.impl.ObjectTerminal;\r
 import org.simantics.g2d.element.handler.impl.OutlinePick;\r
@@ -55,12 +52,8 @@ import org.simantics.g2d.element.handler.impl.TextFontImpl;
 import org.simantics.g2d.element.handler.impl.TextImpl;\r
 import org.simantics.g2d.image.Image;\r
 import org.simantics.g2d.image.impl.ShapeImage;\r
-import org.simantics.h2d.node.RectangleNode;\r
 import org.simantics.modeling.ModelingResources;\r
-import org.simantics.scenegraph.g2d.G2DParentNode;\r
 import org.simantics.structural.stubs.StructuralResource2;\r
-import org.simantics.utils.datastructures.Callback;\r
-import org.simantics.utils.datastructures.hints.IHintContext.Key;\r
 \r
 public class StockFactory extends SyncElementFactory {\r
 \r
@@ -115,7 +108,7 @@ public class StockFactory extends SyncElementFactory {
             definedBy = OrderedSetUtils.toList(graph, definedByList);\r
         Collection<ObjectTerminal> terminals = new ArrayList<ObjectTerminal>(definedBy.size());\r
         for (Resource r : definedBy) {\r
-            if (graph.isInheritedFrom(r, dr.Terminal)) {\r
+            if (graph.isInstanceOf(r, dr.Terminal)) {\r
                 terminals.add(new ResourceTerminal(r));\r
             }\r
         }\r
@@ -137,36 +130,6 @@ public class StockFactory extends SyncElementFactory {
         ).setId(StockFactory.class.getSimpleName());\r
     }\r
 \r
-    private static final Image DEFAULT_IMAGE = new ShapeImage(new Rectangle2D.Double(-5, -5, 10, 10), null, new BasicStroke(1.0f), Image.VECTOR);\r
-\r
-    static class BoundsOutline implements Outline {\r
-        public static final BoundsOutline INSTANCE = new BoundsOutline();\r
-        private static final long serialVersionUID = 5544256245734478634L;\r
-        @Override\r
-        public Shape getElementShape(IElement e) {\r
-            return ElementUtils.getElementBounds(e);\r
-        }\r
-    }\r
-\r
-    static class BorderSceneGraph implements SceneGraph, Callback<RectangleNode> {\r
-        public static final BorderSceneGraph INSTANCE = new BorderSceneGraph();\r
-        private static final long serialVersionUID = 5544256245734478634L;\r
-        private static final Key BORDER_NODE = new SceneGraphNodeKey(RectangleNode.class, "BORDER_NODE");\r
-        @Override\r
-        public void init(IElement e, G2DParentNode parent) {\r
-            RectangleNode node = ElementUtils.getOrCreateNode(e, parent, BORDER_NODE, "border", RectangleNode.class, this);\r
-\r
-            // Calculate borders from text node bounds.\r
-            node.init(ElementUtils.getElementBounds(e));\r
-        }\r
-        @Override\r
-        public void run(RectangleNode node) {\r
-            node.setZIndex(-10);\r
-        }\r
-        @Override\r
-        public void cleanup(IElement e) {\r
-            ElementUtils.removePossibleNode(e, BORDER_NODE);\r
-        }\r
-    }\r
+    private static final Image DEFAULT_IMAGE = new ShapeImage(new Rectangle2D.Double(-5, -2.5, 10, 5), null, new BasicStroke(0.1f), Image.VECTOR);\r
 \r
 }\r
index 817c57bbdbe49b7ba9b013531907157188bbb0be..e38a31e2961cc8e7e3af3532fe3ee27c3f5dfe77 100644 (file)
 package org.simantics.sysdyn.ui.elements2;\r
 \r
 import java.awt.BasicStroke;\r
+import java.awt.Color;\r
+import java.awt.geom.AffineTransform;\r
 import java.awt.geom.Path2D;\r
+import java.awt.geom.Rectangle2D;\r
+import java.util.ArrayList;\r
+import java.util.Collection;\r
+import java.util.Collections;\r
 \r
+import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
-import org.simantics.db.common.utils.NameUtils;\r
+import org.simantics.db.common.utils.OrderedSetUtils;\r
 import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.diagram.G2DUtils;\r
 import org.simantics.diagram.adapter.SyncElementFactory;\r
-import org.simantics.diagram.elements.TextElementHandler;\r
+import org.simantics.diagram.content.ResourceTerminal;\r
+import org.simantics.diagram.elements.TextElementNoBounds;\r
+import org.simantics.diagram.stubs.DiagramResource;\r
+import org.simantics.diagram.stubs.G2DResource;\r
+import org.simantics.diagram.synchronization.CompositeHintSynchronizer;\r
+import org.simantics.diagram.synchronization.IHintSynchronizer;\r
+import org.simantics.diagram.synchronization.SynchronizationHints;\r
+import org.simantics.diagram.synchronization.graph.DiagramGraphUtil;\r
+import org.simantics.diagram.synchronization.graph.TransformSynchronizer;\r
 import org.simantics.g2d.canvas.ICanvasContext;\r
 import org.simantics.g2d.diagram.IDiagram;\r
 import org.simantics.g2d.element.ElementClass;\r
+import org.simantics.g2d.element.ElementUtils;\r
 import org.simantics.g2d.element.IElement;\r
+import org.simantics.g2d.element.SceneGraphNodeKey;\r
+import org.simantics.g2d.element.handler.ElementHandler;\r
+import org.simantics.g2d.element.handler.InternalSize;\r
+import org.simantics.g2d.element.handler.SceneGraph;\r
+import org.simantics.g2d.element.handler.impl.BoundsOutline;\r
 import org.simantics.g2d.element.handler.impl.DefaultTransform;\r
+import org.simantics.g2d.element.handler.impl.ObjectTerminal;\r
+import org.simantics.g2d.element.handler.impl.OutlinePick;\r
 import org.simantics.g2d.element.handler.impl.SimpleElementLayers;\r
 import org.simantics.g2d.element.handler.impl.StaticObjectAdapter;\r
+import org.simantics.g2d.element.handler.impl.StaticSymbolImageInitializer;\r
 import org.simantics.g2d.element.handler.impl.StaticSymbolImpl;\r
 import org.simantics.g2d.element.handler.impl.TextColorImpl;\r
 import org.simantics.g2d.element.handler.impl.TextFontImpl;\r
 import org.simantics.g2d.element.handler.impl.TextImpl;\r
 import org.simantics.g2d.image.Image;\r
 import org.simantics.g2d.image.impl.ShapeImage;\r
+import org.simantics.g2d.utils.Alignment;\r
+import org.simantics.modeling.ModelingResources;\r
+import org.simantics.scenegraph.g2d.G2DParentNode;\r
+import org.simantics.scenegraph.g2d.nodes.ShapeNode;\r
+import org.simantics.structural.stubs.StructuralResource2;\r
+import org.simantics.utils.datastructures.hints.IHintContext.Key;\r
+import org.simantics.utils.datastructures.hints.IHintContext.KeyOf;\r
 \r
 \r
 public class ValveFactory extends SyncElementFactory {\r
 \r
-    public static final double VALVE_SIZE = 5.0;\r
+    public static final Key KEY_ROTATED = new KeyOf(Boolean.class, "ROTATED");\r
+\r
+    public static final double VALVE_SIZE = 2.5;\r
+\r
+    public static final IHintSynchronizer SYNCHRONIZER = new CompositeHintSynchronizer(\r
+            ComponentNameSynchronizer.INSTANCE,\r
+            TransformSynchronizer.INSTANCE);\r
 \r
     @Override\r
     public void load(ReadGraph graph, final ICanvasContext canvas, final IDiagram diagram, final Resource element, final IElement e) throws DatabaseException {\r
-        // TODO: implement\r
+        Builtins b = graph.getBuiltins();\r
+        G2DResource g2d = G2DResource.getInstance(graph);\r
+        DiagramResource dr = DiagramResource.getInstance(graph);\r
+        ModelingResources mr = ModelingResources.getInstance(graph);\r
+\r
+        Resource component = graph.getPossibleObject(element, mr.ElementToComponent);\r
+        String text = null;\r
+        if (component != null) {\r
+            text = (String) graph.getPossibleRelatedValue(component, b.HasName);\r
+        }\r
+        if (text == null)\r
+            text = "[empty]";\r
+\r
+        ElementUtils.setText(e, text);\r
+\r
+        if (graph.isInstanceOf(element, dr.FontProvider)) {\r
+            Resource fontResource = graph.getPossibleObject(element, g2d.HasFont);\r
+            if (fontResource != null)\r
+                ElementUtils.setTextFont(e, G2DUtils.getFont(graph, fontResource));\r
+        }\r
+        if (graph.isInstanceOf(element, dr.ColorProvider)) {\r
+            Resource colorResource = graph.getPossibleObject(element, g2d.HasColor);\r
+            if (colorResource != null)\r
+                ElementUtils.setTextColor(e, G2DUtils.getColor(graph, colorResource));\r
+        }\r
+\r
+        AffineTransform at = DiagramGraphUtil.getAffineTransform(graph, element);\r
+        ElementUtils.setTransform(e, at);\r
+\r
+        // This synchronizes only text and transformation (not font and color)\r
+        e.setHint(SynchronizationHints.HINT_SYNCHRONIZER, SYNCHRONIZER);\r
     }\r
 \r
     @Override\r
     public ElementClass create(ReadGraph graph, ICanvasContext canvas, IDiagram diagram, Resource elementType)\r
     throws DatabaseException {\r
-        String id = "Valve: " + NameUtils.getSafeName(graph, elementType);\r
+        StructuralResource2 sr = StructuralResource2.getInstance(graph);\r
+        DiagramResource dr = DiagramResource.getInstance(graph);\r
+\r
+        Resource definedByList = graph.getPossibleObject(elementType, sr.IsDefinedBy);\r
+        Collection<Resource> definedBy = Collections.emptyList();\r
+        if (definedByList != null)\r
+            definedBy = OrderedSetUtils.toList(graph, definedByList);\r
+        Collection<ObjectTerminal> terminals = new ArrayList<ObjectTerminal>(definedBy.size());\r
+        for (Resource r : definedBy) {\r
+            if (graph.isInstanceOf(r, dr.Terminal)) {\r
+                terminals.add(new ResourceTerminal(r));\r
+            }\r
+        }\r
+\r
         return ElementClass.compile(\r
+                SimpleElementLayers.INSTANCE,\r
+                OutlinePick.INSTANCE,\r
                 TextImpl.INSTANCE,\r
                 TextColorImpl.BLACK,\r
                 TextFontImpl.DEFAULT,\r
-                new StaticObjectAdapter(elementType),\r
                 DefaultTransform.INSTANCE,\r
-                SimpleElementLayers.INSTANCE,\r
-                TextElementHandler.INSTANCE,\r
-                new StaticSymbolImpl(VALVE_STATIC_IMAGE)\r
-        )\r
-        .setId(id)\r
-        ;\r
+                new StaticObjectAdapter(elementType),\r
+                new StaticSymbolImpl(VALVE_STATIC_IMAGE),\r
+                StaticSymbolImageInitializer.INSTANCE,\r
+                TEXT_NODE,\r
+                ValveSceneGraph.INSTANCE,\r
+                BoundsOutline.INSTANCE,\r
+                new WholeElementTerminals(terminals)\r
+        ).setId(ValveFactory.class.getSimpleName());\r
     }\r
 \r
-    private static final Image VALVE_STATIC_IMAGE = new ShapeImage(createShape(VALVE_SIZE, false), null, new BasicStroke(1));\r
+    private static final ElementHandler TEXT_NODE = new TextElementNoBounds(0, VALVE_SIZE+2, Alignment.CENTER);\r
+\r
+    private static final BasicStroke STROKE = new BasicStroke(1f);\r
+    private static final Image VALVE_STATIC_IMAGE = new ShapeImage(createShape(VALVE_SIZE, false), null, STROKE, true);\r
 \r
     /**\r
      * @param valveSize\r
@@ -85,4 +172,40 @@ public class ValveFactory extends SyncElementFactory {
         return path;\r
     }\r
 \r
+    public static class ValveSceneGraph implements SceneGraph, InternalSize {\r
+\r
+        private static final long           serialVersionUID = 5544256245734478634L;\r
+\r
+        public static final ValveSceneGraph INSTANCE         = new ValveSceneGraph();\r
+\r
+        private static final Key            NODE             = new SceneGraphNodeKey(ShapeNode.class, "VALVE_NODE");\r
+\r
+        @Override\r
+        public void init(IElement e, G2DParentNode parent) {\r
+            ShapeNode node = ElementUtils.getOrCreateNode(e, parent, NODE, "valve", ShapeNode.class);\r
+\r
+            System.out.println("shape node : " + node);\r
+            // Calculate borders from text node bounds.\r
+            node.setStroke(STROKE);\r
+            node.setScaleStroke(true);\r
+            node.setColor(Color.BLACK);\r
+            node.setShape(createShape(VALVE_SIZE, Boolean.TRUE.equals(e.getHint(KEY_ROTATED))));\r
+            System.out.println("shape node after init: " + node);\r
+        }\r
+\r
+        @Override\r
+        public void cleanup(IElement e) {\r
+            ElementUtils.removePossibleNode(e, NODE);\r
+        }\r
+\r
+        @Override\r
+        public Rectangle2D getBounds(IElement e, Rectangle2D size) {\r
+            if (size == null)\r
+                size = new Rectangle2D.Double();\r
+            size.setFrame(createShape(VALVE_SIZE, Boolean.TRUE.equals(e.getHint(KEY_ROTATED))).getBounds2D());\r
+            return size;\r
+        }\r
+\r
+    }\r
+\r
 }\r