rwlogo

Rogue Wave Views
Graph Layout Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

 All Classes Files Functions Variables Typedefs Enumerations Enumerator
List of all members | Public Member Functions | Protected Member Functions
IlvOrthogonalLinkLayout Class Reference

This class is the base class for the Orthogonal Link Layout algorithm. More...

#include <ilviews/layout/orthlink.h>

Inheritance diagram for IlvOrthogonalLinkLayout:
IlvGraphLayout

Public Member Functions

 IlvOrthogonalLinkLayout ()
 Creates a new instance of the Orthogonal Link Layout algorithm. More...
 
void cleanObjectProperties (IlAny nodeOrLink)
 Overridden version of the method cleanObjectProperties(). More...
 
void detach ()
 Detaches the graph model from the layout instance. More...
 
virtual IlUInt getAllowedNumberOfIterations () const
 Returns the maximum number of allowed optimization iterations. More...
 
IlvOrthogonalLinkBundleMode getLinkBundlesMode () const
 Returns the current value of the link bundles mode. More...
 
IlvNodeBoxInterface * getLinkConnectionRectangle () const
 Returns the object that provides the rectangle on which the connection points of its adjacent links must be located. More...
 
virtual IlUInt getLinkOffset () const
 Returns the minimum length of the final segment of the links. More...
 
virtual IlvLayoutLinkStyle getLinkStyle () const
 Returns the style of the links shape. More...
 
IlUInt getLinkToLinkCrossingPenalty () const
 Returns the link-to-link crossing penalty factor. More...
 
IlUInt getLinkToNodeCrossingPenalty () const
 Returns the link-to-node crossing penalty factor. More...
 
virtual IlUInt getMinFinalSegmentLength () const
 Returns the minimum length of the final segment of the links. More...
 
IlvNodeSideFiltergetNodeSideFilter () const
 Returns the object that allows or prohibits the connection of the links on a given side of the nodes. More...
 
IlBoolean isAutoLayout () const
 Indicates whether the auto layout mode is enabled or not. More...
 
IlBoolean isSameShapeForMultipleLinks () const
 Specifies whether the algorithm ensures that multiple links are reshaped in the same manner. More...
 
void setAllowedNumberOfIterations (IlUInt)
 Allows you to specify the maximum number of iterations of the layout algorithm. More...
 
void setAutoLayout (IlBoolean enable)
 Enables or disables the auto layout mode. More...
 
void setLinkBundlesMode (IlvOrthogonalLinkBundleMode mode)
 Allows you to specify the link bundle mode. More...
 
void setLinkConnectionRectangle (IlvNodeBoxInterface *)
 Allows you to specify an object that provides, for each node, the rectangle on which the connection points of its adjacent links must be located. More...
 
virtual void setLinkOffset (IlUInt offset)
 Allows you to specify the offset between links connected on the same side of the node. More...
 
virtual void setLinkStyle (IlvLayoutLinkStyle style)
 Sets the style of the links shape. More...
 
void setLinkToLinkCrossingPenalty (IlUInt)
 Sets the link-to-link crossing penalty factor. More...
 
void setLinkToNodeCrossingPenalty (IlUInt)
 Sets the link-to-node crossing penalty factor. More...
 
virtual void setMinFinalSegmentLength (IlUInt)
 Allows you to specify the minimum length of the final segment of the links. More...
 
void setNodeSideFilter (IlvNodeSideFilter *)
 Allows you to specify an object that allows or prohibits the connection of the links on a given side of the nodes. More...
 
void setSameShapeForMultipleLinks (IlBoolean)
 Allows you to specify whether the layout algorithm must ensure that all multiple links have the same shape. More...
 
IlBoolean supportsAllowedTime () const
 Indicates that this layout class can stop the layout computation in the proper manner when the user-defined allowed time is exceeded. More...
 
IlBoolean supportsAnimation () const
 Indicates that this layout class supports the animation mechanism. More...
 
