Author: ghuck
Date: 2011-06-28 19:49:11 -0700 (Tue, 28 Jun 2011)
New Revision: 25972
Modified:
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/igraph/layouts/AbstractIgraphLayout.java
Log:
Now layouts are able to feed the initial location of nodes to igraph
Modified:
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/igraph/layouts/AbstractIgraphLayout.java
===================================================================
---
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/igraph/layouts/AbstractIgraphLayout.java
2011-06-29 00:27:02 UTC (rev 25971)
+++
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/igraph/layouts/AbstractIgraphLayout.java
2011-06-29 02:49:11 UTC (rev 25972)
@@ -28,6 +28,7 @@
import cytoscape.logger.CyLogger;
import cytoscape.view.CyNetworkView;
+import cytoscape.view.CyNodeView;
import cytoscape.data.CyAttributes;
import csplugins.layout.LayoutPartition;
@@ -43,7 +44,9 @@
import java.awt.GridLayout;
import java.util.*;
+import giny.view.*;
+
public abstract class AbstractIgraphLayout extends AbstractGraphPartition {
private String message;
@@ -174,7 +177,7 @@
initialLocation = part.getAverageLocation();
}
- // Get the number of edges and nodes
+ // Get the number of nodes
int numNodes = part.nodeCount();
// Allocate memory for storing graph edges information (to be used as
arguments for JNI call)
@@ -184,6 +187,9 @@
// Load graph into native library
HashMap<Integer,Integer> mapping = loadGraphPartition(part,
selectedOnly);
+ // Store current node positions
+ loadPositions(part, mapping, x, y);
+
// Check whether it has been canceled by the user
if (canceled)
return;
@@ -400,5 +406,20 @@
return nodeIdMapping;
} // loadGraphPartition()
+
+ // Store current node positions
+ public void loadPositions(LayoutPartition part, HashMap<Integer,Integer>
mapping, double[] x, double[] y){
+ Iterator<LayoutNode> iterator = part.getNodeList().iterator();
+ while (iterator.hasNext()){
+ // Get next node
+ LayoutNode node = (LayoutNode) iterator.next();
+
+ if (!selectedOnly || !node.isLocked()) {
+ x[mapping.get(node.getIndex())] = node.getX();
+ y[mapping.get(node.getIndex())] = node.getY();
+ }
+ }
+ }
+
}
--
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.