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

`#include <qcpxic.h>`

Inheritance diagram for pappso::QCPXic:

## Protected Member Functions

| QCPXic (XicWidget *parent)
| ~QCPXic ()
void | clear ()
void | rescale ()
QCPGraph * | addXicP (const Xic *xic_p)
void | addMsMsEvent (const Xic *xic_p, pappso::pappso_double rt)
void | addXicPeakList (const Xic *xic_p, const std::vector< pappso::TracePeakCstSPtr > &xic_peak_list)
void | setName (const Xic *xic_p, const QString &name)
void | drawXicPeakBorders (unsigned int i, const Xic *xic_p, const pappso::TracePeak *p_xic_peak)
void | clearXicPeakBorders ()
virtual void | mouseMoveEvent (QMouseEvent *event) override
virtual void | mousePressEvent (QMouseEvent *event) override
virtual void | mouseReleaseEvent (QMouseEvent *event) override
virtual void | keyPressEvent (QKeyEvent *event) override
virtual void | keyReleaseEvent (QKeyEvent *event) override

## Private Member Functions

Q_SLOT void | setRtRangeChanged (QCPRange range)
pappso::pappso_double | getRetentionTimeFromSecondsToLocal (pappso::pappso_double rt) const
pappso::pappso_double | xAxisToSeconds (pappso::pappso_double rt) const

## Private Attributes

XicWidget * | _parent
QCPRange | _rt_range
QCPRange | _intensity_range
bool | _click = false
bool | _mouse_move = false
bool | _control_key = false
pappso::pappso_double | _old_x
pappso::pappso_double | _old_y
QCPItemTracer * | _current_ms2_event = nullptr
std::map< const Xic *, QCPGraph * > | _map_xic_graph
QColor | _graph_color
std::vector< QColor > | _colours
std::vector< QCPGraph * > | _graph_peak_surface_list
std::vector< QCPItemTracer * > | _graph_peak_border_list

## Friends

class | XicWidget

## Detailed Description

Definition at line 40 of file qcpxic.h.

## Constructor & Destructor Documentation

## QCPXic()

QCPXic::QCPXic | ( | XicWidget * | parent | ) |

protected

Definition at line 38 of file qcpxic.cpp.

: QCustomPlot(parent)
{
qDebug() << "QCPXic::QCPXic begin";
_parent = parent;
setFocusPolicy(Qt::ClickFocus);
if(_parent->_rt_in_seconds)
{
xAxis->setLabel("retention time (sec)");
}
else
{
xAxis->setLabel("retention time (min)");
}
yAxis->setLabel("intensity");
setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);
axisRect()->setRangeDrag(Qt::Horizontal);
axisRect()->setRangeZoom(Qt::Horizontal);
connect(this->xAxis, SIGNAL(rangeChanged(QCPRange)), this, SLOT(setRtRangeChanged(QCPRange)));
//
// http://tools.medialab.sciences-po.fr/iwanthue/
_colours = {QColor(197, 89, 110),
QColor(94, 185, 86),
QColor(132, 95, 203),
QColor(176, 175, 69),
QColor(202, 72, 160),
QColor(91, 126, 59),
QColor(193, 126, 189),
QColor(81, 183, 159),
QColor(210, 77, 58),
QColor(99, 137, 203),
QColor(223, 147, 71),
QColor(156, 105, 52)};
qDebug() << "QCPXic::QCPXic end";
}
pappso::QCPXic::_colours
std::vector< QColor > _colours
Definition qcpxic.h:88
pappso::QCPXic::setRtRangeChanged
Q_SLOT void setRtRangeChanged(QCPRange range)
Definition qcpxic.cpp:247
pappso::QCPXic::_parent
XicWidget * _parent
Definition qcpxic.h:77

References _colours, _parent, setRtRangeChanged(), and XicWidget.

## ~QCPXic()

QCPXic::~QCPXic | ( |  | ) |

protected

Definition at line 77 of file qcpxic.cpp.

{
}

## Member Function Documentation

## addMsMsEvent()

void QCPXic::addMsMsEvent | ( | const Xic * | xic_p,
|  | pappso::pappso_double | rt )

protected

Definition at line 264 of file qcpxic.cpp.

{
_current_ms2_event = new QCPItemTracer(this);
// itemDemoPhaseTracer = phaseTracer; // so we can access it later in the
// bracketDataSlot for animation
_current_ms2_event->setGraph(_map_xic_graph.at(xic_p));
_current_ms2_event->setGraphKey(getRetentionTimeFromSecondsToLocal(rt));
_current_ms2_event->setInterpolating(true);
_current_ms2_event->setStyle(QCPItemTracer::tsCircle);
_current_ms2_event->setPen(QPen(Qt::red));
_current_ms2_event->setBrush(Qt::red);
_current_ms2_event->setSize(7);
// addItem(_current_ms2_event);
}
pappso::QCPXic::_map_xic_graph
std::map< const Xic *, QCPGraph * > _map_xic_graph
Definition qcpxic.h:86
pappso::QCPXic::getRetentionTimeFromSecondsToLocal
pappso::pappso_double getRetentionTimeFromSecondsToLocal(pappso::pappso_double rt) const
Definition qcpxic.cpp:329
pappso::QCPXic::_current_ms2_event
QCPItemTracer * _current_ms2_event
Definition qcpxic.h:85

References _current_ms2_event, _map_xic_graph, and getRetentionTimeFromSecondsToLocal().

## addXicP()

QCPGraph * QCPXic::addXicP | ( | const Xic * | xic_p | ) |

protected

Definition at line 211 of file qcpxic.cpp.

{
_graph_color = _colours[(int)(_map_xic_graph.size() % _colours.size())];
QCPGraph *graph_xic = addGraph();
graph_xic->setPen(QPen(_graph_color));
_map_xic_graph.insert(std::pair<const Xic *, QCPGraph *>(xic_p, graph_xic));
graph_xic->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssDisc, 2.0));
if(xic_p->size() > 0)
{
for(const DataPoint &element : *xic_p)
{
graph_xic->addData(getRetentionTimeFromSecondsToLocal(element.x), element.y);
}
if(_rt_range.lower > getRetentionTimeFromSecondsToLocal(xic_p->front().x))
_rt_range.lower = getRetentionTimeFromSecondsToLocal(xic_p->front().x) - 1;
if(_rt_range.upper < getRetentionTimeFromSecondsToLocal(xic_p->back().x))
_rt_range.upper = getRetentionTimeFromSecondsToLocal(xic_p->back().x) + 1;
_intensity_range.lower = 0;
if(_intensity_range.upper < xic_p->maxYDataPoint().y)
_intensity_range.upper = xic_p->maxYDataPoint().y;
}
return graph_xic;
}
pappso::QCPXic::_rt_range
QCPRange _rt_range
Definition qcpxic.h:78
pappso::QCPXic::_intensity_range
QCPRange _intensity_range
Definition qcpxic.h:79
pappso::QCPXic::_graph_color
QColor _graph_color
Definition qcpxic.h:87

References _colours, _graph_color, _intensity_range, _map_xic_graph, _rt_range, and getRetentionTimeFromSecondsToLocal().

## addXicPeakList()

void QCPXic::addXicPeakList | ( | const Xic * | xic_p,
|  | const std::vector< pappso::TracePeakCstSPtr > & | xic_peak_list )

protected

Definition at line 301 of file qcpxic.cpp.

{
for(const pappso::TracePeakCstSPtr &peak : xic_peak_list)
{
_graph_peak_surface_list.push_back(addGraph());
for(auto &xic_element : *(xic_p))
{
if(peak.get()->containsRt(xic_element.x))
{
_graph_peak_surface_list.back()->addData(
getRetentionTimeFromSecondsToLocal(xic_element.x), xic_element.y);
}
}
// graph()->setData(rt_peak, intensity_peak);
_graph_peak_surface_list.back()->removeFromLegend();
_graph_peak_surface_list.back()->setChannelFillGraph(0);
_graph_peak_surface_list.back()->setLineStyle(QCPGraph::LineStyle::lsLine);
QColor color = _colours[_graph_peak_surface_list.size() % 12];
color.setAlpha(0);
// QColor(0, 110, 110, 30)
_graph_peak_surface_list.back()->setPen(QPen(color));
color.setAlpha(40);
//_graph_peak_surface_list.back()->setScatterStyle(QCPScatterStyle::ssDot);
_graph_peak_surface_list.back()->setBrush(QBrush(color));
}
}
pappso::QCPXic::_graph_peak_surface_list
std::vector< QCPGraph * > _graph_peak_surface_list
Definition qcpxic.h:89
pappso::TracePeakCstSPtr
std::shared_ptr< const TracePeak > TracePeakCstSPtr
Definition tracepeak.h:35

References _colours, _graph_peak_surface_list, and getRetentionTimeFromSecondsToLocal().

## clear()

void QCPXic::clear | ( |  | ) |

protected

Definition at line 290 of file qcpxic.cpp.

{
legend->clearItems();
_map_xic_graph.clear();
this->clearGraphs();
this->clearItems();
this->clearPlottables();
}

References _map_xic_graph.

## clearXicPeakBorders()

void QCPXic::clearXicPeakBorders | ( |  | ) |

protected

Definition at line 415 of file qcpxic.cpp.

{
for(QCPItemTracer *p_tracer : _graph_peak_border_list)
{
removeItem(p_tracer);
// delete p_tracer;
}
_graph_peak_border_list.clear();
replot();
}
pappso::QCPXic::_graph_peak_border_list
std::vector< QCPItemTracer * > _graph_peak_border_list
Definition qcpxic.h:90

References _graph_peak_border_list.

## drawXicPeakBorders()

void QCPXic::drawXicPeakBorders | ( | unsigned int | i,
|  | const Xic * | xic_p,
|  | const pappso::TracePeak * | p_xic_peak )

protected

Definition at line 355 of file qcpxic.cpp.

{
QCPGraph *p_graph = _map_xic_graph.at(xic_p);
QColor color = _colours[i % 12];
// color.setAlpha(95);
QCPItemTracer *p_peak_border_left = new QCPItemTracer(this);
// itemDemoPhaseTracer = phaseTracer; // so we can access it later in the
// bracketDataSlot for animation
QPen border_pen(color);
border_pen.setWidth(3);
p_peak_border_left->setGraph(p_graph);
p_peak_border_left->setGraphKey(
getRetentionTimeFromSecondsToLocal(p_xic_peak->getLeftBoundary().x));
p_peak_border_left->setInterpolating(true);
p_peak_border_left->setStyle(QCPItemTracer::tsPlus);
p_peak_border_left->setPen(border_pen);
p_peak_border_left->setBrush(color);
p_peak_border_left->setSize(30);
_graph_peak_border_list.push_back(p_peak_border_left);
// addItem(p_peak_border_left);
QPen apex_pen(color);
apex_pen.setWidth(2);
p_peak_border_left = new QCPItemTracer(this);
p_peak_border_left->setGraph(_map_xic_graph.at(xic_p));
p_peak_border_left->setGraphKey(
getRetentionTimeFromSecondsToLocal(p_xic_peak->getMaxXicElement().x));
p_peak_border_left->setInterpolating(true);
p_peak_border_left->setStyle(QCPItemTracer::tsPlus);
p_peak_border_left->setPen(apex_pen);
p_peak_border_left->setBrush(color);
p_peak_border_left->setSize(8);
_graph_peak_border_list.push_back(p_peak_border_left);
// addItem(p_peak_border_left);
p_peak_border_left = new QCPItemTracer(this);
p_peak_border_left->setGraph(_map_xic_graph.at(xic_p));
p_peak_border_left->setGraphKey(
getRetentionTimeFromSecondsToLocal(p_xic_peak->getRightBoundary().x));
p_peak_border_left->setInterpolating(true);
p_peak_border_left->setStyle(QCPItemTracer::tsPlus);
p_peak_border_left->setPen(border_pen);
p_peak_border_left->setBrush(color);
p_peak_border_left->setSize(30);
_graph_peak_border_list.push_back(p_peak_border_left);
// addItem(p_peak_border_left);
replot();
}
pappso::TracePeak::getLeftBoundary
DataPoint & getLeftBoundary()
Definition tracepeak.cpp:93
pappso::TracePeak::getMaxXicElement
DataPoint & getMaxXicElement()
Definition tracepeak.cpp:83
pappso::TracePeak::getRightBoundary
DataPoint & getRightBoundary()
Definition tracepeak.cpp:104
pappso::DataPoint::x
pappso_double x
Definition datapoint.h:24

