VTK
vtkQtChartShapeLocator.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkQtChartShapeLocator.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 _vtkQtChartShapeLocator_h
25 #define _vtkQtChartShapeLocator_h
26 
27 #include "vtkQtChartExport.h"
28 #include <QLinkedList> // Needed for parameter.
29 #include <QList> // Needed for parameter.
30 
31 class vtkQtChartShape;
32 class QPointF;
33 class QRectF;
34 
35 
40 class VTKQTCHART_EXPORT vtkQtChartShapeLocatorNode
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  vtkQtChartShape *getElement() const {return this->Element;}
79 
83  void setElement(vtkQtChartShape *element);
84 
89  vtkQtChartShapeLocatorNode *getParent() const {return this->Parent;}
90 
94  void setParent(vtkQtChartShapeLocatorNode *parent) {this->Parent = parent;}
95 
100  bool hasChildren() const {return this->Nodes.size() > 0;}
101 
106  const QList<vtkQtChartShapeLocatorNode *> &getNodes() const {return this->Nodes;}
107 
112  QList<vtkQtChartShapeLocatorNode *> &getNodes() {return this->Nodes;}
113 
119  void updateBounds();
120 
121 private:
122  QRectF *Bounds;
123  vtkQtChartShape *Element;
125  QList<vtkQtChartShapeLocatorNode *> Nodes;
126 
127 private:
130 };
131 
132 
142 class VTKQTCHART_EXPORT vtkQtChartShapeLocator
143 {
144 public:
147 
149  void clear();
150 
158  void build(const QList<QList<vtkQtChartShape *> > &table);
159 
170  void build(const QList<vtkQtChartShape *> &list);
171 
178  void update();
179 
185  QList<vtkQtChartShape *> getItemsAt(const QPointF &point) const;
186 
192  QList<vtkQtChartShape *> getItemsIn(const QRectF &area) const;
193 
198  vtkQtChartShapeLocatorNode *getLast();
199 
206 
207 public:
215  static void sort(QList<vtkQtChartShape *> &list);
216 
217 private:
221  void build(QLinkedList<QLinkedList<vtkQtChartShapeLocatorNode *> > &table);
222 
223 private:
225 
226 private:
229 };
230 
231 #endif