Edge driven layout on groups - bug and correction

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Edge driven layout on groups - bug and correction

Usman Bhatti
Hi,

We spotted a bug related to edge driven layouts and groups. So, when a view has groups in it, performing an edge driven layout gives MNU: RTGroup>>view.

The bug can be reproduced with the following script in latest Roassal. 

view := RTView new.
group1 := RTGroup new add: (RTBox new elementOn: 1); yourself.
group2 := RTGroup new add: (RTEllipse new elementOn: 2); yourself.
view addAll: group1; addAll: group2.
RTForceBasedLayout on: (RTGroup with: group1 with: group2).
view open

The link to get the version with changes (because problem posting more than 1 mb on this list):

All tests are green after the change.

Alex, can you integrate this in Roassal because it is important for our work.

tx,

Usman & Leo



_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Edge driven layout on groups - bug and correction

abergel
Hi Usman,

In your example, I would expect to have the layout applied on the two groups. Each group should therefore stay grouped. There is a bug, indeed. But I do not see how your version of Roassal2 solves the situation. I have found and fixed the problem. I think it will also work for you. 

Update Roassal and try the following:
-=-=-=-=-=-=-=-=-=-=-=-=
view := RTView new.

es1 := (RTEllipse new color: Color lightRed; size: 20) elementsOn: (1 to: 20).
RTForceBasedLayout on: es1.
view addAll: es1.

es2 := (RTEllipse new color: Color lightGreen; size: 20) elementsOn: (1 to: 20).
RTForceBasedLayout on: es2.
view addAll: es2.

es3 := (RTEllipse new color: Color lightBlue; size: 20) elementsOn: (1 to: 20).
RTForceBasedLayout on: es3.
view addAll: es3.

RTForceBasedLayout new 
charge: -800;
on: (Array with: es1 with: es2 with: es3).
view open
-=-=-=-=-=-=-=-=-=-=-=-=

It will produce the following:

Alexandre

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



On Aug 1, 2014, at 12:25 PM, Usman Bhatti <[hidden email]> wrote:

Hi,

We spotted a bug related to edge driven layouts and groups. So, when a view has groups in it, performing an edge driven layout gives MNU: RTGroup>>view.

The bug can be reproduced with the following script in latest Roassal. 

view := RTView new.
group1 := RTGroup new add: (RTBox new elementOn: 1); yourself.
group2 := RTGroup new add: (RTEllipse new elementOn: 2); yourself.
view addAll: group1; addAll: group2.
RTForceBasedLayout on: (RTGroup with: group1 with: group2).
view open

The link to get the version with changes (because problem posting more than 1 mb on this list):

All tests are green after the change.

Alex, can you integrate this in Roassal because it is important for our work.

tx,

Usman & Leo


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Edge driven layout on groups - bug and correction

Usman Bhatti
Hi Alex,

The problem is not complete resolved because RTGroup is not RTElement and layouts are supposed to work on RTElement(s). Hence, for example, applying layouts amongst groups does not work. So, changing the layout in your script exposes the problem:

view := RTView new. es1 := (RTEllipse new color: Color lightRed; size: 20) elementsOn: (1 to: 20). RTForceBasedLayout on: es1. view addAll: es1. es2 := (RTEllipse new color: Color lightGreen; size: 20) elementsOn: (1 to: 20). RTForceBasedLayout on: es2. view addAll: es2. es3 := (RTEllipse new color: Color lightBlue; size: 20) elementsOn: (1 to: 20). RTForceBasedLayout on: es3. view addAll: es3. RTClusterLayout new on: (Array with: es1 with: es2 with: es3). view open

So, some layouts need to be adapted to know how to layout not only elements (RTElement) but also groups (RTGroup).

regards,

usman

On Wed, Aug 6, 2014 at 11:08 PM, Alexandre Bergel <[hidden email]> wrote:
Hi Usman,

In your example, I would expect to have the layout applied on the two groups. Each group should therefore stay grouped. There is a bug, indeed. But I do not see how your version of Roassal2 solves the situation. I have found and fixed the problem. I think it will also work for you. 

Update Roassal and try the following:
-=-=-=-=-=-=-=-=-=-=-=-=
view := RTView new.

es1 := (RTEllipse new color: Color lightRed; size: 20) elementsOn: (1 to: 20).
RTForceBasedLayout on: es1.
view addAll: es1.

es2 := (RTEllipse new color: Color lightGreen; size: 20) elementsOn: (1 to: 20).
RTForceBasedLayout on: es2.
view addAll: es2.

es3 := (RTEllipse new color: Color lightBlue; size: 20) elementsOn: (1 to: 20).
RTForceBasedLayout on: es3.
view addAll: es3.

RTForceBasedLayout new 
charge: -800;
on: (Array with: es1 with: es2 with: es3).
view open
-=-=-=-=-=-=-=-=-=-=-=-=

It will produce the following:

Alexandre

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



On Aug 1, 2014, at 12:25 PM, Usman Bhatti <[hidden email]> wrote:

Hi,

We spotted a bug related to edge driven layouts and groups. So, when a view has groups in it, performing an edge driven layout gives MNU: RTGroup>>view.

The bug can be reproduced with the following script in latest Roassal. 

view := RTView new.
group1 := RTGroup new add: (RTBox new elementOn: 1); yourself.
group2 := RTGroup new add: (RTEllipse new elementOn: 2); yourself.
view addAll: group1; addAll: group2.
RTForceBasedLayout on: (RTGroup with: group1 with: group2).
view open

The link to get the version with changes (because problem posting more than 1 mb on this list):

All tests are green after the change.

Alex, can you integrate this in Roassal because it is important for our work.

tx,

Usman & Leo


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev



_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Edge driven layout on groups - bug and correction

abergel
Hi Usman!

You’re very right. I have fixed the layout. The following script does not generate any error.

-=-=-=-=-=-=-=-=
v := RTView new.
es := (RTEllipse new size: 20) elementsOn: (1 to: 30).
v addAll: es.
(RTLayout withAllSubclasses reject: #isAbstract) do: [ :l | 
l new on: (RTGroup with: es) ].
v
-=-=-=-=-=-=-=-=

Cheers,
Alexandre

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



On Aug 7, 2014, at 6:17 AM, Usman Bhatti <[hidden email]> wrote:

Hi Alex,

The problem is not complete resolved because RTGroup is not RTElement and layouts are supposed to work on RTElement(s). Hence, for example, applying layouts amongst groups does not work. So, changing the layout in your script exposes the problem:

view := RTView new. es1 := (RTEllipse new color: Color lightRed; size: 20) elementsOn: (1 to: 20). RTForceBasedLayout on: es1. view addAll: es1. es2 := (RTEllipse new color: Color lightGreen; size: 20) elementsOn: (1 to: 20). RTForceBasedLayout on: es2. view addAll: es2. es3 := (RTEllipse new color: Color lightBlue; size: 20) elementsOn: (1 to: 20). RTForceBasedLayout on: es3. view addAll: es3. RTClusterLayout new on: (Array with: es1 with: es2 with: es3). view open

So, some layouts need to be adapted to know how to layout not only elements (RTElement) but also groups (RTGroup).

regards,

usman

On Wed, Aug 6, 2014 at 11:08 PM, Alexandre Bergel <[hidden email]> wrote:
Hi Usman,

In your example, I would expect to have the layout applied on the two groups. Each group should therefore stay grouped. There is a bug, indeed. But I do not see how your version of Roassal2 solves the situation. I have found and fixed the problem. I think it will also work for you. 

Update Roassal and try the following:
-=-=-=-=-=-=-=-=-=-=-=-=
view := RTView new.

es1 := (RTEllipse new color: Color lightRed; size: 20) elementsOn: (1 to: 20).
RTForceBasedLayout on: es1.
view addAll: es1.

es2 := (RTEllipse new color: Color lightGreen; size: 20) elementsOn: (1 to: 20).
RTForceBasedLayout on: es2.
view addAll: es2.

es3 := (RTEllipse new color: Color lightBlue; size: 20) elementsOn: (1 to: 20).
RTForceBasedLayout on: es3.
view addAll: es3.

RTForceBasedLayout new 
charge: -800;
on: (Array with: es1 with: es2 with: es3).
view open
-=-=-=-=-=-=-=-=-=-=-=-=

It will produce the following:
<Screen Shot 2014-08-06 at 5.08.14 PM.png>

Alexandre

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



On Aug 1, 2014, at 12:25 PM, Usman Bhatti <[hidden email]> wrote:

Hi,

We spotted a bug related to edge driven layouts and groups. So, when a view has groups in it, performing an edge driven layout gives MNU: RTGroup>>view.

The bug can be reproduced with the following script in latest Roassal. 

view := RTView new.
group1 := RTGroup new add: (RTBox new elementOn: 1); yourself.
group2 := RTGroup new add: (RTEllipse new elementOn: 2); yourself.
view addAll: group1; addAll: group2.
RTForceBasedLayout on: (RTGroup with: group1 with: group2).
view open

The link to get the version with changes (because problem posting more than 1 mb on this list):

All tests are green after the change.

Alex, can you integrate this in Roassal because it is important for our work.

tx,

Usman & Leo


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev