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

147 {
148 }

Member Function Documentation

◆ operator=()

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

Definition at line 79 of file baseplotcontext.cpp.

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

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 152 of file baseplotcontext.cpp.

153 {
154  int drag_directions = static_cast<int>(DragDirections::NOT_SET);
155 
157  drag_directions |= static_cast<int>(DragDirections::LEFT_TO_RIGHT);
158  else
159  drag_directions |= static_cast<int>(DragDirections::RIGHT_TO_LEFT);
160 
162  drag_directions |= static_cast<int>(DragDirections::BOTTOM_TO_TOP);
163  else
164  drag_directions |= static_cast<int>(DragDirections::TOP_TO_BOTTOM);
165 
166  // qDebug() << "DragDirections:" << drag_directions;
167 
168  m_dragDirections = static_cast<DragDirections>(drag_directions);
169 
170  return static_cast<DragDirections>(drag_directions);
171 }
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 175 of file baseplotcontext.cpp.

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

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

◆ 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

◆ m_startDragPoint

◆ m_wasClickOnXAxis

◆ m_wasClickOnYAxis

◆ m_wasMouseDragging

bool pappso::BasePlotContext::m_wasMouseDragging = false

◆ m_wassKeyBoardDragging

bool pappso::BasePlotContext::m_wassKeyBoardDragging = false

◆ 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: