profile: redo animation of labels and grid lines

The old animation was weird: it would reuse the labels
based on the index, not on the value. Thus, with the
new scaling code, sometimes there was no animation at all,
if the value, but not the position changed.

Consider the values instead and let labels appear/disappear.
This makes things slightly more complex.

While changing this code, create our own animation-class.
Thus, we can avoid having the dive axes being QObjects.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-12-02 23:53:17 +01:00 committed by Dirk Hohndel
parent afb0978460
commit 5c5c0c4880
4 changed files with 216 additions and 106 deletions

View file

@ -29,6 +29,7 @@ class DiveReportedCeiling;
class DiveTemperatureItem;
class DiveTextItem;
class PartialPressureGasItem;
class ProfileAnimation;
class TankItem;
class ProfileScene : public QGraphicsScene {
@ -39,6 +40,8 @@ public:
void resize(QSizeF size);
void clear();
bool pointOnProfile(const QPointF &point) const;
void anim(double fraction); // Called by the animation with 0.0-1.0 (start to stop).
// Can be compared with literal 1.0 to determine "end" state.
// If a plannerModel is passed, the deco-information is taken from there.
void plotDive(const struct dive *d, int dc, DivePlannerPointsModel *plannerModel = nullptr, bool inPlanner = false,
@ -96,6 +99,8 @@ private:
DivePercentageItem *percentageItem;
TankItem *tankItem;
std::shared_ptr<const DivePixmaps> pixmaps;
std::unique_ptr<ProfileAnimation> animation;
std::vector<DiveCartesianAxis *> animatedAxes;
};
#endif