Search in sources :

Example 1 with CyLayoutAlgorithm

use of org.cytoscape.view.layout.CyLayoutAlgorithm in project EnrichmentMapApp by BaderLab.

the class CreateEMViewTask method visualizeMap.

private void visualizeMap() {
    CyNetwork network = networkManager.getNetwork(map.getNetworkID());
    CyNetworkView view = networkViewFactory.createNetworkView(network);
    networkViewManager.addNetworkView(view);
    //apply force directed layout
    CyLayoutAlgorithm layout = layoutManager.getLayout("force-directed");
    if (layout == null)
        layout = layoutManager.getDefaultLayout();
    Task styleTask = applyStyleTaskFactory.create(new EMStyleOptions(view, map), null, false);
    TaskIterator layoutTasks = layout.createTaskIterator(view, layout.createLayoutContext(), CyLayoutAlgorithm.ALL_NODE_VIEWS, null);
    TaskIterator moreTasks = new TaskIterator();
    moreTasks.append(styleTask);
    moreTasks.append(layoutTasks);
    insertTasksAfterCurrentTask(moreTasks);
}
Also used : EMStyleOptions(org.baderlab.csplugins.enrichmentmap.style.EMStyleOptions) Task(org.cytoscape.work.Task) AbstractTask(org.cytoscape.work.AbstractTask) TaskIterator(org.cytoscape.work.TaskIterator) CyLayoutAlgorithm(org.cytoscape.view.layout.CyLayoutAlgorithm) CyNetwork(org.cytoscape.model.CyNetwork) CyNetworkView(org.cytoscape.view.model.CyNetworkView)

Aggregations

EMStyleOptions (org.baderlab.csplugins.enrichmentmap.style.EMStyleOptions)1 CyNetwork (org.cytoscape.model.CyNetwork)1 CyLayoutAlgorithm (org.cytoscape.view.layout.CyLayoutAlgorithm)1 CyNetworkView (org.cytoscape.view.model.CyNetworkView)1 AbstractTask (org.cytoscape.work.AbstractTask)1 Task (org.cytoscape.work.Task)1 TaskIterator (org.cytoscape.work.TaskIterator)1