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 <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
35
37{
38 public:
40 BasePlotContext(const BasePlotContext &other);
41 virtual ~BasePlotContext();
42
43 DataKind m_dataKind = DataKind::unset;
44
45 bool m_isMouseDragging = false;
46 bool m_wasMouseDragging = false;
47
48 bool m_isKeyBoardDragging = false;
49 bool m_isLeftPseudoButtonKeyPressed = false;
50 bool m_isRightPseudoButtonKeyPressed = false;
51 bool m_wassKeyBoardDragging = false;
52
56 DragDirections m_dragDirections = DragDirections::NOT_SET;
57
58 IntegrationScopeBaseCstSPtr msp_integrationScope = nullptr;
60 double m_integrationScopeRhombWidth = 0;
61 double m_integrationScopeRhombHeight = 0;
62
63 // The effective range of the axes.
64 QCPRange m_xRange;
65 QCPRange m_yRange;
66
67 // Tell if the mouse move was started onto either axis, because that will
68 // condition if some calculations needs to be performed or not (for example,
69 // if the mouse cursor motion was started on an axis, there is no point to
70 // perform deconvolutions).
71 bool m_wasClickOnXAxis = false;
72 bool m_wasClickOnYAxis = false;
73
74 bool m_isMeasuringDistance = false;
75
76 // The user-selected region over the plot.
77 // Note that we cannot use QCPRange structures because these are normalized by
78 // QCustomPlot in such a manner that lower is actually < upper. But we need
79 // for a number of our calculations (specifically for the deconvolutions) to
80 // actually have the lower value be start drag point.x even if the drag
81 // direction was from right to left.
82 double m_xRegionRangeStart = std::numeric_limits<double>::min();
83 double m_xRegionRangeEnd = std::numeric_limits<double>::min();
84
85 double m_yRegionRangeStart = std::numeric_limits<double>::min();
86 double m_yRegionRangeEnd = std::numeric_limits<double>::min();
87
88 double m_xDelta = 0;
89 double m_yDelta = 0;
90
93
94 Qt::KeyboardModifiers m_keyboardModifiers;
95
96 Qt::MouseButtons m_lastPressedMouseButton;
97 Qt::MouseButtons m_lastReleasedMouseButton;
98
99 Qt::MouseButtons m_pressedMouseButtons;
100
103
104 void updateIntegrationScope();
105 void updateIntegrationScopeRect();
106 void updateIntegrationScopeRhomb();
107 void updateIntegrationScopeRhombHorizontal();
108 void updateIntegrationScopeRhombVertical();
109
110 BasePlotContext &operator=(const BasePlotContext &other);
111
112 DragDirections recordDragDirections();
113
114 QString toString() const;
115};
116
117
118} // 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:211
std::shared_ptr< const IntegrationScopeBase > IntegrationScopeBaseCstSPtr