libpappsomspp
Library for mass spectrometry
pappso::BasePlotContext Class Reference

#include <baseplotcontext.h>

Inheritance diagram for pappso::BasePlotContext:
pappso::MassSpecTracePlotContext

Public Member Functions

 BasePlotContext ()
 
 BasePlotContext (const BasePlotContext &other)
 
virtual ~BasePlotContext ()
 
BasePlotContextoperator= (const BasePlotContext &other)
 
DragDirections recordDragDirections ()
 
QString toString () const
 

Public Attributes

DataKind m_dataKind = DataKind::unset
 
bool m_isMouseDragging = false
 
bool m_wasMouseDragging = false
 
bool m_isKeyBoardDragging = false
 
bool m_isLeftPseudoButtonKeyPressed = false
 
bool m_isRightPseudoButtonKeyPressed = false
 
bool m_wassKeyBoardDragging = false
 
QPointF m_startDragPoint
 
QPointF m_currentDragPoint
 
QPointF m_lastCursorHoveredPoint
 
DragDirections m_dragDirections = DragDirections::NOT_SET
 
SelectionPolygon m_selectionPolygon
 
double m_selectRectangleWidth = 0
 
QCPRange m_xRange
 
QCPRange m_yRange
 
bool m_wasClickOnXAxis = false
 
bool m_wasClickOnYAxis = false
 
bool m_isMeasuringDistance = false
 
double m_xRegionRangeStart = std::numeric_limits<double>::min()
 
double m_xRegionRangeEnd = std::numeric_limits<double>::min()
 
double m_yRegionRangeStart = std::numeric_limits<double>::min()
 
double m_yRegionRangeEnd = std::numeric_limits<double>::min()
 
double m_xDelta = 0
 
double m_yDelta = 0
 
int m_pressedKeyCode
 
int m_releasedKeyCode
 
Qt::KeyboardModifiers m_keyboardModifiers
 
Qt::MouseButtons m_lastPressedMouseButton
 
Qt::MouseButtons m_lastReleasedMouseButton
 
Qt::MouseButtons m_pressedMouseButtons
 
Qt::MouseButtons m_mouseButtonsAtMousePress
 
Qt::MouseButtons m_mouseButtonsAtMouseRelease
 

Detailed Description

Definition at line 35 of file baseplotcontext.h.

Constructor & Destructor Documentation

◆ BasePlotContext() [1/2]

pappso::BasePlotContext::BasePlotContext ( )

Definition at line 9 of file baseplotcontext.cpp.

10 {
11 }

◆ BasePlotContext() [2/2]

pappso::BasePlotContext::BasePlotContext ( const BasePlotContext other)

Definition at line 14 of file baseplotcontext.cpp.

