fenfire-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ff-cvs] fenfire/org/fenfire/view/buoy AbstractMainNode2...


From: Matti Katila
Subject: [ff-cvs] fenfire/org/fenfire/view/buoy AbstractMainNode2...
Date: Sun, 17 Aug 2003 07:31:29 -0400

CVSROOT:        /cvsroot/fenfire
Module name:    fenfire
Branch:         
Changes by:     Matti Katila <address@hidden>   03/08/17 07:31:28

Modified files:
        org/fenfire/view/buoy: AbstractMainNode2D.java 
                               FisheyeMainNode2D.java MainNode2D.java 

Log message:
        fix inheritance problem

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/view/buoy/AbstractMainNode2D.java.diff?tr1=1.44&tr2=1.45&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/view/buoy/FisheyeMainNode2D.java.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/view/buoy/MainNode2D.java.diff?tr1=1.32&tr2=1.33&r1=text&r2=text

Patches:
Index: fenfire/org/fenfire/view/buoy/AbstractMainNode2D.java
diff -u fenfire/org/fenfire/view/buoy/AbstractMainNode2D.java:1.44 
fenfire/org/fenfire/view/buoy/AbstractMainNode2D.java:1.45
--- fenfire/org/fenfire/view/buoy/AbstractMainNode2D.java:1.44  Fri Aug 15 
01:13:51 2003
+++ fenfire/org/fenfire/view/buoy/AbstractMainNode2D.java       Sun Aug 17 
07:31:27 2003
@@ -181,60 +181,24 @@
        return pt;
     }
 
-    public boolean isHitInsidePlane(int x, int y, VobScene oldVobScene) {
-       float[] pt = new float[] { x, y, 0 };
-       float[] sq = new float[2];
-       oldVobScene.coords.inverseTransformPoints3(
-               box2screen, pt, pt);
-       oldVobScene.coords.getSqSize(box2screen, sq);
-       if (dbg) p("sq:  1: "+sq[0]+", 3: "+sq[1]);
-       if (this instanceof MainNode2D) {
-           if(pt[0] >= 0 && pt[0] < sq[0] &&
-              pt[1] >= 0 && pt[1] < sq[1]) {
-               pt[2] = 0;
-               oldVobScene.coords
-                   .transformPoints3(box2screen, pt, pt);
-                // what's zout?
-               //if(zout != null)
-               //    zout[0] = pt[2];
-               return true;
-           }
-       } else if (this instanceof FisheyeMainNode2D) {
-           oldVobScene.coords.transformPoints3(box2paper, pt, pt);
-           view2d.getSize(plane, v2dwh);
-           if(v2dwh[0] >= 0) {
-               if(pt[0] >= 0 && pt[0] < v2dwh[0] &&
-                  pt[1] >= 0 && pt[1] < v2dwh[1]) return true;
-           }
-       } else throw new Error("No known main node view2d");
-       return false;
+
+    protected float[] 
+       hit_pt = new float[3], 
+       hit_sq = new float[2];
+
+    /** Has main node 2d being hit? 
+     * This method tell if hit is inside main node or not.
+     */
+    public boolean hasMouseHit(VobScene oldVobScene, int x, int y) {
+       return hasMouseHit(oldVobScene, x,y, null);
     }
+    public boolean hasMouseHit(VobScene oldVobScene, int x, int y, float[] 
zout) {
+       hit_pt[0] = x; hit_pt[1] = y; hit_pt[2] = 0;
+       for (int i=0; i<hit_sq.length; i++) hit_sq[i] = 0;
 
-    public boolean mouseClickHit(VobMouseEvent e, VobScene oldVobScene, 
float[] zout) {
-       float[] pt = new float[] { e.getX(), e.getY(), 0 };
-       float[] sq = new float[2];
        oldVobScene.coords.inverseTransformPoints3(
-               box2screen, pt, pt);
-       oldVobScene.coords.getSqSize(box2screen, sq);
-       if (dbg) p("sq:  1: "+sq[0]+", 3: "+sq[1]);
-       if (this instanceof MainNode2D) {
-           if(pt[0] >= 0 && pt[0] < sq[0] &&
-              pt[1] >= 0 && pt[1] < sq[1]) {
-               pt[2] = 0;
-               oldVobScene.coords
-                   .transformPoints3(box2screen, pt, pt);
-               if(zout != null)
-                   zout[0] = pt[2];
-               return true;
-           }
-       } else if (this instanceof FisheyeMainNode2D) {
-           oldVobScene.coords.transformPoints3(box2paper, pt, pt);
-           view2d.getSize(plane, v2dwh);
-           if(v2dwh[0] >= 0) {
-               if(pt[0] >= 0 && pt[0] < v2dwh[0] &&
-                  pt[1] >= 0 && pt[1] < v2dwh[1]) return true;
-           }
-       } else throw new Error("No known main node view2d");
+               box2screen, hit_pt, hit_pt);
+       oldVobScene.coords.getSqSize(box2screen, hit_sq);
        return false;
     }
 
Index: fenfire/org/fenfire/view/buoy/FisheyeMainNode2D.java
diff -u fenfire/org/fenfire/view/buoy/FisheyeMainNode2D.java:1.15 
fenfire/org/fenfire/view/buoy/FisheyeMainNode2D.java:1.16
--- fenfire/org/fenfire/view/buoy/FisheyeMainNode2D.java:1.15   Wed Aug  6 
11:55:54 2003
+++ fenfire/org/fenfire/view/buoy/FisheyeMainNode2D.java        Sun Aug 17 
07:31:27 2003
@@ -109,5 +109,19 @@
        }
        return super.mouse(e, oldVobScene);
     }
+
+
+    public boolean hasMouseHit(VobScene oldVobScene, int x, int y, float[] 
zout) {
+       super.hasMouseHit(oldVobScene, x,y, zout);
+
+       oldVobScene.coords.transformPoints3(box2paper, hit_pt, hit_pt);
+       view2d.getSize(plane, v2dwh);
+       if(v2dwh[0] >= 0) {
+           if(hit_pt[0] >= 0 && hit_pt[0] < v2dwh[0] &&
+              hit_pt[1] >= 0 && hit_pt[1] < v2dwh[1]) return true;
+       }
+       return false;
+    }
+
 }
 
Index: fenfire/org/fenfire/view/buoy/MainNode2D.java
diff -u fenfire/org/fenfire/view/buoy/MainNode2D.java:1.32 
fenfire/org/fenfire/view/buoy/MainNode2D.java:1.33
--- fenfire/org/fenfire/view/buoy/MainNode2D.java:1.32  Wed Aug  6 11:55:54 2003
+++ fenfire/org/fenfire/view/buoy/MainNode2D.java       Sun Aug 17 07:31:27 2003
@@ -100,5 +100,20 @@
                        focus.getPanX()-boxw/zoom/2, 
focus.getPanY()-boxh/zoom/2, 
                                    1/zoom, 1/zoom, boxw, boxh);
     }
+
+    public boolean hasMouseHit(VobScene oldVobScene, int x, int y, float[] 
zout) {
+       super.hasMouseHit(oldVobScene, x,y, zout);
+
+       if(hit_pt[0] >= 0 && hit_pt[0] < hit_sq[0] &&
+          hit_pt[1] >= 0 && hit_pt[1] < hit_sq[1]) {
+           hit_pt[2] = 0;
+           oldVobScene.coords
+               .transformPoints3(box2screen, hit_pt, hit_pt);
+           if(zout != null)
+               zout[0] = hit_pt[2];
+           return true;
+       }
+       return false;
+    }
     
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]