rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Graph Layout Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

List of all members | Public Member Functions | Protected Member Functions
IlvHierarchicalLayout Class Reference

This is the main class for the Hierarchical Layout algorithm. More...

#include <ilviews/layout/hierarchical.h>

Inheritance diagram for IlvHierarchicalLayout:
IlvGraphLayout

Public Member Functions

 IlvHierarchicalLayout ()
 Creates a new instance of the Hierarchical Layout algorithm. More...
 
virtual ~IlvHierarchicalLayout ()
 Destroys this instance of class IlvHierarchicalLayout. More...
 
virtual void cleanObjectProperties (IlAny nodeOrLink)
 Overridden version of the method cleanObjectProperties. More...
 
virtual void detach ()
 Detaches the graph model from the layout instance. More...
 
IlInt getCalcNodeLevelIndex (IlAny node) const
 Returns the calculated level index of a node after performing a layout. More...
 
IlInt getCalcNodePositionIndex (IlAny node) const
 Returns the calculated index of the node position within a level after performing a layout. More...
 
IlvLayoutConnectorStyle getConnectorStyle () const
 Returns the current option for the style of the connectors. More...
 
IlvDirection getFlowDirection () const
 Returns the current direction of the link flow. More...
 
IlvLayoutLinkStyle getGlobalLinkStyle () const
 Returns the current option for the global style of the shapes of links. More...
 
IlvPos getHorizontalLinkOffset () const
 Returns the horizontal offset between parallel segments of links. More...
 
IlvPos getHorizontalNodeLinkOffset () const
 Returns the horizontal offset between a node and a link segment that is parallel to the node border. More...
 
IlvPos getHorizontalNodeOffset () const
 Returns the horizontal offset between nodes. More...
 
IlvDirection getLevelJustification () const
 Returns the current justification within the levels. More...
 
IlDouble getLinkPriority (IlAny link) const
 Returns the priority of a link. More...
 
IlvLayoutLinkStyle getLinkStyle (IlAny link) const
 Returns the current option for the style of the shape of an individual link. More...
 
IlInt getSpecNodeLevelIndex (IlAny node) const
 Returns the index of the specified level for a node. More...
 
IlInt getSpecNodePositionIndex (IlAny node) const
 Returns the index of the specified position of a node within a level. More...
 
IlvPos getVerticalLinkOffset () const
 Returns the vertical offset between parallel segments of links. More...
 
IlvPos getVerticalNodeLinkOffset () const
 Returns the vertical offset between a node and a link segment that is parallel to the node border. More...
 
IlvPos getVerticalNodeOffset () const
 Returns the vertical offset between nodes. More...
 
void setConnectorStyle (IlvLayoutConnectorStyle style)
 Sets the option for the style of connectors. More...
 
void setFlowDirection (IlvDirection flowDirection)
 Sets the option for direction of the link flow. More...
 
void setGlobalLinkStyle (IlvLayoutLinkStyle style)
 Sets the option for the global style of the shapes of links. More...
 
void setHorizontalLinkOffset (IlvPos offset)
 Sets the horizontal offset between parallel segments of links. More...
 
void setHorizontalNodeLinkOffset (IlvPos offset)
 Sets the horizontal offset between a node and a link segment that is parallel to the node border. More...
 
void setHorizontalNodeOffset (IlvPos offset)
 Sets the horizontal offset between nodes. More...
 
void setLevelJustification (IlvDirection justification)
 Sets the option for the justification within the levels. More...
 
void setLinkPriority (IlAny link, IlDouble priority)
 Sets the priority of a link. More...
 
void setLinkStyle (IlAny link, IlvLayoutLinkStyle style)
 Sets the option for the style of the shape of an individual link. More...
 
void setSpecNodeLevelIndex (IlAny node, IlInt index)
 Sets the index of the specified level for a node. More...
 
void setSpecNodePositionIndex (IlAny node, IlInt index)
 Sets the index of the specified position of a node within a level. More...
 
void setVerticalLinkOffset (IlvPos offset)
 Sets the vertical offset between parallel segments of links. More...
 
void setVerticalNodeLinkOffset (IlvPos offset)
 Sets the vertical offset between a node and a link segment that is parallel to the node border. More...
 
