|
1 " |
|
2 COPYRIGHT (c) 1995 by Claus Gittinger |
|
3 All Rights Reserved |
|
4 |
|
5 This software is furnished under a license and may be used |
|
6 only in accordance with the terms of that license and with the |
|
7 inclusion of the above copyright notice. This software may not |
|
8 be provided or otherwise made available to, or used by, any |
|
9 other person. No title to or ownership of the software is |
|
10 hereby transferred. |
|
11 " |
|
12 |
|
13 Geometric subclass: #EllipticalArc |
|
14 instanceVariableNames: 'boundingBox startAngle sweepAngle' |
|
15 classVariableNames: '' |
|
16 poolDictionaries: '' |
|
17 category: 'Graphics-Geometry' |
|
18 ! |
|
19 |
|
20 !EllipticalArc class methodsFor: 'documentation'! |
|
21 |
|
22 copyright |
|
23 " |
|
24 COPYRIGHT (c) 1995 by Claus Gittinger |
|
25 All Rights Reserved |
|
26 |
|
27 This software is furnished under a license and may be used |
|
28 only in accordance with the terms of that license and with the |
|
29 inclusion of the above copyright notice. This software may not |
|
30 be provided or otherwise made available to, or used by, any |
|
31 other person. No title to or ownership of the software is |
|
32 hereby transferred. |
|
33 " |
|
34 ! |
|
35 |
|
36 version |
|
37 " |
|
38 $Header: /cvs/stx/stx/libbasic2/EllipticalArc.st,v 1.1 1995-06-06 04:01:53 claus Exp $ |
|
39 " |
|
40 ! |
|
41 |
|
42 documentation |
|
43 " |
|
44 This class implements an ellipse which is aligned to x and y axes |
|
45 given a boundingBox, a startAngle and a sweepAngle. |
|
46 Positive angles are taken clockwise, negative angles are counterclockwise. |
|
47 " |
|
48 ! ! |
|
49 |
|
50 !EllipticalArc class methodsFor:'instance creation'! |
|
51 |
|
52 boundingBox:aRectangle |
|
53 "Return a new EllipticalArc." |
|
54 |
|
55 ^ self new boundingBox:aRectangle |
|
56 ! |
|
57 |
|
58 boundingBox:aRectangle startAngle:startAngle sweepAngle:sweepAngle |
|
59 "Return a new EllipticalArc." |
|
60 |
|
61 ^ self new boundingBox:aRectangle startAngle:startAngle sweepAngle:sweepAngle |
|
62 ! |
|
63 |
|
64 center:centerPoint radius:radius |
|
65 "Return a new Circle." |
|
66 |
|
67 ^ self new center:centerPoint radius:radius |
|
68 ! ! |
|
69 |
|
70 !EllipticalArc methodsFor:'converting'! |
|
71 |
|
72 asEllipticalArc |
|
73 ^ self |
|
74 ! ! |
|
75 |
|
76 !EllipticalArc methodsFor:'queries'! |
|
77 |
|
78 canBeFilled |
|
79 ^ true |
|
80 ! ! |
|
81 |
|
82 !EllipticalArc methodsFor:'displaying'! |
|
83 |
|
84 displayStrokedOn:aGC |
|
85 aGC displayArcX:boundingBox left |
|
86 y:boundingBox top |
|
87 width:boundingBox width |
|
88 height:boundingBox height |
|
89 from:startAngle |
|
90 to:(startAngle+sweepAngle) |
|
91 ! |
|
92 |
|
93 displayFilledOn:aGC |
|
94 aGC fillArcX:boundingBox left |
|
95 y:boundingBox top |
|
96 width:boundingBox width |
|
97 height:boundingBox height |
|
98 from:startAngle |
|
99 to:(startAngle+sweepAngle) |
|
100 ! ! |
|
101 |
|
102 !EllipticalArc methodsFor:'accessing'! |
|
103 |
|
104 boundingBox:aRectangle startAngle:start sweepAngle:sweep |
|
105 "set the center and radius" |
|
106 |
|
107 boundingBox := aRectangle. |
|
108 startAngle := start. |
|
109 sweepAngle := sweep |
|
110 ! |
|
111 |
|
112 boundingBox:aRectangle |
|
113 "set the center and radius" |
|
114 |
|
115 boundingBox := aRectangle. |
|
116 startAngle := 0. |
|
117 sweepAngle := 360 |
|
118 ! |
|
119 |
|
120 center:centerPoint radius:radiusNumber |
|
121 "set the center and radius" |
|
122 |
|
123 ^ self boundingBox:((center-r) asPoint corner:(center+r) asPoint). |
|
124 ! |
|
125 |
|
126 startAngle |
|
127 "return the startAngle." |
|
128 |
|
129 ^ startAngle |
|
130 ! |
|
131 |
|
132 sweepAngle |
|
133 "return the sweepAngle." |
|
134 |
|
135 ^ sweepAngle |
|
136 ! |
|
137 |
|
138 center |
|
139 ^ boundingBox center |
|
140 ! ! |
|
141 |
|
142 |
|
143 |