Author: tomithy
Date: 2010-07-10 10:15:08 -0700 (Sat, 10 Jul 2010)
New Revision: 20892
Modified:
cytoscapeweb/branches/gsoc2010/demos/src/GBEB/GBEB.as
Log:
/* Version control file 11/7/10
Version 0.3
- Mesh is able to merge shape;
- DataDisplay shows different Shapes in Mesh;
- Able to calculate Mesh for different Layouts.
Version 0.4
- cleanup function is written to free up resources
Mesh: - shapes no longer contain repeated edges
- Patch is used to reflect the gradient around the
point, as there is some unknown bug causing the gradient to be reflected about
the y-axis
- Functions implemented:
4a) generateMeshEdges;
getNodesForMeshEdge; isSourceNodeAssigned, generateNonRedundantShapeIndexArray,
findCentroid,
generateLineFromPointAndGradient, intersectionWithVertical,
intersectionWithHorizontal
4b) mergeNodes_All(),
mergeNodes_Pairwise, calculateDistanceBetweenNodes - disabled as there are some
bugs
Class GeometryUtil is added to store lineIntersectline Math function
DataDisplay: - displays the centroid of Shapes,
- displays the mesh itself, which is
accurate except for occurance of vertical straight lines due to known issue (1)
Version 0.5
Shape/ DataDisplay: - control points are set up. Initially they are added via
GBEB properties and mirrored in edge.points
- control points are successfully added to all dataEdges that intersects with
meshEdges - the control point is the avg of the intersection points of
the meshEdge with the dataEdges passing through it.
Version 0.6
Bundler added - it extends from edge render. Used Shapes.BEZIER for rendering,
the effect is only satisfactory in general, but sometimes confusing for lines
with > 1 control points,
due to BEZIER's mathemathical property
Comments: It doesnt work very well on simple graphs and the curves thens to
complicate.
Messy graphs like circle or radial can
be improved if the resolution is set higher at the expense of runtime.
Next:
Version 0.7 - allow dynamic adjusting of resolution by merging Shapes by the
factor of 2
- include edge quality
calculation
- implement another renderer
for meshEdges to obtain better graphical control that default Bezier does not
offer.
Comments: Indent layout is rather slow to compute. Perhaps because of the huge
centre shape.
Known issues: 1) If the mesh edge is vertical or horizontal and it lies
directly above the grid, its source/traget nodes cannot be retrieve.
Eg. Edge 9 of
"social network.xml" -
Function
responsible: intersectsVertical and getNodesForMeshEdge
2) MergeNodes_All() -
Is acting weirdly, so it is disabled for now.
3) Edges cannot be
added when nodes are not added
4) Indent Layout does
not work.
5) Sample 2 does not
work as some nodes are not assigned any location, and are hence out of bounce.
*/
Modified: cytoscapeweb/branches/gsoc2010/demos/src/GBEB/GBEB.as
===================================================================
--- cytoscapeweb/branches/gsoc2010/demos/src/GBEB/GBEB.as 2010-07-10
17:14:48 UTC (rev 20891)
+++ cytoscapeweb/branches/gsoc2010/demos/src/GBEB/GBEB.as 2010-07-10
17:15:08 UTC (rev 20892)
@@ -1,9 +1,12 @@
package GBEB
{
import flare.vis.data.Data;
+ import flare.vis.data.EdgeSprite;
+ import flare.vis.data.NodeSprite;
import flash.display.Sprite;
import flash.geom.Rectangle;
+
//import flare.
//no Resize Event done yet
@@ -11,24 +14,29 @@
{
private var _meshResolution:int = 100; //Stores the resolution
of the Mesh. defined as number of meshnodes.
private var _meshData:Data;// Using Flare data class to store
edges and control points (CP) of mesh and nodes of the mesh.
+ private var _data:Data; //stores the actual data of the graph
+ private var _cloneData:Data; //stores the cloned data for Edges
used for visual comparsion of the algorithm
public var _mesh:Mesh;
- private var _dataDisplay:DataDisplay = new DataDisplay();
+ private var _dataDisplay:DataDisplay;
+ private var _GBEBContainer:Sprite = new Sprite();
+ private var _bundler:Bundler = new Bundler();
private var bounds:Rectangle = new Rectangle(0,0, 700, 500);
public function GBEB(d:Data, _mainBounds:Rectangle = null)
{
+ _data = d;
_meshResolution = int(Math.sqrt(d.edges.length +
d.nodes.length));
-
_mesh = new Mesh(d);
+ addChild(_mesh);
- addChild(_mesh);
+ _dataDisplay = new DataDisplay(d);
addChild(_dataDisplay);
+ addChild(_GBEBContainer);
-
trace("Mesh Resolution = " + _meshResolution);
}
@@ -38,13 +46,64 @@
_mesh.generateMesh(_meshResolution, bounds);
_dataDisplay.updateBounds(bounds);
_dataDisplay.updateMesh(_mesh);
- _dataDisplay.displayMesh();
+
+ trace("GBEB: Bundling!");
+
+ //_cloneData = new Data();
+ //data.nodes.visit(addNodes);
+ _data.edges.visit(bundle);
+ _data.edges.visit(addEdgesToVis);
+
+ //_data.edges.visit(cloneEdges);
+ //_cloneData.edges.visit(bundle);
+ //_cloneData.edges.visit(addEdgesToVis);
+
trace("GBEB : bounds.width:" + bounds.width + " |
bounds.height: " + bounds.height);
}
+ //these indented functions are use to
create a visualisation for GBEB
+ private function
bundle(e:EdgeSprite):void
+ {
+ _bundler.render(e);
+ }
+
+ private function
addNodes(n:NodeSprite):void
+ {
+ _cloneData.addNode(n);
+ }
+
+ private function
cloneEdges(e:EdgeSprite):void
+ {
+ var newEdge:EdgeSprite = new
EdgeSprite(e.source,e.target,e.directed);
+ newEdge.props.GBEBProperty =
e.props.GBEBProperty;
+ newEdge.x1 = e.x1; newEdge.y1 =
e.y1; newEdge.x2 = e.x2; newEdge.y2 = e.y2;
+ newEdge.data = e.data;
+ newEdge.lineColor =
e.lineColor;
+ _cloneData.addEdge(newEdge);
+ trace("GBEB: Cloning Edges!
_cloneData.length: " + _cloneData.edges.length);
+ }
+
+ private function
addEdgesToVis(e:EdgeSprite):void
+ {
+ _GBEBContainer.addChild(e);
+ }
+ public function cleanup():void
+ {
+ _dataDisplay.cleanup();
+ removeChild(_dataDisplay);
+ _dataDisplay = null;
+
+ _mesh.cleanup();
+ removeChild(_mesh);
+ _mesh = null;
+
+ _meshData = null;
+
+ }
+
}
}
\ No newline at end of file
--
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.