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

#include <qxrdintegratorplot.h>

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

Public Slots

void onNewIntegrationAvailable (QcepIntegratedDataPtr data)
 
void clearGraph ()
 
void clearSelectedCurves ()
 
- 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

 QxrdIntegratorPlot (QWidget *parent=0)
 
void init (QcepPlotSettingsWPtr settings)
 
void setDataProcessor (QxrdDataProcessorWPtr proc)
 
- 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

QxrdDataProcessorWPtr m_DataProcessor
 
QxrdIntegratorWPtr m_Integrator
 
int m_PlotIndex
 
QString m_XUnitsLabel
 

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 11 of file qxrdintegratorplot.h.

Constructor & Destructor Documentation

QxrdIntegratorPlot::QxrdIntegratorPlot ( QWidget *  parent = 0)

Definition at line 20 of file qxrdintegratorplot.cpp.

21  : QcepPlot(parent),
23  m_Integrator(),
24  m_PlotIndex(0),
25  m_XUnitsLabel("")
26 {
27  qRegisterMetaType< QVector<double> >("QVector<double>");
28 
29 
30 }
QxrdIntegratorWPtr m_Integrator
QcepPlot(QWidget *parent=0)
Definition: qcepplot.cpp:18
QxrdDataProcessorWPtr m_DataProcessor

Member Function Documentation

void QxrdIntegratorPlot::clearGraph ( )
slot

Definition at line 117 of file qxrdintegratorplot.cpp.

References m_PlotIndex.

Referenced by QxrdWindow::initialize().

118 {
119  m_PlotIndex = 0;
120 
121  detachItems(QwtPlotItem::Rtti_PlotCurve);
122  detachItems(QwtPlotItem::Rtti_PlotMarker);
123 
124  replot();
125 }

Here is the caller graph for this function:

void QxrdIntegratorPlot::clearSelectedCurves ( )
slot

Definition at line 127 of file qxrdintegratorplot.cpp.

References QcepPlot::m_Legend.

Referenced by QxrdWindow::initialize().

128 {
129  QList<QwtPlotCurve*> toDelete;
130 
131  foreach(QwtPlotItem* item, itemList()) {
132  QwtPlotCurve *pc = dynamic_cast<QwtPlotCurve*>(item);
133  if (pc) {
134  QWidget *wid = m_Legend->legendWidget(itemToInfo(pc));
135 
136  if (wid) {
137  QwtLegendLabel *itm = qobject_cast<QwtLegendLabel*>(wid);
138 
139  if (itm) {
140  if (itm->isChecked()) {
141  toDelete.append(pc);
142  }
143  }
144  }
145  }
146  }
147 
148  foreach(QwtPlotCurve *curve, toDelete) {
149  if (curve) {
150  curve->detach();
151 
152  delete curve;
153  }
154  }
155 
156  replot();
157 }
QwtLegend * m_Legend
Definition: qcepplot.h:58

Here is the caller graph for this function:

void QxrdIntegratorPlot::init ( QcepPlotSettingsWPtr  settings)

Definition at line 32 of file qxrdintegratorplot.cpp.

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

33 {
34  QcepPlot::init(settings);
35 
36  if (m_Legend) {
37  insertLegend(m_Legend, QwtPlot::BottomLegend);
38  }
39 }
QwtLegend * m_Legend
Definition: qcepplot.h:58
void init(QcepPlotSettingsWPtr settings)
Definition: qcepplot.cpp:36

Here is the call graph for this function:

void QxrdIntegratorPlot::onNewIntegrationAvailable ( QcepIntegratedDataPtr  data)
slot

Definition at line 55 of file qxrdintegratorplot.cpp.

References m_DataProcessor, QcepPlot::m_Legend, m_PlotIndex, m_XUnitsLabel, QcepPlot::setPlotCurveStyle(), and QcepPlot::updateZoomer().

Referenced by QxrdWindow::initialize().

