]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Adapt to org.simantics.scenegraph changes.
authorlehtonen <lehtonen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Wed, 30 Dec 2009 23:28:10 +0000 (23:28 +0000)
committerlehtonen <lehtonen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Wed, 30 Dec 2009 23:28:10 +0000 (23:28 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@13371 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.h2d/src/org/simantics/h2d/editor/impl/SceneGraphManager.java
org.simantics.h2d/src/org/simantics/h2d/node/FilledShapeNode.java
org.simantics.h2d/src/org/simantics/h2d/node/LineNode.java
org.simantics.h2d/src/org/simantics/h2d/node/RectangleNode.java
org.simantics.h2d/src/org/simantics/h2d/node/ShapeNode.java
org.simantics.h2d/src/org/simantics/h2d/node/TextNode.java

index 1a67333a2882aebf0447d070fe5251b5260aa01c..1f9f2cc3c55f3bd0b796c93338366a758f20a97e 100644 (file)
@@ -11,31 +11,31 @@ import org.simantics.scenegraph.g2d.nodes.PageBorderNode;
 import org.simantics.scenegraph.g2d.nodes.TransformNode;\r
 \r
 class SceneGraphManager {\r
-       G2DSceneGraph sceneGraph;\r
-       TransformNode diagramCoordinatesNode;\r
-       G2DParentNode elementsNode;\r
-       G2DParentNode selectionNode;\r
-       G2DParentNode actionNode;\r
-       \r
-       public SceneGraphManager(JComponent rootPane) {\r
-               sceneGraph = new G2DSceneGraph();\r
-               //sceneGraph.setRootPane(rootPane);\r
-               diagramCoordinatesNode = sceneGraph.addNode(TransformNode.class);\r
-               \r
-               PageBorderNode border = diagramCoordinatesNode.addNode(PageBorderNode.class);\r
-               border.init(new Rectangle2D.Double(0.0, 0.0, 297.0, 210.0), Boolean.TRUE);\r
-               \r
-               elementsNode = diagramCoordinatesNode.addNode(G2DParentNode.class);\r
-               elementsNode.setZIndex(0);\r
-               \r
-               selectionNode = diagramCoordinatesNode.addNode(G2DParentNode.class);\r
-               selectionNode.setZIndex(1);\r
-               \r
-               actionNode = diagramCoordinatesNode.addNode(G2DParentNode.class);\r
-               actionNode.setZIndex(2);\r
-       }\r
-       \r
-       void setViewTransform(AffineTransform viewTransform) {\r
-               diagramCoordinatesNode.setTransform(viewTransform);\r
-       }\r
+    G2DSceneGraph sceneGraph;\r
+    TransformNode diagramCoordinatesNode;\r
+    G2DParentNode elementsNode;\r
+    G2DParentNode selectionNode;\r
+    G2DParentNode actionNode;\r
+\r
+    public SceneGraphManager(JComponent rootPane) {\r
+        sceneGraph = new G2DSceneGraph();\r
+        //sceneGraph.setRootPane(rootPane);\r
+        diagramCoordinatesNode = sceneGraph.addNode(TransformNode.class);\r
+\r
+        PageBorderNode border = diagramCoordinatesNode.addNode(PageBorderNode.class);\r
+        border.init(new Rectangle2D.Double(0.0, 0.0, 297.0, 210.0), new Rectangle2D.Double(10.0, 10.0, 277.0, 190.0), Boolean.TRUE);\r
+\r
+        elementsNode = diagramCoordinatesNode.addNode(G2DParentNode.class);\r
+        elementsNode.setZIndex(0);\r
+\r
+        selectionNode = diagramCoordinatesNode.addNode(G2DParentNode.class);\r
+        selectionNode.setZIndex(1);\r
+\r
+        actionNode = diagramCoordinatesNode.addNode(G2DParentNode.class);\r
+        actionNode.setZIndex(2);\r
+    }\r
+\r
+    void setViewTransform(AffineTransform viewTransform) {\r
+        diagramCoordinatesNode.setTransform(viewTransform);\r
+    }\r
 }\r
index 687c84782285c266c35793341fbabadb6794472f..e3d336676d14dadf10bd5e212cffd28725da8f30 100644 (file)
@@ -1,6 +1,5 @@
 package org.simantics.h2d.node;
 
-import java.awt.BasicStroke;
 import java.awt.Color;
 import java.awt.Graphics2D;
 import java.awt.Shape;
@@ -10,16 +9,16 @@ import org.simantics.scenegraph.g2d.G2DNode;
 
 public class FilledShapeNode extends G2DNode {
 
-       private static final long serialVersionUID = -7540487222025677413L;
-       
-       protected Shape shape = null;
+    private static final long serialVersionUID = -7540487222025677413L;
+
+    protected Shape shape = null;
     protected Color color = Color.BLACK;
 
     @SyncField("shape")
     public void setShape(Shape shape) {
         this.shape = shape;
     }
-    
+
     @SyncField("color")
     public void setColor(Color color) {
         this.color = color;
@@ -29,13 +28,13 @@ public class FilledShapeNode extends G2DNode {
     public void render(Graphics2D g2d) {
         if(shape == null) return;
         if(color != null) g2d.setColor(color);
-        
+
         g2d.fill(shape);
     }
 
     @Override
-    public Rectangle2D getBounds() {
+    public Rectangle2D getBoundsInLocal() {
         return shape.getBounds2D();
     }
-    
+
 }
index 3f608f56cd477dd16189556482eb738ee4f04999..c09ec93bfe3b834fa2a7e93c083e7122b572c540 100644 (file)
@@ -40,7 +40,7 @@ public class LineNode extends G2DNode {
     }\r
 \r
        @Override\r
-       public Rectangle2D getBounds() {\r
+       public Rectangle2D getBoundsInLocal() {\r
                Rectangle2D bounds = new Rectangle2D.Double();\r
                bounds.setFrameFromDiagonal(begin, end);\r
                return bounds;\r
index 5f91df726341911760d32950151e86adb013c18f..d621d9c14d96a9b5a52def5c8beb76c1f3b423d3 100644 (file)
@@ -29,7 +29,7 @@ public class RectangleNode extends G2DNode {
     }\r
 \r
        @Override\r
-       public Rectangle2D getBounds() {\r
+       public Rectangle2D getBoundsInLocal() {\r
                return bounds;\r
        }\r
     \r
index ba8f13b48e5be7e891bf491a7d28512c55e3d0d5..d5af4762e25c751b70c9770c8302a6edfd974875 100644 (file)
@@ -86,7 +86,7 @@ public class ShapeNode extends G2DNode {
     }
 
     @Override
-    public Rectangle2D getBounds() {
+    public Rectangle2D getBoundsInLocal() {
         return shape.getBounds2D();
     }
 }
index 8c3ed90916fd4317fbc4f6f6ea25faeafcb64a33..559e6e4d161ac1a1093aabf9f95d26498f6399dc 100644 (file)
@@ -237,7 +237,7 @@ public class TextNode extends G2DNode {
     }\r
 \r
        @Override\r
-       public Rectangle2D getBounds() {\r
+       public Rectangle2D getBoundsInLocal() {\r
                return null;\r
        }\r
 \r