libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
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 <QPointF>
11#include <QString>
12
13/////////////////////// Local includes
14#include "../../core/types.h"
18
19
20////////////////////// Other includes
21#include "qcustomplot.h"
22
23namespace pappso
24{
25
26Q_NAMESPACE
27
29{
30 NOT_SET = 0x0000,
31 LEFT_TO_RIGHT = 1 << 0,
32 RIGHT_TO_LEFT = 1 << 1,
33 TOP_TO_BOTTOM = 1 << 2,
34 BOTTOM_TO_TOP = 1 << 3
35};
36Q_ENUM_NS(DragDirections)
37
38extern std::map<Qt::MouseButton, QString> qtMouseButtonMap;
39extern std::map<Qt::MouseButtons, QString> qtMouseButtonsMap;
40
41extern std::map<Qt::KeyboardModifier, QString> qtKeyboardModifierMap;
42
43
45{
46 public:
47 explicit BasePlotContext();
48
49 virtual ~BasePlotContext();
50
51 BasePlotContext *clone();
52 void initialize(const BasePlotContext &other);
53
54 BasePlotContext(const BasePlotContext &other);
55 BasePlotContext &operator=(const BasePlotContext &other);
56
57 Enums::DataKind m_dataKind = Enums::DataKind::unset;
58
59 bool m_isMouseDragging = false;
60 bool m_wasMouseDragging = false;
61
62 bool m_isKeyBoardDragging = false;
63 bool m_isLeftPseudoButtonKeyPressed = false;
64 bool m_isRightPseudoButtonKeyPressed = false;
65 bool m_wasKeyBoardDragging = false;
66
70 DragDirections m_dragDirections = DragDirections::NOT_SET;
71
72 IntegrationScopeBase *mpa_integrationScope = nullptr;
74 double m_integrationScopeRhombWidth = 0;
75 double m_integrationScopeRhombHeight = 0;
76
77 // The effective range of the axes.
78 QCPRange m_xRange;
79 QCPRange m_yRange;
80
81 // Tell if the mouse move was started onto either axis, because that will
82 // condition if some calculations needs to be performed or not (for example,
83 // if the mouse cursor motion was started on an axis, there is no point to
84 // perform deconvolutions).
85 bool m_wasClickOnXAxis = false;
86 bool m_wasClickOnYAxis = false;
87
88 bool m_isMeasuringDistance = false;
89
90 // The user-selected region over the plot.
91 // Note that we cannot use QCPRange structures because these are normalized by
92 // QCustomPlot in such a manner that lower is actually < upper. But we need
93 // for a number of our calculations (specifically for the deconvolutions) to
94 // actually have the lower value be start drag point.x even if the drag
95 // direction was from right to left.
96 double m_xRegionRangeStart = std::numeric_limits<double>::min();
97 double m_xRegionRangeStop = std::numeric_limits<double>::min();
98
99 double m_yRegionRangeStart = std::numeric_limits<double>::min();
100 double m_yRegionRangeStop = std::numeric_limits<double>::min();
101
102 double m_xDelta = 0;
103 double m_yDelta = 0;
104
111
112 Qt::KeyboardModifiers m_keyboardModifiers;
113
114 Qt::MouseButtons m_lastPressedMouseButton;
116
117 Qt::MouseButtons m_pressedMouseButtons;
118
121
122 void updateIntegrationScope();
123 void updateIntegrationScopeRect();
124 void updateIntegrationScopeRhomb();
125 void updateIntegrationScopeRhombHorizontal();
126 void updateIntegrationScopeRhombVertical();
127
128 DragDirections recordDragDirections();
129
130 QString toString() const;
131 QString dragDirectionsToString() const;
132};
133
134
135} // 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
std::map< Qt::MouseButton, QString > qtMouseButtonMap
std::map< Qt::MouseButtons, QString > qtMouseButtonsMap
std::map< Qt::KeyboardModifier, QString > qtKeyboardModifierMap