Author: paperwing
Date: 2011-12-21 10:55:35 -0800 (Wed, 21 Dec 2011)
New Revision: 27854

Added:
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/graphics/Quadrilateral.java
Modified:
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/Graphics.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/Vector3.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindMapRenderingEngine.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindRenderingEngine.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/graphics/BirdsEyeViewCoordinator.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/graphics/GraphicsData.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/graphics/GraphicsUtility.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/graphics/RenderEdgesProcedure.java
Log:
coordinator static method implemented to make extracting camera and viewing 
bound data easier. about to make graphics.java an abstract class so that the 
main rendering window and the birds eye view can be child classes of what was 
once graphics.java.

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/Graphics.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/Graphics.java
 2011-12-21 17:13:12 UTC (rev 27853)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/Graphics.java
 2011-12-21 18:55:35 UTC (rev 27854)
@@ -64,22 +64,8 @@
  * @author Paperwing (Yue Dong)
  */
 public class Graphics implements GLEventListener {
-       
-       /** Controls the distance apart to draw the reticle for the mouse */
-       private static final double RETICLE_DISTANCE = 0.06;
-       
-       /** Controls the radius of the reticle */
-       private static final double RETICLE_RADIUS = 0.012;
-       
-       /** The NULL coordinate which means "no coordinate" */
-       private static int NULL_COORDINATE = Integer.MIN_VALUE;
-       
 
-       /** A constant that stands for "no index is here" */
-       // TODO: NO_INDEX relies on cytoscape's guarantee that node and edge 
indices are nonnegative
-       private static final int NO_INDEX = -1; // Value representing that no 
node or edge index is being held  
        
-       
        /** A monitor to keep track of keyboard events */
        private KeyboardMonitor keys;
        
@@ -89,11 +75,6 @@
        /** A boolean to use lower quality 3D shapes to improve framerate */
        private boolean lowerQuality = false;
        
-       
-       private boolean mapMode = false;
-       private Graphics mapPartner = null;
-       private Container mapContainer = null;
-       
        private GraphicsData graphicsData;
        private Map<String, ReadOnlyGraphicsProcedure> renderProcedures;
        
@@ -102,11 +83,6 @@
        
        private BirdsEyeViewCoordinator coordinator;
        
-       private static Map<CyNetworkView, List<Graphics>> registry = null;
-       static {
-               Graphics.registry = new HashMap<CyNetworkView, 
List<Graphics>>();
-       }
-       
        /** A class capable of storing the edge and node indices of edges and 
nodes
         * that were found to be selected using the shape picking methods
         */
@@ -130,14 +106,6 @@
         * @param visualLexicon The visual lexicon being used
         */
        public Graphics(CyNetworkView networkView, VisualLexicon visualLexicon) 
{
-               if (registry.get(networkView) == null) {
-                       List<Graphics> list = new LinkedList<Graphics>();
-                       list.add(this);
-                       
-                       registry.put(networkView, list);
-               } else {
-                       registry.get(networkView).add(this);
-               }
                
                keys = new KeyboardMonitor();
                mouse = new MouseMonitor();
@@ -167,38 +135,6 @@
                inputProcessor = new InputProcessor();
        }
        
-       public void setMapMode(boolean mapMode) {
-               this.mapMode = mapMode;
-       }
-       
-       private void setMapPartner(Graphics mapPartner) {
-               this.mapPartner = mapPartner;
-       }
-       
-       public void setMapContainer(Container container) {
-               this.mapContainer = container;
-       }
-       
-       public void findMapPartner() {
-               List<Graphics> list = 
registry.get(graphicsData.getNetworkView());
-               
-               if (list == null) {
-                       return;
-               } else {
-                       for (Graphics g : list) {
-                               if (g.mapMode != this.mapMode && g.mapPartner 
== null && this.mapPartner == null) {
-                                       g.setMapPartner(this);
-                                       this.setMapPartner(g);
-                                       
-                                       System.out.println("Graphics with 
mapMode (" + mapMode + ") found partner. Link is + " + g + " and " + this);
-                                       
-                                       return;
-                               }
-                       }
-               }
-               
-       }
-       
        /** Attach the KeyboardMonitor and MouseMonitors, which are listeners,
         * to the specified component for capturing keyboard and mouse events
         * 
@@ -225,11 +161,48 @@
                GL2 gl = drawable.getGL().getGL2();
                graphicsData.setGlContext(gl);
                
-               SimpleCamera camera = graphicsData.getCamera();
-               
                // Check input
-               checkInput(gl);
+               processInput();
 
+               // Update data for bird's eye view camera movement
+               checkBevCameraMovement();
+               
+               // Reset the scene for drawing
+               resetSceneForDrawing(gl);
+               
+               // Draw the scene
+               drawScene(gl);
+               
+               
+               graphicsData.setFramesElapsed(graphicsData.getFramesElapsed() + 
1);
+       }
+       
+
+       /** Obtain input and check for changes in the keyboard and mouse 
buttons,
+        * as well as mouse movement. This method also handles responses
+        * to such events
+        */
+       private void processInput() {
+               inputProcessor.processInput(keys, mouse, graphicsData, 
shapePicker);
+       }
+       
+       
+       // Check for signals from birdsEyeView
+       private void checkBevCameraMovement() {
+               if (coordinator.birdsEyeBoundsChanged()) {
+                       Vector3 newCameraPosition = 
+                               
BirdsEyeViewCoordinator.extractCameraPosition(coordinator, 
+                                               
graphicsData.getCamera().getDirection(), 
+                                               
graphicsData.getCamera().getDistance());
+                       
+                       graphicsData.getCamera().moveTo(newCameraPosition);
+               }
+       }
+       
+       
+       private void resetSceneForDrawing(GL2 gl) {
+               SimpleCamera camera = graphicsData.getCamera();
+               
                // Reset scene
                gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
                gl.glLoadIdentity();
@@ -241,78 +214,26 @@
                GLU glu = new GLU();
                glu.gluLookAt(position.x(), position.y(), position.z(), 
target.x(),
                                target.y(), target.z(), up.x(), up.y(), up.z());
+       }
+       
+       private void drawScene(GL2 gl) {
                
                // Draw selection box
-               // ------------------
-
                if (graphicsData.getSelectionData().isDragSelectMode()) {
-                       
                        
renderProcedures.get("selectionBox").execute(graphicsData);
                }
                
                // Control light positioning
-               // -------------------------
-               
                float[] lightPosition = { -4.0f, 4.0f, 6.0f, 1.0f };
                
                // Code below toggles the light following the camera
                // gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_POSITION,
                // FloatBuffer.wrap(lightPosition));
-
-
-               // Draw nodes and edges
-               // --------------------
                
                renderProcedures.get("nodes").execute(graphicsData);
                renderProcedures.get("edges").execute(graphicsData);
-               
-               graphicsData.setFramesElapsed(graphicsData.getFramesElapsed() + 
1);
-               
-               if (mapMode) {
-                       if (mapContainer != null) {
-                               mapContainer.repaint();
-                       }
-               }
-               
-//             // Draw the location rectangle on the map
-//             if (mapMode) {
-//                     if (mapPartner != null) {
-//                             SimpleCamera partnerCamera = mapPartner.camera;
-//                             
-//                             Vector3 topLeft = 
mapPartner.projectScreenCoordinates(0, 0, partnerCamera.getDistance());
-//                             Vector3 bottomLeft = 
mapPartner.projectScreenCoordinates(0, mapPartner.screenHeight, 
partnerCamera.getDistance());
-//                             
-//                             Vector3 topRight = 
mapPartner.projectScreenCoordinates(mapPartner.screenWidth, 0, 
partnerCamera.getDistance());
-//                             Vector3 bottomRight = 
mapPartner.projectScreenCoordinates(mapPartner.screenWidth, 
mapPartner.screenHeight, partnerCamera.getDistance());
-//                             
-//                             gl.glDisable(GL2.GL_LIGHTING);
-//                             gl.glColor3f(0.7f, 0.7f, 0.6f);
-//                             
-//                             // Below uses converted 3D coordinates
-//                             gl.glBegin(GL2.GL_LINE_LOOP);
-//                             gl.glVertex3d(topLeft.x(), topLeft.y(), 
topLeft.z());
-//                             gl.glVertex3d(bottomLeft.x(), bottomLeft.y(), 
bottomLeft.z());
-//                             gl.glVertex3d(bottomRight.x(), bottomRight.y(), 
bottomRight.z());
-//                             gl.glVertex3d(topRight.x(), topRight.y(), 
topRight.z());
-//                             gl.glEnd();
-//                             
-//                             
-//                             gl.glEnable(GL2.GL_LIGHTING);
-//                     }
-//             }
-               
        }
        