void setVerticalNodeOffset (IlvPos offset)
 Sets the vertical offset between nodes. More...
 
virtual IlBoolean supportsAllowedTime () const
 Indicates that this layout class can stop the layout computation in a proper manner when the user-defined allowed time is exceeded. More...
 
virtual IlBoolean supportsPreserveFixedLinks () const
 Indicates that this layout class allows the user to specify fixed links. More...
 
virtual IlBoolean supportsPreserveFixedNodes () const
 Indicates that this layout class allows the user to specify fixed nodes. More...
 
- Public Member Functions inherited from IlvGraphLayout
 IlvGraphLayout ()
 Constructor.
 
virtual void attach (IlvGrapher *grapher)
 Allows you to specify the grapher you want to lay out. More...
 
virtual void attach (IlvGraphModel *graphModel)
 Allows you to specify the graph model you want to lay out. More...
 
virtual IlvRunTimeType getAllowedTime () const
 Returns the currently allowed time for the layout algorithm in milliseconds. More...
 
IlvMgrViewgetFirstManagerView () const
 Returns the first manager view attached to the graph model if any, and 0 otherwise.
 
IlvGraphergetGrapher () const
 Returns the grapher to lay out. More...
 
IlvGraphModelgetGraphModel () const
 Returns the graph model to lay out if a graph model is attached. More...
 
IlUInt getInstanceId () const
 A utility method that returns a unique integer value for each layout instance inside the same program.
 
void getLayoutRegion (IlvRect &rect) const
 Updates the rectangle rect passed as argument with the region that the drawing of the graph model must fit (exactly or approximately). More...
 
IlvGraphLayoutReportgetLayoutReport () const
 Returns the layout report, that is, an object containing information about the behavior of the layout algorithm for the previous run of layout. More...
 
virtual IlUShort getSeedValueForRandomGenerator ()
 Returns the user-defined seed value for the random generator. More...
 
IlBoolean isAnimate () const
 Returns IlTrue if the layout can perform a redraw of the graph model after each iteration or step of the layout algorithm. More...
 
IlBoolean isFitToView () const
 Returns IlTrue if the size of the graph drawing must fit (exactly or approximately) the size of a given manager view. More...
 
IlBoolean isFixed (IlAny nodeOrLink) const
 Returns IlTrue if the node or link nodeOrLink is specified as fixed. More...
 
IlBoolean isGeometryUpToDate () const
 Returns IlFalse if at least one node or link was moved or reshaped since the last time the layout was successfully performed on the same graph model or if the layout has never been performed successfully on the same graph model. More...
 
IlBoolean isIlvGrapherAttached () const
 Convenience method. More...
 
IlBoolean isLayoutRunning () const
 Specifies whether the layout algorithm is running. More...
 
virtual IlBoolean isLayoutTimeElapsed () const
 Returns IlTrue if, at the moment the method is called, the allowed layout time is exceeded; returns IlFalse otherwise. More...
 
IlBoolean isLinkConnectorReplacementAllowed () const
 Returns IlTrue if the replacement of the link connectors is allowed. More...
 
virtual IlBoolean isLinkReplacementAllowed () const
 Returns IlTrue if the replacement of the links is allowed. More...
 
virtual IlBoolean isMemorySavings () const
 Returns the current setting specifying whether priority is given to speed or memory usage.
 
virtual IlBoolean isParametersUpToDate () const
 Returns IlFalse if at least one parameter was modified since the last time the layout was successfully performed on the same graph or if the layout has never been performed successfully on the same graph. More...
 
virtual IlBoolean isPreserveFixedLinks () const
 Returns IlTrue if the layout is not allowed to reshape the links indicated as fixed by the user. More...
 
virtual IlBoolean isPreserveFixedNodes () const
 Returns IlTrue if the layout is not allowed to move the nodes indicated as fixed by the user. More...
 
IlBoolean isStructureUpToDate () const
 Indicates whether the graph model structure has been modified since the last layout was performed. More...
 
virtual IlBoolean isUseDefaultParameters () const
 Returns the current options for the parameters. More...
 
virtual IlBoolean isUseSeedValueForRandomGenerator ()
 Returns IlTrue if the user-defined seed value is used for the random generator and IlFalse otherwise. More...
 
void layoutRunning (IlBoolean)
 Updates the field _isLayoutRunning.
 
