Rogue Wave Views Graph Layout Package API Reference Guide |
Rogue Wave Views Documentation Home |
An IlvGrapherAdapter
encapsulates an IlvGrapher
and provides a bridge between the API of the IlvGrapher
and the API of the IlvGraphModel
.
More...
#include <ilviews/layout/gphadapt.h>
Public Member Functions | |
IlvGrapherAdapter (IlvGrapher *grapher) | |
Creates a new grapher adapter for a given IlvGrapher . More... | |
virtual | ~IlvGrapherAdapter () |
Destructor. | |
void | addLayer (IlvManagerLayer *layer) |
Adds a manager layer to the list of layers to be used during the layout. More... | |
void | boundingBox (IlAny nodeOrLink, IlvRect &rect) |
Updates the rect argument with the bounding box of a node or a link in manager coordinates. More... | |
void | ensureReshapeableLinks (IlvGraphLayout *layout) |
Ensures that all the links in the grapher can be reshaped to a polyline shape. More... | |
void | ensureStraightLineLinks (IlvGraphLayout *layout) |
Ensures that all the links in the grapher can be reshaped to straight-line links. More... | |
IlvLayoutGraphicFilter * | getFilter () const |
Returns the filter, if any. Returns 0 otherwise. More... | |
IlvMgrView * | getFirstManagerView () const |
Returns the first manager view attached to the encapsulated IlvGrapher if any, and null otherwise. | |
IlAny | getFrom (IlAny link) |
Returns the origin node of a link. More... | |
IlvGrapher * | getGrapher () const |
Returns the IlvGrapher encapsulated by the adapter. | |
const IlArray & | getLayers () const |
Returns an enumeration of the manager layers to be taken into account during the layout. More... | |
IlvPoint | getLinkPointAt (IlAny link, IlUInt index) |
Returns the point of a link at a specified index. More... | |
IlvPoint * | getLinkPoints (IlAny link, IlUInt &count) |
Returns the points that define a link. More... | |
IlInt | getLinkPointsCount (IlAny link) |
Returns the number of points of a link. More... | |
IlList * | getLinks () |
Returns an enumeration of the links. More... | |
IlList * | getLinks (IlAny node) |
Returns an enumeration of all the links that have node as their origin or destination. More... | |
IlUInt | getLinksCountOf (IlAny node) |
Returns the number of links adjacent to node. More... | |
IlList * | getLinksFrom (IlAny node) |
Returns an enumeration of all the links that have node as their origin. More... | |
IlUInt | getLinksFromCount (IlAny node) |
Returns the number of links that have node as their origin. More... | |
IlList * | getLinksTo (IlAny node) |
Returns an enumeration of all the links that have node as their destination. More... | |
IlUInt | getLinksToCount (IlAny node) |
Returns the number of links that have node as their origin. More... | |
IlUInt | getLinkWidth (IlAny link) |
Returns the width of the link. More... | |
virtual const char * | getMessage (const char *msg) const |
Returns the message string associated with the message identifier msg . More... | |
IlList * | getNeighbors (IlAny node) |
Returns an enumeration of all the nodes that are the "neighbors" of node; in other words, the nodes that have a common link with node. More... | |
virtual IlList * | getNodes () |
Returns an enumeration of the nodes. More... | |
IlList * | getNodesAndLinks () |
Returns an enumeration of the nodes and links. More... | |
IlAny | getOpposite (IlAny link, IlAny node) |
Returns the opposite node of a link. | |
IlAny | getProperty (IlAny nodeOrLink, const char *key) |
Returns the value of a property. More... | |
IlvTransformer * | getReferenceTransformer () |
Returns the transformer to be taken into account. More... | |
virtual IlvMgrView * | getReferenceView () const |
Returns the specified reference view (if any). More... | |
IlAny | getTo (IlAny link) |
Returns the destination node of a link. More... | |
IlBoolean | hasProperty (IlAny nodeOrLink, const char *key) |
Returns IlTrue if the property exists and IlFalse otherwise. More... | |
IlBoolean | isLink (IlAny obj) |
Returns IlTrue if an object is a valid link and IlFalse otherwise. More... | |
IlBoolean | isLinkBetween (IlAny node1, IlAny node2) |
Tests whether a link exists between two nodes. | |
IlBoolean | isNode (IlAny obj) |
Returns IlTrue if an object is a valid node and IlFalse otherwise. More... | |
void | moveNode (IlAny node, IlInt x, IlInt y, IlBoolean reDraw) |
Changes the position of the specified node. The x and y coordinates correspond to the top-left corner of the rectangle that defines the node. More... | |
IlBoolean | removeAllLayers () |
Removes all manager layers from the list of layers to be used during the layout. More... | |
IlBoolean | removeLayer (IlvManagerLayer *layer) |
Removes a manager layer from the list of layers to be used during the layout. More... | |
void | reshapeLink (IlAny link, IlvPoint fromPoint, IlvPoint *points, IlUInt startIndex, IlUInt length, IlvPoint toPoint, IlBoolean reDraw) |
Reshapes all the points of a link, including the connection points on the origin and destination nodes. More... | |
void | setFilter (IlvLayoutGraphicFilter *filter) |
Allows you to specify a filter on the nodes and links. More... | |
void | setProperty (IlAny nodeOrLink, const char *key, IlAny value) |
Sets the value of a property for a node or a link. More... | |
void | setReferenceTransformer (IlvTransformer *t) |
Allows you to specify the reference transformer. More... | |
virtual void | setReferenceView (IlvMgrView *view=0) |
Allows you to specify the reference manager view. More... | |
Public Member Functions inherited from IlvGraphModel | |
IlvGraphModel () | |
Creates a new IlvGraphModel . | |
void | geometryChanged (IlBoolean) |
Notifies the graph model that the geometry of the graph has changed (nodes or links were moved or reshaped). More... | |
virtual IlUInt | getLinksCount () |
Returns the number of links. More... | |
virtual IlUInt | getNodeDegree (IlAny node) |
Returns the degree of a node, that is, the number of neighbors that the node has. More... | |
virtual IlUInt | getNodesCount () |
Returns the number of nodes. More... | |
const char * | getUniqueName (const char *=0) |
Method to be used everywhere in the package to choose names for properties that must be unique for a given graph model instance. | |
void | structureChanged (IlBoolean) |
Notifies the graph-model-event listeners that the topology of the graph has changed (nodes or links were added or removed). More... | |
Protected Member Functions | |
void | afterAnimationStep () |
Notifies the grapher adapter that a layout animation step has finished. More... | |
void | afterLayout (IlvGraphLayout *layout, IlvGraphLayoutReport *layoutReport, IlBoolean reDraw) |
Notifies the grapher adapter that a layout session has finished. More... | |
void | beforeAnimationStep () |
Notifies the grapher adapter that a layout animation step has been started. More... | |
void | beforeLayout (IlvGraphLayout *layout, IlBoolean redraw) |
Notifies the grapher adapter that a layout session has been started. More... | |
An IlvGrapherAdapter
encapsulates an IlvGrapher
and provides a bridge between the API of the IlvGrapher
and the API of the IlvGraphModel
.
Library: ilvlayout
IlvGrapherAdapter
is a concrete subclass of IlvGraphModel
that allows an IlvGrapher
to be laid out using the layout algorithms provided in Rogue Wave Views. It provides an implementation for all the abstract methods of IlvGraphModel
. It also provides overridden implementations of some non-abstract methods of IlvGraphModel
in order to improve the efficiency by taking advantage of the particularities of the IlvGrapher
.
If an application uses the class IlvGrapher
, the grapher can be attached directly to the layout instance without explicitly using a graph model (see the method IlvGraphLayout::attach(IlvGrapher*)
). In this case, an IlvGrapherAdapter
will be internally created. This adapter can be retrieved using the method IlvGraphLayout::getGraphModel()
, which will return an instance of IlvGrapherAdapter
.
IlvGrapherAdapter::IlvGrapherAdapter | ( | IlvGrapher * | grapher | ) |
Creates a new grapher adapter for a given IlvGrapher
.
grapher | The Rogue Wave Views grapher. |
void IlvGrapherAdapter::addLayer | ( | IlvManagerLayer * | layer | ) |
Adds a manager layer to the list of layers to be used during the layout.
If you do not call this method, all the layers of the grapher are taken into account. Note that, in this case, getLayers()
returns an empty array.
layer | The layer to be added. |
IlTrue
if the layer is in the list of layers to be used; IlFalse
if the layer is not in the list of layers or if the list of layers is empty. removeLayer()
removeAllLayers()
getLayers()
.
|
protectedvirtual |
Notifies the grapher adapter that a layout animation step has finished.
If appropriate, this method is called by the layout algorithm after each animation step. The method redraws all the views of the grapher.
beforeAnimationStep()
. Reimplemented from IlvGraphModel.
|
protectedvirtual |
Notifies the grapher adapter that a layout session has finished.
This method is always called by IlvGraphLayout::performLayout()
after the method IlvGraphLayout::layout()
has finished.
layoutReport->getCode() == IlvGraphLayoutReport::LayoutDone
.The method IlvGrapher::reDraw()
is called on the encapsulated grapher if the argument reDraw is IlTrue
.
layout | The layout instance origin of the notification. |
layoutReport | The layout report. |
reDraw | If IlTrue , all the views of the encapsulated grapher are redrawn. |
beforeLayout()
. Reimplemented from IlvGraphModel.
|
protectedvirtual |
Notifies the grapher adapter that a layout animation step has been started.
If appropriate, this method is called by the layout algorithm before each animation step.
afterAnimationStep()
. Reimplemented from IlvGraphModel.
|
protectedvirtual |
Notifies the grapher adapter that a layout session has been started.
This method is always called by IlvGraphLayout::performLayout()
before the call to the method IlvGraphLayout::layout()
.
The default implementation of the method does nothing.
layout | The layout instance origin of the notification. |
redraw | If IlTrue , the layout algorithm will call, after the layout, the method afterLayout() with the redraw argument at IlTrue . |
afterLayout()
. Reimplemented from IlvGraphModel.
Updates the rect argument with the bounding box of a node or a link in manager coordinates.
If the object is zoomable, it returns the bounding box in manager coordinates by calling IlvGraphic::boundingBox(IlvRect&)
. For nonzoomable objects, it computes the bounding box according to the current transformer (see the method getReferenceTransformer()
) and returns a rectangle obtained by applying the inverse transformation to the rectangle.
nodeOrLink | The node or link for which we want the bounding box. |
rect | The rectangle that will be updated. |
Implements IlvGraphModel.
|
virtual |
Ensures that all the links in the grapher can be reshaped to a polyline shape.
This method is called by layout algorithms that need to reshape the links. See also the method IlvGraphLayout::isLinkReplacementAllowed()
.
The method replaces all the links of the grapher that cannot be reshaped to a polyline shape with a new link of type IlvPolylineLinkImage
, without any intermediate points. The following link classes are replaced:
If a link is replaced, the following attributes of the old link are copied to the new link:
layout | The layout algorithm that needs reshapeable links. |
ensureStraightLineLinks()
IlvGraphLayout::isLinkReplacementAllowed()
IlvGraphLayout::isLinkConnectorReplacementAllowed()
. Reimplemented from IlvGraphModel.
|
virtual |
Ensures that all the links in the grapher can be reshaped to straight-line links.
This method is called by layout algorithms that need straight-line links. See also the method IlvGraphLayout::isLinkReplacementAllowed()
.
The method replaces all the links of the grapher that cannot be reshaped to a straight-line shape with new links of type IlvPolylineLinkImage
without any intermediate points. The following link classes are replaced:
If a link is replaced, the following attributes of the old link are copied to the new link:
The method also removes any link connectors of type IlvGrapherPin
from the nodes.
layout | The layout algorithm that needs straight-line links. |
ensureReshapeableLinks()
IlvGraphLayout::isLinkReplacementAllowed()
IlvGraphLayout::isLinkConnectorReplacementAllowed()
. Reimplemented from IlvGraphModel.
IlvLayoutGraphicFilter* IlvGrapherAdapter::getFilter | ( | ) | const |
Returns the filter, if any. Returns 0
otherwise.
setFilter(IlvLayoutGraphicFilter*)
. const IlArray& IlvGrapherAdapter::getLayers | ( | ) | const |
Returns an enumeration of the manager layers to be taken into account during the layout.
If you do not specify any layers using the method addLayer(IlvManagerLayer*)
, all layers in the encapsulated IlvGrapher
are used. In this case, this method returns an empty array.
IlvManagerLayer
instances) to be taken into account during the layout. Returns an empty array if the list of layers to be used is empty. addLayer()
removeLayer()
removeAllLayers()
. Returns the point of a link at a specified index.
link | The link. |
index | The index in the points array. |
Reimplemented from IlvGraphModel.
Returns the points that define a link.
link | The link. |
count | The number of points is set in this argument. |
Implements IlvGraphModel.
Returns the number of points of a link.
link | The link for which we want to know the number of points. |
Implements IlvGraphModel.
|
virtual |
Returns an enumeration of the links.
It calls the method IlvGrapher::getObjects()
on the encapsulated grapher and skips all the elements that are not links.
Note that, because the nodes and the links are not stored separately in the IlvGrapher
, browsing all elements returned by this method is no more efficient than browsing them using the enumeration returned by the method getNodesAndLinks()
.
Implements IlvGraphModel.
Returns an enumeration of all the links that have node as their origin or destination.
node | The node. |
Reimplemented from IlvGraphModel.
Returns the number of links adjacent to node.
node | The node. |
Reimplemented from IlvGraphModel.
Returns an enumeration of all the links that have node as their origin.
node | The node. |
Implements IlvGraphModel.
Returns the number of links that have node as their origin.
node | The node. |
Reimplemented from IlvGraphModel.
Returns an enumeration of all the links that have node as their destination.
The method may return an empty list if there are no links.
node | The node. |
Implements IlvGraphModel.
Returns the number of links that have node as their origin.
node | The node. |
Reimplemented from IlvGraphModel.
Returns the width of the link.
link | The link for which we want to know the width. |
Reimplemented from IlvGraphModel.
|
virtual |
Returns the message string associated with the message identifier msg
.
msg | The message identifier searched for. |
Implements IlvGraphModel.
Returns an enumeration of all the nodes that are the "neighbors" of node; in other words, the nodes that have a common link with node.
node | The node. |
Note that a neighbor node will be contained in the enumeration the same number of times as the number of links between node and this neighbor.
Reimplemented from IlvGraphModel.
|
virtual |
Returns an enumeration of the nodes.
It calls the method IlvGrapher::getObjects()
on the encapsulated grapher and skips all the elements that are not nodes.
Note that, because the nodes and the links are not stored separately in the IlvGrapher
, browsing all elements returned by this method is no more efficient than browsing them using the enumeration returned by the method getNodesAndLinks()
.
Implements IlvGraphModel.
|
virtual |
Returns an enumeration of the nodes and links.
Note that graphic objects that are stored by the encapsulated grapher but are not nodes or links are not skipped by this enumeration. Use the methods isNode(IlAny)
and isLink(IlAny)
to skip them.
getNodes()
getLinks()
. Reimplemented from IlvGraphModel.
Returns the value of a property.
The method returns 0
if the property does not exist.
nodeOrLink | The node or link for which the property is to be set |
key | The key string for the property |
setProperty()
. Reimplemented from IlvGraphModel.
IlvTransformer* IlvGrapherAdapter::getReferenceTransformer | ( | ) |
Returns the transformer to be taken into account.
This method returns the transformer specified using setReferenceTransformer(IlvTransformer*)
if this transformer is not equal to 0
.
Otherwise, it returns the current transformer of the manager view specified using setReferenceView(IlvMgrView*)
(if any).
Otherwise, it returns the current transformer of the first manager view attached to the grapher (as returned by the method IlvManager::getViews()
).
Otherwise, it returns an identity transformer.
|
virtual |
Returns the specified reference view (if any).
Returns IlTrue
if the property exists and IlFalse
otherwise.
nodeOrLink | The node or link for which the property is to be set. |
key | The key string for the property. |
Reimplemented from IlvGraphModel.
Returns IlTrue
if an object is a valid link and IlFalse
otherwise.
An object is not valid in one of the following cases:
obj | The object to test. |
Implements IlvGraphModel.
Returns IlTrue
if an object is a valid node and IlFalse
otherwise.
An object is not valid in one of the following cases:
obj | The object to test. |
Implements IlvGraphModel.
Changes the position of the specified node. The x and y coordinates correspond to the top-left corner of the rectangle that defines the node.
node | The node. |
x | The new x-position. |
y | The new y-position. |
reDraw | If IlTrue , the node is redrawn. |
boundingBox(IlAny, IlvRect&)
. Implements IlvGraphModel.
IlBoolean IlvGrapherAdapter::removeAllLayers | ( | ) |
Removes all manager layers from the list of layers to be used during the layout.
All layers will be taken into account. Note that, in this case, getLayers()
returns an empty array.
IlFalse
if there are no layers to be removed and IlTrue
otherwise. addLayer()
removeLayer()
getLayers()
. IlBoolean IlvGrapherAdapter::removeLayer | ( | IlvManagerLayer * | layer | ) |
Removes a manager layer from the list of layers to be used during the layout.
layer | The layer to be removed. |
IlTrue
if the layer is in the list of layers to be used; IlFalse
if the layer is not in the list of layers or if the list of layers is empty. addLayer()
removeAllLayers()
getLayers()
.
|
virtual |
Reshapes all the points of a link, including the connection points on the origin and destination nodes.
If the new shape of the link must be a straight line, without any intermediate points, call the method with 0
for the points argument. In this case, the values of the arguments startIndex and length are ignored.
Note that the effect of this method depends on the type of the link. For the following link types the reshaping of the intermediate points has no effect:
link | The link to be reshaped |
fromPoint | The connection point of the link on the origin node. If 0 , the connection point is not moved. |
points | The intermediate points of the link (ordered from origin node to destination node). If 0 , all the intermediate points of the link are removed. |
startIndex | The start position in the array of points. |
length | The number of intermediate points. |
toPoint | The connection point of the link on the destination node. If 0 , the connection point is not moved. |
reDraw | If IlTrue , the link is redrawn. |
Implements IlvGraphModel.
void IlvGrapherAdapter::setFilter | ( | IlvLayoutGraphicFilter * | filter | ) |
Allows you to specify a filter on the nodes and links.
Using a filter allows you to perform the layout on a part of a grapher. To do this, methods such as getNodes()
, getLinks()
, getNeighbors()
, and so on return enumerations of only the nodes or links that are accepted by the filter (if any).
To remove the filter, call this method with an argument equal to 0
.
filter | The new filter. |
getFilter()
.Sets the value of a property for a node or a link.
If value is equal to 0
, the property is removed. Otherwise, the property value is set to value.
nodeOrLink | The node or link for which the property is to be set. |
key | The key string for the property. |
value | The new value of the property. |
getProperty()
. Reimplemented from IlvGraphModel.
void IlvGrapherAdapter::setReferenceTransformer | ( | IlvTransformer * | t | ) |
Allows you to specify the reference transformer.
The reference transformer is the transformer (see the class IlvTransformer
) that is taken into account by the IlvGrapherAdapter
when computing the geometry of the graph.
If the encapsulated grapher contains only zoomable nodes and links (see IlvGraphic::zoomable()
), you never need to call this method. In this case, the layout computes the geometry of the graph on the basis of the bounding boxes of the objects in manager coordinates. The geometry will stay valid for any transformer.
If the encapsulated grapher contains at least one nonzoomable object, the geometry of the graph becomes dependent on the transformer that is used to draw the graph. Therefore, you need to specify the transformer with which you want the layout to be performed. Usually, this transformer is the current transformer used to display the result of the layout.
In most cases, it is not necessary to call this method because the transformer to be taken into account is chosen using a set of default rules (see getReferenceTransformer()
). If it is called, the transformer specified using this method is returned by the method getReferenceTransformer()
, overriding the default rules for choosing the transformer.
The only cases when you may need to call this method are the following:
IlvGrapher
contains nonzoomable objects and more than one manager view is attached to the grapher. IlvGrapher
contains nonzoomable objects and no manager view is attached to the grapher. In both cases, because of the nonzoomable objects, the layout cannot be correctly computed independently of the transformer used for drawing the graph. Also, the default rule for choosing the current transformer of the first manager view as the reference transformer cannot be applied.
If a grapher containing nonzoomable objects is displayed simultaneously in several views, you can use the method setReferenceView(IlvMgrView*)
to indicate the view for which you want the layout to correspond exactly to the geometry of the graph.
If you specified a transformer but want to reset this setting and go back to the default behavior, call the method with an argument equal to 0
.
t | The transformer that becomes the reference. |
Note that if this method is overridden, you must call setReferenceTransformer(IlvTransformer*)
of the super class in order to notify the grapher adapter that the reference transformer has changed.
Note also that a call to the method setReferenceView(IlvMgrView*)
overrides the effect of a call to the method setReferenceTransformer(IlvTransformer*)
.
Similarly, a call to the method setReferenceTransformer(IlvTransformer*)
overrides the effect of a call to the method setReferenceView(IlvMgrView*)
.
|
virtual |
Allows you to specify the reference manager view.
The reference view is the view connected to the manager whose current transformer is used as a reference transformer (see method getReferenceTransformer()
).
Usually, the view argument is the manager view that is used for displaying the graph, but this is not mandatory.
Call this method with an argument equal to 0
to reset the setting.
view | The view set as the reference. |
setReferenceTransformer(IlvTransformer*)
overrides the effect of a call to the method setReferenceView(IlvMgrView*)
. Similarly, a call to the method setReferenceView(IlvMgrView*)
overrides the effect of a call to the method setReferenceTransformer(IlvTransformer*)
. © Copyright 2016, 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.