Loading...
Searching...
No Matches
pappso::IntegrationScopeRhomb Class Reference

`#include <integrationscoperhomb.h>`

Inheritance diagram for pappso::IntegrationScopeRhomb:

## Public Member Functions

| IntegrationScopeRhomb ()
| IntegrationScopeRhomb (const std::vector< QPointF > &points)
| IntegrationScopeRhomb (const std::vector< QPointF > &points, DataKind data_kind_x, DataKind data_kind_y)
| IntegrationScopeRhomb (const IntegrationScopeRhomb &other)
virtual | ~IntegrationScopeRhomb ()
virtual IntegrationScopeRhomb & | operator= (const IntegrationScopeRhomb &other)
virtual std::size_t | addPoint (QPointF point)
virtual bool | getPoint (QPointF &point) const override
virtual bool | getPoints (std::vector< QPointF > &points) const override
virtual IntegrationScopeFeatures | getTopMostPoint (QPointF &point) const override
virtual IntegrationScopeFeatures | getTopMostPoints (std::vector< QPointF > &points) const override
virtual IntegrationScopeFeatures | getBottomMostPoint (QPointF &point) const override
virtual IntegrationScopeFeatures | getBottomMostPoints (std::vector< QPointF > &points) const override
virtual IntegrationScopeFeatures | getLeftMostPoint (QPointF &point) const override
virtual IntegrationScopeFeatures | getLeftMostPoints (std::vector< QPointF > &points) const override
virtual IntegrationScopeFeatures | getLeftMostTopPoint (QPointF &point) const override
virtual IntegrationScopeFeatures | getLeftMostBottomPoint (QPointF &point) const override
virtual IntegrationScopeFeatures | getRightMostPoint (QPointF &point) const override
virtual IntegrationScopeFeatures | getRightMostPoints (std::vector< QPointF > &points) const override
virtual IntegrationScopeFeatures | getRightMostTopPoint (QPointF &point) const override
virtual IntegrationScopeFeatures | getRightMostBottomPoint (QPointF &point) const override
virtual IntegrationScopeFeatures | getWidth (double &width) const override
virtual IntegrationScopeFeatures | getHeight (double &height) const override
virtual IntegrationScopeFeatures | getRhombHorizontalSize (double &size) const override
virtual IntegrationScopeFeatures | getRhombVerticalSize (double &size) const override
virtual bool | range (Axis axis, double &start, double &end) const override
virtual void | setDataKindX (DataKind data_kind) override
virtual bool | getDataKindX (DataKind &data_kind) override
virtual void | setDataKindY (DataKind data_kind) override
virtual bool | getDataKindY (DataKind &data_kind) override
bool | is1D () const override
bool | is2D () const override
virtual bool | isRectangle () const override
virtual bool | isRhomboid () const override
virtual bool | transpose () override
virtual bool | contains (const QPointF &point) const override
virtual QString | toString () const override
virtual void | reset () override
Public Member Functions inherited from pappso::IntegrationScopeBase
| IntegrationScopeBase ()
| IntegrationScopeBase (const IntegrationScopeBase &other)
virtual | ~IntegrationScopeBase ()

## Protected Attributes

std::vector< QPointF > | m_points
DataKind | m_dataKindX = DataKind::unset
DataKind | m_dataKindY = DataKind::unset

## Detailed Description

Definition at line 76 of file integrationscoperhomb.h.

## Constructor & Destructor Documentation

## IntegrationScopeRhomb() [1/4]

pappso::IntegrationScopeRhomb::IntegrationScopeRhomb | ( |  | ) |

Definition at line 21 of file integrationscoperhomb.cpp.

: IntegrationScopeBase()
{
// qDebug() << "Constructing" << this;
}
pappso::IntegrationScopeBase::IntegrationScopeBase
IntegrationScopeBase()
Definition integrationscopebase.cpp:21

## IntegrationScopeRhomb() [2/4]

pappso::IntegrationScopeRhomb::IntegrationScopeRhomb | ( | const std::vector< QPointF > & | points | ) |

Definition at line 26 of file integrationscoperhomb.cpp.

: m_points(points)
{
// qDebug() << "Constructing" << this << "with" << m_points.size() << "points.";
}
pappso::IntegrationScopeRhomb::m_points
std::vector< QPointF > m_points
Definition integrationscoperhomb.h:142

## IntegrationScopeRhomb() [3/4]

pappso::IntegrationScopeRhomb::IntegrationScopeRhomb | ( | const std::vector< QPointF > & | points,
|  | DataKind | data_kind_x,
|  | DataKind | data_kind_y
| ) |  |

Definition at line 32 of file integrationscoperhomb.cpp.

: IntegrationScopeBase(),
m_points(points),
m_dataKindX(data_kind_x),
m_dataKindY(data_kind_y)
{
// qDebug() << "Constructing" << this << "with" << m_points.size() << "points."
// << "data_kind_x:" << static_cast<int>(data_kind_x)
// << "data_kind_y:" << static_cast<int>(data_kind_y);
}
pappso::IntegrationScopeRhomb::m_dataKindY
DataKind m_dataKindY
Definition integrationscoperhomb.h:144
pappso::IntegrationScopeRhomb::m_dataKindX
DataKind m_dataKindX
Definition integrationscoperhomb.h:143

## IntegrationScopeRhomb() [4/4]

pappso::IntegrationScopeRhomb::IntegrationScopeRhomb | ( | const IntegrationScopeRhomb & | other | ) |

Definition at line 44 of file integrationscoperhomb.cpp.

: IntegrationScopeBase(),
m_points(other.m_points),
m_dataKindX(other.m_dataKindX),
m_dataKindY(other.m_dataKindY)
{
}

## ~IntegrationScopeRhomb()

pappso::IntegrationScopeRhomb::~IntegrationScopeRhomb | ( |  | ) |

virtual

Definition at line 52 of file integrationscoperhomb.cpp.