56 {
57 
58 // printf("New integration available, %d, %d points\n", x.size(), y.size());
59 
60  if (m_PlotIndex < 40) {
61  QTime tic;
62  tic.start();
63 
64  QString units = data->get_XUnitsLabel();
65 
66  if (m_PlotIndex == 0) {
67  m_XUnitsLabel = units;
68  } else if (units != m_XUnitsLabel) {
69  m_XUnitsLabel = "";
70  }
71 
72  setAxisTitle(QwtPlot::xBottom, m_XUnitsLabel);
73 
74  QcepDoubleImageDataPtr img(data->get_Image());
75 
76  QString title = (img ? img -> get_Title() : data -> get_Title());
77  QString tooltip;
78 
79  if (data->get_Oversample() > 1) {
80  tooltip = tr("%1\nPlotted vs %2\n%3 x oversampled")
81  .arg(title)
82  .arg(units)
83  .arg(data->get_Oversample());
84  } else {
85  tooltip = tr("%1\nPlotted vs %2\nNo oversampling")
86  .arg(title)
87  .arg(units);
88  }
89 
90  QwtPlotCurve *pc = new QwtPlotPiecewiseCurve(this, title/*tr("Plot %1").arg(m_PlotIndex)*/);
91  pc -> setSamples(data->x(), data->y(), data->size());
93  pc -> attach(this);
94  pc -> setLegendAttribute(QwtPlotCurve::LegendShowSymbol, true);
95  pc -> setLegendAttribute(QwtPlotCurve::LegendShowLine, true);
96 
97  updateZoomer();
98 
100 
101  if (proc) {
102  proc -> updateEstimatedTime(proc -> prop_DisplayIntegratedDataTime(), tic.restart());
103  }
104 
105  QWidget *legend = m_Legend->legendWidget(itemToInfo(pc));
106 
107  if (legend) {
108  legend->setToolTip(tooltip);
109  }
110  }
111 
112  m_PlotIndex++;
113 //
114 // printf("Plotting took %d msec\n", tic.restart());
115 }
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
void setPlotCurveStyle(int index, QwtPlotCurve *curve)
Definition: qcepplot.cpp:103
QwtLegend * m_Legend
Definition: qcepplot.h:58
A class which draws piecewise curves.
void updateZoomer()
Definition: qcepplot.cpp:252
QxrdDataProcessorWPtr m_DataProcessor
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdIntegratorPlot::setDataProcessor ( QxrdDataProcessorWPtr  proc)

Definition at line 41 of file qxrdintegratorplot.cpp.

References m_DataProcessor, m_Integrator, QcepPlot::m_Measurer, and QxrdDataProcessorBase::printMeasuredPolygon().

42 {
43  m_DataProcessor = proc;
44 
46 
47  if (dp) {
48  m_Integrator = dp -> integrator();
49 
50  connect(m_Measurer, (void (QcepPlotMeasurer::*)( const QVector<QPointF> &)) &QwtPlotPicker::selected,
52  }
53 }
QxrdIntegratorWPtr m_Integrator
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
void printMeasuredPolygon(QVector< QPointF > poly)
QcepPlotMeasurerPtr m_Measurer
Definition: qcepplot.h:62
QxrdDataProcessorWPtr m_DataProcessor

Here is the call graph for this function:

Member Data Documentation

QxrdDataProcessorWPtr QxrdIntegratorPlot::m_DataProcessor
private

Definition at line 27 of file qxrdintegratorplot.h.

Referenced by onNewIntegrationAvailable(), and setDataProcessor().

QxrdIntegratorWPtr QxrdIntegratorPlot::m_Integrator
private

Definition at line 28 of file qxrdintegratorplot.h.

Referenced by setDataProcessor().

int QxrdIntegratorPlot::m_PlotIndex
private

Definition at line 29 of file qxrdintegratorplot.h.

Referenced by clearGraph(), and onNewIntegrationAvailable().

QString QxrdIntegratorPlot::m_XUnitsLabel
private

Definition at line 30 of file qxrdintegratorplot.h.

Referenced by onNewIntegrationAvailable().


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