15 {
16  m_dataKind = other.m_dataKind;
17 
18  m_isMouseDragging = other.m_isMouseDragging;
19  m_wasMouseDragging = other.m_wasMouseDragging;
20 
21  m_isKeyBoardDragging = other.m_isKeyBoardDragging;
22  m_isLeftPseudoButtonKeyPressed = other.m_isLeftPseudoButtonKeyPressed;
23  m_isRightPseudoButtonKeyPressed = other.m_isRightPseudoButtonKeyPressed;
24  m_wassKeyBoardDragging = other.m_wassKeyBoardDragging;
25 
26  m_startDragPoint = other.m_startDragPoint;
27  m_currentDragPoint = other.m_currentDragPoint;
28  m_lastCursorHoveredPoint = other.m_lastCursorHoveredPoint;
29 
30  m_selectionPolygon = other.m_selectionPolygon;
31  m_selectRectangleWidth = other.m_selectRectangleWidth;
32 
33  // The effective range of the axes.
34  m_xRange = other.m_xRange;
35  m_yRange = other.m_yRange;
36 
37  // Tell if the mouse move was started onto either axis, because that will
38  // condition if some calculations needs to be performed or not (for example,
39  // if the mouse cursor motion was started on an axis, there is no point to
40  // perform deconvolutions).
41  m_wasClickOnXAxis = other.m_wasClickOnXAxis;
42  m_wasClickOnYAxis = other.m_wasClickOnYAxis;
43 
44  m_isMeasuringDistance = other.m_isMeasuringDistance;
45 
46  // The user-selected region over the plot.
47  // Note that we cannot use QCPRange structures because these are normalized by
48  // QCustomPlot in such a manner that lower is actually < upper. But we need
49  // for a number of our calculations (specifically for the deconvolutions) to
50  // actually have the lower value be start drag point.x even if the drag
51  // direction was from right to left.
52  m_xRegionRangeStart = other.m_xRegionRangeStart;
53  m_xRegionRangeEnd = other.m_xRegionRangeEnd;
54 
55  m_yRegionRangeStart = other.m_yRegionRangeStart;
56  m_yRegionRangeEnd = other.m_yRegionRangeEnd;
57 
58  m_xDelta = other.m_xDelta;
59  m_yDelta = other.m_yDelta;
60 
61  m_pressedKeyCode = other.m_pressedKeyCode;
62  m_releasedKeyCode = other.m_releasedKeyCode;
63 
64  m_keyboardModifiers = other.m_keyboardModifiers;
65 
66  m_lastPressedMouseButton = other.m_lastPressedMouseButton;
67  m_lastReleasedMouseButton = other.m_lastReleasedMouseButton;
68 
69  m_pressedMouseButtons = other.m_pressedMouseButtons;
70 
71  m_mouseButtonsAtMousePress = other.m_mouseButtonsAtMousePress;
72  m_mouseButtonsAtMouseRelease = other.m_mouseButtonsAtMouseRelease;
73 }
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

References m_currentDragPoint, m_dataKind, m_isKeyBoardDragging, m_isLeftPseudoButtonKeyPressed, m_isMeasuringDistance, m_isMouseDragging, m_isRightPseudoButtonKeyPressed, m_keyboardModifiers, m_lastCursorHoveredPoint, m_lastPressedMouseButton, m_lastReleasedMouseButton, m_mouseButtonsAtMousePress, m_mouseButtonsAtMouseRelease, m_pressedKeyCode, m_pressedMouseButtons, m_releasedKeyCode, m_selectionPolygon, m_selectRectangleWidth, m_startDragPoint, m_wasClickOnXAxis, m_wasClickOnYAxis, m_wasMouseDragging, m_wassKeyBoardDragging, m_xDelta, m_xRange, m_xRegionRangeEnd, m_xRegionRangeStart, m_yDelta, m_yRange, m_yRegionRangeEnd, and m_yRegionRangeStart.

◆ ~BasePlotContext()

pappso::BasePlotContext::~BasePlotContext ( )
virtual

Definition at line 144 of file baseplotcontext.cpp.

145 {
146 }

Member Function Documentation

◆ operator=()

BasePlotContext & pappso::BasePlotContext::operator= ( const BasePlotContext other)

Definition at line 77 of file baseplotcontext.cpp.

78 {
79  if(this == &other)
80  return *this;
81 
82  m_dataKind = other.m_dataKind;
83 
84  m_isMouseDragging = other.m_isMouseDragging;
85  m_wasMouseDragging = other.m_wasMouseDragging;
86 
87  m_isKeyBoardDragging = other.m_isKeyBoardDragging;
88  m_isLeftPseudoButtonKeyPressed = other.m_isLeftPseudoButtonKeyPressed;
89  m_isRightPseudoButtonKeyPressed = other.m_isRightPseudoButtonKeyPressed;
90  m_wassKeyBoardDragging = other.m_wassKeyBoardDragging;
91 
92  m_startDragPoint = other.m_startDragPoint;
93  m_currentDragPoint = other.m_currentDragPoint;
94  m_lastCursorHoveredPoint = other.m_lastCursorHoveredPoint;
95 
96  m_selectionPolygon = other.m_selectionPolygon;
97  m_selectRectangleWidth = other.m_selectRectangleWidth;
98 
99  // The effective range of the axes.
100  m_xRange = other.m_xRange;
101  m_yRange = other.m_yRange;
102 
103  // Tell if the mouse move was started onto either axis, because that will
104  // condition if some calculations needs to be performed or not (for example,
105  // if the mouse cursor motion was started on an axis, there is no point to
106  // perform deconvolutions).
107  m_wasClickOnXAxis = other.m_wasClickOnXAxis;
108  m_wasClickOnYAxis = other.m_wasClickOnYAxis;
109 
110  m_isMeasuringDistance = other.m_isMeasuringDistance;
111 
112  // The user-selected region over the plot.
113  // Note that we cannot use QCPRange structures because these are normalized by
114  // QCustomPlot in such a manner that lower is actually < upper. But we need
115  // for a number of our calculations (specifically for the deconvolutions) to
116  // actually have the lower value be start drag point.x even if the drag
117  // direction was from right to left.
118  m_xRegionRangeStart = other.m_xRegionRangeStart;
119  m_xRegionRangeEnd = other.m_xRegionRangeEnd;
120 
121  m_yRegionRangeStart = other.m_yRegionRangeStart;
122  m_yRegionRangeEnd = other.m_yRegionRangeEnd;
123 
124  m_xDelta = other.m_xDelta;
125  m_yDelta = other.m_yDelta;
126 
127  m_pressedKeyCode = other.m_pressedKeyCode;
128  m_releasedKeyCode = other.m_releasedKeyCode;
129 
130  m_keyboardModifiers = other.m_keyboardModifiers;
131 
132  m_lastPressedMouseButton = other.m_lastPressedMouseButton;
133  m_lastReleasedMouseButton = other.m_lastReleasedMouseButton;
134 
135  m_pressedMouseButtons = other.m_pressedMouseButtons;
136 
137  m_mouseButtonsAtMousePress = other.m_mouseButtonsAtMousePress;
138  m_mouseButtonsAtMouseRelease = other.m_mouseButtonsAtMouseRelease;
139 
140  return *this;
141 }

References m_currentDragPoint, m_dataKind, m_isKeyBoardDragging, m_isLeftPseudoButtonKeyPressed, m_isMeasuringDistance, m_isMouseDragging, m_isRightPseudoButtonKeyPressed, m_keyboardModifiers, m_lastCursorHoveredPoint, m_lastPressedMouseButton, m_lastReleasedMouseButton, m_mouseButtonsAtMousePress, m_mouseButtonsAtMouseRelease, m_pressedKeyCode, m_pressedMouseButtons, m_releasedKeyCode, m_selectionPolygon, m_selectRectangleWidth, m_startDragPoint, m_wasClickOnXAxis, m_wasClickOnYAxis, m_wasMouseDragging, m_wassKeyBoardDragging, m_xDelta, m_xRange, m_xRegionRangeEnd, m_xRegionRangeStart, m_yDelta, m_yRange, m_yRegionRangeEnd, and m_yRegionRangeStart.

◆ recordDragDirections()

DragDirections pappso::BasePlotContext::recordDragDirections ( )

Definition at line 150 of file baseplotcontext.cpp.

151 {
152  int drag_directions = static_cast<int>(DragDirections::NOT_SET);
153 
155  drag_directions |= static_cast<int>(DragDirections::LEFT_TO_RIGHT);
156  else
157  drag_directions |= static_cast<int>(DragDirections::RIGHT_TO_LEFT);
158 
160  drag_directions |= static_cast<int>(DragDirections::BOTTOM_TO_TOP);
161  else
162  drag_directions |= static_cast<int>(DragDirections::TOP_TO_BOTTOM);
163 
164  //qDebug() << "DragDirections:" << drag_directions;
165 
166  m_dragDirections = static_cast<DragDirections>(drag_directions);
167 
168  return static_cast<DragDirections>(drag_directions);
169 }
DragDirections m_dragDirections

References pappso::BOTTOM_TO_TOP, pappso::LEFT_TO_RIGHT, m_currentDragPoint, m_dragDirections, m_startDragPoint, pappso::NOT_SET, pappso::RIGHT_TO_LEFT, and pappso::TOP_TO_BOTTOM.

Referenced by pappso::BasePlotWidget::mouseMoveHandlerDraggingCursor().

◆ toString()

QString pappso::BasePlotContext::toString ( ) const

Definition at line 173 of file baseplotcontext.cpp.

174 {
175  QString text("Context:");
176 
177  text += QString("data kind: %1").arg(static_cast<int>(m_dataKind));
178 
179  text += QString(" isMouseDragging: %1 -- wasMouseDragging: %2")
180  .arg(m_isMouseDragging ? "true" : "false")
181  .arg(m_wasMouseDragging ? "true" : "false");
182 
183  text += QString(" -- startDragPoint : (%1, %2)")
184  .arg(m_startDragPoint.x())
185  .arg(m_startDragPoint.y());
186 
187  text += QString(" -- currentDragPoint : (%1, %2)")
188  .arg(m_currentDragPoint.x())
189  .arg(m_currentDragPoint.y());
190 
191  text += QString(" -- lastCursorHoveredPoint : (%1, %2)")
192  .arg(m_lastCursorHoveredPoint.x())
193  .arg(m_lastCursorHoveredPoint.y());
194 
195  // Document how the mouse cursor is being dragged.
197  {
198  if(static_cast<int>(m_dragDirections) & static_cast<int>(DragDirections::LEFT_TO_RIGHT))
199  text += " -- dragging from left to right";
200  else if(static_cast<int>(m_dragDirections) & static_cast<int>(DragDirections::RIGHT_TO_LEFT))
201  text += " -- dragging from right to left";
202  if(static_cast<int>(m_dragDirections) & static_cast<int>(DragDirections::TOP_TO_BOTTOM))
203  text += " -- dragging from top to bottom";
204  if(static_cast<int>(m_dragDirections) & static_cast<int>(DragDirections::BOTTOM_TO_TOP))
205  text += " -- dragging from bottom to top";
206  }
207 
208  // The selection polygon.
209  text += m_selectionPolygon.toString();
210 
211  text +=
212  QString(" -- xRange: (%1, %2)").arg(m_xRange.lower).arg(m_xRange.upper);
213 
214  text +=
215  QString(" -- yRange: (%1, %2)").arg(m_yRange.lower).arg(m_yRange.upper);
216 
217  text += QString(" -- wasClickOnXAxis: %1")
218  .arg(m_wasClickOnXAxis ? "true" : "false");
219  text += QString(" -- wasClickOnYAxis: %1")
220  .arg(m_wasClickOnYAxis ? "true" : "false");
221  text += QString(" -- isMeasuringDistance: %1")
222  .arg(m_isMeasuringDistance ? "true" : "false");
223 
224  text += QString(" -- xRegionRangeStart: %1 -- xRegionRangeEnd: %2")
225  .arg(m_xRegionRangeStart)
226  .arg(m_xRegionRangeEnd);
227 
228  text += QString(" -- yRegionRangeStart: %1 -- yRegionRangeEnd: %2")
229  .arg(m_yRegionRangeStart)
230  .arg(m_yRegionRangeEnd);
231 
232  text += QString(" -- xDelta: %1 -- yDelta: %2").arg(m_xDelta).arg(m_yDelta);
233 
234  text += QString(" -- pressedKeyCode: %1").arg(m_pressedKeyCode);
235 
236  text += QString(" -- keyboardModifiers: %1").arg(m_keyboardModifiers);
237 
238  text +=
239  QString(" -- lastPressedMouseButton: %1").arg(m_lastPressedMouseButton);
240 
241  text +=
242  QString(" -- lastReleasedMouseButton: %1").arg(m_lastReleasedMouseButton);
243 
244  text += QString(" -- pressedMouseButtons: %1").arg(m_pressedMouseButtons);
245 
246  text +=
247  QString(" -- mouseButtonsAtMousePress: %1").arg(m_mouseButtonsAtMousePress);
248 
249  text += QString(" -- mouseButtonsAtMouseRelease: %1")
251 
252  return text;
253 }