References _colours, _graph_peak_border_list, _map_xic_graph, pappso::TracePeak::getLeftBoundary(), pappso::TracePeak::getMaxXicElement(), getRetentionTimeFromSecondsToLocal(), pappso::TracePeak::getRightBoundary(), and pappso::DataPoint::x.

## getRetentionTimeFromSecondsToLocal()

pappso::pappso_double QCPXic::getRetentionTimeFromSecondsToLocal | ( | pappso::pappso_double | rt | ) | const

private

Definition at line 329 of file qcpxic.cpp.

{
if(_parent->_rt_in_seconds)
{
return rt;
}
else
{
return (rt / (pappso::pappso_double)60);
}
}
pappso::Enums::DataKind::rt
@ rt
Retention time.
Definition types.h:251
pappso::pappso_double
double pappso_double
A type definition for doubles.
Definition types.h:60

References _parent.

Referenced by addMsMsEvent(), addXicP(), addXicPeakList(), and drawXicPeakBorders().

## keyPressEvent()

void QCPXic::keyPressEvent | ( | QKeyEvent * | event | ) |

override protected virtual

Definition at line 81 of file qcpxic.cpp.

{
if(event->key() == Qt::Key_Control)
{
_control_key = true;
}
qDebug() << "QCPXic::keyPressEvent end";
}
pappso::QCPXic::_control_key
bool _control_key
Definition qcpxic.h:82

References _control_key.

## keyReleaseEvent()

void QCPXic::keyReleaseEvent | ( | QKeyEvent * | event | ) |

override protected virtual

Definition at line 91 of file qcpxic.cpp.

{
if(event->key() == Qt::Key_Control)
{
_control_key = false;
}
qDebug() << "QCPXic::keyReleaseEvent end";
}

References _control_key.

## mouseMoveEvent()

void QCPXic::mouseMoveEvent | ( | QMouseEvent * | event | ) |

override protected virtual

Definition at line 147 of file qcpxic.cpp.

