Author: Christian Lopes
Date: 2011-05-06 15:07:13 -0700 (Fri, 06 May 2011)
New Revision: 24954

Modified:
   cytoscapeweb/trunk/cytoscapeweb/default.properties
   cytoscapeweb/trunk/cytoscapeweb/html-template/tests.html
   cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/GraphUtils.as
   cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/Nodes.as
   cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/ExternalMediator.as
   
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/render/NodeRenderer.as
Log:
Fixed bug #2523: Rendering issue when using high resolution image as node 
background.
Fixed issue with gaps between a node and its edges when the node border width 
changes.

Modified: cytoscapeweb/trunk/cytoscapeweb/default.properties
===================================================================
--- cytoscapeweb/trunk/cytoscapeweb/default.properties  2011-05-06 21:59:55 UTC 
(rev 24953)
+++ cytoscapeweb/trunk/cytoscapeweb/default.properties  2011-05-06 22:07:13 UTC 
(rev 24954)
@@ -1,3 +1,3 @@
-build.version=0.8
+build.version=0.7.3
 
 FLEX_HOME=/Applications/Adobe Flex Builder 3 Plug-in/sdks/3.2.0/
\ No newline at end of file

Modified: cytoscapeweb/trunk/cytoscapeweb/html-template/tests.html
===================================================================
--- cytoscapeweb/trunk/cytoscapeweb/html-template/tests.html    2011-05-06 
21:59:55 UTC (rev 24953)
+++ cytoscapeweb/trunk/cytoscapeweb/html-template/tests.html    2011-05-06 
22:07:13 UTC (rev 24954)
@@ -61,10 +61,17 @@
         vis1.ready(function() { runGraphTests("Vis-1", vis1, options1); });
         runJSTests(vis1);
 
