Isis 3 Programmer Reference
ViewportBufferFill.cpp
1 
2 #include "ViewportBufferFill.h"
3 
4 #include <algorithm>
5 #include <iostream>
6 
7 #include <QRect>
8 #include <QPoint>
9 
10 using namespace std;
11 
12 namespace Isis {
23  ViewportBufferFill::ViewportBufferFill(const QRect &rect,
24  const int &xCoef, const double &xScale, const int &yCoef,
25  const double &yScale, const QPoint &topLeftPixel)
27  p_rect = NULL;
28  p_topLeftPixel = NULL;
29 
30  p_rect = new QRect(rect);
31  p_topLeftPixel = new QPoint(topLeftPixel);
32  p_requestPosition = rect.top();
33  p_readPosition = rect.top();
34  p_xCoef = xCoef;
35  p_xScale = xScale;
36  p_yCoef = yCoef;
37  p_yScale = yScale;
38  }
39 
44  if(p_rect) {
45  delete p_rect;
46  p_rect = NULL;
47  }
48 
49  if(p_topLeftPixel) {
50  delete p_topLeftPixel;
51  p_topLeftPixel = NULL;
52  }
53  }
54 
61  return p_topLeftPixel->y();
62  }
63 
64 
71  return p_topLeftPixel->x();
72  }
73 
74 
81  return p_readPosition >= (unsigned)(p_rect->top() + p_rect->height());
82  }
83 
84 
91  return p_requestPosition < (unsigned)(p_rect->top() + p_rect->height());
92  }
93 
94 
99  p_rect->setBottom(p_requestPosition - 1);
100  }
101 
102 
111  bool ViewportBufferFill::shouldPaint(int &linesToPaint) {
112  if(p_rect->height() < STEPSIZE)
113  linesToPaint = p_rect->height();
114  else
115  linesToPaint = STEPSIZE;
116 
117  return p_readPosition % STEPSIZE == 0 || doneReading();
118  }
119 }
int getLeftmostPixelPosition()
Returns the left of the X/Y bounding rect for this fill.
QPoint * p_topLeftPixel
Top left of the viewport for this fill.
bool shouldRequestMore()
Returns true if request position is past the end of the fill.
bool shouldPaint(int &linesToPaint)
Returns true if it is recommended to paint the fill area so far.
Namespace for the standard library.
unsigned int p_readPosition
Position of the cube reads.
void stop()
Cancels the current operation.
double p_xScale
viewport to sample/line x scalar
bool doneReading()
Returns true if read position is past the end of the fill.
unsigned int p_requestPosition
Position of the cube requests.
int p_xCoef
viewport to sample/line x coef
QRect * p_rect
Rect this fill represents.
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
static const int STEPSIZE
how many cube lines per paint if painting inbetween gets re-enabled
double p_yScale
viewport to sample/line y scalar
int p_yCoef
viewport to sample/line y coef
int getTopmostPixelPosition()
Returns the top of the X/Y bounding rect for this fill.