Author: paperwing
Date: 2012-01-12 14:55:52 -0800 (Thu, 12 Jan 2012)
New Revision: 28004
Added:
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderArcEdgesProcedure.java
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/RenderNodesProcedure.java
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderSelectionBoxProcedure.java
Log:
in process of implementing circular edge drawing algorithm
Added:
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
(rev 0)
+++
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderArcEdgesProcedure.java
2012-01-12 22:55:52 UTC (rev 28004)
@@ -0,0 +1,73 @@
+package org.cytoscape.paperwing.internal.rendering;
+
+import javax.media.opengl.GL2;
+import javax.media.opengl.glu.GLU;
+import javax.media.opengl.glu.GLUquadric;
+
+import org.cytoscape.paperwing.internal.data.GraphicsData;
+import org.cytoscape.paperwing.internal.geometric.Vector3;
+import org.cytoscape.paperwing.internal.tools.GeometryToolkit;
+import org.cytoscape.paperwing.internal.tools.RenderToolkit;
+
+public class RenderArcEdgesProcedure implements ReadOnlyGraphicsProcedure {
+
+ private static final double SEGMENT_RADIUS = 0.05;
+ private static final int SEGMENT_SLICES = 4;
+ private static final int SEGMENT_STACKS = 1;
+
+ private int segmentListIndex;
+
+ @Override
+ public void initialize(GraphicsData graphicsData) {
+ GL2 gl = graphicsData.getGlContext();
+
+ segmentListIndex = gl.glGenLists(1);
+
+ GLU glu = GLU.createGLU(gl);
+
+ GLUquadric segmentQuadric = glu.gluNewQuadric();
+ glu.gluQuadricDrawStyle(segmentQuadric, GLU.GLU_FILL);
+ glu.gluQuadricNormals(segmentQuadric, GLU.GLU_SMOOTH); // TODO:
Experiment
+
// with GLU_FLAT for
+
// efficiency
+
+ gl.glNewList(segmentListIndex, GL2.GL_COMPILE);
+ glu.gluCylinder(segmentQuadric, SEGMENT_RADIUS, SEGMENT_RADIUS,
1.0,
+ SEGMENT_SLICES, SEGMENT_STACKS);
+ gl.glEndList();
+ }
+
+ @Override
+ public void execute(GraphicsData graphicsData) {
+ // TODO Auto-generated method stub
+
+ }
+
+ private void drawArcSegments(GL2 gl, Vector3 start, Vector3 end, double
radius, double angle, int segments) {
+ Vector3 displacement = end.subtract(start);
+ double displacementLength = displacement.magnitude();
+
+ // Use cosine law
+ double arcAngle;
+ arcAngle = GeometryToolkit.saferArcCos(
+ (2 * radius * radius - displacementLength *
displacementLength)
+ / (2 * radius * radius));
+
+ double nearCornerAngle = Math.PI / 2 - (arcAngle / 2);
+
+
+ }
+
+ private void drawSegment(GL2 gl, Vector3 start, Vector3 end) {
+ Vector3 displacement = end.subtract(start);
+
+ RenderToolkit.setUpFacingTransformation(gl, start,
displacement);
+
+ gl.glScaled(1, 1, displacement.magnitude());
+
+ // need a scale transformation for segment radius?
+
+ gl.glCallList(segmentListIndex);
+ }
+
+}
Property changes on:
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderArcEdgesProcedure.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
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-12 22:39:36 UTC (rev 28003)
+++
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderEdgesProcedure.java
2012-01-12 22:55:52 UTC (rev 28004)
@@ -243,26 +243,13 @@
p1.addLocal(p1Offset);
- // if (latch_1) {
- // System.out.println("Source index: " + sourceIndex);
- // System.out.println("Source target: " + targetIndex);
- // System.out.println("pairs.get(pairIdentifier): " +
- // pairs.get(pairIdentifier));
- // System.out.println("pairIdentifier: " +
pairIdentifier);
- // }
-
// Load name for edge picking
gl.glLoadName(edgeIndex);
edgeView.setVisualProperty(RichVisualLexicon.NODE_SELECTED, false);
DrawStateModifier modifier;
- // if (generalModifier == DrawStateModifier.ENLARGED) {
- // modifier = DrawStateModifier.ENLARGED;
- // } else if (selectedEdgeIndices.contains(edgeIndex)) {
-
-// if (selectedEdgeIndices.contains(edgeIndex)) {
if
(edgeView.getVisualProperty(MinimalVisualLexicon.EDGE_SELECTED)) {
modifier = DrawStateModifier.SELECTED;
@@ -375,12 +362,12 @@
// Perform a transformation to adjust width
gl.glScalef(width, width, 1.0f);
- Color color;
+ Color color = null;
if (modifier == DrawStateModifier.NORMAL) {
color = (Color) edgeView
.getVisualProperty(RichVisualLexicon.EDGE_PAINT);
-
+
gl.glColor3f(color.getRed() / 255.0f, color.getGreen()
/ 255.0f,
color.getBlue() / 255.0f);
Modified:
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderNodesProcedure.java
===================================================================
---
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderNodesProcedure.java
2012-01-12 22:39:36 UTC (rev 28003)
+++
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderNodesProcedure.java
2012-01-12 22:55:52 UTC (rev 28004)
@@ -142,15 +142,11 @@
// color = (Color) nodeView
//
.getVisualProperty(MinimalVisualLexicon.NODE_PAINT);
- // TODO: Cleanup code below
Object colorObject =
nodeView.getVisualProperty(MinimalVisualLexicon.NODE_FILL_COLOR);
if (colorObject != null
&& colorObject.getClass() ==
Color.class) {
color = (Color) colorObject;
- } else if (colorObject.getClass() !=
Color.class) {
-// System.out.println("Found unexpected
NODE_FILL_COLOR type for: " + nodeView
-// + ", which was: " +
colorObject.getClass() + " with value: " + colorObject);
}
if (color != null) {
Modified:
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderSelectionBoxProcedure.java
===================================================================
---
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderSelectionBoxProcedure.java
2012-01-12 22:39:36 UTC (rev 28003)
+++
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderSelectionBoxProcedure.java
2012-01-12 22:55:52 UTC (rev 28004)
@@ -14,7 +14,7 @@
public class RenderSelectionBoxProcedure implements ReadOnlyGraphicsProcedure {
private static final RenderColor DEFAULT_COLOR =
- new RenderColor(0.4, 0.6, 0.75);
+ new RenderColor(0.58, 0.68, 0.85);
@Override
public void initialize(GraphicsData graphicsData) {
--
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.