Package org.cytoscape.view.layout
Class AbstractPartitionLayoutTask
java.lang.Object
org.cytoscape.work.AbstractTask
org.cytoscape.view.layout.AbstractLayoutTask
org.cytoscape.view.layout.AbstractPartitionLayoutTask
- All Implemented Interfaces:
Task
- Direct Known Subclasses:
AbstractParallelPartitionLayoutTask
This is a more helpful implementation of a LayoutAlgorithm Task
that extends AbstractBasicLayoutTask and does the work of partitioning
the CyNetworkView so that partitions may be laid out individually.
Extensions of this class are meant to implement the layoutPartition()
method and operate on the LayoutParition object that is passed to that
method as an argument.
Cytoscape Backwards Compatibility (Abstract Class): This class is abstract and meant to be extended by users. This means that we may add methods for minor version updates. Methods will only be removed for major version updates.
Module: layout-api
To use this in your app, include the following dependency in your POM:
<dependency> <groupId>org.cytoscape</groupId> <artifactId>layout-api</artifactId> </dependency>
-
Field Summary
Modifier and TypeFieldDescriptionprotected double
Partition size used for taskMonitor.protected double
Starting node number used for taskMonitor.protected EdgeWeighter
The EdgeWeighter used for edge weight calculations.protected double
The value used for spacing nodes.protected static org.slf4j.Logger
protected List<LayoutPartition>
The list of LayoutPartition objects that get laid out.protected TaskMonitor
The TaskMonitor initially set in the run method of the task.protected double
Total number of nodes used for taskMonitor.Fields inherited from class org.cytoscape.view.layout.AbstractLayoutTask
LAYOUT_ALGORITHM, layoutAttribute, networkView, nodesToLayOut, recenter, undo
Fields inherited from class org.cytoscape.work.AbstractTask
cancelled
-
Constructor Summary
ConstructorDescriptionAbstractPartitionLayoutTask(String displayName, boolean singlePartition, CyNetworkView networkView, Set<View<CyNode>> nodesToLayOut, String layoutAttribute, UndoSupport undo)
Creates a new AbstractPartitionLayoutTask object. -
Method Summary
Modifier and TypeMethodDescriptionprotected double
calculate_max_dimension(double width, double height, double screen_width, double screen_height, List<LayoutPartition> partitionList)
void
doLayout(TaskMonitor taskMonitor)
AbstractGraphPartitionLayout implements the doLayout method of AbstractBasicLayout in which it calls the layoutParition method on each LayoutPartition object created for the network.abstract void
layoutPartition(LayoutPartition partition)
Override this method and layout the LayoutPartion just like you would a NetworkView.protected void
setTaskStatus(int percent)
Used forMethods inherited from class org.cytoscape.view.layout.AbstractLayoutTask
run
Methods inherited from class org.cytoscape.work.AbstractTask
cancel, getTaskIterator, insertTasksAfterCurrentTask, insertTasksAfterCurrentTask, setTaskIterator
-
Field Details
-
logger
protected static org.slf4j.Logger logger -
taskMonitor
The TaskMonitor initially set in the run method of the task. Used to track the layout progress. -
incr
protected double incrThe value used for spacing nodes. Defaults to 100. -
partitionList
The list of LayoutPartition objects that get laid out. -
edgeWeighter
The EdgeWeighter used for edge weight calculations. -
current_start
protected double current_startStarting node number used for taskMonitor. -
current_size
protected double current_sizePartition size used for taskMonitor. -
total_nodes
protected double total_nodesTotal number of nodes used for taskMonitor.
-
-
Constructor Details
-
AbstractPartitionLayoutTask
public AbstractPartitionLayoutTask(String displayName, boolean singlePartition, CyNetworkView networkView, Set<View<CyNode>> nodesToLayOut, String layoutAttribute, UndoSupport undo)Creates a new AbstractPartitionLayoutTask object.- Parameters:
name
- The name of the layout algorithm.singlePartition
- Whether this layout algorithm should execute on a single partition instead of multiple partitions.networkView
- the CyNetworkView being partitioned.nodesToLayOut
- the set of nodes to layout.layoutAttribute
- the name of the attribute to use for this layout. Allowed to be empty or null.
-
-
Method Details
-
layoutPartition
Override this method and layout the LayoutPartion just like you would a NetworkView.- Parameters:
partition
- The LayoutPartition to be laid out.
-
setTaskStatus
protected void setTaskStatus(int percent)Used for- Parameters:
percent
- The percentage of completion for this partition. Value must be between 0 and 100.
-
doLayout
AbstractGraphPartitionLayout implements the doLayout method of AbstractBasicLayout in which it calls the layoutParition method on each LayoutPartition object created for the network.- Specified by:
doLayout
in classAbstractLayoutTask
- Parameters:
taskMonitor
- the TaskMonitor provided by the run() method of the Task.
-
calculate_max_dimension
protected double calculate_max_dimension(double width, double height, double screen_width, double screen_height, List<LayoutPartition> partitionList)
-