virtual void layoutStepPerformed ()
 This method can be called by the layout classes when a step (or iteration) of the layout algorithm has been performed. More...
 
IlvGraphLayoutReportperformLayout ()
 Starts the layout algorithm using the currently attached graph model and the current settings for the layout parameters. More...
 
void setAllowedTime (IlvRunTimeType time)
 Allows you to specify an upper bound for the duration of the layout algorithm. More...
 
void setAnimate (IlBoolean arg)
 If arg is IlTrue, all manager views attached to the graph model are redrawn after each iteration or step of the layout algorithm. More...
 
virtual void setFixed (IlAny nodeOrLink, IlBoolean val)
 Allows you to specify whether a node or a link is fixed. More...
 
void setGeometryUpToDate (IlBoolean)
 If the argument is IlFalse, notifies the layout instance that the geometry of the graph was changed since the last time the layout was successfully performed. More...
 
void setGrapher (IlvGrapher *grapher)
 Allows you to specify the grapher you want to lay out. More...
 
void setLayoutRegion (IlvMgrView *view)
 Allows you to specify that the size of the graph drawing must fit (exactly or approximately) the size of a given manager view. More...
 
void setLayoutRegion (IlvMgrView *view, const IlvRect &rect)
 Allows you to specify a region (the rectangle rect) that the layout must fit (exactly or approximately) with the dimensions of the rectangle rect being given in the manager view coordinates. More...
 
void setLayoutRegion (const IlvRect &rect)
 Allows you to specify a rectangle that the layout must fit (exactly or approximately). More...
 
void setLinkConnectorReplacementAllowed (IlBoolean allow)
 Enables or disables the link connector replacement. More...
 
virtual void setLinkReplacementAllowed (IlBoolean)
 Enables or disables the link replacement. More...
 
virtual void setMemorySavings (IlBoolean arg)
 If arg is IlTrue, the layout algorithm uses the implementation that consumes less memory. More...
 
void setParametersUpToDate (IlBoolean)
 If the argument is IlFalse, notifies the layout instance that a parameter value was changed. More...
 
virtual void setPreserveFixedLinks (IlBoolean arg)
 If arg is IlTrue, the layout is not allowed to reshape the links indicated as fixed by the user. More...
 
virtual void setPreserveFixedNodes (IlBoolean arg)
 If the argument is IlTrue, the layout is not allowed to move the nodes indicated as fixed by the user. More...
 
virtual void setSeedValueForRandomGenerator (IlUShort seedValue)
 Allows you to specify a seed value for the random generator. More...
 
void setStructureUpToDate (IlBoolean)
 If the argument is IlFalse, notifies the layout instance that the structure of the graph was changed since the last time the layout was successfully performed. More...
 
virtual void setUseDefaultParameters (IlBoolean arg)
 If the argument is IlTrue, the layout uses the default values of all the parameters, that is, the "get..." and "is..." methods return the default values. More...
 
virtual void setUseSeedValueForRandomGenerator (IlBoolean)
 Allows you to specify whether the user-defined seed value should be used for the random generator. More...
 
virtual IlBoolean supportsAnimation () const
 Indicates whether the layout class performs a redraw of the graph model after each step or iteration. More...
 
virtual IlBoolean supportsLayoutRegion () const
 Indicates whether the layout class can control the size of the graph drawing to fit (exactly or approximately) a user-defined region (a rectangle) or a user-defined manager view. More...
 
virtual IlBoolean supportsMemorySavings () const
 Indicates whether the layout class can perform the layout using two partially different implementations. More...
 
virtual IlBoolean supportsRandomGenerator () const
 Indicates whether the layout class uses randomly-generated numbers (or randomly-chosen parameters) for which it can accept a user-defined seed value. More...
 
void unfixAllLinks ()
 Removes the fixed attributes from all links in the graph model. More...
 
void unfixAllNodes ()
 Removes the fixed attribute from all nodes in the graph model. More...
 

Protected Member Functions

virtual void layout ()
 Computes the layout using the Hierarchical Layout algorithm. More...
 
- Protected Member Functions inherited from IlvGraphLayout
virtual IlvGraphLayoutReportcreateLayoutReport ()
 Returns a new instance of the layout report. More...
 
