Arrow.st
author ca
Sat, 25 May 1996 15:54:02 +0200
changeset 354 909581778d57
parent 333 785f0e48fdb8
child 357 9b43dacb35d1
permissions -rw-r--r--
checkin from browser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
318
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1996 by Claus Gittinger
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
              All Rights Reserved
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
LineSegment subclass:#Arrow
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	instanceVariableNames:'arrowHeadPosition arrowHeadLength arrowHeadAngle'
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	classVariableNames:'DefaultLength DefaultAngle'
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	poolDictionaries:''
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
	category:'Graphics-Geometry'
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
!
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
!Arrow class methodsFor:'documentation'!
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
copyright
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
"
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
 COPYRIGHT (c) 1996 by Claus Gittinger
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
              All Rights Reserved
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 This software is furnished under a license and may be used
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 only in accordance with the terms of that license and with the
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 inclusion of the above copyright notice.   This software may not
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 be provided or otherwise made available to, or used by, any
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
 other person.  No title to or ownership of the software is
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
 hereby transferred.
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
"
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
!
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
documentation
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
"
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
    Arrows are just what the name says - a directed LineSegment, which
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
    draws itself with an arrowHead. The position of the arrowhead can
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
    be set to be anywhere along the lineSegement (default is at the end).
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
323
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
    50
    Arrows can be drawn stroked or filled - when filled, only the arrowHead
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
    51
    is filled.
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
    52
318
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
    [author:]
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
        Claus Gittinger
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
    [see also:]
320
14e3290c1c0a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 318
diff changeset
    57
        Rectangle Polygon EllipticalArc Circle Spline Curve Point 
331
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
    58
        LineSegment ArrowedSpline 
318
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
        GraphicsContext
331
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
    60
        StrokingWrapper FillingWrapper
318
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
"
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
!
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
examples
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
"
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
  low level use:
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
                                                                        [exBegin]
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
    |v a|
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
    v := (View extent:100@100) openAndWait.
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
    a := Arrow from:10@10 to:90@90. 
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
    v paint:Color red.
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
    a displayStrokedOn:v.
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
    a start:90@10 end:10@90.
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
    v paint:Color blue.
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
    a displayStrokedOn:v.
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
                                                                        [exEnd]
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
325
f4835579dc09 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
    82
  as component (automatic redraw):
f4835579dc09 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
    83
                                                                        [exBegin]
f4835579dc09 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
    84
    |v a|
f4835579dc09 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
    85
f4835579dc09 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
    86
    v := View extent:100@100.
f4835579dc09 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
    87
f4835579dc09 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
    88
    a := Arrow from:50@50 to:10@10. 
f4835579dc09 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
    89
    v addComponent:(StrokingWrapper on:a).
f4835579dc09 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
    90
f4835579dc09 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
    91
    a := Arrow from:50@50 to:90@10. 
f4835579dc09 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
    92
    v addComponent:(StrokingWrapper on:a).
f4835579dc09 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
    93
f4835579dc09 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
    94
    a := Arrow from:50@50 to:10@90. 
f4835579dc09 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
    95
    v addComponent:(StrokingWrapper on:a).
f4835579dc09 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
    96
f4835579dc09 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
    97
    a := Arrow from:50@50 to:90@90. 
f4835579dc09 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
    98
    v addComponent:(StrokingWrapper on:a).
f4835579dc09 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
    99
f4835579dc09 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
   100
    v open
f4835579dc09 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
   101
                                                                        [exEnd]
f4835579dc09 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
   102
f4835579dc09 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
   103
  as component filled vs. stroked:
323
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   104
                                                                        [exBegin]
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   105
    |v a|
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   106
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   107
    v := View extent:100@100.
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   108
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   109
    a := Arrow from:10@10 to:90@10. 
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   110
    v addComponent:(StrokingWrapper on:a).
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   111
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   112
    a := Arrow from:90@20 to:10@20. 
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   113
    v addComponent:(StrokingWrapper on:a).
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   114
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   115
    a := Arrow from:10@50 to:90@50. 
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   116
    v addComponent:(FillingWrapper on:a).
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   117
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   118
    a := Arrow from:90@60 to:10@60. 
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   119
    v addComponent:(FillingWrapper on:a).
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   120
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   121
    v open
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   122
                                                                        [exEnd]
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   123
324
1a318dec0fd7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 323
diff changeset
   124
  as component (varying lineStyles):
318
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
                                                                        [exBegin]
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
    |v a|
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
    v := View extent:100@100.
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
    a := Arrow from:10@10 to:90@90. 
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
    v addComponent:(StrokingWrapper on:a).
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
    a := Arrow from:10@10 to:90@10.
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
    a arrowHeadPosition:0.5.
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
    v addComponent:(StrokingWrapper on:a).
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
    a := Arrow from:90@10 to:10@90. 
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
    v addComponent:((StrokingWrapper on:a) foregroundColor:(Color red)).
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
    a := Arrow from:10@50 to:90@50. 
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
    a arrowHeadLength:20; arrowHeadAngle:130.
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
    v addComponent:((StrokingWrapper on:a) 
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
                        lineWidth:5;
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
                        foregroundColor:(Color red)).
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
    a := Arrow from:50@90 to:50@10. 
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
    a arrowHeadLength:10; arrowHeadAngle:170.
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
    v addComponent:((StrokingWrapper on:a) 
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
                        lineWidth:2;
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
                        lineStyle:#dashed;
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
                        foregroundColor:(Color red);
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
                        backgroundColor:(Color yellow)).
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
    v open.
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
                                                                        [exEnd]
321
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   158
  varying the position:
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   159
                                                                        [exBegin]
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   160
    |v a|
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   161
323
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   162
    v := View extent:200@100.
321
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   163
323
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   164
    a := Arrow from:10@10 to:90@10. 
321
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   165
    a arrowHeadPosition:0.
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   166
    v addComponent:(StrokingWrapper on:a).
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   167
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   168
    a := Arrow from:10@30 to:90@30. 
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   169
    a arrowHeadPosition:(1/3).
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   170
    v addComponent:(StrokingWrapper on:a).
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   171
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   172
    a := Arrow from:10@40 to:90@40. 
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   173
    a arrowHeadPosition:0.5.
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   174
    v addComponent:(StrokingWrapper on:a).
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   175
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   176
    a := Arrow from:10@50 to:90@50. 
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   177
    a arrowHeadPosition:(2/3).
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   178
    v addComponent:(StrokingWrapper on:a).
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   179
323
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   180
    a := Arrow from:10@70 to:90@70. 
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   181
    v addComponent:(StrokingWrapper on:a).
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   182
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   183
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   184
    a := Arrow from:100@10 to:150@90.
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   185
    a arrowHeadPosition:(1/3).
326
2be7d1d78659 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   186
    v addComponent:(FillingWrapper on:a).
323
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   187
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   188
    a := Arrow from:110@10 to:160@90.
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   189
    a arrowHeadPosition:(2/3).
326
2be7d1d78659 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   190
    v addComponent:(FillingWrapper on:a).
323
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   191
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   192
    a := Arrow from:120@10 to:170@90.
326
2be7d1d78659 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   193
    v addComponent:(FillingWrapper on:a).
321
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   194
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   195
    v open.
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   196
                                                                        [exEnd]
