Author: ghuck
Date: 2009-07-31 07:54:51 -0700 (Fri, 31 Jul 2009)
New Revision: 17633

Modified:
   csplugins/trunk/soc/ghuck/plugin/src/ForceDirected.java
Log:
Added tunable with desired node size value.



Modified: csplugins/trunk/soc/ghuck/plugin/src/ForceDirected.java
===================================================================
--- csplugins/trunk/soc/ghuck/plugin/src/ForceDirected.java     2009-07-30 
22:41:16 UTC (rev 17632)
+++ csplugins/trunk/soc/ghuck/plugin/src/ForceDirected.java     2009-07-31 
14:54:51 UTC (rev 17633)
@@ -30,7 +30,10 @@
 import cytoscape.layout.Tunable;
 import cytoscape.CyNode;
 import cytoscape.logger.CyLogger;
+import cytoscape.visual.Appearance;
+import cytoscape.visual.VisualPropertyType;
 
+
 import giny.model.GraphPerspective;
 import giny.model.Node;
 
@@ -74,6 +77,8 @@
 
     private String CUDA_PATH = "/usr/local/cuda/lib";
 
+    private double nodeSize = 2.0;
+
     private LayoutProperties layoutProperties;
 
 
@@ -115,7 +120,8 @@
 
        layoutProperties.add(new Tunable("CUDA_PATH", "CUDA instalation 
folder", Tunable.STRING , new String("/usr/local/cuda")));
        
-       
+       layoutProperties.add(new Tunable("nodeSize", "Final node size", 
Tunable.DOUBLE , new Double(2.0)));
+
        // Initialize layout properties
        layoutProperties.initializeProperties();
        
@@ -182,7 +188,12 @@
        if ((t6 != null) && (t6.valueChanged() || force))
            CUDA_PATH =  t6.getValue().toString();
 
+       // Get initialNoIterations
+       Tunable t7 = layoutProperties.get("nodeSize");
+       if ((t7 != null) && (t7.valueChanged() || force))
+           nodeSize  = ((Double) t7.getValue()).doubleValue();
 
+
        
        // Show message on screen    
        /*
@@ -192,7 +203,8 @@
          + levelConvergence + "\n"         
          + edgeLen + "\n"                  
          + initialNoIterations + "\n"
-         + CUDA_PATH;
+         + CUDA_PATH + "\n"
+         + nodeSize;
          
          JOptionPane.showMessageDialog( Cytoscape.getDesktop(), message);
        */
@@ -388,6 +400,11 @@
        // Create an iterator for processing the nodes
        Iterator<LayoutNode> iterator2 = nodeList.iterator();
 
+       // Creates the appearance that we want to apply to nodes
+       Appearance appearance = new Appearance();
+
+       appearance.set(VisualPropertyType.NODE_SIZE, nodeSize);
+
        while (iterator2.hasNext()){
            
            // Get next node
@@ -400,6 +417,9 @@
            // Move node to desired location
            part.moveNodeToLocation(node);
 
+           // Change node's size
+           appearance.applyAppearance(node.getNodeView());
+
            currentNode++;
        }
        


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