Qwt Polar User's Guide 1.0.0

qwt_polar_item.h

00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
00002  * QwtPolar Widget Library
00003  * Copyright (C) 2008   Uwe Rathmann
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the Qwt License, Version 1.0
00007  *****************************************************************************/
00008 
00009 #ifndef QWT_POLAR_ITEM_H
00010 #define QWT_POLAR_ITEM_H
00011 
00012 #include "qwt_polar_global.h"
00013 #include <qwt_text.h>
00014 #include <qwt_legend_itemmanager.h>
00015 #include <qwt_interval.h>
00016 
00017 class QString;
00018 class QRect;
00019 class QPointF;
00020 class QPainter;
00021 class QwtPolarPlot;
00022 class QwtScaleMap;
00023 class QwtScaleDiv;
00024 
00036 class QWT_POLAR_EXPORT QwtPolarItem: public QwtLegendItemManager
00037 {
00038 public:
00045     enum RttiValues
00046     {
00048         Rtti_PolarItem = 0,
00049 
00051         Rtti_PolarGrid,
00052 
00054         Rtti_PolarMarker,
00055 
00057         Rtti_PolarCurve,
00058 
00060         Rtti_PolarSpectrogram,
00061 
00066         Rtti_PolarUserItem = 1000
00067     };
00068 
00073     enum ItemAttribute
00074     {
00076         Legend    = 0x01,
00077 
00082         AutoScale = 0x02
00083     };
00084 
00086     typedef QFlags<ItemAttribute> ItemAttributes;
00087 
00092     enum RenderHint
00093     {
00095         RenderAntialiased = 0x01
00096     };
00097 
00099     typedef QFlags<RenderHint> RenderHints;
00100 
00101     explicit QwtPolarItem( const QwtText &title = QwtText() );
00102     virtual ~QwtPolarItem();
00103 
00104     void attach( QwtPolarPlot *plot );
00105 
00113     void detach() { attach( NULL ); }
00114 
00115     QwtPolarPlot *plot() const;
00116 
00117     void setTitle( const QString &title );
00118     void setTitle( const QwtText &title );
00119     const QwtText &title() const;
00120 
00121     virtual int rtti() const;
00122 
00123     void setItemAttribute( ItemAttribute, bool on = true );
00124     bool testItemAttribute( ItemAttribute ) const;
00125 
00126     void setRenderHint( RenderHint, bool on = true );
00127     bool testRenderHint( RenderHint ) const;
00128 
00129     double z() const;
00130     void setZ( double z );
00131 
00132     void show();
00133     void hide();
00134     virtual void setVisible( bool );
00135     bool isVisible () const;
00136 
00137     virtual void itemChanged();
00138 
00149     virtual void draw( QPainter *painter,
00150         const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap,
00151         const QPointF &pole, double radius,
00152         const QRectF &canvasRect ) const = 0;
00153 
00154     virtual QwtInterval boundingInterval( int scaleId ) const;
00155 
00156     virtual QWidget *legendItem() const;
00157 
00158     virtual void updateLegend( QwtLegend * ) const;
00159     virtual void updateScaleDiv( const QwtScaleDiv &,
00160         const QwtScaleDiv &, const QwtInterval & );
00161 
00162     virtual int marginHint() const;
00163 
00164 private:
00165     // Disabled copy constructor and operator=
00166     QwtPolarItem( const QwtPolarItem & );
00167     QwtPolarItem &operator=( const QwtPolarItem & );
00168 
00169     class PrivateData;
00170     PrivateData *d_data;
00171 };
00172 
00173 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPolarItem::ItemAttributes )
00174 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPolarItem::RenderHints )
00175 
00176 #endif