Search in sources :

Example 6 with LNode

use of org.ivis.layout.LNode in project cytoscape-impl by cytoscape.

the class CoSELayoutAlgorithmTask method createLNode.

private LNode createLNode(final LayoutNode layoutNode, final LGraph graph, final CoSELayout cose, final Map<CyNode, LNode> lNodeMap) {
    final VNode vn = new VNode(layoutNode);
    final LNode ln = graph.add(cose.newNode(vn));
    ln.setCenter(layoutNode.getX(), layoutNode.getY());
    ln.setWidth(layoutNode.getWidth());
    ln.setHeight(layoutNode.getHeight());
    lNodeMap.put(layoutNode.getNode(), ln);
    return ln;
}
Also used : LNode(org.ivis.layout.LNode)

Example 7 with LNode

use of org.ivis.layout.LNode in project cytoscape-impl by cytoscape.

the class CoSELayoutAlgorithmTask method traverseLNodeTree.

private void traverseLNodeTree(final LayoutNode layoutNode, final LGraph graph, final CoSELayout cose, final Map<CyNode, LNode> lNodeMap, final Map<CyNode, LayoutNode> layoutNodeMap, final CyGroupManager groupManager) {
    if (lNodeMap.containsKey(layoutNode.getNode()))
        // This node has already been visited!
        return;
    final LNode ln = createLNode(layoutNode, graph, cose, lNodeMap);
    if (groupManager.isGroup(layoutNode.getNode(), networkView.getModel())) {
        final CyGroup group = groupManager.getGroup(layoutNode.getNode(), networkView.getModel());
        if (group != null) {
            final LGraphManager gm = cose.getGraphManager();
            final LGraph subGraph = gm.add(cose.newGraph("G" + group.getGroupNetwork().getSUID()), ln);
            for (CyNode childNode : group.getNodeList()) {
                final LayoutNode childLayoutNode = layoutNodeMap.get(childNode);
                if (childLayoutNode != null)
                    traverseLNodeTree(childLayoutNode, subGraph, cose, lNodeMap, layoutNodeMap, groupManager);
            }
        }
    }
}
Also used : CyGroup(org.cytoscape.group.CyGroup) LayoutNode(org.cytoscape.view.layout.LayoutNode) LGraphManager(org.ivis.layout.LGraphManager) LNode(org.ivis.layout.LNode) CyNode(org.cytoscape.model.CyNode) LGraph(org.ivis.layout.LGraph)

Aggregations

LNode (org.ivis.layout.LNode)7 CyNode (org.cytoscape.model.CyNode)2 LayoutNode (org.cytoscape.view.layout.LayoutNode)2 LEdge (org.ivis.layout.LEdge)2 LGraph (org.ivis.layout.LGraph)2 LGraphManager (org.ivis.layout.LGraphManager)2 HashMap (java.util.HashMap)1 CyGroup (org.cytoscape.group.CyGroup)1 CyGroupManager (org.cytoscape.group.CyGroupManager)1 CyEdge (org.cytoscape.model.CyEdge)1 CyNetwork (org.cytoscape.model.CyNetwork)1 LayoutEdge (org.cytoscape.view.layout.LayoutEdge)1 ProgressListener (org.ivis.layout.ProgressListener)1 CoSELayout (org.ivis.layout.cose.CoSELayout)1 RectangleD (org.ivis.util.RectangleD)1