libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
pappso::BasePlotContext Class Reference

#include <baseplotcontext.h>

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

Public Member Functions

 BasePlotContext ()
 
 BasePlotContext (const BasePlotContext &other)
 
virtual ~BasePlotContext ()
 
void updateIntegrationScope ()
 
void updateIntegrationScopeRect ()
 
void updateIntegrationScopeRhomb ()
 
void updateIntegrationScopeRhombHorizontal ()
 
void updateIntegrationScopeRhombVertical ()
 
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
 
IntegrationScopeBaseCstSPtr msp_integrationScope = nullptr
 
SelectionPolygon m_selectionPolygon
 
double m_integrationScopeRhombWidth = 0
 
double m_integrationScopeRhombHeight = 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 36 of file baseplotcontext.h.

Constructor & Destructor Documentation

◆ BasePlotContext() [1/2]

pappso::BasePlotContext::BasePlotContext ( )

Definition at line 12 of file baseplotcontext.cpp.

13{
14 // So we know it is never nullptr.
15 msp_integrationScope = std::make_shared<IntegrationScopeBase>();
16}
IntegrationScopeBaseCstSPtr msp_integrationScope

References msp_integrationScope.

◆ BasePlotContext() [2/2]

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

Definition at line 19 of file baseplotcontext.cpp.

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

◆ ~BasePlotContext()

pappso::BasePlotContext::~BasePlotContext ( )
virtual

Definition at line 84 of file baseplotcontext.cpp.

85{
86}

Member Function Documentation

◆ operator=()

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

Definition at line 622 of file baseplotcontext.cpp.

623{
624 if(this == &other)
625 return *this;
626
627 m_dataKind = other.m_dataKind;
628
629 m_isMouseDragging = other.m_isMouseDragging;
630 m_wasMouseDragging = other.m_wasMouseDragging;
631
632 m_isKeyBoardDragging = other.m_isKeyBoardDragging;
633 m_isLeftPseudoButtonKeyPressed = other.m_isLeftPseudoButtonKeyPressed;
634 m_isRightPseudoButtonKeyPressed = other.m_isRightPseudoButtonKeyPressed;
635 m_wassKeyBoardDragging = other.m_wassKeyBoardDragging;
636
637 m_startDragPoint = other.m_startDragPoint;
638 m_currentDragPoint = other.m_currentDragPoint;
639 m_lastCursorHoveredPoint = other.m_lastCursorHoveredPoint;
640
641 m_selectionPolygon = other.m_selectionPolygon;
642 msp_integrationScope = other.msp_integrationScope;
643 m_integrationScopeRhombWidth = other.m_integrationScopeRhombWidth;
644 m_integrationScopeRhombHeight = other.m_integrationScopeRhombHeight;
645
646 // The effective range of the axes.
647 m_xRange = other.m_xRange;
648 m_yRange = other.m_yRange;
649
650 // Tell if the mouse move was started onto either axis, because that will
651 // condition if some calculations needs to be performed or not (for example,
652 // if the mouse cursor motion was started on an axis, there is no point to
653 // perform deconvolutions).
654 m_wasClickOnXAxis = other.m_wasClickOnXAxis;
655 m_wasClickOnYAxis = other.m_wasClickOnYAxis;
656
657 m_isMeasuringDistance = other.m_isMeasuringDistance;
658
659 // The user-selected region over the plot.
660 // Note that we cannot use QCPRange structures because these are normalized by
661 // QCustomPlot in such a manner that lower is actually < upper. But we need
662 // for a number of our calculations (specifically for the deconvolutions) to
663 // actually have the lower value be start drag point.x even if the drag
664 // direction was from right to left.
665 m_xRegionRangeStart = other.m_xRegionRangeStart;
666 m_xRegionRangeEnd = other.m_xRegionRangeEnd;
667
668 m_yRegionRangeStart = other.m_yRegionRangeStart;
669 m_yRegionRangeEnd = other.m_yRegionRangeEnd;
670
671 m_xDelta = other.m_xDelta;
672 m_yDelta = other.m_yDelta;
673
674 m_pressedKeyCode = other.m_pressedKeyCode;
675 m_releasedKeyCode = other.m_releasedKeyCode;
676
677 m_keyboardModifiers = other.m_keyboardModifiers;
678
679 m_lastPressedMouseButton = other.m_lastPressedMouseButton;
680 m_lastReleasedMouseButton = other.m_lastReleasedMouseButton;
681
682 m_pressedMouseButtons = other.m_pressedMouseButtons;
683
684 m_mouseButtonsAtMousePress = other.m_mouseButtonsAtMousePress;
685 m_mouseButtonsAtMouseRelease = other.m_mouseButtonsAtMouseRelease;
686
687 return *this;
688}

References m_currentDragPoint, m_dataKind, m_integrationScopeRhombHeight, m_integrationScopeRhombWidth, 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_startDragPoint, m_wasClickOnXAxis, m_wasClickOnYAxis, m_wasMouseDragging, m_wassKeyBoardDragging, m_xDelta, m_xRange, m_xRegionRangeEnd, m_xRegionRangeStart, m_yDelta, m_yRange, m_yRegionRangeEnd, m_yRegionRangeStart, and msp_integrationScope.

Referenced by pappso::MassSpecTracePlotContext::operator=(), and pappso::MassSpecTracePlotContext::operator=().

◆ recordDragDirections()

DragDirections pappso::BasePlotContext::recordDragDirections ( )

Definition at line 691 of file baseplotcontext.cpp.

692{
693 int drag_directions = static_cast<int>(DragDirections::NOT_SET);
694
696 drag_directions |= static_cast<int>(DragDirections::LEFT_TO_RIGHT);
697 else
698 drag_directions |= static_cast<int>(DragDirections::RIGHT_TO_LEFT);
699
701 drag_directions |= static_cast<int>(DragDirections::BOTTOM_TO_TOP);
702 else
703 drag_directions |= static_cast<int>(DragDirections::TOP_TO_BOTTOM);
704
705 // qDebug() << "DragDirections:" << drag_directions;
706
707 m_dragDirections = static_cast<DragDirections>(drag_directions);
708
709 return static_cast<DragDirections>(drag_directions);
710}
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 714 of file baseplotcontext.cpp.

715{
716 QString text("Context:");
717
718 text += QString("data kind: %1").arg(static_cast<int>(m_dataKind));
719
720 text += QString(" isMouseDragging: %1 -- wasMouseDragging: %2")
721 .arg(m_isMouseDragging ? "true" : "false")
722 .arg(m_wasMouseDragging ? "true" : "false");
723
724 text += QString(" -- startDragPoint : (%1, %2)")
725 .arg(m_startDragPoint.x())
726 .arg(m_startDragPoint.y());
727
728 text += QString(" -- currentDragPoint : (%1, %2)")
729 .arg(m_currentDragPoint.x())
730 .arg(m_currentDragPoint.y());
731
732 text += QString(" -- lastCursorHoveredPoint : (%1, %2)")
734 .arg(m_lastCursorHoveredPoint.y());
735
736 // Document how the mouse cursor is being dragged.
738 {
739 if(static_cast<int>(m_dragDirections) &
740 static_cast<int>(DragDirections::LEFT_TO_RIGHT))
741 text += " -- dragging from left to right";
742 else if(static_cast<int>(m_dragDirections) &
743 static_cast<int>(DragDirections::RIGHT_TO_LEFT))
744 text += " -- dragging from right to left";
745 if(static_cast<int>(m_dragDirections) &
746 static_cast<int>(DragDirections::TOP_TO_BOTTOM))
747 text += " -- dragging from top to bottom";
748 if(static_cast<int>(m_dragDirections) &
749 static_cast<int>(DragDirections::BOTTOM_TO_TOP))
750 text += " -- dragging from bottom to top";
751 }
752
753 // The integration scope
754 text += " -- ";
755 text += msp_integrationScope->toString();
756
757 text +=
758 QString(" -- xRange: (%1, %2)").arg(m_xRange.lower).arg(m_xRange.upper);
759
760 text +=
761 QString(" -- yRange: (%1, %2)").arg(m_yRange.lower).arg(m_yRange.upper);
762
763 text += QString(" -- wasClickOnXAxis: %1")
764 .arg(m_wasClickOnXAxis ? "true" : "false");
765 text += QString(" -- wasClickOnYAxis: %1")
766 .arg(m_wasClickOnYAxis ? "true" : "false");
767 text += QString(" -- isMeasuringDistance: %1")
768 .arg(m_isMeasuringDistance ? "true" : "false");
769
770 text += QString(" -- xRegionRangeStart: %1 -- xRegionRangeEnd: %2")
772 .arg(m_xRegionRangeEnd);
773
774 text += QString(" -- yRegionRangeStart: %1 -- yRegionRangeEnd: %2")
776 .arg(m_yRegionRangeEnd);
777
778 text += QString(" -- xDelta: %1 -- yDelta: %2").arg(m_xDelta).arg(m_yDelta);
779
780 text += QString(" -- pressedKeyCode: %1").arg(m_pressedKeyCode);
781
782 text += QString(" -- keyboardModifiers: %1").arg(m_keyboardModifiers);
783
784 text +=
785 QString(" -- lastPressedMouseButton: %1").arg(m_lastPressedMouseButton);
786
787 text +=
788 QString(" -- lastReleasedMouseButton: %1").arg(m_lastReleasedMouseButton);
789
790 text += QString(" -- pressedMouseButtons: %1").arg(m_pressedMouseButtons);
791
792 text +=
793 QString(" -- mouseButtonsAtMousePress: %1").arg(m_mouseButtonsAtMousePress);
794
795 text += QString(" -- mouseButtonsAtMouseRelease: %1")
797
798 return text;
799}

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_startDragPoint, m_wasClickOnXAxis, m_wasClickOnYAxis, m_wasMouseDragging, m_xDelta, m_xRange, m_xRegionRangeEnd, m_xRegionRangeStart, m_yDelta, m_yRange, m_yRegionRangeEnd, m_yRegionRangeStart, msp_integrationScope, pappso::RIGHT_TO_LEFT, and pappso::TOP_TO_BOTTOM.

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

◆ updateIntegrationScope()

void pappso::BasePlotContext::updateIntegrationScope ( )

Definition at line 89 of file baseplotcontext.cpp.

90{
91 // qDebug();
92
93 // By essence, IntegrationScope is 1D scope. The point of the scope is the
94 // left bottom point, and then we document the width.
95
96 double x_range_start = std::min(m_currentDragPoint.x(), m_startDragPoint.x());
97 double x_range_end = std::max(m_currentDragPoint.x(), m_startDragPoint.x());
98
99 double y_position = m_startDragPoint.y();
100
101 QPointF point(x_range_start, y_position);
102 double width = x_range_end - x_range_start;
103
104 // qDebug() << "Going to create an integration scope with point:"
105 // << point << "and width:" << width;
106 msp_integrationScope = std::make_shared<IntegrationScope>(point, width);
107}

References m_currentDragPoint, m_startDragPoint, and msp_integrationScope.

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

◆ updateIntegrationScopeRect()

void pappso::BasePlotContext::updateIntegrationScopeRect ( )

Definition at line 111 of file baseplotcontext.cpp.

112{
113 // qDebug();
114
115 // By essence, IntegrationScopeRect is a squared rectangle scope. The point of
116 // the scope is the left bottom point, and then we document the width and the
117 // height.
118
119 /* Like this:
120 *
121 +---------------------------+ -
122 | | |
123 | | |
124 | | m_height
125 | | |
126 | | |
127 P---------------------------+ -
128
129 |--------- m_width ---------|
130
131 */
132
133 // We need to find the point that is actually the left bottom point.
134
135 QPointF point;
136 double width = 0;
137 double height = 0;
138
139 if(static_cast<int>(m_dragDirections) &
140 static_cast<int>(DragDirections::LEFT_TO_RIGHT) &&
141 static_cast<int>(m_dragDirections) &
142 static_cast<int>(DragDirections::BOTTOM_TO_TOP))
143 {
144 point.rx() = m_startDragPoint.x();
145 point.ry() = m_startDragPoint.y();
146 width = m_currentDragPoint.x() - point.rx();
147 height = m_currentDragPoint.y() - point.ry();
148 // qDebug() << "left to right - bottom to top";
149 }
150
151 if(static_cast<int>(m_dragDirections) &
152 static_cast<int>(DragDirections::RIGHT_TO_LEFT) &&
153 static_cast<int>(m_dragDirections) &
154 static_cast<int>(DragDirections::BOTTOM_TO_TOP))
155 {
156 point.rx() = m_currentDragPoint.x();
157 point.ry() = m_currentDragPoint.y();
158 width = m_startDragPoint.x() - m_currentDragPoint.x();
159 height = m_startDragPoint.y() - m_currentDragPoint.y();
160 // qDebug() << "right to left - bottom to top";
161 }
162
163 if(static_cast<int>(m_dragDirections) &
164 static_cast<int>(DragDirections::LEFT_TO_RIGHT) &&
165 static_cast<int>(m_dragDirections) &
166 static_cast<int>(DragDirections::TOP_TO_BOTTOM))
167 {
168 point.rx() = m_startDragPoint.x();
169 point.ry() = m_currentDragPoint.y();
170 width = m_currentDragPoint.x() - m_startDragPoint.x();
171 height = m_startDragPoint.y() - m_currentDragPoint.y();
172 // qDebug() << "left to right - top to bottom";
173 }
174
175 if(static_cast<int>(m_dragDirections) &
176 static_cast<int>(DragDirections::RIGHT_TO_LEFT) &&
177 static_cast<int>(m_dragDirections) &
178 static_cast<int>(DragDirections::TOP_TO_BOTTOM))
179 {
180 point.rx() = m_currentDragPoint.x();
181 point.ry() = m_currentDragPoint.y();
182 width = m_startDragPoint.x() - m_currentDragPoint.x();
183 height = m_startDragPoint.y() - m_currentDragPoint.y();
184 // qDebug() << "right to left - top to bottom";
185 }
186
187 // qDebug() << "The data used to update the integration scope:";
188 // qDebug() << "Point:" << point << "width:" << width << "height:" << height;
189 //
190 // qDebug() << "The integration scope before update:" << mpa_integrationScope;
191 //
192 // qDebug() << "Will update IntegrationScopeRect with:" << point << "width"
193 // << width << "height" << height;
195 std::make_shared<IntegrationScopeRect>(point, width, height);
196
197
198 // if(typeid(*mpa_integrationScope) == typeid(IntegrationScopeInterface))
199 // qDebug() << "The pointer is of type IntegrationScopeInterface";
200 // if(typeid(*mpa_integrationScope) == typeid(IntegrationScope))
201 // qDebug() << "The pointer is of type IntegrationScope";
202 // if(typeid(*mpa_integrationScope) == typeid(IntegrationScopeRect))
203 // qDebug() << "The pointer is of type IntegrationScopeRect";
204 // if(typeid(*mpa_integrationScope) == typeid(IntegrationScopeRhomb))
205 // qDebug() << "The pointer is of type IntegrationScopeRhomb";
206 //
207 // qDebug() << "The integration scope right after update:"
208 // << mpa_integrationScope;
209 //
210 // if(!mpa_integrationScope->getPoint(point))
211 // qFatal("Could not get point.");
212 // qDebug() << "The point:" << point;
213 // if(!mpa_integrationScope->getWidth(width))
214 // qFatal("Oh no!!!! width");
215 // if(!mpa_integrationScope->getWidth(height))
216 // qFatal("Oh no!!!! height");
217}

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

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

