public final class NodeHalo extends Object
NodeHalo
specifies a rectangular area around a specific node.
A layout algorithm
that supports
NodeHalo
s, keeps this area clear of graph elements, except the node labels of this specific node and the
adjacent segments of its edges. All minimum distances to this node, which are used in the layout calculation, e.g.,
minimum first segment length, will be extended by the halo size.
This class defines a key used for registering a IDataProvider
that provides NodeHalo
s for all nodes of
the input graph. NodeHalo
-aware layout algorithms like HierarchicLayout
look for IDataProvider
s registered with this key to retrieve NodeHalo
information.
The following layouters support NodeHalo
s with different restrictions:
Modifier and Type | Field and Description |
---|---|
double |
bottom
The
NodeHalo size at the bottom side of the node. |
double |
left
The
NodeHalo size at the left side of the node. |
static NodeDpKey<NodeHalo> |
NODE_HALO_DPKEY
A
DataProvider key for assigning halos for the nodes
|
double |
right
The
NodeHalo size at the right side of the node. |
double |
top
The
NodeHalo size at the top side of the node. |
static NodeHalo |
ZERO_HALO
A constant holding a
NodeHalo with zero size on each side. |
Modifier and Type | Method and Description |
---|---|
static NodeHalo |
create(double value)
Creates a
NodeHalo object with the specified value on each side of the node. |
static NodeHalo |
create(double top,
double left,
double bottom,
double right)
Creates a
NodeHalo with the specified values. |
boolean |
equals(Object o) |
static NodeHalo |
getHalo(LayoutGraph graph,
Node node)
Returns the
NodeHalo associated with the given node. |
static YRectangle |
getHaloBox(LayoutGraph graph,
Node node)
Returns a
YRectangle instance with the bounds of the given node including its NodeHalo . |
static boolean |
hasHalos(LayoutGraph graph)
Checks whether or not the given graph contains
NodeHalo information. |
int |
hashCode() |
public final double bottom
NodeHalo
size at the bottom side of the node.public final double left
NodeHalo
size at the left side of the node.public static final NodeDpKey<NodeHalo> NODE_HALO_DPKEY
DataProvider
key for assigning halos for the nodes
public final double right
NodeHalo
size at the right side of the node.public final double top
NodeHalo
size at the top side of the node.public static final NodeHalo create(double value)
NodeHalo
object with the specified value on each side of the node.
The value must not be negative, Double.NaN
or Double.POSITIVE_INFINITY
.
IllegalArgumentException
- if the value is negative, Double.NaN
or Double.POSITIVE_INFINITY
value
- the halo size at each side of the nodeNodeHalo
public static final NodeHalo create(double top, double left, double bottom, double right)
NodeHalo
with the specified values.
The values must not be negative, Double.NaN
or Double.POSITIVE_INFINITY
.
IllegalArgumentException
- if one of the values is negative, Double.NaN
or Double.POSITIVE_INFINITY
top
- the NodeHalo
size at the top side of the nodeleft
- the NodeHalo
size at the left side of the nodebottom
- the NodeHalo
size at the bottom side of the noderight
- the NodeHalo
size at the right side of the nodeNodeHalo
public static final NodeHalo getHalo(LayoutGraph graph, Node node)
public static final YRectangle getHaloBox(LayoutGraph graph, Node node)
YRectangle
instance with the bounds of the given node including its NodeHalo
.
This YRectangle
is located at the position of the node.
If the node does not have a NodeHalo
assigned, this box has the same size as the node.
graph
- the graph containing the given nodenode
- the node whose NodeHalo
will be determinedYRectangle
instance with the bounds of the given node including its NodeHalo
public static final boolean hasHalos(LayoutGraph graph)
NodeHalo
information.
This method looks for a IDataProvider
that has been registered with the given graph using
NODE_HALO_DPKEY
.
graph
- the input graphtrue
if a IDataProvider
has been registered with the according key, false
otherwise