Changeset 8127 in ntrip for trunk/BNC/qwt/qwt_symbol.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_symbol.h

    r4271 r8127  
    1212
    1313#include "qwt_global.h"
    14 #include <QPolygonF>
     14#include <qpolygon.h>
    1515
    1616class QPainter;
     
    2121class QColor;
    2222class QPointF;
     23class QPolygonF;
     24class QPainterPath;
     25class QPixmap;
     26class QByteArray;
     27class QwtGraphic;
    2328
    2429//! A class for drawing symbols
     
    8186
    8287        /*!
     88          The symbol is represented by a painter path, where the
     89          origin ( 0, 0 ) of the path coordinate system is mapped to
     90          the position of the symbol.
     91
     92          \sa setPath(), path()
     93         */
     94        Path,
     95
     96        /*!
     97          The symbol is represented by a pixmap. The pixmap is centered
     98          or aligned to its pin point.
     99
     100          \sa setPinPoint()
     101         */
     102        Pixmap,
     103
     104        /*!
     105          The symbol is represented by a graphic. The graphic is centered
     106          or aligned to its pin point.
     107
     108          \sa setPinPoint()
     109         */
     110        Graphic,
     111
     112        /*!
     113          The symbol is represented by a SVG graphic. The graphic is centered
     114          or aligned to its pin point.
     115
     116          \sa setPinPoint()
     117         */
     118        SvgDocument,
     119
     120        /*!
    83121         Styles >= QwtSymbol::UserSymbol are reserved for derived
    84122         classes of QwtSymbol that overload drawSymbols() with
     
    88126    };
    89127
     128    /*!
     129      Depending on the render engine and the complexity of the
     130      symbol shape it might be faster to render the symbol
     131      to a pixmap and to paint this pixmap.
     132
     133      F.e. the raster paint engine is a pure software renderer
     134      where in cache mode a draw operation usually ends in
     135      raster operation with the the backing store, that are usually
     136      faster, than the algorithms for rendering polygons.
     137      But the opposite can be expected for graphic pipelines
     138      that can make use of hardware acceleration.
     139
     140      The default setting is AutoCache
     141
     142      \sa setCachePolicy(), cachePolicy()
     143
     144      \note The policy has no effect, when the symbol is painted
     145            to a vector graphics format ( PDF, SVG ).
     146      \warning Since Qt 4.8 raster is the default backend on X11
     147     */
     148
     149    enum CachePolicy
     150    {
     151        //! Don't use a pixmap cache
     152        NoCache,
     153
     154        //! Always use a pixmap cache
     155        Cache,
     156
     157        /*!
     158           Use a cache when one of the following conditions is true:
     159
     160           - The symbol is rendered with the software
     161             renderer ( QPaintEngine::Raster )
     162         */
     163        AutoCache
     164    };
     165
    90166public:
    91167    QwtSymbol( Style = NoSymbol );
    92168    QwtSymbol( Style, const QBrush &, const QPen &, const QSize & );
    93     QwtSymbol( const QwtSymbol & );
     169    QwtSymbol( const QPainterPath &, const QBrush &, const QPen & );
     170
    94171    virtual ~QwtSymbol();
    95172
    96     QwtSymbol &operator=( const QwtSymbol & );
    97     bool operator==( const QwtSymbol & ) const;
    98     bool operator!=( const QwtSymbol & ) const;
     173    void setCachePolicy( CachePolicy );
     174    CachePolicy cachePolicy() const;
    99175
    100176    void setSize( const QSize & );
     
    102178    const QSize& size() const;
    103179
     180    void setPinPoint( const QPointF &pos, bool enable = true );
     181    QPointF pinPoint() const;
     182
     183    void setPinPointEnabled( bool );
     184    bool isPinPointEnabled() const;
     185
    104186    virtual void setColor( const QColor & );
    105187
     
    107189    const QBrush& brush() const;
    108190
     191    void setPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
    109192    void setPen( const QPen & );
    110193    const QPen& pen() const;
     
    113196    Style style() const;
    114197
     198    void setPath( const QPainterPath & );
     199    const QPainterPath &path() const;
     200
     201    void setPixmap( const QPixmap & );
     202    const QPixmap &pixmap() const;
     203
     204    void setGraphic( const QwtGraphic & );
     205    const QwtGraphic &graphic() const;
     206
     207#ifndef QWT_NO_SVG
     208    void setSvgDocument( const QByteArray & );
     209#endif
     210
     211    void drawSymbol( QPainter *, const QRectF & ) const;
    115212    void drawSymbol( QPainter *, const QPointF & ) const;
    116213    void drawSymbols( QPainter *, const QPolygonF & ) const;
    117 
    118     virtual QSize boundingSize() const;
     214    void drawSymbols( QPainter *,
     215        const QPointF *, int numPoints ) const;
     216
     217    virtual QRect boundingRect() const;
     218    void invalidateCache();
    119219
    120220protected:
    121     virtual void drawSymbols( QPainter *,
     221    virtual void renderSymbols( QPainter *,
    122222        const QPointF *, int numPoints ) const;
    123223
    124224private:
     225    // Disabled copy constructor and operator=
     226    QwtSymbol( const QwtSymbol & );
     227    QwtSymbol &operator=( const QwtSymbol & );
     228
    125229    class PrivateData;
    126230    PrivateData *d_data;
Note: See TracChangeset for help on using the changeset viewer.