forked from BITS-DIC/BITS-DIC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
disp.cpp
46 lines (40 loc) · 1.12 KB
/
disp.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "disp.h"
#include <QtDebug>
Disp::Disp(unsigned int rows, unsigned int cols)
{
this->rows = rows;
this->cols = cols;
plot.assign(this->rows, std::vector<double>(this->cols, 0));
}
Disp::~Disp() {
plot.clear();
}
void Disp::setValue(double value, unsigned int row, unsigned int col) {
if(row >= getRows() || col >= getCols()) {
qDebug() << QString("row(%1) or col(%2) greater than max allowed Row(%3) and Col(%4)")
.arg(row)
.arg(col)
.arg(getRows())
.arg(getCols());
} else {
plot[row][col] = value;
}
}
double Disp::getValue(unsigned int row, unsigned int col) {
if(row >= getRows() || col >= getCols()) {
qDebug() << QString("row(%1) or col(%2) greater than max allowed Row(%3) and Col(%4)")
.arg(row)
.arg(col)
.arg(getRows())
.arg(getCols());
} else {
return plot[row][col];
}
return 0;
}
unsigned int Disp::getRows() {
return rows;
}
unsigned int Disp::getCols() {
return cols;
}