As I use a lot of CompositeShape in my project I will give you a lot of feedbacks ;-)
I like the composition of composite shape itself. I needed it now it will so much easier.

But is it possible the put a RTCompositeShape as fixed ? Let me give you an example to show you
I'm working on a Menu in my vizualisation so i want them fix. But a menu is a label and its "background' so a composite shape. Can I set it as fixed ?


On Thu, Apr 24, 2014 at 3:39 PM, Alexandre Bergel <alexandre.bergel@me.com> wrote:
Hi!

I’ve just introduced a new class TRExtensibleLabelShape and TRLabelShape. This will ease the problem we are experiencing with using labels in a composed shape. 

I would like now to discuss about how to compose shapes. This has been a big discussion for at least 5 years. I propose a solution in this email, I hope this will make most of us happy :-)


Consider the example:

-=-=-=-=-=-=-=-=
| v s1 s2 c es |
v := RTView new.

s1 := (RTEllipse new size: #yourself; color: (Color blue alpha: 0.4)).
s2 := (RTLabel new text: 'Hello World'; height: 10).

c := RTCompositeShape new 
shape1: s1; 
shape2: s2;
offset2: 0 @ -30.

es := c elementsOn: #(30 60 80).
es @ RTDraggable.
v addAll: es.

es when: TRMouseClick do: [ :evt | evt element remove. v signalUpdate ].

RTHorizontalLineLayout on: v elements.
v open
-=-=-=-=-=-=-=-=

This is the output:

If you click on an element, then the element with its label is properly removed. Yupi! Leo will be happy with that :-)
The reason is that how can I specify to have s2 above s1? What should I put in offset2 ? Instead of fiddling with blocks like [:shape1 :shape2 :element | … ] I have introduced RTHorizontalCompositeShape and RTVerticalCompositeShape just to try whether it make sense or not.

We can have 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
| v s1 s2 c es |
v := RTView new.

s1 := (RTEllipse new size: #yourself; color: (Color blue alpha: 0.4)).
s2 := (RTLabel new text: 'Hello World'; height: 10).

c := RTHorizontalCompositeShape new 
shape1: s1; 
shape2: s2.

es := c elementsOn: #(30 60 80).
es @ RTDraggable.
v addAll: es.

RTHorizontalLineLayout on: v elements.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Replacing Horizontal by Vertical works as expected. 

You can also compose these things. Look at that:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
| v s1 s2 c es |
v := RTView new.

s1 := (RTEllipse new size: #yourself; color: (Color blue alpha: 0.4)).
s2 := (RTLabel new text: 'Hello World'; height: 10).

c2 := RTVerticalCompositeShape new
shape1: s1;
shape2: s2.
c := RTHorizontalCompositeShape new 
shape1: s1; 
shape2: c2.

es := c elementsOn: #(30 60 80).
es @ RTDraggable.
v addAll: es.

RTHorizontalLineLayout on: v elements.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Are we happy with RTVerticalCompositeShape, RTHorizontalCompositeShape and RTCompositeShape ?

If yes, then RTLabelling (and its problem of passing the view along :-) will be obsolete.

Cheers,
Alexandre
-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev




--
Leo Perard