|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecty.layout.seriesparallel.DefaultPortAssignment
public class DefaultPortAssignment
DefaultPortAssignment
implements the default port assignment strategy.
Ports are either placed at the center
or get
distributed
at the sides of the node.
If PortConstraint
s are specified, the strong PortConstraint
s are handled separately
and keep their initial location relative to the node while weak PortConstraint
s just influence on which
side of the node the port is placed.
If there are edge groups specified, the edges which belong to the same group get the same port locations.
PortConstraint
,
PortConstraintKeys.SOURCE_GROUPID_KEY
,
PortConstraintKeys.TARGET_GROUPID_KEY
![]() |
![]() |
Field Summary | |
---|---|
static byte |
FORK_STYLE_AT_NODE
Fork style specifier that defines that the edges will fork on a node. |
static byte |
FORK_STYLE_OUTSIDE_NODE
Fork style specifier that defines that the edges will fork outside a node. |
static byte |
PORT_ASSIGNMENT_MODE_CENTER
A port assignment specifier which defines that all ports are reset to the center of their nodes. |
static byte |
PORT_ASSIGNMENT_MODE_DISTRIBUTED
A port assignment specifier which defines that the ports of incoming and outgoing edges are distributed evenly at the side of their nodes. |
Constructor Summary | |
---|---|
DefaultPortAssignment()
Creates a new DefaultPortAssignment with default settings. |
|
DefaultPortAssignment(byte mode)
Creates a new DefaultPortAssignment instance using the given port assignment mode . |
|
DefaultPortAssignment(byte mode,
double ratio)
Creates a new DefaultPortAssignment instance using the given mode and a given value for
the ratio of the gap between the border and the ports to the gap
between the ports themselves. |
Method Summary | |
---|---|
void |
assignPorts(LayoutGraph graph,
Node node)
Places the ports of edges connecting to the given node according to the port assignment mode . |
double |
getBorderGapToPortGapRatio()
Returns the ratio of the border gap (distance between the outer ports and the node border) to the port gap (distance between adjacent ports). |
byte |
getForkStyle()
Returns the fork style which influences the port assignment. |
byte |
getMode()
Returns the mode that describes how ports are placed. |
protected double |
getPortBorderGap(double sideLength,
int edgeCount)
Determines the distance between the outer ports and the border of the node. |
protected double |
getPortDistanceDelta(double sideLength,
int edgeCount,
double portBorderGap)
Determines the distance between two adjacent ports. |
void |
setBorderGapToPortGapRatio(double borderGapToPortGapRatio)
Specifies the ratio of the border gap (distance between the outer ports and the node border) to the port gap (distance between adjacent ports). |
void |
setForkStyle(byte forkStyle)
Specifies the fork style which influences the port assignment. |
void |
setMode(byte mode)
Specifies the mode that describes how ports are placed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte PORT_ASSIGNMENT_MODE_CENTER
public static final byte PORT_ASSIGNMENT_MODE_DISTRIBUTED
The source ports of edges without PortConstraint
s will be distributed at the sides of
their source and target nodes.
Edges with weak PortConstraint
s are distributed at the side of the nodes which is specified in the
PortConstraint
.
Grouped edges will get the same port location.
public static final byte FORK_STYLE_OUTSIDE_NODE
public static final byte FORK_STYLE_AT_NODE
Constructor Detail |
---|
public DefaultPortAssignment()
DefaultPortAssignment
with default settings.
public DefaultPortAssignment(byte mode)
DefaultPortAssignment
instance using the given port assignment mode
.
mode
- one of the predefined port assignment modes
java.lang.IllegalArgumentException
- if the given mode is unknownpublic DefaultPortAssignment(byte mode, double ratio)
DefaultPortAssignment
instance using the given mode
and a given value for
the ratio
of the gap between the border and the ports to the gap
between the ports themselves.
mode
- one of the predefined port assignment modesratio
- the ratio of the distance between outer ports and the border to the distance between any two ports
java.lang.IllegalArgumentException
- if the given mode is unknown or the given ratio is negativeMethod Detail |
---|
public void assignPorts(LayoutGraph graph, Node node)
port assignment mode
.
assignPorts
in interface PortAssignment
graph
- the input graphnode
- the node whose adjacent edges' ports should be placedgetMode()
protected double getPortBorderGap(double sideLength, int edgeCount)
This implementation calculates the gap according to the number of edges at one side of the node. It also includes
the ratio between border gap and port gap
.
This method is called by assignPorts(LayoutGraph, Node)
to calculate the
location of the first port. It may be overridden to implement a different distribution of ports on the node's
side.
sideLength
- the width/height of the sideedgeCount
- the number of edges that connect to this side
assignPorts(LayoutGraph, Node)
,
getBorderGapToPortGapRatio()
protected double getPortDistanceDelta(double sideLength, int edgeCount, double portBorderGap)
This implementation calculates the gap according to the number of edges at one side of the node. The edges are distributed keeping the given gap to the border of the node.
This method is called by assignPorts(LayoutGraph, Node)
to calculate the
distance between two ports. It may be overridden to implement a different distribution of ports on the node's
side.
sideLength
- the width/height of the sideedgeCount
- the number of edges/ports that connect to this sideportBorderGap
- the port border gap (i.e. calculated by getPortBorderGap(double, int)
)
assignPorts(LayoutGraph, Node)
,
getPortBorderGap(double, int)
public byte getMode()
setMode(byte)
public void setMode(byte mode)
PORT_ASSIGNMENT_MODE_CENTER
mode
- one of the predefined port assignment modes
java.lang.IllegalArgumentException
- if an unknown mode is specifiedpublic double getBorderGapToPortGapRatio()
The ratio must have a positive value. If the ratio is 0
, the ports will be distributed along the
whole side of the node without a gap between the last port and the corner.
distributed
port assignment.setBorderGapToPortGapRatio(double)
public void setBorderGapToPortGapRatio(double borderGapToPortGapRatio)
The ratio must have a positive value. If the ratio is 0
, the ports will be distributed along the
whole side of the node without a gap between the last port and the corner.
distributed
port assignment.borderGapToPortGapRatio
- the ratio of the border gap (gap between ports and border) to the port gap (gap between two ports)
java.lang.IllegalArgumentException
- if the specified ratio is negative![]() 0.5 | ![]() 1 |
public byte getForkStyle()
If the fork style is set to FORK_STYLE_OUTSIDE_NODE
, edges without port constraints will be
assigned in flow direction.
If the fork style is set to FORK_STYLE_AT_NODE
, the ports of edges in flow direction also get
distributed to the sides unless they are without bends. Due to large minimum first/last segment
lengths edges may overlap.
setForkStyle(byte)
public void setForkStyle(byte forkStyle)
If the fork style is set to FORK_STYLE_OUTSIDE_NODE
, edges without port constraints will be
assigned in flow direction.
If the fork style is set to FORK_STYLE_AT_NODE
, the ports of edges in flow direction also get
distributed to the sides unless they are without bends. Due to large minimum first/last segment
lengths edges may overlap.
FORK_STYLE_OUTSIDE_NODE
forkStyle
- one of the predefined fork styles
java.lang.IllegalArgumentException
- if the specified fork style is unknown
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |