Graph Layout > Using Advanced Features > Using the Filtering Features to Lay Out a Part of an IlvGrapher
 
Using the Filtering Features to Lay Out a Part of an IlvGrapher
Note: To understand this section better, read Using the Graph Model first.
Applications sometimes need to perform the layout algorithm on a subset of the nodes and links of a graph. If the graph is not an IlvGrapher, the custom adapter should support the filtering of a graph. (See Laying Out a Non-Views Grapher.) The methods that are related to the structure of the graph (getNodes, getLinks, getNeighbors, and so on) must behave just as if the graph has changed in some way. They must take into account only the nodes and links that belong to the part of the graph that must be laid out.
For applications that use IlvGrapher, the filtering feature is built into the IlvGrapherAdapter. To do this, the IlvGrapherAdapter needs a way to know, for each node or link, whether it must be taken into account during the layout. This is the role of the “filter” class, IlvLayoutGraphicFilter.
The IlvLayoutGraphicFilter class defines this main method:
IlBoolean accept(IlvGraphic nodeOrLink)
If a filter is specified, the IlvGrapherAdapter calls the accept method for each node or link whenever necessary. If the method returns IlTrue, the IlvGrapherAdapter considers the node or the link as part of the graph that needs to be laid out. Otherwise, it ignores the node or the link.
To specify a filter on an IlvGrapherAdapter, use the following method of the IlvGrapherAdapter class:
void setFilter(IlvLayoutGraphicFilter* filter)
To remove the filter, call the IlvGrapherAdapter::setFilter method with a null argument.
To obtain the filter that has been specified, use the method:
IlvLayoutGraphicFilter* getFilter()
Note: All overridden implementations of the IlvLayoutGraphicFilter::accept method must respect the following rule: a link cannot be accepted by the filter if any of its end nodes (origin or destination nodes) are not accepted.
Note: The filter is not managed by the adapter. You have to store it and destroy it when it is no longer needed.
There are two ways to filter an IlvGrapher, by layers or by graphic objects. The two methods can be combined.

Version 6.0
Copyright © 2015, Rogue Wave Software, Inc. All Rights Reserved.