◆ updateIntegrationScopeRhomb()

void pappso::BasePlotContext::updateIntegrationScopeRhomb ( )

Definition at line 538 of file baseplotcontext.cpp.

539{
540 // qDebug() << toString();
541
542 // By essence, IntegrationScopeRhomb is a rhomboid polygon. Just set the
543 // points. There are two kinds of rhomboid integration scopes: horizontal and
544 // vertical.
545
546 /*
547 +----------+
548 | |
549 | |
550 | |
551 | |
552 | |
553 | |
554 | |
555 +----------+
556 ----width---
557 */
558
559 // As visible here, the fixed size of the rhomboid (using the S key in the
560 // plot widget) is the *horizontal* side (that is, the rhomboid has a non-0
561 // width)..
562
563 // However, it might be useful to be able to draw rhomboid integration scopes
564 // like this, that would correspond to the rhomboid above after a transpose
565 // operation.
566
567 /*
568 +
569 . |
570 . |
571 . |
572 . +
573 . .
574 . .
575 . .
576 + .
577 | | .
578 height | | .
579 | | .
580 +
581
582*/
583
584 // As visible here, the fixed size of the rhomboid (using the S key in the
585 // plot widget) is the vertical side (that is, the rhomboid has a non-0
586 // height).
587
588 // The general rule is thus that when the m_integrationScopeRhombWidth is
589 // not-0, then the first shape is considered, while when the
590 // m_integrationScopeRhombHeight is non-0, then the second shape is
591 // considered.
592
593 // This function is called when the user has dragged the cursor (left or right
594 // button, not for or for integration, respectively) with the 'Alt' modifier
595 // key pressed, so that they want to perform a rhomboid integration scope
596 // calculation.
597
598 // Of course, the integration scope in the context might not be a rhomboid
599 // scope, because we might enter this function as a very firt switch from
600 // scope or scopeRect to scopeRhomb. The only indication we have to direct the
601 // creation of a horizontal or vertical rhomboid is the
602 // m_integrationScopeRhombWidth/m_integrationScopeRhombHeight recorded in the
603 // plot widget that owns this plot context.
604
605 // qDebug() << "In updateIntegrationScopeRhomb, m_integrationScopeRhombWidth:"
606 // << m_integrationScopeRhombWidth
607 // << "and m_integrationScopeRhombHeight:"
608 // << m_integrationScopeRhombHeight;
609
611 qFatal(
612 "Both m_integrationScopeRhombWidth and m_integrationScopeRhombHeight of "
613 "rhomboid integration scope cannot be 0.");
614
619}

