From 5b0f4e79c4767f6d4e305e1607d7749330531a21 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 19 Aug 2014 21:07:43 -0500 Subject: Mark manually entered waypoints as such With this information, when we re-plan a dive we can bring the user right back to the point where they ended - they have the waypoints in the dive pointes table and handles are shown on the right points in the profile - and the rest of the dive is once again calculated by the planning algorithm. For now this state is lost when saving the dive file as we don't add this flag in the sample to our saved files. So if we don't find any samples marked as manually added we add ALL of the samples as way points on the diveplan and the user has to manually remove the ones that were calculated. Signed-off-by: Dirk Hohndel --- qt-ui/diveplanner.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'qt-ui/diveplanner.cpp') diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index 8775196b7..8e5229a26 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -111,10 +111,16 @@ void DivePlannerPointsModel::loadFromDive(dive *d) CylindersModel::instance()->updateDive(); duration_t lasttime = {}; struct gasmix gas; + free_dps(&diveplan); diveplan.when = d->when; + // is this a "new" dive where we marked manually entered samples? + // if yes then the first sample should be marked + // if it is we only add the manually entered samples as waypoints to the diveplan + // otherwise we have to add all of them + bool hasMarkedSamples = d->dc.sample[0].manually_entered; for (int i = 0; i < d->dc.samples - 1; i++) { const sample &s = d->dc.sample[i]; - if (s.time.seconds == 0) + if (s.time.seconds == 0 || (hasMarkedSamples && !s.manually_entered)) continue; get_gas_at_time(d, &d->dc, lasttime, &gas); plannerModel->addStop(s.depth.mm, s.time.seconds, &gas, 0, true); -- cgit v1.2.3-70-g09d2