QXRD  0.11.16
Public Slots | Public Member Functions | Private Attributes | List of all members
QxrdAcquisitionExtraInputsPlot Class Reference

#include <qxrdacquisitionextrainputsplot.h>

Inheritance diagram for QxrdAcquisitionExtraInputsPlot:
Inheritance graph
[legend]
Collaboration diagram for QxrdAcquisitionExtraInputsPlot:
Collaboration graph
[legend]

Public Slots

void setNChannels (int nch)
 
void plotChannel (int ch, int i0, int i1, QcepDoubleVector x, QcepDoubleVector y)
 
- Public Slots inherited from QcepPlot
virtual void autoScale ()
 
void printGraph ()
 
void zoomIn ()
 
void zoomOut ()
 
void enableZooming ()
 
void enableMeasuring ()
 
virtual void onLegendClicked (const QVariant &itemInfo, int index)
 
virtual void onLegendChecked (const QVariant &itemInfo, bool on, int index)
 
void setXAxisLog (bool isLog)
 
void setYAxisLog (bool isLog)
 
void setX2AxisLog (bool isLog)
 
void setY2AxisLog (bool isLog)
 
void setLogAxis (int axis, int isLog)
 
int logAxis (int axis)
 

Public Member Functions

 QxrdAcquisitionExtraInputsPlot (QWidget *parent=0)
 
void init (QcepPlotSettingsWPtr settings)
 
- Public Member Functions inherited from QcepPlot
 QcepPlot (QWidget *parent=0)
 
virtual ~QcepPlot ()
 
void init (QcepPlotSettingsWPtr settings)
 
void setPlotCurveStyle (int index, QwtPlotCurve *curve)
 
virtual QwtText trackerTextF (const QPointF &pos)
 
void contextMenuEvent (QContextMenuEvent *event)
 
void updateZoomer ()
 

Private Attributes

QVector< QwtPlotCurve * > m_RawData
 
QVector< QwtPlotCurve * > m_Selections
 
QVector< QColor > m_Colors
 

Additional Inherited Members

- Protected Attributes inherited from QcepPlot
QcepPlotSettingsWPtr m_PlotSettings
 
QwtLegend * m_Legend
 
QwtPlotZoomer * m_Zoomer
 
QwtPlotPanner * m_Panner
 
QwtPlotMagnifier * m_Magnifier
 
QcepPlotMeasurerPtr m_Measurer
 
int m_IsLog [QwtPlot::axisCnt]
 

Detailed Description

Definition at line 9 of file qxrdacquisitionextrainputsplot.h.

Constructor & Destructor Documentation

QxrdAcquisitionExtraInputsPlot::QxrdAcquisitionExtraInputsPlot ( QWidget *  parent = 0)
explicit

Definition at line 4 of file qxrdacquisitionextrainputsplot.cpp.

References m_Colors.

4  :
5  QcepPlot(parent)
6 {
7  m_Colors << Qt::black
8  << QColor(170,110,40)
9  << Qt::red
10  << QColor(255,180,60)
11  << Qt::yellow
12  << Qt::green
13  << Qt::blue
14  << Qt::magenta
15  << Qt::gray;
16 }
QcepPlot(QWidget *parent=0)
Definition: qcepplot.cpp:18

Member Function Documentation

void QxrdAcquisitionExtraInputsPlot::init ( QcepPlotSettingsWPtr  settings)

Definition at line 18 of file qxrdacquisitionextrainputsplot.cpp.

References QcepPlot::init(), and QcepPlot::m_Legend.

19 {
20  QcepPlot::init(settings);
21 
22  if (m_Legend) {
23  insertLegend(m_Legend, QwtPlot::BottomLegend);
24  }
25 }
QwtLegend * m_Legend
Definition: qcepplot.h:58
void init(QcepPlotSettingsWPtr settings)
Definition: qcepplot.cpp:36

Here is the call graph for this function:

void QxrdAcquisitionExtraInputsPlot::plotChannel ( int  ch,
int  i0,
int  i1,
QcepDoubleVector  x,
QcepDoubleVector  y 
)
slot

Definition at line 72 of file qxrdacquisitionextrainputsplot.cpp.

References m_RawData, and m_Selections.

73 {
74  QwtPlotCurve *pc = m_RawData.value(ch);
75 
76  if (pc) {
77  pc -> setSamples(x, y);
78  }
79 
80  QwtPlotCurve *pc2 = m_Selections.value(ch);
81 
82  if (pc2) {
83  pc2->setSamples(x.mid(i0, i1-i0), y.mid(i0, i1-i0));
84  }
85 }
void QxrdAcquisitionExtraInputsPlot::setNChannels ( int  nch)
slot

Definition at line 27 of file qxrdacquisitionextrainputsplot.cpp.

References m_Colors, m_RawData, and m_Selections.

28 {
29  if (m_RawData.count() > nch) {
30  for (int i=nch; i<m_RawData.count(); i++) {
31  m_RawData[i]->detach();
32  delete m_RawData[i];
33  }
34 
35  m_RawData.resize(nch);
36  } else if (m_RawData.count() < nch) {
37  for (int i=m_RawData.count(); i<nch; i++) {
38  QwtPlotCurve *pc = new QwtPlotCurve(tr("Chan %1").arg(i));
39  m_RawData.append(pc);
40 
41  pc->setPen(QPen(m_Colors[i % m_Colors.count()]));
42 
43  pc->attach(this);
44  }
45  }
46 
47  if (m_Selections.count() > nch) {
48  for (int i=nch; i<m_Selections.count(); i++) {
49  m_Selections[i]->detach();
50  delete m_Selections[i];
51  }
52 
53  m_Selections.resize(nch);
54  } else if (m_Selections.count() < nch) {
55  for (int i=m_Selections.count(); i<nch; i++) {
56  QwtPlotCurve *pc = new QwtPlotCurve(tr("Chan %1").arg(i));
57  m_Selections.append(pc);
58 
59  QPen pen(m_Colors[i % m_Colors.count()]);
60  QBrush brush(m_Colors[i % m_Colors.count()]);
61 
62  QwtSymbol *a = new QwtSymbol(QwtSymbol::Rect, brush, pen, QSize(3,3));
63 
64  pc->setStyle(QwtPlotCurve::NoCurve);
65  pc->setSymbol(a);
66 
67  pc->attach(this);
68  }
69  }
70 }

Member Data Documentation

QVector<QColor> QxrdAcquisitionExtraInputsPlot::m_Colors
private
QVector<QwtPlotCurve*> QxrdAcquisitionExtraInputsPlot::m_RawData
private

Definition at line 23 of file qxrdacquisitionextrainputsplot.h.

Referenced by plotChannel(), and setNChannels().

QVector<QwtPlotCurve*> QxrdAcquisitionExtraInputsPlot::m_Selections
private

Definition at line 24 of file qxrdacquisitionextrainputsplot.h.

Referenced by plotChannel(), and setNChannels().


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