rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Graph Layout Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvBusLayout Class Reference

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

#include <ilviews/layout/bus.h>

Inheritance diagram for IlvBusLayout:
IlvGraphLayout

List of all members.

Public Member Functions

 IlvBusLayout ()
 Creates a new instance of the Bus Layout algorithm.
virtual void cleanObjectProperties (IlAny nodeOrLink)
 Overridden version of the method cleanObjectProperties.
void createOneLevel (IlvPolyline *)
 Returns the new current value of the index.
void detach ()
 Overridden version of the method detach.
IlvPolylinegetBus () const
 Returns the current bus node.
IlUInt getConnectionOnBusMargin () const
 Returns the horizontal offset between the first/last nodes on a given level and the left/right margins of the level.
IlvPointgetConnectionPoint (IlAny, IlvPolyline *, IlvTransformer *=0)
 Returns the connection point of the link on the bus node.
IlUInt getHorizontalOffset () const
 Returns the horizontal offset between the nodes placed on the same level of the bus.
IlInt getIndex (IlAny) const
 Returns the index associated with a node.
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.
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.
IlUInt getMarginOnBus () const
 Returns the horizontal offset between the first/last nodes on a given level and the left/right margins of the level.
IlvBusOrder getOrdering () const
 Returns the option that specifies the ordering of the nodes.
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.
IlUInt getVerticalOffsetToPreviousLevel () const
 Returns the vertical offset between the nodes and the horizontal level of the bus above the nodes.
void removeUselessPoints (IlvPolyline *)
 Removes the points of the polyline that have not been used for drawing the bus.
void setBus (IlvPolyline *)
 Allows you to specify the bus node. The bus node must be a node contained in the attached graph.
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.
void setHorizontalOffset (IlUInt value)
 Sets the horizontal offset between the nodes placed on the same level of the bus.
void setIndex (IlAny, IlInt)
 Allows you to specify the index of a node.
void setLinkStyle (IlvLayoutLinkStyle value)
 Sets the option for the style of the links shape.
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.
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.
void setOrdering (IlvBusOrder value)
 Allows you to specify how the nodes are arranged on the bus.
void setVerticalOffsetToLevel (IlUInt value)
 Sets the vertical offset between the nodes and the horizontal level of the bus to which they are connected.
void setVerticalOffsetToPreviousLevel (IlUInt value)
 Sets the vertical offset between the nodes and the horizontal level of the bus above the nodes.
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.
IlBoolean supportsPreserveFixedNodes () const
 Indicates that this layout class allows the user to specify fixed nodes.

Protected Member Functions

void layout ()
 Computes the layout using the Bus Layout algorithm.
IlvBusLinkConnector * makeLinkConnector () const
 Creates a new instance of the link connector.

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:

Bus-By-Height.gif

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.

Bus-offsets-region.gif

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.

Warning:
[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.
[note] 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.

Warning:
[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.

Warning:
[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 (  )  [protected, virtual]

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.

Warning:
[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  ) 

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

The transformer is not used by IlvPolyPoints.removePoint, but it may eventually be used by a subclass.

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.

Warning:
[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:
value The 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:
value The 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.

Warning:
[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:
value The 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.

Warning:
[note] The following relationship must be respected: getLayoutRegion().width > 2*getMargin() + 2*getMarginOnBus().
Parameters:
value The 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:
value The 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:
value The 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:
value The 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:
value The 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.

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

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.

See also:
IlvGraphLayout::setPreserveFixedNodes
IlvGraphLayout::isPreserveFixedNodes
Returns:
Always IlTrue.

Reimplemented from IlvGraphLayout.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends

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