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