Geometric.st
author Claus Gittinger <cg@exept.de>
Wed, 12 Feb 1997 13:23:49 +0100
changeset 2381 10af98758a49
parent 2377 83a8f10a1234
child 2382 78182edd332e
permissions -rw-r--r--
added dummy Scale & InverseScale classVars. based #bounds on #computeBounds
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
356
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
610
cadd76cb5fb0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    13
Object subclass:#Geometric
1283
2c533653efa3 commentary
Claus Gittinger <cg@exept.de>
parents: 637
diff changeset
    14
	instanceVariableNames:''
2381
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
    15
	classVariableNames:'Scale InverseScale'
1283
2c533653efa3 commentary
Claus Gittinger <cg@exept.de>
parents: 637
diff changeset
    16
	poolDictionaries:''
2c533653efa3 commentary
Claus Gittinger <cg@exept.de>
parents: 637
diff changeset
    17
	category:'Graphics-Geometry'
356
claus
parents:
diff changeset
    18
!
claus
parents:
diff changeset
    19
claus
parents:
diff changeset
    20
!Geometric class methodsFor:'documentation'!
claus
parents:
diff changeset
    21
claus
parents:
diff changeset
    22
copyright
claus
parents:
diff changeset
    23
"
claus
parents:
diff changeset
    24
 COPYRIGHT (c) 1995 by Claus Gittinger
claus
parents:
diff changeset
    25
	      All Rights Reserved
claus
parents:
diff changeset
    26
claus
parents:
diff changeset
    27
 This software is furnished under a license and may be used
claus
parents:
diff changeset
    28
 only in accordance with the terms of that license and with the
claus
parents:
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
claus
parents:
diff changeset
    30
 be provided or otherwise made available to, or used by, any
claus
parents:
diff changeset
    31
 other person.  No title to or ownership of the software is
claus
parents:
diff changeset
    32
 hereby transferred.
claus
parents:
diff changeset
    33
"
claus
parents:
diff changeset
    34
!
claus
parents:
diff changeset
    35
claus
parents:
diff changeset
    36
documentation
claus
parents:
diff changeset
    37
"
claus
parents:
diff changeset
    38
    Abstract superclass for geometric figures.
claus
parents:
diff changeset
    39
    Concrete classes are (currently) Rectangle, Polygon and the classes
claus
parents:
diff changeset
    40
    found in goodies/shape.
claus
parents:
diff changeset
    41
claus
parents:
diff changeset
    42
    These are not graphical objects, but pure mathematical ones.
claus
parents:
diff changeset
    43
    I.e. instances do not carry graphics attributes such as color, lineWidth etc.
1355
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
    44
    However, they ``know'' how to display themself as stroked or possibly
1360
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
    45
    filled picture on a graphicsContext (although, the GC's current
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
    46
    paint and lineStyles are used).
1355
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
    47
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
    48
    Use instances of (subclasses) of DisplayObject or 
1360
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
    49
    of the GeometricWrapper classes for objects which keep the color 
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
    50
    and lineStyle information with them.
356
claus
parents:
diff changeset
    51
1314
18fabbc0e0a6 examples
Claus Gittinger <cg@exept.de>
parents: 1290
diff changeset
    52
    Notice: 
18fabbc0e0a6 examples
Claus Gittinger <cg@exept.de>
parents: 1290
diff changeset
    53
        ST/X does not use Geometric instances for drawing (yet).
1355
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
    54
        Except for Rectangle, Geometry and its subclasses exists mainly 
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
    55
        for ST-80 compatibility and to provide a home when other (PD) 
1314
18fabbc0e0a6 examples
Claus Gittinger <cg@exept.de>
parents: 1290
diff changeset
    56
        geometry classes are to be filed in.
1290
15ba3221b89b documentation
Claus Gittinger <cg@exept.de>
parents: 1283
diff changeset
    57
15ba3221b89b documentation
Claus Gittinger <cg@exept.de>
parents: 1283
diff changeset
    58
    [author:]
15ba3221b89b documentation
Claus Gittinger <cg@exept.de>
parents: 1283
diff changeset
    59
        Claus Gittinger
1314
18fabbc0e0a6 examples
Claus Gittinger <cg@exept.de>
parents: 1290
diff changeset
    60
18fabbc0e0a6 examples
Claus Gittinger <cg@exept.de>
parents: 1290
diff changeset
    61
    [see also:]
1355
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
    62
        Rectangle Polygon EllipticalArc Circle Spline Point
1390
Claus Gittinger <cg@exept.de>
parents: 1389
diff changeset
    63
        LineSegment Curve Arrow ArrowedSpline
1353
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
    64
        GraphicsContext
1358
9491e703ca81 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1357
diff changeset
    65
        StrokingWrapper FillingWrapper
356
claus
parents:
diff changeset
    66
"
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
    67
!
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
    68
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
    69
examples
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
    70
"
1357
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    71
  line segment:
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    72
                                                                        [exBegin]
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    73
    |v l|
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    74
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    75
    v := (View extent:100@100) openAndWait.
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    76
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    77
    l := LineSegment from:10@10 to:90@90. 
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    78
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    79
    v paint:Color red.
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    80
    l displayStrokedOn:v.
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    81
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    82
    l start:90@10 end:10@90.
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    83
    v paint:Color blue.
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    84
    l displayStrokedOn:v.
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    85
                                                                        [exEnd]
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    86
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    87
  rectangle, unfilled:
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    88
                                                                        [exBegin]
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    89
    |v r|
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    90
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    91
    v := (View extent:100@100) openAndWait.
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    92
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    93
    r := Rectangle origin:10@10 corner:90@90. 
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    94
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    95
    v paint:Color red.
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    96
    r displayStrokedOn:v.
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    97
                                                                        [exEnd]
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    98
1353
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
    99
  circle; filled and unfilled:
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   100
                                                                        [exBegin]
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   101
    |v c|
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   102
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   103
    v := (View extent:200@100) openAndWait.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   104
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   105
    c := Circle boundingBox:(10@10 corner:90@90). 
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   106
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   107
    v paint:Color blue.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   108
    c displayFilledOn:v.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   109
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   110
    c center:150@50.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   111
    v paint:Color red.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   112
    c displayStrokedOn:v.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   113
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   114
                                                                        [exEnd]
1353
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   115
  circle & rectangle; both filled:
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   116
                                                                        [exBegin]
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   117
    |v c|
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   118
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   119
    v := (View extent:100@100) openAndWait.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   120
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   121
    c := Circle center:50@50 radius:40. 
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   122
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   123
    v paint:Color red.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   124
    c asRectangle displayFilledOn:v.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   125
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   126
    v paint:Color blue.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   127
    c displayFilledOn:v.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   128
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   129
                                                                        [exEnd]
1353
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   130
  elliptical arcs; filled & unfilled:
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   131
                                                                        [exBegin]
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   132
    |v e|
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   133
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   134
    v := (View extent:200@100) openAndWait.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   135
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   136
    e := EllipticalArc 
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   137
            boundingBox:(10@10 corner:190@90)
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   138
            startAngle:0
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   139
            endAngle:270. 
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   140
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   141
    v paint:Color blue.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   142
    e displayFilledOn:v.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   143
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   144
    v paint:Color red.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   145
    e displayStrokedOn:v.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   146
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   147
                                                                        [exEnd]
1353
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   148
  polygon; filled & unfilled:
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   149
                                                                        [exBegin]
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   150
    |v p|
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   151
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   152
    v := (View extent:100@100) openAndWait.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   153
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   154
    p := Polygon vertices:
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   155
                (Array with:(10@10)
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   156
                       with:(90@90)
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   157
                       with:(10@90)).
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   158
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   159
    v paint:Color blue.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   160
    p displayFilledOn:v.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   161
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   162
    v paint:Color red.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   163
    p displayStrokedOn:v.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   164
                                                                        [exEnd]
1353
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   165
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   166
  circles; filled & unfilled:
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   167
                                                                        [exBegin]
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   168
    |v c|
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   169
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   170
    v := View new openAndWait.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   171
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   172
    c := Circle center:50@50 radius:40.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   173
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   174
    c displayFilledOn:v.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   175
    50 to:1 by:-1 do:[:r |
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   176
        c radius:r.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   177
        v paint:(Color grey:(r * 2)).
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   178
        c displayStrokedOn:v.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   179
    ].
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   180
    1 to:50 do:[:r |
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   181
        c radius:r.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   182
        v paint:(Color grey:100-(r * 2)).
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   183
        c displayStrokedOn:v.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   184
    ]
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   185
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   186
                                                                        [exEnd]
1353
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   187
  arcs; filled:
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   188
                                                                        [exBegin]
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   189
    |v ell|
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   190
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   191
    v := View new openAndWait.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   192
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   193
    ell := EllipticalArc
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   194
                boundingBox:(10@10 corner:90@90) 
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   195
                startAngle:0
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   196
                sweepAngle:0.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   197
1353
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   198
    #(45 90 135 180 225 270 315 360) keysAndValuesDo:[:index :angle |
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   199
        index odd ifTrue:[
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   200
            v paint:Color white
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   201
        ] ifFalse:[
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   202
            v paint:Color black
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   203
        ].
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   204
        ell sweepAngle:angle.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   205
        ell displayFilledOn:v.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   206
        Delay waitForSeconds:0.5.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   207
    ].
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   208
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   209
                                                                        [exEnd]
1353
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   210
  arcs; filled:
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   211
                                                                        [exBegin]
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   212
    |v ell|
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   213
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   214
    v := View new openAndWait.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   215
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   216
    ell := EllipticalArc
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   217
                boundingBox:(10@10 corner:90@90) 
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   218
                startAngle:0
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   219
                sweepAngle:45.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   220
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   221
    #(45 90 135 180 225 270 315 360) 
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   222
    with:#( 0.125 0.25 0.375 0.5 0.625 0.75 0.875 1)
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   223
    do:[:angle :grey |
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   224
        ell startAngle:angle-45.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   225
        v paint:(ColorValue red:grey green:0 blue:0).
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   226
        ell displayFilledOn:v.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   227
    ].
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   228
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   229
                                                                        [exEnd]
1353
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   230
  spline; filled & unfilled:
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   231
                                                                        [exBegin]
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   232
    |v p|
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   233
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   234
    v := (View extent:100@100) openAndWait.
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   235
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   236
    p := Spline controlPoints:
1354
Claus Gittinger <cg@exept.de>
parents: 1353
diff changeset
   237
                (Array with:(20@20)
Claus Gittinger <cg@exept.de>
parents: 1353
diff changeset
   238
                       with:(80@80)
Claus Gittinger <cg@exept.de>
parents: 1353
diff changeset
   239
                       with:(20@80)).
1353
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   240
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   241
    v paint:Color blue.
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   242
    p displayFilledOn:v.
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   243
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   244
    v paint:Color red.
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   245
    p displayStrokedOn:v.
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   246
                                                                        [exEnd]
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   247
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   248
  closed spline; filled & unfilled:
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   249
                                                                        [exBegin]
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   250
    |v p|
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   251
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   252
    v := (View extent:100@100) openAndWait.
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   253
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   254
    p := Spline controlPoints:
1354
Claus Gittinger <cg@exept.de>
parents: 1353
diff changeset
   255
                (Array with:(20@20)
Claus Gittinger <cg@exept.de>
parents: 1353
diff changeset
   256
                       with:(80@80)
Claus Gittinger <cg@exept.de>
parents: 1353
diff changeset
   257
                       with:(20@80)
Claus Gittinger <cg@exept.de>
parents: 1353
diff changeset
   258
                       with:(20@20)).
