mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Adjust planner to work with the new semantic
Insert the dive data point at 0,0 manually at the beginning of the plan. Now everything should work. We still can't edit a plan created like this, but at least we can once again plan things. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
edecb0fcf9
commit
6d5b2d7592
1 changed files with 17 additions and 19 deletions
|
@ -487,18 +487,16 @@ void DivePlannerGraphics::drawProfile()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Re-position the user generated dive handlers
|
// Re-position the user generated dive handlers
|
||||||
for (int i = 0; i < plannerModel->rowCount(); i++) {
|
for (int i = 1; i < plannerModel->rowCount(); i++) {
|
||||||
divedatapoint dp = plannerModel->at(i);
|
divedatapoint dp = plannerModel->at(i);
|
||||||
DiveHandler *h = handles.at(i);
|
DiveHandler *h = handles.at(i);
|
||||||
h->setPos(timeLine->posAtValue(dp.time / 60), depthLine->posAtValue(dp.depth));
|
h->setPos(timeLine->posAtValue(dp.time / 60), depthLine->posAtValue(dp.depth));
|
||||||
QPointF p1 = (i == 0) ? QPointF(timeLine->posAtValue(0), depthLine->posAtValue(0)) : handles[i-1]->pos();
|
QPointF p1 = handles[i-1]->pos();
|
||||||
QPointF p2 = handles[i]->pos();
|
QPointF p2 = handles[i]->pos();
|
||||||
QLineF line(p1, p2);
|
QLineF line(p1, p2);
|
||||||
if (i > 0) {
|
QPointF pos = line.pointAt(0.5);
|
||||||
QPointF pos = line.pointAt(0.5);
|
gases[i]->setPos(pos);
|
||||||
gases[i]->setPos(pos);
|
gases[i]->setText(strForAir(plannerModel->at(i-1)));
|
||||||
gases[i]->setText(strForAir(plannerModel->at(i-1)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// (re-) create the profile with different colors for segments that were
|
// (re-) create the profile with different colors for segments that were
|
||||||
|
@ -1104,21 +1102,21 @@ bool divePointsLessThan(const divedatapoint& p1, const divedatapoint& p2)
|
||||||
int DivePlannerPointsModel::addStop(int milimeters, int minutes, int o2, int he, int ccpoint)
|
int DivePlannerPointsModel::addStop(int milimeters, int minutes, int o2, int he, int ccpoint)
|
||||||
{
|
{
|
||||||
int row = divepoints.count();
|
int row = divepoints.count();
|
||||||
#if 0 // this seems bogus
|
if(row == 0) {
|
||||||
if(milimeters == 0 && minutes == 0) {
|
beginInsertRows(QModelIndex(), row, row);
|
||||||
if(row == 0) {
|
divedatapoint point;
|
||||||
milimeters = M_OR_FT(10,30);
|
point.depth = 0;
|
||||||
minutes = 600;
|
point.time = 0;
|
||||||
} else {
|
point.o2 = o2;
|
||||||
divedatapoint p = at(row-1);
|
point.he = he;
|
||||||
milimeters = p.depth;
|
point.po2 = ccpoint;
|
||||||
minutes = p.time + 600;
|
divepoints.append( point );
|
||||||
}
|
endInsertRows();
|
||||||
|
row++;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// check if there's already a new stop before this one:
|
// check if there's already a new stop before this one:
|
||||||
for (int i = 0; i < divepoints.count(); i++) {
|
for (int i = 0; i < row; i++) {
|
||||||
const divedatapoint& dp = divepoints.at(i);
|
const divedatapoint& dp = divepoints.at(i);
|
||||||
if (dp.time == minutes) {
|
if (dp.time == minutes) {
|
||||||
row = i;
|
row = i;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue