libpappsomspp
Library for mass spectrometry
baseplotcontext.h
Go to the documentation of this file.
1 // Copyright 2021 Filippo Rusconi
2 // GPL3+
3 
4 #pragma once
5 
6 /////////////////////// StdLib includes
7 
8 
9 /////////////////////// Qt includes
10 #include <QString>
11 #include <QPointF>
12 
13 ////////////////////// Other includes
14 #include "qcustomplot.h"
15 
16 /////////////////////// Local includes
17 #include "../../types.h"
18 #include "../../exportinmportconfig.h"
19 #include "../../processing/combiners/selectionpolygon.h"
20 
21 
22 namespace pappso
23 {
24 
25 enum class DragDirections
26 {
27  NOT_SET = 0x0000,
28  LEFT_TO_RIGHT = 1 << 0,
29  RIGHT_TO_LEFT = 1 << 1,
30  TOP_TO_BOTTOM = 1 << 2,
31  BOTTOM_TO_TOP = 1 << 3
32 };
33 
34 
36 {
37  public:
39  BasePlotContext(const BasePlotContext &other);
40  virtual ~BasePlotContext();
41 
42  BasePlotContext &operator=(const BasePlotContext &other);
43 
44  DataKind m_dataKind = DataKind::unset;
45 
46  bool m_isMouseDragging = false;
47  bool m_wasMouseDragging = false;
48 
49  bool m_isKeyBoardDragging = false;
50  bool m_isLeftPseudoButtonKeyPressed = false;
51  bool m_isRightPseudoButtonKeyPressed = false;
52  bool m_wassKeyBoardDragging = false;
53 
58 
60  double m_selectRectangleWidth = 0;
61 
62  // The effective range of the axes.
63  QCPRange m_xRange;
64  QCPRange m_yRange;
65 
66  // Tell if the mouse move was started onto either axis, because that will
67  // condition if some calculations needs to be performed or not (for example,
68  // if the mouse cursor motion was started on an axis, there is no point to
69  // perform deconvolutions).
70  bool m_wasClickOnXAxis = false;
71  bool m_wasClickOnYAxis = false;
72 
73  bool m_isMeasuringDistance = false;
74 
75  // The user-selected region over the plot.
76  // Note that we cannot use QCPRange structures because these are normalized by
77  // QCustomPlot in such a manner that lower is actually < upper. But we need
78  // for a number of our calculations (specifically for the deconvolutions) to
79  // actually have the lower value be start drag point.x even if the drag
80  // direction was from right to left.
81  double m_xRegionRangeStart = std::numeric_limits<double>::min();
82  double m_xRegionRangeEnd = std::numeric_limits<double>::min();
83 
84  double m_yRegionRangeStart = std::numeric_limits<double>::min();
85  double m_yRegionRangeEnd = std::numeric_limits<double>::min();
86 
87  double m_xDelta = 0;
88  double m_yDelta = 0;
89 
92 
93  Qt::KeyboardModifiers m_keyboardModifiers;
94 
95  Qt::MouseButtons m_lastPressedMouseButton;
96  Qt::MouseButtons m_lastReleasedMouseButton;
97 
98  Qt::MouseButtons m_pressedMouseButtons;
99 
100  Qt::MouseButtons m_mouseButtonsAtMousePress;
102 
103  DragDirections recordDragDirections();
104  QString toString() const;
105 };
106 
107 
108 } // namespace pappso
Qt::MouseButtons m_mouseButtonsAtMousePress
SelectionPolygon m_selectionPolygon
Qt::KeyboardModifiers m_keyboardModifiers
Qt::MouseButtons m_lastPressedMouseButton
Qt::MouseButtons m_pressedMouseButtons
Qt::MouseButtons m_mouseButtonsAtMouseRelease
Qt::MouseButtons m_lastReleasedMouseButton
#define PMSPP_LIB_DECL
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39
DataKind
Definition: types.h:172