{
// qDebug() << "Destructing" << this;
}

## Member Function Documentation

## addPoint()

std::size_t pappso::IntegrationScopeRhomb::addPoint | ( | QPointF | point | ) |

virtual

Definition at line 72 of file integrationscoperhomb.cpp.

{
m_points.push_back(point);
return m_points.size();
}

References m_points.

## contains()

bool pappso::IntegrationScopeRhomb::contains | ( | const QPointF & | point | ) | const

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 1010 of file integrationscoperhomb.cpp.

{
// We have to make the real check using the point-in-polygon algorithm.
// This code is inspired by the work described here:
// https://wrf.ecse.rpi.edu/Research/Short_Notes/pnpoly.html
// int pnpoly(int vertex_count, float *vertx, float *verty, float testx,
// float testy)
int i = 0;
int j = 0;
bool is_inside = false;
int vertex_count = m_points.size();
for(i = 0, j = vertex_count - 1; i < vertex_count; j = i++)
{
if(((m_points.at(i).y() > point.y()) !=
(m_points.at(j).y() > point.y())) &&
(point.x() < (m_points.at(j).x() - m_points.at(i).x()) *
(point.y() - m_points.at(i).y()) /
(m_points.at(j).y() - m_points.at(i).y()) +
m_points.at(i).x()))
is_inside = !is_inside;
}
// if(is_inside)
// qDebug() << "Testing point:" << point
// << "against rhomboid polygon - turns out be in.";
// else
// qDebug() << "Testing point:" << point
// << "against rhomboid polygon - turns out be out.";
return is_inside;
}

References m_points.

## getBottomMostPoint()

IntegrationScopeFeatures pappso::IntegrationScopeRhomb::getBottomMostPoint | ( | QPointF & | point | ) | const

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 166 of file integrationscoperhomb.cpp.

{
if(m_points.size() < 4)
qFatal("The rhomboid has not four points.");
double bottom_most_y_value = std::numeric_limits<double>::max();
for(auto &the_point : m_points)
{
if(the_point.y() < bottom_most_y_value)
{
bottom_most_y_value = the_point.y();
point = the_point;
}
}
return IntegrationScopeFeatures::SUCCESS;
}
pappso::SUCCESS
@ SUCCESS
Definition integrationscopebase.h:50

References m_points, and pappso::SUCCESS.

Referenced by getBottomMostPoints(), getHeight(), and range().

## getBottomMostPoints()

IntegrationScopeFeatures pappso::IntegrationScopeRhomb::getBottomMostPoints | ( | std::vector< QPointF > & | points | ) | const

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 186 of file integrationscoperhomb.cpp.

{
if(m_points.size() < 4)
qFatal("The rhomboid has not four points.");
// Depending of the horiz or vert quality of the scope we are going to return
// 1 or 2 points, respectively.
points.clear();
QPointF point;
if(getBottomMostPoint(point) == IntegrationScopeFeatures::FAILURE)
qFatal("Failed to get the bottom most point.");
// Store that point immediately.
points.push_back(point);
// Now that we know at least one of the bottom most points, check if there are
// other points having same y and different x. Note that one specific case
// is when the rhomboid is flat on the x axis, in which case all the points
// have the same y value. We will thus return 4 points. In all the other
// cases, we return 2 points if the rhomboid is horizontal and 1 point if the
// rhomboid is vertical.
for(auto &the_point : m_points)
{
if(the_point == point)
continue;
if(the_point.y() == point.y())
{
// We are handling a vertical rhomboid.
points.push_back(the_point);
}
}
uint temp = 0;
if(points.size() == 1)
temp |= static_cast<int>(IntegrationScopeFeatures::RHOMBOID_VERTICAL);
else if(points.size() == 2)
temp |= static_cast<int>(IntegrationScopeFeatures::RHOMBOID_HORIZONTAL);
else if(points.size() > 2)
temp |= static_cast<int>(IntegrationScopeFeatures::FLAT_ON_X_AXIS);
temp |= static_cast<int>(IntegrationScopeFeatures::SUCCESS);
return static_cast<IntegrationScopeFeatures>(temp);
}
pappso::IntegrationScopeRhomb::getBottomMostPoint
virtual IntegrationScopeFeatures getBottomMostPoint(QPointF &point) const override
Definition integrationscoperhomb.cpp:166
pappso::IntegrationScopeFeatures
IntegrationScopeFeatures
Definition integrationscopebase.h:46
pappso::FLAT_ON_X_AXIS
@ FLAT_ON_X_AXIS
Definition integrationscopebase.h:51
pappso::FAILURE
@ FAILURE
Definition integrationscopebase.h:48
pappso::RHOMBOID_VERTICAL
@ RHOMBOID_VERTICAL
Definition integrationscopebase.h:53
pappso::RHOMBOID_HORIZONTAL
@ RHOMBOID_HORIZONTAL
Definition integrationscopebase.h:54
pappso::uint
unsigned int uint
Definition types.h:57

References pappso::FAILURE, pappso::FLAT_ON_X_AXIS, getBottomMostPoint(), m_points, pappso::RHOMBOID_HORIZONTAL, pappso::RHOMBOID_VERTICAL, and pappso::SUCCESS.

Referenced by getLeftMostBottomPoint(), and getRightMostBottomPoint().

## getDataKindX()

bool pappso::IntegrationScopeRhomb::getDataKindX | ( | DataKind & | data_kind | ) |

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 953 of file integrationscoperhomb.cpp.

{
data_kind = m_dataKindX;
return true;
}

References m_dataKindX.

## getDataKindY()

bool pappso::IntegrationScopeRhomb::getDataKindY | ( | DataKind & | data_kind | ) |

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 960 of file integrationscoperhomb.cpp.

{
data_kind = m_dataKindY;
return true;
}

References m_dataKindY.

## getHeight()

IntegrationScopeFeatures pappso::IntegrationScopeRhomb::getHeight | ( | double & | height | ) | const

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 732 of file integrationscoperhomb.cpp.

{
// See getWidth() for explanations.
if(m_points.size() < 4)
qFatal("The IntegrationScopeRhomb has less than four points.");
// The height of the rhomboid is the entire span that it has on the y axis.
QPointF top_most_point;
QPointF bottom_most_point;
if(!getTopMostPoint(top_most_point))
qFatal("Failed to get the top most point.");
if(!getBottomMostPoint(bottom_most_point))
qFatal("Failed to get the bottom most point.");
height = fabs(top_most_point.y() - bottom_most_point.y());
return IntegrationScopeFeatures::SUCCESS;
}
pappso::IntegrationScopeRhomb::getTopMostPoint
virtual IntegrationScopeFeatures getTopMostPoint(QPointF &point) const override
Definition integrationscoperhomb.cpp:93

References getBottomMostPoint(), getTopMostPoint(), m_points, and pappso::SUCCESS.

## getLeftMostBottomPoint()

IntegrationScopeFeatures pappso::IntegrationScopeRhomb::getLeftMostBottomPoint | ( | QPointF & | point | ) | const

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 454 of file integrationscoperhomb.cpp.

{
if(m_points.size() < 4)
qFatal("The rhomboid has not four points.");
std::vector<QPointF> points;
// Try the bottom most points, which will tell us if the rhomboid is
// horizontal or not.
IntegrationScopeFeatures scope_features = getBottomMostPoints(points);
if(scope_features == IntegrationScopeFeatures::FAILURE)
qFatal("Failed to get the bottom most points.");
if(scope_features & IntegrationScopeFeatures::RHOMBOID_HORIZONTAL)
{
// We should have gotten 2 points.
if(points.size() != 2)
qFatal("We should have gotten two points.");
if(points.at(0).x() < points.at(1).x())
point = points.at(0);
else
point = points.at(1);
}
else if(scope_features & IntegrationScopeFeatures::RHOMBOID_VERTICAL)
{
// In this case, we need to ask for the left most points. We'll have to
// check the results again!
scope_features = getLeftMostPoints(points);
if(!(scope_features & IntegrationScopeFeatures::SUCCESS))
qFatal("Failed to get the left most points.");
if(scope_features & IntegrationScopeFeatures::RHOMBOID_VERTICAL)
{
// We should have gotten 2 points.
if(points.size() != 2)
qFatal("We should have gotten two points.");
if(points.at(0).y() < points.at(1).y())
point = points.at(0);
else
point = points.at(1);
}
else if(scope_features & IntegrationScopeFeatures::FLAT_ON_Y_AXIS)
{
// It is possible that the user has rotated the vertical rhomboid
// such that all the points are aligned on the y axis (all have the
// same x axis value). This is not an error condition. All we do is
// return scope_features so the caller understands the situations.
}
else
qFatal("This point should never be reached.");
}
else if(scope_features & IntegrationScopeFeatures::FLAT_ON_X_AXIS)
{
// This is not an error condition. All we do is return scope_features
// so the caller understands the situations.
}
else
qFatal("This point should never be reached.");
return scope_features;
}
pappso::IntegrationScopeRhomb::getBottomMostPoints
virtual IntegrationScopeFeatures getBottomMostPoints(std::vector< QPointF > &points) const override
Definition integrationscoperhomb.cpp:186
pappso::IntegrationScopeRhomb::getLeftMostPoints
virtual IntegrationScopeFeatures getLeftMostPoints(std::vector< QPointF > &points) const override
Definition integrationscoperhomb.cpp:258
pappso::FLAT_ON_Y_AXIS
@ FLAT_ON_Y_AXIS
Definition integrationscopebase.h:52

References pappso::FAILURE, pappso::FLAT_ON_X_AXIS, pappso::FLAT_ON_Y_AXIS, getBottomMostPoints(), getLeftMostPoints(), m_points, pappso::RHOMBOID_HORIZONTAL, pappso::RHOMBOID_VERTICAL, and pappso::SUCCESS.

Referenced by toString().

## getLeftMostPoint()

IntegrationScopeFeatures pappso::IntegrationScopeRhomb::getLeftMostPoint | ( | QPointF & | point | ) | const

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 238 of file integrationscoperhomb.cpp.

{
if(m_points.size() < 4)
qFatal("The rhomboid has not four points.");
double left_most_x = std::numeric_limits<double>::max();
for(auto &the_point : m_points)
{
if(the_point.x() < left_most_x)
{
left_most_x = the_point.x();
point = the_point;
}
}
return IntegrationScopeFeatures::SUCCESS;
}

References m_points, and pappso::SUCCESS.

Referenced by getLeftMostPoints(), getWidth(), and range().

## getLeftMostPoints()

IntegrationScopeFeatures pappso::IntegrationScopeRhomb::getLeftMostPoints | ( | std::vector< QPointF > & | points | ) | const

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 258 of file integrationscoperhomb.cpp.

{
if(m_points.size() < 4)
qFatal("The rhomboid has not four points.");
// Depending of the horiz or vert quality of the scope we are going to return
// 1 or 2 points, respectively.
points.clear();
QPointF point;
if(getLeftMostPoint(point) == IntegrationScopeFeatures::FAILURE)
qFatal("Failed to get at least one left most point.");
// Store that point immediately.
points.push_back(point);
// Now that we know at least one of the left most points, check if there are
// other points having same x and different y. Note that one specific case
// is when the rhomboid is flat on the y axis, in which case all the points
// have the same x value. We will thus return 4 points. In all the other
// cases, we return 1 point if the rhomboid is horizontal and 2 points if the
// rhomboid is vertical.
for(auto &the_point : m_points)
{
if(the_point == point)
continue;
if(the_point.x() == point.x())
{
// We are handling a vertical rhomboid.
points.push_back(the_point);
}
}
uint temp = 0;
if(points.size() == 1)
temp |= static_cast<int>(IntegrationScopeFeatures::RHOMBOID_HORIZONTAL);
else if(points.size() == 2)
temp |= static_cast<int>(IntegrationScopeFeatures::RHOMBOID_VERTICAL);
else if(points.size() > 2)
temp |= static_cast<int>(IntegrationScopeFeatures::FLAT_ON_Y_AXIS);
temp |= static_cast<int>(IntegrationScopeFeatures::SUCCESS);
return static_cast<IntegrationScopeFeatures>(temp);
}
pappso::IntegrationScopeRhomb::getLeftMostPoint
virtual IntegrationScopeFeatures getLeftMostPoint(QPointF &point) const override
Definition integrationscoperhomb.cpp:238

References pappso::FAILURE, pappso::FLAT_ON_Y_AXIS, getLeftMostPoint(), m_points, pappso::RHOMBOID_HORIZONTAL, pappso::RHOMBOID_VERTICAL, and pappso::SUCCESS.

Referenced by getLeftMostBottomPoint(), getLeftMostTopPoint(), and getRhombVerticalSize().

## getLeftMostTopPoint()

IntegrationScopeFeatures pappso::IntegrationScopeRhomb::getLeftMostTopPoint | ( | QPointF & | point | ) | const

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 382 of file integrationscoperhomb.cpp.

{
if(m_points.size() < 4)
qFatal("The rhomboid has not four points.");
std::vector<QPointF> points;
// Try the top most points, which will tell us if the rhomboid is horizontal
// or not.
IntegrationScopeFeatures scope_features = getTopMostPoints(points);
if(scope_features == IntegrationScopeFeatures::FAILURE)
qFatal("Failed to get the top most points.");
if(scope_features & IntegrationScopeFeatures::RHOMBOID_HORIZONTAL)
{
// We should have gotten 2 points.
if(points.size() != 2)
qFatal("We should have gotten two points.");
if(points.at(0).x() < points.at(1).x())
point = points.at(0);
else
point = points.at(1);
}
else if(scope_features & IntegrationScopeFeatures::RHOMBOID_VERTICAL)
{
// In this case, we need to ask for the left most points. We'll have to
// check the
// results again!
scope_features = getLeftMostPoints(points);
if(scope_features == IntegrationScopeFeatures::FAILURE)
qFatal("Failed to get the left most points.");
if(scope_features & IntegrationScopeFeatures::RHOMBOID_VERTICAL)
{
// We should have gotten 2 points.
if(points.size() != 2)
qFatal("We should have gotten two points.");
if(points.at(0).y() > points.at(1).y())
point = points.at(0);
else
point = points.at(1);
}
else if(scope_features & IntegrationScopeFeatures::FLAT_ON_Y_AXIS)
{
// It is possible that the user has rotated the vertical rhomboid
// such that all the points are aligned on the y axis (all have the
// same x axis value). This is not an error condition. All we do is
// return scope_features so the caller understands the situations.
}
else
qFatal("This point should never be reached.");
}
else if(scope_features & IntegrationScopeFeatures::FLAT_ON_X_AXIS)
{
// This is not an error condition. All we do is return scope_features
// so the caller understands the situations.
}
else
qFatal("This point should never be reached.");
return scope_features;
}
pappso::IntegrationScopeRhomb::getTopMostPoints
virtual IntegrationScopeFeatures getTopMostPoints(std::vector< QPointF > &points) const override
Definition integrationscoperhomb.cpp:114

References pappso::FAILURE, pappso::FLAT_ON_X_AXIS, pappso::FLAT_ON_Y_AXIS, getLeftMostPoints(), getTopMostPoints(), m_points, pappso::RHOMBOID_HORIZONTAL, and pappso::RHOMBOID_VERTICAL.

Referenced by toString().

## getPoint()

bool pappso::IntegrationScopeRhomb::getPoint | ( | QPointF & | point | ) | const

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 79 of file integrationscoperhomb.cpp.

{
return false;
}

## getPoints()

bool pappso::IntegrationScopeRhomb::getPoints | ( | std::vector< QPointF > & | points | ) | const

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 85 of file integrationscoperhomb.cpp.

{
points.clear();
points.assign(m_points.begin(), m_points.end());
return true;
}

References m_points.

## getRhombHorizontalSize()

IntegrationScopeFeatures pappso::IntegrationScopeRhomb::getRhombHorizontalSize | ( | double & | size | ) | const

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 756 of file integrationscoperhomb.cpp.

{
if(m_points.size() < 4)
qFatal("The IntegrationScopeRhomb has less than four points.");
// There are two kinds of rhomboid integration scopes:
/*
* 4 +-----------+3
* | |
* | |
* | |
* | |
* | |
* | |
* | |
* 1+----------+2
* ----width---
*/
// As visible here, the fixed size of the rhomboid (using the S key in the
// plot widget) is the *horizontal* side (this is the plot context's
// m_integrationScopeRhombWidth). In this case the height of the scope is 0.
// and
/*
* +3
* . |
* . |
* . |
* . +2
* . .
* . .
* . .
* 4+ .
* | | .
* height | | .
* | | .
* 1+
*
*/
// As visible here, the fixed size of the rhomboid (using the S key in the
// plot widget) is the *vertical* side (this is the plot context's
// m_integrationScopeRhombHeight). In this case the width of the scope is 0.
// In this function we need to establish what kind of rhomboid (horizontal or
// vertical) we are dealing with.
// If the scope is horizontal, then two points of same y value (either top or
// bottom) have different x values. That is, leftmost top point has the same y
// value as the rightmost top point. Similarly, the leftmost bottom point has
// the same y value as the rightmost bottom point.
// If the scope is vertical, then there is only one single point that has the
// greatest y value. Likewise, there is only one single point having the
// smallest y value. Conversely, there are going to be two points of differing
// y values having the same x value (2 leftmost points and two rightmost
// points).
std::vector<QPointF> points;
// First get the top most point, we'll use the y value to check if there is
// only one point sharing that value or not.
// qDebug() << "The rhomboid integration scope:" << toString();
IntegrationScopeFeatures scope_features = getTopMostPoints(points);
if(scope_features == IntegrationScopeFeatures::FAILURE)
qFatal("Failed to get top most points.");
// qDebug() << "getTopMostPoints() got" << points.size() << "points.";
if(scope_features & IntegrationScopeFeatures::FLAT_ON_X_AXIS)
{
// Do not change anything to the width passed as parameter.
}
else if(scope_features & IntegrationScopeFeatures::RHOMBOID_HORIZONTAL)
{
// We are dealing with a horizontal rhomboid. Thus we *must* have
// gotten 2 points.
size = fabs(points.at(0).x() - points.at(1).x());
}
else if(scope_features &
IntegrationScopeFeatures::RHOMBOID_VERTICAL)
{
// We are dealing with a vertical rhomboid.
size = 0;
}
return scope_features;
}

References pappso::FAILURE, pappso::FLAT_ON_X_AXIS, getTopMostPoints(), m_points, pappso::RHOMBOID_HORIZONTAL, and pappso::RHOMBOID_VERTICAL.

## getRhombVerticalSize()

IntegrationScopeFeatures pappso::IntegrationScopeRhomb::getRhombVerticalSize | ( | double & | size | ) | const

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 853 of file integrationscoperhomb.cpp.

{
// See getRhombHorizontalSize() for explanations.
// If the scope is horizontal, then two points of same y value (either top or
// bottom) have different x values. That is, leftmost top point has the same y
// value as the rightmost top point. Similarly, the leftmost bottom point has
// the same y value as the rightmost bottom point.
// If the scope is vertical, then there is only one single point that has the
// greatest y value. Likewise, there is only one single point having the
// smallest y value. Conversely, there are going to be two points of differing
// y values having the same x value (2 leftmost points and two rightmost
// points).
std::vector<QPointF> points;
// Get the leftmost points (there are going to be 1 or 2 points in the
// vector depending on the kind of rhomboid.
// qDebug() << "The rhomboid integration scope:" << toString();
IntegrationScopeFeatures scope_features = getLeftMostPoints(points);
if(scope_features == IntegrationScopeFeatures::FAILURE)
qFatal("Failed to get left most points.");
// qDebug() << "getLeftMostPoints() got" << points.size() << "points.";
if(scope_features & IntegrationScopeFeatures::FLAT_ON_Y_AXIS)
{
// Do not change anything to the width passed as parameter.
}
else if(scope_features & IntegrationScopeFeatures::RHOMBOID_HORIZONTAL)
{
// We are dealing with a horizontal rhomboid.
size = 0;
}
else if(scope_features & IntegrationScopeFeatures::RHOMBOID_VERTICAL)
{
// We are dealing with a vertical rhomboid. Thus we *must* have
// gotten 2 points.
size = fabs(points.at(0).y() - points.at(1).y());
}
return scope_features;
}

References pappso::FAILURE, pappso::FLAT_ON_Y_AXIS, getLeftMostPoints(), pappso::RHOMBOID_HORIZONTAL, and pappso::RHOMBOID_VERTICAL.

## getRightMostBottomPoint()

IntegrationScopeFeatures pappso::IntegrationScopeRhomb::getRightMostBottomPoint | ( | QPointF & | point | ) | const

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 596 of file integrationscoperhomb.cpp.

{
if(m_points.size() < 4)
qFatal("The rhomboid has not four points.");
std::vector<QPointF> points;
// Try the bottom most points, which will tell us if the rhomboid is
// horizontal or not.
IntegrationScopeFeatures scope_features = getBottomMostPoints(points);
if(scope_features == IntegrationScopeFeatures::FAILURE)
qFatal("Failed to get the bottom most points.");
if(scope_features & IntegrationScopeFeatures::RHOMBOID_HORIZONTAL)
{
// We should have gotten 2 points.
if(points.size() != 2)
qFatal("We should have gotten two points.");
if(points.at(0).x() > points.at(1).x())
point = points.at(0);
else
point = points.at(1);
}
else if(scope_features & IntegrationScopeFeatures::RHOMBOID_VERTICAL)
{
// In this case, we need to ask for the left most points. We'll have to
// check the results again!
scope_features = getRightMostPoints(points);
if(!(scope_features & IntegrationScopeFeatures::SUCCESS))
qFatal("Failed to get the right most points.");
if(scope_features & IntegrationScopeFeatures::RHOMBOID_VERTICAL)
{
// We should have gotten 2 points.
if(points.size() != 2)
qFatal("We should have gotten two points.");
if(points.at(0).y() < points.at(1).y())
point = points.at(0);
else
point = points.at(1);
}
else if(scope_features & IntegrationScopeFeatures::FLAT_ON_Y_AXIS)
{
// It is possible that the user has rotated the vertical rhomboid
// such that all the points are aligned on the y axis (all have the
// same x axis value). This is not an error condition. All we do is
// return scope_features so the caller understands the situations.
}
else
qFatal("This point should never be reached.");
}
else if(scope_features & IntegrationScopeFeatures::FLAT_ON_ANY_AXIS)
{
// This is not an error condition. All we do is return scope_features
// so the caller understands the situations.
}
else
qFatal("This point should never be reached.");
return scope_features;
}
pappso::IntegrationScopeRhomb::getRightMostPoints
virtual IntegrationScopeFeatures getRightMostPoints(std::vector< QPointF > &points) const override
Definition integrationscoperhomb.cpp:330
pappso::FLAT_ON_ANY_AXIS
@ FLAT_ON_ANY_AXIS
Definition integrationscopebase.h:56

References pappso::FAILURE, pappso::FLAT_ON_ANY_AXIS, pappso::FLAT_ON_Y_AXIS, getBottomMostPoints(), getRightMostPoints(), m_points, pappso::RHOMBOID_HORIZONTAL, pappso::RHOMBOID_VERTICAL, and pappso::SUCCESS.

Referenced by toString().

## getRightMostPoint()

IntegrationScopeFeatures pappso::IntegrationScopeRhomb::getRightMostPoint | ( | QPointF & | point | ) | const

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 310 of file integrationscoperhomb.cpp.

{
if(m_points.size() < 4)
qFatal("The rhomboid has not four points.");
double greatest_x = std::numeric_limits<double>::min();
for(auto &the_point : m_points)
{
if(the_point.x() > greatest_x)
{
greatest_x = the_point.x();
point = the_point;
}
}
return IntegrationScopeFeatures::SUCCESS;
}

References m_points, and pappso::SUCCESS.

Referenced by getRightMostPoints(), getWidth(), and range().

## getRightMostPoints()

IntegrationScopeFeatures pappso::IntegrationScopeRhomb::getRightMostPoints | ( | std::vector< QPointF > & | points | ) | const

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 330 of file integrationscoperhomb.cpp.

{
if(m_points.size() < 4)
qFatal("The rhomboid has not four points.");
// Depending of the horiz or vert quality of the scope we are going to return
// 1 or 2 points, respectively.
points.clear();
QPointF point;
if(getRightMostPoint(point) == IntegrationScopeFeatures::FAILURE)
qFatal("Failed to get at least one left most point.");
// Store that point immediately.
points.push_back(point);
// Now that we know at least one of the right most points, check if there are
// other points having same x and different y. Note that one specific case
// is when the rhomboid is flat on the y axis, in which case all the points
// have the same x value. We will thus return 4 points. In all the other
// cases, we return 1 point if the rhomboid is horizontal and 2 points if the
// rhomboid is vertical.
for(auto &the_point : m_points)
{
if(the_point == point)
continue;
if(the_point.x() == point.x())
{
// We are handling a vertical rhomboid.
points.push_back(the_point);
}
}
uint temp = 0;
if(points.size() == 1)
temp |= static_cast<int>(IntegrationScopeFeatures::RHOMBOID_HORIZONTAL);
else if(points.size() == 2)
temp |= static_cast<int>(IntegrationScopeFeatures::RHOMBOID_VERTICAL);
else if(points.size() > 2)
temp |= static_cast<int>(IntegrationScopeFeatures::FLAT_ON_Y_AXIS);
temp |= static_cast<int>(IntegrationScopeFeatures::SUCCESS);
return static_cast<IntegrationScopeFeatures>(temp);
}
pappso::IntegrationScopeRhomb::getRightMostPoint
virtual IntegrationScopeFeatures getRightMostPoint(QPointF &point) const override
Definition integrationscoperhomb.cpp:310

References pappso::FAILURE, pappso::FLAT_ON_Y_AXIS, getRightMostPoint(), m_points, pappso::RHOMBOID_HORIZONTAL, pappso::RHOMBOID_VERTICAL, and pappso::SUCCESS.

Referenced by getRightMostBottomPoint(), and getRightMostTopPoint().

## getRightMostTopPoint()

IntegrationScopeFeatures pappso::IntegrationScopeRhomb::getRightMostTopPoint | ( | QPointF & | point | ) | const

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 525 of file integrationscoperhomb.cpp.

{
if(m_points.size() < 4)
qFatal("The rhomboid has not four points.");
std::vector<QPointF> points;
// Try the top most points, which will tell us if the rhomboid is horizontal
// or not.
IntegrationScopeFeatures scope_features = getTopMostPoints(points);
if(scope_features == IntegrationScopeFeatures::FAILURE)
qFatal("Failed to get the top most points.");
if(scope_features & IntegrationScopeFeatures::RHOMBOID_HORIZONTAL)
{
// We should have gotten 2 points.
if(points.size() != 2)
qFatal("We should have gotten two points.");
if(points.at(0).x() > points.at(1).x())
point = points.at(0);
else
point = points.at(1);
}
else if(scope_features & IntegrationScopeFeatures::RHOMBOID_VERTICAL)
{
// In this case, we need to ask for the left most points. We'll have to
// check the results again!
scope_features = getRightMostPoints(points);
if(scope_features == IntegrationScopeFeatures::FAILURE)
qFatal("Failed to get the right most points.");
if(scope_features & IntegrationScopeFeatures::RHOMBOID_VERTICAL)
{
// We should have gotten 2 points.
if(points.size() != 2)
qFatal("We should have gotten two points.");
if(points.at(0).y() > points.at(1).y())
point = points.at(0);
else
point = points.at(1);
}
else if(scope_features & IntegrationScopeFeatures::FLAT_ON_Y_AXIS)
{
// It is possible that the user has rotated the vertical rhomboid
// such that all the points are aligned on the y axis (all have the
// same x axis value). This is not an error condition. All we do is
// return scope_features so the caller understands the situations.
}
else
qFatal("This point should never be reached.");
}
else if(scope_features & IntegrationScopeFeatures::FLAT_ON_X_AXIS)
{
// This is not an error condition. All we do is return scope_features
// so the caller understands the situations.
}
else
qFatal("This point should never be reached.");
return scope_features;
}

References pappso::FAILURE, pappso::FLAT_ON_X_AXIS, pappso::FLAT_ON_Y_AXIS, getRightMostPoints(), getTopMostPoints(), m_points, pappso::RHOMBOID_HORIZONTAL, and pappso::RHOMBOID_VERTICAL.

Referenced by toString().

## getTopMostPoint()

IntegrationScopeFeatures pappso::IntegrationScopeRhomb::getTopMostPoint | ( | QPointF & | point | ) | const

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 93 of file integrationscoperhomb.cpp.

{
if(m_points.size() < 4)
qFatal("The rhomboid has not four points.");
double top_most_y_value = std::numeric_limits<double>::min();
for(auto &the_point : m_points)
{
if(the_point.y() > top_most_y_value)
{
top_most_y_value = the_point.y();
point = the_point;
}
}
// Necessarily, whe have a top most point (greatest y of all).
return IntegrationScopeFeatures::SUCCESS;
}

References m_points, and pappso::SUCCESS.

Referenced by getHeight(), getTopMostPoints(), and range().

## getTopMostPoints()

IntegrationScopeFeatures pappso::IntegrationScopeRhomb::getTopMostPoints | ( | std::vector< QPointF > & | points | ) | const

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 114 of file integrationscoperhomb.cpp.

{
if(m_points.size() < 4)
qFatal("The rhomboid has not four points.");
// Depending on the horiz or vert quality of the scope we are going to return
// 2 or 1 point, respectively.
points.clear();
QPointF point;
if(!(getTopMostPoint(point) & IntegrationScopeFeatures::SUCCESS))
qFatal("Failed to get the top most point.");
// Store that point immediately.
points.push_back(point);
// Now that we know at least one of the top most points, check if there are
// other points having same y and different x. Note that one specific case
// is when the rhomboid is flat on the x axis, in which case all the points
// have the same y value. We will thus return 4 points. In all the other
// cases, we return 2 points if the rhomboid is horizontal and 1 point if the
// rhomboid is vertical.
for(auto &the_point : m_points)
{
if(the_point == point)
continue;
if(the_point.y() == point.y())
{
// We are handling a horizontal rhomboid.
points.push_back(the_point);
}
}
uint temp = 0;
if(points.size() == 1)
temp |= IntegrationScopeFeatures::RHOMBOID_VERTICAL;
else if(points.size() == 2)
temp |= IntegrationScopeFeatures::RHOMBOID_HORIZONTAL;
else if(points.size() > 2)
temp |= IntegrationScopeFeatures::FLAT_ON_X_AXIS;
temp |= IntegrationScopeFeatures::SUCCESS;
return static_cast<IntegrationScopeFeatures>(temp);
}

References pappso::FLAT_ON_X_AXIS, getTopMostPoint(), m_points, pappso::RHOMBOID_HORIZONTAL, pappso::RHOMBOID_VERTICAL, and pappso::SUCCESS.

Referenced by getLeftMostTopPoint(), getRhombHorizontalSize(), and getRightMostTopPoint().

## getWidth()

IntegrationScopeFeatures pappso::IntegrationScopeRhomb::getWidth | ( | double & | width | ) | const

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 667 of file integrationscoperhomb.cpp.

{
if(m_points.size() < 4)
qFatal("The IntegrationScopeRhomb has less than four points.");
// There are two kinds of rhomboid integration scopes:
/*
4 +-----------+3
| |
| |
| |
| |
| |
| |
| |
1+----------+2
----width---
*/
// As visible here, the fixed size of the rhomboid (using the S key in the
// plot widget) is the *horizontal* side (this is the plot context's
// m_integrationScopeRhombWidth). In this case the height of the scope is 0.
// and
/*
* +3
* . |
* . |
* . |
* . +2
* . .
* . .
* . .
* 4+ .
* | | .
* height | | .
* | | .
* 1+
*
*/
// As visible here, the fixed size of the rhomboid (using the S key in the
// plot widget) is the *vertical* side (this is the plot context's
// m_integrationScopeRhombHeight). In this case the width of the scope is 0.
// The width of the rhomboid is the entire span that it has on the x axis.
QPointF left_most_point;
QPointF right_most_point;
if(!getLeftMostPoint(left_most_point))
qFatal("Failed to get the left most point.");
if(!getRightMostPoint(right_most_point))
qFatal("Failed to get the right most point.");
width = fabs(right_most_point.x() - left_most_point.x());
return IntegrationScopeFeatures::SUCCESS;
}

References getLeftMostPoint(), getRightMostPoint(), m_points, and pappso::SUCCESS.

## is1D()

bool pappso::IntegrationScopeRhomb::is1D | ( |  | ) | const

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 967 of file integrationscoperhomb.cpp.

{
return false;
}

Referenced by is2D().

## is2D()

bool pappso::IntegrationScopeRhomb::is2D | ( |  | ) | const

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 973 of file integrationscoperhomb.cpp.

{
return !is1D();
}
pappso::IntegrationScopeRhomb::is1D
bool is1D() const override
Definition integrationscoperhomb.cpp:967

References is1D().

## isRectangle()

bool pappso::IntegrationScopeRhomb::isRectangle | ( |  | ) | const

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 979 of file integrationscoperhomb.cpp.

{
return false;
}

## isRhomboid()

bool pappso::IntegrationScopeRhomb::isRhomboid | ( |  | ) | const

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 985 of file integrationscoperhomb.cpp.

{
return true;
}

## operator=()

IntegrationScopeRhomb & pappso::IntegrationScopeRhomb::operator= | ( | const IntegrationScopeRhomb & | other | ) |

virtual

Definition at line 58 of file integrationscoperhomb.cpp.

{
if(this == &other)
return *this;
m_points.assign(other.m_points.begin(), other.m_points.end());
m_dataKindX = other.m_dataKindX;
m_dataKindY = other.m_dataKindY;
return *this;
}

References m_dataKindX, m_dataKindY, and m_points.

## range()

bool pappso::IntegrationScopeRhomb::range | ( | Axis | axis,
|  | double & | start,
|  | double & | end
| ) |  | const

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 902 of file integrationscoperhomb.cpp.

