Rogue Wave Views 5.5.1 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
The main class for the Bus Layout algorithm. More...
#include <ilviews/layout/bus.h>
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 . | |
IlvPolyline * | getBus () 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. | |
IlvPoint * | getConnectionPoint (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. |
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.
setPreserveFixedNodes()
with an IlTrue
argument.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.
virtual void IlvBusLayout::cleanObjectProperties | ( | IlAny | nodeOrLink | ) | [virtual] |
Overridden version of the method cleanObjectProperties
.
Reimplemented from IlvGraphLayout.
void IlvBusLayout::detach | ( | ) | [virtual] |
Overridden version of the method detach
.
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
.
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.
getLayoutRegion().width > 2*getMargin() + 2*getMarginOnBus()
.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).
IlUInt IlvBusLayout::getHorizontalOffset | ( | ) | const |
Returns the horizontal offset between the nodes placed on the same level of the bus.
setHorizontalOffset
IlvLayoutLinkStyle IlvBusLayout::getLinkStyle | ( | ) | const |
Returns the current option for the style of the shape of the links.
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.
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.
getLayoutRegion().width > 2*getMargin() + 2*getMarginOnBus()
.setMarginOnBus
IlvBusOrder IlvBusLayout::getOrdering | ( | ) | const |
Returns the option that specifies the ordering of the nodes.
setOrdering
IlUInt IlvBusLayout::getVerticalOffsetToLevel | ( | ) | const |
Returns the vertical offset between the nodes and the horizontal level of the bus to which they are connected.
setVerticalOffsetToLevel
IlUInt IlvBusLayout::getVerticalOffsetToPreviousLevel | ( | ) | const |
Returns the vertical offset between the nodes and the horizontal level of the bus above the nodes.
setVerticalOffsetToPreviousLevel
void IlvBusLayout::layout | ( | ) | [protected, virtual] |
Computes the layout using the Bus Layout algorithm.
To start the layout, call the method IlvGraphLayout::performLayout()
.
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
.
IlvGrapherAdapter
or an IlvGrapher
. 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
.
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.
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
.
value | The horizontal offset value to set. |
void IlvBusLayout::setHorizontalOffset | ( | IlUInt | value | ) |
Sets the horizontal offset between the nodes placed on the same level of the bus.
value | The horizontal offset value to set. |
getHorizontalOffset
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.
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.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
.
value | The style value to set. |
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.
getLayoutRegion().width > 2*getMargin() + 2*getMarginOnBus()
. value | The horizontal margin value to set. |
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.
value | The horizontal offset value to set. |
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
.
value | The ordering value to set. |
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.
value | The vertical offset value to set. |
getVerticalOffsetToLevel
void IlvBusLayout::setVerticalOffsetToPreviousLevel | ( | IlUInt | value | ) |
Sets the vertical offset between the nodes and the horizontal level of the bus above the nodes.
value | The vertical offset value to set. |
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.
IlvGraphLayout::setLayoutRegion(IlvManagerView)
IlvGraphLayout::setLayoutRegion(IlvManagerView, const IlvRect&)
IlvGraphLayout::setLayoutRegion(const IlvRect&)
IlvGraphLayout::getLayoutRegion()
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.
IlTrue
. 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.