VTK
vtkQtChartBarLocator.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkQtChartBarLocator.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /*-------------------------------------------------------------------------
16  Copyright 2008 Sandia Corporation.
17  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18  the U.S. Government retains certain rights in this software.
19 -------------------------------------------------------------------------*/
20 
23 
24 #ifndef _vtkQtChartBarLocator_h
25 #define _vtkQtChartBarLocator_h
26 
27 #include "vtkQtChartExport.h"
28 #include <QLinkedList> // Needed for parameter.
29 #include <QList> // Needed for parameter.
30 
31 class vtkQtChartBar;
32 class QPointF;
33 class QRectF;
34 
35 
40 class VTKQTCHART_EXPORT vtkQtChartBarLocatorNode
41 {
42 public:
48 
54  bool contains(const QPointF &point) const;
55 
61  bool intersects(const QRectF &area) const;
62 
67  const QRectF &getBounds() const {return *this->Bounds;}
68 
72  void setBounds(const QRectF &bounds);
73 
78  vtkQtChartBar *getElement() const {return this->Element;}
79 
83  void setElement(vtkQtChartBar *element);
84 
89  vtkQtChartBarLocatorNode *getParent() const {return this->Parent;}
90 
94  void setParent(vtkQtChartBarLocatorNode *parent) {this->Parent = parent;}
95 
100  bool hasChildren() const {return this->First || this->Second;}
101 
106  vtkQtChartBarLocatorNode *getFirst() const {return this->First;}
107 
111  void setFirst(vtkQtChartBarLocatorNode *first) {this->First = first;}
112 
117  vtkQtChartBarLocatorNode *getSecond() const {return this->Second;}
118 
122  void setSecond(vtkQtChartBarLocatorNode *second) {this->Second = second;}
123 
129  void updateBounds();
130 
131 private:
132  QRectF *Bounds;
133  vtkQtChartBar *Element;
134  vtkQtChartBarLocatorNode *Parent;
135  vtkQtChartBarLocatorNode *First;
136  vtkQtChartBarLocatorNode *Second;
137 
138 private:
141 };
142 
143 
152 class VTKQTCHART_EXPORT vtkQtChartBarLocator
153 {
154 public:
157 
159  void clear();
160 
168  void build(const QList<vtkQtChartBar *> &list);
169 
176  void update();
177 
183  vtkQtChartBar *getItemAt(const QPointF &point) const;
184 
190  QList<vtkQtChartBar *> getItemsIn(const QRectF &area) const;
191 
196  vtkQtChartBarLocatorNode *getLast();
197 
204 
205 private:
209  void buildTree(QLinkedList<vtkQtChartBarLocatorNode *> &list) const;
210 
211 private:
213  QList<vtkQtChartBarLocatorNode *> Items;
214 
215 private:
217  vtkQtChartBarLocator &operator=(const vtkQtChartBarLocator &);
218 };
219 
220 #endif
void setSecond(vtkQtChartBarLocatorNode *second)
Sets the second child node.
void setFirst(vtkQtChartBarLocatorNode *first)
Sets the first child node.
vtkQtChartBarLocatorNode * getSecond() const
Gets the second child node.
vtkQtChartBar * getElement() const
Gets the chart shape element.
The vtkQtChartBarLocator class is used to locate bars in a tree structure.
const QRectF & getBounds() const
Gets the bounding rectangle.
vtkQtChartBarLocatorNode * getParent() const
Gets the parent node.
bool hasChildren() const
Gets whether or not the node has children.
The vtkQtChartBar class defines a bar used by the chart bar locator.
Definition: vtkQtChartBar.h:35
vtkQtChartBarLocatorNode * getFirst() const
Gets the first child node.
void setParent(vtkQtChartBarLocatorNode *parent)
Sets the parent node.
The vtkQtChartBarLocatorNode class is used to build a tree of chart bar shapes.