References m_integrationScopeRhombHeight, m_integrationScopeRhombWidth, updateIntegrationScopeRhombHorizontal(), and updateIntegrationScopeRhombVertical().

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

◆ updateIntegrationScopeRhombHorizontal()

void pappso::BasePlotContext::updateIntegrationScopeRhombHorizontal ( )

Definition at line 221 of file baseplotcontext.cpp.

222{
223 // qDebug() << toString();
224
225 /*
226 4+----------+3
227 | |
228 | |
229 | |
230 | |
231 | |
232 | |
233 | |
234 1+----------+2
235 ----width---
236 */
237
238 // As visible here, the fixed size of the rhomboid (using the S key in the
239 // plot widget) is the horizontal side.
240
241 // The points are numbered in a counterclockwise manner, starting from the
242 // starting drag point. The width side is right of the start drag point if
243 // the user drags from left to right and left of the start drag point if
244 // the user drags from left to right. In the figure above, the user
245 // has dragged the mouse from point 1 and to the right and upwards.
246 // Thus the width side is right of point 1. Because the numbering
247 // is counterclockwise, that point happens to be numbered 2.
248
249 // If the user had draggged the mouse starting at point 3 and to the left
250 // and to the bottom, then point 3 above would be point 1, point 4
251 // would be point 2 because the width side is left of the start
252 // drag point; point 1 would be point 3 and finally the last point
253 // would be at point 2.
254
255 // Sanity check
257 qFatal(
258 "The m_integrationScopeRhombWidth of the fixed rhomboid side cannot be "
259 "0.");
260
261 QPointF point;
262 std::vector<QPointF> points;
263
264 // Fill-in the points in the vector in the order they are created
265 // while drawing the rhomboid shape. Thus, the first point (start of the
266 // mouse click & drag operation is always the same.
267
268 point.rx() = m_startDragPoint.x();
269 point.ry() = m_startDragPoint.y();
270 points.push_back(point);
271 // qDebug() << "Start point:" << point;
272
273 if(static_cast<int>(m_dragDirections) &
274 static_cast<int>(DragDirections::LEFT_TO_RIGHT) &&
275 static_cast<int>(m_dragDirections) &
276 static_cast<int>(DragDirections::BOTTOM_TO_TOP))
277 {
278 // Second point.
280 point.ry() = m_startDragPoint.y();
281 points.push_back(point);
282 // qDebug() << "Second point:" << point;
283
284 // Third point.
286 point.ry() = m_currentDragPoint.ry();
287 points.push_back(point);
288 // qDebug() << "Third point:" << point;
289
290 // Fourth point.
291 point.rx() = m_currentDragPoint.rx();
292 point.ry() = m_currentDragPoint.ry();
293 points.push_back(point);
294 // qDebug() << "Last point:" << point;
295 }
296
297 if(static_cast<int>(m_dragDirections) &
298 static_cast<int>(DragDirections::RIGHT_TO_LEFT) &&
299 static_cast<int>(m_dragDirections) &
300 static_cast<int>(DragDirections::BOTTOM_TO_TOP))
301 {
302 // Second point.
303 point.rx() = m_currentDragPoint.rx();
304 point.ry() = m_currentDragPoint.ry();
305 points.push_back(point);
306 // qDebug() << "Second point:" << point;
307
308 // Third point.
310 point.ry() = m_currentDragPoint.ry();
311 points.push_back(point);
312 // qDebug() << "Third point:" << point;
313
314 // Fourth point.
316 point.ry() = m_startDragPoint.ry();
317 points.push_back(point);
318 // qDebug() << "Last point:" << point;
319 }
320
321 if(static_cast<int>(m_dragDirections) &
322 static_cast<int>(DragDirections::LEFT_TO_RIGHT) &&
323 static_cast<int>(m_dragDirections) &
324 static_cast<int>(DragDirections::TOP_TO_BOTTOM))
325 {
326 // Second point.
327 point.rx() = m_currentDragPoint.rx();
328 point.ry() = m_currentDragPoint.ry();
329 points.push_back(point);
330 // qDebug() << "Second point:" << point;
331
332 // Third point.
334 point.ry() = m_currentDragPoint.ry();
335 points.push_back(point);
336 // qDebug() << "Third point:" << point;
337
338 // Fourth point.
340 point.ry() = m_startDragPoint.y();
341 points.push_back(point);
342 // qDebug() << "Last point:" << point;
343 }
344
345 if(static_cast<int>(m_dragDirections) &
346 static_cast<int>(DragDirections::RIGHT_TO_LEFT) &&
347 static_cast<int>(m_dragDirections) &
348 static_cast<int>(DragDirections::TOP_TO_BOTTOM))
349 {
350 // Second point.
352 point.ry() = m_startDragPoint.y();
353 points.push_back(point);
354 // qDebug() << "Second point:" << point;
355
356 // Third point.
358 point.ry() = m_currentDragPoint.ry();
359 points.push_back(point);
360 // qDebug() << "Third point:" << point;
361
362 // Fourth point.
363 point.rx() = m_currentDragPoint.rx();
364 point.ry() = m_currentDragPoint.ry();
365 points.push_back(point);
366 // qDebug() << "Last point:" << point;
367 }
368
369
370 msp_integrationScope = std::make_shared<IntegrationScopeRhomb>(points);
371
372 // qDebug() << "Created an integration scope horizontal rhomboid with"
373 // << points.size() << "points:" << msp_integrationScope->toString();
374}

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

Referenced by updateIntegrationScopeRhomb().

◆ updateIntegrationScopeRhombVertical()

void pappso::BasePlotContext::updateIntegrationScopeRhombVertical ( )

Definition at line 378 of file baseplotcontext.cpp.

379{
380 // qDebug() << toString();
381
382 /*
383 * +3
384 * . |
385 * . |
386 * . |
387 * . +2
388 * . .
389 * . .
390 * . .
391 * 4+ .
392 * | | .
393 * height | | .
394 * | | .
395 * 1+
396 *
397 */
398
399 // As visible here, the fixed size of the rhomboid (using the S key in the
400 // plot widget) is the vertical side.
401
402 // The points are numbered in a counterclockwise manner, starting from the
403 // starting drag point. The height side is below the start drag point if
404 // the user drags from top to bottom and above the start drag point if
405 // the user drags from bottom to top. In the figure above, the user
406 // has dragged the mouse from point 1 and to the right and upwards.
407 // Thus the height side is above the point 1. Because the numbering
408 // is counterclockwise, that point happens to be numbered 4.
409
410 // If the user had draggged the mouse starting at point 3 and to the left
411 // and to the bottom, then point 3 above would be point 1, point 4
412 // would be ponit 2, point 1 would be point 3 and finally, because
413 // the dragging is from top to bottom, the last point would be at point 2
414 // above, because the height side of the rhomboid is below the start
415 // drag point.
416
417 // Sanity check
419 qFatal("The height of the fixed rhomboid side cannot be 0.");
420
421 QPointF point;
422 std::vector<QPointF> points;
423
424 // Fill-in the points in the vector in the order they are created
425 // while drawing the rhomboid shape. Thus, the first point (start of the
426 // mouse click & drag operation is always the same, the leftmost bottom point
427 // of the drawing above (point 1).
428
429 point.rx() = m_startDragPoint.x();
430 point.ry() = m_startDragPoint.y();
431 points.push_back(point);
432 qDebug() << "Start point:" << point;
433
434 if(static_cast<int>(m_dragDirections) &
435 static_cast<int>(DragDirections::LEFT_TO_RIGHT) &&
436 static_cast<int>(m_dragDirections) &
437 static_cast<int>(DragDirections::BOTTOM_TO_TOP))
438 {
439 // Second point.
440 point.rx() = m_currentDragPoint.rx();
441 point.ry() = m_currentDragPoint.ry();
442 points.push_back(point);
443 // qDebug() << "Second point:" << point;
444
445 // Third point.
446 point.rx() = m_currentDragPoint.rx();
448 points.push_back(point);
449 // qDebug() << "Third point:" << point;
450
451 // Fourth point.
452 point.rx() = m_startDragPoint.x();
454 points.push_back(point);
455 // qDebug() << "Last point:" << point;
456 }
457
458 if(static_cast<int>(m_dragDirections) &
459 static_cast<int>(DragDirections::RIGHT_TO_LEFT) &&
460 static_cast<int>(m_dragDirections) &
461 static_cast<int>(DragDirections::BOTTOM_TO_TOP))
462 {
463 // Second point.
464 point.rx() = m_startDragPoint.rx();
466 points.push_back(point);
467 // qDebug() << "Second point:" << point;
468
469 // Third point.
470 point.rx() = m_currentDragPoint.rx();
472 points.push_back(point);
473 // qDebug() << "Third point:" << point;
474
475 // Fourth point.
476 point.rx() = m_currentDragPoint.x();
477 point.ry() = m_currentDragPoint.y();
478 points.push_back(point);
479 // qDebug() << "Last point:" << point;
480 }
481
482 if(static_cast<int>(m_dragDirections) &
483 static_cast<int>(DragDirections::LEFT_TO_RIGHT) &&
484 static_cast<int>(m_dragDirections) &
485 static_cast<int>(DragDirections::TOP_TO_BOTTOM))
486 {
487 // Second point.
488 point.rx() = m_startDragPoint.x();
490 points.push_back(point);
491 // qDebug() << "Second point:" << point;
492
493 // Third point.
494 point.rx() = m_currentDragPoint.rx();
496 points.push_back(point);
497 // qDebug() << "Third point:" << point;
498
499 // Fourth point.
500 point.rx() = m_currentDragPoint.rx();
501 point.ry() = m_currentDragPoint.ry();
502 points.push_back(point);
503 // qDebug() << "Last point:" << point;
504 }
505
506 if(static_cast<int>(m_dragDirections) &
507 static_cast<int>(DragDirections::RIGHT_TO_LEFT) &&
508 static_cast<int>(m_dragDirections) &
509 static_cast<int>(DragDirections::TOP_TO_BOTTOM))
510 {
511 // Second point.
512 point.rx() = m_currentDragPoint.rx();
513 point.ry() = m_currentDragPoint.ry();
514 points.push_back(point);
515 // qDebug() << "Second point:" << point;
516
517 // Third point.
518 point.rx() = m_currentDragPoint.rx();
520 points.push_back(point);
521 // qDebug() << "Third point:" << point;
522
523 // Fourth point.
524 point.rx() = m_startDragPoint.rx();
526 points.push_back(point);
527 // qDebug() << "Last point:" << point;
528 }
529
530 msp_integrationScope = std::make_shared<IntegrationScopeRhomb>(points);
531
532 // qDebug() << "Created an integration scope vertical rhomboid with"
533 // << points.size() << "points:" << msp_integrationScope->toString();
534}

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

Referenced by updateIntegrationScopeRhomb().

Member Data Documentation

◆ m_currentDragPoint

◆ m_dataKind

◆ m_dragDirections

◆ m_integrationScopeRhombHeight

◆ m_integrationScopeRhombWidth

◆ m_isKeyBoardDragging

bool pappso::BasePlotContext::m_isKeyBoardDragging = false

Definition at line 48 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

SelectionPolygon pappso::BasePlotContext::m_selectionPolygon

Definition at line 59 of file baseplotcontext.h.

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

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

◆ msp_integrationScope


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