|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectilog.views.graphlayout.IlvGraphLayout
ilog.views.graphlayout.hierarchical.IlvHierarchicalLayout
public class IlvHierarchicalLayout
The main class for the Hierarchical Layout algorithm.
The Hierarchical Layout arranges the nodes in horizontal or vertical levels such that the majority of the links point in the same direction and the number of link crossings is small.
Here is a sample drawing produced by the Hierarchical Layout algorithm with two levels of nodes that are top-justified within each level:
Another sample drawing with eight levels follows. This graph contains a cycle and a self-loop. The direction of the flow is from top to bottom. The nodes are organized in horizontal levels.
The Hierarchical Layout algorithm supports different styles of links in the same drawing. The following sample drawing shows orthogonal, straight, and polyline links. The direction of the flow is to the right and the node levels are vertical.
The Hierarchical Layout algorithm supports port specifications. The side and index of the port where a link connects to a node can be specified. The following sample drawing shows a drawing with port specifications and orthogonal link style. The direction of the flow is from top to bottom.
To simplify the explanations of the layout parameters, we use the compass directions north, south, east, and west. The first level of the layout is the north pole. If the flow direction is top to bottom, north is always upwards, south towards the bottom, west towards the left, and east towards the right side of the layout. If the flow direction is left to right, north is left and south is right.
See the corresponding chapter of the User's Manual for details on the algorithm, the types of graphs for which this algorithm can be used, the features and limitations, code samples, and so on.
Note the following points:
- The layout algorithm always takes into account the direction of links.
- The initial position of the nodes (at the moment you start the layout)
does not affect the resulting layout.
- The algorithm supports self-links, cycles, and multiple links
between the same pair of nodes.
| Field Summary | |
|---|---|
static int |
AUTOMATIC_PINS
Automatic connector pin option. |
static int |
CENTERED_PINS
Centered connector pin option. |
static int |
CLIPPED_PINS
Clipped connector pin option. |
static int |
EAST
East port side. |
static int |
EVENLY_SPACED_PINS
Evenly spaced connector pin option. |
static int |
FIXED_IN_X_MODE
Fixed movement mode for the x direction. |
static int |
FIXED_IN_Y_MODE
Fixed movement mode for the y direction. |
static int |
FIXED_MODE
Fixed movement mode. |
static int |
FREE_MODE
Free movement mode. |
static int |
HIGHER_LEVELS
The leveling strategy to utilize higher numbered levels. |
static int |
LOWER_LEVELS
The leveling strategy to utilize lower numbered levels. |
static int |
MIXED_MODE
Mixed movement mode. |
static int |
MIXED_STYLE
Mixed link shape option. |
static int |
NO_RESHAPE_STYLE
No reshape option. |
static int |
NORTH
North port side. |
static int |
OPTIMAL
The optimal leveling strategy. |
static int |
ORTHOGONAL_STYLE
Orthogonal link shape option. |
static int |
POLYLINE_STYLE
Polyline link shape option. |
static int |
SEMI_OPTIMAL
The semioptimal leveling strategy. |
static int |
SOUTH
South port side. |
static int |
SPREAD_OUT
The leveling strategy to spread the nodes over all levels. |
static int |
STRAIGHT_LINE_STYLE
Straight-line link shape option. |
static int |
UNSPECIFIED
Unspecified port side. |
static int |
WEST
West port side. |
| Fields inherited from class ilog.views.graphlayout.IlvGraphLayout |
|---|
INVERSE_VIEW_COORDINATES, MANAGER_COORDINATES, VIEW_COORDINATES |
| Constructor Summary | |
|---|---|
IlvHierarchicalLayout()
Creates a new instance of the Hierarchical Layout algorithm. |
|
IlvHierarchicalLayout(IlvHierarchicalLayout source)
Creates a new layout instance by copying an existing one. |
|
| Method Summary | |
|---|---|
void |
addConstraint(IlvHierarchicalConstraint constraint)
Adds a constraint for the hierarchical layout. |
protected void |
beforeLayout(boolean redraw)
Performs preprocessing operations before the layout of the entire graph. |
int |
checkAppropriateLink(Object link)
Checks whether the input link is appropriate for this layout. |
void |
cleanLink(IlvGraphModel graphModel,
Object link)
Cleans a link. |
void |
cleanNode(IlvGraphModel graphModel,
Object node)
Cleans a node. |
IlvGraphLayout |
copy()
Copies the layout instance. |
void |
copyParameters(IlvGraphLayout source)
Copies the parameters from a given layout instance. |
protected IlvGraphLayoutGrapherProperty |
createLayoutGrapherProperty(String name,
boolean withDefaults)
Returns a new instance of IlvHierarchicalLayoutGrapherProperty
that stores the parameter settings of this layout class. |
protected IlvGraphLayoutLinkProperty |
createLayoutLinkProperty(String name,
IlvGraphic link,
boolean withDefaults)
Returns a new instance of IlvHierarchicalLayoutLinkProperty
that stores the parameter settings of this layout class for links. |
protected IlvGraphLayoutNodeProperty |
createLayoutNodeProperty(String name,
IlvGraphic node,
boolean withDefaults)
Returns a new instance of IlvHierarchicalLayoutNodeProperty
that stores the parameter settings of this layout class for nodes. |
void |
detach()
Detaches the graph model from the layout instance. |
int |
getCalcNodeLevelIndex(Object node)
Returns the calculated level index of a node after performing a layout. |
int |
getCalcNodePositionIndex(Object node)
Returns the calculated index of the node position within a level after performing a layout. |
int |
getConnectorStyle()
Returns the style of the connectors. |
Enumeration |
getConstraints()
Returns the constraints that have been added to the hierarchical layout. |
int |
getDestinationPointMode(Object link)
Returns the destination point mode of an individual link. |
int |
getEastNumberOfPorts(Object node)
Returns the number of relative ports on the east side of a node. |
int |
getFlowDirection()
Returns the current direction of the link flow. |
int |
getFromPortIndex(Object link)
Returns the port index of a link at the "from" side. |
int |
getFromPortSide(Object link)
Returns the port side of a link at the "from" side. |
int |
getGlobalDestinationPointMode()
Returns the global mode for the connection points of the links on the destination nodes. |
int |
getGlobalIncrementalNodeMovementMode()
Returns the node movement mode used during incremental layout. |
int |
getGlobalLinkStyle()
Returns the global style of the shapes of links. |
int |
getGlobalOriginPointMode()
Returns the global mode for the connection points of the links on the origin nodes. |
float |
getHorizontalLinkOffset()
Returns the horizontal offset between parallel segments of links. |
float |
getHorizontalNodeLinkOffset()
Returns the horizontal offset between a node and a link segment that is parallel to the node border. |
float |
getHorizontalNodeOffset()
Returns the horizontal offset between nodes. |
float |
getIncrementalAbsoluteLevelPositionRange()
Returns the range that is considered very close to the previous node position. |
float |
getIncrementalAbsoluteLevelPositionTendency()
Returns the percentage of how much the layout algorithm tries to place nodes to absolute positions within the level that are close to the previous positions during incremental layout. |
IlvRect |
getIncrementalNodeBoxForExpand(Object expandedNode)
Returns the effective bounding rectangle of an expanded node during incremental layout. |
int |
getIncrementalNodeMovementMode(Object node)
Returns the movement mode of an individual node used during incremental layout. |
int |
getLevelingStrategy()
Returns the current hierarchical layout leveling strategy. |
int |
getLevelJustification()
Returns the current justification within the levels. |
float |
getLinkPriority(Object link)
Returns the priority of a link. |
int |
getLinkStyle(Object link)
Returns the style of the shape of an individual link. |
float |
getMaxInterLevelApertureAngle()
Returns the maximal aperture angle of the links incident to a node. |
float |
getMinEndSegmentLength()
Returns the minimum length of the last segment of each link. |
float |
getMinForkSegmentLength()
Returns the minimal length of the start or end segment of links if a fork shape is used for these links. |
float |
getMinStartSegmentLength()
Returns the minimum length of the first segment of each link. |
IlvGraphicVector |
getMovingNodes()
Returns the vector of nodes being moved by the graph layout algorithm. |
Enumeration |
getNodeGroups()
Returns the node groups that occur in constraints that were added to the hierarchical layout. |
int |
getNorthNumberOfPorts(Object node)
Returns the number of relative ports on the north side of a node. |
int |
getNumberOfConstraints()
Returns the number of constraints that have been added to the hierarchical layout. |
int |
getNumberOfLinkCrossingSweeps()
Returns the number of layer sweeps to remove link crossings. |
int |
getNumberOfNodeGroups()
Returns the number of node groups that occur in constraints that were added to the hierarchical layout. |
int |
getNumberOfPorts(Object node,
int side)
Returns the specified number of relative ports of a node on the given side. |
int |
getOriginPointMode(Object link)
Returns the origin point mode of an individual link. |
IlvPoint |
getPosition()
Returns the specified position of the layout. |
float |
getPreferredForkAxisLength()
Returns the preferred length of the axis of a fork shape. |
int |
getSouthNumberOfPorts(Object node)
Returns the number of relative ports on the south side of a node. |
int |
getSpecNodeLevelIndex(Object node)
Returns the index of the specified level for a node. |
int |
getSpecNodePositionIndex(Object node)
Returns the index of the specified position of a node within a level. |
int |
getToPortIndex(Object link)
Returns the port index of a link at the "to" side. |
int |
getToPortSide(Object link)
Returns the port side of a link at the "to" side. |
float |
getVerticalLinkOffset()
Returns the vertical offset between parallel segments of links. |
float |
getVerticalNodeLinkOffset()
Returns the vertical offset between a node and a link segment that is parallel to the node border. |
float |
getVerticalNodeOffset()
Returns the vertical offset between nodes. |
int |
getWestNumberOfPorts(Object node)
Returns the number of relative ports on the west side of a node. |
protected void |
init()
Initializes instance variables. |
boolean |
isBacktrackCrossingReductionEnabled()
Returns true if the backtrack mechanism of the link crossing
reduction phase is enabled. |
boolean |
isCrossingReductionDuringIncremental()
Returns true if crossing reduction during incremental
layout is enabled. |
boolean |
isFromFork()
Returns true if the fork shape is enabled for links that
start at the same source point. |
boolean |
isIncrementalAbsoluteLevelPositioning()
Returns true if the algorithm tries to place the nodes within
the level to absolute positions that are close to the previous positions
during incremental layout. |
boolean |
isIncrementalMode()
Returns true if the incremental mode is enabled. |
boolean |
isIntergraphConnectivityMode()
Returns true if the intergraph link connectivity is
considered for the partitioning of the layout into levels. |
boolean |
isLinkCrossingFineTuningEnabled()
Returns true if the link crossing fine tuning phase is
enabled. |
boolean |
isLinkStraighteningEnabled()
Returns true if the link straightening phase is enabled. |
boolean |
isLinkWidthUsed()
Returns true if the layout respects the width of links. |
boolean |
isLongLinkCrossingReductionDuringIncremental()
Returns true if the handling of long links by the crossing
reduction during incremental layout is enabled. |
boolean |
isMedianCrossingValueEnabled()
Returns true if the median crossing value is used during
crossing reduction. |
boolean |
isNeighborLinksAligned()
Returns true if links between neighbor nodes of the same
level are aligned so that they are parallel. |
boolean |
isPolylineLinkOverlapReductionEnabled()
Returns true if the optimization of polyline links is
enabled to avoid links overlapping large neighbor nodes. |
boolean |
isToFork()
Returns true if the fork shape is enabled for links that
end at the same target point. |
protected void |
layout(boolean redraw)
Computes the layout using the Hierarchical Layout algorithm. |
void |
layoutStepPerformed()
Can be called by the layout classes when a step of the layout algorithm has been performed. |
void |
markForIncremental(Object nodeOrLink)
Marks the input node or link to be repositioned with the next call of IlvGraphLayout.performLayout() if incremental mode is enabled. |
void |
removeAllConstraints()
Removes all the constraints from the hierarchical layout. |
void |
removeConstraint()
Removes the constraint that was most recently added from the hierarchical layout. |
void |
removeConstraint(IlvHierarchicalConstraint constraint)
Removes the constraint from the hierarchical layout. |
void |
setBacktrackCrossingReductionEnabled(boolean flag)
Sets whether the backtrack mechanism of the link crossing reduction phase is enabled. |
void |
setConnectorStyle(int style)
Sets the style of connectors. |
void |
setCrossingReductionDuringIncremental(boolean enable)
Sets whether crossing reduction during incremental layout is enabled. |
void |
setDestinationPointMode(Object link,
int mode)
Sets the mode for the connection point on an individual link on the destination node. |
void |
setEastNumberOfPorts(Object node,
int numberOfPorts)
Sets the number of relative ports on the east side of a node. |
void |
setFlowDirection(int direction)
Sets the direction of the link flow. |
void |
setFromFork(boolean enable)
Sets whether a fork shape is created for links that start at the same source point. |
void |
setFromPortIndex(Object link,
int portIndex)
Sets the port index of a link at the "from" side. |
void |
setFromPortSide(Object link,
int side)
Sets the port side of a link at the "from" side. |
void |
setGlobalDestinationPointMode(int mode)
Sets the global mode for the connection point of the links on the destination nodes. |
void |
setGlobalIncrementalNodeMovementMode(int mode)
Sets the node movement mode used during incremental layout. |
void |
setGlobalLinkStyle(int style)
Sets the global style of the shapes of links. |
void |
setGlobalOriginPointMode(int mode)
Sets the global mode for the connection point of the links on the origin nodes. |
void |
setHorizontalLinkOffset(float offset)
Sets the horizontal offset between parallel segments of links. |
void |
setHorizontalNodeLinkOffset(float offset)
Sets the horizontal offset between a node and a link segment that is parallel to the node border. |
void |
setHorizontalNodeOffset(float offset)
Sets the horizontal offset between nodes. |
void |
setIncrementalAbsoluteLevelPositioning(boolean enable)
Sets whether it is enabled to place nodes within the level to absolute positions that are close to the previous positions during incremental layout. |
void |
setIncrementalAbsoluteLevelPositionRange(float range)
Sets the range that is considered very close to the previous node position. |
void |
setIncrementalAbsoluteLevelPositionTendency(float percentage)
Sets the percentage how much the layout algorithm tries to place nodes to absolute positions within the level that are close to the previous positions during incremental layout. |
void |
setIncrementalMode(boolean enable)
Sets whether the incremental layout mode is enabled. |
void |
setIncrementalNodeBoxForExpand(Object expandedNode,
IlvRect rect)
Sets the effective bounding rectangle of an expanded node during incremental layout. |
void |
setIncrementalNodeMovementMode(Object node,
int mode)
Sets the movement mode of an individual node used during incremental layout. |
void |
setIntergraphConnectivityMode(boolean flag)
Sets whether the intergraph link connectivity is considered for the partitioning of the layout into levels. |
void |
setLevelingStrategy(int strategy)
Sets the hierarchical layout leveling strategy. |
void |
setLevelJustification(int justification)
Sets the justification within the levels. |
void |
setLinkCrossingFineTuningEnabled(boolean flag)
Sets whether the link crossing fine tuning phase is enabled. |
void |
setLinkPriority(Object link,
float priority)
Sets the priority of a link. |
void |
setLinkStraighteningEnabled(boolean flag)
Sets whether the link straightening phase is enabled. |
void |
setLinkStyle(Object link,
int style)
Sets the style of the shape of an individual link. |
void |
setLinkWidthUsed(boolean used)
Sets whether the layout respects the width of links. |
void |
setLongLinkCrossingReductionDuringIncremental(boolean enable)
Sets whether the handling of long links for crossing reduction during incremental layout is enabled. |
void |
setMaxInterLevelApertureAngle(float angle)
Sets the maximal aperture angle of the links incident to a node. |
void |
setMedianCrossingValueEnabled(boolean flag)
Sets whether the median crossing value is used during crossing reduction. |
void |
setMinEndSegmentLength(float length)
Sets the minimum length of the last segment of each link, that is, the segment that is incident to the "to" node. |
void |
setMinForkSegmentLength(float length)
Sets the minimal length of the start or end segment of links if a fork shape is used for these links. |
void |
setMinStartSegmentLength(float length)
Sets the minimum length of the first segment of each link, that is, the segment that is incident to the "from" node. |
void |
setNeighborLinksAligned(boolean enable)
Sets whether links between neighbor nodes of the same level are aligned so that they are strictly horizontal or vertical. |
void |
setNorthNumberOfPorts(Object node,
int numberOfPorts)
Sets the number of relative ports on the north side of a node. |
void |
setNumberOfLinkCrossingSweeps(int numberOfSweeps)
Sets the number of layer sweeps to remove link crossings. |
void |
setNumberOfPorts(Object node,
int side,
int numberOfPorts)
Sets the number of relative ports of a node on a given side. |
void |
setOriginPointMode(Object link,
int mode)
Sets the mode for the connection point on an individual link on the origin node. |
void |
setPolylineLinkOverlapReductionEnabled(boolean flag)
Sets whether optimization of polyline links to avoid links overlapping large neighbor nodes is enabled. |
void |
setPosition(IlvPoint point)
Sets the position of the layout. |
void |
setPreferredForkAxisLength(float length)
Sets the preferred length of the axis of a fork shape. |
void |
setQuickAndUgly(boolean flag)
This is a convenience method to set up for a "quick and ugly" layout. |
void |
setSouthNumberOfPorts(Object node,
int numberOfPorts)
Sets the number of relative ports on the south side of a node. |
void |
setSpecNodeLevelIndex(Object node,
int index)
Sets the index of the specified level for a node. |
void |
setSpecNodePositionIndex(Object node,
int index)
Sets the index of the specified position of a node within a level. |
void |
setToFork(boolean enable)
Sets whether a fork shape is created for links that end at the same target point. |
void |
setToPortIndex(Object link,
int portIndex)
Sets the port index of a link at the "to" side. |
void |
setToPortSide(Object link,
int side)
Sets the port side of a link at the "to" side. |
void |
setVerticalLinkOffset(float offset)
Sets the vertical offset between parallel segments of links. |
void |
setVerticalNodeLinkOffset(float offset)
Sets the vertical offset between a node and a link segment that is parallel to the node border. |
void |
setVerticalNodeOffset(float offset)
Sets the vertical offset between nodes. |
void |
setWestNumberOfPorts(Object node,
int numberOfPorts)
Sets the number of relative ports on the west side of a node. |
boolean |
stopImmediately()
Stops the running layout algorithm as soon as possible. |
boolean |
supportsAllowedTime()
Indicates that this layout class can stop the layout computation in a proper manner when the user-defined allowed time is exceeded. |
boolean |
supportsLayoutOfConnectedComponents()
Indicates that this layout class can use the generic connected component layout mechanism of the IlvGraphLayout
base class. |
boolean |
supportsLinkClipping()
Indicates that this layout class can use a link clip interface to clip the end points of a links. |
boolean |
supportsLinkConnectionBox()
Indicates that this layout class can use a link connection box interface to calculate the end points of links. |
boolean |
supportsPercentageComplete()
Indicates that this layout class can estimate the percentage of completion during the run of layout. |
boolean |
supportsPreserveFixedLinks()
Indicates that this layout class allows the user to specify fixed links. |
boolean |
supportsPreserveFixedNodes()
Indicates that this layout class allows the user to specify fixed nodes. |
boolean |
supportsSaveParametersToNamedProperties()
Indicates that this layout class can transfer the layout parameters to named properties. |
boolean |
supportsSplineRouting()
Indicates if this class supports the generic optimization of spline control points. |
boolean |
supportsStopImmediately()
Indicates that this layout class can interrupt the current run of layout immediately in a controlled way. |
void |
validateConstraints()
Performs a validation check for the constraints. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int NO_RESHAPE_STYLE
setGlobalLinkStyle(int), none of the links are reshaped.
To specify the shape of an individual link, use it as the argument of the
method setLinkStyle(Object, int).
public static final int STRAIGHT_LINE_STYLE
setGlobalLinkStyle(int), all links get a straight-line shape.
To specify the shape of an individual link, use it as the argument of the
method setLinkStyle(Object, int).
public static final int ORTHOGONAL_STYLE
setGlobalLinkStyle(int), all links get a shape consisting
of a sequence of orthogonal line segments.
To specify the shape of an individual link, use it as the argument of the
method setLinkStyle(Object, int).
public static final int POLYLINE_STYLE
setGlobalLinkStyle(int), all links get a shape consisting
of a sequence of line segments (not necessarily orthogonal).
To specify the shape of an individual link, use it as the argument of the
method setLinkStyle(Object, int).
public static final int MIXED_STYLE
setGlobalLinkStyle(int), each link can have a different shape.
The shape of an individual link can be set by
setLinkStyle(Object, int).
public static final int AUTOMATIC_PINS
setConnectorStyle(int), the connector style is automatically
selected depending on the global link style.
setGlobalLinkStyle(int),
Constant Field Valuespublic static final int CENTERED_PINS
setConnectorStyle(int), the connector pins of links are placed
at the center of the border the link is attached to.
public static final int CLIPPED_PINS
setConnectorStyle(int), the connector pins of links are placed
such that the link pointing toward the node center is clipped at the node
border.
public static final int EVENLY_SPACED_PINS
setConnectorStyle(int), the connector pins of links are
evenly spaced along the border the link is attached to.
public static final int EAST
setFromPortSide(Object, int) or
setToPortSide(Object, int),
the link is connected to the east border of its end node at the "from"
or "to" side.
public static final int WEST
setFromPortSide(Object, int) or
setToPortSide(Object, int),
the link is connected to the west border of its end node at the "from"
or "to" side.
public static final int NORTH
setFromPortSide(Object, int) or
setToPortSide(Object, int),
the link is connected to the north border of its end node at the "from"
or "to" side.
public static final int SOUTH
setFromPortSide(Object, int) or
setToPortSide(Object, int),
the link is connected to the south border of its end node at the "from"
or "to" side.
public static final int UNSPECIFIED
setFromPortSide(Object, int) or
setToPortSide(Object, int),
the link can be connected to any border of its end node at the "from"
or "to" side.
public static final int FREE_MODE
setGlobalIncrementalNodeMovementMode(int),
the incremental layout is free to move the nodes.
Depending on the various parameters of the incremental mode, the layout
shifts the nodes to optimize the space usage, but the shifting does not
change the relative order of the nodes and links, so that the diagram
after an incremental layout looks very similar to the previous diagram.
To specify the mode of an individual node,
use this mode as the argument of the method
setIncrementalNodeMovementMode(Object, int).
When this mode is used as the argument of the method
setGlobalOriginPointMode(int)
or setGlobalDestinationPointMode(int),
the layout is free to choose the appropriate position of the
connection points, except for "pinned"
connection points (see IlvGraphModel.hasPinnedConnectionPoint(java.lang.Object, boolean)).
To specify the mode for the connection points of an individual link,
use this mode as the argument of the method
setOriginPointMode(java.lang.Object, int)