author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Mon, 04 Oct 2010 01:19:32 +0300 | |
changeset 37 | 758a864f9613 |
parent 18 | 2f34d5167611 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtGui module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#ifndef QPOLYGON_H |
|
43 |
#define QPOLYGON_H |
|
44 |
||
45 |
#include <QtCore/qvector.h> |
|
46 |
#include <QtCore/qpoint.h> |
|
47 |
#include <QtCore/qrect.h> |
|
48 |
||
49 |
QT_BEGIN_HEADER |
|
50 |
||
51 |
QT_BEGIN_NAMESPACE |
|
52 |
||
53 |
QT_MODULE(Gui) |
|
54 |
||
55 |
class QMatrix; |
|
56 |
class QTransform; |
|
57 |
class QRect; |
|
58 |
class QVariant; |
|
59 |
||
60 |
class Q_GUI_EXPORT QPolygon : public QVector<QPoint> |
|
61 |
{ |
|
62 |
public: |
|
63 |
inline QPolygon() {} |
|
64 |
inline ~QPolygon() {} |
|
65 |
inline QPolygon(int size); |
|
66 |
inline QPolygon(const QPolygon &a) : QVector<QPoint>(a) {} |
|
67 |
inline QPolygon(const QVector<QPoint> &v) : QVector<QPoint>(v) {} |
|
68 |
QPolygon(const QRect &r, bool closed=false); |
|
69 |
QPolygon(int nPoints, const int *points); |
|
70 |
operator QVariant() const; |
|
71 |
||
72 |
void translate(int dx, int dy); |
|
73 |
void translate(const QPoint &offset); |
|
74 |
||
75 |
QPolygon translated(int dx, int dy) const; |
|
76 |
inline QPolygon translated(const QPoint &offset) const; |
|
77 |
||
78 |
QRect boundingRect() const; |
|
79 |
||
80 |
void point(int i, int *x, int *y) const; |
|
81 |
QPoint point(int i) const; |
|
82 |
void setPoint(int index, int x, int y); |
|
83 |
void setPoint(int index, const QPoint &p); |
|
84 |
void setPoints(int nPoints, const int *points); |
|
85 |
void setPoints(int nPoints, int firstx, int firsty, ...); |
|
86 |
void putPoints(int index, int nPoints, const int *points); |
|
87 |
void putPoints(int index, int nPoints, int firstx, int firsty, ...); |
|
88 |
void putPoints(int index, int nPoints, const QPolygon & from, int fromIndex=0); |
|
89 |
||
90 |
bool containsPoint(const QPoint &pt, Qt::FillRule fillRule) const; |
|
91 |
||
92 |
QPolygon united(const QPolygon &r) const; |
|
93 |
QPolygon intersected(const QPolygon &r) const; |
|
94 |
QPolygon subtracted(const QPolygon &r) const; |
|
95 |
}; |
|
96 |
||
97 |
inline QPolygon::QPolygon(int asize) : QVector<QPoint>(asize) {} |
|
98 |
||
99 |
#ifndef QT_NO_DEBUG_STREAM |
|
100 |
Q_GUI_EXPORT QDebug operator<<(QDebug, const QPolygon &); |
|
101 |
#endif |
|
102 |
||
103 |
/***************************************************************************** |
|
104 |
QPolygon stream functions |
|
105 |
*****************************************************************************/ |
|
106 |
#ifndef QT_NO_DATASTREAM |
|
107 |
Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QPolygon &polygon); |
|
108 |
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QPolygon &polygon); |
|
109 |
#endif |
|
110 |
||
111 |
/***************************************************************************** |
|
112 |
Misc. QPolygon functions |
|
113 |
*****************************************************************************/ |
|
114 |
||
115 |
inline void QPolygon::setPoint(int index, const QPoint &pt) |
|
116 |
{ (*this)[index] = pt; } |
|
117 |
||
118 |
inline void QPolygon::setPoint(int index, int x, int y) |
|
119 |
{ (*this)[index] = QPoint(x, y); } |
|
120 |
||
121 |
inline QPoint QPolygon::point(int index) const |
|
122 |
{ return at(index); } |
|
123 |
||
124 |
inline void QPolygon::translate(const QPoint &offset) |
|
125 |
{ translate(offset.x(), offset.y()); } |
|
126 |
||
127 |
inline QPolygon QPolygon::translated(const QPoint &offset) const |
|
128 |
{ return translated(offset.x(), offset.y()); } |
|
129 |
||
130 |
class QRectF; |
|
131 |
||
132 |
class Q_GUI_EXPORT QPolygonF : public QVector<QPointF> |
|
133 |
{ |
|
134 |
public: |
|
135 |
inline QPolygonF() {} |
|
136 |
inline ~QPolygonF() {} |
|
137 |
inline QPolygonF(int size); |
|
138 |
inline QPolygonF(const QPolygonF &a) : QVector<QPointF>(a) {} |
|
139 |
inline QPolygonF(const QVector<QPointF> &v) : QVector<QPointF>(v) {} |
|
140 |
QPolygonF(const QRectF &r); |
|
141 |
QPolygonF(const QPolygon &a); |
|
142 |
||
143 |
inline void translate(qreal dx, qreal dy); |
|
144 |
void translate(const QPointF &offset); |
|
145 |
||
146 |
inline QPolygonF translated(qreal dx, qreal dy) const; |
|
147 |
QPolygonF translated(const QPointF &offset) const; |
|
148 |
||
149 |
QPolygon toPolygon() const; |
|
150 |
||
151 |
bool isClosed() const { return !isEmpty() && first() == last(); } |
|
152 |
||
153 |
QRectF boundingRect() const; |
|
154 |
||
155 |
bool containsPoint(const QPointF &pt, Qt::FillRule fillRule) const; |
|
156 |
||
157 |
QPolygonF united(const QPolygonF &r) const; |
|
158 |
QPolygonF intersected(const QPolygonF &r) const; |
|
159 |
QPolygonF subtracted(const QPolygonF &r) const; |
|
160 |
}; |
|
161 |
||
162 |
inline QPolygonF::QPolygonF(int asize) : QVector<QPointF>(asize) {} |
|
163 |
||
164 |
#ifndef QT_NO_DEBUG_STREAM |
|
165 |
Q_GUI_EXPORT QDebug operator<<(QDebug, const QPolygonF &); |
|
166 |
#endif |
|
167 |
||
168 |
/***************************************************************************** |
|
169 |
QPolygonF stream functions |
|
170 |
*****************************************************************************/ |
|
171 |
#ifndef QT_NO_DATASTREAM |
|
172 |
Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QPolygonF &array); |
|
173 |
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QPolygonF &array); |
|
174 |
#endif |
|
175 |
||
176 |
inline void QPolygonF::translate(qreal dx, qreal dy) |
|
177 |
{ translate(QPointF(dx, dy)); } |
|
178 |
||
179 |
inline QPolygonF QPolygonF::translated(qreal dx, qreal dy) const |
|
180 |
{ return translated(QPointF(dx, dy)); } |
|
181 |
||
182 |
QT_END_NAMESPACE |
|
183 |
||
184 |
QT_END_HEADER |
|
185 |
||
186 |
#endif // QPOLYGON_H |