Author: ghuck
Date: 2010-06-25 13:41:40 -0700 (Fri, 25 Jun 2010)
New Revision: 20657
Added:
csplugins/trunk/soc/ghuck/LabelPositioningPlugin/plugin/tests/cytoscape/layout/label/LayoutLabelNodeTest.java.backup
csplugins/trunk/soc/ghuck/LabelPositioningPlugin/plugin/tests/cytoscape/layout/label/LayoutPartitionTest.java.backup
Modified:
csplugins/trunk/soc/ghuck/LabelPositioningPlugin/plugin/src/cytoscape/label/layout/LabelBioLayoutFRAlgorithm.java
csplugins/trunk/soc/ghuck/LabelPositioningPlugin/plugin/src/cytoscape/label/layout/LabelForceDirectedLayout.java
Log:
Modified:
csplugins/trunk/soc/ghuck/LabelPositioningPlugin/plugin/src/cytoscape/label/layout/LabelBioLayoutFRAlgorithm.java
===================================================================
---
csplugins/trunk/soc/ghuck/LabelPositioningPlugin/plugin/src/cytoscape/label/layout/LabelBioLayoutFRAlgorithm.java
2010-06-25 20:41:27 UTC (rev 20656)
+++
csplugins/trunk/soc/ghuck/LabelPositioningPlugin/plugin/src/cytoscape/label/layout/LabelBioLayoutFRAlgorithm.java
2010-06-25 20:41:40 UTC (rev 20657)
@@ -170,7 +170,7 @@
moveNodes,
selectedOnly);
- // logger.info("New partition succesfully created!");
+ logger.info("New partition succesfully created!");
if (canceled)
return;
@@ -182,8 +182,16 @@
}
// Layout the new partition using the parent class layout algorithm
- super.layoutPartition(newPartition);
+ // super.layoutPartition(newPartition);
+ // Move labels to a random position near their parents
+ for(LayoutLabelNodeImpl node: newPartition.getLabelNodes() ) {
+ logger.info("moving label of node " + node.getIdentifier());
+ node.increment(10 * Math.random(), 10 * Math.random());
+ node.moveToLocation();
+ logger.info("label moved!");
+ }
+
// redraw the network so that the new label positions are visible
networkView.updateView();
networkView.redrawGraph(true, true);
Modified:
csplugins/trunk/soc/ghuck/LabelPositioningPlugin/plugin/src/cytoscape/label/layout/LabelForceDirectedLayout.java
===================================================================
---
csplugins/trunk/soc/ghuck/LabelPositioningPlugin/plugin/src/cytoscape/label/layout/LabelForceDirectedLayout.java
2010-06-25 20:41:27 UTC (rev 20656)
+++
csplugins/trunk/soc/ghuck/LabelPositioningPlugin/plugin/src/cytoscape/label/layout/LabelForceDirectedLayout.java
2010-06-25 20:41:40 UTC (rev 20657)
@@ -385,7 +385,7 @@
// Set labelNode's location to parent node's current label position
nodeAtts = Cytoscape.getNodeAttributes();
- String labelPosition = (String) nodeAtts.getAttribute(ln.getNode().
+ String labelPosition = (String)
nodeAtts.getAttribute(ln.getNodeView().getNode().
getIdentifier(), "node.labelPosition");
if (labelPosition == null) {
@@ -419,7 +419,7 @@
labelNode.lock();
ln.lock();
if (!selectedOnly
- || network.getSelectedNodes().contains(ln.getNode())) {
+ ||
network.getSelectedNodes().contains(ln.getNodeView().getNode())) {
labelNode.unLock();
if (moveNodes) {
ln.unLock();
Copied:
csplugins/trunk/soc/ghuck/LabelPositioningPlugin/plugin/tests/cytoscape/layout/label/LayoutLabelNodeTest.java.backup
(from rev 20490,
csplugins/trunk/soc/ghuck/LabelPositioningPlugin/plugin/tests/cytoscape/layout/label/LayoutLabelNodeTest.java)
===================================================================
---
csplugins/trunk/soc/ghuck/LabelPositioningPlugin/plugin/tests/cytoscape/layout/label/LayoutLabelNodeTest.java.backup
(rev 0)
+++
csplugins/trunk/soc/ghuck/LabelPositioningPlugin/plugin/tests/cytoscape/layout/label/LayoutLabelNodeTest.java.backup
2010-06-25 20:41:40 UTC (rev 20657)
@@ -0,0 +1,72 @@
+package cytoscape.layout.label;
+
+import static org.junit.Assert.*;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import cytoscape.data.CyAttributes;
+import cytoscape.visual.LabelPosition;
+import cytoscape.Cytoscape;
+
+import cytoscape.view.*;
+import giny.view.*;
+
+public class LayoutLabelNodeTest extends LayoutAbstractNodeTest {
+
+ LayoutLabelNode node1, node2,node3;
+ LayoutNode parentNode1;
+ CyNodeView nodeView1;
+
+ @Before public void setUp() {
+ node1 = new LayoutLabelNode();
+ node2 = new LayoutLabelNode();
+ // nodeView1 = new CyNodeView();
+ //parentNode1 = new LayoutNode(nodeView1, 1);
+ //node3 = new LayoutLabelNode(parentNode1);
+ }
+
+
+ @Test public void testSetX() {
+ super.testSetX(node1,1.5);
+ super.testSetX(node2,4.0002);
+ }
+
+ @Test public void testSetY() {
+ super.testSetY(node1,1.5);
+ super.testSetY(node2,4.0002);
+ }
+
+ @Test public void testSetLocation() {
+ super.testSetLocation(node1,3.0,7.789);
+ super.testSetLocation(node2,0.0,2.67);
+ }
+
+ @Test public void testDisplacement() {
+ super.testDisplacement(node1, 1.4, 3.6, 5.0, -0.3, 9.3, 12.45);
+ super.testDisplacement(node2, 11.34, 33.0, -5.3, 0.0, 78.12, -123.3);
+ }
+
+ @Test public void testDistance() {
+ super.testDistance(node1, node2, 0.4, -3.5, 2345.2, 234.3);
+ }
+
+ @Test public void testMoveToLocation() {
+// parentNode1.setLocation(1.0,3.5);
+// parentNode1.moveToLocation();
+// node3.setLocation(5.0,8.5);
+// node3.moveToLocation();
+
+// CyAttributes nodeAtts = Cytoscape.getNodeAttributes();
+// String labelPosition = (String)
nodeAtts.getAttribute(parentNode1.getNode().
+// getIdentifier(),
"node.labelPosition");
+
+// assertNotNull(labelPosition);
+
+// LabelPosition lp = LabelPosition.parse(labelPosition);
+
+// assertEquals(lp.getOffsetX(),4.0,EPSILON);
+// assertEquals(lp.getOffsetY(),5.0,EPSILON);
+ }
+
+}
\ No newline at end of file
Copied:
csplugins/trunk/soc/ghuck/LabelPositioningPlugin/plugin/tests/cytoscape/layout/label/LayoutPartitionTest.java.backup
(from rev 20490,
csplugins/trunk/soc/ghuck/LabelPositioningPlugin/plugin/tests/cytoscape/layout/label/LayoutPartitionTest.java)
===================================================================
---
csplugins/trunk/soc/ghuck/LabelPositioningPlugin/plugin/tests/cytoscape/layout/label/LayoutPartitionTest.java.backup
(rev 0)
+++
csplugins/trunk/soc/ghuck/LabelPositioningPlugin/plugin/tests/cytoscape/layout/label/LayoutPartitionTest.java.backup
2010-06-25 20:41:40 UTC (rev 20657)
@@ -0,0 +1,52 @@
+package cytoscape.layout.label;
+
+import static org.junit.Assert.*;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class LayoutPartitionTest {
+
+ Object o;
+
+ /**
+ * Called before each Test is run. This is where you should construct
any
+ * objects or data needed by your tests.
+ */
+ @Before
+ public void setUp() {
+ o = new Object();
+ }
+
+ /**
+ * Called after each Test is run. Often this isn't used, but sometimes
+ * a test will change the state of something that you need to clean up.
+ */
+ @After
+ public void tearDown() {
+ o = null;
+ }
+
+ /**
+ * This is a single test. Any objects or data you need should either be
+ * local to the class (initialized in @Before) or local to this method.
+ */
+ @Test
+ public void testSomething() {
+ assertEquals(2,1+1);
+ }
+
+ /**
+ * This is a separate test. A test class (or test case) can have as
+ * many tests as needed. Test methods should be short and focused on
+ * testing one thing only. It's better to have many short test methods
than
+ * a few long methods. This will help with debugging later on.
+ */
+ @Test
+ public void testSomethingElse() {
+ assertNotNull( o );
+ }
+
+}
+
+
--
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.