USGS

Isis 3.0 Developer's Reference (API)

Home

ViewportBuffer.h
Go to the documentation of this file.
1 #ifndef ViewportBuffer_h
2 #define ViewportBuffer_h
3 
27 #include <vector>
28 
29 #include <QRect>
30 
31 #include "Cube.h"
32 #include "Brick.h"
33 
34 // parent
35 #include <QObject>
36 
37 template<class T > class QQueue;
38 class QRect;
39 
40 namespace Isis {
41  class CubeDataThread;
42  class Brick;
43  class CubeViewport;
44  class ViewportBufferAction;
45  class ViewportBufferFill;
46  class ViewportBufferStretch;
47  class ViewportBufferTransform;
48 
78  class ViewportBuffer : public QObject {
79  Q_OBJECT
80 
81  public:
82  ViewportBuffer(CubeViewport *viewport, CubeDataThread *cubeData,
83  int cubeId);
84  virtual ~ViewportBuffer();
85 
86  const std::vector<double> &getLine(int line);
87 
88  void resizedViewport();
89  void pan(int deltaX, int deltaY);
90 
91  void scaleChanged();
92 
93  void fillBuffer(QRect rect);
94  void fillBuffer(QRect rect, const Brick *data);
95 
96  void emptyBuffer(bool force = false);
97 
98  QRect bufferXYRect();
99 
100  void setBand(int band);
101 
103  int getBand() {
104  return p_band;
105  }
106 
107  void enable(bool enabled);
108 
109  void addStretchAction();
110 
111  double currentProgress();
112  double totalUnfilledArea();
113 
120  bool enabled() {
121  return p_enabled;
122  }
123  bool working();
124 
125  bool hasEntireCube();
126 
127  public slots:
128  void DataReady(void *requester, int cubeId, const Isis::Brick *brick);
129 
130  signals:
142  void ReadCube(int cubeId, int startSample, int startLine,
143  int endSample, int endLine, int band, void *caller);
144 
146  void DoneWithData(int, const Isis::Brick *);
147 
148  private:
149  QRect getXYBoundingRect();
150  QList<double> getSampLineBoundingRect();
151  void updateBoundingRects();
152  void doQueuedActions();
153  void doTransformAction(ViewportBufferTransform *action);
154  void doStretchAction(ViewportBufferStretch *action);
155  void startFillAction(ViewportBufferFill *action);
156 
157  ViewportBufferFill *createViewportBufferFill(QRect, bool);
158 
159  void requestCubeLine(ViewportBufferFill *fill);
160 
161  void resizeBuffer(unsigned int width, unsigned int height);
162  void shiftBuffer(int deltaX, int deltaY);
163  void reinitialize();
164  bool actionsPreserveData();
165  bool reinitializeActionExists();
166  void enqueueAction(ViewportBufferAction *);
167 
168  CubeViewport *p_viewport;
169  int p_cubeId;
170  CubeDataThread *p_dataThread;
171 
172  int p_band;
173 
174  bool p_enabled;
175  std::vector< std::vector<double> > p_buffer;
176  bool p_bufferInitialized;
177 
182  QRect p_XYBoundingRect;
183  QRect p_oldXYBoundingRect;
184 
191  QList< double > p_sampLineBoundingRect;
192  QList< double > p_oldSampLineBoundingRect;
193  int p_viewportHeight;
194  int p_oldViewportHeight;
195  int p_vertScrollBarPos;
196  int p_oldVertScrollBarPos;
197  bool p_initialStretchDone;
198  double p_requestedFillArea;
199 
203  enum sampLineRectPosition {
204  rectLeft = 0,
205  rectTop,
206  rectRight,
207  rectBottom
208  };
209 
216 
217  bool p_bricksOrdered;
218  };
219 }
220 
221 #endif