virtual IlBoolean isLayoutNeeded () const
 Verifies that it is necessary to perform the layout. More...
 

Detailed Description

This is the main class for the Hierarchical Layout algorithm.

Library: ilvhierarchical

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.

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. 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.

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:

Constructor & Destructor Documentation

IlvHierarchicalLayout::IlvHierarchicalLayout ( )

Creates a new instance of the Hierarchical Layout algorithm.

To indicate the grapher you want to lay out, use the method attach(IlvGrapher*).
To indicate the graph model you want to lay out, use the method attach(IlvGraphModel*).
To perform the layout, use the method performLayout().
To modify the layout parameters, use the different methods provided in this class and its superclass.

See Also
IlvGraphLayout::attach(IlvGrapher*)
IlvGraphLayout::attach(IlvGraphModel*)
IlvGraphLayout::performLayout()
virtual IlvHierarchicalLayout::~IlvHierarchicalLayout ( )
virtual

Destroys this instance of class IlvHierarchicalLayout.

If necessary, it detaches this instance from the graph model or the grapher, respectively, before destroying this layout instance.

Member Function Documentation

virtual void IlvHierarchicalLayout::cleanObjectProperties ( IlAny  nodeOrLink)
virtual

Overridden version of the method cleanObjectProperties.

See Also
IlvGraphLayout::cleanObjectProperties

Reimplemented from IlvGraphLayout.

virtual void IlvHierarchicalLayout::detach ( )
virtual

Detaches the graph model from the layout instance.

When you attach a new graph model to the layout instance, it is not necessary to detach the old graph model because this is done automatically when you call attach. The detach method performs cleaning operations on the graph model or the grapher. Additional to the cleaning operations in the base class, Hierarchical Layout removes the layout specification per node and link as well as the calculated level index and calculated position index from the nodes.

See Also
IlvGraphLayout::attach(IlvGrapher*)
IlvGraphLayout::attach(IlvGraphModel*)
getCalcNodeLevelIndex(IlAny)
getCalcNodePositionIndex(IlAny)

Reimplemented from IlvGraphLayout.

IlInt IlvHierarchicalLayout::getCalcNodeLevelIndex ( IlAny  node) const

Returns the calculated level index of a node after performing a layout.

If there was no call of performLayout before, it returns -1. Nodes are organized in horizontal or vertical levels numbered from 0 to "n". If the link flow direction is from top to bottom, the nodes with level index 0 are placed in the top-most level, and the nodes with higher level indices are placed in the levels below. If the link flow direction is from left to right, the nodes with level index 0 are placed in the left-most level, and the nodes with higher level indices are placed in the levels more to the right.

Note the difference between calculated and specified level index: The layout algorithm assigns level indices to all nodes, even if no level index is specified. Therefore, the method getSpecNodeLevelIndex returns -1 for nodes that have no level index specified, but the method getCalcNodeLevelIndex returns a non-negative number, that is, the real index of the level after layout.

Parameters
nodeA node of the attached grapher or graph model.
Returns
The level index calculated for this node.
See Also
getFlowDirection()
getSpecNodeLevelIndex(IlAny)
detach()
IlvGraphLayout::performLayout()
IlInt IlvHierarchicalLayout::getCalcNodePositionIndex ( IlAny  node) const

Returns the calculated index of the node position within a level after performing a layout.

If there was no call of performLayout before, it returns -1. Nodes are organized in horizontal or vertical levels. Within each level, the nodes are placed sequentially at relative positions numbered from 0 to "n". If the link flow direction is from top to bottom, the node with position index 0 is placed left-most within its level, and the nodes with higher position indices are placed more to the right. If the link flow direction is from left to right, the node with position index 0 is placed top-most within its level, and the nodes with higher position indices are placed below.

Note the difference between calculated and specified position index: The layout algorithm assigns position indices to all nodes, even if no position index is specified. Therefore, the method getSpecNodePositionIndex returns -1 for nodes that have no position index specified, but the method getCalcNodePositionIndex returns a non-negative number, that is, the real index of the position within its level after layout.

Parameters
nodeA node of the attached grapher or graph model.
Returns
The position index calculated for this node.
See Also
getFlowDirection()
getSpecNodePositionIndex(IlAny)
detach()
IlvGraphLayout::performLayout()
IlvLayoutConnectorStyle IlvHierarchicalLayout::getConnectorStyle ( ) const

Returns the current option for the style of the connectors.

Returns
The style of the placement of connector pins for links.
See Also
setConnectorStyle(IlvLayoutConnectorStyle)
IlvDirection IlvHierarchicalLayout::getFlowDirection ( ) const

Returns the current direction of the link flow.

Returns
The direction the majority of the links flow into.
See Also
setFlowDirection(IlvDirection)
IlvLayoutLinkStyle IlvHierarchicalLayout::getGlobalLinkStyle ( ) const

Returns the current option for the global style of the shapes of links.

Returns
The global style of the shape of all links.
See Also
setGlobalLinkStyle(IlvLayoutLinkStyle)
IlvPos IlvHierarchicalLayout::getHorizontalLinkOffset ( ) const

Returns the horizontal offset between parallel segments of links.

Returns
The horizontal offset between links.
See Also
setHorizontalLinkOffset(IlvPos)
IlvPos IlvHierarchicalLayout::getHorizontalNodeLinkOffset ( ) const

Returns the horizontal offset between a node and a link segment that is parallel to the node border.

Returns
The horizontal offset between a node and a link.
See Also
setHorizontalNodeLinkOffset(IlvPos)
IlvPos IlvHierarchicalLayout::getHorizontalNodeOffset ( ) const

Returns the horizontal offset between nodes.

Returns
The horizontal offset between nodes.
See Also
setHorizontalNodeOffset(IlvPos)
IlvDirection IlvHierarchicalLayout::getLevelJustification ( ) const

Returns the current justification within the levels.

Returns
The justification of the nodes within each level.
See Also
setLevelJustification(IlvDirection)
IlDouble IlvHierarchicalLayout::getLinkPriority ( IlAny  link) const

Returns the priority of a link.

Parameters
linkA link of the attached grapher or graph model.
Returns
The priority of this link.
See Also
setLinkPriority(IlAny, IlDouble)
IlvLayoutLinkStyle IlvHierarchicalLayout::getLinkStyle ( IlAny  link) const

Returns the current option for the style of the shape of an individual link.

Parameters
linkA link of the attached grapher or graph model.
Returns
The style of the shape of this link.
See Also
setGlobalLinkStyle(IlvLayoutLinkStyle)
setLinkStyle(IlAny, IlvLayoutLinkStyle)
IlInt IlvHierarchicalLayout::getSpecNodeLevelIndex ( IlAny  node) const

Returns the index of the specified level for a node.

If no level index is specified for the node, it returns a negative number.

Parameters
nodeA node of the attached grapher or graph model.
Returns
The level index specified for this node.
See Also
setSpecNodeLevelIndex(IlAny, IlInt)
getCalcNodeLevelIndex(IlAny)
IlInt IlvHierarchicalLayout::getSpecNodePositionIndex ( IlAny  node) const

Returns the index of the specified position of a node within a level.

If no position index is specified for the node, it returns a negative number.

Parameters
nodeA node of the attached grapher or graph model.
Returns
The position index specified for this node.
See Also
setSpecNodePositionIndex(IlAny, IlInt)
getCalcNodePositionIndex()
IlvPos IlvHierarchicalLayout::getVerticalLinkOffset ( ) const

Returns the vertical offset between parallel segments of links.

Returns
The vertical offset between links.
See Also
setVerticalLinkOffset(IlvPos)
IlvPos IlvHierarchicalLayout::getVerticalNodeLinkOffset ( ) const

Returns the vertical offset between a node and a link segment that is parallel to the node border.

Returns
The vertical offset between a node and a link.
See Also
setVerticalNodeLinkOffset(IlvPos)
IlvPos IlvHierarchicalLayout::getVerticalNodeOffset ( ) const

Returns the vertical offset between nodes.

Returns
The vertical offset between nodes.
See Also
setVerticalNodeOffset(IlvPos)
virtual void IlvHierarchicalLayout::layout ( )
protectedvirtual

Computes the layout using the Hierarchical Layout algorithm.

To start the layout, call the method performLayout.

See Also
IlvGraphLayout::performLayout()

Implements IlvGraphLayout.

