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/integrationscopebase.h"
20#include "../../processing/combiners/selectionpolygon.h"
21
22
23namespace pappso
24{
25
27{
28 NOT_SET = 0x0000,
29 LEFT_TO_RIGHT = 1 << 0,
30 RIGHT_TO_LEFT = 1 << 1,
31 TOP_TO_BOTTOM = 1 << 2,
32 BOTTOM_TO_TOP = 1 << 3
33};
34
35extern std::map<Qt::MouseButton, QString> qtMouseButtonMap;
36extern std::map<Qt::MouseButtons, QString> qtMouseButtonsMap;
37
38
40{
41 public:
43 BasePlotContext(const BasePlotContext &other);
44 virtual ~BasePlotContext();
45
47
48 bool m_isMouseDragging = false;
49 bool m_wasMouseDragging = false;
50
51 bool m_isKeyBoardDragging = false;
52 bool m_isLeftPseudoButtonKeyPressed = false;
53 bool m_isRightPseudoButtonKeyPressed = false;
54 bool m_wassKeyBoardDragging = false;
55
60
61 IntegrationScopeBaseCstSPtr msp_integrationScope = nullptr;
63 double m_integrationScopeRhombWidth = 0;
64 double m_integrationScopeRhombHeight = 0;
65
66 // The effective range of the axes.
67 QCPRange m_xRange;
68 QCPRange m_yRange;
69
70 // Tell if the mouse move was started onto either axis, because that will
71 // condition if some calculations needs to be performed or not (for example,
72 // if the mouse cursor motion was started on an axis, there is no point to
73 // perform deconvolutions).
74 bool m_wasClickOnXAxis = false;
75 bool m_wasClickOnYAxis = false;
76
77 bool m_isMeasuringDistance = false;
78
79 // The user-selected region over the plot.
80 // Note that we cannot use QCPRange structures because these are normalized by
81 // QCustomPlot in such a manner that lower is actually < upper. But we need
82 // for a number of our calculations (specifically for the deconvolutions) to
83 // actually have the lower value be start drag point.x even if the drag
84 // direction was from right to left.
85 double m_xRegionRangeStart = std::numeric_limits<double>::min();
86 double m_xRegionRangeEnd = std::numeric_limits<double>::min();
87
88 double m_yRegionRangeStart = std::numeric_limits<double>::min();
89 double m_yRegionRangeEnd = std::numeric_limits<double>::min();
90
91 double m_xDelta = 0;
92 double m_yDelta = 0;
93
96
97 Qt::KeyboardModifiers m_keyboardModifiers;
98
99 Qt::MouseButtons m_lastPressedMouseButton;
101
102 Qt::MouseButtons m_pressedMouseButtons;
103
106
107 void updateIntegrationScope();
108 void updateIntegrationScopeRect();
109 void updateIntegrationScopeRhomb();
110 void updateIntegrationScopeRhombHorizontal();
111 void updateIntegrationScopeRhombVertical();
112
113 BasePlotContext &operator=(const BasePlotContext &other);
114
115 DragDirections recordDragDirections();
116
117 QString toString() const;
118};
119
120
121} // 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
DataKind
Definition: types.h:229
std::shared_ptr< const IntegrationScopeBase > IntegrationScopeBaseCstSPtr
std::map< Qt::MouseButtons, QString > qtMouseButtonsMap