EllipticalArc.st
author Claus Gittinger <cg@exept.de>
Thu, 06 Sep 2007 17:31:09 +0200
changeset 1894 8bf137acc445
parent 1303 6ca5f36cdc63
child 2157 b8368addde0d
permissions -rw-r--r--
if no unit is given in the readString, assume seconds.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
78
claus
parents:
diff changeset
     1
"
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
claus
parents:
diff changeset
     3
	      All Rights Reserved
claus
parents:
diff changeset
     4
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
claus
parents:
diff changeset
    10
 hereby transferred.
claus
parents:
diff changeset
    11
"
claus
parents:
diff changeset
    12
1303
6ca5f36cdc63 category
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
    13
"{ Package: 'stx:libbasic2' }"
6ca5f36cdc63 category
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
    14
275
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    15
Geometric subclass:#EllipticalArc
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    16
	instanceVariableNames:'boundingBox startAngle sweepAngle'
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    17
	classVariableNames:''
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    18
	poolDictionaries:''
1303
6ca5f36cdc63 category
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
    19
	category:'Graphics-Geometry-Objects'
78
claus
parents:
diff changeset
    20
!
claus
parents:
diff changeset
    21
275
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    22
!EllipticalArc class methodsFor:'documentation'!
78
claus
parents:
diff changeset
    23
claus
parents:
diff changeset
    24
copyright
claus
parents:
diff changeset
    25
"
claus
parents:
diff changeset
    26
 COPYRIGHT (c) 1995 by Claus Gittinger
claus
parents:
diff changeset
    27
	      All Rights Reserved
claus
parents:
diff changeset
    28
claus
parents:
diff changeset
    29
 This software is furnished under a license and may be used
claus
parents:
diff changeset
    30
 only in accordance with the terms of that license and with the
claus
parents:
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
claus
parents:
diff changeset
    32
 be provided or otherwise made available to, or used by, any
claus
parents:
diff changeset
    33
 other person.  No title to or ownership of the software is
claus
parents:
diff changeset
    34
 hereby transferred.
claus
parents:
diff changeset
    35
"
claus
parents:
diff changeset
    36
!
claus
parents:
diff changeset
    37
claus
parents:
diff changeset
    38
documentation
claus
parents:
diff changeset
    39
"
claus
parents:
diff changeset
    40
     This class implements an ellipse which is aligned to x and y axes
claus
parents:
diff changeset
    41
     given a boundingBox, a startAngle and a sweepAngle.
claus
parents:
diff changeset
    42
     Positive angles are taken clockwise, negative angles are counterclockwise.
281
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    43
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    44
    [author:]
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    45
        Claus Gittinger
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    46
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    47
    [see also:]
331
Claus Gittinger <cg@exept.de>
parents: 289
diff changeset
    48
        Circle Spline Curve LineSegment Polygon Rectangle Arrow
Claus Gittinger <cg@exept.de>
parents: 289
diff changeset
    49
        ArrowedSpline
281
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    50
        GraphicsContext
288
5d79dc613999 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 284
diff changeset
    51
        StrokingWrapper FillingWrapper
78
claus
parents:
diff changeset
    52
"
289
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    53
!
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    54
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    55
examples
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    56
"
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    57
  ellipses; filled & unfilled:
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    58
                                                                        [exBegin]
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    59
    |v e|
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    60
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    61
    v := (View extent:200@100) openAndWait.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    62
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    63
    e := EllipticalArc 
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    64
            boundingBox:(10@10 corner:190@90)
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    65
            startAngle:0
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    66
            endAngle:360. 
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    67
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    68
    v paint:Color blue.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    69
    e displayFilledOn:v.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    70
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    71
    v paint:Color red.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    72
    e displayStrokedOn:v.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    73
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    74
                                                                        [exEnd]
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    75
  elliptical arcs; filled & unfilled:
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    76
                                                                        [exBegin]
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    77
    |v e|
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    78
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    79
    v := (View extent:200@100) openAndWait.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    80
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    81
    e := EllipticalArc 
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    82
            boundingBox:(10@10 corner:190@90)
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    83
            startAngle:0
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    84
            endAngle:270. 
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    85
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    86
    v paint:Color blue.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    87
    e displayFilledOn:v.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    88
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    89
    v paint:Color red.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    90
    e displayStrokedOn:v.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    91
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    92
                                                                        [exEnd]
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    93
  more arcs; filled:
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    94
                                                                        [exBegin]
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    95
    |v ell|
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    96
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    97
    v := View new openAndWait.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    98
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    99
    ell := EllipticalArc
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   100
                boundingBox:(10@10 corner:90@90) 
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   101
                startAngle:0
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   102
                sweepAngle:0.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   103
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   104
    #(45 90 135 180 225 270 315 360) 
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   105
    keysAndValuesReverseDo:[:index :angle |
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   106
        index odd ifTrue:[
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   107
            v paint:Color white
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   108
        ] ifFalse:[
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   109
            v paint:Color black
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   110
        ].
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   111
        ell sweepAngle:angle.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   112
        ell displayFilledOn:v.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   113
        Delay waitForSeconds:0.1.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   114
    ].
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   115
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   116
                                                                        [exEnd]
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   117
  more arcs; filled:
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   118
                                                                        [exBegin]
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   119
    |v ell|
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   120
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   121
    v := View new openAndWait.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   122
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   123
    ell := EllipticalArc
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   124
                boundingBox:(10@10 corner:90@90) 
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   125
                startAngle:0
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   126
                sweepAngle:45.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   127
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   128
    #(45 90 135 180 225 270 315 360) 
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   129
    with:#( 0.125 0.25 0.375 0.5 0.625 0.75 0.875 1)
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   130
    do:[:angle :grey |
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   131
        ell startAngle:angle-45.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   132
        v paint:(ColorValue red:grey green:0 blue:0).
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   133
        ell displayFilledOn:v.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   134
    ].
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   135
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   136
                                                                        [exEnd]
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   137
"
78
claus
parents:
diff changeset
   138
