Author: paperwing
Date: 2012-01-20 13:57:47 -0800 (Fri, 20 Jan 2012)
New Revision: 28070

Added:
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderLabelsProcedure.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/text/
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/text/TextRenderer.java
Modified:
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/MainGraphicsHandler.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/coordinator/BirdsEyeCoordinatorProcessor.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/coordinator/MainCoordinatorProcessor.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/coordinator/ViewingCoordinator.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/geometric/Vector3.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderArcEdgesProcedure.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderBoundingBoxProcedure.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderEdgesProcedure.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/ResetSceneProcedure.java
Log:
In process of implementing text rendering using the JOGL library's TextRenderer 
class, experimented with drawing text using lines, finding suitable way to 
represent the main camera with a slice of the viewing volume (frustum)

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/MainGraphicsHandler.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/MainGraphicsHandler.java
      2012-01-20 21:05:16 UTC (rev 28069)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/MainGraphicsHandler.java
      2012-01-20 21:57:47 UTC (rev 28070)
@@ -16,9 +16,11 @@
 import org.cytoscape.paperwing.internal.rendering.ReadOnlyGraphicsProcedure;
 import org.cytoscape.paperwing.internal.rendering.RenderArcEdgesProcedure;
 import org.cytoscape.paperwing.internal.rendering.RenderEdgesProcedure;
+import org.cytoscape.paperwing.internal.rendering.RenderLabelsProcedure;
 import org.cytoscape.paperwing.internal.rendering.RenderNodesProcedure;
 import org.cytoscape.paperwing.internal.rendering.RenderSelectionBoxProcedure;
 import org.cytoscape.paperwing.internal.rendering.ResetSceneProcedure;
+import org.cytoscape.paperwing.internal.rendering.text.TextRenderer;
 import org.cytoscape.view.model.CyNetworkView;
 
 public class MainGraphicsHandler implements GraphicsHandler {
@@ -31,6 +33,7 @@
                renderProcedures.put("nodes", new RenderNodesProcedure());
                renderProcedures.put("edges", new RenderArcEdgesProcedure());
                renderProcedures.put("selectionBox", new 
RenderSelectionBoxProcedure());
+               renderProcedures.put("labels", new RenderLabelsProcedure());
                
                renderProcedures.put("resetScene", new ResetSceneProcedure());
        }
@@ -59,6 +62,8 @@
                renderProcedures.get("edges").execute(graphicsData);
                renderProcedures.get("nodes").execute(graphicsData);
                renderProcedures.get("selectionBox").execute(graphicsData);
+               renderProcedures.get("labels").execute(graphicsData);
+               
        }
 
        @Override

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/coordinator/BirdsEyeCoordinatorProcessor.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/coordinator/BirdsEyeCoordinatorProcessor.java
 2012-01-20 21:05:16 UTC (rev 28069)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/coordinator/BirdsEyeCoordinatorProcessor.java
 2012-01-20 21:57:47 UTC (rev 28070)
@@ -30,6 +30,9 @@
                                
coordinatorData.setBoundsTo(coordinator.getMainCameraBounds());
                                coordinatorData.setInitialBoundsMatched(true);
                                coordinator.setInitialBoundsMatched(true);
+                               
+                               
coordinatorData.setLastReportedMainCameraPosition(
+                                               
coordinator.getUpdatedMainCameraPosition());
                        }
                        
                        // This is the regular case

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/coordinator/MainCoordinatorProcessor.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/coordinator/MainCoordinatorProcessor.java
     2012-01-20 21:05:16 UTC (rev 28069)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/coordinator/MainCoordinatorProcessor.java
     2012-01-20 21:57:47 UTC (rev 28070)
@@ -40,7 +40,7 @@
                                if (coordinator.isBirdsEyeBoundsMoved()) {
                                        
                                        // Transfer data from coordinator
-                                       Vector3 newPosition = 
coordinator.calculateCameraPosition(camera.getDirection(), 
camera.getDistance());
+                                       Vector3 newPosition = 
coordinator.calculateCameraPosition(camera.getDirection());
                                        camera.moveTo(newPosition);
                                        coordinator.setMainCameraCopy(camera);
                                        

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/coordinator/ViewingCoordinator.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/coordinator/ViewingCoordinator.java
   2012-01-20 21:05:16 UTC (rev 28069)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/coordinator/ViewingCoordinator.java
   2012-01-20 21:57:47 UTC (rev 28070)
@@ -12,6 +12,10 @@
 
 public class ViewingCoordinator {
 
+       // Distance between bounds and camera position
+       // TODO: Make into member variable, with adjustable value
+       public static double BOUND_DISTANCE = 0.7;
+       
        public static double BOUNDS_CHANGE_THRESHOLD = 5e-16;
        public static double CAMERA_CHANGE_THRESHOLD = 5e-25;
        
@@ -60,7 +64,7 @@
                Quadrilateral bounds;
                
                bounds = 
GeometryToolkit.generateViewingBounds(mainCameraCopy.getPosition(), 
-                               mainCameraCopy.getDirection(), 
mainCameraCopy.getUp(), mainCameraCopy.getDistance(), verticalFov, aspectRatio);
+                               mainCameraCopy.getDirection(), 
mainCameraCopy.getUp(), BOUND_DISTANCE, verticalFov, aspectRatio);
                
                return bounds;
        }
@@ -109,15 +113,15 @@
                        return 
GeometryToolkit.generateViewingBounds(mainCameraCopy.getPosition(), 
                                        mainCameraCopy.getDirection(), 
                                        mainCameraCopy.getUp(),
-                                       mainCameraCopy.getDistance(), 
verticalFov, aspectRatio);
+                                       BOUND_DISTANCE, verticalFov, 
aspectRatio);
                }
        }
        
