|
Search this API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.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 PortCandidates extends the one of PortConstraints. In contrast to
PortConstraints, they can be associated with both edges and nodes. Moreover, more than one
PortCandidate can be specified for an edge or a node.
Edge PortCandidates 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 PortCandidates is held by DataProviders that are registered with the graph
using keys SOURCE_PCLIST_DPKEY (to specify PortCandidates for an edge on the source node) and
TARGET_PCLIST_DPKEY (to specify PortCandidates for an edge on the target node).
The DataProviders hold a collection of PortCandidates for each edge.
Node PortCandidates 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 PortCandidates are specified too).
To register and define node PortCandidates refer to PortCandidateSet.
A PortCandidate is described by the following attributes:
PortCandidate relative to the center of the node.
PortCandidates 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 PortCandidates. 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 PortConstraints or
PortCandidates after calling the core layout algorithm.PortConstraints and PortCandidates (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 specifiers
protected 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.
PortCandidategetDirectionForLayoutOrientation(byte)public boolean isFixed()
PortCandidate is fixed.
Fixed PortCandidates 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.PortCandidatepublic 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.PortCandidatepublic 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 instance
public 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 instance
public 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 instance
public 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.Objectpublic 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 PortCandidatepublic 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.Objectother - 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.
PortCandidatepublic 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.ObjectPortCandidate
|
© Copyright 2000-2025, yWorks GmbH. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||