Excellent
Alex
Le 24 déc. 2015 à 14:08, Offray Vladimir Luna Cárdenas offray.luna@mutabit.com a écrit :
Thanks Milton!
It works like a charm :-)
<dgiafiic.>
Cheers,
Offray
On 24/12/15 10:01, milton mamani wrote: Hi Offray
Can you try the next piece of code.
.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.= | view center data diameter angle gap | diameter := 100. gap := 5. view := RTView new. data := #('lion-o' 'tigro' 'chitara' 'munra' 'ozimandias' 'Dr Manhatan').
center := RTEllipse new size: diameter; color: Color white; borderColor: Color veryLightGray. view add: center element. 1 to: data size do: [ :index | | label | angle := (index * 360/ data size) degreesToRadians. label := (RTRotatedLabel new text: (data at: index); height: 5) element. label translateBy: (Point r: label trachelShape notRotatedWidth/2+(diameter/2)+gap theta: angle). view add: label. angle := angle radiansToDegrees. angle := angle + ((angle between: 90 and: 270) ifTrue: [ 180 ] ifFalse: [ 0 ]). label trachelShape angleInDegree: angle. ]. view
.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=
Cheers, Milton
2015-12-23 20:36 GMT-04:00 Offray Vladimir Luna Cárdenas offray.luna@mutabit.com:
Hi,
I'm trying to understand the code behind the figure here to rotate labels:
<mime-attachment.png>
So, I made a minimal example to start with, here (code is at http://ws.stfx.eu/N6ZG4BAIBO00 )
<mime-attachment.png>
Now I would like to rotate the text to made it look like the first image. I presume that the code that made this possible for the first case is this one:
==================== RTBundleBuilder>>createLabelFor: e view: aView | lbl | lbl := label elementOn: e model. self interaction setUpElement: lbl. aView add: lbl. e addCallback: (TRTranslationCallback new block: [ | angle | angle := (e position - center ) theta. lbl translateTo: e position+((lbl trachelShape notRotatedWidth/2) * (angle cos @ angle sin)). angle := angle radiansToDegrees. angle := angle + ((angle between: 90 and: 270) ifTrue: [ 180 ] ifFalse: [ 0 ]). lbl trachelShape angleInDegree: angle ] ). e translateTo: e position. ====================
but I can not quite understand the lines
lbl translateTo: e position+((lbl trachelShape notRotatedWidth/2) * (angle cos @ angle sin)).
and
angle := angle + ((angle between: 90 and: 270) ifTrue: [ 180 ] ifFalse: [ 0 ]).
Could some body explain me how to incorporate rotation to the first basic example at http://ws.stfx.eu/N6ZG4BAIBO00 (second image of this mail).
Thanks,
Offray
Moose-dev mailing list Moose-dev@list.inf.unibe.ch https://www.list.inf.unibe.ch/listinfo/moose-dev
Moose-dev mailing list Moose-dev@list.inf.unibe.ch https://www.list.inf.unibe.ch/listinfo/moose-dev
Moose-dev mailing list Moose-dev@list.inf.unibe.ch https://www.list.inf.unibe.ch/listinfo/moose-dev