Qwt User's Guide
svn
|
00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- ***************************** 00002 * Qwt Widget Library 00003 * Copyright (C) 1997 Josef Wilgen 00004 * Copyright (C) 2002 Uwe Rathmann 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the Qwt License, Version 1.0 00008 *****************************************************************************/ 00009 00011 #ifndef QWT_POINT_3D_H 00012 #define QWT_POINT_3D_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 00024 class QWT_EXPORT QwtPoint3D 00025 { 00026 public: 00027 QwtPoint3D(); 00028 QwtPoint3D( double x, double y, double z ); 00029 QwtPoint3D( const QwtPoint3D & ); 00030 QwtPoint3D( const QPointF & ); 00031 00032 bool isNull() const; 00033 00034 double x() const; 00035 double y() const; 00036 double z() const; 00037 00038 double &rx(); 00039 double &ry(); 00040 double &rz(); 00041 00042 void setX( double x ); 00043 void setY( double y ); 00044 void setZ( double y ); 00045 00046 QPointF toPoint() const; 00047 00048 bool operator==( const QwtPoint3D & ) const; 00049 bool operator!=( const QwtPoint3D & ) const; 00050 00051 private: 00052 double d_x; 00053 double d_y; 00054 double d_z; 00055 }; 00056 00057 Q_DECLARE_TYPEINFO(QwtPoint3D, Q_MOVABLE_TYPE); 00058 00059 #ifndef QT_NO_DEBUG_STREAM 00060 QWT_EXPORT QDebug operator<<( QDebug, const QwtPoint3D & ); 00061 #endif 00062 00067 inline QwtPoint3D::QwtPoint3D(): 00068 d_x( 0.0 ), 00069 d_y( 0.0 ), 00070 d_z( 0.0 ) 00071 { 00072 } 00073 00075 inline QwtPoint3D::QwtPoint3D( double x, double y, double z = 0.0 ): 00076 d_x( x ), 00077 d_y( y ), 00078 d_z( z ) 00079 { 00080 } 00081 00086 inline QwtPoint3D::QwtPoint3D( const QwtPoint3D &other ): 00087 d_x( other.d_x ), 00088 d_y( other.d_y ), 00089 d_z( other.d_z ) 00090 { 00091 } 00092 00097 inline QwtPoint3D::QwtPoint3D( const QPointF &other ): 00098 d_x( other.x() ), 00099 d_y( other.y() ), 00100 d_z( 0.0 ) 00101 { 00102 } 00103 00110 inline bool QwtPoint3D::isNull() const 00111 { 00112 return d_x == 0.0 && d_y == 0.0 && d_z == 0.0; 00113 } 00114 00116 inline double QwtPoint3D::x() const 00117 { 00118 return d_x; 00119 } 00120 00122 inline double QwtPoint3D::y() const 00123 { 00124 return d_y; 00125 } 00126 00128 inline double QwtPoint3D::z() const 00129 { 00130 return d_z; 00131 } 00132 00134 inline double &QwtPoint3D::rx() 00135 { 00136 return d_x; 00137 } 00138 00140 inline double &QwtPoint3D::ry() 00141 { 00142 return d_y; 00143 } 00144 00146 inline double &QwtPoint3D::rz() 00147 { 00148 return d_z; 00149 } 00150 00152 inline void QwtPoint3D::setX( double x ) 00153 { 00154 d_x = x; 00155 } 00156 00158 inline void QwtPoint3D::setY( double y ) 00159 { 00160 d_y = y; 00161 } 00162 00164 inline void QwtPoint3D::setZ( double z ) 00165 { 00166 d_z = z; 00167 } 00168 00172 inline QPointF QwtPoint3D::toPoint() const 00173 { 00174 return QPointF( d_x, d_y ); 00175 } 00176 00178 inline bool QwtPoint3D::operator==( const QwtPoint3D &other ) const 00179 { 00180 return ( d_x == other.d_x ) && ( d_y == other.d_y ) && ( d_z == other.d_z ); 00181 } 00182 00184 inline bool QwtPoint3D::operator!=( const QwtPoint3D &other ) const 00185 { 00186 return !operator==( other ); 00187 } 00188 00189 #endif