void IlvHierarchicalLayout::setConnectorStyle ( IlvLayoutConnectorStyle  style)

Sets the option for the style of connectors.

Valid values are:

  • IlvLayoutCenteredPins - the link connector pins are placed in the center of the border the link is attached to.
  • IlvLayoutClippedPins - each link pointing to the center of the node is clipped at the node border.
  • IlvLayoutEvenlySpacedPins - the link connector pins are evenly spaced along the node border.
  • IlvLayoutAutomaticPins - the connector style is selected depending on the link style.

The default value is IlvLayoutAutomaticPins.

Note that, when the graph attached to the layout is of type IlvGrapher, the connector style only has an effect if a pin is installed at the nodes.

If the method isLinkReplacementAllowed returns IlTrue, the layout algorithm calls the method ensureReshapeableLinks to ensure that the connector pins of all the links can be repositioned. It installs a subclass of IlvGrapherPin at the nodes.

Parameters
styleThe style of the placement of connector pins for links.
See Also
getConnectorStyle()
IlvGraphLayout::setLinkReplacementAllowed(IlBoolean)
IlvGraphModel::ensureReshapeableLinks(IlvGraphLayout*)
void IlvHierarchicalLayout::setFlowDirection ( IlvDirection  flowDirection)

Sets the option for direction of the link flow.

Valid values are:

  • IlvRight - the majority of the links flow to the right.
  • IlvLeft - the majority of the links flow to the left.
  • IlvBottom - the majority of the links flow to the bottom.
  • IlvTop - the majority of the links flow to the top.

This method sets the direction of the flow for the majority of the links in a directed graph. The layout algorithm may need to direct some links in the opposite direction of the general link flow. If the links flow to the left or right, the nodes are placed in vertical levels. If the links flow to the top or bottom, the nodes are placed in horizontal levels.

The default value is IlvRight.

Parameters
flowDirectionThe direction the majority of the links flow into.
See Also
getFlowDirection()
void IlvHierarchicalLayout::setGlobalLinkStyle ( IlvLayoutLinkStyle  style)

Sets the option for the global style of the shapes of links.

Valid values are:

  • IlvLayoutPolylineLinkStyle - all links get a polyline shape, that is, a shape consisting of a sequence of line segments.
  • IlvLayoutOrthogonalLinkStyle - all links get an orthogonal shape, that is, a shape consisting of a sequence of orthogonal line segments.
  • IlvLayoutStraightLineLinkStyle - all links get a straight-line shape.
  • IlvLayoutNoReshapeLinkStyle - no reshape is performed on any link.
  • IlvLayoutMixedLinkStyle - each link can have a different link style. In this case, the style of each individual link can be set by the method setLinkStyle(IlAny, IlvLayoutLinkStyle), such that different link shapes can occur in the same graph.

This feature can be useful if the graph contains links that can have intermediate points and are not straight-line links, for instance links of type IlvPolylineLinkImage. Unless the global link style is IlvLayoutMixedLinkStyle, all links have the same style of shape.

The default value is IlvLayoutPolylineLinkStyle.

Note that, when the graph attached to the layout is of type IlvGrapher, the effect of the link reshaping depends on the type of link. For the following link types, the reshaping has no effect:

If the method isLinkReplacementAllowed returns IlTrue, the layout algorithm calls the method ensureReshapeableLinks to ensure that all the links can be reshaped. It replaces the non-reshapeable links by links of type IlvPolylineLinkImage.

Parameters
styleThe global style of the shape of all links.
See Also
getGlobalLinkStyle()
setLinkStyle(IlAny, IlvLayoutLinkStyle)
IlvGraphLayout::setLinkReplacementAllowed(IlBoolean)
IlvGraphModel::ensureReshapeableLinks(IlvGraphLayout*)
void IlvHierarchicalLayout::setHorizontalLinkOffset ( IlvPos  offset)

Sets the horizontal offset between parallel segments of links.

In the orthogonal link style, the segments attached directly to the node may have a smaller offset if the node is too small or the number of incident links is too large to satisfy the specified offset.

The default value is 15.

Parameters
offsetThe horizontal offset between links.
See Also
getHorizontalLinkOffset()
void IlvHierarchicalLayout::setHorizontalNodeLinkOffset ( IlvPos  offset)