-        $.get("fixtures/test1.graphml", function(xml){
-            options1.network = xml;
-            options1.layout = { name: "circle", options: {} };
-            vis1.draw(options1);
+        $.ajax({
+            url: "fixtures/test1.graphml",
+            dataType: "text",
+            success: function(xml){
+                options1.network = xml;
+                options1.layout = { name: "circle", options: {} };
+                vis1.draw(options1);
+            },
+            error: function(){
+                alert("Error loading file 1");
+            }
         });
         
         var options2 = {
@@ -77,9 +84,16 @@
         var vis2 = new org.cytoscapeweb.Visualization("cytoweb2", { 
resourceBundleUrl: "fixtures/bundle_test.properties" });
         vis2.ready(function() { runGraphTests("Vis-2", vis2, options2); });
 
-        $.get("fixtures/test2.xgmml", function(xml){
-            options2.network = xml;
-            vis2.draw(options2);
+        $.ajax({
+            url: "fixtures/test2.xgmml",
+            dataType: "text",
+            success: function(xml){
+                options2.network = xml;
+                vis2.draw(options2);
+            },
+            error: function(){
+                alert("Error loading file 2");
+            }
         });
     });
 </script>

Modified: 
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/GraphUtils.as
===================================================================
--- cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/GraphUtils.as     
2011-05-06 21:59:55 UTC (rev 24953)
+++ cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/GraphUtils.as     
2011-05-06 22:07:13 UTC (rev 24954)
@@ -193,6 +193,7 @@
             var boundsList:Array = [];
             var lookup:Dictionary = new Dictionary();
             var data:Data;
+            var area:Number = 0;
            
             for each (data in dataList) {
                 // The real subgraph bounds:
@@ -205,12 +206,17 @@
                 // If there is a subgraph that is wider than the whole canvas,
                 // use its width in the packing bounds:
                 if (b.width > width) width = b.width;
+                area += b.width * b.height;
             }
             
             boundsList.sort(function(a:Rectangle, b:Rectangle):int {
                 return a.width < b.width ? -1 : (a.width > b.width ? 1 : 0);
             }, Array.DESCENDING);
             
+            // Adjust the bounds width:
+            if (dataList.length > 50)
+                width = Math.max(width, 1.4 * Math.sqrt(area));
+            
             // More than 8 subgraphs decreases performance when using "fill by 
stripes":
             if (boundsList.length <= 7)
                 boundsList = PackingAlgorithms.fillByStripes(width, 
boundsList);

Modified: cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/Nodes.as
===================================================================
--- cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/Nodes.as  
2011-05-06 21:59:55 UTC (rev 24953)
+++ cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/util/Nodes.as  
2011-05-06 22:07:13 UTC (rev 24954)
@@ -34,8 +34,8 @@
     
     import org.cytoscapeweb.ApplicationFacade;
     import org.cytoscapeweb.model.ConfigProxy;
-    import org.cytoscapeweb.model.data.VisualStyleVO;
     import org.cytoscapeweb.model.data.VisualStyleBypassVO;
+    import org.cytoscapeweb.model.data.VisualStyleVO;
     import org.cytoscapeweb.view.render.NodeRenderer;
     
     
@@ -160,7 +160,6 @@
 
         public static function imageUrl(n:NodeSprite):String {
             var propName:String = VisualProperties.NODE_IMAGE;
-            // TODO: selected/mouseover images
             return style.getValue(propName, n.data);
         }
         
@@ -179,8 +178,8 @@
         
         public static function filters(n:NodeSprite, 
selectNow:Boolean=false):Array {
             var filters:Array = [];
-
             var glow:GlowFilter = null;
+
             if (!selectNow && n.props.$hover)
                 glow = hoverGlow(n);
             if (glow == null && n.props.$selected)

Modified: 
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/ExternalMediator.as
===================================================================
--- 
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/ExternalMediator.as   
    2011-05-06 21:59:55 UTC (rev 24953)
+++ 
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/ExternalMediator.as   
    2011-05-06 22:07:13 UTC (rev 24954)
@@ -130,6 +130,7 @@
                 }
                 
                 functionName = "_cytoscapeWebInstances." + configProxy.id + 
"." + functionName;
+                
                 try {
                     if (desigFunction != null)
                         return ExternalInterface.call(functionName, 
desigFunction, argument);

Modified: 
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/render/NodeRenderer.as
===================================================================
--- 
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/render/NodeRenderer.as
    2011-05-06 21:59:55 UTC (rev 24953)
+++ 
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/render/NodeRenderer.as
    2011-05-06 22:07:13 UTC (rev 24954)
@@ -30,6 +30,8 @@
 package org.cytoscapeweb.view.render {
        import flare.util.Shapes;
        import flare.vis.data.DataSprite;
+       import flare.vis.data.EdgeSprite;
+       import flare.vis.data.NodeSprite;
        import flare.vis.data.render.ShapeRenderer;
        
        import flash.display.BitmapData;
@@ -87,6 +89,9 @@
             var g:Graphics = d.graphics;
             g.clear();
             
+            // Just to prevent rendering issues when drawing large bitmaps on 
small nodes:
+            d.cacheAsBitmap = d.props.imageUrl != null;
+            
             if (lineAlpha > 0 && d.lineWidth > 0) {
                 var pixelHinting:Boolean = d.shape === 
NodeShapes.ROUND_RECTANGLE;
                 g.lineStyle(d.lineWidth, d.lineColor, lineAlpha, pixelHinting);
@@ -103,6 +108,13 @@
                 // 2. Draw an image on top:
                 drawImage(d, size);
             }
+            
+            // To prevent gaps between the node and its edges when the node 
has the
+            // border width changed on mouseover or selection
+            NodeSprite(d).visitEdges(function(e:EdgeSprite):Boolean {
+               e.dirty();
+               return false; 
+            }, NodeSprite.GRAPH_LINKS);
         }
         
         // ========[ PRIVATE METHODS 
]==============================================================

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