{
_mouse_move = true;
#if QT_VERSION < 0x060000
pappso::pappso_double x = xAxis->pixelToCoord(event->x());
#else
pappso::pappso_double x = xAxis->pixelToCoord(event->position().x());
#endif
if(_click)
{
#if QT_VERSION < 0x060000
qDebug() << "QCPXic::mouseMoveEvent begin " << xAxis->pixelToCoord(event->x()) << " "
<< yAxis->pixelToCoord(event->y());
pappso::pappso_double y = yAxis->pixelToCoord(event->y());
#else
qDebug() << "QCPXic::mouseMoveEvent begin " << xAxis->pixelToCoord(event->position().x())
<< " " << yAxis->pixelToCoord(event->position().y());
pappso::pappso_double y = yAxis->pixelToCoord(event->position().y());
#endif
if(y < 0)
{
y = 0;
}
if(_control_key)
{
if(y > 0)
{
this->yAxis->scaleRange(_old_y / y, 0);
}
}
else
{
#if QT_VERSION < 0x060000
this->xAxis->moveRange(xAxis->pixelToCoord(_old_x) - xAxis->pixelToCoord(event->x()));
#else
this->xAxis->moveRange(xAxis->pixelToCoord(_old_x) -
xAxis->pixelToCoord(event->position().x()));
#endif
}
#if QT_VERSION < 0x060000
_old_x = event->x();
#else
_old_x = event->position().x();
#endif
_old_y = y;
replot();
qDebug() << "QCPXic::mouseMoveEvent end";
}
else
{
if(_map_xic_graph.size() > 0)
{
// pappso::pappso_double mouse_mz_range = xAxis->pixelToCoord(10) -
// xAxis->pixelToCoord(5); getNearestPeakBetween(x, mouse_mz_range);
_parent->rtChangeEvent(xAxisToSeconds(x));
}
}
}
pappso::QCPXic::_click
bool _click
Definition qcpxic.h:80
pappso::QCPXic::_mouse_move
bool _mouse_move
Definition qcpxic.h:81
pappso::QCPXic::_old_y
pappso::pappso_double _old_y
Definition qcpxic.h:84
pappso::QCPXic::xAxisToSeconds
pappso::pappso_double xAxisToSeconds(pappso::pappso_double rt) const
Definition qcpxic.cpp:342
pappso::QCPXic::_old_x
pappso::pappso_double _old_x
Definition qcpxic.h:83
pappso::PeptideIonCter::y
@ y
Definition peptide.h:87
pappso::PeptideIonCter::x
@ x
Definition peptide.h:92

References _click, _control_key, _map_xic_graph, _mouse_move, _old_x, _old_y, _parent, pappso::x, xAxisToSeconds(), and pappso::y.

## mousePressEvent()

void QCPXic::mousePressEvent | ( | QMouseEvent * | event | ) |

override protected virtual

Definition at line 101 of file qcpxic.cpp.

{
qDebug() << " begin ";
_mouse_move = false;
_click = true;
#if QT_VERSION < 0x060000
_old_x = event->x();
_old_y = yAxis->pixelToCoord(event->y());
#else
_old_x = event->position().x();
_old_y = yAxis->pixelToCoord(event->position().y());
#endif
if(_old_y < 0)
{
_old_y = 0;
}
else
{
}
qDebug() << "QCPXic::mousePressEvent end";
}

References _click, _mouse_move, _old_x, and _old_y.

## mouseReleaseEvent()

void QCPXic::mouseReleaseEvent | ( | QMouseEvent * | event | ) |

override protected virtual

Definition at line 124 of file qcpxic.cpp.

{
#if QT_VERSION < 0x060000
qDebug() << "QCPXic::mouseReleaseEvent begin " << xAxis->pixelToCoord(event->x()) << " "
<< yAxis->pixelToCoord(event->y());
#else
qDebug() << "QCPXic::mouseReleaseEvent begin " << xAxis->pixelToCoord(event->position().x())
<< " " << yAxis->pixelToCoord(event->position().y());
#endif
_click = false;
if(_mouse_move)
{
_mouse_move = false;
}
else
{
_parent->xicClickEvent(xAxisToSeconds(_old_x), _old_y);
}
qDebug() << "QCPXic::mouseReleaseEvent end";
}

References _click, _mouse_move, _old_x, _old_y, _parent, and xAxisToSeconds().

## rescale()

void QCPXic::rescale | ( |  | ) |

protected

Definition at line 241 of file qcpxic.cpp.

{
}

## setName()

void QCPXic::setName | ( | const Xic * | xic_p,
|  | const QString & | name )

protected

Definition at line 282 of file qcpxic.cpp.

{
_map_xic_graph.at(xic_p)->addToLegend();
_map_xic_graph.at(xic_p)->setName(name);
}

References _map_xic_graph.

## setRtRangeChanged()

void QCPXic::setRtRangeChanged | ( | QCPRange | range | ) |

private

