Author: paperwing
Date: 2012-01-17 15:37:21 -0800 (Tue, 17 Jan 2012)
New Revision: 28035
Modified:
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/shapes/ScalableShapeDrawer.java
Log:
Updated shape drawing class, may consider splitting shapes to different classes
to make it easier to replace implementations of shapes as well as
adding/removing shapes
Modified:
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/shapes/ScalableShapeDrawer.java
===================================================================
---
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/shapes/ScalableShapeDrawer.java
2012-01-17 23:21:12 UTC (rev 28034)
+++
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/shapes/ScalableShapeDrawer.java
2012-01-17 23:37:21 UTC (rev 28035)
@@ -8,9 +8,17 @@
import javax.media.opengl.glu.GLUquadric;
public class ScalableShapeDrawer {
+
+ private static final int SPHERE_SLICES_DETAIL = 12;
+ private static final int SPHERE_STACKS_DETAIL = 12;
+
public static enum ShapeType {
+ SHAPE_SPHERICAL,
SHAPE_CUBIC,
- SHAPE_TETRAHEDRAL
+ SHAPE_TETRAHEDRAL,
+ SHAPE_CONICAL,
+ SHAPE_CYLINDRICAL,
+ SHAPE_DOUGHNUT,
}
private Map<ShapeType, Integer> shapeLists;
@@ -20,6 +28,12 @@
}
public void initialize(GL2 gl) {
+ initializeSphere(gl);
+ initializeCube(gl);
+ }
+
+ // Diameter 1 sphere
+ private void initializeSphere(GL2 gl) {
int shapeListIndex = gl.glGenLists(1);
GLU glu = GLU.createGLU(gl);
@@ -28,17 +42,28 @@
glu.gluQuadricDrawStyle(quadric, GLU.GLU_FILL);
glu.gluQuadricNormals(quadric, GLU.GLU_SMOOTH);
- // Draw Shape
- // ---------
+ gl.glNewList(shapeListIndex, GL2.GL_COMPILE);
+ glu.gluSphere(quadric, 0.5, SPHERE_SLICES_DETAIL,
SPHERE_STACKS_DETAIL);
+ gl.glEndList();
+
+ shapeLists.put(ShapeType.SHAPE_SPHERICAL, shapeListIndex);
+ }
+
+ // Cube inscribed in a radius 0.5 sphere
+ private void initializeCube(GL2 gl) {
+ int shapeListIndex = gl.glGenLists(1);
+ double cornerCoordinate = 0.5 / Math.sqrt(2);
+
gl.glNewList(shapeListIndex, GL2.GL_COMPILE);
+ gl.glBegin(GL2.GL_TRIANGLE_STRIP);
+ gl.glEnd();
+ gl.glEndList();
- gl.glEndList();
+ shapeLists.put(ShapeType.SHAPE_CUBIC, shapeListIndex);
}
-
-
public void drawShape(ShapeType shapeType) {
}
--
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.