-       public Vector3 calculateCameraPosition(Vector3 cameraDirection, double 
distance) {
+       public Vector3 calculateCameraPosition(Vector3 cameraDirection) {
                if (!initialBoundsMatched) {
                        return null;
                } else {
-                       return 
GeometryToolkit.generateCameraPosition(birdsEyeBoundsCopy, cameraDirection, 
distance);
+                       return 
GeometryToolkit.generateCameraPosition(birdsEyeBoundsCopy, cameraDirection, 
BOUND_DISTANCE);
                }
        }
        

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/geometric/Vector3.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/geometric/Vector3.java
        2012-01-20 21:05:16 UTC (rev 28069)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/geometric/Vector3.java
        2012-01-20 21:57:47 UTC (rev 28070)
@@ -390,11 +390,10 @@
         * @return
         */
        public Vector3 towards(Vector3 other, double fraction) {
-               Vector3 result = other.subtract(this);
-               result.multiplyLocal(fraction);
-               result.addLocal(this);
-               
-               return result;
+               Vector3 offset = other.subtract(this);
+               offset.multiplyLocal(fraction);
+       
+               return offset.plus(this);
        }
        
        /** Give a string representation of this vector

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderArcEdgesProcedure.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderArcEdgesProcedure.java
        2012-01-20 21:05:16 UTC (rev 28069)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderArcEdgesProcedure.java
        2012-01-20 21:57:47 UTC (rev 28070)
@@ -38,7 +38,7 @@
        private static final RenderColor DEFAULT_HOVER_COLOR = 
                new RenderColor(0.5, 0.5, 0.7);
        
-       private static final int NUM_SEGMENTS = 3;
+       private static final int NUM_SEGMENTS = 11;
        
        private int segmentListIndex;
        

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderBoundingBoxProcedure.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderBoundingBoxProcedure.java
     2012-01-20 21:05:16 UTC (rev 28069)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderBoundingBoxProcedure.java
     2012-01-20 21:57:47 UTC (rev 28070)
@@ -119,21 +119,22 @@
        }
        
        /** Draws a portion of the viewing volume.
-        * 
-        * Currently, the stored bounds representing the main camera's view is 
used as the front
-        * face of the volume, and the back face is placed at a distance equal 
to 2 times the distance
-        * between the front face and the camera.
         */
        private void drawViewingVolumePortion(GraphicsData graphicsData) {
                
                GL2 gl = graphicsData.getGlContext();
-               
+               Vector3 eyePosition = 
graphicsData.getCoordinatorData().getLastReportedMainCameraPosition();
                Quadrilateral frontFace = 
graphicsData.getCoordinatorData().getBounds();
-               Quadrilateral backFace = frontFace.copy();
+               Quadrilateral backFace;
+
+               double backDistanceMultiplier = -1.2;
                
                // Move the back face so it is twice the distance away from the 
depicted camera as the front face
-               backFace.moveTo(frontFace.getCenterPoint().towards(
-                               
graphicsData.getCoordinatorData().getLastReportedMainCameraPosition(), 2));
+               backFace = new Quadrilateral(
+                               frontFace.getTopLeft().towards(eyePosition, 
backDistanceMultiplier),
+                               frontFace.getTopRight().towards(eyePosition, 
backDistanceMultiplier),
+                               frontFace.getBottomLeft().towards(eyePosition, 
backDistanceMultiplier),
+                               frontFace.getBottomRight().towards(eyePosition, 
backDistanceMultiplier));
                
                gl.glDisable(GL2.GL_LIGHTING);
                gl.glDisable(GL.GL_DEPTH_TEST);
@@ -154,6 +155,7 @@
                RenderToolkit.drawPoint(gl, backFace.getBottomLeft());
                RenderToolkit.drawPoint(gl, backFace.getBottomRight());
                RenderToolkit.drawPoint(gl, backFace.getTopRight());
+               RenderToolkit.drawPoint(gl, backFace.getTopLeft());
                gl.glEnd();
                
                gl.glBegin(GL2.GL_LINES);

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderEdgesProcedure.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderEdgesProcedure.java
   2012-01-20 21:05:16 UTC (rev 28069)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderEdgesProcedure.java
   2012-01-20 21:57:47 UTC (rev 28070)
@@ -53,7 +53,7 @@
         * How many straight edge segments to use for approximating a curved 
edge,
         * this value does not have to be static
         */
-       private static int QUADRATIC_EDGE_SEGMENTS = 3;
+       private static int QUADRATIC_EDGE_SEGMENTS = 11;
 
        /** The slices detail level to use for drawing edges */
        private static int EDGE_SLICES_DETAIL = 3;

Added: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderLabelsProcedure.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderLabelsProcedure.java
                          (rev 0)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderLabelsProcedure.java
  2012-01-20 21:57:47 UTC (rev 28070)
@@ -0,0 +1,78 @@
+package org.cytoscape.paperwing.internal.rendering;
+
+import java.util.Set;
+
+import javax.media.opengl.GL2;
+
+import org.cytoscape.model.CyNode;
+import org.cytoscape.paperwing.internal.data.GraphicsData;
+import org.cytoscape.paperwing.internal.geometric.Vector3;
+import 
org.cytoscape.paperwing.internal.rendering.shapes.ScalableShapeDrawer.ShapeType;
+import org.cytoscape.paperwing.internal.rendering.text.TextRenderer;
+import org.cytoscape.paperwing.internal.tools.RenderColor;
+import org.cytoscape.view.model.CyNetworkView;
+import org.cytoscape.view.model.View;
+import org.cytoscape.view.presentation.property.MinimalVisualLexicon;
+import org.cytoscape.view.presentation.property.RichVisualLexicon;
+
+public class RenderLabelsProcedure implements ReadOnlyGraphicsProcedure {
+
+       private static final float TEXT_SCALE = 0.045f;
+       private static final Vector3 TEXT_OFFSET = new Vector3 (0, 0.04, 0);
+       
+       private TextRenderer textRenderer;
+       
+       public RenderLabelsProcedure() {
+               textRenderer = new TextRenderer();
+       }
+       
+       @Override
+       public void initialize(GraphicsData graphicsData) {
+               GL2 gl = graphicsData.getGlContext();
+               
+               textRenderer.initialize(gl);
+       }
+
+       @Override
+       public void execute(GraphicsData graphicsData) {
+               GL2 gl = graphicsData.getGlContext();
+
+               CyNetworkView networkView = graphicsData.getNetworkView();
+               float distanceScale = graphicsData.getDistanceScale();
+               float x, y, z;
+
+               String text;
+               
+               for (View<CyNode> nodeView : networkView.getNodeViews()) {
+                       x = 
nodeView.getVisualProperty(RichVisualLexicon.NODE_X_LOCATION)
+                                       .floatValue() / distanceScale;
+                       y = 
nodeView.getVisualProperty(RichVisualLexicon.NODE_Y_LOCATION)
+                                       .floatValue() / distanceScale;
+                       z = 
nodeView.getVisualProperty(RichVisualLexicon.NODE_Z_LOCATION)
+                                       .floatValue() / distanceScale;
+
+                       // Draw it only if the visual property says it is 
visible
+                       if 
(nodeView.getVisualProperty(MinimalVisualLexicon.NODE_VISIBLE)) {
+                               gl.glPushMatrix();
+                               gl.glTranslatef(x, y, z);
+                               
+                               gl.glColor3f(0.2f, 0.2f, 0.2f);
+                               
+                               text = 
nodeView.getVisualProperty(MinimalVisualLexicon.NODE_LABEL);
+                               
+                               gl.glTranslatef((float) TEXT_OFFSET.x(),
+                                               (float) TEXT_OFFSET.y(),
+                                               (float) TEXT_OFFSET.z());
+                               
+                               if (text != null) {
+                                       gl.glScalef(TEXT_SCALE, TEXT_SCALE, 
TEXT_SCALE);
+                                       // textRenderer.drawCenteredText(gl, 
text, TEXT_OFFSET);
+                                       // textRenderer.drawCenteredText(gl, 
"aac");
+                               }
+                               
+                               gl.glPopMatrix();
+                       }
+               }
+       }
+
+}


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

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/ResetSceneProcedure.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/ResetSceneProcedure.java
    2012-01-20 21:05:16 UTC (rev 28069)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/ResetSceneProcedure.java
    2012-01-20 21:57:47 UTC (rev 28070)