Sets the horizontal offset between a node and a link segment that is parallel to the node border.

The default value is 20.

Parameters
offsetThe horizontal offset between a node and a link.
See Also
getHorizontalNodeLinkOffset()
void IlvHierarchicalLayout::setHorizontalNodeOffset ( IlvPos  offset)

Sets the horizontal offset between nodes.

If the levels are horizontal, this is the minimum distance between the nodes of the same level. If the levels are vertical, this is the minimum distance between the nodes of different levels.

The default value is 40.

Parameters
offsetThe horizontal offset between nodes.
See Also
getHorizontalNodeOffset()
void IlvHierarchicalLayout::setLevelJustification ( IlvDirection  justification)

Sets the option for the justification within the levels.

Valid values are:

  • IlvCenter
  • IlvLeft
  • IlvRight
  • IlvTop
  • IlvBottom

This method sets the justification of the nodes within each level. If the nodes are center justified, all nodes of the same level are placed with their centers along a line. Otherwise, all nodes of the same level are placed with the specified border justified to a line. If the link flow direction is to the left or right, the nodes can be justified to the left, center, or right. If the link flow direction is to the top or bottom, the nodes can be justified to the top, center, or bottom.

The default value is CENTER.

Parameters
justificationThe justification of the nodes within each level.
See Also
getLevelJustification()
setFlowDirection(IlvDirection)
void IlvHierarchicalLayout::setLinkPriority ( IlAny  link,
IlDouble  priority 
)

Sets the priority of a link.

The layout algorithm tries to place the links in a way such that the majority of the links are short and point in the same direction. However, this is not always possible for all links. Low priority links are more likely to be longer or point in the opposite direction than the high priority links.

Parameters
linkA link of the attached grapher or graph model.
priorityThe priority of this link.
See Also
getLinkPriority(IlAny)
void IlvHierarchicalLayout::setLinkStyle ( IlAny  link,
IlvLayoutLinkStyle  style 
)

Sets the option for the style of the shape of an individual link.

This link style is only used if the global link style is set to IlvLayoutMixedLinkStyle. Otherwise, all links have the style that is specified as the global link style.

Valid values are:

  • IlvLayoutPolylineLinkStyle - the link gets a polyline shape, that is, a shape consisting of a sequence of line segments.
  • IlvLayoutOrthogonalLinkStyle - the link gets an orthogonal shape, that is, a shape consisting of a sequence of orthogonal line segments.
  • IlvLayoutStraightLineLinkStyle - the link gets a straight-line shape.
  • IlvLayoutNoReshapeLinkStyle - no reshape is performed on the link.

This feature can be useful if the link can have intermediate points and is not a straight-line link, for instance a link of type IlvPolylineLinkImage.

The default value is IlvLayoutPolylineLinkStyle.

Note that, when the graph attached to the layout is of type IlvGrapher, the effect of the link reshaping depends on the type of link. For the following link types, the reshaping has no effect:

If the method isLinkReplacementAllowed returns IlTrue, the layout algorithm calls the method ensureReshapeableLinks to ensure that all the links can be reshaped. It replaces the non-reshapeable links by links of type IlvPolylineLinkImage.

Parameters
linkA link of the attached grapher or graph model.
styleThe style of the shape of this link.
See Also
setGlobalLinkStyle(IlvLayoutLinkStyle)
getLinkStyle(IlAny)
IlvGraphLayout::setLinkReplacementAllowed(IlBoolean)
IlvGraphModel::ensureReshapeableLinks(IlvGraphLayout*)
void IlvHierarchicalLayout::setSpecNodeLevelIndex ( IlAny  node,
IlInt  index 
)

Sets the index of the specified level for a node.

Nodes are organized in horizontal or vertical levels numbered from 0 to "n". If the link flow direction is from top to bottom, the nodes with level index 0 are placed in the top-most level, and the nodes with higher level indices are placed in the levels below. If the link flow direction is from left to right, the nodes with level index 0 are placed in the left-most level, and the nodes with higher level indices are placed in the levels more to the right.

This method allows you to specify the level where a node should be placed. If the level index of a node is set to a negative value, it means that there is no preference for the level of the node. In this case, the layout algorithm calculates an appropriate level index.

The default level index of a node is -1, that is, the layout algorithm determines the appropriate level automatically.