IlBoolean supportsPreserveFixedLinks () const
 Indicates that this layout class allows the user to specify fixed links. 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 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 supportsPreserveFixedNodes () const
 Indicates whether the layout class allows the user to specify fixed nodes. 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 Orthogonal 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 class is the base class for the Orthogonal Link Layout algorithm.

Library: ilvorthlink

This algorithm reshapes the links of a graph without moving the nodes. By default, the algorithm computes orthogonal links (that is, links composed of alternating horizontal and vertical segments). Optionally, direct links can be computed (see the method setLinkStyle(IlvLayoutLinkStyle)).

Sample drawings produced by the Orthogonal Link Layout algorithm:

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

IlvOrthogonalLinkLayout::IlvOrthogonalLinkLayout ( )

Creates a new instance of the Orthogonal Link 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().

Member Function Documentation

void IlvOrthogonalLinkLayout::cleanObjectProperties ( IlAny  nodeOrLink)
virtual

Overridden version of the method cleanObjectProperties().

See Also
IlvGraphLayout::cleanObjectProperties().

Reimplemented from IlvGraphLayout.

void IlvOrthogonalLinkLayout::detach ( )
virtual

Detaches the graph model from the layout instance.

When a new graph model is attached to the layout instance, it is not necessary to detach the previously attached graph model because this is done automatically when the methods attach(IlvGrapher*) or attach(IlvGraphModel*) are called.

This method performs cleaning operations on the graph model (for example, properties added to the graph model objects are removed) and reinitializes the parameters related to animation and the layout region.

Subclasses can override this method to remove additional information stored in the graph model.

See Also
setAnimate(IlBoolean))
setLayoutRegion(const IlvRect&)
attach(IlvGrapher*)
attach(IlvGraphModel*).
Note
You must call this method when you no longer need the layout instance; otherwise some objects may not be deleted.

Reimplemented from IlvGraphLayout.

virtual IlUInt IlvOrthogonalLinkLayout::getAllowedNumberOfIterations ( ) const
virtual

Returns the maximum number of allowed optimization iterations.

See Also
setAllowedNumberOfIterations().
IlvOrthogonalLinkBundleMode IlvOrthogonalLinkLayout::getLinkBundlesMode ( ) const

Returns the current value of the link bundles mode.

See Also
setLinkBundlesMode(IlvLayoutLinkStyle).
IlvNodeBoxInterface* IlvOrthogonalLinkLayout::getLinkConnectionRectangle ( ) const

Returns the object that provides the rectangle on which the connection points of its adjacent links must be located.

Returns the object that provides, for each node, the rectangle on which the connection points of its adjacent links must be located, if one is specified using the method setLinkConnectionPointsRectangle(IlvNodeBoxInterface*). Returns 0 otherwise.

See Also
setLinkConnectionRectangle(IlvNodeBoxInterface*).
virtual IlUInt IlvOrthogonalLinkLayout::getLinkOffset ( ) const
virtual

Returns the minimum length of the final segment of the links.

The default value is 2.

See Also
setLinkOffset().
virtual IlvLayoutLinkStyle IlvOrthogonalLinkLayout::getLinkStyle ( ) const
virtual

Returns the style of the links shape.

See Also
setLinkStyle(IlvLayoutLinkStyle).
IlUInt IlvOrthogonalLinkLayout::getLinkToLinkCrossingPenalty ( ) const

Returns the link-to-link crossing penalty factor.

When choosing the optimal shape for the links, the algorithm computes a penalty function expressed in the following manner:

Link_to_Link_Penalty * #Link_to_Link_Crossings + Link_to_Node_Penalty * #Link_to_Node_Crossings

The default value is 1.

See Also
setLinkToLinkCrossingPenalty().
IlUInt IlvOrthogonalLinkLayout::getLinkToNodeCrossingPenalty ( ) const

Returns the link-to-node crossing penalty factor.

When choosing the optimal shape for the links, the algorithm computes a penalty function expressed in the following manner:

Link_to_Link_Penalty * #Link_to_Link_Crossings + Link_to_Node_Penalty * #Link_to_Node_Crossings

