statistics: implement rectangle selection in scatter plot

Allow the user to select regions of the scatter plot using
a rectangular selection. When shift is pressed, do an
incremental selection.

Unfortunately, the list-selection code is so slow that this
becomes unusable for a large number of selected dives.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-02-01 23:17:04 +01:00 committed by Dirk Hohndel
parent e38b78b2aa
commit d63d4cd3c3
16 changed files with 207 additions and 36 deletions

View file

@ -27,11 +27,14 @@ public:
// Note: this expects that all items are added with increasing pos!
void append(dive *d, double pos, double value);
void selectItemsUnderMouse(const QPointF &point, bool shiftPressed) override;
bool selectItemsUnderMouse(const QPointF &point, bool shiftPressed) override;
bool supportsLassoSelection() const override;
void selectItemsInRect(const QRectF &rect, bool shiftPressed, const std::vector<dive *> &oldSelection) override;
private:
// Get items under mouse.
std::vector<int> getItemsUnderMouse(const QPointF &f) const;
std::vector<int> getItemsInRect(const QRectF &f) const;
struct Item {
ChartItemPtr<ChartScatterItem> item;