00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef QPOLYGON_H
00025 #define QPOLYGON_H
00026
00027 #include <QtCore/qvector.h>
00028 #include <QtCore/qpoint.h>
00029 #include <QtCore/qrect.h>
00030
00031 QT_BEGIN_HEADER
00032
00033 QT_MODULE(Gui)
00034
00035 class QMatrix;
00036 class QRect;
00037 class QVariant;
00038
00039 class Q_GUI_EXPORT QPolygon : public QVector<QPoint>
00040 {
00041 public:
00042 inline QPolygon() {}
00043 inline ~QPolygon() {}
00044 inline QPolygon(int size);
00045 inline QPolygon(const QPolygon &a) : QVector<QPoint>(a) {}
00046 inline QPolygon(const QVector<QPoint> &v) : QVector<QPoint>(v) {}
00047 QPolygon(const QRect &r, bool closed=false);
00048 QPolygon(int nPoints, const int *points);
00049 operator QVariant() const;
00050
00051 void translate(int dx, int dy);
00052 void translate(const QPoint &offset);
00053 QRect boundingRect() const;
00054
00055 void point(int i, int *x, int *y) const;
00056 QPoint point(int i) const;
00057 void setPoint(int index, int x, int y);
00058 void setPoint(int index, const QPoint &p);
00059 void setPoints(int nPoints, const int *points);
00060 void setPoints(int nPoints, int firstx, int firsty, ...);
00061 void putPoints(int index, int nPoints, const int *points);
00062 void putPoints(int index, int nPoints, int firstx, int firsty, ...);
00063 void putPoints(int index, int nPoints, const QPolygon & from, int fromIndex=0);
00064 };
00065
00066 inline QPolygon::QPolygon(int asize) : QVector<QPoint>(asize) {}
00067
00068 #ifndef QT_NO_DEBUG_STREAM
00069 Q_GUI_EXPORT QDebug operator<<(QDebug, const QPolygon &);
00070 #endif
00071
00072
00073
00074
00075
00076 inline void QPolygon::setPoint(int index, const QPoint &pt)
00077 { (*this)[index] = pt; }
00078
00079 inline void QPolygon::setPoint(int index, int x, int y)
00080 { (*this)[index] = QPoint(x, y); }
00081
00082 inline QPoint QPolygon::point(int index) const
00083 { return at(index); }
00084
00085 inline void QPolygon::translate(const QPoint &offset)
00086 { translate(offset.x(), offset.y()); }
00087
00088 class QRectF;
00089
00090 class Q_GUI_EXPORT QPolygonF : public QVector<QPointF>
00091 {
00092 public:
00093 inline QPolygonF() {}
00094 inline ~QPolygonF() {}
00095 inline QPolygonF(int size);
00096 inline QPolygonF(const QPolygonF &a) : QVector<QPointF>(a) {}
00097 inline QPolygonF(const QVector<QPointF> &v) : QVector<QPointF>(v) {}
00098 QPolygonF(const QRectF &r);
00099 QPolygonF(const QPolygon &a);
00100
00101 inline void translate(qreal dx, qreal dy);
00102 void translate(const QPointF &offset);
00103
00104 QPolygon toPolygon() const;
00105
00106 bool isClosed() const { return !isEmpty() && first() == last(); }
00107
00108 QRectF boundingRect() const;
00109 };
00110
00111 inline QPolygonF::QPolygonF(int asize) : QVector<QPointF>(asize) {}
00112
00113 #ifndef QT_NO_DEBUG_STREAM
00114 Q_GUI_EXPORT QDebug operator<<(QDebug, const QPolygonF &);
00115 #endif
00116
00117
00118
00119
00120 #ifndef QT_NO_DATASTREAM
00121 Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QPolygonF &array);
00122 Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QPolygonF &array);
00123 #endif
00124
00125 inline void QPolygonF::translate(qreal dx, qreal dy)
00126 { translate(QPointF(dx, dy)); }
00127
00128 QT_END_HEADER
00129
00130 #endif // QPOLYGON_H