Author: ghuck Date: 2010-07-16 08:57:52 -0700 (Fri, 16 Jul 2010) New Revision: 20946
Modified: csplugins/trunk/soc/ghuck/LabelPositioningPlugin/plugin/src/cytoscape/label/layout/LabelBioLayoutFRAlgorithm.java csplugins/trunk/soc/ghuck/LabelPositioningPlugin/plugin/src/cytoscape/label/layout/ModifiedBioLayoutAlgorithm.java csplugins/trunk/soc/ghuck/LabelPositioningPlugin/plugin/src/cytoscape/label/layout/ModifiedBioLayoutFRAlgorithm.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-07-16 02:24:55 UTC (rev 20945) +++ csplugins/trunk/soc/ghuck/LabelPositioningPlugin/plugin/src/cytoscape/label/layout/LabelBioLayoutFRAlgorithm.java 2010-07-16 15:57:52 UTC (rev 20946) @@ -1,4 +1,33 @@ +/** +* Copyright (C) Gerardo Huck, 2010 +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published +* by the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +/** + * This algorithms uses a node layout algorithm as a Label layout one, by creating fake nodes + * (representing the labels). This creation is implemented in the csplugins.layout package, + * and returns a partition which is passed to the previously existing algorithm as an argument + * for the layout. + * + * It was done as part of Google Summer of Code 2010. + * Mentor: Mike Smoot + * @author <a href="mailto:gerardohuck .at. gmail .dot. com">Gerardo Huck</a> + * @version 0.1 + */ package cytoscape.layout.label; import csplugins.layout.LayoutEdge; @@ -178,7 +207,7 @@ selectedOnly, supportWeights); - logger.info("New partition succesfully created!"); + // logger.info("New partition succesfully created!"); // Figure out our starting point - This will be used when: // 1- Laying out labels off all nodes @@ -198,8 +227,8 @@ // Not quite done, yet. We may need to migrate labels back to their starting position // This will be necessary if: // 1- Laying out only selected nodes - // - or- - // 2- (normal) Nodes are not allowed to move + // - and - + // 2- (normal) Nodes are allowed to move if (selectedOnly && moveNodes) { logger.info("moving back labels (and possibly nodes) to their location"); Modified: csplugins/trunk/soc/ghuck/LabelPositioningPlugin/plugin/src/cytoscape/label/layout/ModifiedBioLayoutAlgorithm.java =================================================================== --- csplugins/trunk/soc/ghuck/LabelPositioningPlugin/plugin/src/cytoscape/label/layout/ModifiedBioLayoutAlgorithm.java 2010-07-16 02:24:55 UTC (rev 20945) +++ csplugins/trunk/soc/ghuck/LabelPositioningPlugin/plugin/src/cytoscape/label/layout/ModifiedBioLayoutAlgorithm.java 2010-07-16 15:57:52 UTC (rev 20946) @@ -30,8 +30,12 @@ * */ -package cytoscape.layout.label; +/** + * Copyright (c) 2010 Gerardo Huck + */ +package cytoscape.layout.label; // LABEL + import csplugins.layout.EdgeWeighter; import csplugins.layout.LayoutNode; import csplugins.layout.LayoutPartition; @@ -51,15 +55,20 @@ import javax.swing.JPanel; -// TODO: Change this Javadoc description - /** - * Superclass for the two bioLayout algorithms (KK and FR). + * (Modified) Superclass for the two bioLayout algorithms (KK and FR). + * + * This is a modified version of the BioLayoutAlgorithm class, to be used as + * superclass for the label layout by KK and FR flavors. * + * Changes made are marked with "LABEL" + * + * @author <a href="mailto:gerardohuck .at. gmail .dot. com">Gerardo Huck</a> * @author <a href="mailto:[email protected]">Scooter Morris</a> * @version 0.9 */ -public abstract class ModifiedBioLayoutAlgorithm extends AbstractGraphPartition { + +public abstract class ModifiedBioLayoutAlgorithm extends AbstractGraphPartition { // LABEL /** * Properties */ Modified: csplugins/trunk/soc/ghuck/LabelPositioningPlugin/plugin/src/cytoscape/label/layout/ModifiedBioLayoutFRAlgorithm.java =================================================================== --- csplugins/trunk/soc/ghuck/LabelPositioningPlugin/plugin/src/cytoscape/label/layout/ModifiedBioLayoutFRAlgorithm.java 2010-07-16 02:24:55 UTC (rev 20945) +++ csplugins/trunk/soc/ghuck/LabelPositioningPlugin/plugin/src/cytoscape/label/layout/ModifiedBioLayoutFRAlgorithm.java 2010-07-16 15:57:52 UTC (rev 20946) @@ -1,4 +1,3 @@ -/* vim: set ts=2: */ /** * Copyright (c) 2006 The Regents of the University of California. * All rights reserved. @@ -31,8 +30,12 @@ * */ -package cytoscape.layout.label; +/** + * Copyright (c) 2010 Gerardo Huck + */ +package cytoscape.layout.label; // LABEL + import csplugins.layout.LayoutEdge; import csplugins.layout.LayoutNode; import csplugins.layout.LayoutPartition; @@ -50,8 +53,11 @@ /** - * Lays out the nodes in a graph using a modification of the Fruchterman-Rheingold - * algorithm. + * This is a modified version of the BioLayoutFRAlgorithm class, to be used as + * at laying out labels. (this class is extended by LabelBioLayoutFRAlgorithm) + * + * Lays out the labels (and maybe nodes as well) in a graph using a modification of the + * Fruchterman-Rheingold algorithm. * <p> * The basic layout algorithm follows from the paper: * <em>"Graph Drawing by Force-Directed Placement"</em> @@ -61,10 +67,14 @@ * allows for its use for laying out similarity networks, which are useful * for biological problems. * + * + * Changes made are marked with "LABEL" + * + * @author <a href="mailto:gerardohuck .at. gmail .dot. com">Gerardo Huck</a> * @author <a href="mailto:[email protected]">Scooter Morris</a> * @version 0.9 */ -public abstract class ModifiedBioLayoutFRAlgorithm extends ModifiedBioLayoutAlgorithm { +public abstract class ModifiedBioLayoutFRAlgorithm extends ModifiedBioLayoutAlgorithm { // LABEL /** * Sets the number of iterations for each update */ @@ -74,11 +84,11 @@ * The multipliers and computed result for the * attraction and repulsion values. */ - private double attraction_multiplier = 1.0; + private double attraction_multiplier = 1.0; // LABEL private double attraction_constant; - private double repulsion_multiplier = 0.01; + private double repulsion_multiplier = 0.001; // LABEL private double repulsion_constant; - private double gravity_multiplier = 0.1; + private double gravity_multiplier = 0.0; // LABEL private double gravity_constant; /** @@ -164,13 +174,15 @@ displacementArray = new ArrayList<Double>(100); - // this.initializeProperties(); + // this.initializeProperties(); // LABEL } /** * Required methods (and overrides) for AbstractLayout */ + // LABEL --> + // /** // * Return the "name" of this algorithm. This is meant // * to be used by programs for deciding which algorithm to @@ -198,6 +210,8 @@ // return "(Label Modified) Force-Directed (BioLayout)"; // } +// <-- LABEL + /** * Sets the number of iterations * @@ -425,11 +439,11 @@ Tunable.DOUBLE, new Double(20.0))); // We've now set all of our tunables, so we can read the property // file now and adjust as appropriate - // layoutProperties.initializeProperties(); + // layoutProperties.initializeProperties(); // LABEL // Finally, update everything. We need to do this to update // any of our values based on what we read from the property file - // updateSettings(true); + // updateSettings(true); // LABEL } @@ -548,11 +562,16 @@ temp = Math.sqrt(this.width*this.height) * this.temperature/100; } + +// LABEL --> + // Figure out our starting point // if (selectedOnly) { // initialLocation = partition.getAverageLocation(); // } +// <-- LABEL + // Randomize our points, if any points lie // outside of our bounds if (randomize) @@ -613,6 +632,9 @@ partition.moveNodeToLocation(v); } + +// LABEL --> + // Not quite done, yet. If we're only laying out selected nodes, we need // to migrate the selected nodes back to their starting position // if (selectedOnly) { @@ -630,6 +652,9 @@ // } // } +// <-- LABEL + + logger.info("Layout complete after " + iteration + " iterations"); } @@ -685,7 +710,6 @@ double yDispTotal = 0; // updateProfile.start(); - /// for v in V do begin for (LayoutNode v: partition.getNodeList()) { if (v.isLocked()) continue; @@ -695,8 +719,10 @@ xDispTotal += Math.abs(v.getXDisp()); yDispTotal += Math.abs(v.getYDisp()); } - /// end + +// LABEL --> + // Translate back to the middle (or to the starting point, // if we're dealing with a selected group // if (!selectedOnly) { @@ -705,6 +731,8 @@ // } // } +// <-- LABEL + // updateProfile.checkpoint(); // Test our total x and y displacement to see if we've -- 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.