318
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
"
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
! !
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
!Arrow class methodsFor:'initialization'!
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
initialize
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
    DefaultAngle := 150.
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
    DefaultLength := 8
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
    "
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
     Arrow initialize
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
    "
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
! !
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
321
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   211
!Arrow class methodsFor:'accessing defaults'!
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   212
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   213
defaultAngle
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   214
    ^ DefaultAngle
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   215
!
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   216
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   217
defaultLength
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   218
    ^ DefaultLength
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   219
! !
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   220
318
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
!Arrow methodsFor:'accessing'!
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
arrowHeadAngle
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
    "return the arrowHeads angle, in degrees.
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
     The default is 150 degrees"
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
    arrowHeadAngle isNil ifTrue:[^ DefaultAngle].
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
    ^ arrowHeadAngle
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
    "Modified: 12.5.1996 / 22:48:29 / cg"
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
    "Created: 12.5.1996 / 22:56:36 / cg"
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
!
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   233
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
arrowHeadAngle:angleInDegrees
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
    "set the arrowHeads angle, in degrees.
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
     The default is 150 degrees"
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
    arrowHeadAngle := angleInDegrees
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240
    "Modified: 12.5.1996 / 22:48:29 / cg"
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   241
    "Created: 12.5.1996 / 22:57:47 / cg"
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   242
!
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   243
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   244
arrowHeadLength
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
    "return the arrowHeads length, in pixels.
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
     The default is 8 pixels"
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   248
    arrowHeadPosition isNil ifTrue:[^ DefaultLength].
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
    ^ arrowHeadLength
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   250
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   251
    "Created: 12.5.1996 / 22:47:32 / cg"
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   252
    "Modified: 12.5.1996 / 22:57:27 / cg"
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   253
!
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   254
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
arrowHeadLength:pixels
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
    "set the arrowHeads length, in pixels.
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
     The default is 8 pixels"
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
    arrowHeadLength := pixels
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
    "Created: 12.5.1996 / 22:47:48 / cg"
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
    "Modified: 12.5.1996 / 23:01:20 / cg"
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
!
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   265
arrowHeadPosition
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
    "return the arrowHeads position, as a fraction of the overall length;
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   267
     0 is at the beginning, 1 is at the end, 0.5 is in the center."
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   268
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
    arrowHeadPosition isNil ifTrue:[^ 1].
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   270
    ^ arrowHeadPosition
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   271
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   272
    "Created: 12.5.1996 / 22:46:21 / cg"
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   273
    "Modified: 12.5.1996 / 22:57:55 / cg"
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   274
!
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   275
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   276
arrowHeadPosition:aFractionOfTheLinesLength
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   277
    "set the arrowHeads position, as a fraction of the overall length;
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   278
     0 is at the beginning, 1 is at the end, 0.5 is in the center."
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   279
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   280
    arrowHeadPosition := aFractionOfTheLinesLength
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   281
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   282
    "Created: 12.5.1996 / 22:46:54 / cg"
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   283
    "Modified: 12.5.1996 / 23:01:09 / cg"
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   284
! !
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   285
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   286
!Arrow methodsFor:'displaying'!
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   287
354
909581778d57 checkin from browser
ca
parents: 333
diff changeset
   288
arrowPoints
909581778d57 checkin from browser
ca
parents: 333
diff changeset
   289
    "return the arrowPoints in a collection"
318
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   290
333
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   291
    |arrowHeadPoint len pos angle point grad x1 y1 x2 y2
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   292
     savedLineStyle atn p1 p2 deriv dX dY|
318
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   293
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   294
    arrowHeadPosition isNil ifTrue:[
321
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   295
        pos := 1
318
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   296
    ] ifFalse:[
321
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   297
        pos := arrowHeadPosition max:0.0001.
318
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   298
    ].
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   299
321
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   300
    arrowHeadPoint := startPoint + ((endPoint - startPoint) * pos).
49c7fd30093c kludge for position of 0
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   301
318
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   302
    len := arrowHeadLength.
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   303
    len isNil ifTrue:[
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   304
        len := DefaultLength
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   305
    ].
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   306
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   307
    angle := arrowHeadAngle.
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   308
    angle isNil ifTrue:[
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   309
        angle := DefaultAngle
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   310
    ].
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   311
    angle := angle degreesToRadians.
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   312
333
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   313
    deriv := arrowHeadPoint - startPoint.
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   314
    dX := deriv x.
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   315
    dY := deriv y.
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   316
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   317
    dX = 0 ifTrue: [
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   318
        grad := 99999999.9
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   319
    ] ifFalse: [
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   320
        grad := dY / dX
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   321
    ].
322
38c88d4b3976 avoid calling arcTan too often
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
   322
38c88d4b3976 avoid calling arcTan too often
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
   323
    atn := grad arcTan.
333
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   324
    x1 := len * (angle - atn) cos.
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   325
    y1 := len * (angle - atn) sin.
318
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   326
333
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   327
    x2 := len * (angle + atn) cos.
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   328
    y2 := len * (angle + atn) sin.
318
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   329
333
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   330
    dX = 0 ifTrue:[
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   331
        dY > 0 ifTrue:[
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   332
            p1 := (dX + x1) @ (dY - y1).
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   333
            p2 := (dX + x2) @ (dY + y2).
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   334
        ] ifFalse:[
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   335
            p1 := (dX - x1) @ (dY + y1).
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   336
            p2 := (dX - x2) @ (dY - y2).
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   337
        ]
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   338
    ] ifFalse:[
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   339
        dX > 0 ifTrue:[
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   340
            p1 := (dX + x1) @ (dY - y1).
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   341
            p2 := (dX + x2) @ (dY + y2).
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   342
        ] ifFalse:[
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   343
            p1 := (dX - x1) @ (dY + y1).
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   344
            p2 := (dX - x2) @ (dY - y2).
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   345
        ]
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   346
    ].
318
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   347
333
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   348
    p1 := startPoint + p1.
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   349
    p2 := startPoint + p2.
323
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   350
354
909581778d57 checkin from browser
ca
parents: 333
diff changeset
   351
    ^ Array with:p1 with:arrowHeadPoint with:p2.
909581778d57 checkin from browser
ca
parents: 333
diff changeset
   352
909581778d57 checkin from browser
ca
parents: 333
diff changeset
   353
    "Created: 12.5.1996 / 23:54:35 / cg"
909581778d57 checkin from browser
ca
parents: 333
diff changeset
   354
    "Modified: 13.5.1996 / 20:55:51 / cg"
909581778d57 checkin from browser
ca
parents: 333
diff changeset
   355
!
909581778d57 checkin from browser
ca
parents: 333
diff changeset
   356
909581778d57 checkin from browser
ca
parents: 333
diff changeset
   357
displayArrowOn:aGC filled:filled
909581778d57 checkin from browser
ca
parents: 333
diff changeset
   358
    "display the receivers arrow in the graphicsContext, aGC"
909581778d57 checkin from browser
ca
parents: 333
diff changeset
   359
909581778d57 checkin from browser
ca
parents: 333
diff changeset
   360
    |arrowHeadPoint savedLineStyle p1 p2 points|
909581778d57 checkin from browser
ca
parents: 333
diff changeset
   361
909581778d57 checkin from browser
ca
parents: 333
diff changeset
   362
    super displayStrokedOn:aGC.
909581778d57 checkin from browser
ca
parents: 333
diff changeset
   363
909581778d57 checkin from browser
ca
parents: 333
diff changeset
   364
    savedLineStyle := aGC lineStyle.
909581778d57 checkin from browser
ca
parents: 333
diff changeset
   365
    aGC lineStyle:#solid.
909581778d57 checkin from browser
ca
parents: 333
diff changeset
   366
909581778d57 checkin from browser
ca
parents: 333
diff changeset
   367
    points := self arrowPoints.
909581778d57 checkin from browser
ca
parents: 333
diff changeset
   368
909581778d57 checkin from browser
ca
parents: 333
diff changeset
   369
    p1 := points at:1.
909581778d57 checkin from browser
ca
parents: 333
diff changeset
   370
    arrowHeadPoint := points at:2.
909581778d57 checkin from browser
ca
parents: 333
diff changeset
   371
    p2 := points at:3.
909581778d57 checkin from browser
ca
parents: 333
diff changeset
   372
323
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   373
    filled ifFalse:[
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   374
        aGC displayLineFrom:arrowHeadPoint to:p1.
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   375
        aGC displayLineFrom:arrowHeadPoint to:p2.
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   376
    ] ifTrue:[
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   377
        aGC fillPolygon:(Array with:p1 with:arrowHeadPoint with:p2).
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   378
    ].
318
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   379
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   380
    aGC lineStyle:savedLineStyle.
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   381
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   382
    "
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   383
     |v|
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   384
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   385
     v := View new openAndWait.
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   386
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   387
     (Arrow from:10@10 to:50@50) displayStrokedOn:v
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   388
    "
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   389
323
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   390
    "Created: 12.5.1996 / 23:54:35 / cg"
333
785f0e48fdb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   391
    "Modified: 13.5.1996 / 20:55:51 / cg"
323
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   392
!
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   393
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   394
displayFilledOn:aGC
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   395
    "display the receiver in the graphicsContext, aGC"
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   396
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   397
    super displayStrokedOn:aGC.
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   398
    self displayArrowOn:aGC filled:true
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   399
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   400
    "Modified: 12.5.1996 / 23:54:52 / cg"
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   401
    "Created: 12.5.1996 / 23:58:42 / cg"
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   402
!
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   403
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   404
displayStrokedOn:aGC
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   405
    "display the receiver in the graphicsContext, aGC"
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   406
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   407
    super displayStrokedOn:aGC.
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   408
    self displayArrowOn:aGC filled:false
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   409
125bc8f428a4 added filled arrows
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
   410
    "Modified: 12.5.1996 / 23:54:52 / cg"
318
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   411
! !
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   412
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   413
!Arrow class methodsFor:'documentation'!
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   414
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   415
version
354
909581778d57 checkin from browser
ca
parents: 333
diff changeset
   416
    ^ '$Header: /cvs/stx/stx/libbasic2/Arrow.st,v 1.11 1996-05-25 13:54:02 ca Exp $'
318
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   417
! !
27d26332a987 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   418
Arrow initialize!