mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Simplfy the code for the cylinder pressure.
Instead of asking the data as we do on the generic models, use the internal knowledge of the class. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
0a4e21a168
commit
21d34db3a9
1 changed files with 6 additions and 9 deletions
|
@ -226,22 +226,19 @@ void DiveGasPressureItem::modelDataChanged()
|
||||||
QPolygonF boundingPoly; // This is the "Whole Item", but a pressure can be divided in N Polygons.
|
QPolygonF boundingPoly; // This is the "Whole Item", but a pressure can be divided in N Polygons.
|
||||||
polygons.clear();
|
polygons.clear();
|
||||||
|
|
||||||
for (int i = 0; i < dataModel->rowCount(); i++) {
|
for (int i = 0, count = dataModel->rowCount(); i < count; i++) {
|
||||||
int sPressure = dataModel->index(i, DivePlotDataModel::SENSOR_PRESSURE).data().toInt();
|
plot_data* entry = dataModel->data() + i;
|
||||||
int iPressure = dataModel->index(i, DivePlotDataModel::INTERPOLATED_PRESSURE).data().toInt();
|
int mbar = GET_PRESSURE(entry);
|
||||||
int cylIndex = dataModel->index(i, DivePlotDataModel::CYLINDERINDEX).data().toInt();
|
|
||||||
int sec = dataModel->index(i, DivePlotDataModel::TIME).data().toInt();
|
|
||||||
int mbar = sPressure ? sPressure : iPressure;
|
|
||||||
|
|
||||||
if (cylIndex != last_index) {
|
if (entry->cylinderindex != last_index) {
|
||||||
polygons.append(QPolygonF()); // this is the polygon that will be actually drawned on screen.
|
polygons.append(QPolygonF()); // this is the polygon that will be actually drawned on screen.
|
||||||
last_index = cylIndex;
|
last_index = entry->cylinderindex;
|
||||||
}
|
}
|
||||||
if (!mbar) {
|
if (!mbar) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPointF point(hAxis->posAtValue(sec), vAxis->posAtValue(mbar));
|
QPointF point(hAxis->posAtValue(entry->sec), vAxis->posAtValue(mbar));
|
||||||
boundingPoly.push_back(point); // The BoundingRect
|
boundingPoly.push_back(point); // The BoundingRect
|
||||||
polygons.last().push_back(point); // The polygon thta will be plotted.
|
polygons.last().push_back(point); // The polygon thta will be plotted.
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue