libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
integrationscoperhomb.h
Go to the documentation of this file.
1// Copyright 2021 Filippo Rusconi
2// GPLv3+
3
4#pragma once
5
6/////////////////////// StdLib includes
7#include <vector>
8#include <limits>
9
10/////////////////////// Qt includes
11#include <QString>
12#include <QPointF>
13
14
15/////////////////////// Local includes
16#include "../../exportinmportconfig.h"
17#include "../../types.h"
19
20namespace pappso
21{
22
23// This class represents the case where the user draws a rhomboid in a colormap
24// plot widget, with the aim of integrating data in two-dimension manner (over a
25// range in the X axis and a range in the Y axis). The rhomboid typically
26// would try to delineate the signal shown in a m/z vs im colormap.
27
28
29// There are two kinds of rhomboid integration scopes:
30
31/*
32 * 4 +-----------+3
33 * | |
34 * | |
35 * | |
36 * | |
37 * | |
38 * | |
39 * | |
40 * 1+----------+2
41 * ----width---
42 */
43
44// As visible here, the fixed size of the rhomboid (using the S key in the
45// plot widget) is the *horizontal* side (this is the plot context's
46// m_integrationScopeRhombWidth). In this case the height of the scope is 0.
47
48// and
49
50
51/*
52 * +3
53 * . |
54 * . |
55 * . |
56 * . +2
57 * . .
58 * . .
59 * . .
60 * 4+ .
61 * | | .
62 * height | | .
63 * | | .
64 * 1+
65 *
66 */
67
68
69// In this implementation we just provide a vector of points and a
70// complete set of functions that define the kind of scope depending
71// on the position of the points. Note that the points are defined
72// by the user of the scope according to their own logic (left to right
73// and bottom to top mouse movement, for example. See the BasePlotWidget class
74// for a thorough use of this kind of scope.
75
77{
78 public:
80 IntegrationScopeRhomb(const std::vector<QPointF> &points);
81 IntegrationScopeRhomb(const std::vector<QPointF> &points,
82 DataKind data_kind_x,
83 DataKind data_kind_y);
85
86 virtual ~IntegrationScopeRhomb();
87
88 virtual IntegrationScopeRhomb &operator=(const IntegrationScopeRhomb &other);
89
90 virtual std::size_t addPoint(QPointF point);
91
92 virtual bool getPoint(QPointF &point) const override;
93 virtual bool getPoints(std::vector<QPointF> &points) const override;
94
95 virtual IntegrationScopeFeatures getTopMostPoint(QPointF &point) const override;
96 virtual IntegrationScopeFeatures getTopMostPoints(std::vector<QPointF> &points) const override;
97 virtual IntegrationScopeFeatures getBottomMostPoint(QPointF &point) const override;
98 virtual IntegrationScopeFeatures getBottomMostPoints(std::vector<QPointF> &points) const override;
99
100 // These functions are specific for the current implementation
101 // of the IntegrationScopeRhomb, that is a rhomboid, aka a
102 // skewed rectangle, with four points.
103 virtual IntegrationScopeFeatures getLeftMostPoint(QPointF &point) const override;
104 virtual IntegrationScopeFeatures getLeftMostPoints(std::vector<QPointF> &points) const override;
105 virtual IntegrationScopeFeatures getLeftMostTopPoint(QPointF &point) const override;
106 virtual IntegrationScopeFeatures getLeftMostBottomPoint(QPointF &point) const override;
107 virtual IntegrationScopeFeatures getRightMostPoint(QPointF &point) const override;
108 virtual IntegrationScopeFeatures getRightMostPoints(std::vector<QPointF> &points) const override;
109 virtual IntegrationScopeFeatures getRightMostTopPoint(QPointF &point) const override;
110 virtual IntegrationScopeFeatures getRightMostBottomPoint(QPointF &point) const override;
111
112 virtual IntegrationScopeFeatures getWidth(double &width) const override;
113 virtual IntegrationScopeFeatures getHeight(double &height) const override;
114
115 virtual IntegrationScopeFeatures getRhombHorizontalSize(double &size) const override;
116 virtual IntegrationScopeFeatures getRhombVerticalSize(double &size) const override;
117
118 virtual bool range(Axis axis, double &start, double &end) const override;
119
120 virtual void setDataKindX(DataKind data_kind) override;
121 virtual bool getDataKindX(DataKind &data_kind) override;
122
123 virtual void setDataKindY(DataKind data_kind) override;
124 virtual bool getDataKindY(DataKind &data_kind) override;
125
126 bool is1D() const override;
127 bool is2D() const override;
128
129 virtual bool isRectangle() const override;
130 virtual bool isRhomboid() const override;
131
132 virtual bool transpose() override;
133
134 virtual bool contains(const QPointF &point) const override;
135
136 virtual QString toString() const override;
137
138 virtual void reset() override;
139
140 protected:
141
142 std::vector<QPointF> m_points;
143 DataKind m_dataKindX = DataKind::unset;
144 DataKind m_dataKindY = DataKind::unset;
145};
146
147typedef std::shared_ptr<IntegrationScopeRhomb> IntegrationScopeRhombSPtr;
148typedef std::shared_ptr<const IntegrationScopeRhomb>
150
151} // namespace pappso
#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::shared_ptr< IntegrationScopeRhomb > IntegrationScopeRhombSPtr
std::shared_ptr< const IntegrationScopeRhomb > IntegrationScopeRhombCstSPtr
DataKind
Definition types.h:213