Reference documentation
|
The Thistle::GraphAlgorithm class provides a default algorithm to calculate the positions of the nodes in a Thistle::GraphView. More...
Public Member Functions | |
void | run () |
The function is pure virtual. More... | |
Public Member Functions inherited from AbstractGraphAlgorithm | |
AbstractGraphAlgorithm (GraphView *parent) | |
Initializes the abstract object with the given parent. | |
~AbstractGraphAlgorithm () | |
Destructs the current instance. | |
const Node | node (const QModelIndex &index) const |
Returns the Thistle::Node corresponding to the given index . | |
void | setPosition (const QModelIndex &index, QPointF pos) |
Sets the position pos to the given index . More... | |
The Thistle::GraphAlgorithm class provides a default algorithm to calculate the positions of the nodes in a Thistle::GraphView.
The Thistle::GraphAlgorithm class provides a default algorithm to calculate the positions of the nodes in a Thistle::GraphView.
This class implements the elastic effect that pulls and pushes on nodes. this is a very simple and efficient algorihtm.
First, we calculate the forces that push the nodes apart. Then, we subtract the forces that pull the nodes together. this algorithm takes a certain time to calculate the forces and find the final position of each item. So, we can see the nodes moving on the view.
If you want to implement you own algorithm, use the Thistle::AbstractGraphAlgorithm abstract class as base.
|
virtual |
The function is pure virtual.
this function is used to calculate the position of Thistle::Node in a Thistle::GraphView. Implement this function to use your own algorithm.
Implements AbstractGraphAlgorithm.