VTK
Public Member Functions | Static Public Member Functions | List of all members
vtkQtChartShapeLocator Class Reference

The vtkQtChartShapeLocator class is used to locate shapes in a tree structure. More...

#include <vtkQtChartShapeLocator.h>

Public Member Functions

 vtkQtChartShapeLocator ()
 ~vtkQtChartShapeLocator ()
void clear ()
 Removes all the tree items.
void build (const QList< QList< vtkQtChartShape * > > &table)
 Builds a shape tree from the ordered table of shapes.
void build (const QList< vtkQtChartShape * > &list)
 Builds a shape tree from the list of shapes.
void update ()
 Updates the bounding rectangles in the shape tree.
QList< vtkQtChartShape * > getItemsAt (const QPointF &point) const
 Gets the shapes at the specified point.
QList< vtkQtChartShape * > getItemsIn (const QRectF &area) const
 Gets the shapes in the specified rectangle.
vtkQtChartShapeLocatorNodegetLast ()
 Gets the last node in the tree.
vtkQtChartShapeLocatorNodegetPrevious (vtkQtChartShapeLocatorNode *node)
 Gets the previous node in the tree.

Static Public Member Functions

static void sort (QList< vtkQtChartShape * > &list)
 Sorts the list of shapes according to the y value.

Detailed Description

The vtkQtChartShapeLocator class is used to locate shapes in a tree structure.

The tree is built from a table of shapes. The leaf nodes store the shapes and use them for searches. The parent nodes in the tree use the bounding rectangle for searches. The bounding rectangles can be updated if the layout remains unchanged.

Definition at line 142 of file vtkQtChartShapeLocator.h.

Constructor & Destructor Documentation

vtkQtChartShapeLocator::vtkQtChartShapeLocator ( )
vtkQtChartShapeLocator::~vtkQtChartShapeLocator ( )

Member Function Documentation

void vtkQtChartShapeLocator::clear ( )

Removes all the tree items.

void vtkQtChartShapeLocator::build ( const QList< QList< vtkQtChartShape * > > &  table)

Builds a shape tree from the ordered table of shapes.

The shape pointers are stored by the tree and should not be deleted until the tree has been cleared.

Parameters
tableThe ordered table of shapes.
void vtkQtChartShapeLocator::build ( const QList< vtkQtChartShape * > &  list)

Builds a shape tree from the list of shapes.

The list of shapes should be sorted in the x-axis direction before calling this method. The list will be divided into a table and sorted in the y-axis direction before building the tree. The shape pointers are stored by the tree and should not be deleted until the tree has been cleared.

Parameters
listThe list of shapes.
void vtkQtChartShapeLocator::update ( )

Updates the bounding rectangles in the shape tree.

The nodes are traversed from last to first. The bounding rectangle of each node is updated using the shape if it is a leaf or the bounds of the children otherwise.

QList<vtkQtChartShape *> vtkQtChartShapeLocator::getItemsAt ( const QPointF &  point) const

Gets the shapes at the specified point.

Parameters
pointThe point to search.
Returns
The list of shapes at the given point.
QList<vtkQtChartShape *> vtkQtChartShapeLocator::getItemsIn ( const QRectF &  area) const

Gets the shapes in the specified rectangle.

Parameters
areaThe rectangle to search.
Returns
The list of shapes in the given rectangle.
vtkQtChartShapeLocatorNode* vtkQtChartShapeLocator::getLast ( )

Gets the last node in the tree.

Returns
A pointer to the last node in the tree.
vtkQtChartShapeLocatorNode* vtkQtChartShapeLocator::getPrevious ( vtkQtChartShapeLocatorNode node)

Gets the previous node in the tree.

Parameters
nodeThe node to search from.
Returns
A pointer to the previous node in the tree.
static void vtkQtChartShapeLocator::sort ( QList< vtkQtChartShape * > &  list)
static

Sorts the list of shapes according to the y value.

The list of shapes is sorted by the y-axis value using a quick sort algorithm. The list is sorted in place.

Parameters
listThe list of shapes to be sorted.

The documentation for this class was generated from the following file: