00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00023
00024 #ifndef _vtkQtChartIndexRangeList_h
00025 #define _vtkQtChartIndexRangeList_h
00026
00027 #include "vtkQtChartExport.h"
00028
00029
00034 class VTKQTCHART_EXPORT vtkQtChartIndexRange
00035 {
00036 public:
00037 vtkQtChartIndexRange();
00038
00044 vtkQtChartIndexRange(int first, int second, bool black=true);
00045 vtkQtChartIndexRange(const vtkQtChartIndexRange &other);
00046 ~vtkQtChartIndexRange();
00047
00048 vtkQtChartIndexRange &operator=(const vtkQtChartIndexRange &other);
00049
00051
00052
00053
00054
00055
00056 int getFirst() const {return this->First;}
00057
00065 void setFirst(int first);
00066
00071 int getSecond() const {return this->Second;}
00072
00080 void setSecond(int second);
00081
00087 bool contains(int value) const;
00089
00091
00092
00093
00094
00095
00096 bool isBlack() const {return this->Black;}
00097
00101 void setBlack(bool black) {this->Black = black;}
00102
00107 vtkQtChartIndexRange *getParent() const {return this->Parent;}
00108
00112 void setParent(vtkQtChartIndexRange *parent) {this->Parent = parent;}
00113
00118 vtkQtChartIndexRange *getLeft() const {return this->Left;}
00119
00123 void setLeft(vtkQtChartIndexRange *left) {this->Left = left;}
00124
00129 vtkQtChartIndexRange *getRight() const {return this->Right;}
00130
00134 void setRight(vtkQtChartIndexRange *right) {this->Right = right;}
00136
00137 private:
00138 vtkQtChartIndexRange *Parent;
00139 vtkQtChartIndexRange *Left;
00140 vtkQtChartIndexRange *Right;
00141 bool Black;
00142 int First;
00143 int Second;
00144 };
00145
00146
00157 class VTKQTCHART_EXPORT vtkQtChartIndexRangeList
00158 {
00159 public:
00160 vtkQtChartIndexRangeList();
00161
00166 vtkQtChartIndexRangeList(int first, int second);
00167 vtkQtChartIndexRangeList(const vtkQtChartIndexRangeList &other);
00168 ~vtkQtChartIndexRangeList();
00169
00170 vtkQtChartIndexRangeList &operator=(const vtkQtChartIndexRangeList &other);
00171
00173
00174
00175
00176
00177
00178 bool isEmpty() const {return this->Root == 0;}
00179
00184 vtkQtChartIndexRange *getFirst() const;
00185
00190 vtkQtChartIndexRange *getLast() const;
00191
00198 vtkQtChartIndexRange *getNext(vtkQtChartIndexRange *range) const;
00199
00206 vtkQtChartIndexRange *getPrevious(vtkQtChartIndexRange *range) const;
00208
00210
00211
00212
00213
00214
00215
00216
00217 vtkQtChartIndexRange *findClosest(int value) const;
00218
00223 bool contains(int value) const;
00225
00227
00228
00229
00230
00231
00232 bool clear();
00233
00240 bool setRange(int first, int second);
00241
00247 bool setRanges(const vtkQtChartIndexRangeList &ranges);
00248
00255 bool addRange(int first, int second);
00256
00262 bool addRanges(const vtkQtChartIndexRangeList &ranges);
00263
00270 bool subtractRange(int first, int second);
00271
00277 bool subtractRanges(const vtkQtChartIndexRangeList &ranges);
00278
00286 bool xorRange(int first, int second);
00287
00294 bool xorRanges(const vtkQtChartIndexRangeList &ranges);
00295
00300 void limitRange(int minimum, int maximum);
00301
00313 bool offsetRanges(int start, int offset);
00315
00316 private:
00324 vtkQtChartIndexRange *findNode(int value, bool left) const;
00325
00332 void rotateLeft(vtkQtChartIndexRange *node);
00333
00340 void rotateRight(vtkQtChartIndexRange *node);
00341
00354 void insertNode(vtkQtChartIndexRange *current, vtkQtChartIndexRange *node,
00355 bool left);
00356
00367 void removeNode(vtkQtChartIndexRange *node);
00368
00373 int removeBetween(vtkQtChartIndexRange *left, vtkQtChartIndexRange *right);
00374
00380 vtkQtChartIndexRange *getNextNode(vtkQtChartIndexRange *node) const;
00381
00387 vtkQtChartIndexRange *getPreviousNode(vtkQtChartIndexRange *node) const;
00388
00394 vtkQtChartIndexRange *getFirstNode(vtkQtChartIndexRange *root) const;
00395
00401 vtkQtChartIndexRange *getLastNode(vtkQtChartIndexRange *root) const;
00402
00403 private:
00404 vtkQtChartIndexRange *Root;
00405 };
00406
00407 #endif