! !
claus
parents:
diff changeset
   139
claus
parents:
diff changeset
   140
!EllipticalArc class methodsFor:'instance creation'!
claus
parents:
diff changeset
   141
claus
parents:
diff changeset
   142
boundingBox:aRectangle
claus
parents:
diff changeset
   143
    "Return a new EllipticalArc."
claus
parents:
diff changeset
   144
claus
parents:
diff changeset
   145
    ^ self new boundingBox:aRectangle
claus
parents:
diff changeset
   146
!
claus
parents:
diff changeset
   147
275
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   148
boundingBox:aRectangle startAngle:startAngle endAngle:endAngle
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   149
    "Return a new EllipticalArc."
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   150
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   151
    ^ self boundingBox:aRectangle startAngle:startAngle sweepAngle:(endAngle - startAngle)
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   152
!
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   153
78
claus
parents:
diff changeset
   154
boundingBox:aRectangle startAngle:startAngle sweepAngle:sweepAngle
claus
parents:
diff changeset
   155
    "Return a new EllipticalArc."
claus
parents:
diff changeset
   156
claus
parents:
diff changeset
   157
    ^ self new boundingBox:aRectangle startAngle:startAngle sweepAngle:sweepAngle
claus
parents:
diff changeset
   158
!
claus
parents:
diff changeset
   159
claus
parents:
diff changeset
   160
center:centerPoint radius:radius
claus
parents:
diff changeset
   161
    "Return a new Circle."
claus
parents:
diff changeset
   162
claus
parents:
diff changeset
   163
    ^ self new center:centerPoint radius:radius
346
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   164
!
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   165
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   166
center:centerPoint radius:radius startAngle:startAngle endAngle:endAngle
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   167
    "Return a new (circular) Arc."
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   168
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   169
    ^ (self new center:centerPoint radius:radius)
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   170
        startAngle:startAngle; sweepAngle:(endAngle - startAngle)
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   171
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   172
    "Created: 17.5.1996 / 09:58:36 / cg"
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   173
    "Modified: 17.5.1996 / 09:59:16 / cg"
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   174
!
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   175
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   176
center:centerPoint radius:radius startAngle:startAngle sweepAngle:sweepAngle
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   177
    "Return a new (circular) Arc."
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   178
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   179
    ^ (self new center:centerPoint radius:radius)
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   180
        startAngle:startAngle; sweepAngle:sweepAngle
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   181
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   182
    "Created: 17.5.1996 / 09:59:08 / cg"
78
claus
parents:
diff changeset
   183
! !
claus
parents:
diff changeset
   184
275
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   185
!EllipticalArc methodsFor:'accessing'!
78
claus
parents:
diff changeset
   186
275
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   187
boundingBox:aRectangle
346
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   188
    "setup the arc, given a bounding rectangle"
78
claus
parents:
diff changeset
   189
275
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   190
    boundingBox := aRectangle.
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   191
    startAngle := 0.
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   192
    sweepAngle := 360
346
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   193
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   194
    "Modified: 17.5.1996 / 10:05:06 / cg"
78
claus
parents:
diff changeset
   195
!
claus
parents:
diff changeset
   196
claus
parents:
diff changeset
   197
boundingBox:aRectangle startAngle:start sweepAngle:sweep
346
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   198
    "setup the arc, given a bounding rectangle, start and endAngle"
78
claus
parents:
diff changeset
   199
claus
parents:
diff changeset
   200
    boundingBox := aRectangle.
claus
parents:
diff changeset
   201
    startAngle := start.
claus
parents:
diff changeset
   202
    sweepAngle := sweep
346
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   203
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   204
    "Modified: 17.5.1996 / 10:05:27 / cg"
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   205
!
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   206
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   207
center:centerPoint radius:radius
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   208
    "setup for a circular arc, given center and radius"
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   209
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   210
    boundingBox := Rectangle
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   211
                        left:(centerPoint x - radius)
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   212
                        top:(centerPoint y - radius)
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   213
                        width:(radius * 2)
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   214
                        height:(radius * 2).
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   215
    startAngle := 0.
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   216
    sweepAngle := 360.
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   217
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   218
    "Created: 17.5.1996 / 10:07:35 / cg"
78
claus
parents:
diff changeset
   219
!
claus
parents:
diff changeset
   220
275
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   221
endAngle
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   222
    "return the endAngle."
78
claus
parents:
diff changeset
   223
275
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   224
    ^ startAngle + sweepAngle
78
claus
parents:
diff changeset
   225
!
claus
parents:
diff changeset
   226
claus
parents:
diff changeset
   227
startAngle
claus
parents:
diff changeset
   228
    "return the startAngle."
claus
parents:
diff changeset
   229
claus
parents:
diff changeset
   230
    ^ startAngle
275
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   231
!
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   232
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   233
startAngle:angle
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   234
    "set the startAngle."
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   235
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   236
    startAngle := angle
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   237
!
78
claus
parents:
diff changeset
   238
claus
parents:
diff changeset
   239
sweepAngle
claus
parents:
diff changeset
   240
    "return the sweepAngle."
claus
parents:
diff changeset
   241
claus
parents:
diff changeset
   242
    ^ sweepAngle
claus
parents:
diff changeset
   243
!
claus
parents:
diff changeset
   244
275
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   245
sweepAngle:angle
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   246
    "set the sweepAngle."
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   247
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   248
    sweepAngle := angle
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   249
! !
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   250
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   251
!EllipticalArc methodsFor:'converting'!
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   252
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   253
asEllipticalArc
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   254
    "convert the receiver into an ellipticalArc - thats the receiver itself"
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   255
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   256
    ^ self 
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   257
! !
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   258
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   259
!EllipticalArc methodsFor:'displaying'!
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   260
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   261
displayFilledOn:aGC
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   262
    "draw the receiver as a filled arc in a graphicsContext, aGC"
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   263
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   264
    aGC fillArcX:boundingBox left
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   265
               y:boundingBox top
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   266
           width:boundingBox width
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   267
          height:boundingBox height
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   268
            from:startAngle
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   269
              to:(startAngle+sweepAngle)
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   270
!
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   271
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   272
displayStrokedOn:aGC
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   273
    "draw the receiver as a unfilled arc in a graphicsContext, aGC"
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   274
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   275
    aGC displayArcX:boundingBox left
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   276
                  y:boundingBox top
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   277
              width:boundingBox width
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   278
             height:boundingBox height
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   279
               from:startAngle
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   280
              angle:sweepAngle
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   281
! !
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   282
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   283
!EllipticalArc methodsFor:'queries'!
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   284
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   285
canBeFilled
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   286
    "return true, if the receiver can be drawn as a filled geometric.
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   287
     Always true here."
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   288
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   289
    ^ true
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   290
!
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   291
78
claus
parents:
diff changeset
   292
center
275
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   293
    "return the center"
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   294
78
claus
parents:
diff changeset
   295
    ^ boundingBox center
490
ef43c7a69346 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   296
!
ef43c7a69346 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   297
ef43c7a69346 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   298
computeBounds
ef43c7a69346 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   299
    "return the smallest enclosing rectangle"
ef43c7a69346 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   300
ef43c7a69346 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   301
    ^ boundingBox
ef43c7a69346 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   302
ef43c7a69346 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   303
    "Created: 12.2.1997 / 11:43:00 / cg"
78
claus
parents:
diff changeset
   304
! !
claus
parents:
diff changeset
   305
275
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   306
!EllipticalArc class methodsFor:'documentation'!
78
claus
parents:
diff changeset
   307
275
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   308
version
1303
6ca5f36cdc63 category
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   309
    ^ '$Header: /cvs/stx/stx/libbasic2/EllipticalArc.st,v 1.13 2003-08-29 17:32:12 cg Exp $'
275
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   310
! !