Grafoscopio/src/Dataviz/TRArcShape.extension.st

22 lines
845 B
Smalltalk

Extension { #name : #TRArcShape }
{ #category : #'*DataViz' }
TRArcShape >> surroundedBy: anArray radialGap: aDistance angularGap: anAngle renderedIn: aCanvas [
"I put TR shape objects stored in anArray equally separeted around the external part of an RTArc.
Notice that the array must contain TR shapes"
| sep start end |
end := self betaAngle - anAngle.
start := self alphaAngle + anAngle.
sep := (start - end) / (anArray size - 1).
anArray doWithIndex: [ :each :i | | angle |
angle := (start - (i - 1 * sep)) negated.
each class = TRRotatedLabelShape
ifTrue: [ each angleInDegree: angle + ((angle between: -270 and: -90) ifTrue: [ 180 ] ifFalse: [ 0 ]) ].
aCanvas addShape: (each
translateBy: (Point r: (self externalRadius + aDistance) theta: angle degreesToRadians))
].
aCanvas addShape: self.
^ aCanvas
]