-       /** Obtain input and check for changes in the keyboard and mouse 
buttons,
-        * as well as mouse movement. This method also handles responses
-        * to such events
-        * 
-        * @param gl The {@link GL2} object used for rendering
-        */
-       private void checkInput(GL2 gl) {
-               inputProcessor.processInput(keys, mouse, graphicsData, 
shapePicker);
-       }
-       
        @Override
        public void dispose(GLAutoDrawable autoDrawable) {
 
@@ -407,7 +328,7 @@
                gl.glLoadIdentity();
 
                GLU glu = new GLU();
-               glu.gluPerspective(45.0f, (float) width / height, 0.2f, 50.0f);
+               glu.gluPerspective(graphicsData.getVerticalFov(), (float) width 
/ height, 0.2f, 50.0f);
 
                gl.glMatrixMode(GL2.GL_MODELVIEW);
                gl.glLoadIdentity();
@@ -415,17 +336,4 @@
                graphicsData.setScreenHeight(height);
                graphicsData.setScreenWidth(width);
        }
-       
-       /** Move the camera so that it zooms out on a central part of the 
network,
-        * but this method is not finalized yet
-        */
-       public void provideCentralView() {
-//             camera.moveTo(new Vector3(0, 0, 0));
-//             
-//             if (findAveragePosition(networkView.getModel().getNodeList()) 
!= null) {
-//                     
camera.moveTo(findAveragePosition(networkView.getModel().getNodeList()));
-//             }
-//             camera.moveBackward();
-//             camera.zoomOut(40);
-       }
 }

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/Vector3.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/Vector3.java
  2011-12-21 17:13:12 UTC (rev 27853)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/Vector3.java
  2011-12-21 18:55:35 UTC (rev 27854)
@@ -94,7 +94,7 @@
         * @param other The vector to add
         * @return A new {@link Vector3} representing the sum
         */
-       public Vector3 add(Vector3 other) {
+       public Vector3 plus(Vector3 other) {
                return new Vector3(x + other.x, y + other.y, z + other.z);
        }
        
@@ -249,7 +249,7 @@
                }
        }
        
-       /** Obtain the magnitude, sometimes length, of the vector
+       /** Obtain the magnitude, or the length, of the vector
         * 
         * @return The magnitude of the vector
         */
@@ -342,4 +342,12 @@
        public String toString() {
                return "(" + x + ", " + y + ", " + z + ")";
        }
+       
+       /** Make a copy of this vector
+        * 
+        * @return A copy of this vector object
+        */
+       public Vector3 copy() {
+               return new Vector3(this);
+       }
 }

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindMapRenderingEngine.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindMapRenderingEngine.java
   2011-12-21 17:13:12 UTC (rev 27853)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindMapRenderingEngine.java
   2011-12-21 18:55:35 UTC (rev 27854)
@@ -29,11 +29,11 @@
                
                super(container, viewModel, visualLexicon);
                
-               graphics.provideCentralView();
-               graphics.setMapMode(true);
-               graphics.setMapContainer((Container) container);
-               
-               graphics.findMapPartner();
+//             graphics.provideCentralView();
+//             graphics.setMapMode(true);
+//             graphics.setMapContainer((Container) container);
+//             
+//             graphics.findMapPartner();
        }
 
 }

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindRenderingEngine.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindRenderingEngine.java
      2011-12-21 17:13:12 UTC (rev 27853)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindRenderingEngine.java
      2011-12-21 18:55:35 UTC (rev 27854)
