Author: allain.lalonde
Date: Sat Jul 18 17:58:21 2009
New Revision: 517

Modified:
    piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PNode.java
     
piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PAffineTransform.java
     
piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/PerformanceTests.java
     
piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwingEventHandler.java

Log:
Reverted override of createInverse in PAffineTransform since the fact that  
it didn't throw anything was being overlooked in Hudson, but honoured in  
Eclipse

Modified:  
piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PNode.java
==============================================================================
--- piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PNode.java       
 
(original)
+++ piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PNode.java       
 
Sat Jul 18 17:58:21 2009
@@ -915,7 +915,11 @@
       */
      public PAffineTransform getGlobalToLocalTransform(PAffineTransform  
dest) {
          dest = getLocalToGlobalTransform(dest);
-        dest.setTransform(dest.createInverse());
+        try {
+            dest.setTransform(dest.createInverse());
+        } catch (NoninvertibleTransformException e) {
+            throw new PAffineTransformException(e, dest);
+        }
          return dest;
      }

@@ -2121,7 +2125,11 @@
              return new PAffineTransform();
          }

-        return new PAffineTransform(transform.createInverse());
+        try {
+            return new PAffineTransform(transform.createInverse());
+        } catch (NoninvertibleTransformException e) {
+            throw new PAffineTransformException(e, transform);
+        }
      }

      /**

Modified:  
piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PAffineTransform.java
==============================================================================
---  
piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PAffineTransform.java
    
(original)
+++  
piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PAffineTransform.java
    
Sat Jul 18 17:58:21 2009
@@ -333,17 +333,5 @@
              }
          }
          aRectangle.setRect(minX, minY, maxX - minX, maxY - minY);
-    }
-    /**
-     * Creates an inverse transform of this PAffineTransform
-     *
-     * If it's not possible then it throws a PAffineTransformException
-     */
-    public AffineTransform createInverse() {
-        try {
-            return super.createInverse();
-        } catch (NoninvertibleTransformException e) {
-            throw new PAffineTransformException(e, this);
-        }
-    }
+    }
  }

Modified:  
piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/PerformanceTests.java
==============================================================================
---  
piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/PerformanceTests.java
         
(original)
+++  
piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/PerformanceTests.java
         
Sat Jul 18 17:58:21 2009
@@ -55,9 +55,9 @@
      }

      public void testRunPerformanceTests() {
-        if (1==1)
+        if (1 == 1)
              return;
-
+
          // three times to warm up JVM
          for (int i = 0; i < 3; i++) {
              addNodes();
@@ -189,7 +189,7 @@
          log.startTest();
          // parent.validateFullBounds(); now protected.
          parent.getFullBoundsReference(); // calls validateFullBounds as a  
side
-                                         // effect.
+        // effect.
          log.endTest("Validate Layout after translate " + NUMBER_NODES + "  
nodes");

          log.startTest();
@@ -213,7 +213,7 @@

          // parent.validateFullBounds(); // now protected
          parent.getFullBoundsReference(); // calls validateFullBounds as a  
side
-                                         // effect.
+        // effect.

          log.startTest();
          for (int i = 0; i < NUMBER_NODES; i++) {
@@ -297,18 +297,18 @@

      }

-    public void renderSpeed() {
+    public void renderSpeed() throws NoninvertibleTransformException {
          Random r = new Random();
          PAffineTransform at = new PAffineTransform();
          at.setScale(r.nextFloat());
          at.translate(r.nextFloat(), r.nextFloat());
-
+
          log.startTest();
          for (int i = 0; i < NUMBER_NODES; i++) {
              at.createInverse();
          }
          log.endTest("Create inverse transform " + NUMBER_NODES + " times");
-
+
          int height = 400;
          int width = 400;


Modified:  
piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwingEventHandler.java
==============================================================================
---  
piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwingEventHandler.java
     
(original)
+++  
piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwingEventHandler.java
     
Sat Jul 18 17:58:21 2009
@@ -33,6 +33,7 @@
  import edu.umd.cs.piccolo.PNode;
  import edu.umd.cs.piccolo.event.PInputEvent;
  import edu.umd.cs.piccolo.event.PInputEventListener;
+import edu.umd.cs.piccolo.util.PAffineTransformException;

  import javax.swing.*;
  import java.awt.*;
@@ -359,7 +360,12 @@
      }

      private void cameraToLocal(PCamera topCamera, Point2D pt, PNode node) {
-        AffineTransform inverse =  
topCamera.getViewTransform().createInverse();
+        AffineTransform inverse;
+        try {
+             inverse = topCamera.getViewTransform().createInverse();
+        } catch (NoninvertibleTransformException e) {
+            throw new PAffineTransformException(e,  
topCamera.getViewTransform());
+        }

          /*
           * Only apply the camera's view transform when this node is a  
descendant

--~--~---------~--~----~------------~-------~--~----~
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to