References pappso::BOTTOM_TO_TOP, pappso::LEFT_TO_RIGHT, m_currentDragPoint, m_dataKind, m_dragDirections, m_isMeasuringDistance, m_isMouseDragging, m_keyboardModifiers, m_lastCursorHoveredPoint, m_lastPressedMouseButton, m_lastReleasedMouseButton, m_mouseButtonsAtMousePress, m_mouseButtonsAtMouseRelease, m_pressedKeyCode, m_pressedMouseButtons, m_selectionPolygon, m_startDragPoint, m_wasClickOnXAxis, m_wasClickOnYAxis, m_wasMouseDragging, m_xDelta, m_xRange, m_xRegionRangeEnd, m_xRegionRangeStart, m_yDelta, m_yRange, m_yRegionRangeEnd, m_yRegionRangeStart, pappso::RIGHT_TO_LEFT, pappso::TOP_TO_BOTTOM, and pappso::SelectionPolygon::toString().

Referenced by pappso::MassSpecTracePlotContext::toString().

Member Data Documentation

◆ m_currentDragPoint

◆ m_dataKind

◆ m_dragDirections

DragDirections pappso::BasePlotContext::m_dragDirections = DragDirections::NOT_SET

◆ m_isKeyBoardDragging

bool pappso::BasePlotContext::m_isKeyBoardDragging = false

Definition at line 49 of file baseplotcontext.h.

Referenced by BasePlotContext(), and operator=().

◆ m_isLeftPseudoButtonKeyPressed

bool pappso::BasePlotContext::m_isLeftPseudoButtonKeyPressed = false

◆ m_isMeasuringDistance

◆ m_isMouseDragging

◆ m_isRightPseudoButtonKeyPressed

bool pappso::BasePlotContext::m_isRightPseudoButtonKeyPressed = false

◆ m_keyboardModifiers

◆ m_lastCursorHoveredPoint

◆ m_lastPressedMouseButton

Qt::MouseButtons pappso::BasePlotContext::m_lastPressedMouseButton

◆ m_lastReleasedMouseButton

Qt::MouseButtons pappso::BasePlotContext::m_lastReleasedMouseButton

◆ m_mouseButtonsAtMousePress

◆ m_mouseButtonsAtMouseRelease

Qt::MouseButtons pappso::BasePlotContext::m_mouseButtonsAtMouseRelease

◆ m_pressedKeyCode

◆ m_pressedMouseButtons

◆ m_releasedKeyCode

int pappso::BasePlotContext::m_releasedKeyCode

◆ m_selectionPolygon

◆ m_selectRectangleWidth

double pappso::BasePlotContext::m_selectRectangleWidth = 0

◆ m_startDragPoint

◆ m_wasClickOnXAxis

◆ m_wasClickOnYAxis

◆ m_wasMouseDragging

bool pappso::BasePlotContext::m_wasMouseDragging = false

◆ m_wassKeyBoardDragging

bool pappso::BasePlotContext::m_wassKeyBoardDragging = false

Definition at line 52 of file baseplotcontext.h.

Referenced by BasePlotContext(), and operator=().

◆ m_xDelta

◆ m_xRange

◆ m_xRegionRangeEnd

◆ m_xRegionRangeStart

◆ m_yDelta

◆ m_yRange

◆ m_yRegionRangeEnd

◆ m_yRegionRangeStart


The documentation for this class was generated from the following files: