00001
00002
00003
00004
00005
00006
00007
00008
00009
00011 #ifndef _QWT_POINT_POLAR_H_
00012 #define _QWT_POINT_POLAR_H_ 1
00013
00014 #include "qwt_global.h"
00015 #include <qpoint.h>
00016 #ifndef QT_NO_DEBUG_STREAM
00017 #include <qdebug.h>
00018 #endif
00019
00027 class QWT_EXPORT QwtPointPolar
00028 {
00029 public:
00030 QwtPointPolar();
00031 QwtPointPolar( double azimuth, double radius );
00032 QwtPointPolar( const QwtPointPolar & );
00033 QwtPointPolar( const QPointF & );
00034
00035 void setPoint( const QPointF & );
00036 QPointF toPoint() const;
00037
00038 bool isValid() const;
00039 bool isNull() const;
00040
00041 double radius() const;
00042 double azimuth() const;
00043
00044 double &rRadius();
00045 double &rAzimuth();
00046
00047 void setRadius( double );
00048 void setAzimuth( double );
00049
00050 bool operator==( const QwtPointPolar & ) const;
00051 bool operator!=( const QwtPointPolar & ) const;
00052
00053 QwtPointPolar normalized() const;
00054
00055 private:
00056 double d_azimuth;
00057 double d_radius;
00058 };
00059
00064 inline QwtPointPolar::QwtPointPolar():
00065 d_azimuth( 0.0 ),
00066 d_radius( 0.0 )
00067 {
00068 }
00069
00076 inline QwtPointPolar::QwtPointPolar( double azimuth, double radius ):
00077 d_azimuth( azimuth ),
00078 d_radius( radius )
00079 {
00080 }
00081
00086 inline QwtPointPolar::QwtPointPolar( const QwtPointPolar &other ):
00087 d_azimuth( other.d_azimuth ),
00088 d_radius( other.d_radius )
00089 {
00090 }
00091
00093 inline bool QwtPointPolar::isValid() const
00094 {
00095 return d_radius >= 0.0;
00096 }
00097
00099 inline bool QwtPointPolar::isNull() const
00100 {
00101 return d_radius == 0.0;
00102 }
00103
00105 inline double QwtPointPolar::radius() const
00106 {
00107 return d_radius;
00108 }
00109
00111 inline double QwtPointPolar::azimuth() const
00112 {
00113 return d_azimuth;
00114 }
00115
00117 inline double &QwtPointPolar::rRadius()
00118 {
00119 return d_radius;
00120 }
00121
00123 inline double &QwtPointPolar::rAzimuth()
00124 {
00125 return d_azimuth;
00126 }
00127
00129 inline void QwtPointPolar::setRadius( double radius )
00130 {
00131 d_radius = radius;
00132 }
00133
00135 inline void QwtPointPolar::setAzimuth( double azimuth )
00136 {
00137 d_azimuth = azimuth;
00138 }
00139
00140 #ifndef QT_NO_DEBUG_STREAM
00141 QWT_EXPORT QDebug operator<<( QDebug, const QwtPointPolar & );
00142 #endif
00143
00144 #endif