|
Class: ArrowedSpline
Object
|
+--Geometric
|
+--Spline
|
+--ArrowedSpline
- Package:
- stx:libbasic2
- Category:
- Graphics-Geometry-Objects
- Version:
- rev:
1.12
date: 2022/02/17 10:25:16
- user: cg
- file: ArrowedSpline.st directory: libbasic2
- module: stx stc-classLibrary: libbasic2
ArrowedSplines are like infilled splines, with arrowHeads.
copyrightCOPYRIGHT (c) 1996 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
accessing
-
arrowHeadAngle
-
return the arrowHeads angle, in degrees.
The default is defined in Arrow (150 degrees)
-
arrowHeadAngle: angleInDegrees
-
set the arrowHeads angle, in degrees.
The default is defined in Arrow (150 degrees)
-
arrowHeadLength
-
return the arrowHeads length, in pixels.
The default is define in Arrow (8 pixels)
-
arrowHeadLength: pixels
-
set the arrowHeads length, in pixels.
The default is defined in Arrow (8 pixels)
-
arrowHeadPositions: collectionOfPositions
-
set the arrowHeads positions. Each collections element gives
theindex of a controlPoint, on which an arrowHead is drawn.
The default is #(<controlPoints size>) i.e. a single arrowHead
on the last controlPoint.
To have arrowHeads on all controlPoints, define arrowHeadPositions
as (1 to:controlPoints size)
displaying
-
arrowPoints
-
helper: return a collection of arrow-points
-
displayArrowsOn: aGC filled: filled
-
display the receiver in the graphicsContext, aGC
-
displayFilledOn: aGC
-
display the receiver in the graphicsContext, aGC
-
displayStrokedOn: aGC
-
display the receiver in the graphicsContext, aGC
queries
-
computeBounds
-
return the smallest enclosing rectangle
testing
-
canBeFilled
-
return true, if the receiver can be drawn as a filled geometric.
Always true here. Notice, that only the arrowHeads are filled.
arrowedspline:
|v a|
v := View extent:100@100.
a := ArrowedSpline controlPoints:
(Array with:(20@20)
with:(80@80)
with:(20@80)).
v addComponent:((StrokingWrapper on:a) foregroundColor:Color red).
v open.
|
filled arrow:
|v a|
v := View extent:100@100.
a := ArrowedSpline controlPoints:
(Array with:(20@20)
with:(80@80)
with:(20@50)
with:(90@10)).
v addComponent:((FillingWrapper on:a) foregroundColor:Color red).
v open.
|
more arrowHeads:
|v a|
v := View extent:100@100.
a := ArrowedSpline controlPoints:
(Array with:(20@20)
with:(80@80)
with:(20@50)
with:(90@10)).
a arrowHeadPositions:#(1 4).
v addComponent:((FillingWrapper on:a) foregroundColor:Color red).
v open.
| interactive:
|v points eventCatcher|
v := StandardSystemView extent:(450 @ 450).
v label:'ArrowedSpline Example - (click left/middle)'.
points := OrderedCollection new.
v openAndWaitUntilVisible.
eventCatcher := Plug new.
eventCatcher respondTo:#handlesButtonPress:inView:
with:[:butt :view | true].
eventCatcher respondTo:#buttonPress:x:y:view:
with:[:butt :x :y :view |
v paint:(Color white).
v fillCircle:(x @ y) radius:3.
points add:(x @ y).
(butt == 1 or:[butt == #select]) ifFalse:[
v paint:(Color white).
v fillCircle:(x @ y) radius:3.
((ArrowedSpline controlPoints:points)
arrowHeadPositions:(1 to:points size);
arrowHeadLength:15)
displayStrokedOn:v.
points := OrderedCollection new.
]
].
v delegate:(eventCatcher)
|
|