QXRD  0.11.16
Public Member Functions | Private Member Functions | List of all members
QxrdPlotVectorFieldCurve Class Reference

#include <qxrdplotvectorfieldcurve.h>

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

Public Member Functions

 QxrdPlotVectorFieldCurve ()
 
void setSamples (QxrdPlotVectorFieldData *data)
 
void drawSeries (QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const
 
QRectF boundingRect () const
 
QRectF dataRect () const
 

Private Member Functions

void init ()
 

Detailed Description

Definition at line 7 of file qxrdplotvectorfieldcurve.h.

Constructor & Destructor Documentation

QxrdPlotVectorFieldCurve::QxrdPlotVectorFieldCurve ( )

Definition at line 5 of file qxrdplotvectorfieldcurve.cpp.

References init().

Here is the call graph for this function:

Member Function Documentation

QRectF QxrdPlotVectorFieldCurve::boundingRect ( ) const

Definition at line 63 of file qxrdplotvectorfieldcurve.cpp.

64 {
65  const QwtSeriesData<QxrdPoint4D> *series = data();
66 
67  if (series) {
68  return series->boundingRect();
69  } else {
70  return QRectF();
71  }
72 }
QRectF QxrdPlotVectorFieldCurve::dataRect ( ) const

Definition at line 74 of file qxrdplotvectorfieldcurve.cpp.

75 {
76  const QwtSeriesData<QxrdPoint4D> *series = data();
77 
78  if (series) {
79  return series->boundingRect();
80  } else {
81  return QRectF();
82  }
83 }
void QxrdPlotVectorFieldCurve::drawSeries ( QPainter *  painter,
const QwtScaleMap &  xMap,
const QwtScaleMap &  yMap,
const QRectF &  canvasRect,
int  from,
int  to 
) const

Definition at line 16 of file qxrdplotvectorfieldcurve.cpp.

References QxrdPoint4D::t(), QxrdPoint4D::x(), QxrdPoint4D::y(), and QxrdPoint4D::z().

21 {
22  if (to < 0) {
23  to = dataSize() - 1;
24  }
25 
26  if (from < 0) {
27  from = 0;
28  }
29 
30  if (from > to) {
31  return;
32  }
33 
34  painter->save();
35 
36  const QwtSeriesData<QxrdPoint4D> *series = data();
37 
38  for (int i=from; i<=to; i++) {
39  const QxrdPoint4D sample = series->sample(i);
40 
41  double x0 = xMap.transform(sample.x());
42  double y0 = yMap.transform(sample.y());
43  double x1 = xMap.transform(sample.x()+sample.z()*50.0);
44  double y1 = yMap.transform(sample.y()+sample.t()*50.0);
45 
46  double th = atan2(y1-y0, x1-x0);
47  double thp = th+0.2;
48  double thm = th-0.2;
49  double xp = x1 - 5.0*cos(thp);
50  double yp = y1 - 5.0*sin(thp);
51 
52  double xm = x1 - 5.0*cos(thm);
53  double ym = y1 - 5.0*sin(thm);
54 
55  QwtPainter::drawLine(painter, x0, y0, x1, y1);
56  QwtPainter::drawLine(painter, x1, y1, xp, yp);
57  QwtPainter::drawLine(painter, x1, y1, xm, ym);
58  }
59 
60  painter->restore();
61 }
double t() const
Definition: qxrdpoint4d.h:67
double y() const
Definition: qxrdpoint4d.h:57
double x() const
Definition: qxrdpoint4d.h:52
double z() const
Definition: qxrdpoint4d.h:62

Here is the call graph for this function:

void QxrdPlotVectorFieldCurve::init ( )
private

Definition at line 85 of file qxrdplotvectorfieldcurve.cpp.

Referenced by QxrdPlotVectorFieldCurve().

86 {
87  setItemAttribute( QwtPlotItem::AutoScale, true );
88  setItemAttribute( QwtPlotItem::Legend, false );
89 }

Here is the caller graph for this function:

void QxrdPlotVectorFieldCurve::setSamples ( QxrdPlotVectorFieldData data)

Definition at line 10 of file qxrdplotvectorfieldcurve.cpp.

11 {
12  setData(data);
13 }

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