Changeset 8127 in ntrip for trunk/BNC/qwt/qwt_scale_engine.h


Ignore:
Timestamp:
May 10, 2017, 3:20:54 PM (7 years ago)
Author:
stoecker
Message:

update qwt and qwtpolar, many QT5 fixes (unfinished)

File:
1 edited

Legend:

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

    r4271 r8127  
    1515#include "qwt_interval.h"
    1616
    17 class QwtScaleTransformation;
     17class QwtTransform;
    1818
    1919/*!
     
    2828    static double divideEps( double interval, double steps );
    2929
    30     static double ceil125( double x );
    31     static double floor125( double x );
     30    static double divideInterval( double interval,
     31        int numSteps, uint base );
    3232};
    3333
     
    4040  The layout of the scale can be varied with setAttribute().
    4141
    42   Qwt offers implementations for logarithmic (log10)
    43   and linear scales. Contributions for other types of scale engines
    44   (date/time, log2 ... ) are welcome.
     42  Qwt offers implementations for logarithmic and linear scales.
    4543*/
    4644
     
    8179    typedef QFlags<Attribute> Attributes;
    8280
    83     explicit QwtScaleEngine();
     81    explicit QwtScaleEngine( uint base = 10 );
    8482    virtual ~QwtScaleEngine();
     83
     84    void setBase( uint base );
     85    uint base() const;
    8586
    8687    void setAttribute( Attribute, bool on = true );
     
    113114      \param x1 First interval limit
    114115      \param x2 Second interval limit
    115       \param maxMajSteps Maximum for the number of major steps
    116       \param maxMinSteps Maximum number of minor steps
     116      \param maxMajorSteps Maximum for the number of major steps
     117      \param maxMinorSteps Maximum number of minor steps
    117118      \param stepSize Step size. If stepSize == 0.0, the scaleEngine
    118119                   calculates one.
     120
     121      \return Calculated scale division
    119122    */
    120123    virtual QwtScaleDiv divideScale( double x1, double x2,
    121         int maxMajSteps, int maxMinSteps,
     124        int maxMajorSteps, int maxMinorSteps,
    122125        double stepSize = 0.0 ) const = 0;
    123126
    124     //! \return a transformation
    125     virtual QwtScaleTransformation *transformation() const = 0;
     127    void setTransformation( QwtTransform * );
     128    QwtTransform *transformation() const;
    126129
    127130protected:
    128131    bool contains( const QwtInterval &, double val ) const;
    129132    QList<double> strip( const QList<double>&, const QwtInterval & ) const;
     133
    130134    double divideInterval( double interval, int numSteps ) const;
    131135
     
    147151{
    148152public:
     153    QwtLinearScaleEngine( uint base = 10 );
     154    virtual ~QwtLinearScaleEngine();
     155
    149156    virtual void autoScale( int maxSteps,
    150157        double &x1, double &x2, double &stepSize ) const;
     
    154161                                     double stepSize = 0.0 ) const;
    155162
    156     virtual QwtScaleTransformation *transformation() const;
    157163
    158164protected:
     
    166172        const QwtInterval &interval, double stepSize ) const;
    167173
    168     void buildMinorTicks(
    169         const QList<double>& majorTicks,
    170         int maxMinMark, double step,
    171         QList<double> &, QList<double> & ) const;
    172 };
    173 
    174 /*!
    175   \brief A scale engine for logarithmic (base 10) scales
     174    void buildMinorTicks( const QList<double>& majorTicks,
     175        int maxMinorSteps, double stepSize,
     176        QList<double> &minorTicks, QList<double> &mediumTicks ) const;
     177};
     178
     179/*!
     180  \brief A scale engine for logarithmic scales
    176181
    177182  The step size is measured in *decades*
     
    183188*/
    184189
    185 class QWT_EXPORT QwtLog10ScaleEngine: public QwtScaleEngine
    186 {
    187 public:
     190class QWT_EXPORT QwtLogScaleEngine: public QwtScaleEngine
     191{
     192public:
     193    QwtLogScaleEngine( uint base = 10 );
     194    virtual ~QwtLogScaleEngine();
     195
    188196    virtual void autoScale( int maxSteps,
    189197        double &x1, double &x2, double &stepSize ) const;
     
    193201        double stepSize = 0.0 ) const;
    194202
    195     virtual QwtScaleTransformation *transformation() const;
    196 
    197203protected:
    198     QwtInterval log10( const QwtInterval& ) const;
    199     QwtInterval pow10( const QwtInterval& ) const;
    200 
    201204    QwtInterval align( const QwtInterval&, double stepSize ) const;
    202205
     
    208211        const QwtInterval &interval, double stepSize ) const;
    209212
    210     QList<double> buildMinorTicks(
    211         const QList<double>& majorTicks,
    212         int maxMinMark, double step ) const;
     213    void buildMinorTicks( const QList<double>& majorTicks,
     214        int maxMinorSteps, double stepSize,
     215        QList<double> &minorTicks, QList<double> &mediumTicks ) const;
    213216};
    214217
Note: See TracChangeset for help on using the changeset viewer.