Definition at line 247 of file qcpxic.cpp.

{
qDebug() << "QCPXic::setMzRangeChanged _rt_range.lower" << _rt_range.lower;
if(range.lower < _rt_range.lower)
{
range.lower = _rt_range.lower;
}
if(range.upper > _rt_range.upper)
{
range.upper = _rt_range.upper;
}
xAxis->setRange(range);
}

References _rt_range.

Referenced by QCPXic().

## xAxisToSeconds()

pappso::pappso_double QCPXic::xAxisToSeconds | ( | pappso::pappso_double | rt | ) | const

private

Definition at line 342 of file qcpxic.cpp.

{
if(_parent->_rt_in_seconds)
{
return rt;
}
else
{
return (rt * (pappso::pappso_double)60);
}
}

References _parent.

Referenced by mouseMoveEvent(), and mouseReleaseEvent().

## Friends And Related Symbol Documentation

## XicWidget

friend class XicWidget

friend

Definition at line 44 of file qcpxic.h.

References XicWidget.

Referenced by QCPXic(), and XicWidget.

## Member Data Documentation

## _click

bool pappso::QCPXic::_click = false

private

Definition at line 80 of file qcpxic.h.

Referenced by mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().

## _colours

std::vector<QColor> pappso::QCPXic::_colours

private

Definition at line 88 of file qcpxic.h.

Referenced by QCPXic(), addXicP(), addXicPeakList(), and drawXicPeakBorders().

## _control_key

bool pappso::QCPXic::_control_key = false

private

Definition at line 82 of file qcpxic.h.

Referenced by keyPressEvent(), keyReleaseEvent(), and mouseMoveEvent().

## _current_ms2_event

QCPItemTracer* pappso::QCPXic::_current_ms2_event = nullptr

private

Definition at line 85 of file qcpxic.h.

Referenced by addMsMsEvent().

## _graph_color

QColor pappso::QCPXic::_graph_color

private

Definition at line 87 of file qcpxic.h.

Referenced by addXicP().

## _graph_peak_border_list

std::vector<QCPItemTracer *> pappso::QCPXic::_graph_peak_border_list

private

Definition at line 90 of file qcpxic.h.

Referenced by clearXicPeakBorders(), and drawXicPeakBorders().

## _graph_peak_surface_list

std::vector<QCPGraph *> pappso::QCPXic::_graph_peak_surface_list

private

Definition at line 89 of file qcpxic.h.

Referenced by addXicPeakList().

## _intensity_range

QCPRange pappso::QCPXic::_intensity_range

private

Definition at line 79 of file qcpxic.h.

Referenced by addXicP().

## _map_xic_graph

std::map<const Xic *, QCPGraph *> pappso::QCPXic::_map_xic_graph

private

Definition at line 86 of file qcpxic.h.

Referenced by addMsMsEvent(), addXicP(), clear(), drawXicPeakBorders(), mouseMoveEvent(), and setName().

## _mouse_move

bool pappso::QCPXic::_mouse_move = false

private

Definition at line 81 of file qcpxic.h.

Referenced by mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().

## _old_x

pappso::pappso_double pappso::QCPXic::_old_x

private

Definition at line 83 of file qcpxic.h.

Referenced by mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().

## _old_y

pappso::pappso_double pappso::QCPXic::_old_y

private

Definition at line 84 of file qcpxic.h.

Referenced by mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().

## _parent

XicWidget* pappso::QCPXic::_parent

private

Definition at line 77 of file qcpxic.h.

Referenced by QCPXic(), getRetentionTimeFromSecondsToLocal(), mouseMoveEvent(), mouseReleaseEvent(), and xAxisToSeconds().

## _rt_range

QCPRange pappso::QCPXic::_rt_range

private

Definition at line 78 of file qcpxic.h.

Referenced by addXicP(), and setRtRangeChanged().

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

- pappsomspp/gui/xicwidget/qcpxic.h
- pappsomspp/gui/xicwidget/qcpxic.cpp