Package org.cytoscape.view.layout
Class LayoutNode
java.lang.Object
org.cytoscape.view.layout.LayoutNode
 All Implemented Interfaces:
Comparable<LayoutNode>
The LayoutNode class. This class is used as a container for information
about the nodes in a layout. In particular, it provides a convenient handle
to information about position, the node itself, the node view. Many of
the methods of this class are wrappers for Node or View methods, and
these are often wrapped by LayoutPartition methods.
Cytoscape Backwards Compatibility (Final Class): This class is final and therefore can't 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: layoutapi
To use this in your app, include the following dependency in your POM:
<dependency> <groupId>org.cytoscape</groupId> <artifactId>layoutapi</artifactId> </dependency>

Constructor Summary
ConstructorDescriptionLayoutNode
(View<CyNode> nodeView, int index, CyRow row) The main constructor for a LayoutNode. 
Method Summary
Modifier and TypeMethodDescriptionvoid
Convenience function to keep track of neighbors of this node.int
compareTo
(LayoutNode nodeView) void
decrement
(double x, double y) Decrement the location of this node by (x,y).void
decrement
(double x, double y, double z) Decrement the location of this node by (x,y,z).void
decrementDisp
(double x, double y) Decrement the displacement recorded for this node by (x,y).void
decrementDisp
(double x, double y, double z) Decrement the displacement recorded for this node by (x,y,z).double
distance
(double uX, double uY) Return the Euclidean distance (in 2D) between this node and a location.double
distance
(LayoutNode otherNode) Return the Euclidean distance (in 2D) between this node and another node.double
distance3D
(double uX, double uY, double uZ) Return the Euclidean distance (in 3D) between this node and a location.double
distance3D
(LayoutNode otherNode) Return the Euclidean distance (in 3D) between this node and another node.int
Return the node's degree (i.e.double
getDepth()
Return the height of this nodedouble
Return the height of this nodeReturn the node's identifier.int
getIndex()
Returns the index of this LayoutNode.Convenience function to return the list of neighbors (connected nodes) of this node.getNode()
Accessor function to return the Node associated with this LayoutNode.Accessor function to return the Viewassociated with this LayoutNode. getRow()
Accessor function to return the CyRow associated with this LayoutNode.double
getWidth()
Return the width of this nodedouble
getX()
Return the current X value for this LayoutNode.double
getXDisp()
Return the current X displacement value for this LayoutNode.double
getY()
Return the current Y value for this LayoutNode.double
getYDisp()
Return the current Y displacement value for this LayoutNode.double
getZ()
Return the current Z value for this LayoutNode.double
getZDisp()
Return the current Z displacement value for this LayoutNode.void
increment
(double x, double y) Increment the location of this node by (x,y).void
increment
(double x, double y, double z) Increment the location of this node by (x,y,z).void
incrementDisp
(double x, double y) Increment the displacement recorded for this node by (x,y).void
incrementDisp
(double x, double y, double z) Increment the displacement recorded for this node by (x,y,z).boolean
isLocked()
Returns "true" if this node is locked, false otherwise.void
lock()
Register this node as being "locked".void
Move the node to its current x,y coordinate (ignores the value of the z coordinate).void
Move the node to its current x,y,z coordinate.Return a string representation of the node's displacementReturn a string representation of the node's locationvoid
setDisp
(double x, double y) Set the 2D displacement of this LayoutNode.void
setDisp
(double x, double y, double z) Set the 3D displacement of this LayoutNode.void
setLocation
(double x, double y) Set the 2D location of this LayoutNode.void
setLocation
(double x, double y, double z) Set the 3D location of this LayoutNode.void
setX
(double x) Set the X location of this LayoutNode.void
setY
(double y) Set the Y location of this LayoutNode.void
setZ
(double z) Set the Z location of this LayoutNode.toString()
Return a string representation of the nodevoid
unLock()
Register this node as being "unlocked".

Constructor Details

LayoutNode
The main constructor for a LayoutNode. Parameters:
nodeView
 The Viewof this node index
 The index (usually in a node array) of this node


Method Details