@@ -30,9 +30,14 @@
                Vector3 target = camera.getTarget();
                Vector3 up = camera.getUp();
 
-               glu.gluLookAt((float) position.x(), (float) position.y(), 
(float) position.z(), 
-                               (float) target.x(), (float) target.y(), (float) 
target.z(), 
-                               (float) up.x(), (float) up.y(), (float) up.z());
+//             System.out.println(position);
+//             System.out.println(target);
+//             System.out.println(up);
+               
+               glu.gluLookAt(
+                               position.x(), position.y(), position.z(), 
+                               target.x(), target.y(), target.z(), 
+                               up.x(), up.y(), up.z());
        }
 
 }

Added: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/text/TextRenderer.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/text/TextRenderer.java
                              (rev 0)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/text/TextRenderer.java
      2012-01-20 21:57:47 UTC (rev 28070)
@@ -0,0 +1,143 @@
+package org.cytoscape.paperwing.internal.rendering.text;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.media.opengl.GL2;
+import org.cytoscape.paperwing.internal.geometric.Vector3;
+
+public class TextRenderer {
+       
+       private static final float CHARACTER_SPACING = 0.1f;
+       
+       private static final float MAX_CHARACTER_HEIGHT = 1.0f;
+       private static final float MAX_CHARACTER_SECONDARY_HEIGHT = 0.5f;
+       private static final float MAX_CHARACTER_WIDTH = 0.5f;  
+       
+       Map<Character, RenderedCharacter> characterLists;
+       
+       private class RenderedCharacter {
+               int characterListIndex;
+               float width;
+               char character;
+               
+               @Override
+               public String toString() {
+                       return ("RenderedCharacter " + character);
+               }
+       }
+       
+       public TextRenderer() {
+               characterLists = new HashMap(80);
+       }
+       
+       public void initialize(GL2 gl) {
+               initializeCharacterSet(gl);
+               
+               initializeCharacterLists(gl);
+               
+               // System.out.println(characterLists);
+       }
+       
+       private void initializeCharacterSet(GL2 gl) {
+               int startingIndex;
+               startingIndex = gl.glGenLists(26);
+               char startingCharacter = 'a';
+       
+               RenderedCharacter renderedCharacter;
+               
+               for (int i = 0; i < 26; i++) {
+                       renderedCharacter = new RenderedCharacter();
+                       renderedCharacter.character = startingCharacter++;
+                       renderedCharacter.characterListIndex = startingIndex++;
+                       
+                       characterLists.put(renderedCharacter.character, 
renderedCharacter);
+               }
+       }
+       
+       private void initializeCharacterLists(GL2 gl) {
+               int listIndex;
+               
+               float maxHeight = 1.0f;
+               float secondaryHeight = 0.5f;
+               float maxWidth = 0.5f;
+               
+               for (RenderedCharacter renderedCharacter : 
characterLists.values()) {
+                       listIndex = renderedCharacter.characterListIndex;
+                       renderedCharacter.width = maxWidth;
+                       
+                       gl.glNewList(listIndex, GL2.GL_COMPILE);
+                       gl.glBegin(GL2.GL_LINE_STRIP);
+                       
+                       // Characters are drawn with bottom left as origin, 
extends to (1, 0.5)
+                       
+                       switch (renderedCharacter.character) {
+                       case 'a':
+                               gl.glVertex2f(maxWidth, secondaryHeight * 0.0f);
+                               gl.glVertex2f(maxWidth, secondaryHeight * 0.9f);
+                               gl.glVertex2f(maxWidth * 0.9f, secondaryHeight);
+                               gl.glVertex2f(maxWidth * 0.2f, secondaryHeight);
+                               gl.glVertex2f(maxWidth * 0.1f, secondaryHeight 
* 0.7f);
+                               gl.glVertex2f(maxWidth * 0.05f, secondaryHeight 
* 0.0f);
+                               gl.glVertex2f(maxWidth, secondaryHeight * 0.1f);
+                               break;
+                       case 'c':
+                               gl.glVertex2f(maxWidth, secondaryHeight);
+                               gl.glVertex2f(maxWidth * 0.1f, secondaryHeight);
+                               gl.glVertex2f(maxWidth * 0.1f, secondaryHeight 
* 0.0f);
+                               gl.glVertex2f(maxWidth, secondaryHeight * 0.0f);
+                               break;
+                       }
+                       
+                       gl.glEnd();
+                       gl.glEndList();
+                       
+                       
+               }
+       }
+       
+       private void drawString(GL2 gl, String text) {
+               char current;
+               RenderedCharacter renderedCharacter;
+               
+               for (int i = 0; i < text.length(); i++) {
+                       current = text.charAt(i);
+                       
+                       renderedCharacter = characterLists.get(current);
+                       
+//                     System.out.println("get result for " + current + "in " 
+ text + ": " + renderedCharacter);
+                       
+                       if (renderedCharacter != null) {
+                               
gl.glCallList(renderedCharacter.characterListIndex);
+//                             System.out.println("calling list for :" + 
renderedCharacter.character);
+                               gl.glTranslatef(renderedCharacter.width + 
CHARACTER_SPACING, 0, 0);
+                       }
+               }
+       }
+       
+       public void drawCenteredText(GL2 gl, String text) {
+               float stringWidth = 0;
+               
+               char current;
+               RenderedCharacter renderedCharacter;
+               
+               for (int i = 0; i < text.length(); i++) {
+                       current = text.charAt(i);
+                       
+                       renderedCharacter = characterLists.get(current);
+                       
+                       if (renderedCharacter != null) {
+                               stringWidth += renderedCharacter.width;
+                       }
+               }
+               
+               gl.glDisable(GL2.GL_LIGHTING);
+               gl.glPushMatrix();
+               
+               gl.glTranslatef(-stringWidth / 2, 0, 0);
+               drawString(gl, text);
+               
+               gl.glPopMatrix();
+               gl.glEnable(GL2.GL_LIGHTING);
+       }
+}


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

-- 
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