Author: paperwing
Date: 2012-02-06 14:29:38 -0800 (Mon, 06 Feb 2012)
New Revision: 28198

Modified:
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderArcEdgesProcedure.java
Log:
Support added for the edge width visual property

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-02-06 19:24:33 UTC (rev 28197)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderArcEdgesProcedure.java
        2012-02-06 22:29:38 UTC (rev 28198)
@@ -60,6 +60,8 @@
        
        private EdgeShapeDrawer shapeDrawer;
        
+       private float edgeRadiusFactor = 1.0f;
+       
        // Container for EdgeView objects that also adds information about 
whether the
        // edge is part of a series of edges that connect the same pair of nodes
        private class EdgeViewContainer {
@@ -184,6 +186,7 @@
                Set<EdgeViewContainer> edgeViewContainers = 
analyzeEdges(networkView, distanceScale);
                View<CyEdge> edgeView;
                Vector3 circleCenter;
+               Number edgeWidth;
                
                for (EdgeViewContainer container : edgeViewContainers) {
                        edgeView = container.edgeView;
@@ -191,6 +194,12 @@
                        if (container.start != null && container.end != null && 
                                        
(container.end.distance(container.start) >= MIN_LENGTH || container.selfEdge)) {
                                
+                               edgeWidth = 
container.edgeView.getVisualProperty(RichVisualLexicon.EDGE_WIDTH);
+                               
+                               if (edgeWidth != null) {
+                                       edgeRadiusFactor = 
edgeWidth.floatValue() / 2;
+                               }
+                               
                                // Set color
                                chooseColor(gl, edgeView, graphicsData);
                                
@@ -407,7 +416,9 @@
                        
                        // Setup transformations to draw the shape
                        RenderToolkit.setUpFacingTransformation(gl, points[i], 
displacement);
-                       gl.glScalef(SEGMENT_RADIUS, SEGMENT_RADIUS, (float) 
displacement.magnitude());
+                       gl.glScalef(SEGMENT_RADIUS * edgeRadiusFactor, 
+                                       SEGMENT_RADIUS * edgeRadiusFactor, 
+                                       (float) displacement.magnitude());
                        
                        // Perform drawing
                        shapeDrawer.drawSegment(gl, EdgeShapeType.REGULAR);
@@ -427,7 +438,9 @@
                        RenderToolkit.setUpFacingTransformation(gl, points[i], 
facing);
                        gl.glTranslatef(0, 0, -DASHED_EDGE_LENGTH / 2);
                        
-                       gl.glScalef(DASHED_EDGE_RADIUS, DASHED_EDGE_RADIUS, 
DASHED_EDGE_LENGTH);
+                       gl.glScalef(DASHED_EDGE_RADIUS * edgeRadiusFactor,
+                                       DASHED_EDGE_RADIUS * edgeRadiusFactor, 
+                                       DASHED_EDGE_LENGTH);
                        
                        // Perform drawing
                        shapeDrawer.drawSegment(gl, EdgeShapeType.DASHED);
@@ -445,7 +458,9 @@
                        gl.glPushMatrix();
                        
                        RenderToolkit.setUpFacingTransformation(gl, points[i], 
facing);
-                       gl.glScalef(DOTTED_EDGE_RADIUS, DOTTED_EDGE_RADIUS, 
DOTTED_EDGE_RADIUS);
+                       gl.glScalef(DOTTED_EDGE_RADIUS  * edgeRadiusFactor,
+                                       DOTTED_EDGE_RADIUS * edgeRadiusFactor,
+                                       DOTTED_EDGE_RADIUS * edgeRadiusFactor);
                        
                        // Perform drawing
                        shapeDrawer.drawSegment(gl, EdgeShapeType.DOTTED);

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