Isis 3 Programmer Reference
ViewportBufferFill.cpp
1
7/* SPDX-License-Identifier: CC0-1.0 */
8
9#include "ViewportBufferFill.h"
10
11#include <algorithm>
12#include <iostream>
13
14#include <QRect>
15#include <QPoint>
16
17using namespace std;
18
19namespace Isis {
31 const int &xCoef, const double &xScale, const int &yCoef,
32 const double &yScale, const QPoint &topLeftPixel)
34 p_rect = NULL;
35 p_topLeftPixel = NULL;
36
37 p_rect = new QRect(rect);
38 p_topLeftPixel = new QPoint(topLeftPixel);
39 p_requestPosition = rect.top();
40 p_readPosition = rect.top();
41 p_xCoef = xCoef;
42 p_xScale = xScale;
43 p_yCoef = yCoef;
44 p_yScale = yScale;
45 }
46
51 if(p_rect) {
52 delete p_rect;
53 p_rect = NULL;
54 }
55
56 if(p_topLeftPixel) {
57 delete p_topLeftPixel;
58 p_topLeftPixel = NULL;
59 }
60 }
61
70
71
80
81
88 return p_readPosition >= (unsigned)(p_rect->top() + p_rect->height());
89 }
90
91
98 return p_requestPosition < (unsigned)(p_rect->top() + p_rect->height());
99 }
100
101
106 p_rect->setBottom(p_requestPosition - 1);
107 }
108
109
118 bool ViewportBufferFill::shouldPaint(int &linesToPaint) {
119 if(p_rect->height() < STEPSIZE)
120 linesToPaint = p_rect->height();
121 else
122 linesToPaint = STEPSIZE;
123
124 return p_readPosition % STEPSIZE == 0 || doneReading();
125 }
126}
int p_yCoef
viewport to sample/line y coef
int getTopmostPixelPosition()
Returns the top of the X/Y bounding rect for this fill.
int getLeftmostPixelPosition()
Returns the left of the X/Y bounding rect for this fill.
unsigned int p_requestPosition
Position of the cube requests.
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
QPoint * p_topLeftPixel
Top left of the viewport for this fill.
void stop()
Cancels the current operation.
unsigned int p_readPosition
Position of the cube reads.
QRect * p_rect
Rect this fill represents.
bool shouldPaint(int &linesToPaint)
Returns true if it is recommended to paint the fill area so far.
bool shouldRequestMore()
Returns true if request position is past the end of the fill.
bool doneReading()
Returns true if read position is past the end of the fill.
ViewportBufferFill(const QRect &rect, const int &xCoef, const double &xScale, const int &yCoef, const double &yScale, const QPoint &topLeftPixel)
Constructor.
int p_xCoef
viewport to sample/line x coef
double p_xScale
viewport to sample/line x scalar
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
Namespace for the standard library.