Parameters
nodeA node of the attached grapher or graph model.
indexThe level index desired for this node.
See Also
getFlowDirection()
getSpecNodeLevelIndex(IlAny)
void IlvHierarchicalLayout::setSpecNodePositionIndex ( IlAny  node,
IlInt  index 
)

Sets the index of the specified position of a node within a level.

Nodes are organized in horizontal or vertical levels. Within each level, the nodes are placed sequentially at relative positions numbered from 0 to "n". If the link flow direction is from top to bottom, the node with position index 0 is placed left-most within its level, and the nodes with higher position indices are placed more to the right. If the link flow direction is from left to right, the node with position index 0 is placed top-most within its level, and the nodes with higher position indices are placed below.

This method allows you to specify the relative position where a node should be placed within its level. If the position index of a node is set to a negative value, it means that there is no preference for the position of the node. In this case, the layout algorithm calculates an appropriate position index. If the position index is higher than the number of nodes in the level, the position index is ignored. If two nodes of the same level have the same position index, one of the indices is ignored. The layout algorithm calculates an appropriate position index for the nodes that have inappropriate or conflicting position indices.

The default position index of a node is -1, that is, the layout algorithm determines the appropriate position automatically.

Parameters
nodeA node of the attached grapher or graph model.
indexThe position index desired for this node.
See Also
getFlowDirection()
getSpecNodePositionIndex(IlAny)
void IlvHierarchicalLayout::setVerticalLinkOffset ( IlvPos  offset)

Sets the vertical offset between parallel segments of links.

In the orthogonal link style, the segments attached directly to the node may have a smaller offset if the node is too small or the number of incident links is too large to satisfy the specified offset.

The default value is 15.

Parameters
offsetThe vertical offset between links.
See Also
getVerticalLinkOffset()
void IlvHierarchicalLayout::setVerticalNodeLinkOffset ( IlvPos  offset)

Sets the vertical offset between a node and a link segment that is parallel to the node border.

The default value is 20.

Parameters
offsetThe vertical offset between a node and a link.
See Also
getVerticalNodeLinkOffset()
void IlvHierarchicalLayout::setVerticalNodeOffset ( IlvPos  offset)

Sets the vertical offset between nodes.

If the levels are vertical, this is the minimum distance between the nodes of the same level. If the levels are horizontal, this is the minimum distance between the nodes of different levels.

The default value is 40.

Parameters
offsetThe vertical offset between nodes.
See Also
getVerticalNodeOffset()
virtual IlBoolean IlvHierarchicalLayout::supportsAllowedTime ( ) const
virtual

Indicates that this layout class can stop the layout computation in a proper manner when the user-defined allowed time is exceeded.

If the allowed time elapses before termination of the Hierarchical Layout algorithm, the nodes and links are not moved and remain at the same position as before the start of the algorithm.

Returns
Always IlTrue.
See Also
IlvGraphLayout::setAllowedTime(IlvRunTimeType)

Reimplemented from IlvGraphLayout.

virtual IlBoolean IlvHierarchicalLayout::supportsPreserveFixedLinks ( ) const
virtual

Indicates that this layout class allows the user to specify fixed links.

Fixed links are not reshaped during the layout if IlTrue is passed as the argument to the method setPreserveFixedLinks(IlBoolean).

Returns
Always IlTrue.
See Also
IlvGraphLayout::setPreserveFixedLinks(IlBoolean)
setGlobalLinkStyle(IlvLayoutLinkStyle)
setLinkStyle(IlAny, IlvLayoutLinkStyle)

Reimplemented from IlvGraphLayout.

virtual IlBoolean IlvHierarchicalLayout::supportsPreserveFixedNodes ( ) const
virtual

Indicates that this layout class allows the user to specify fixed nodes.

Fixed nodes are not moved during the layout if IlTrue is passed as the argument to the method setPreserveFixedNodes(IlBoolean). Links that are incident to fixed nodes are not reshaped during the layout. Fixed nodes are ignored by the Hierarchical Layout algorithm, which may lead to node overlapping.

Returns
Always IlTrue.
See Also
IlvGraphLayout::setPreserveFixedNodes(IlBoolean)

Reimplemented from IlvGraphLayout.


© Copyright 2012, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.