]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Added memory consumption FIXMEs for sysdyn scene graph nodes
authorlehtonen <lehtonen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 2 Dec 2010 16:29:23 +0000 (16:29 +0000)
committerlehtonen <lehtonen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 2 Dec 2010 16:29:23 +0000 (16:29 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@18919 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/connections/DependencyNode.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/connections/FlowNode.java

index 844192e5e7bf4a4c4cb217f17447cb43be12f5f4..988b00017d6992c1ed2908284b8a6cc50c38ed7f 100644 (file)
@@ -33,6 +33,8 @@ public class DependencyNode extends G2DNode implements ISelectionPainterNode {
 \r
     private static final long serialVersionUID = 1294351381209071074L;\r
 \r
+    private static final BasicStroke STROKE = new BasicStroke(1.0f);\r
+\r
     private Color color;\r
     private Stroke stroke;\r
     private Rectangle2D beginBounds;\r
@@ -42,7 +44,7 @@ public class DependencyNode extends G2DNode implements ISelectionPainterNode {
     transient public boolean hover = false;\r
     \r
        private transient PropertyChangeListener fieldListener = null;\r
-       \r
+\r
        public void setFieldListener(PropertyChangeListener listener) {\r
                this.fieldListener = listener;\r
        }\r
@@ -111,12 +113,13 @@ public class DependencyNode extends G2DNode implements ISelectionPainterNode {
         // NICENESS\r
         g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);\r
         \r
+        // FIXME: optimize memory allocations\r
         Pair<Shape, Shape> shapes = Dependencies.createArrowShape(beginBounds, endBounds, angle);\r
 \r
        boolean selected = NodeUtil.isSelected(this, 2);\r
        if(selected) {\r
             g.setColor(Color.PINK);\r
-            g.setStroke(new BasicStroke(1.0f));\r
+            g.setStroke(STROKE);\r
                g.draw(shapes.first);\r
                g.fill(shapes.second);\r
             if(color != null) g.setColor(color);\r
@@ -125,7 +128,7 @@ public class DependencyNode extends G2DNode implements ISelectionPainterNode {
                g.fill(shapes.second);\r
        } else if (hover){\r
             g.setColor(Color.LIGHT_GRAY);\r
-            g.setStroke(new BasicStroke(1.0f));\r
+            g.setStroke(STROKE);\r
                g.draw(shapes.first);\r
                g.fill(shapes.second);\r
             if(color != null) g.setColor(color);\r
index b44cacf7516d3c8317340206d03072ad8668eed1..23bace0ba65bbefd2d16e11fc3def6d3efa082fc 100644 (file)
@@ -27,7 +27,9 @@ import org.simantics.utils.datastructures.Pair;
 public class FlowNode extends G2DNode implements ISelectionPainterNode {\r
 \r
        private static final long serialVersionUID = 328942356917631237L;\r
-    \r
+\r
+    private static final BasicStroke STROKE = new BasicStroke(1.0f);\r
+\r
     private Color color;\r
     private Stroke stroke;\r
     private Rectangle2D beginBounds;\r
@@ -103,10 +105,12 @@ public class FlowNode extends G2DNode implements ISelectionPainterNode {
         \r
         if(toValve) {\r
                \r
+            // FIXME: optimize memory allocations\r
             lines = Flows.createLines(false, endBounds, beginBounds);\r
 \r
         } else {\r
 \r
+            // FIXME: optimize memory allocations\r
             lines = Flows.createLines(true, beginBounds, endBounds);\r
             arrow = Flows.createArrow(beginBounds, endBounds);\r
                \r
@@ -115,7 +119,7 @@ public class FlowNode extends G2DNode implements ISelectionPainterNode {
        boolean selected = NodeUtil.isSelected(this, 2);\r
        if(selected) {\r
             g.setColor(Color.PINK);\r
-            g.setStroke(new BasicStroke(1.0f));\r
+            g.setStroke(STROKE);\r
                g.draw(lines.first);\r
                g.draw(lines.second);\r
             if(color != null) g.setColor(color);\r