Author: ghuck
Date: 2011-07-26 06:48:18 -0700 (Tue, 26 Jul 2011)
New Revision: 26266
Modified:
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/igraph/MinimumSpanningTreeUnweighted.java
csplugins/trunk/soc/ghuck/IgraphPlugin/src/igraphWrapper/igraphJNA.cpp
Log:
Unweighted MST working OK
Modified:
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/igraph/MinimumSpanningTreeUnweighted.java
===================================================================
---
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/igraph/MinimumSpanningTreeUnweighted.java
2011-07-26 00:16:28 UTC (rev 26265)
+++
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/igraph/MinimumSpanningTreeUnweighted.java
2011-07-26 13:48:18 UTC (rev 26266)
@@ -29,9 +29,12 @@
import cytoscape.plugin.CytoscapePlugin;
import cytoscape.util.CytoscapeAction;
import cytoscape.logger.CyLogger;
-
import giny.model.*;
+import giny.view.NodeView;
+import cytoscape.view.CyNodeView;
+import cytoscape.view.CyNetworkView;
+
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.Platform;
@@ -77,6 +80,7 @@
logger.info("Nodes: "+ nodesString);
/* Create new network & networkView */
+ CyNetworkView oldView = Cytoscape.getCurrentNetworkView();
// Prepare nodes
int[] nodes = new int[numNodes];
@@ -175,8 +179,31 @@
/* Set node positions */
+ CyNetworkView newView = Cytoscape.getCurrentNetworkView();
+ Iterator<Node> newNodesIt = newNetwork.nodesIterator();
+ while(newNodesIt.hasNext()){
+ Node node = newNodesIt.next();
+ NodeView newNodeView = newView.getNodeView(node);
+ NodeView oldNodeView = oldView.getNodeView(node);
+
+ //oldNodeView.;
+
+ // Set X and Y positions
+ newNodeView.setXPosition(oldNodeView.getXPosition());
+ newNodeView.setYPosition(oldNodeView.getYPosition());
+
+ // Set label position
+ newNodeView.setLabelPosition(oldNodeView.getLabelPosition());
+ }
+
+ // Redraw the whole network
+ newView.updateView();
+ newView.redrawGraph(true, true);
+ newView.fitContent();
+
+
} catch (Exception ex) {
ex.printStackTrace();
String message = "Error:\n" + ex.getMessage();
Modified: csplugins/trunk/soc/ghuck/IgraphPlugin/src/igraphWrapper/igraphJNA.cpp
===================================================================
--- csplugins/trunk/soc/ghuck/IgraphPlugin/src/igraphWrapper/igraphJNA.cpp
2011-07-26 00:16:28 UTC (rev 26265)
+++ csplugins/trunk/soc/ghuck/IgraphPlugin/src/igraphWrapper/igraphJNA.cpp
2011-07-26 13:48:18 UTC (rev 26266)
@@ -44,7 +44,7 @@
igraph_create(&g, &v, 0, directed);
existsGraph = 1;
- printf("Graph created! Number of nodes: %d\n", nodeCount());
+ // printf("Graph created! Number of nodes: %d\n", nodeCount());
// Free resources no longer needed
igraph_vector_destroy(&v);
@@ -189,7 +189,8 @@
// Copy results
int e = igraph_ecount(&mst);
- printf("Number of edges in MST: %d\n", e);
+
+ // printf("Number of edges in MST: %d\n", e);
for(int i = 0; i < e ; i++) {
igraph_edge(&mst, i, &from, &to);
--
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.