{
if(axis == Axis::x)
{
QPointF left_most_point;
if(getLeftMostPoint(left_most_point) == IntegrationScopeFeatures::FAILURE)
qFatal("Failed to get left-most point.");
QPointF right_most_point;
if(getRightMostPoint(right_most_point) ==
IntegrationScopeFeatures::FAILURE)
qFatal("Failed to get right-most point.");
start = left_most_point.x();
end = right_most_point.x();
return true;
}
else if(axis == Axis::y)
{
QPointF bottom_most_point;
if(getBottomMostPoint(bottom_most_point) ==
IntegrationScopeFeatures::FAILURE)
qFatal("Failed to get bottom-most point.");
QPointF top_most_point;
if(getTopMostPoint(top_most_point) == IntegrationScopeFeatures::FAILURE)
qFatal("Failed to get top-most point.");
start = bottom_most_point.y();
end = top_most_point.y();
return true;
}
return false;
}
pappso::Axis::y
@ y
pappso::Axis::x
@ x

References pappso::FAILURE, getBottomMostPoint(), getLeftMostPoint(), getRightMostPoint(), getTopMostPoint(), pappso::x, and pappso::y.

## reset()

void pappso::IntegrationScopeRhomb::reset | ( |  | ) |

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 1084 of file integrationscoperhomb.cpp.

{
IntegrationScopeBase::reset();
m_points.clear();
}
pappso::IntegrationScopeBase::reset
virtual void reset()
Definition integrationscopebase.cpp:228

References m_points, and pappso::IntegrationScopeBase::reset().

## setDataKindX()

void pappso::IntegrationScopeRhomb::setDataKindX | ( | DataKind | data_kind | ) |

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 941 of file integrationscoperhomb.cpp.

{
m_dataKindX = data_kind;
}

References m_dataKindX.

## setDataKindY()

void pappso::IntegrationScopeRhomb::setDataKindY | ( | DataKind | data_kind | ) |

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 947 of file integrationscoperhomb.cpp.

{
m_dataKindY = data_kind;
}

References m_dataKindY.

## toString()

QString pappso::IntegrationScopeRhomb::toString | ( |  | ) | const

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 1048 of file integrationscoperhomb.cpp.

{
QString text = "[";
#if 0
// This version is bad because it has reentrancy problems: it might be
// called by functions that are actually called in turn here.
// First the bottom points pair
getLeftMostBottomPoint(point);
text.append(QString("(%1, %2)").arg(point.x()).arg(point.y()));
getRightMostBottomPoint(point);
text.append(QString("(%1, %2)").arg(point.x()).arg(point.y()));
// Second the top points pair
getLeftMostTopPoint(point);
text.append(QString("(%1, %2)").arg(point.x()).arg(point.y()));
getRightMostTopPoint(point);
text.append(QString("(%1, %2)").arg(point.x()).arg(point.y()));
#endif
for(auto &point : m_points)
text.append(QString("(%1, %2)").arg(point.x()).arg(point.y()));
text.append("]");
// qDebug() << "Returning toString():" << text;
return text;
}
pappso::IntegrationScopeRhomb::getRightMostTopPoint
virtual IntegrationScopeFeatures getRightMostTopPoint(QPointF &point) const override
Definition integrationscoperhomb.cpp:525
pappso::IntegrationScopeRhomb::getLeftMostTopPoint
virtual IntegrationScopeFeatures getLeftMostTopPoint(QPointF &point) const override
Definition integrationscoperhomb.cpp:382
pappso::IntegrationScopeRhomb::getLeftMostBottomPoint
virtual IntegrationScopeFeatures getLeftMostBottomPoint(QPointF &point) const override
Definition integrationscoperhomb.cpp:454
pappso::IntegrationScopeRhomb::getRightMostBottomPoint
virtual IntegrationScopeFeatures getRightMostBottomPoint(QPointF &point) const override
Definition integrationscoperhomb.cpp:596
pappso::PeptideIonCter::y
@ y
pappso::PeptideIonCter::x
@ x

References getLeftMostBottomPoint(), getLeftMostTopPoint(), getRightMostBottomPoint(), getRightMostTopPoint(), and m_points.

## transpose()

bool pappso::IntegrationScopeRhomb::transpose | ( |  | ) |

override virtual

Reimplemented from pappso::IntegrationScopeBase.

Definition at line 991 of file integrationscoperhomb.cpp.

{
DataKind was_data_kind_y = m_dataKindY;
m_dataKindY = m_dataKindX;
m_dataKindX = was_data_kind_y;
// Transpose each point in a new vector.
std::vector<QPointF> transposed_points;
for(QPointF &point : m_points)
transposed_points.push_back(QPointF(point.y(), point.x()));
// And now set them back to the member datum.
m_points.assign(transposed_points.begin(), transposed_points.end());
return true;
}
pappso::DataKind
DataKind
Definition types.h:218

References m_dataKindX, m_dataKindY, and m_points.

## Member Data Documentation

## m_dataKindX

DataKind pappso::IntegrationScopeRhomb::m_dataKindX = DataKind::unset

protected

Definition at line 143 of file integrationscoperhomb.h.

Referenced by getDataKindX(), operator=(), setDataKindX(), and transpose().

## m_dataKindY

DataKind pappso::IntegrationScopeRhomb::m_dataKindY = DataKind::unset

protected

Definition at line 144 of file integrationscoperhomb.h.

Referenced by getDataKindY(), operator=(), setDataKindY(), and transpose().

## m_points

std::vector<QPointF> pappso::IntegrationScopeRhomb::m_points

protected

Definition at line 142 of file integrationscoperhomb.h.

Referenced by addPoint(), contains(), getBottomMostPoint(), getBottomMostPoints(), getHeight(), getLeftMostBottomPoint(), getLeftMostPoint(), getLeftMostPoints(), getLeftMostTopPoint(), getPoints(), getRhombHorizontalSize(), getRightMostBottomPoint(), getRightMostPoint(), getRightMostPoints(), getRightMostTopPoint(), getTopMostPoint(), getTopMostPoints(), getWidth(), operator=(), reset(), toString(), and transpose().

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

- pappsomspp/processing/combiners/integrationscoperhomb.h
- pappsomspp/processing/combiners/integrationscoperhomb.cpp