Author: ghuck
Date: 2010-08-03 07:42:46 -0700 (Tue, 03 Aug 2010)
New Revision: 21130
Modified:
coreplugins/branches/labelLayout/AutomaticLayout/src/csplugins/layout/algorithms/graphPartition/AbstractGraphPartition.java
Log:
Modified:
coreplugins/branches/labelLayout/AutomaticLayout/src/csplugins/layout/algorithms/graphPartition/AbstractGraphPartition.java
===================================================================
---
coreplugins/branches/labelLayout/AutomaticLayout/src/csplugins/layout/algorithms/graphPartition/AbstractGraphPartition.java
2010-08-03 01:13:49 UTC (rev 21129)
+++
coreplugins/branches/labelLayout/AutomaticLayout/src/csplugins/layout/algorithms/graphPartition/AbstractGraphPartition.java
2010-08-03 14:42:46 UTC (rev 21130)
@@ -37,7 +37,17 @@
import java.awt.Dimension;
+enum LayoutTypes {
+ NODE("Nodes Only"),
+ LABEL("Labels Only"),
+ BOTH("Both Nodes and Labels");
+
+ private String name;
+ private LayoutTypes(String str) { name=str; }
+ public String toString() { return name; }
+}
+
/**
* An abstract class that handles the partitioning of graphs so that
* the partitions will be laid out individually.
@@ -50,22 +60,26 @@
protected CyLogger logger = null;
/**
+ * Which kinf of layout are we going to perform
+ */
+ protected LayoutTypes layoutType = LayoutTypes.NODE;
+
+ /**
* Whether Labels should be repositioned in their default positions
*/
protected boolean resetPosition = false;
/**
- * Whether network nodes will be moved or not
- */
- protected boolean moveNodes = false;
-
- /**
* Coefficient to determine label edge weights
*/
protected double weightCoefficient = 10.0;
+ static LayoutTypes[] layoutChoices = {LayoutTypes.NODE,
+ LayoutTypes.LABEL,
+ LayoutTypes.BOTH};
+
// Information for taskMonitor
double current_start = 0; // Starting node number
double current_size = 0; // Partition size
@@ -289,13 +303,20 @@
*/
protected void layoutSinglePartition(LayoutPartition partition){
- if(supportsLabelLayout()) {
+ if(supportsLabelLayout() && layoutType != LayoutTypes.NODE ) {
Dimension initialLocation = null;
if (canceled)
return;
-
+
+ Boolean moveNodes;
+
+ if (layoutType == LayoutTypes.BOTH)
+ moveNodes = true;
+ else
+ moveNodes = false;
+
// Create new Label partition
LayoutLabelPartition newPartition = new
LayoutLabelPartition(partition,
weightCoefficient,
@@ -351,17 +372,18 @@
public void getLabelTunables(LayoutProperties layoutProperties) {
layoutProperties.add(new Tunable("labels_settings",
- "Label specific settings",
+ "General Layout Settings",
Tunable.GROUP, new Integer(3)));
+ layoutProperties.add(new Tunable("layout_type",
+ "Which elements to layout",
+ Tunable.LIST, new Integer(0),
+ (Object) layoutChoices, (Object) null,
0));
+
layoutProperties.add(new Tunable("resetPosition",
"Reset label positions",
Tunable.BOOLEAN, new
Boolean(resetPosition)));
- layoutProperties.add(new Tunable("moveNodes",
- "Allow nodes to move",
- Tunable.BOOLEAN, new
Boolean(moveNodes)));
-
layoutProperties.add(new Tunable("weightCoefficient",
"weightCoefficient",
Tunable.DOUBLE, new
Double(weightCoefficient)));
@@ -375,14 +397,17 @@
*/
public void updateSettings(LayoutProperties layoutProperties, boolean
force) {
- Tunable t = layoutProperties.get("resetPosition");
+ Tunable t = layoutProperties.get("layout_type");
+ if ((t != null) && (t.valueChanged() || force)) {
+ layoutType = layoutChoices[((Integer) t.getValue()).intValue()];
+// if (t.valueChanged())
+// layoutProperties.setProperty(t.getName(),
t.getValue().toString());
+ }
+
+ t = layoutProperties.get("resetPosition");
if ((t != null) && (t.valueChanged() || force))
resetPosition = ((Boolean) t.getValue()).booleanValue();
- t = layoutProperties.get("moveNodes");
- if ((t != null) && (t.valueChanged() || force))
- moveNodes = ((Boolean) t.getValue()).booleanValue();
-
t = layoutProperties.get("weightCoefficient");
if ((t != null) && (t.valueChanged() || force))
weightCoefficient = ((Double) t.getValue()).doubleValue();
--
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.