public final class LayoutPartition extends Object
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>
Constructor and Description |
---|
LayoutPartition(CyNetworkView networkView,
Collection<View<CyNode>> nodeSet,
EdgeWeighter edgeWeighter)
LayoutPartition: use this constructor to create a LayoutPartition that
includes the entire network.
|
LayoutPartition(int nodeCount,
int edgeCount)
LayoutPartition: use this constructor to create an empty LayoutPartition.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addEdge(CyEdge edge,
CyRow row)
Add an edge to this partition assuming that the source and target
nodes are not yet known.
|
protected void |
addEdge(CyEdge edge,
LayoutNode v1,
LayoutNode v2,
CyRow row)
Add an edge to this partition assuming that the source and target
nodes are known.
|
protected void |
addNode(CyNetwork network,
View<CyNode> nv,
boolean locked)
Add a node to this partition.
|
void |
calculateEdgeWeights()
Calculate and set the edge weights.
|
int |
edgeCount()
Return the number of edges in this partition
|
Iterator<LayoutEdge> |
edgeIterator()
Return an iterator over all of the LayoutEdges in this partition
|
void |
fixEdges()
Convenience routine to update the source and target for all of the
edges in a partition.
|
LayoutPoint |
getAverageLocation()
Return the average location of the nodes in this partition
|
double |
getDepth()
Return the total depth of all of the LayoutNodes
|
List<LayoutEdge> |
getEdgeList()
Return the list of LayoutEdges within this partition.
|
double |
getHeight()
Return the total height of all of the LayoutNodes
|
double |
getMaxX()
Return the maximum X location of all of the LayoutNodes
|
double |
getMaxY()
Return the maximum Y location of all of the LayoutNodes
|
double |
getMaxZ()
Return the maximum Z location of all of the LayoutNodes
|
double |
getMinX()
Return the minimum X location of all of the LayoutNodes
|
double |
getMinY()
Return the minimum Y location of all of the LayoutNodes
|
double |
getMinZ()
Return the minimum Z location of all of the LayoutNodes
|
List<LayoutNode> |
getNodeList()
Return the list of LayoutNodes within this partition.
|
int |
getPartitionNumber()
Return the partition number of this partition
|
double |
getWidth()
Return the total width of all of the LayoutNodes
|
int |
lockedNodeCount()
Return the number of locked nodes within this partition
|
void |
moveNodeToLocation(LayoutNode node)
Move the node to its current X and Y values.
|
void |
moveNodeToLocation3D(LayoutNode node)
Move the node to its current X, Y and Z values.
|
int |
nodeCount()
Return the number of nodes in this partition
|
Iterator<LayoutNode> |
nodeIterator()
Return an iterator over all of the LayoutNodes in this partition
|
void |
offset(double xoffset,
double yoffset)
Offset all of the nodes in the partition by a fixed
amount.
|
void |
offset(double xoffset,
double yoffset,
double zoffset)
Offset all of the nodes in the partition by a fixed
amount.
|
void |
randomizeLocations()
Randomize the graph locations (ignoring Z values).
|
void |
randomizeLocations(boolean is3D)
Randomize the graph locations.
|
void |
resetNodes()
Reset all of the data maintained for the LayoutNodes
contained within this partition, including the min, max
and average x and y values.
|
void |
setEdgeWeighter(EdgeWeighter edgeWeighter)
Set the EdgeWeighter to use for this partition.
|
void |
setPartitionNumber(int part)
Set the partition number of this partition
|
int |
size()
Return the size of this partition, which is defined as the number of
nodes that it contains.
|
public LayoutPartition(int nodeCount, int edgeCount)
nodeCount
- The number of nodes in the new partition.edgeCount
- The number of edges in the new partition.public LayoutPartition(CyNetworkView networkView, Collection<View<CyNode>> nodeSet, EdgeWeighter edgeWeighter)
networkView
- the CyNetworkView to usenodeSet
- the nodes to be considerededgeWeighter
- the weighter to use for edge weightingpublic void setEdgeWeighter(EdgeWeighter edgeWeighter)
edgeWeighter
- the weighter to use for edge weightingprotected void addNode(CyNetwork network, View<CyNode> nv, boolean locked)
nv
- the Viewlocked
- a boolean value to determine if this node is locked or notprotected void addEdge(CyEdge edge, CyRow row)
edge
- the Edge to add to the partitionprotected void addEdge(CyEdge edge, LayoutNode v1, LayoutNode v2, CyRow row)
edge
- the Edge to add to the partitionv1
- the LayoutNode of the edge sourcev2
- the LayoutNode of the edge targetpublic void randomizeLocations(boolean is3D)
is3D
- ignores Z values if falsepublic void randomizeLocations()
public void moveNodeToLocation(LayoutNode node)
node
- the LayoutNode to movepublic void moveNodeToLocation3D(LayoutNode node)
node
- the LayoutNode to movepublic void fixEdges()
public void calculateEdgeWeights()
public int size()
public List<LayoutNode> getNodeList()
LayoutNode
public List<LayoutEdge> getEdgeList()
LayoutEdge
public Iterator<LayoutNode> nodeIterator()
LayoutNode
public Iterator<LayoutEdge> edgeIterator()
LayoutEdge
public int nodeCount()
public int edgeCount()
public double getMaxX()
public double getMaxY()
public double getMaxZ()
public double getMinX()
public double getMinY()
public double getMinZ()
public double getWidth()
public double getHeight()
public double getDepth()
public int getPartitionNumber()
public void setPartitionNumber(int part)
part
- partition numberpublic int lockedNodeCount()
public LayoutPoint getAverageLocation()
public void offset(double xoffset, double yoffset)
xoffset
- the amount to offset in the X directionyoffset
- the amount to offset in the Y directionpublic void offset(double xoffset, double yoffset, double zoffset)
xoffset
- the amount to offset in the X directionyoffset
- the amount to offset in the Y directionpublic void resetNodes()
Copyright 2011-2015 Cytoscape Consortium. All rights reserved.