VTK
vtkQtChartIndexRangeList.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkQtChartIndexRangeList.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 _vtkQtChartIndexRangeList_h
25 #define _vtkQtChartIndexRangeList_h
26 
27 #include "vtkQtChartExport.h"
28 
29 
34 class VTKQTCHART_EXPORT vtkQtChartIndexRange
35 {
36 public:
38 
44  vtkQtChartIndexRange(int first, int second, bool black=true);
47 
48  vtkQtChartIndexRange &operator=(const vtkQtChartIndexRange &other);
49 
51 
52  int getFirst() const {return this->First;}
57 
65  void setFirst(int first);
66 
71  int getSecond() const {return this->Second;}
72 
80  void setSecond(int second);
81 
87  bool contains(int value) const;
89 
91 
92  bool isBlack() const {return this->Black;}
97 
101  void setBlack(bool black) {this->Black = black;}
102 
107  vtkQtChartIndexRange *getParent() const {return this->Parent;}
108 
112  void setParent(vtkQtChartIndexRange *parent) {this->Parent = parent;}
113 
118  vtkQtChartIndexRange *getLeft() const {return this->Left;}
119 
123  void setLeft(vtkQtChartIndexRange *left) {this->Left = left;}
124 
129  vtkQtChartIndexRange *getRight() const {return this->Right;}
130 
134  void setRight(vtkQtChartIndexRange *right) {this->Right = right;}
136 
137 private:
138  vtkQtChartIndexRange *Parent;
139  vtkQtChartIndexRange *Left;
140  vtkQtChartIndexRange *Right;
141  bool Black;
142  int First;
143  int Second;
144 };
145 
146 
157 class VTKQTCHART_EXPORT vtkQtChartIndexRangeList
158 {
159 public:
161 
166  vtkQtChartIndexRangeList(int first, int second);
169 
170  vtkQtChartIndexRangeList &operator=(const vtkQtChartIndexRangeList &other);
171 
173 
174  bool isEmpty() const {return this->Root == 0;}
179 
184  vtkQtChartIndexRange *getFirst() const;
185 
190  vtkQtChartIndexRange *getLast() const;
191 
199 
206  vtkQtChartIndexRange *getPrevious(vtkQtChartIndexRange *range) const;
208 
210 
211  vtkQtChartIndexRange *findClosest(int value) const;
218 
223  bool contains(int value) const;
225 
227 
228  bool clear();
233 
240  bool setRange(int first, int second);
241 
247  bool setRanges(const vtkQtChartIndexRangeList &ranges);
248 
255  bool addRange(int first, int second);
256 
262  bool addRanges(const vtkQtChartIndexRangeList &ranges);
263 
270  bool subtractRange(int first, int second);
271 
277  bool subtractRanges(const vtkQtChartIndexRangeList &ranges);
278 
286  bool xorRange(int first, int second);
287 
294  bool xorRanges(const vtkQtChartIndexRangeList &ranges);
295 
300  void limitRange(int minimum, int maximum);
301 
313  bool offsetRanges(int start, int offset);
315 
316 private:
324  vtkQtChartIndexRange *findNode(int value, bool left) const;
325 
332  void rotateLeft(vtkQtChartIndexRange *node);
333 
340  void rotateRight(vtkQtChartIndexRange *node);
341 
354  void insertNode(vtkQtChartIndexRange *current, vtkQtChartIndexRange *node,
355  bool left);
356 
367  void removeNode(vtkQtChartIndexRange *node);
368 
373  int removeBetween(vtkQtChartIndexRange *left, vtkQtChartIndexRange *right);
374 
380  vtkQtChartIndexRange *getNextNode(vtkQtChartIndexRange *node) const;
381 
387  vtkQtChartIndexRange *getPreviousNode(vtkQtChartIndexRange *node) const;
388 
394  vtkQtChartIndexRange *getFirstNode(vtkQtChartIndexRange *root) const;
395 
401  vtkQtChartIndexRange *getLastNode(vtkQtChartIndexRange *root) const;
402 
403 private:
404  vtkQtChartIndexRange *Root;
405 };
406 
407 #endif