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
IlvBusLayout Class Reference

The main class for the Bus Layout algorithm. More...

#include <ilviews/layout/bus.h>

Inheritance diagram for IlvBusLayout:
IlvGraphLayout

Public Member Functions

 IlvBusLayout ()
 Creates a new instance of the Bus Layout algorithm. More...
 
virtual void cleanObjectProperties (IlAny nodeOrLink)
 Overridden version of the method cleanObjectProperties(). More...
 
void createOneLevel (IlvPolyline *)
 Returns the new current value of the index.
 
void detach ()
 Overridden version of the method detach(). More...
 
IlvPolylinegetBus () const
 Returns the current bus node. More...
 
IlUInt getConnectionOnBusMargin () const
 Returns the horizontal offset between the first/last nodes on a given level and the left/right margins of the level. More...
 
IlvPointgetConnectionPoint (IlAny, IlvPolyline *, IlvTransformer *=0)
 Returns the connection point of the link on the bus node. More...
 
IlUInt getHorizontalOffset () const
 Returns the horizontal offset between the nodes placed on the same level of the bus. More...
 
IlInt getIndex (IlAny) const
 Returns the index associated with a node. More...
 
IlUInt getIndexNode () const
 Returns the index of the current node.
 
IlvLayoutLinkStyle getLinkStyle () const
 Returns the current option for the style of the shape of the links. More...
 
IlUInt getMargin () const
 Returns the horizontal offset between the left/right borders of the bus level and the left/right borders of the layout region. More...
 
IlUInt getMarginOnBus () const
 Returns the horizontal offset between the first/last nodes on a given level and the left/right margins of the level. More...
 
IlvBusOrder getOrdering () const
 Returns the option that specifies the ordering of the nodes. More...
 
const IlArray & getVectNodes () const
 Returns a vector of nodes.
 
IlUInt getVerticalOffsetToLevel () const
 Returns the vertical offset between the nodes and the horizontal level of the bus to which they are connected. More...
 
IlUInt getVerticalOffsetToPreviousLevel () const
 Returns the vertical offset between the nodes and the horizontal level of the bus above the nodes. More...
 
void removeUselessPoints (IlvPolyline *bus)
 Removes the points of the polyline that have not been used for drawing the bus. More...
 
void setBus (IlvPolyline *)
 Allows you to specify the bus node. The bus node must be a node contained in the attached graph. More...
 
void setConnectionOnBusMargin (IlUInt value)
 Sets the horizontal offset between the first/last nodes on a given level and the left/right margins of the level. More...
 
void setHorizontalOffset (IlUInt value)
 Sets the horizontal offset between the nodes placed on the same level of the bus. More...
 
void setIndex (IlAny, IlInt)
 Allows you to specify the index of a node. More...
 
void setLinkStyle (IlvLayoutLinkStyle value)
 Sets the option for the style of the links shape. More...
 
void setMargin (IlUInt value)
 Sets the horizontal offset between the left/right borders of the bus level and the left/right borders of the layout region. More...
 
void setMarginOnBus (IlUInt value)
 Sets the horizontal offset between the first/last nodes on a given level and the left/right margins of the level. More...
 
void setOrdering (IlvBusOrder value)
 Allows you to specify how the nodes are arranged on the bus. More...
 
void setVerticalOffsetToLevel (IlUInt value)
 Sets the vertical offset between the nodes and the horizontal level of the bus to which they are connected. More...
 
void setVerticalOffsetToPreviousLevel (IlUInt value)
 Sets the vertical offset between the nodes and the horizontal level of the bus above the nodes. More...
 
IlBoolean supportsLayoutRegion () const
 Indicates that this layout class can control the size of the graph drawing to fit a user-defined region (a rectangle) or a user-defined manager view. More...
 
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 supportsAllowedTime () const
 Indicates whether the layout class can stop the layout computation when a user-defined allowed time is exceeded. 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 supportsMemorySavings () const
 Indicates whether the layout class can perform the layout using two partially different implementations. More...
 
virtual IlBoolean supportsPreserveFixedLinks () const
 Indicates whether the layout class allows the user to specify fixed links. 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

void layout ()
 Computes the layout using the Bus Layout algorithm. More...
 
IlvBusLinkConnector * makeLinkConnector () const
 Creates a new instance of the link connector. 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

The main class for the Bus Layout algorithm.

Library: ilvbus

The Bus Layout algorithm is designed to display bus network topologies, that is, a set of nodes connected to a bus node. The algorithm takes into account the size of the nodes (so that no nodes overlap) and provides several ordering options.

The following drawing is an example produced with the Bus Layout algorithm:

To use this layout style, you must specify a node of the attached graph model as the "bus" using the method setBus(). The bus node must be an instance of a class that implements the interface IlvPolyline, for instance an IlvPolyline (or a subclass). The layout algorithm gives the bus polyline the appropriate shape by moving, adding, or removing points as needed. Therefore, the initial number of points and the position of those points are not significant. Note that you can use for the bus object only subclasses of IlvPolyPointsInterface for which the methods allowsPointInsertion() and allowsPointRemoval() return IlTrue.

Only the nodes connected to the bus node by a link are taken into account.

The following figure illustrates the dimensional parameters of the layout algorithm.

The algorithm not only computes the shape of the bus node and the position of the nodes connected to the bus but also the connection points of the links on the bus node. These points are computed in such a manner as to obtain vertical links.

If the attached graph model encapsulates an IlvGrapher, the computation of the connection points is provided by a special subclass of IlvGrapherPin. Otherwise, the method getConnectionPoint() is provided to allow you to implement a different mechanism.

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, code samples, parameters, and so on.

Note
The initial position of the nodes (at the moment you start the layout) does not affect the resulting layout. However, nodes specified as fixed are not moved if you call the method setPreserveFixedNodes() with an IlTrue argument.
Multiple links between the nodes and the bus object are supported.

Constructor & Destructor Documentation

IlvBusLayout::IlvBusLayout ( )

Creates a new instance of the Bus Layout algorithm.

To indicate the grapher you want to layout, use the method attach(IlvGrapher).

To indicate the graph model you want to layout, use the method attach(IlvGraphModel).

To indicate the bus node, use the method setBus().

To perform the layout, use the method performLayout().

To modify the layout parameters, use the various methods provided in this class and its superclass.

See Also
IlvGraphLayout::attach(IlvGrapher*)
IlvGraphLayout::attach(IlvGraphModel*)
IlvGraphLayout::performLayout()

Member Function Documentation

virtual void IlvBusLayout::cleanObjectProperties ( IlAny  nodeOrLink)
virtual

Overridden version of the method cleanObjectProperties().

See Also
IlvGraphLayout::cleanObjectProperties().

Reimplemented from IlvGraphLayout.

void IlvBusLayout::detach ( )
virtual

Overridden version of the method detach().

See Also
IlvGraphLayout::detach().

Reimplemented from IlvGraphLayout.

IlvPolyline* IlvBusLayout::getBus ( ) const

Returns the current bus node.

If no bus is specified, or the specified bus object is no longer a valid node of the attached graph (the method IlvGraphModel::isNode() is called), the method automatically searches for a node that is an instance of IlvPolyPointsInterface.

If none is found, the method returns 0.

See Also
setBus().
IlUInt IlvBusLayout::getConnectionOnBusMargin ( ) const

Returns the horizontal offset between the first/last nodes on a given level and the left/right margins of the level.

Note
The following relationship must be respected: getLayoutRegion().width > 2*getMargin() + 2*getMarginOnBus().
See Also
setConnectionOnBusMargin()
getConnectionPoint()
IlvPoint* IlvBusLayout::getConnectionPoint ( IlAny  ,
IlvPolyline ,
IlvTransformer = 0 
)

Returns the connection point of the link on the bus node.

This method is provided to obtain the connection points of the links on the bus node in case the attached graph model does not encapsulate an IlvGrapher. If the attached graph model encapsulates an IlvGrapher, the layout of the links is done by the subclass of IlvGrapherPin and this method is not used.

This method should be used only after having performed the layout, that is, after the bus node has been reshaped. Also, the method should be called only for links that have the bus object as the origin or destination node and that are not self-links (same origin and destination nodes).

See Also
setConnectionOnBusMargin()
getConnectionOnBusMargin()
IlUInt IlvBusLayout::getHorizontalOffset ( ) const

Returns the horizontal offset between the nodes placed on the same level of the bus.

See Also
setHorizontalOffset().
IlInt IlvBusLayout::getIndex ( IlAny  ) const

Returns the index associated with a node.

Returns NoIndex if node has no index.

See Also
setIndex().
IlvLayoutLinkStyle IlvBusLayout::getLinkStyle ( ) const

Returns the current option for the style of the shape of the links.

See Also
setLinkStyle().
IlUInt IlvBusLayout::getMargin ( ) const

Returns the horizontal offset between the left/right borders of the bus level and the left/right borders of the layout region.

See Also
setMargin().
IlUInt IlvBusLayout::getMarginOnBus ( ) const

Returns the horizontal offset between the first/last nodes on a given level and the left/right margins of the level.

Note
The following relationship must be respected: getLayoutRegion().width > 2*getMargin() + 2*getMarginOnBus().
See Also
setMarginOnBus().
IlvBusOrder IlvBusLayout::getOrdering ( ) const

Returns the option that specifies the ordering of the nodes.

See Also
setOrdering().
IlUInt IlvBusLayout::getVerticalOffsetToLevel ( ) const

Returns the vertical offset between the nodes and the horizontal level of the bus to which they are connected.

See Also
setVerticalOffsetToLevel().
IlUInt IlvBusLayout::getVerticalOffsetToPreviousLevel ( ) const

Returns the vertical offset between the nodes and the horizontal level of the bus above the nodes.

See Also
setVerticalOffsetToPreviousLevel().
void IlvBusLayout::layout ( )
protectedvirtual

Computes the layout using the Bus Layout algorithm.

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

See Also
IlvGraphLayout::performLayout(IlBoolean)
IlvGraphLayout::performLayout()
IlvGraphLayout::getLayoutRegion()
getMargin()
getMarginOnBus()

Implements IlvGraphLayout.

IlvBusLinkConnector* IlvBusLayout::makeLinkConnector ( ) const
protected

Creates a new instance of the link connector.

The default implementation returns a new instance of IlvGrapherPin. This method can be overridden to create subclasses of IlvGrapherPin.

Note
The method is intended to be called only when the attached graph is an IlvGrapherAdapter or an IlvGrapher.
See Also
getLinkConnector().
void IlvBusLayout::removeUselessPoints ( IlvPolyline bus)

Removes the points of the polyline that have not been used for drawing the bus.

Parameters
busThe polyline graphic object.
void IlvBusLayout::setBus ( IlvPolyline )

Allows you to specify the bus node. The bus node must be a node contained in the attached graph.

The number of points on the "polypoints" is not significant. The methods allowsPointsInsertion() and allowsPointsRemoval(), defined in IlvPolyPointsInterface, must return IlTrue.

Note
If the attached graph is an IlvGrapher (or IlvGrapherAdapter), this method automatically installs on the bus node the instance of the link connector returned by the method makeLinkConnector().

Remark: It may be useful to restrict users from modifying the bus node. If the bus node is an IlvPolyline contained in an IlvGrapher, you can call the method setEditable() on the grapher instance with an IlFalse parameter.

See Also
getBus().
void IlvBusLayout::setConnectionOnBusMargin ( IlUInt  value)

Sets the horizontal offset between the first/last nodes on a given level and the left/right margins of the level.

Note that, if the attached graph model is an IlvGrapherAdapter, a subclass of IlvGrapherPin is used to compute the connection points of the links on the bus. This subclass provides its own margin parameter. Therefore, the margin parameter for the connection of the links on the bus node is automatically updated according to the current margin specified in the instance of the subclass of IlvGrapherPin. The method setConnectionOnBusMargin() is provided only for the case where the attached graph does not encapsulate an IlvGrapher.

Parameters
valueThe horizontal offset value to set.
See Also
getConnectionOnBusMargin()
getConnectionPoint()
void IlvBusLayout::setHorizontalOffset ( IlUInt  value)

Sets the horizontal offset between the nodes placed on the same level of the bus.

Parameters
valueThe horizontal offset value to set.
See Also
getHorizontalOffset().
void IlvBusLayout::setIndex ( IlAny  ,
IlInt   
)

Allows you to specify the index of a node.

When the layout is performed, the nodes for which indexes have been specified are arranged on the bus in the order corresponding to their index (starting in the upper left corner with the smallest index). The nodes for which indexes have not been specified are arranged after them. You can specify the class variable NoIndex as an index value if you want to reset an index you previously specified.

Note
index must not be negative. The values of the indexes for consecutive nodes are not necessarily consecutive. Only the order of the values is important.
See Also
getIndex().
void IlvBusLayout::setLinkStyle ( IlvLayoutLinkStyle  value)

Sets the option for the style of the links shape.

Valid values are IlvLayoutStraightLineLinkStyle (the links are given a straight-line shape) and IlvLayoutNoReshapeLinkStyle (no reshape is performed on the links).

This feature can be useful if the graph contains links that have intermediate points and are not straight-line links, for instance IlvPolylineLinkImage links with intermediate points. With the option IlvLayoutStraightLineLinkStyle, * if the method isLinkReplacementAllowed() returns IlTrue, the layout calls the method IlvGraphModel::ensureStraightLineLinks() to ensure that all the links have a straight-line shape. Note that in this case the links that cannot have a straight-line shape can be replaced with new links of a different type. For details, see the documentation of the method IlvGraphModel::ensureStraightLineLinks().

The default value is IlvLayoutStraightLineLinkStyle.

Parameters
valueThe style value to set.
See Also
getLinkStyle().
void IlvBusLayout::setMargin ( IlUInt  value)

Sets the horizontal offset between the left/right borders of the bus level and the left/right borders of the layout region.

Note
The following relationship must be respected: getLayoutRegion().width > 2*getMargin() + 2*getMarginOnBus().
Parameters
valueThe horizontal margin value to set.
See Also
getMargin().
void IlvBusLayout::setMarginOnBus ( IlUInt  value)

Sets the horizontal offset between the first/last nodes on a given level and the left/right margins of the level.

Parameters
valueThe horizontal offset value to set.
See Also
getMarginOnBus().
void IlvBusLayout::setOrdering ( IlvBusOrder  value)

Allows you to specify how the nodes are arranged on the bus.

Valid values for the value parameter are IlvBusNoOrdering, IlvBusOrderByHeight, and IlvBusOrderByIndex. The default is IlvBusNoOrdering.

Parameters
valueThe ordering value to set.
See Also
getOrdering().
void IlvBusLayout::setVerticalOffsetToLevel ( IlUInt  value)

Sets the vertical offset between the nodes and the horizontal level of the bus to which they are connected.

Parameters
valueThe vertical offset value to set.
See Also
getVerticalOffsetToLevel().
void IlvBusLayout::setVerticalOffsetToPreviousLevel ( IlUInt  value)

Sets the vertical offset between the nodes and the horizontal level of the bus above the nodes.

Parameters
valueThe vertical offset value to set.
See Also
getVerticalOffsetToPreviousLevel().
IlBoolean IlvBusLayout::supportsLayoutRegion ( ) const
virtual

Indicates that this layout class can control the size of the graph drawing to fit a user-defined region (a rectangle) or a user-defined manager view.

This layout uses the layout region to determine the vertical positioning of the upper level of the bus and the horizontal dimension of the levels of the bus. The height of the layout region is not used because it may need to be larger or smaller depending on the amount of space required for the drawing.

Returns
Always IlTrue.
See Also
IlvGraphLayout::setLayoutRegion(IlvManagerView)
IlvGraphLayout::setLayoutRegion(IlvManagerView, const IlvRect&)
IlvGraphLayout::setLayoutRegion(const IlvRect&)
IlvGraphLayout::getLayoutRegion()

Reimplemented from IlvGraphLayout.

IlBoolean IlvBusLayout::supportsPreserveFixedNodes ( ) const
virtual

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

Fixed nodes are not moved during the layout if the method setPreserveFixedNodes(IlBoolean) is called with an IlTrue argument.

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

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.