|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.PortCandidate
public class PortCandidate
This class represents a candidate port on which edges can be connected to their source and/or target node.
The notion of PortCandidate
s extends the one of PortConstraint
s. In contrast to
PortConstraint
s, they can be associated with both edges and nodes. Moreover, more than one
PortCandidate
can be specified for an edge or a node.
Edge PortCandidate
s can be introduced to define specific sides or exact locations on which a given edge can
be connected to its source or target node.
Information about edge PortCandidate
s is held by DataProvider
s that are registered with the graph
using keys SOURCE_PCLIST_DPKEY
(to specify PortCandidate
s for an edge on the source node) and
TARGET_PCLIST_DPKEY
(to specify PortCandidate
s for an edge on the target node).
The DataProvider
s hold a collection
of PortCandidate
s for each edge.
Node PortCandidate
s determine available ports on the nodes to which edges can be connected.
This means that an edge of the graph can be connected to any of these node ports
(unless edge PortCandidate
s are specified too).
To register and define node PortCandidate
s refer to PortCandidateSet
.
A PortCandidate
is described by the following attributes:
PortCandidate
relative to the center of the node.
PortCandidate
s are defined using exact coordinates, whereas
coordinates of free candidates are selected arbitrarily.
PortCandidate
. During the processing of an edge by a
layout or routing algorithm, candidates of lower cost will be considered first.
If candidates are defined for nodes as well as for edges and if they should be properly matched by
layout algorithms (i.e. detected as the same candidate), then it is important that the same
PortCandidate
instance is registered. It does not suffice to register candidates with the
same parameter values.
Not all layout and routing algorithms are able to handle PortCandidate
s. Major layout algorithms
that obey them are IncrementalHierarchicLayouter
,
EdgeRouter
, ChannelEdgeRouter
and
BusRouter
.
PortCandidateAssignmentStage
can be appended to any layout algorithm that cannot handle port
constraints in order to assign edges to the ports specified by PortConstraint
s or
PortCandidate
s after calling the core layout algorithm.PortConstraint
s and PortCandidate
s (on edges and/or nodes) are defined
for a graph, the layout or the routing algorithm will try to match both of them in order to find an appropriate port.
The matching process depends on the actual algorithm.Field Summary | |
---|---|
static int |
AGAINST_THE_FLOW
A port direction specifier indicating a port lying in the opposite direction of the main flow of the edge or of the overall layout. |
static int |
ANY
A combination of all possible direction specifiers indicating that edges can connect to any side of a node. |
static int |
EAST
A port direction specifier indicating a port on the east (i.e., right) side of a node. |
static int |
LEFT_IN_FLOW
A port direction specifier indicating a port lying left of the direction of the main flow of the edge or of the overall layout. |
static int |
NORTH
A port direction specifier indicating a port on the north (i.e., top) side of a node. |
static int |
RIGHT_IN_FLOW
A port direction specifier indicating a port lying right of the direction of the main flow of the edge or of the overall layout. |
static java.lang.Object |
SOURCE_PCLIST_DPKEY
A DataProvider key for specifying source port candidates for each edge.
|
static int |
SOUTH
A port direction specifier indicating a port on the south (i.e., bottom) side of a node. |
static java.lang.Object |
TARGET_PCLIST_DPKEY
A DataProvider key for specifying target port candidates for each edge.
|
static int |
WEST
A port direction specifier indicating a port on the west (i.e., left) side of a node. |
static int |
WITH_THE_FLOW
A port direction specifier indicating a port lying in the direction of the main flow of the edge or of the overall layout. |
Constructor Summary | |
---|---|
protected |
PortCandidate(double xOffset,
double yOffset,
boolean fixed,
int directionMask,
double cost)
Deprecated. Factory method createCandidate(double, double, int, double) should be used instead. |
protected |
PortCandidate(double xOffset,
double yOffset,
int directionMask)
Deprecated. Factory method createCandidate(double, double, int) should be used instead. |
protected |
PortCandidate(int directionMask)
Deprecated. Factory method createCandidate(int) } should be used instead. |
protected |
PortCandidate(int directionMask,
double cost)
Deprecated. Factory method createCandidate(int, double) should be used instead. |
Method Summary | |
---|---|
static PortCandidate |
createCandidate(double xOffset,
double yOffset,
int directionMask)
Factory method that creates a fixed PortCandidate instance with zero cost of usage, the given direction
and the given offset values. |
static PortCandidate |
createCandidate(double xOffset,
double yOffset,
int directionMask,
double cost)
Factory method that creates a fixed PortCandidate instance with the given cost of usage, direction and
offset values. |
static PortCandidate |
createCandidate(int directionMask)
Factory method that creates a free PortCandidate instance with the given direction and
zero cost of usage. |
static PortCandidate |
createCandidate(int directionMask,
double cost)
Factory method that creates a free PortCandidate instance with the given direction and cost of
usage. |
static PortCandidate |
createCandidate(PortConstraint fromPortConstraint)
Factory method that returns a free PortCandidate instance with zero cost of usage and the
direction specified by the side of the given PortConstraint . |
boolean |
equals(java.lang.Object other)
Returns whether or not this PortCandidate is equal to another PortCandidate based on their
internal attributes. |
double |
getCost()
Returns the penalty cost for using this PortCandidate instance. |
int |
getDirection()
Returns the direction of this PortCandidate . |
int |
getDirectionForLayoutOrientation(byte layoutOrientation)
Returns the direction of this PortCandidate instance with respect to the given
layout orientation . |
double |
getXOffset()
Returns the X-offset of the PortCandidate with respect to the center of the corresponding node. |
double |
getXOffsetForLayoutOrientation(byte layoutOrientation)
Returns the X-offset of the PortCandidate with respect to the center of the corresponding node for the given
layout orientation . |
double |
getXOffsetForLayoutOrientation(byte layoutOrientation,
int mirrorMask)
Returns the X-offset of the PortCandidate with respect to the center of the corresponding node for the given
layout orientation and
mirror mask . |
double |
getYOffset()
Returns the Y-offset of the PortCandidate with respect to the center of the corresponding node. |
double |
getYOffsetForLayoutOrientation(byte layoutOrientation)
Returns the Y-offset of the PortCandidate with respect to the center of the corresponding node for the given
layout orientation . |
double |
getYOffsetForLayoutOrientation(byte layoutOrientation,
int mirrorMask)
Returns the Y-offset of the PortCandidate with respect to the center of the corresponding node for the given
layout orientation and
mirror mask . |
int |
hashCode()
Returns a hash code value for this PortCandidate instance based on the internal attributes. |
boolean |
isFixed()
Returns whether or not this PortCandidate is fixed. |
boolean |
isInDirection(int directionMask)
Returns whether or not this PortCandidate lies in the given direction. |
PortConstraint |
toPortConstraint()
A utility method that converts the current PortCandidate instance to a PortConstraint . |
PortConstraint |
toPortConstraintForLayoutOrientation(byte layoutOrientation)
A utility method that converts the current PortCandidate instance to a PortConstraint with respect
to the given layout orientation . |
java.lang.String |
toString()
Returns a string representation of this PortCandidate instance. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int NORTH
public static final int EAST
public static final int WEST
public static final int SOUTH
public static final int WITH_THE_FLOW
The exact direction is domain-specific.
public static final int AGAINST_THE_FLOW
The exact direction is domain-specific.
public static final int LEFT_IN_FLOW
The exact direction is domain-specific.
public static final int RIGHT_IN_FLOW
The exact direction is domain-specific.
public static final int ANY
public static final java.lang.Object SOURCE_PCLIST_DPKEY
DataProvider
key for specifying source port candidates for each edge.
public static final java.lang.Object TARGET_PCLIST_DPKEY
DataProvider
key for specifying target port candidates for each edge.
Constructor Detail |
---|
protected PortCandidate(double xOffset, double yOffset, boolean fixed, int directionMask, double cost)
createCandidate(double, double, int, double)
should be used instead.
PortCandidate
with the given cost of usage, direction specifier and offset values.
xOffset
- the X-offset relative to the center of the given nodeyOffset
- the Y-offset relative to the center of the given nodefixed
- true
if this is a fixed PortCandidate
, false
otherwisedirectionMask
- any combination of the default direction specifierscost
- the penalty cost for using this PortCandidate
protected PortCandidate(double xOffset, double yOffset, int directionMask)
createCandidate(double, double, int)
should be used instead.
PortCandidate
instance with zero cost of usage, the given direction specifier
and the given offset values.
xOffset
- the X-offset relative to the center of the given nodeyOffset
- the Y-offset relative to the center of the given nodedirectionMask
- any combination of the default direction specifiersprotected PortCandidate(int directionMask)
createCandidate(int)
} should be used instead.
PortCandidate
instance with the given direction and zero cost of usage.
directionMask
- any combination of the default direction specifiersprotected PortCandidate(int directionMask, double cost)
createCandidate(int, double)
should be used instead.
PortCandidate
instance with the given direction and cost of usage.
directionMask
- any combination of the default direction specifierscost
- the penalty cost for using this PortCandidate
Method Detail |
---|
public boolean isInDirection(int directionMask)
PortCandidate
lies in the given direction.
directionMask
- one of the default direction specifiers
true
if this PortCandidate
lies in the given direction,
false
otherwisepublic int getDirection()
PortCandidate
.
If the direction is required to be calculated with respect to the actual
layout orientation
,
getDirectionForLayoutOrientation(byte)
should be used instead.
PortCandidate
getDirectionForLayoutOrientation(byte)
public boolean isFixed()
PortCandidate
is fixed.
Fixed PortCandidate
s are defined using exact coordinates, whereas
coordinates of free candidates are selected arbitrarily.
true
if this PortCandidate
is fixed,
false
otherwisepublic double getXOffset()
PortCandidate
with respect to the center of the corresponding node.
The X-offset encodes the horizontal distance of the port relative to the center of a node. If the
PortCandidate
is not fixed
(i.e., free), the X-offset is zero.
layout orientation
,
getXOffsetForLayoutOrientation(byte)
should be used instead.PortCandidate
public double getYOffset()
PortCandidate
with respect to the center of the corresponding node.
The Y-offset encodes the vertical distance of the port relative to the center of a node. If the
PortCandidate
is not fixed
(i.e., free), the Y-offset is zero.
layout orientation
,
method getYOffsetForLayoutOrientation(byte)
should be used instead.PortCandidate
public static PortCandidate createCandidate(int directionMask)
PortCandidate
instance with the given direction and
zero cost of usage.
directionMask
- any combination of the default direction specifiers
PortCandidate
instancepublic static PortCandidate createCandidate(int directionMask, double cost)
PortCandidate
instance with the given direction and cost of
usage.
PCListOptimizer.setOverUsagePenalty(double)
in
IncrementalHierarchicLayouter
.directionMask
- any combination of the default direction specifierscost
- the penalty cost for using this PortCandidate
PortCandidate
instancepublic static PortCandidate createCandidate(double xOffset, double yOffset, int directionMask)
PortCandidate
instance with zero cost of usage, the given direction
and the given offset values.
directionMask
- any combination of the default direction specifiersxOffset
- the X-offset relative to the center of the nodeyOffset
- the Y-offset relative to the center of the node
PortCandidate
instancepublic static PortCandidate createCandidate(double xOffset, double yOffset, int directionMask, double cost)
PortCandidate
instance with the given cost of usage, direction and
offset values.
PCListOptimizer.setOverUsagePenalty(double)
in
IncrementalHierarchicLayouter
.directionMask
- any combination of the default direction specifiersxOffset
- the X-offset relative to the center of the nodeyOffset
- the Y-offset relative to the center of the nodecost
- the penalty cost for using this PortCandidate
instance
PortCandidate
instancepublic static PortCandidate createCandidate(PortConstraint fromPortConstraint)
PortCandidate
instance with zero cost of usage and the
direction specified by the side
of the given PortConstraint
.
fromPortConstraint
- the PortConstraint
whose side
should be used as direction
PortCandidate
instancepublic int hashCode()
PortCandidate
instance based on the internal attributes.
hashCode
in class java.lang.Object
public PortConstraint toPortConstraint()
PortCandidate
instance to a PortConstraint
.
The side
of the created PortConstraint
matches the
direction
of this PortCandidate
.
If this PortCandidate
is fixed
, the resulting PortConstraint
will be
strong
.
PortConstraint
should be determined with respect to a certain
layout orientation
, method
toPortConstraintForLayoutOrientation(byte)
should be used instead.PortConstraint
that matches this PortCandidate
public PortConstraint toPortConstraintForLayoutOrientation(byte layoutOrientation)
PortCandidate
instance to a PortConstraint
with respect
to the given layout orientation
.
The side
of the created PortConstraint
is the
direction
of this PortCandidate
interpreted for the given orientation.
If this PortCandidate
is fixed
, the resulting PortConstraint
will be
strong
.
PortConstraint
should not be determined with respect to a certain
layout orientation
, method
toPortConstraint()
should be used instead.PortConstraint
that matches this PortCandidate
with respect to the given orientationpublic boolean equals(java.lang.Object other)
PortCandidate
is equal to another PortCandidate
based on their
internal attributes.
equals
in class java.lang.Object
other
- the reference PortCandidate
object with which to compare
true
if this object is the same as the PortCandidate
argument, false
otherwisepublic double getCost()
PortCandidate
instance.
PortCandidate
public int getDirectionForLayoutOrientation(byte layoutOrientation)
PortCandidate
instance with respect to the given
layout orientation
.
If the direction mask is not required to be calculated with respect to the actual
layout orientation
,
getDirection()
should be used instead.
PortCandidate
with respect to the given layout orientationgetDirection()
public double getXOffsetForLayoutOrientation(byte layoutOrientation, int mirrorMask)
PortCandidate
with respect to the center of the corresponding node for the given
layout orientation
and
mirror mask
.
The X-offset encodes the horizontal distance of the port relative to the center of a node. If the
PortCandidate
is not fixed
(i.e., free), the X-offset is equal to zero.
layout orientation
, getXOffset()
should be used
instead.layoutOrientation
- the layout orientationmirrorMask
- the mirror mask
public double getYOffsetForLayoutOrientation(byte layoutOrientation, int mirrorMask)
PortCandidate
with respect to the center of the corresponding node for the given
layout orientation
and
mirror mask
.
The Y-offset encodes the vertical distance of the port relative to the center of a node. If the
PortCandidate
is not fixed
(i.e., free), the Y-offset is equal to zero.
layout orientation
, getYOffset()
should be used
instead.layoutOrientation
- the layout orientationmirrorMask
- the mirror mask
PortCandidate
with respect to the given orientation and mirror maskpublic double getXOffsetForLayoutOrientation(byte layoutOrientation)
PortCandidate
with respect to the center of the corresponding node for the given
layout orientation
.
The X-offset encodes the horizontal distance of the port relative to the center of a node. If the
PortCandidate
is not fixed
(i.e., free), the X-offset is equal to zero.
layout orientation
, getXOffset()
should be used instead.layoutOrientation
- the layout orientation
PortCandidate
with respect to the given layout orientationpublic double getYOffsetForLayoutOrientation(byte layoutOrientation)
PortCandidate
with respect to the center of the corresponding node for the given
layout orientation
.
The Y-offset encodes the vertical distance of the port relative to the center of a node. If the
PortCandidate
is not fixed
(i.e., free), the Y-offset is equal to zero.
layout orientation
, getYOffset()
should be used instead.layoutOrientation
- the layout orientation
PortCandidate
with respect to the given layout orientationpublic java.lang.String toString()
PortCandidate
instance.
toString
in class java.lang.Object
PortCandidate
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |