|
Class: ArrowedSpline
Object
|
+--Geometric
|
+--Spline
|
+--ArrowedSpline
- Package:
- stx:libbasic2
- Category:
- Graphics-Geometry-Objects
- Version:
- rev:
1.10
date: 2009/06/06 10:12:15
- user: cg
- file: ArrowedSpline.st directory: libbasic2
- module: stx stc-classLibrary: libbasic2
- Author:
- Claus Gittinger
ArrowedSplines are like infilled splines, with arrowHeads.
Polygon
LineSegment
Circle
EllipticalArc
Rectangle
Curve
Arrow
Spline
GraphicsContext
StrokingWrapper
FillingWrapper
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 openAndWait.
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)
|
|