Author: clopes
Date: 2010-07-31 22:08:39 -0700 (Sat, 31 Jul 2010)
New Revision: 21111

Added:
   cytoscapeweb/branches/gsoc2010/gbeb/lib/
   cytoscapeweb/branches/gsoc2010/gbeb/lib/OpenSourceFarm.swc
Modified:
   cytoscapeweb/branches/gsoc2010/gbeb/src/GBEBView.as
   cytoscapeweb/branches/gsoc2010/gbeb/src/gbeb/view/operator/router/Shape.as
   cytoscapeweb/branches/gsoc2010/gbeb/src/gbeb/view/render/EdgeRenderer.as
Log:
Drawing curved edges through control points.

Added: cytoscapeweb/branches/gsoc2010/gbeb/lib/OpenSourceFarm.swc
===================================================================
(Binary files differ)


Property changes on: cytoscapeweb/branches/gsoc2010/gbeb/lib/OpenSourceFarm.swc
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: cytoscapeweb/branches/gsoc2010/gbeb/src/GBEBView.as
===================================================================
--- cytoscapeweb/branches/gsoc2010/gbeb/src/GBEBView.as 2010-07-31 23:42:15 UTC 
(rev 21110)
+++ cytoscapeweb/branches/gsoc2010/gbeb/src/GBEBView.as 2010-08-01 05:08:39 UTC 
(rev 21111)
@@ -5,17 +5,15 @@
     import flare.data.DataSet;
     import flare.data.converters.GraphMLConverter;
     import flare.display.DirtySprite;
-    import flare.query.methods.neq;
     import flare.util.Shapes;
     import flare.vis.Visualization;
-    import flare.vis.controls.ClickControl;
     import flare.vis.data.Data;
     import flare.vis.data.EdgeSprite;
     import flare.vis.data.NodeSprite;
     import flare.vis.data.Tree;
     import flare.vis.events.SelectionEvent;
-    import flare.vis.operator.label.Labeler;
     import flare.vis.operator.layout.CircleLayout;
+    import flare.vis.operator.layout.RadialTreeLayout;
     
     import flash.display.Sprite;
     import flash.display.StageAlign;
@@ -99,17 +97,17 @@
             if (_bounds) resize(_bounds);
  
                 // place around circle by tree structure, radius mapped to 
depth
-//                _vis.operators.add(new RadialTreeLayout("depth", null, 
true));
-//                CircleLayout(_vis.operators.last).startRadiusFraction = 3/5;
+//                _vis.operators.add(new CircleLayout(null, null, true));
+//                CircleLayout(_vis.operators.last).angleWidth = 2 * Math.PI;
                                                                                
                
-                // _vis.operators.add(new RadialTreeLayout(80));
-             // RadialTreeLayout(_vis.operators.last).autoScale = true;        
                        
+//                 _vis.operators.add(new RadialTreeLayout(80));
+//                RadialTreeLayout(_vis.operators.last).autoScale = true;      
                        
                                                        
-                                                       _vis.operators.add(new 
CircleLayout());
+                               _vis.operators.add(new CircleLayout());
+                               
+                               //_vis.operators.add(new 
NodeLinkTreeLayout("topToBottom", 50, 50, 50));
                                                        
-                                                       
//_vis.operators.add(new NodeLinkTreeLayout("topToBottom", 50, 50, 50));
                                                        
-                                                       
                 // set the edge alpha values
                 // longer edge, lighter alpha: 1/(2*numCtrlPoints)
 //                _vis.operators.add(new PropertyEncoder({ alpha: edgeAlpha }, 
Data.EDGES));

Modified: 
cytoscapeweb/branches/gsoc2010/gbeb/src/gbeb/view/operator/router/Shape.as
===================================================================
--- cytoscapeweb/branches/gsoc2010/gbeb/src/gbeb/view/operator/router/Shape.as  
2010-07-31 23:42:15 UTC (rev 21110)
+++ cytoscapeweb/branches/gsoc2010/gbeb/src/gbeb/view/operator/router/Shape.as  
2010-08-01 05:08:39 UTC (rev 21111)
@@ -175,9 +175,9 @@
                        }
                        
                        for each (edge in storedDataEdges) {
-                                       edge.lineWidth = edge.lineWidth /2 ; 
//lower width gives better visual quality
-                           edge.shape = Shapes.BSPLINE; //Here to change curve 
type
-                                       edge.lineAlpha = 0.5;
+                               edge.lineWidth = edge.lineWidth /2 ; //lower 
width gives better visual quality
+                       edge.shape = Shapes.BSPLINE; //Here to change curve type
+                               edge.lineAlpha = 0.5;
                                var ctrl:Array = edge.props.$controlPointsArray;
                                var ctrlgradient:Array = 
edge.props.$CPGradientArray; //used to store the gradient of each control point
                                if (ctrl == null) 
edge.props.$controlPointsArray = ctrl = [];

Modified: 
cytoscapeweb/branches/gsoc2010/gbeb/src/gbeb/view/render/EdgeRenderer.as
===================================================================
--- cytoscapeweb/branches/gsoc2010/gbeb/src/gbeb/view/render/EdgeRenderer.as    
2010-07-31 23:42:15 UTC (rev 21110)
+++ cytoscapeweb/branches/gsoc2010/gbeb/src/gbeb/view/render/EdgeRenderer.as    
2010-08-01 05:08:39 UTC (rev 21111)
@@ -12,7 +12,10 @@
        import flash.geom.Point;
        import flash.geom.Rectangle;
        
-       import gbeb.util.GeometryUtil;
+       import gbeb.util.GeometryUtil;
+       
+       import org.farmcode.bezier.BezierPoint;
+       import org.farmcode.bezier.Path;
 
        /**
         * Renderer that draws edges as lines. The EdgeRenderer supports 
straight
@@ -188,8 +191,25 @@
                        }
                        else if (e.shape == Shapes.BSPLINE)
                        {
-                               Shapes.consolidate(x1, y1, ctrls, x2, y2, _pts);
-                               Shapes.drawBSpline(g, _pts, 2+ctrls.length/2);
+//                             Shapes.consolidate(x1, y1, ctrls, x2, y2, _pts);
+//                             Shapes.drawBSpline(g, _pts, 2+ctrls.length/2);
+
+                // See 
http://farmcode.org/post/2009/07/06/Fast-2D-Bezier-Library-for-ActionScript-3.aspx
+                // 
#################################################################################
+                               var points:Array = [new BezierPoint(x1, y1)];
+                               for each (p in e.props.$controlPointsArray) {
+                                       var b:BezierPoint = new 
BezierPoint(p.x, p.y);
+                                       points.push(b);
+                               }
+                               points.push(new BezierPoint(x2, y2));
+                               
+                               var path:Path = new Path();
+                               path.points = points;
+                               //path.autoFillTension = 0.5;
+                               //path.tolerance = 0.5;
+                               path.drawInto(g);
+                               // 
#################################################################################
+                               
                                trace("EdgeRenderer: Tesing render calls: " + 
e.name);//debug
                                // DEBUG *******
                 if (e.props.$debug == true) {

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