@@ -180,7 +180,7 @@
                        
                        active = true;
                        
-                       graphics.findMapPartner();
+//                     graphics.findMapPartner();
                }
        }
 

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/graphics/BirdsEyeViewCoordinator.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/graphics/BirdsEyeViewCoordinator.java
 2011-12-21 17:13:12 UTC (rev 27853)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/graphics/BirdsEyeViewCoordinator.java
 2011-12-21 18:55:35 UTC (rev 27854)
@@ -10,10 +10,10 @@
 public class BirdsEyeViewCoordinator {
 
        private SimpleCamera newMainCamera;
-       private SimpleCamera newBirdsEyeCamera;
+       private Quadrilateral newBirdsEyeBounds;
 
        private boolean mainCameraChanged = false;
-       private boolean birdsEyeCameraChanged = false;
+       private boolean birdsEyeBoundsChanged = false;
 
        private boolean mainClaimed = false;
        private boolean birdsEyeClaimed = false;
@@ -28,11 +28,29 @@
        // the maps
        private static Map<BirdsEyeViewCoordinator, CyNetworkView> networkViews 
= new LinkedHashMap<BirdsEyeViewCoordinator, CyNetworkView>();
        
+       // Camera direction must be a unit vector
+       public static Vector3 extractCameraPosition(BirdsEyeViewCoordinator 
coordinator, Vector3 cameraDirection, double cameraDistance) {
+               Vector3 offset = cameraDirection.copy();
+               offset.multiplyLocal(cameraDistance);
+               
+               Quadrilateral bounds = coordinator.getNewBirdsEyeBounds();
+               
+               Vector3 position = bounds.getCenterPoint();
+               position.addLocal(offset);
+               
+               return position;
+       }
+       
+       public static Quadrilateral extractBounds(SimpleCamera camera, double 
verticalFov, double aspectRatio) {
+               return 
GraphicsUtility.generateViewingBounds(camera.getPosition(), 
camera.getDirection(), camera.getUp(), 
+                               camera.getDistance(), verticalFov, aspectRatio);
+       }
+       
        // This networkView is only used to differentiate between main camera 
and
        // birds eye camera pairs
        private BirdsEyeViewCoordinator(CyNetworkView networkView) {
                newMainCamera = new SimpleCamera();
-               newBirdsEyeCamera = new SimpleCamera();
+               newBirdsEyeBounds = new Quadrilateral();
        }
        
        public static BirdsEyeViewCoordinator getCoordinator(CyNetworkView 
networkView) {
@@ -55,35 +73,35 @@
        }
 
        // Update orientation
-       public void updateBirdsEyeCamera(SimpleCamera birdsEyeCamera) {
-               newBirdsEyeCamera.copyOrientation(birdsEyeCamera);
-               birdsEyeCameraChanged = true;
+       public void updateBirdsEyeBounds(Quadrilateral bounds) {
+               newBirdsEyeBounds.set(bounds);
+               birdsEyeBoundsChanged = true;
        }
-
+       
        // Get the updated camera
        public SimpleCamera getNewMainCamera() {
                return newMainCamera;
        }
 
        // Get the updated camera
-       public SimpleCamera getNewBirdsEyeCamera() {
-               return newBirdsEyeCamera;
+       public Quadrilateral getNewBirdsEyeBounds() {
+               return newBirdsEyeBounds;
        }
 
        public boolean mainCameraChanged() {
                return mainCameraChanged;
        }
 
-       public boolean birdsEyeCameraChanged() {
-               return birdsEyeCameraChanged;
+       public boolean birdsEyeBoundsChanged() {
+               return birdsEyeBoundsChanged;
        }
 
        public void updateMainCamera() {
                mainCameraChanged = false;
        }
 
-       public void updateBirdsEyeCamera() {
-               birdsEyeCameraChanged = false;
+       public void updateBirdsEyeBounds() {
+               birdsEyeBoundsChanged = false;
        }
 
        // Claim by a main window rendering object

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/graphics/GraphicsData.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/graphics/GraphicsData.java
    2011-12-21 17:13:12 UTC (rev 27853)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/graphics/GraphicsData.java
    2011-12-21 18:55:35 UTC (rev 27854)
@@ -20,6 +20,8 @@
         */
        private float distanceScale = 178.0f; 
        
+       private float verticalFov = 45.0f;
+       
        /** The index of the node currently being hovered over */
        private int hoverNodeIndex;
        
@@ -180,4 +182,12 @@
        public CoordinatorData getCoordinatorData() {
                return coordinatorData;
        }
+
+       public float getVerticalFov() {
+               return verticalFov;
+       }
+
+       public void setVerticalFov(float verticalFov) {
+               this.verticalFov = verticalFov;
+       }
 }

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/graphics/GraphicsUtility.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/graphics/GraphicsUtility.java
 2011-12-21 17:13:12 UTC (rev 27853)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/graphics/GraphicsUtility.java
 2011-12-21 18:55:35 UTC (rev 27854)
@@ -111,43 +111,29 @@
                
        }
        
-       /**
-        * Obtain the average position of a set of nodes, where each node has 
the same
-        * weight in the average
-        * 
-        * @param nodes The {@link Collection} of nodes
-        * @return The average position
-        */
-       public static Vector3 findAveragePosition(Collection<CyNode> nodes, 
CyNetworkView networkView) {
-               if (nodes.isEmpty()) {
-                       return null;
-               }
+       // Needs camera direction vector, camera up vector to be unit
+       // This method also uses the Math.tan method, so there might be room 
for finding a faster tangent method
+       public static Quadrilateral generateViewingBounds(Vector3 
cameraPosition, Vector3 cameraDirection, Vector3 cameraUp, 
+                       double planeDistance, double verticalFov, double 
aspectRatio) {
+               // These x, y, z offsets are oriented relative to the camera's 
direction vector
+               Vector3 zOffset = cameraDirection.copy();
+               zOffset.multiplyLocal(planeDistance);
                
-               double x = 0;
-               double y = 0;
-               double z = 0;
+               Vector3 yOffset = cameraUp.copy();
+               yOffset.multiplyLocal(planeDistance * Math.tan(verticalFov));
                
-               View<CyNode> nodeView;
+               Vector3 xOffset = cameraDirection.copy(); // xOffset will be 
the camera's right vector
+               xOffset.crossLocal(cameraUp);
+               xOffset.multiplyLocal(yOffset.magnitude() * aspectRatio); // 
aspect = width / length
                
-               for (CyNode node : nodes) {
-                       // TODO: This relies on an efficient traversal of 
nodes, as well
-                       // as efficient retrieval from the networkView object
-                       nodeView = networkView.getNodeView(node);
-                       
-                       if (nodeView != null) {
-                               x += 
nodeView.getVisualProperty(RichVisualLexicon.NODE_X_LOCATION);
-                               y += 
nodeView.getVisualProperty(RichVisualLexicon.NODE_Y_LOCATION);
-                               z += 
nodeView.getVisualProperty(RichVisualLexicon.NODE_Z_LOCATION);
-                       } else {
-                               System.out.println("Node with no view found: " 
+ node + 
-                                               ", index: " + node.getIndex());
-                       }
-               }
+               Vector3 centerPoint = cameraPosition.copy().plus(zOffset);
                
-               Vector3 result = new Vector3(x, y, z);
-               // result.divideLocal(DISTANCE_SCALE * nodes.size());
+               Vector3 topLeft = centerPoint.plus(yOffset).subtract(xOffset);
+               Vector3 topRight = centerPoint.plus(yOffset).plus(xOffset);
+               Vector3 bottomLeft = 
centerPoint.subtract(yOffset).subtract(xOffset);
+               Vector3 bottomRight = 
centerPoint.subtract(yOffset).plus(xOffset);
                
-               return result;
+               return new Quadrilateral(topLeft, topRight, bottomLeft, 
bottomRight);
        }
        
        public static Vector3 findAveragePosition(Set<Integer> nodeIndices, 
CyNetworkView networkView, double distanceScale) {

Added: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/graphics/Quadrilateral.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/graphics/Quadrilateral.java
                           (rev 0)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/graphics/Quadrilateral.java
   2011-12-21 18:55:35 UTC (rev 27854)
@@ -0,0 +1,70 @@
+package org.cytoscape.paperwing.internal.graphics;
+
+import org.cytoscape.paperwing.internal.Vector3;
+
+public class Quadrilateral {
+       private Vector3 topLeft;
+       private Vector3 topRight;
+       private Vector3 bottomLeft;
+       private Vector3 bottomRight;
+       
+       public Quadrilateral(Vector3 topLeft, Vector3 topRight, Vector3 
bottomLeft, Vector3 bottomRight) {
+               this.topLeft = topLeft.copy();
+               this.topRight = topRight.copy();
+               this.bottomLeft = bottomLeft.copy();
+               this.bottomRight = bottomRight.copy();
+       }
+       
+       public Quadrilateral() {
+               this(new Vector3(0, 0, 0), new Vector3(0, 0, 0), new Vector3(0, 
0, 0), new Vector3(0, 0, 0));
+       }
+       
+       public Vector3 getTopLeft() {
+               return topLeft.copy();
+       }
+       public void setTopLeft(double x, double y, double z) {
+               topLeft.set(x, y, z);
+       }
+       public Vector3 getTopRight() {
+               return topRight.copy();
+       }
+       public void setTopRight(double x, double y, double z) {
+               topRight.set(x, y, z);
+       }
+       public Vector3 getBottomLeft() {
+               return bottomLeft.copy();
+       }
+       public void setBottomLeft(double x, double y, double z) {
+               bottomLeft.set(x, y, z);
+       }
+       public Vector3 getBottomRight() {
+               return bottomRight.copy();
+       }
+       public void setBottomRight(double x, double y, double z) {
+               bottomRight.set(x, y, z);
+       }
+       
+       public void set(Quadrilateral other) {
+               topLeft.set(other.topLeft);
+               topRight.set(other.topRight);
+               bottomLeft.set(other.bottomLeft);
+               bottomRight.set(other.bottomRight);
+       }
+
+       public Quadrilateral copy() {
+               return new Quadrilateral(topLeft, topRight, bottomLeft, 
bottomRight);
+       }
+       
+       // Return average point
+       public Vector3 getCenterPoint() {
+               Vector3 center = new Vector3();
+               
+               center.addLocal(topLeft);
+               center.addLocal(topRight);
+               center.addLocal(bottomLeft);
+               center.addLocal(bottomRight);
+               center.divideLocal(4.0);
+               
+               return center;
+       }
+}


Property changes on: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/graphics/Quadrilateral.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/graphics/RenderEdgesProcedure.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/graphics/RenderEdgesProcedure.java
    2011-12-21 17:13:12 UTC (rev 27853)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/graphics/RenderEdgesProcedure.java
    2011-12-21 18:55:35 UTC (rev 27854)
@@ -199,7 +199,7 @@
                                                        
.getVisualProperty(RichVisualLexicon.NODE_Z_LOCATION));
                        p2.divideLocal(distanceScale);
 
-                       p1 = p0.add(p2);
+                       p1 = p0.plus(p2);
                        p1.divideLocal(2);
 
                        direction = p2.subtract(p0);

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to