1353
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   259
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   260
    v paint:Color blue.
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   261
    p displayFilledOn:v.
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   262
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   263
    v paint:Color red.
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   264
    p displayStrokedOn:v.
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   265
                                                                        [exEnd]
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   266
"
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   267
! !
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   268
2381
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   269
!Geometric class methodsFor:'initialization'!
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   270
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   271
initialize
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   272
    "setup class constants"
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   273
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   274
    "/ these are note used in ST/X;
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   275
    "/ (acc. to a testers note, ST-80 internally uses
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   276
    "/  integer valued coordinates, scaling coordinates by
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   277
    "/  the Scale constant. ST/X does not do this. However,
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   278
    "/  user suppied subclasses may depend on those values being
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   279
    "/  present ...)
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   280
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   281
    Scale := 4096.
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   282
    InverseScale := 1.0 / Scale
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   283
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   284
    "
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   285
     Geometric initialize
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   286
    "
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   287
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   288
    "Modified: 12.2.1997 / 13:11:31 / cg"
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   289
! !
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   290
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   291
!Geometric class methodsFor:'helper functions'!
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   292
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   293
boundingRectangleForPoints:aSequencableCollectionOfPoints
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   294
    "given a bunch of point, compute the boundingRectangle
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   295
     (i.e. the smallest rectangle which encloses all of those points)"
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   296
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   297
    |p minX minY maxX maxY n "{ Class: SmallInteger }"
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   298
     x y |
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   299
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   300
    p := aSequencableCollectionOfPoints first.
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   301
    minX := maxX := p x.
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   302
    minY := maxY := p y.
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   303
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   304
    n := aSequencableCollectionOfPoints size.
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   305
    1 to:n do:[:idx | 
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   306
        p := aSequencableCollectionOfPoints at:idx.
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   307
        x := p x.
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   308
        y := p y.
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   309
        x < minX ifTrue:[
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   310
            minX := x
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   311
        ] ifFalse:[
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   312
            x > maxX ifTrue:[
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   313
                maxX := x
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   314
            ]
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   315
        ].
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   316
        y < minY ifTrue:[
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   317
            minY := y
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   318
        ] ifFalse:[
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   319
            y > maxY ifTrue:[
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   320
                maxY := y
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   321
            ]
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   322
        ].
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   323
    ].
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   324
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   325
    ^ Rectangle left:minX top:minY right:maxX bottom:maxY
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   326
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   327
    "Modified: 12.2.1997 / 12:10:12 / cg"
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   328
! !
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   329
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   330
!Geometric methodsFor:'converting'!
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   331
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   332
asFiller
1353
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   333
    "return a wrapper which displays the receiver in its filled form"
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   334
2381
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   335
    self canBeFilled ifTrue:[
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   336
        ^ FillingWrapper on:self
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   337
    ].
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   338
    ^ self shouldNotImplement
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   339
2381
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   340
    "Modified: 12.2.1997 / 11:47:22 / cg"
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   341
!
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   342
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   343
asRectangle
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   344
    "return the enclosing rectangle; same as #bounds"
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   345
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   346
    ^ self bounds
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   347
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   348
    "Created: 8.5.1996 / 14:36:35 / cg"
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   349
!
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   351
asStroker
1353
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   352
    "return a wrapper which displays the receiver as stroked outline"
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   353
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   354
    ^ StrokingWrapper on:self
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   355
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   356
    "Created: 8.5.1996 / 14:38:09 / cg"
1353
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   357
    "Modified: 8.5.1996 / 18:23:00 / cg"
2377
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   358
!
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   359
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   360
asVisualComponent
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   361
    "return a wrapper on the receiver, which responds to VisualComponent messages."
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   362
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   363
    ^ self asStroker
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   364
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   365
    "Created: 10.2.1997 / 12:04:27 / cg"
356
claus
parents:
diff changeset
   366
! !
claus
parents:
diff changeset
   367
claus
parents:
diff changeset
   368
!Geometric methodsFor:'displaying'!
claus
parents:
diff changeset
   369
610
cadd76cb5fb0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   370
displayFilledOn:aGC
cadd76cb5fb0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   371
    "display myself filled on a graphicsContext; the current graphics
cadd76cb5fb0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   372
     attributes are used. Since we do not know how to do it, nothing is
cadd76cb5fb0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   373
     drawn here."
cadd76cb5fb0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   374
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   375
    ^ self subclassResponsibility
610
cadd76cb5fb0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   376
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   377
    "Modified: 8.5.1996 / 09:07:02 / cg"
610
cadd76cb5fb0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   378
!
cadd76cb5fb0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   379
356
claus
parents:
diff changeset
   380
displayOn:aGC
claus
parents:
diff changeset
   381
    "display myself on a graphicsContext; the current graphics
claus
parents:
diff changeset
   382
     attributes are used. The default here is to display the outline."
claus
parents:
diff changeset
   383
claus
parents:
diff changeset
   384
    ^ self displayStrokedOn:aGC
claus
parents:
diff changeset
   385
!
claus
parents:
diff changeset
   386
claus
parents:
diff changeset
   387
displayStrokedOn:aGC
claus
parents:
diff changeset
   388
    "display my outline on a graphicsContext; the current graphics
1357
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
   389
     attributes are used. Since we do not know how to do it, nothing is
356
claus
parents:
diff changeset
   390
     drawn here."
claus
parents:
diff changeset
   391
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   392
    ^ self subclassResponsibility
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   393
1357
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
   394
    "Modified: 8.5.1996 / 21:20:19 / cg"
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   395
! !
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   396
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   397
!Geometric methodsFor:'queries'!
356
claus
parents:
diff changeset
   398
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   399
bounds
2381
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   400
    "return the smallest enclosing rectangle.
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   401
     This resends computeBounds, to allow caching of bounds in
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   402
     case this computation is expensive."
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   403
2381
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   404
    ^ self computeBounds
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   405
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   406
    "Created: 8.5.1996 / 13:56:08 / cg"
2381
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   407
    "Modified: 12.2.1997 / 11:41:38 / cg"
1446
fabdc1d2598c added #canBeFilled for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1390
diff changeset
   408
!
fabdc1d2598c added #canBeFilled for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1390
diff changeset
   409
fabdc1d2598c added #canBeFilled for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1390
diff changeset
   410
canBeFilled
fabdc1d2598c added #canBeFilled for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1390
diff changeset
   411
    "return true, if the receiver can be drawn as a filled geometric.
fabdc1d2598c added #canBeFilled for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1390
diff changeset
   412
     Return false here, since we dont know."
fabdc1d2598c added #canBeFilled for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1390
diff changeset
   413
fabdc1d2598c added #canBeFilled for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1390
diff changeset
   414
    ^ false
fabdc1d2598c added #canBeFilled for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1390
diff changeset
   415
fabdc1d2598c added #canBeFilled for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1390
diff changeset
   416
    "Created: 1.6.1996 / 11:28:58 / cg"
2376
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   417
!
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   418
2381
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   419
computeBounds
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   420
    "return the smallest enclosing rectangle."
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   421
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   422
    ^ self subclassResponsibility
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   423
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   424
    "Created: 12.2.1997 / 11:41:58 / cg"
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   425
!
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   426
2376
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   427
outlineIntersects:aRectangle
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   428
    "return true, if the receivers image intersects
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   429
     aRectangle, when drawn as an outline.
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   430
     Here, all we can do is to ask the boundary rectangle;
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   431
     subclasses should reimplement better checks."
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   432
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   433
    ^ self bounds intersects:aRectangle
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   434
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   435
    "Modified: 10.2.1997 / 13:40:36 / cg"
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   436
!
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   437
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   438
regionIntersects:aRectangle
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   439
    "return true, if the receivers image intersects
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   440
     aRectangle, when drawn as a filled version.
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   441
     Here, all we can do is to ask the boundary rectangle;
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   442
     subclasses should reimplement better checks."
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   443
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   444
    ^ self bounds intersects:aRectangle
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   445
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   446
    "Modified: 10.2.1997 / 13:40:00 / cg"
356
claus
parents:
diff changeset
   447
! !
claus
parents:
diff changeset
   448
2377
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   449
!Geometric methodsFor:'transforming'!
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   450
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   451
scaledBy:scaleAmount 
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   452
    "return a copy of the receiver, which is scaled by the argument,
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   453
     a point or number"
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   454
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   455
    ^ self subclassResponsibility
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   456
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   457
    "Created: 10.2.1997 / 12:05:45 / cg"
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   458
!
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   459
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   460
translatedBy:scaleAmount 
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   461
    "return a copy of the receiver, which is translated by the argument,
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   462
     a point or number"
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   463
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   464
    ^ self subclassResponsibility
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   465
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   466
    "Created: 10.2.1997 / 12:05:56 / cg"
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   467
! !
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   468
637
f71df465819c version at the end
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   469
!Geometric class methodsFor:'documentation'!
f71df465819c version at the end
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   470
f71df465819c version at the end
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   471
version
2381
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   472
    ^ '$Header: /cvs/stx/stx/libbasic/Geometric.st,v 1.23 1997-02-12 12:23:49 cg Exp $'
637
f71df465819c version at the end
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   473
! !
2381
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   474
Geometric initialize!