Go to the
documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef QPOLYGON_H
00043 #define QPOLYGON_H
00044
00045 #include <QtCore/qvector.h>
00046 #include <QtCore/qpoint.h>
00047 #include <QtCore/qrect.h>
00048
00049 QT_BEGIN_HEADER
00050
00051 QT_BEGIN_NAMESPACE
00052
00053 QT_MODULE(Gui)
00054
00055 class QMatrix;
00056 class QTransform;
00057 class QRect;
00058 class QVariant;
00059
00060 class Q_GUI_EXPORT QPolygon : public QVector<QPoint>
00061 {
00062 public:
00063 inline QPolygon() {}
00064 inline ~QPolygon() {}
00065 inline QPolygon(int size);
00066 inline QPolygon(const QPolygon &a) : QVector<QPoint>(a) {}
00067 inline QPolygon(const QVector<QPoint> &v) : QVector<QPoint>(v) {}
00068 QPolygon(const QRect &r, bool closed=false);
00069 QPolygon(int nPoints, const int *points);
00070 operator QVariant() const;
00071
00072 void translate(int dx, int dy);
00073 void translate(const QPoint &offset);
00074
00075 QPolygon translated(int dx, int dy) const;
00076 inline QPolygon translated(const QPoint &offset) const;
00077
00078 QRect boundingRect() const;
00079
00080 void point(int i, int *x, int *y) const;
00081 QPoint point(int i) const;
00082 void setPoint(int index, int x, int y);
00083 void setPoint(int index, const QPoint &p);
00084 void setPoints(int nPoints, const int *points);
00085 void setPoints(int nPoints, int firstx, int firsty, ...);
00086 void putPoints(int index, int nPoints, const int *points);
00087 void putPoints(int index, int nPoints, int firstx, int firsty, ...);
00088 void putPoints(int index, int nPoints, const QPolygon & from, int fromIndex=0);
00089
00090 bool containsPoint(const QPoint &pt, Qt::FillRule fillRule) const;
00091
00092 QPolygon united(const QPolygon &r) const;
00093 QPolygon intersected(const QPolygon &r) const;
00094 QPolygon subtracted(const QPolygon &r) const;
00095 };
00096
00097 inline QPolygon::QPolygon(int asize) : QVector<QPoint>(asize) {}
00098
00099 #ifndef QT_NO_DEBUG_STREAM
00100 Q_GUI_EXPORT QDebug operator<<(QDebug, const QPolygon &);
00101 #endif
00102
00103
00104
00105
00106 #ifndef QT_NO_DATASTREAM
00107 Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QPolygon &polygon);
00108 Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QPolygon &polygon);
00109 #endif
00110
00111
00112
00113
00114
00115 inline void QPolygon::setPoint(int index, const QPoint &pt)
00116 { (*this)[index] = pt; }
00117
00118 inline void QPolygon::setPoint(int index, int x, int y)
00119 { (*this)[index] = QPoint(x, y); }
00120
00121 inline QPoint QPolygon::point(int index) const
00122 { return at(index); }
00123
00124 inline void QPolygon::translate(const QPoint &offset)
00125 { translate(offset.x(), offset.y()); }
00126
00127 inline QPolygon QPolygon::translated(const QPoint &offset) const
00128 { return translated(offset.x(), offset.y()); }
00129
00130 class QRectF;
00131
00132 class Q_GUI_EXPORT QPolygonF : public QVector<QPointF>
00133 {
00134 public:
00135 inline QPolygonF() {}
00136 inline ~QPolygonF() {}
00137 inline QPolygonF(int size);
00138 inline QPolygonF(const QPolygonF &a) : QVector<QPointF>(a) {}
00139 inline QPolygonF(const QVector<QPointF> &v) : QVector<QPointF>(v) {}
00140 QPolygonF(const QRectF &r);
00141 QPolygonF(const QPolygon &a);
00142
00143 inline void translate(qreal dx, qreal dy);
00144 void translate(const QPointF &offset);
00145
00146 inline QPolygonF translated(qreal dx, qreal dy) const;
00147 QPolygonF translated(const QPointF &offset) const;
00148
00149 QPolygon toPolygon() const;
00150
00151 bool isClosed() const { return !isEmpty() && first() == last(); }
00152
00153 QRectF boundingRect() const;
00154
00155 bool containsPoint(const QPointF &pt, Qt::FillRule fillRule) const;
00156
00157 QPolygonF united(const QPolygonF &r) const;
00158 QPolygonF intersected(const QPolygonF &r) const;
00159 QPolygonF subtracted(const QPolygonF &r) const;
00160 };
00161
00162 inline QPolygonF::QPolygonF(int asize) : QVector<QPointF>(asize) {}
00163
00164 #ifndef QT_NO_DEBUG_STREAM
00165 Q_GUI_EXPORT QDebug operator<<(QDebug, const QPolygonF &);
00166 #endif
00167
00168
00169
00170
00171 #ifndef QT_NO_DATASTREAM
00172 Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QPolygonF &array);
00173 Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QPolygonF &array);
00174 #endif
00175
00176 inline void QPolygonF::translate(qreal dx, qreal dy)
00177 { translate(QPointF(dx, dy)); }
00178
00179 inline QPolygonF QPolygonF::translated(qreal dx, qreal dy) const
00180 { return translated(QPointF(dx, dy)); }
00181
00182 QT_END_NAMESPACE
00183
00184 QT_END_HEADER
00185
00186 #endif // QPOLYGON_H