The default value is 1.

See Also
setLinkToNodeCrossingPenalty().
virtual IlUInt IlvOrthogonalLinkLayout::getMinFinalSegmentLength ( ) const
virtual

Returns the minimum length of the final segment of the links.

See Also
setMinFinalSegmentLength(IlUInt).
IlvNodeSideFilter* IlvOrthogonalLinkLayout::getNodeSideFilter ( ) const

Returns the object that allows or prohibits the connection of the links on a given side of the nodes.

Returns the object that allows or prohibits the connection of the links on a given side of the nodes, if one is specified using the method setNodeSideFilter(IlvNodeSideFilter*). Returns 0 otherwise.

See Also
setNodeSideFilter().
IlBoolean IlvOrthogonalLinkLayout::isAutoLayout ( ) const

Indicates whether the auto layout mode is enabled or not.

Returns IlTrue if the auto layout mode is enabled. Returns IlFalse otherwise.

See Also
setAutoLayout(IlBoolean).
IlBoolean IlvOrthogonalLinkLayout::isSameShapeForMultipleLinks ( ) const

Specifies whether the algorithm ensures that multiple links are reshaped in the same manner.

Returns IlTrue if it is enabled, and IlFalse otherwise.

See Also
setSameShapeForMultipleLinks(IlBoolean).
virtual void IlvOrthogonalLinkLayout::layout ( )
protectedvirtual

Computes the layout using the Orthogonal Layout algorithm.

To start the layout, call the method IlvGraphLayout::performLayout().

See Also
IlvGraphLayout::performLayout()
IlvGraphLayout::getLayoutRegion(IlvRect&).

Implements IlvGraphLayout.

void IlvOrthogonalLinkLayout::setAllowedNumberOfIterations ( IlUInt  )

Allows you to specify the maximum number of iterations of the layout algorithm.

See Also
getAllowedNumberOfIterations().
void IlvOrthogonalLinkLayout::setAutoLayout ( IlBoolean  enable)

Enables or disables the auto layout mode.

If the argument is IlTrue, the layout is automatically reperformed each time the layout instance is notified that the geometry or the structure of the graph have changed.

The default value is IlTrue.

See Also
contentsChanged(GraphModelEvent).
void IlvOrthogonalLinkLayout::setLinkBundlesMode ( IlvOrthogonalLinkBundleMode  mode)

Allows you to specify the link bundle mode.

The valid values of the argument mode are the following:

  • IlvOrthogonalLinkNoBundle: Several links connected to the same side of a node share the same connection point, that is, the middle of the node side. The final segments of the links overlap. No bundles are created and the link offset parameter is ignored.

  • IlvOrthogonalLinkFirstLastSegment: The connection points of several links connected to the same side of a node are distributed according to the link offset value. With the orthogonal link style, the algorithm also ensures that the first and last segments of the links are always orthogonal to the side of the node to which they are connected.

  • IlvOrthogonalLinkImprovedFirstLastSegment: The algorithm also tries to avoid overlapping the second segment and the segment before the last.

Note that with the direct link style, this option is equivalent to IlvOrthogonalLinkFirstLastSegment.

IlvOrthogonalLinkImprovedFirstLastSegment is the default value.

Parameters
modeThe link bundle mode.
See Also
getLinkBundlesMode().
void IlvOrthogonalLinkLayout::setLinkConnectionRectangle ( IlvNodeBoxInterface *  )

Allows you to specify an object that provides, for each node, the rectangle on which the connection points of its adjacent links must be located.

If you do not call this method, the layout algorithm locates the connection points on the bounding box of the node (see IlvGraphModel::boundingBox(IlvRect&)).

You can call this method with 0 as parameter in order to revert to the default behavior.

See Also
getLinkConnectionRectangle().
virtual void IlvOrthogonalLinkLayout::setLinkOffset ( IlUInt  offset)
virtual

Allows you to specify the offset between links connected on the same side of the node.

The default value is 2.

