78
|
1 |
Geometric subclass: #Circle
|
|
2 |
instanceVariableNames: 'center radius'
|
|
3 |
classVariableNames: ''
|
|
4 |
poolDictionaries: ''
|
|
5 |
category: 'Graphics-Geometry'
|
|
6 |
!
|
|
7 |
|
|
8 |
!Circle class methodsFor: 'documentation'!
|
|
9 |
|
|
10 |
copyright
|
|
11 |
"
|
|
12 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
|
13 |
All Rights Reserved
|
|
14 |
|
|
15 |
This software is furnished under a license and may be used
|
|
16 |
only in accordance with the terms of that license and with the
|
|
17 |
inclusion of the above copyright notice. This software may not
|
|
18 |
be provided or otherwise made available to, or used by, any
|
|
19 |
other person. No title to or ownership of the software is
|
|
20 |
hereby transferred.
|
|
21 |
"
|
|
22 |
!
|
|
23 |
|
|
24 |
version
|
|
25 |
"
|
|
26 |
$Header: /cvs/stx/stx/libbasic2/Circle.st,v 1.1 1995-06-06 04:01:34 claus Exp $
|
|
27 |
"
|
|
28 |
!
|
|
29 |
|
|
30 |
documentation
|
|
31 |
"
|
|
32 |
This class implements a circles which are defined by a radius and
|
|
33 |
a centerpoint.
|
|
34 |
"
|
|
35 |
! !
|
|
36 |
|
|
37 |
!Circle class methodsFor:'instance creation'!
|
|
38 |
|
|
39 |
center:centerPoint radius:radius
|
|
40 |
"Return a new Circle."
|
|
41 |
|
|
42 |
| aCircle |
|
|
43 |
|
|
44 |
^ self new center:centerPoint radius:radius
|
|
45 |
! !
|
|
46 |
|
|
47 |
!Circle methodsFor:'converting'!
|
|
48 |
|
|
49 |
asEllipticalArc
|
|
50 |
^ EllipticalArc center:center radius:radius
|
|
51 |
! !
|
|
52 |
|
|
53 |
!Circle methodsFor:'displaying'!
|
|
54 |
|
|
55 |
displayStrokedOn:aGC
|
|
56 |
aGC displayArcX:boundingBox left
|
|
57 |
y:boundingBox top
|
|
58 |
width:boundingBox width
|
|
59 |
height:boundingBox height
|
|
60 |
from:0
|
|
61 |
to:360
|
|
62 |
!
|
|
63 |
|
|
64 |
displayFilledOn:aGC
|
|
65 |
aGC fillArcX:boundingBox left
|
|
66 |
y:boundingBox top
|
|
67 |
width:boundingBox width
|
|
68 |
height:boundingBox height
|
|
69 |
from:0
|
|
70 |
to:360
|
|
71 |
! !
|
|
72 |
|
|
73 |
!Circle methodsFor:'accessing'!
|
|
74 |
|
|
75 |
center:centerPoint radius:radiusNumber
|
|
76 |
"set the center and radius"
|
|
77 |
|
|
78 |
center := centerPoint.
|
|
79 |
radius := radiusNumber
|
|
80 |
!
|
|
81 |
|
|
82 |
center
|
|
83 |
"return the center."
|
|
84 |
|
|
85 |
^ center
|
|
86 |
!
|
|
87 |
|
|
88 |
radius
|
|
89 |
"return the radius."
|
|
90 |
|
|
91 |
^ radius
|
|
92 |
!
|
|
93 |
|
|
94 |
startAngle
|
|
95 |
"return the startAngle.
|
|
96 |
For circles, this is arbitrary; for compatibility with arcs."
|
|
97 |
|
|
98 |
^ 0
|
|
99 |
!
|
|
100 |
|
|
101 |
sweepAngle
|
|
102 |
"return the sweepAngle.
|
|
103 |
For circles, this is always 360 degrees; for compatibility with arcs."
|
|
104 |
|
|
105 |
^ 360
|
|
106 |
! !
|
|
107 |
|
|
108 |
|