annotate d2/qt/core/QLine.d @ 372:a032df77b6ab

Simple debug helper. Unittests. Meta-object for polymorphic non-QObjects
author Max Samukha <maxter@spambox.com>
date Thu, 08 Jul 2010 17:19:05 +0300
parents 96a75b1e5b26
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
1 module qt.core.QLine;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
2
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
3 public import qt.QGlobal;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
4 public import qt.core.Qt;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
5 public import qt.core.QPoint;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
6 public import qt.core.QDataStream;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
7
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
8
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
9 public struct QLine
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
10 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
11 public static QLine opCall() {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
12 QLine ln;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
13 ln.pt1 = QPoint();
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
14 ln.pt2 = QPoint();
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
15 return ln;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
16 }
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
17
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
18 public this(QPoint pt1_, QPoint pt2_) {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
19 pt1 = pt1_;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
20 pt2 = pt2_;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
21 }
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
22
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
23 public this(int x1pos, int y1pos, int x2pos, int y2pos) {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
24 pt1 = QPoint(x1pos, y1pos);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
25 pt2 = QPoint(x2pos, y2pos);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
26 }
254
maxter
parents: 252
diff changeset
27
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
28 bool isNull() // const
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
29 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
30 return pt1 == pt2;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
31 }
254
maxter
parents: 252
diff changeset
32
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
33 int x1() // const
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
34 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
35 return pt1.x();
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
36 }
254
maxter
parents: 252
diff changeset
37
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
38 int y1() // const
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
39 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
40 return pt1.y();
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
41 }
254
maxter
parents: 252
diff changeset
42
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
43 int x2() // const
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
44 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
45 return pt2.x();
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
46 }
254
maxter
parents: 252
diff changeset
47
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
48 int y2() // const
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
49 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
50 return pt2.y();
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
51 }
254
maxter
parents: 252
diff changeset
52
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
53 QPoint p1() // const
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
54 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
55 return pt1;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
56 }
254
maxter
parents: 252
diff changeset
57
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
58 QPoint p2() // const
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
59 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
60 return pt2;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
61 }
254
maxter
parents: 252
diff changeset
62
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
63 int dx() // const
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
64 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
65 return pt2.x() - pt1.x();
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
66 }
254
maxter
parents: 252
diff changeset
67
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
68 int dy() // const
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
69 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
70 return pt2.y() - pt1.y();
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
71 }
254
maxter
parents: 252
diff changeset
72
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
73 void translate(ref QPoint point)
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
74 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
75 pt1 += point;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
76 pt2 += point;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
77 }
254
maxter
parents: 252
diff changeset
78
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
79 void translate(int adx, int ady)
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
80 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
81 translate(QPoint(adx, ady));
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
82 }
254
maxter
parents: 252
diff changeset
83
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
84 QLine translated(ref QPoint p) // const
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
85 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
86 return QLine(pt1 + p, pt2 + p);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
87 }
254
maxter
parents: 252
diff changeset
88
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
89 QLine translated(int adx, int ady) // const
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
90 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
91 return translated(QPoint(adx, ady));
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
92 }
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
93
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
94 void p1(ref QPoint aP1)
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
95 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
96 pt1 = aP1;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
97 }
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
98
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
99 void p2(ref QPoint aP2)
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
100 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
101 pt2 = aP2;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
102 }
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
103
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
104 void setP1(ref QPoint aP1) // for convenience
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
105 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
106 pt1 = aP1;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
107 }
254
maxter
parents: 252
diff changeset
108
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
109 void setP2(ref QPoint aP2) // for convenience
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
110 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
111 pt2 = aP2;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
112 }
254
maxter
parents: 252
diff changeset
113
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
114 void setPoints(ref QPoint aP1, ref QPoint aP2)
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
115 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
116 pt1 = aP1;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
117 pt2 = aP2;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
118 }
254
maxter
parents: 252
diff changeset
119
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
120 void setLine(int aX1, int aY1, int aX2, int aY2)
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
121 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
122 pt1 = QPoint(aX1, aY1);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
123 pt2 = QPoint(aX2, aY2);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
124 }
254
maxter
parents: 252
diff changeset
125
325
b460cd08041f dmd 2.037 opEquals bug-feature
eldar1@eldar1-laptop
parents: 295
diff changeset
126 bool opEquals(ref const QLine d) const
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
127 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
128 return pt1 == d.pt1 && pt2 == d.pt2;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
129 }
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
130
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
131 public final void writeTo(QDataStream arg__1) {
372
a032df77b6ab Simple debug helper. Unittests. Meta-object for polymorphic non-QObjects
Max Samukha <maxter@spambox.com>
parents: 344
diff changeset
132 qtd_QLine_writeTo_QDataStream(&this, arg__1 is null ? null : arg__1.qtdNativeId);
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
133 }
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
134
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
135 public final void readFrom(QDataStream arg__1) {
372
a032df77b6ab Simple debug helper. Unittests. Meta-object for polymorphic non-QObjects
Max Samukha <maxter@spambox.com>
parents: 344
diff changeset
136 qtd_QLine_readFrom_QDataStream(&this, arg__1 is null ? null : arg__1.qtdNativeId);
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
137 }
372
a032df77b6ab Simple debug helper. Unittests. Meta-object for polymorphic non-QObjects
Max Samukha <maxter@spambox.com>
parents: 344
diff changeset
138
295
463563fc9e17 more of QList. const functions in C++ are now const in D too. Drop of the store result feature, which was incompatible with const functions and introduced too much of the bloat in the generator.
eldar
parents: 254
diff changeset
139 // service stuff
463563fc9e17 more of QList. const functions in C++ are now const in D too. Drop of the store result feature, which was incompatible with const functions and introduced too much of the bloat in the generator.
eldar
parents: 254
diff changeset
140 public alias void __isNativeValueType;
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
141
295
463563fc9e17 more of QList. const functions in C++ are now const in D too. Drop of the store result feature, which was incompatible with const functions and introduced too much of the bloat in the generator.
eldar
parents: 254
diff changeset
142 struct QTypeInfo
463563fc9e17 more of QList. const functions in C++ are now const in D too. Drop of the store result feature, which was incompatible with const functions and introduced too much of the bloat in the generator.
eldar
parents: 254
diff changeset
143 {
463563fc9e17 more of QList. const functions in C++ are now const in D too. Drop of the store result feature, which was incompatible with const functions and introduced too much of the bloat in the generator.
eldar
parents: 254
diff changeset
144 enum bool isComplex = true;
463563fc9e17 more of QList. const functions in C++ are now const in D too. Drop of the store result feature, which was incompatible with const functions and introduced too much of the bloat in the generator.
eldar
parents: 254
diff changeset
145 enum bool isStatic = false;
463563fc9e17 more of QList. const functions in C++ are now const in D too. Drop of the store result feature, which was incompatible with const functions and introduced too much of the bloat in the generator.
eldar
parents: 254
diff changeset
146 enum bool isLarge = true;
463563fc9e17 more of QList. const functions in C++ are now const in D too. Drop of the store result feature, which was incompatible with const functions and introduced too much of the bloat in the generator.
eldar
parents: 254
diff changeset
147 enum bool isPointer = false;
463563fc9e17 more of QList. const functions in C++ are now const in D too. Drop of the store result feature, which was incompatible with const functions and introduced too much of the bloat in the generator.
eldar
parents: 254
diff changeset
148 enum bool isDummy = false;
463563fc9e17 more of QList. const functions in C++ are now const in D too. Drop of the store result feature, which was incompatible with const functions and introduced too much of the bloat in the generator.
eldar
parents: 254
diff changeset
149 }
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
150 private:
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
151 QPoint pt1, pt2;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
152 }
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
153
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
154
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
155 public enum QLineF_IntersectType {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
156 NoIntersection = 0,
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
157 BoundedIntersection = 1,
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
158 UnboundedIntersection = 2
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
159 }
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
160
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
161 public struct QLineF
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
162 {
254
maxter
parents: 252
diff changeset
163
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
164 alias QLineF_IntersectType IntersectType;
254
maxter
parents: 252
diff changeset
165
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
166 alias QLineF_IntersectType.NoIntersection NoIntersection;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
167 alias QLineF_IntersectType.BoundedIntersection BoundedIntersection;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
168 alias QLineF_IntersectType.UnboundedIntersection UnboundedIntersection;
254
maxter
parents: 252
diff changeset
169
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
170 public static QLineF opCall() {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
171 QLineF ln;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
172 ln.pt1 = QPointF();
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
173 ln.pt2 = QPointF();
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
174 return ln;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
175 }
254
maxter
parents: 252
diff changeset
176
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
177 public this(QPointF apt1, QPointF apt2) {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
178 pt1 = apt1;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
179 pt2 = apt2;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
180 }
254
maxter
parents: 252
diff changeset
181
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
182 public this(qreal x1pos, qreal y1pos, qreal x2pos, qreal y2pos) {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
183 pt1 = QPointF(x1pos, y1pos);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
184 pt2 = QPointF(x2pos, y2pos);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
185 }
254
maxter
parents: 252
diff changeset
186
maxter
parents: 252
diff changeset
187 public this(QLine line){
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
188 pt1 = QPointF(line.p1());
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
189 pt2 = QPointF(line.p2());
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
190 }
254
maxter
parents: 252
diff changeset
191
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
192 public final bool isNull() // const
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
193 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
194 return qtd_QLineF_isNull(&this);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
195 }
254
maxter
parents: 252
diff changeset
196
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
197 qreal x1() // const
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
198 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
199 return pt1.x();
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
200 }
254
maxter
parents: 252
diff changeset
201
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
202 qreal y1() // const
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
203 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
204 return pt1.y();
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
205 }
254
maxter
parents: 252
diff changeset
206
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
207 qreal x2() // const
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
208 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
209 return pt2.x();
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
210 }
254
maxter
parents: 252
diff changeset
211
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
212 qreal y2() // const
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
213 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
214 return pt2.y();
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
215 }
254
maxter
parents: 252
diff changeset
216
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
217 QPointF p1() // const
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
218 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
219 return pt1;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
220 }
254
maxter
parents: 252
diff changeset
221
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
222 QPointF p2() // const
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
223 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
224 return pt2;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
225 }
254
maxter
parents: 252
diff changeset
226
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
227 qreal dx() // const
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
228 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
229 return pt2.x() - pt1.x();
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
230 }
254
maxter
parents: 252
diff changeset
231
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
232 qreal dy() // const
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
233 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
234 return pt2.y() - pt1.y();
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
235 }
254
maxter
parents: 252
diff changeset
236
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
237 QLineF normalVector() // const
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
238 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
239 return QLineF(p1(), p1() + QPointF(dy(), -dx()));
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
240 }
254
maxter
parents: 252
diff changeset
241
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
242 void translate(ref QPointF point)
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
243 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
244 pt1 += point;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
245 pt2 += point;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
246 }
254
maxter
parents: 252
diff changeset
247
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
248 void translate(qreal adx, qreal ady)
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
249 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
250 this.translate(QPointF(adx, ady));
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
251 }
254
maxter
parents: 252
diff changeset
252
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
253 QLineF translated(ref QPointF p) // const
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
254 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
255 return QLineF(pt1 + p, pt2 + p);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
256 }
254
maxter
parents: 252
diff changeset
257
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
258 QLineF translated(qreal adx, qreal ady) // const
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
259 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
260 return translated(QPointF(adx, ady));
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
261 }
254
maxter
parents: 252
diff changeset
262
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
263 void setLength(qreal len)
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
264 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
265 if (isNull())
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
266 return;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
267 QLineF v = unitVector();
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
268 pt2 = QPointF(pt1.x() + v.dx() * len, pt1.y() + v.dy() * len);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
269 }
254
maxter
parents: 252
diff changeset
270
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
271 void length(qreal len)
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
272 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
273 if (isNull())
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
274 return;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
275 QLineF v = unitVector();
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
276 pt2 = QPointF(pt1.x() + v.dx() * len, pt1.y() + v.dy() * len);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
277 }
254
maxter
parents: 252
diff changeset
278
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
279 QPointF pointAt(qreal t) // const
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
280 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
281 qreal vx = pt2.x() - pt1.x();
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
282 qreal vy = pt2.y() - pt1.y();
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
283 return QPointF(pt1.x() + vx * t, pt1.y() + vy * t);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
284 }
254
maxter
parents: 252
diff changeset
285
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
286 QLine toLine() // const
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
287 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
288 return QLine(pt1.toPoint(), pt2.toPoint());
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
289 }
254
maxter
parents: 252
diff changeset
290
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
291 void setP1(ref QPointF aP1)
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
292 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
293 pt1 = aP1;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
294 }
254
maxter
parents: 252
diff changeset
295
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
296 void setP2(ref QPointF aP2)
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
297 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
298 pt2 = aP2;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
299 }
254
maxter
parents: 252
diff changeset
300
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
301 void p1(ref QPointF aP1)
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
302 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
303 pt1 = aP1;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
304 }
254
maxter
parents: 252
diff changeset
305
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
306 void p2(ref QPointF aP2)
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
307 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
308 pt2 = aP2;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
309 }
254
maxter
parents: 252
diff changeset
310
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
311 void setPoints(ref QPointF aP1, ref QPointF aP2)
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
312 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
313 pt1 = aP1;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
314 pt2 = aP2;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
315 }
254
maxter
parents: 252
diff changeset
316
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
317 void setLine(qreal aX1, qreal aY1, qreal aX2, qreal aY2)
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
318 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
319 pt1 = QPointF(aX1, aY1);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
320 pt2 = QPointF(aX2, aY2);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
321 }
254
maxter
parents: 252
diff changeset
322
325
b460cd08041f dmd 2.037 opEquals bug-feature
eldar1@eldar1-laptop
parents: 295
diff changeset
323 bool opEquals(ref const QLineF d) const
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
324 {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
325 return pt1 == d.pt1 && pt2 == d.pt2;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
326 }
254
maxter
parents: 252
diff changeset
327
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
328 public final double angle() {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
329 return qtd_QLineF_angle(&this);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
330 }
254
maxter
parents: 252
diff changeset
331
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
332 public final double angle(ref QLineF l) {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
333 return qtd_QLineF_angle_QLineF(&this, &l);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
334 }
254
maxter
parents: 252
diff changeset
335
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
336 public final double angleTo(ref QLineF l) {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
337 return qtd_QLineF_angleTo_QLineF(&this, &l);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
338 }
254
maxter
parents: 252
diff changeset
339
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
340 // ### Qt 5: rename intersects() or intersection() and rename IntersectType IntersectionType
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
341 private final QLineF_IntersectType intersect(ref QLineF l, QPointF* intersectionPoint) {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
342 return cast(QLineF_IntersectType) qtd_QLineF_intersect_QLineF_nativepointerQPointF(&this, &l, intersectionPoint);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
343 }
254
maxter
parents: 252
diff changeset
344
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
345 public final double length() {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
346 return qtd_QLineF_length(&this);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
347 }
254
maxter
parents: 252
diff changeset
348
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
349 public final void writeTo(QDataStream arg__1) {
372
a032df77b6ab Simple debug helper. Unittests. Meta-object for polymorphic non-QObjects
Max Samukha <maxter@spambox.com>
parents: 344
diff changeset
350 qtd_QLineF_writeTo_QDataStream(&this, arg__1 is null ? null : arg__1.qtdNativeId);
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
351 }
254
maxter
parents: 252
diff changeset
352
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
353 public final void readFrom(QDataStream arg__1) {
372
a032df77b6ab Simple debug helper. Unittests. Meta-object for polymorphic non-QObjects
Max Samukha <maxter@spambox.com>
parents: 344
diff changeset
354 qtd_QLineF_readFrom_QDataStream(&this, arg__1 is null ? null : arg__1.qtdNativeId);
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
355 }
254
maxter
parents: 252
diff changeset
356
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
357 public final void setAngle(double angle) {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
358 qtd_QLineF_setAngle_double(&this, angle);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
359 }
254
maxter
parents: 252
diff changeset
360
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
361 public final QLineF unitVector() {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
362 return qtd_QLineF_unitVector(&this);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
363 }
254
maxter
parents: 252
diff changeset
364
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
365 public static QLineF fromPolar(double length, double angle) {
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
366 return qtd_QLineF_fromPolar_double_double(length, angle);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
367 }
254
maxter
parents: 252
diff changeset
368
295
463563fc9e17 more of QList. const functions in C++ are now const in D too. Drop of the store result feature, which was incompatible with const functions and introduced too much of the bloat in the generator.
eldar
parents: 254
diff changeset
369 // service stuff
463563fc9e17 more of QList. const functions in C++ are now const in D too. Drop of the store result feature, which was incompatible with const functions and introduced too much of the bloat in the generator.
eldar
parents: 254
diff changeset
370 public alias void __isNativeValueType;
463563fc9e17 more of QList. const functions in C++ are now const in D too. Drop of the store result feature, which was incompatible with const functions and introduced too much of the bloat in the generator.
eldar
parents: 254
diff changeset
371
463563fc9e17 more of QList. const functions in C++ are now const in D too. Drop of the store result feature, which was incompatible with const functions and introduced too much of the bloat in the generator.
eldar
parents: 254
diff changeset
372 struct QTypeInfo
463563fc9e17 more of QList. const functions in C++ are now const in D too. Drop of the store result feature, which was incompatible with const functions and introduced too much of the bloat in the generator.
eldar
parents: 254
diff changeset
373 {
463563fc9e17 more of QList. const functions in C++ are now const in D too. Drop of the store result feature, which was incompatible with const functions and introduced too much of the bloat in the generator.
eldar
parents: 254
diff changeset
374 enum bool isComplex = true;
463563fc9e17 more of QList. const functions in C++ are now const in D too. Drop of the store result feature, which was incompatible with const functions and introduced too much of the bloat in the generator.
eldar
parents: 254
diff changeset
375 enum bool isStatic = false;
463563fc9e17 more of QList. const functions in C++ are now const in D too. Drop of the store result feature, which was incompatible with const functions and introduced too much of the bloat in the generator.
eldar
parents: 254
diff changeset
376 enum bool isLarge = true;
463563fc9e17 more of QList. const functions in C++ are now const in D too. Drop of the store result feature, which was incompatible with const functions and introduced too much of the bloat in the generator.
eldar
parents: 254
diff changeset
377 enum bool isPointer = false;
463563fc9e17 more of QList. const functions in C++ are now const in D too. Drop of the store result feature, which was incompatible with const functions and introduced too much of the bloat in the generator.
eldar
parents: 254
diff changeset
378 enum bool isDummy = false;
463563fc9e17 more of QList. const functions in C++ are now const in D too. Drop of the store result feature, which was incompatible with const functions and introduced too much of the bloat in the generator.
eldar
parents: 254
diff changeset
379 }
463563fc9e17 more of QList. const functions in C++ are now const in D too. Drop of the store result feature, which was incompatible with const functions and introduced too much of the bloat in the generator.
eldar
parents: 254
diff changeset
380
188
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
381 private:
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
382 QPointF pt1, pt2;
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
383 }
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
384
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
385
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
386 // C wrappers
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
387 // QLine
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
388 private extern(C) void qtd_QLine_writeTo_QDataStream(void* __this_nativeId,
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
389 void* arg__1);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
390 private extern(C) void qtd_QLine_readFrom_QDataStream(void* __this_nativeId,
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
391 void* arg__1);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
392
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
393 // QLineF
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
394 private extern(C) bool qtd_QLineF_isNull(void* __this_nativeId);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
395 private extern(C) double qtd_QLineF_angle(void* __this_nativeId);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
396 private extern(C) double qtd_QLineF_angle_QLineF(void* __this_nativeId,
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
397 void* l0);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
398 private extern(C) double qtd_QLineF_angleTo_QLineF(void* __this_nativeId,
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
399 void* l0);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
400 private extern(C) int qtd_QLineF_intersect_QLineF_nativepointerQPointF(void* __this_nativeId,
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
401 void* l0,
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
402 void* intersectionPoint1);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
403 private extern(C) double qtd_QLineF_length(void* __this_nativeId);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
404 private extern(C) void qtd_QLineF_writeTo_QDataStream(void* __this_nativeId,
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
405 void* arg__1);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
406 private extern(C) void qtd_QLineF_readFrom_QDataStream(void* __this_nativeId,
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
407 void* arg__1);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
408 private extern(C) void qtd_QLineF_setAngle_double(void* __this_nativeId,
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
409 double angle0);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
410
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
411 private extern(C) QLineF qtd_QLineF_unitVector(void* __this_nativeId);
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
412 private extern(C) QLineF qtd_QLineF_fromPolar_double_double(double length0,
7dd099050621 initial commit for D2 support
eldar
parents:
diff changeset
413 double angle1);