See Also
getLinkOffset().
virtual void IlvOrthogonalLinkLayout::setLinkStyle ( IlvLayoutLinkStyle  style)
virtual

Sets the style of the links shape.

Valid values are the following:

  • IlvLayoutDirectLinkStyle: The shape of the links is a polyline composed of a straight-line segment between the end nodes with two horizontal or vertical segments at its extremities (their length is controlled by the setMinFinalSegmentLength(IlUInt) method and may be 0).
  • IlvLayoutOrthogonalLinkStyle: The shape of the links is a polyline composed of alternating horizontal and vertical segments.

If the method isLinkReplacementAllowed() returns IlTrue, the layout calls the method IlvGraphModel::ensureReshapeableLinks(IlvGraphLayout*) with to ensure that all the links can be reshaped as needed. Note that, in this case, the links that cannot be reshaped can be replaced with new links of a different type. For details, see the documentation of the method IlvGraphModel::ensureReshapeableLinks(IlvGraphLayout*).

The default value is IlvLayoutOrthogonalLinkStyle.

See Also
getLinkStyle().
void IlvOrthogonalLinkLayout::setLinkToLinkCrossingPenalty ( IlUInt  )

Sets the link-to-link crossing penalty factor.

The default value is 1.

See Also
getLinkToLinkCrossingPenalty().
void IlvOrthogonalLinkLayout::setLinkToNodeCrossingPenalty ( IlUInt  )

Sets the link-to-node crossing penalty factor.

The default value is 1.

See Also
getLinkToNodeCrossingPenalty().
virtual void IlvOrthogonalLinkLayout::setMinFinalSegmentLength ( IlUInt  )
virtual

Allows you to specify the minimum length of the final segment of the links.

See Also
getMinFinalSegmentLength().
void IlvOrthogonalLinkLayout::setNodeSideFilter ( IlvNodeSideFilter )

Allows you to specify an object that allows or prohibits the connection of the links on a given side of the nodes.

If you do not call this method, the layout algorithm is free to choose any side of the nodes.

When a filter is specified, the layout algorithm tries to choose for the links only shapes connected to node sides that are allowed by the filter.

Note that the layout algorithm cannot always strictly respect the prescriptions of the filter, especially for the IlvLayoutDirectLinkStyle link style.

You can call this method with 0 as parameter in order to revert to the default behavior.

See Also
getNodeSideFilter().
void IlvOrthogonalLinkLayout::setSameShapeForMultipleLinks ( IlBoolean  )

Allows you to specify whether the layout algorithm must ensure that all multiple links have the same shape.

Multiple links are links that have the same origin and destination nodes.

If the argument is IlTrue, additional work is done to ensure that all multiple links will be reshaped in the same manner.

The default value is IlTrue.

See Also
isSameShapeForMultipleLinks().
IlBoolean IlvOrthogonalLinkLayout::supportsAllowedTime ( ) const
virtual

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

If a subclass does not support this parameter, it must override this method in order to return IlFalse.

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

Reimplemented from IlvGraphLayout.

IlBoolean IlvOrthogonalLinkLayout::supportsAnimation ( ) const
virtual

Indicates that this layout class supports the animation mechanism.

It performs a redraw of the grapher after each iteration if the method setAnimate(IlBoolean) is called with an IlTrue argument.

Returns
Always IlTrue.
See Also
IlvGraphLayout::setAnimate(IlBoolean)
IlvGraphLayout::isAnimate().

Reimplemented from IlvGraphLayout.

IlBoolean IlvOrthogonalLinkLayout::supportsPreserveFixedLinks ( ) const
virtual

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

Fixed links are not reshaped during the layout if the method setPreserveFixedLinks(IlBoolean) is called with an IlTrue argument.

Returns
Always IlTrue.
See Also
IlvGraphLayout::setPreserveFixedLinks(IlBoolean)
IlvGraphLayout::isPreserveFixedLinks().

Reimplemented from IlvGraphLayout.


© Copyright 2015, 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.