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

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

#include <ilviews/layout/random.h>

Inheritance diagram for IlvRandomLayout:
IlvGraphLayout

Public Member Functions

 IlvRandomLayout ()
 Creates a new instance of the Random Layout algorithm. More...
 
IlvLayoutLinkStyle getLinkStyle () const
 Returns the current option for the style of the shape of the links. More...
 
void setLinkStyle (IlvLayoutLinkStyle linkStyle)
 Sets the option for the style of the shape of the links. More...
 
IlBoolean supportsLayoutRegion () const
 Indicates that this layout class can control the size of the drawing of the grapher to fit (exactly or approximately) 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...
 
IlBoolean supportsRandomGenerator () const
 Indicates that this layout class uses randomly-generated numbers that can be initialized with a user-defined seed value. 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 void cleanObjectProperties (IlAny nodeOrLink)
 Deletes properties attached to the node or link. More...
 
virtual void detach ()
 Detaches the graph model from the layout instance. 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...
 
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 Random 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

The main class for the Random Layout algorithm.

Library: ilvrandom

This is the simplest layout algorithm. The nodes are moved at randomly-computed positions inside a user-defined region.

Sample drawing produced by the Random 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 that 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(IlBoolean) with an IlTrue argument.

Note the following points:

Constructor & Destructor Documentation

§ IlvRandomLayout()

IlvRandomLayout::IlvRandomLayout ( )

Creates a new instance of the Random 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

§ getLinkStyle()

IlvLayoutLinkStyle IlvRandomLayout::getLinkStyle ( ) const

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

Returns
The style of the shape of the links.
See also
setLinkStyle

§ layout()

void IlvRandomLayout::layout ( )
protectedvirtual

Computes the layout using the Random Layout algorithm.

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

See also
IlvGraphLayout::performLayout()
IlvGraphLayout::getLayoutRegion(IlvRect&)

Implements IlvGraphLayout.

§ setLinkStyle()

void IlvRandomLayout::setLinkStyle ( IlvLayoutLinkStyle  linkStyle)

Sets the option for the style of the shape of the links.

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
linkStyleThe style of the shape of the links.
See also
getLinkStyle

§ supportsLayoutRegion()

IlBoolean IlvRandomLayout::supportsLayoutRegion ( ) const
virtual

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

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

Reimplemented from IlvGraphLayout.

§ supportsPreserveFixedNodes()

IlBoolean IlvRandomLayout::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(IlBoolean)
IlvGraphLayout::isPreserveFixedNodes

Reimplemented from IlvGraphLayout.

§ supportsRandomGenerator()

IlBoolean IlvRandomLayout::supportsRandomGenerator ( ) const
virtual

Indicates that this layout class uses randomly-generated numbers that can be initialized with a user-defined seed value.

When you perform the layout several times on the same graph and use the same user-defined seed value, you obtain the same drawing of the grapher. If you want different drawings each time you perform the layout, you should modify the seed value and call the method setUseSeedValueForRandomGenerator(IlBoolean) with an IlTrue argument.

Returns
Always IlTrue.
See also
setSeedValueForRandomGenerator(IlUShort)
getSeedValueForRandomGenerator
setUseSeedValueForRandomGenerator(IlBoolean)
isUseSeedValueForRandomGenerator

Reimplemented from IlvGraphLayout.


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