qwt_compass_rose.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
  2. * Qwt Widget Library
  3. * Copyright (C) 1997 Josef Wilgen
  4. * Copyright (C) 2002 Uwe Rathmann
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the Qwt License, Version 1.0
  8. *****************************************************************************/
  9. #ifndef QWT_COMPASS_ROSE_H
  10. #define QWT_COMPASS_ROSE_H 1
  11. #include "qwt_global.h"
  12. #include <qpalette.h>
  13. class QPainter;
  14. /*!
  15. \brief Abstract base class for a compass rose
  16. */
  17. class QWT_EXPORT QwtCompassRose
  18. {
  19. public:
  20. //! Destructor
  21. virtual ~QwtCompassRose() {};
  22. //! Assign a palette
  23. virtual void setPalette( const QPalette &p )
  24. {
  25. d_palette = p;
  26. }
  27. //! \return Current palette
  28. const QPalette &palette() const
  29. {
  30. return d_palette;
  31. }
  32. /*!
  33. Draw the rose
  34. \param painter Painter
  35. \param center Center point
  36. \param radius Radius of the rose
  37. \param north Position
  38. \param colorGroup Color group
  39. */
  40. virtual void draw( QPainter *painter,
  41. const QPointF &center, double radius, double north,
  42. QPalette::ColorGroup colorGroup = QPalette::Active ) const = 0;
  43. private:
  44. QPalette d_palette;
  45. };
  46. /*!
  47. \brief A simple rose for QwtCompass
  48. */
  49. class QWT_EXPORT QwtSimpleCompassRose: public QwtCompassRose
  50. {
  51. public:
  52. QwtSimpleCompassRose( int numThorns = 8, int numThornLevels = -1 );
  53. virtual ~QwtSimpleCompassRose();
  54. void setWidth( double );
  55. double width() const;
  56. void setNumThorns( int );
  57. int numThorns() const;
  58. void setNumThornLevels( int );
  59. int numThornLevels() const;
  60. void setShrinkFactor( double factor );
  61. double shrinkFactor() const;
  62. virtual void draw( QPainter *, const QPointF &center, double radius,
  63. double north, QPalette::ColorGroup = QPalette::Active ) const;
  64. static void drawRose( QPainter *, const QPalette &,
  65. const QPointF &center, double radius, double north, double width,
  66. int numThorns, int numThornLevels, double shrinkFactor );
  67. private:
  68. class PrivateData;
  69. PrivateData *d_data;
  70. };
  71. #endif