QwtSyntheticPointData(3)

๐ŸŽ€ QwtSyntheticPointData(3) โ€” Library Functions Manual ๐ŸŽ€

okay bestie, welcome to the Library Functions Manual page for QwtSyntheticPointData(3) ๐Ÿ’… this is synthetic point data and itโ€™s lowkey iconic.

๐Ÿ’– NAME ๐Ÿ’–

QwtSyntheticPointData โ€” synthetic point data, periodt โœจ

๐ŸŒˆ SYNOPSIS ๐ŸŒˆ

#include <qwt_point_data.h>

Inherits QwtSeriesData< QPointF >.

๐Ÿซถ Public Member Functions

  • QwtSyntheticPointData (size_t size, const QwtInterval &=QwtInterval()) โ€” constructor vibes.
  • void setSize (size_t size) โ€” change the number of points.
  • virtual size_t size () const override โ€” get the number of points.
  • void setInterval (const QwtInterval &) โ€” set the bounding interval.
  • QwtInterval interval () const โ€” get the bounding interval.
  • virtual QRectF boundingRect () const override โ€” calculate the bounding rectangle.
  • virtual QPointF sample (size_t index) const override โ€” calculate the point from an index.
  • virtual double y (double x) const =0 โ€” calculate a y value for an x value.
  • virtual double x (uint index) const โ€” calculate an x-value from an index.
  • virtual void setRectOfInterest (const QRectF &) override โ€” set the โ€œrectangle of interestโ€.
  • QRectF rectOfInterest () const โ€” get the โ€œrectangle of interestโ€.

๐Ÿฆ‹ Public Member Functions inherited from QwtSeriesData< QPointF >

  • QwtSeriesData () โ€” Constructor.
  • virtual ~QwtSeriesData () โ€” Destructor.
  • QPointF firstSample () const โ€” first sample, bestie.
  • QPointF lastSample () const โ€” last sample, bestie.

๐ŸŒธ Additional Inherited Members

Protected Attributes inherited from QwtSeriesData< QPointF >

  • QRectF cachedBoundingRect โ€” can be used to cache a calculated bounding rectangle. slay for performance ๐Ÿ’…

โœจ Detailed Description โœจ

QwtSyntheticPointData provides a fixed number of points for an interval. The points are calculated in equidistant steps in x-direction.

If the interval is invalid, the points are calculated for the โ€œrectangle of interestโ€, what normally is the displayed area on the plot canvas. In this mode you get different levels of detail when zooming in/out โ€” literally the main character energy of plot data ๐Ÿซถ

๐Ÿงš Example

The following example shows how to implement a sinus curve.

#include <cmath>
#include <qwt_series_data.h>
#include <qwt_plot_curve.h>
#include <qwt_plot.h>
#include <qapplication.h>

  class SinusData: public QwtSyntheticPointData
  {
  public:
   SinusData():
       QwtSyntheticPointData( 100 )
   {
   }

   virtual double y( double x ) const
   {
       return qSin( x );
   }
  };

  int main(int argc, char **argv)
  {
   QApplication a( argc, argv );

   QwtPlot plot;
   plot.setAxisScale( QwtAxis::XBottom, 0.0, 10.0 );
   plot.setAxisScale( QwtAxis::YLeft, -1.0, 1.0 );

   QwtPlotCurve *curve = new QwtPlotCurve( "y = sin(x)" );
   curve->setData( new SinusData() );
   curve->attach( &plot );

   plot.show();
   return a.exec();
  }

Definition at line 157 of file qwt_point_data.h.

๐Ÿ› ๏ธ Constructor & Destructor Documentation ๐Ÿ› ๏ธ

QwtSyntheticPointData::QwtSyntheticPointData (size_t size, const QwtInterval & interval = QwtInterval())

Constructor. okay so hereโ€™s what you pass in:

  • size โ€” Number of points.
  • interval โ€” Bounding interval for the points.

See also setInterval(), setSize().

Definition at line 20 of file qwt_point_data.cpp.

๐Ÿ’œ Member Function Documentation ๐Ÿ’œ

QRectF QwtSyntheticPointData::boundingRect () const [override], [virtual]

Calculate the bounding rectangle. This implementation literally iterates over all points, what could often be implemented much faster using the characteristics of the series. When there are many points, it is recommended to overload and reimplement this method using the characteristics of the series (if possible) โ€” no cap, thatโ€™s the move.

Returns: Bounding rectangle.

Reimplemented from QwtSeriesData< QPointF >.

Definition at line 105 of file qwt_point_data.cpp.

QwtInterval QwtSyntheticPointData::interval () const

Returns: Bounding interval.

See also setInterval(), size().

Definition at line 62 of file qwt_point_data.cpp.

QRectF QwtSyntheticPointData::rectOfInterest () const

Returns: โ€œrectangle of interestโ€.

See also setRectOfInterest().

Definition at line 89 of file qwt_point_data.cpp.

QPointF QwtSyntheticPointData::sample (size_t index) const [override], [virtual]

Calculate the point from an index.

  • index โ€” Index.

Returns: QPointF(x(index), y(x(index)));

โš ๏ธ Warning: For invalid indices (index < 0 || index >= size()) (0, 0) is returned. so bestie, vibe-check your index first ๐Ÿ˜ญ

Implements QwtSeriesData< QPointF >.

Definition at line 125 of file qwt_point_data.cpp.

void QwtSyntheticPointData::setInterval (const QwtInterval & interval)

Set the bounding interval.

  • interval โ€” Interval.

See also interval(), setSize().

Definition at line 53 of file qwt_point_data.cpp.

void QwtSyntheticPointData::setRectOfInterest (const QRectF & rect) [override], [virtual]

Set the โ€œrectangle of interestโ€ โ€” yes, the original doc says โ€œSet a theโ€, and we keep the iconique typo energy ๐Ÿ˜ญ๐Ÿ’…

QwtPlotSeriesItem defines the current area of the plot canvas as โ€œrect of interestโ€ (QwtPlotSeriesItem::updateScaleDiv()).

If interval().isValid() == false, the x values are calculated in the interval rect.left() -> rect.right().

See also rectOfInterest().

Reimplemented from QwtSeriesData< QPointF >.

Definition at line 78 of file qwt_point_data.cpp.

void QwtSyntheticPointData::setSize (size_t size)

Change the number of points.

  • size โ€” Number of points.

See also size(), setInterval().

Definition at line 33 of file qwt_point_data.cpp.

size_t QwtSyntheticPointData::size () const [override], [virtual]

Returns: Number of points.

See also setSize(), interval().

Implements QwtSeriesData< QPointF >.

Definition at line 42 of file qwt_point_data.cpp.

double QwtSyntheticPointData::x (uint index) const [virtual]

Calculate an x-value from an index.

x values are calculated by dividing an interval into equidistant steps. If !interval().isValid(), the interval is calculated from the โ€œrectangle of interestโ€.

  • index โ€” Index of the requested point.

Returns: Calculated x coordinate.

See also interval(), rectOfInterest(), y().

Definition at line 148 of file qwt_point_data.cpp.

virtual double QwtSyntheticPointData::y (double x) const [pure virtual]

Calculate a y value for an x value.

  • x โ€” x value.

Returns: Corresponding y value.

๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Generated automatically by Doxygen for Qwt User's Guide from the source code.


mwah ๐Ÿ’– source/version sign-off: this page is from the Qwt User's Guide, page QwtSyntheticPointData(3), and the original footer has no date listed, so Iโ€™m not inventing one ๐ŸŽ€ bye bestie, go make those synthetic points look iconic โœจ

๐Ÿ“ฆ where this page comes from