Changeset 9383 in ntrip for trunk/BNC/qwt/qwt_series_data.h


Ignore:
Timestamp:
Mar 19, 2021, 9:15:03 AM (3 years ago)
Author:
stoecker
Message:

update to qwt verion 6.1.1 to fix build with newer Qt5

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/qwt/qwt_series_data.h

    r8127 r9383  
    2626   to implement an individual data access.
    2727
    28    A subclass of QwtSeriesData<QPointF> must implement: 
    29 
    30    - size()\n 
     28   A subclass of QwtSeriesData<QPointF> must implement:
     29
     30   - size()\n
    3131     Should return number of data points.
    3232
     
    3535     as QPointF object.
    3636
    37    - boundingRect()\n 
     37   - boundingRect()\n
    3838     Should return the bounding rectangle of the data series.
    3939     It is used for autoscaling and might help certain algorithms for displaying
    4040     the data. You can use qwtBoundingRect() for an implementation
    41      but often it is possible to implement a more efficient algorithm 
     41     but often it is possible to implement a more efficient algorithm
    4242     depending on the characteristics of the series.
    4343     The member d_boundingRect is intended for caching the calculated rectangle.
    44    
     44
    4545*/
    4646template <typename T>
     
    5353    //! Destructor
    5454    virtual ~QwtSeriesData();
     55
     56#ifndef QWT_PYTHON_WRAPPER
    5557
    5658    //! \return Number of samples
     
    7880    virtual QRectF boundingRect() const = 0;
    7981
     82#else
     83    // Needed for generating the python bindings, but not for using them !
     84    virtual size_t size() const { return 0; }
     85    virtual T sample( size_t i ) const { return T(); }
     86    virtual QRectF boundingRect() const { return d_boundingRect; }
     87#endif
     88
    8089    /*!
    8190       Set a the "rect of interest"
     
    8695
    8796       The default implementation does nothing.
    88    
     97
    8998       \param rect Rectangle of interest
    9099    */
     
    275284    The following example shows finds a point of curve from an x
    276285    coordinate
    277 
    278   \verbatim
    279 #include <qwt_series_data.h>
    280 #include <qwt_plot_curve.h>
    281 
    282 struct compareX
    283 {
    284     inline bool operator()( const double x, const QPointF &pos ) const
    285     {
    286         return ( x < pos.x() );
    287     }
    288 };
    289 
    290 QLineF curveLineAt( const QwtPlotCurve *curve, double x )
    291 {
    292     int index = qwtUpperSampleIndex<QPointF>(
    293         *curve->data(), x, compareX() );
    294            
    295     if ( index == -1 &&
    296         x == curve->sample( curve->dataSize() - 1 ).x() )
    297     {   
    298         // the last sample is excluded from qwtUpperSampleIndex
    299         index = curve->dataSize() - 1;
    300     }
    301 
    302     QLineF line; // invalid
    303     if ( index > 0 )
    304     {
    305         line.setP1( curve->sample( index - 1 ) );
    306         line.setP2( curve->sample( index ) );
    307     }
    308 
    309     return line;
    310 }
    311 
    312 \endverbatim
    313 
    314 
    315     \param series Series of samples
    316     \param value Value
    317     \param lessThan Compare operation
    318 
    319     \note The samples must be sorted according to the order specified
    320           by the lessThan object
    321 
    322 of the range [begin, end) and returns the position of the one-past-the-last occurrence of value. If no such item is found, returns the position where the item should be inserted.
     286    \code
     287      #include <qwt_series_data.h>
     288      #include <qwt_plot_curve.h>
     289
     290      struct compareX
     291      {
     292          inline bool operator()( const double x, const QPointF &pos ) const
     293          {
     294              return ( x < pos.x() );
     295          }
     296      };
     297
     298      QLineF curveLineAt( const QwtPlotCurve *curve, double x )
     299      {
     300          int index = qwtUpperSampleIndex<QPointF>(
     301              *curve->data(), x, compareX() );
     302
     303          if ( index == -1 &&
     304              x == curve->sample( curve->dataSize() - 1 ).x() )
     305          {
     306              // the last sample is excluded from qwtUpperSampleIndex
     307              index = curve->dataSize() - 1;
     308          }
     309
     310          QLineF line; // invalid
     311          if ( index > 0 )
     312          {
     313              line.setP1( curve->sample( index - 1 ) );
     314              line.setP2( curve->sample( index ) );
     315          }
     316
     317          return line;
     318      }
     319
     320    \endcode
     321  \endpar
     322
     323  \param series Series of samples
     324  \param value Value
     325  \param lessThan Compare operation
     326
     327  \note The samples must be sorted according to the order specified
     328        by the lessThan object
    323329 */
    324330template <typename T, typename LessThan>
    325331inline int qwtUpperSampleIndex( const QwtSeriesData<T> &series,
    326     double value, LessThan lessThan  ) 
     332    double value, LessThan lessThan  )
    327333{
    328334    const int indexMax = series.size() - 1;
Note: See TracChangeset for help on using the changeset viewer.