getNode
Accessor function to return the Node associated with this LayoutNode. Returns:
 Node that is associated with this LayoutNode

getRow
Accessor function to return the CyRow associated with this LayoutNode. Returns:
 CyRow that is associated with this LayoutNode

getNodeView
Accessor function to return the Viewassociated with this LayoutNode.  Returns:
 View
that is associated with this LayoutNode

setLocation
public void setLocation(double x, double y) Set the 2D location of this LayoutNode. Note that this only sets the location  it does not actually move the node to that location. Users should call moveToLocation to actually accomplish the move. Parameters:
x
 Double representing the new X coordinate of this nodey
 Double representing the new Y coordinate of this node

setLocation
public void setLocation(double x, double y, double z) Set the 3D location of this LayoutNode. Note that this only sets the location  it does not actually move the node to that location. Users should call moveToLocation to actually accomplish the move. Parameters:
x
 Double representing the new X coordinate of this nodey
 Double representing the new Y coordinate of this nodez
 Double representing the new Z coordinate of this node

setX
public void setX(double x) Set the X location of this LayoutNode. Note that this only sets the location  it does not actually move the node to that location. Users should call moveToLocation to actually accomplish the move. Parameters:
x
 Double representing the new X coordinate of this node

setY
public void setY(double y) Set the Y location of this LayoutNode. Note that this only sets the location  it does not actually move the node to that location. Users should call moveToLocation to actually accomplish the move. Parameters:
y
 Double representing the new Y coordinate of this node

setZ
public void setZ(double z) Set the Z location of this LayoutNode. Note that this only sets the location  it does not actually move the node to that location. Users should call moveToLocation to actually accomplish the move. Parameters:
z
 Double representing the new Z coordinate of this node

setDisp
public void setDisp(double x, double y) Set the 2D displacement of this LayoutNode. The displacement is a little different than the location in that it records an offset from the current location. This is useful for algorithms such as Kamada Kawai and Fructerman Rheingold, which update positions iteratively. Parameters:
x
 Double representing the amount to offset in the x directiony
 Double representing the amount to offset in the y direction

setDisp
public void setDisp(double x, double y, double z) Set the 3D displacement of this LayoutNode. The displacement is a little different than the location in that it records an offset from the current location. This is useful for algorithms such as Kamada Kawai and Fructerman Rheingold, which update positions iteratively. Parameters:
x
 Double representing the amount to offset in the x directiony
 Double representing the amount to offset in the y directionz
 Double representing the amount to offset in the y direction

addNeighbor
Convenience function to keep track of neighbors of this node. This can be used to improve the performance of algorithms that try to determine the edge partners of nodes. Parameters:
v
 LayoutNode that is a neighbor of this LayoutNode

getNeighbors
Convenience function to return the list of neighbors (connected nodes) of this node. Returns:
 List of all of the neighbors (nodes with shared edges) of this node.

getIndex
public int getIndex()Returns the index of this LayoutNode. This is not the same as the rootGraphIndex of the node. Its primarily used by LayoutPartition to keep track of the offset in the node array that holds this LayoutNode. Returns:
 The index of this node
 See Also:

lock
public void lock()Register this node as being "locked". Locked nodes are exempt from being moved during layout. Usually, these are the unselected nodes when a selectedonly layout is being executed. 
unLock
public void unLock()Register this node as being "unlocked". Locked nodes are exempt from being moved during layout. Usually, these are the unselected nodes when a selectedonly layout is being executed. The "unlocked" state is the default. 
isLocked
public boolean isLocked()Returns "true" if this node is locked, false otherwise. Returns:
 true if locked, false if unlocked.

incrementDisp
public void incrementDisp(double x, double y) Increment the displacement recorded for this node by (x,y). Parameters:
x
 the additional amount to displace in the x directiony
 the additional amount to displace in the y direction

incrementDisp
public void incrementDisp(double x, double y, double z) Increment the displacement recorded for this node by (x,y,z). Parameters:
x
 the additional amount to displace in the x directiony
 the additional amount to displace in the y directionz
 the additional amount to displace in the z direction

increment
public void increment(double x, double y) Increment the location of this node by (x,y). Note that location values are merely recorded until moveToLocation is called. Parameters:
x
 the amount to move in the x directiony
 the amount to move in the y direction

increment
public void increment(double x, double y, double z) Increment the location of this node by (x,y,z). Note that location values are merely recorded until moveToLocation is called. Parameters:
x
 the amount to move in the x directiony
 the amount to move in the y directionz
 the amount to move in the z direction

decrementDisp
public void decrementDisp(double x, double y) Decrement the displacement recorded for this node by (x,y). Parameters:
x
 the additional amount to displace in the x directiony
 the additional amount to displace in the y direction

decrementDisp
public void decrementDisp(double x, double y, double z) Decrement the displacement recorded for this node by (x,y,z). Parameters:
x
 the additional amount to displace in the x directiony
 the additional amount to displace in the y directionz
 the additional amount to displace in the z direction

decrement
public void decrement(double x, double y) Decrement the location of this node by (x,y). Note that location values are merely recorded until moveToLocation is called. Parameters:
x
 the amount to move in the x directiony
 the amount to move in the y direction

decrement
public void decrement(double x, double y, double z) Decrement the location of this node by (x,y,z). Note that location values are merely recorded until moveToLocation is called. Parameters:
x
 the amount to move in the x directiony
 the amount to move in the y directionz
 the amount to move in the z direction

getX
public double getX()Return the current X value for this LayoutNode. Returns:
 current X value

getY
public double getY()Return the current Y value for this LayoutNode. Returns:
 current Y value

getZ
public double getZ()Return the current Z value for this LayoutNode. Returns:
 current Z value

getXDisp
public double getXDisp()Return the current X displacement value for this LayoutNode. Returns:
 current X displacement value

getYDisp
public double getYDisp()Return the current Y displacement value for this LayoutNode. Returns:
 current Y displacement value

getZDisp
public double getZDisp()Return the current Z displacement value for this LayoutNode. Returns:
 current Z displacement value

getWidth
public double getWidth()Return the width of this node Returns:
 width of this node

getHeight
public double getHeight()Return the height of this node Returns:
 height of this node

getDepth
public double getDepth()Return the height of this node Returns:
 height of this node

distance
Return the Euclidean distance (in 2D) between this node and another node. This method only considers the X and Y coordinates of the nodes. Parameters:
otherNode
 the node to measure the distance to Returns:
 the Euclidean distance from this node to otherNode

distance3D
Return the Euclidean distance (in 3D) between this node and another node. This method considers the X, Y and Z coordinates of the nodes. Parameters:
otherNode
 the node to measure the distance to Returns:
 the Euclidean distance from this node to otherNode

distance
public double distance(double uX, double uY) Return the Euclidean distance (in 2D) between this node and a location. This method only considers the X and Y coordinates of the nodes. Parameters:
uX
 the X location to measure the distance touY
 the Y location to measure the distance to Returns:
 the Euclidean distance from this node to (uX,uY)

distance3D
public double distance3D(double uX, double uY, double uZ) Return the Euclidean distance (in 3D) between this node and a location. This method considers the X, Y and Z coordinates of the nodes. Parameters:
uX
 the X location to measure the distance touY
 the Y location to measure the distance touZ
 the Z location to measure the distance to Returns:
 the Euclidean distance from this node to (uX,uY,uZ)

moveToLocation
public void moveToLocation()Move the node to its current x,y coordinate (ignores the value of the z coordinate). 
moveToLocation3D
public void moveToLocation3D()Move the node to its current x,y,z coordinate. 
getIdentifier
Return the node's identifier. Returns:
 String containing the node's identifier

getDegree
public int getDegree()Return the node's degree (i.e. number of nodes it's connected to). Returns:
 Degree of this node

toString
Return a string representation of the node 
printDisp
Return a string representation of the node's displacement Returns:
 String containing the node's X,Y displacement

printLocation
Return a string representation of the node's location Returns:
 String containing the node's X,Y location

compareTo
 Specified by:
compareTo
in interfaceComparable<LayoutNode>
