Centering edges over composites

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

Centering edges over composites

hernanmd
Hi,

When connecting two composite shapes with RTEdgeBuilder, the connector
position loose its center over the connecting shapes.

It's easier to explain with two scripts:

This one looks good, the connector (RTArrowedLine) is centered:

| view shapes myElems |
view := RTView new.
myElems := 1 to: 2.
shapes := (RTSVGPath new
    path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C 22.489583,23.8125
17.197917,34.395833 3.96875,27.78125 Z';
    fillColor: Color red;
    borderColor: Color black;
    borderWidth: 1.2;
    scale: 1.4) elementsOn: myElems.
view addAll: shapes.
RTEdgeBuilder new
    view: view;
    shape: (RTArrowedLine new
        color: Color white;
        yourself);
    elements: shapes;
    connectFrom: 1 to: 2.
RTTreeLayout new
    verticalGap: 30;
    horizontalGap: 30;
    applyOn: shapes.
view inspect.

However when adding a label in a composite, both label and arrow looks shifted:

| view shape shapes myElems |
view := RTView new.
myElems := 1 to: 2.
shape := RTCompositeShape new
    add: (RTLabel new text: 'Test');
    add: (RTSVGPath new
        path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C
22.489583,23.8125 17.197917,34.395833 3.96875,27.78125 Z';
        fillColor: Color red;
        borderColor: Color black;
        borderWidth: 1.2;
        scale: 1.4);
    vertical;
    yourself.
shapes := shape elementsOn: myElems.
view addAll: shapes.
RTEdgeBuilder new
    view: view;
    shape: (RTArrowedLine new
        color: Color white;
        yourself);
    elements: shapes;
    connectFrom: 1 to: 2.
RTTreeLayout new
    verticalGap: 30;
    horizontalGap: 30;
    applyOn: shapes.
view inspect.

Any idea how to align these shapes?

Cheers,

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

Re: Centering edges over composites

hernanmd
Attached screenshots just in case someone has a clue.
Cheers,

Hernán


2018-08-23 14:31 GMT-03:00 Hernán Morales Durand <[hidden email]>:

> Hi,
>
> When connecting two composite shapes with RTEdgeBuilder, the connector
> position loose its center over the connecting shapes.
>
> It's easier to explain with two scripts:
>
> This one looks good, the connector (RTArrowedLine) is centered:
>
> | view shapes myElems |
> view := RTView new.
> myElems := 1 to: 2.
> shapes := (RTSVGPath new
>     path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C 22.489583,23.8125
> 17.197917,34.395833 3.96875,27.78125 Z';
>     fillColor: Color red;
>     borderColor: Color black;
>     borderWidth: 1.2;
>     scale: 1.4) elementsOn: myElems.
> view addAll: shapes.
> RTEdgeBuilder new
>     view: view;
>     shape: (RTArrowedLine new
>         color: Color white;
>         yourself);
>     elements: shapes;
>     connectFrom: 1 to: 2.
> RTTreeLayout new
>     verticalGap: 30;
>     horizontalGap: 30;
>     applyOn: shapes.
> view inspect.
>
> However when adding a label in a composite, both label and arrow looks shifted:
>
> | view shape shapes myElems |
> view := RTView new.
> myElems := 1 to: 2.
> shape := RTCompositeShape new
>     add: (RTLabel new text: 'Test');
>     add: (RTSVGPath new
>         path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C
> 22.489583,23.8125 17.197917,34.395833 3.96875,27.78125 Z';
>         fillColor: Color red;
>         borderColor: Color black;
>         borderWidth: 1.2;
>         scale: 1.4);
>     vertical;
>     yourself.
> shapes := shape elementsOn: myElems.
> view addAll: shapes.
> RTEdgeBuilder new
>     view: view;
>     shape: (RTArrowedLine new
>         color: Color white;
>         yourself);
>     elements: shapes;
>     connectFrom: 1 to: 2.
> RTTreeLayout new
>     verticalGap: 30;
>     horizontalGap: 30;
>     applyOn: shapes.
> view inspect.
>
> Any idea how to align these shapes?
>
> Cheers,
>
> Hernán

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

RT_aligned-figs.jpg (3K) Download Attachment
RT_unaligned-figs.jpg (5K) Download Attachment
cbc
Reply | Threaded
Open this post in threaded view
|

Re: Centering edges over composites

cbc
Hi, 
I looks like the arrow is still centered on the shapes; it is just that the 'shapes' are now composite shapes consisting of the text 'Test' and the drawn/filled shape.

What I think you want is a way to connect the arrows between the SVG sub-shapes, correct?  I am not sure (at all) how to do that.

-cbc

On Tue, Aug 28, 2018 at 12:04 PM Hernán Morales Durand <[hidden email]> wrote:
Attached screenshots just in case someone has a clue.
Cheers,

Hernán


2018-08-23 14:31 GMT-03:00 Hernán Morales Durand <[hidden email]>:
> Hi,
>
> When connecting two composite shapes with RTEdgeBuilder, the connector
> position loose its center over the connecting shapes.
>
> It's easier to explain with two scripts:
>
> This one looks good, the connector (RTArrowedLine) is centered:
>
> | view shapes myElems |
> view := RTView new.
> myElems := 1 to: 2.
> shapes := (RTSVGPath new
>     path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C 22.489583,23.8125
> 17.197917,34.395833 3.96875,27.78125 Z';
>     fillColor: Color red;
>     borderColor: Color black;
>     borderWidth: 1.2;
>     scale: 1.4) elementsOn: myElems.
> view addAll: shapes.
> RTEdgeBuilder new
>     view: view;
>     shape: (RTArrowedLine new
>         color: Color white;
>         yourself);
>     elements: shapes;
>     connectFrom: 1 to: 2.
> RTTreeLayout new
>     verticalGap: 30;
>     horizontalGap: 30;
>     applyOn: shapes.
> view inspect.
>
> However when adding a label in a composite, both label and arrow looks shifted:
>
> | view shape shapes myElems |
> view := RTView new.
> myElems := 1 to: 2.
> shape := RTCompositeShape new
>     add: (RTLabel new text: 'Test');
>     add: (RTSVGPath new
>         path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C
> 22.489583,23.8125 17.197917,34.395833 3.96875,27.78125 Z';
>         fillColor: Color red;
>         borderColor: Color black;
>         borderWidth: 1.2;
>         scale: 1.4);
>     vertical;
>     yourself.
> shapes := shape elementsOn: myElems.
> view addAll: shapes.
> RTEdgeBuilder new
>     view: view;
>     shape: (RTArrowedLine new
>         color: Color white;
>         yourself);
>     elements: shapes;
>     connectFrom: 1 to: 2.
> RTTreeLayout new
>     verticalGap: 30;
>     horizontalGap: 30;
>     applyOn: shapes.
> view inspect.
>
> Any idea how to align these shapes?
>
> Cheers,
>
> Hernán
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev

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

Re: Centering edges over composites

hernanmd
Hi Chris,

I attached a screenshot of the desired result. It seems to me the
problem is not where the arrow is connected, but the Tree Layout,
which is positioning the "Test" label as if it would be the root of a
tree with the svg figures as their leaves. I still don't get how to
apply a vertical layout (not tree) to a RTCompositeShape, assuming
that could be a reasonable solution.
Cheers,

Hernán


2018-08-28 18:25 GMT-03:00 Chris Cunningham <[hidden email]>:

> Hi,
> I looks like the arrow is still centered on the shapes; it is just that the
> 'shapes' are now composite shapes consisting of the text 'Test' and the
> drawn/filled shape.
>
> What I think you want is a way to connect the arrows between the SVG
> sub-shapes, correct?  I am not sure (at all) how to do that.
>
> -cbc
>
> On Tue, Aug 28, 2018 at 12:04 PM Hernán Morales Durand
> <[hidden email]> wrote:
>>
>> Attached screenshots just in case someone has a clue.
>> Cheers,
>>
>> Hernán
>>
>>
>> 2018-08-23 14:31 GMT-03:00 Hernán Morales Durand
>> <[hidden email]>:
>> > Hi,
>> >
>> > When connecting two composite shapes with RTEdgeBuilder, the connector
>> > position loose its center over the connecting shapes.
>> >
>> > It's easier to explain with two scripts:
>> >
>> > This one looks good, the connector (RTArrowedLine) is centered:
>> >
>> > | view shapes myElems |
>> > view := RTView new.
>> > myElems := 1 to: 2.
>> > shapes := (RTSVGPath new
>> >     path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C 22.489583,23.8125
>> > 17.197917,34.395833 3.96875,27.78125 Z';
>> >     fillColor: Color red;
>> >     borderColor: Color black;
>> >     borderWidth: 1.2;
>> >     scale: 1.4) elementsOn: myElems.
>> > view addAll: shapes.
>> > RTEdgeBuilder new
>> >     view: view;
>> >     shape: (RTArrowedLine new
>> >         color: Color white;
>> >         yourself);
>> >     elements: shapes;
>> >     connectFrom: 1 to: 2.
>> > RTTreeLayout new
>> >     verticalGap: 30;
>> >     horizontalGap: 30;
>> >     applyOn: shapes.
>> > view inspect.
>> >
>> > However when adding a label in a composite, both label and arrow looks
>> > shifted:
>> >
>> > | view shape shapes myElems |
>> > view := RTView new.
>> > myElems := 1 to: 2.
>> > shape := RTCompositeShape new
>> >     add: (RTLabel new text: 'Test');
>> >     add: (RTSVGPath new
>> >         path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C
>> > 22.489583,23.8125 17.197917,34.395833 3.96875,27.78125 Z';
>> >         fillColor: Color red;
>> >         borderColor: Color black;
>> >         borderWidth: 1.2;
>> >         scale: 1.4);
>> >     vertical;
>> >     yourself.
>> > shapes := shape elementsOn: myElems.
>> > view addAll: shapes.
>> > RTEdgeBuilder new
>> >     view: view;
>> >     shape: (RTArrowedLine new
>> >         color: Color white;
>> >         yourself);
>> >     elements: shapes;
>> >     connectFrom: 1 to: 2.
>> > RTTreeLayout new
>> >     verticalGap: 30;
>> >     horizontalGap: 30;
>> >     applyOn: shapes.
>> > view inspect.
>> >
>> > Any idea how to align these shapes?
>> >
>> > Cheers,
>> >
>> > Hernán
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.list.inf.unibe.ch/listinfo/moose-dev
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.list.inf.unibe.ch/listinfo/moose-dev
>

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

Aligned_Test.jpg (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Centering edges over composites

abergel
In reply to this post by hernanmd
Hi!

An easy thing to do, is to make the elements labeled. Which is different than creating a composite shape (I can detail why there are two ways to label elements).

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
| view shapes myElems |
view := RTView new.
myElems := 1 to: 2.
shapes := (RTSVGPath new
   path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C 22.489583,23.8125
17.197917,34.395833 3.96875,27.78125 Z';
   fillColor: Color red;
   borderColor: Color black;
   borderWidth: 1.2;
   scale: 1.4) elementsOn: myElems.
view addAll: shapes.
shapes @ (RTLabeled new text: 'hello').
RTEdgeBuilder new
   view: view;
   shape: (RTArrowedLine new
       color: Color black;
       yourself);
   elements: shapes;
   connectFrom: 1 to: 2.
RTTreeLayout new
   verticalGap: 30;
   horizontalGap: 30;
   applyOn: shapes.
view inspect.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Here is the result


Cheers,
Alexandre


On Aug 23, 2018, at 2:31 PM, Hernán Morales Durand <[hidden email]> wrote:

Hi,

When connecting two composite shapes with RTEdgeBuilder, the connector
position loose its center over the connecting shapes.

It's easier to explain with two scripts:

This one looks good, the connector (RTArrowedLine) is centered:

| view shapes myElems |
view := RTView new.
myElems := 1 to: 2.
shapes := (RTSVGPath new
   path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C 22.489583,23.8125
17.197917,34.395833 3.96875,27.78125 Z';
   fillColor: Color red;
   borderColor: Color black;
   borderWidth: 1.2;
   scale: 1.4) elementsOn: myElems.
view addAll: shapes.
RTEdgeBuilder new
   view: view;
   shape: (RTArrowedLine new
       color: Color white;
       yourself);
   elements: shapes;
   connectFrom: 1 to: 2.
RTTreeLayout new
   verticalGap: 30;
   horizontalGap: 30;
   applyOn: shapes.
view inspect.

However when adding a label in a composite, both label and arrow looks shifted:

| view shape shapes myElems |
view := RTView new.
myElems := 1 to: 2.
shape := RTCompositeShape new
   add: (RTLabel new text: 'Test');
   add: (RTSVGPath new
       path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C
22.489583,23.8125 17.197917,34.395833 3.96875,27.78125 Z';
       fillColor: Color red;
       borderColor: Color black;
       borderWidth: 1.2;
       scale: 1.4);
   vertical;
   yourself.
shapes := shape elementsOn: myElems.
view addAll: shapes.
RTEdgeBuilder new
   view: view;
   shape: (RTArrowedLine new
       color: Color white;
       yourself);
   elements: shapes;
   connectFrom: 1 to: 2.
RTTreeLayout new
   verticalGap: 30;
   horizontalGap: 30;
   applyOn: shapes.
view inspect.

Any idea how to align these shapes?

Cheers,

Hernán
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev


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

Re: Centering edges over composites

hernanmd
Hi Alex,

My problem using labeled elements is that adding another box, labeled text gets overlaped:

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
| view shapes myElems |
view := RTView new.
myElems := 1 to: 3.
shapes := (RTSVGPath new
   path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C 22.489583,23.8125
17.197917,34.395833 3.96875,27.78125 Z';
   fillColor: Color red;
   borderColor: Color black;
   borderWidth: 1.2;
   scale: 1.4) elementsOn: myElems.
view addAll: shapes.
shapes @ (RTLabeled new text: 'Long text message').
RTEdgeBuilder new
   view: view;
   shape: (RTArrowedLine new
       color: Color black;
       yourself);
   elements: shapes;
   connectFrom: 1 to: 3.
RTTreeLayout new
   verticalGap: 30;
   horizontalGap: 30;
   applyOn: shapes.
view inspect.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Maybe another suggestion?

Cheers,

Hernán


2018-08-29 22:09 GMT-03:00 Alexandre Bergel <[hidden email]>:
Hi!

An easy thing to do, is to make the elements labeled. Which is different than creating a composite shape (I can detail why there are two ways to label elements).

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
| view shapes myElems |
view := RTView new.
myElems := 1 to: 2.
shapes := (RTSVGPath new
   path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C 22.489583,23.8125
17.197917,34.395833 3.96875,27.78125 Z';
   fillColor: Color red;
   borderColor: Color black;
   borderWidth: 1.2;
   scale: 1.4) elementsOn: myElems.
view addAll: shapes.
shapes @ (RTLabeled new text: 'hello').
RTEdgeBuilder new
   view: view;
   shape: (RTArrowedLine new
       color: Color black;
       yourself);
   elements: shapes;
   connectFrom: 1 to: 2.
RTTreeLayout new
   verticalGap: 30;
   horizontalGap: 30;
   applyOn: shapes.
view inspect.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Here is the result


Cheers,
Alexandre


On Aug 23, 2018, at 2:31 PM, Hernán Morales Durand <[hidden email]> wrote:

Hi,

When connecting two composite shapes with RTEdgeBuilder, the connector
position loose its center over the connecting shapes.

It's easier to explain with two scripts:

This one looks good, the connector (RTArrowedLine) is centered:

| view shapes myElems |
view := RTView new.
myElems := 1 to: 2.
shapes := (RTSVGPath new
   path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C 22.489583,23.8125
17.197917,34.395833 3.96875,27.78125 Z';
   fillColor: Color red;
   borderColor: Color black;
   borderWidth: 1.2;
   scale: 1.4) elementsOn: myElems.
view addAll: shapes.
RTEdgeBuilder new
   view: view;
   shape: (RTArrowedLine new
       color: Color white;
       yourself);
   elements: shapes;
   connectFrom: 1 to: 2.
RTTreeLayout new
   verticalGap: 30;
   horizontalGap: 30;
   applyOn: shapes.
view inspect.

However when adding a label in a composite, both label and arrow looks shifted:

| view shape shapes myElems |
view := RTView new.
myElems := 1 to: 2.
shape := RTCompositeShape new
   add: (RTLabel new text: 'Test');
   add: (RTSVGPath new
       path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C
22.489583,23.8125 17.197917,34.395833 3.96875,27.78125 Z';
       fillColor: Color red;
       borderColor: Color black;
       borderWidth: 1.2;
       scale: 1.4);
   vertical;
   yourself.
shapes := shape elementsOn: myElems.
view addAll: shapes.
RTEdgeBuilder new
   view: view;
   shape: (RTArrowedLine new
       color: Color white;
       yourself);
   elements: shapes;
   connectFrom: 1 to: 2.
RTTreeLayout new
   verticalGap: 30;
   horizontalGap: 30;
   applyOn: shapes.
view inspect.

Any idea how to align these shapes?

Cheers,

Hernán
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev


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



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

Align_Test2.png (20K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Centering edges over composites

abergel
Hi!

Just to make sure I have not missed anything. You told me on discord that you fixed the problem, don’t you? What is your solution?

Cheers,
Alexandre


> On Aug 29, 2018, at 10:35 PM, Hernán Morales Durand <[hidden email]> wrote:
>
> Hi Alex,
>
> My problem using labeled elements is that adding another box, labeled text gets overlaped:
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> | view shapes myElems |
> view := RTView new.
> myElems := 1 to: 3.
> shapes := (RTSVGPath new
>    path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C 22.489583,23.8125
> 17.197917,34.395833 3.96875,27.78125 Z';
>    fillColor: Color red;
>    borderColor: Color black;
>    borderWidth: 1.2;
>    scale: 1.4) elementsOn: myElems.
> view addAll: shapes.
> shapes @ (RTLabeled new text: 'Long text message').
> RTEdgeBuilder new
>    view: view;
>    shape: (RTArrowedLine new
>        color: Color black;
>        yourself);
>    elements: shapes;
>    connectFrom: 1 to: 3.
> RTTreeLayout new
>    verticalGap: 30;
>    horizontalGap: 30;
>    applyOn: shapes.
> view inspect.
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
> Maybe another suggestion?
>
> Cheers,
>
> Hernán
>
>
> 2018-08-29 22:09 GMT-03:00 Alexandre Bergel <[hidden email]>:
> Hi!
>
> An easy thing to do, is to make the elements labeled. Which is different than creating a composite shape (I can detail why there are two ways to label elements).
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> | view shapes myElems |
> view := RTView new.
> myElems := 1 to: 2.
> shapes := (RTSVGPath new
>    path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C 22.489583,23.8125
> 17.197917,34.395833 3.96875,27.78125 Z';
>    fillColor: Color red;
>    borderColor: Color black;
>    borderWidth: 1.2;
>    scale: 1.4) elementsOn: myElems.
> view addAll: shapes.
> shapes @ (RTLabeled new text: 'hello').
> RTEdgeBuilder new
>    view: view;
>    shape: (RTArrowedLine new
>        color: Color black;
>        yourself);
>    elements: shapes;
>    connectFrom: 1 to: 2.
> RTTreeLayout new
>    verticalGap: 30;
>    horizontalGap: 30;
>    applyOn: shapes.
> view inspect.
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
> Here is the result
> <Screenshot 2018-08-28 15.32.19.png>
>
>
> Cheers,
> Alexandre
>
>
>> On Aug 23, 2018, at 2:31 PM, Hernán Morales Durand <[hidden email]> wrote:
>>
>> Hi,
>>
>> When connecting two composite shapes with RTEdgeBuilder, the connector
>> position loose its center over the connecting shapes.
>>
>> It's easier to explain with two scripts:
>>
>> This one looks good, the connector (RTArrowedLine) is centered:
>>
>> | view shapes myElems |
>> view := RTView new.
>> myElems := 1 to: 2.
>> shapes := (RTSVGPath new
>>    path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C 22.489583,23.8125
>> 17.197917,34.395833 3.96875,27.78125 Z';
>>    fillColor: Color red;
>>    borderColor: Color black;
>>    borderWidth: 1.2;
>>    scale: 1.4) elementsOn: myElems.
>> view addAll: shapes.
>> RTEdgeBuilder new
>>    view: view;
>>    shape: (RTArrowedLine new
>>        color: Color white;
>>        yourself);
>>    elements: shapes;
>>    connectFrom: 1 to: 2.
>> RTTreeLayout new
>>    verticalGap: 30;
>>    horizontalGap: 30;
>>    applyOn: shapes.
>> view inspect.
>>
>> However when adding a label in a composite, both label and arrow looks shifted:
>>
>> | view shape shapes myElems |
>> view := RTView new.
>> myElems := 1 to: 2.
>> shape := RTCompositeShape new
>>    add: (RTLabel new text: 'Test');
>>    add: (RTSVGPath new
>>        path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C
>> 22.489583,23.8125 17.197917,34.395833 3.96875,27.78125 Z';
>>        fillColor: Color red;
>>        borderColor: Color black;
>>        borderWidth: 1.2;
>>        scale: 1.4);
>>    vertical;
>>    yourself.
>> shapes := shape elementsOn: myElems.
>> view addAll: shapes.
>> RTEdgeBuilder new
>>    view: view;
>>    shape: (RTArrowedLine new
>>        color: Color white;
>>        yourself);
>>    elements: shapes;
>>    connectFrom: 1 to: 2.
>> RTTreeLayout new
>>    verticalGap: 30;
>>    horizontalGap: 30;
>>    applyOn: shapes.
>> view inspect.
>>
>> Any idea how to align these shapes?
>>
>> Cheers,
>>
>> Hernán
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.list.inf.unibe.ch/listinfo/moose-dev
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.list.inf.unibe.ch/listinfo/moose-dev
>
>
> <Align_Test2.png>_______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.list.inf.unibe.ch/listinfo/moose-dev

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

Re: Centering edges over composites

hernanmd
Hi Alex,

I didn't posted yet because my workaround is unfinished, it needs more
work, but is a start (didn't tested for other cases, etc).

Note that it works connecting multiple edges:

| view shapes myElems |
view := RTView new.
myElems := 1 to: 7.
shapes := RTCompositeShape new
    add: (RTText new text: 'Long text message');
    add: (RTSVGPath new
   path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C 22.489583,23.8125
17.197917,34.395833 3.96875,27.78125 Z';
        fillColor: Color red;
        borderColor: Color black;
        borderWidth: 1.2;
        scale: 1.4);
    alignCenter;
    elementsOn: myElems.

RTEdgeBuilder new
   view: view;
   shape: (RTArrowedLine new
       color: Color white;
       yourself);
   elements: shapes;
    connectFrom: 2 to: 4;
    connectFrom: 2 to: 5;
    connectFrom: 2 to: 7;
    connectFrom: 1 to: 2;
    connectFrom: 3 to: 2;
    connectFrom: 6 to: 2.

RTTreeLayout new
   verticalGap: 30;
   horizontalGap: 30;
   applyOn: shapes.

view addAll: shapes.
view inspect.


But it doesn't work for connecting two composites:

| view shapes myElems |
view := RTView new.
view @ RTDraggableView.
myElems := 1 to: 2.
shapes := RTCompositeShape new
    add: (RTLabel new text: 'Test');
    add: (RTSVGPath new
        path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C
22.489583,23.8125 17.197917,34.395833 3.96875,27.78125 Z';
        fillColor: Color red;
        borderColor: Color black;
        borderWidth: 1.2;
        scale: 1.4);
    alignCenter;
    elementsOn: myElems.
RTEdgeBuilder new
    view: view;
    shape: (RTArrowedLine new
        color: Color white;
        yourself);
    elements: shapes;
    connectFrom: 1 to: 2.
RTTreeLayout new
    verticalGap: 30;
    horizontalGap: 10;
    applyOn: shapes.
view addAll: shapes.
view inspect.

Doing some experiments the following frightening modification aligns
the two labeled composites, obviously destroying all other cases:

>>alignFromCenterUsing: anElement
    | topX newX topY newY |

    topX := anElement encompassingRectangle center x.
    topY := anElement encompassingRectangle center y.
    elements do: [ :s |
        newX := topX + (s encompassingRectangle width / 2).
        newY := topY + (s encompassingRectangle height / 2).
        (s isKindOf: TRLabelShape)
            ifTrue: [ s translateTo: newX @ newY ]
            ifFalse: [ s translateTo: (topX / 2) @ (newY) ]
    ]

I would love to have more time to learn RTAlignment, but unfortunately
I'm on a deadline.
You may find the coded attached to this mail.

Cheers,

Hernán



2018-08-31 22:03 GMT-03:00 Alexandre Bergel <[hidden email]>:

> Hi!
>
> Just to make sure I have not missed anything. You told me on discord that you fixed the problem, don’t you? What is your solution?
>
> Cheers,
> Alexandre
>
>
>> On Aug 29, 2018, at 10:35 PM, Hernán Morales Durand <[hidden email]> wrote:
>>
>> Hi Alex,
>>
>> My problem using labeled elements is that adding another box, labeled text gets overlaped:
>>
>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>> | view shapes myElems |
>> view := RTView new.
>> myElems := 1 to: 3.
>> shapes := (RTSVGPath new
>>    path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C 22.489583,23.8125
>> 17.197917,34.395833 3.96875,27.78125 Z';
>>    fillColor: Color red;
>>    borderColor: Color black;
>>    borderWidth: 1.2;
>>    scale: 1.4) elementsOn: myElems.
>> view addAll: shapes.
>> shapes @ (RTLabeled new text: 'Long text message').
>> RTEdgeBuilder new
>>    view: view;
>>    shape: (RTArrowedLine new
>>        color: Color black;
>>        yourself);
>>    elements: shapes;
>>    connectFrom: 1 to: 3.
>> RTTreeLayout new
>>    verticalGap: 30;
>>    horizontalGap: 30;
>>    applyOn: shapes.
>> view inspect.
>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>>
>> Maybe another suggestion?
>>
>> Cheers,
>>
>> Hernán
>>
>>
>> 2018-08-29 22:09 GMT-03:00 Alexandre Bergel <[hidden email]>:
>> Hi!
>>
>> An easy thing to do, is to make the elements labeled. Which is different than creating a composite shape (I can detail why there are two ways to label elements).
>>
>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>> | view shapes myElems |
>> view := RTView new.
>> myElems := 1 to: 2.
>> shapes := (RTSVGPath new
>>    path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C 22.489583,23.8125
>> 17.197917,34.395833 3.96875,27.78125 Z';
>>    fillColor: Color red;
>>    borderColor: Color black;
>>    borderWidth: 1.2;
>>    scale: 1.4) elementsOn: myElems.
>> view addAll: shapes.
>> shapes @ (RTLabeled new text: 'hello').
>> RTEdgeBuilder new
>>    view: view;
>>    shape: (RTArrowedLine new
>>        color: Color black;
>>        yourself);
>>    elements: shapes;
>>    connectFrom: 1 to: 2.
>> RTTreeLayout new
>>    verticalGap: 30;
>>    horizontalGap: 30;
>>    applyOn: shapes.
>> view inspect.
>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>>
>> Here is the result
>> <Screenshot 2018-08-28 15.32.19.png>
>>
>>
>> Cheers,
>> Alexandre
>>
>>
>>> On Aug 23, 2018, at 2:31 PM, Hernán Morales Durand <[hidden email]> wrote:
>>>
>>> Hi,
>>>
>>> When connecting two composite shapes with RTEdgeBuilder, the connector
>>> position loose its center over the connecting shapes.
>>>
>>> It's easier to explain with two scripts:
>>>
>>> This one looks good, the connector (RTArrowedLine) is centered:
>>>
>>> | view shapes myElems |
>>> view := RTView new.
>>> myElems := 1 to: 2.
>>> shapes := (RTSVGPath new
>>>    path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C 22.489583,23.8125
>>> 17.197917,34.395833 3.96875,27.78125 Z';
>>>    fillColor: Color red;
>>>    borderColor: Color black;
>>>    borderWidth: 1.2;
>>>    scale: 1.4) elementsOn: myElems.
>>> view addAll: shapes.
>>> RTEdgeBuilder new
>>>    view: view;
>>>    shape: (RTArrowedLine new
>>>        color: Color white;
>>>        yourself);
>>>    elements: shapes;
>>>    connectFrom: 1 to: 2.
>>> RTTreeLayout new
>>>    verticalGap: 30;
>>>    horizontalGap: 30;
>>>    applyOn: shapes.
>>> view inspect.
>>>
>>> However when adding a label in a composite, both label and arrow looks shifted:
>>>
>>> | view shape shapes myElems |
>>> view := RTView new.
>>> myElems := 1 to: 2.
>>> shape := RTCompositeShape new
>>>    add: (RTLabel new text: 'Test');
>>>    add: (RTSVGPath new
>>>        path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C
>>> 22.489583,23.8125 17.197917,34.395833 3.96875,27.78125 Z';
>>>        fillColor: Color red;
>>>        borderColor: Color black;
>>>        borderWidth: 1.2;
>>>        scale: 1.4);
>>>    vertical;
>>>    yourself.
>>> shapes := shape elementsOn: myElems.
>>> view addAll: shapes.
>>> RTEdgeBuilder new
>>>    view: view;
>>>    shape: (RTArrowedLine new
>>>        color: Color white;
>>>        yourself);
>>>    elements: shapes;
>>>    connectFrom: 1 to: 2.
>>> RTTreeLayout new
>>>    verticalGap: 30;
>>>    horizontalGap: 30;
>>>    applyOn: shapes.
>>> view inspect.
>>>
>>> Any idea how to align these shapes?
>>>
>>> Cheers,
>>>
>>> Hernán
>>> _______________________________________________
>>> Moose-dev mailing list
>>> [hidden email]
>>> https://www.list.inf.unibe.ch/listinfo/moose-dev
>>
>>
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.list.inf.unibe.ch/listinfo/moose-dev
>>
>>
>> <Align_Test2.png>_______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.list.inf.unibe.ch/listinfo/moose-dev
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.list.inf.unibe.ch/listinfo/moose-dev

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

TRCompositeShape-alignCenter.st (524 bytes) Download Attachment
RTCompositeShape-#RT-Extensions.st (324 bytes) Download Attachment
RTAlignment-#RT-Extensions.st (1K) Download Attachment
Multiple_Composites.png (53K) Download Attachment
Two_Composites.png (13K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Centering edges over composites

abergel
Hi Hernán,

Your code is now in Roassal. Thanks!

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



On Sep 1, 2018, at 2:31 AM, Hernán Morales Durand <[hidden email]> wrote:

Hi Alex,

I didn't posted yet because my workaround is unfinished, it needs more
work, but is a start (didn't tested for other cases, etc).

Note that it works connecting multiple edges:

| view shapes myElems |
view := RTView new.
myElems := 1 to: 7.
shapes := RTCompositeShape new
   add: (RTText new text: 'Long text message');
   add: (RTSVGPath new
  path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C 22.489583,23.8125
17.197917,34.395833 3.96875,27.78125 Z';
       fillColor: Color red;
       borderColor: Color black;
       borderWidth: 1.2;
       scale: 1.4);
   alignCenter;
   elementsOn: myElems.

RTEdgeBuilder new
  view: view;
  shape: (RTArrowedLine new
      color: Color white;
      yourself);
  elements: shapes;
   connectFrom: 2 to: 4;
   connectFrom: 2 to: 5;
   connectFrom: 2 to: 7;
   connectFrom: 1 to: 2;
   connectFrom: 3 to: 2;
   connectFrom: 6 to: 2.

RTTreeLayout new
  verticalGap: 30;
  horizontalGap: 30;
  applyOn: shapes.

view addAll: shapes.
view inspect.


But it doesn't work for connecting two composites:

| view shapes myElems |
view := RTView new.
view @ RTDraggableView.
myElems := 1 to: 2.
shapes := RTCompositeShape new
   add: (RTLabel new text: 'Test');
   add: (RTSVGPath new
       path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C
22.489583,23.8125 17.197917,34.395833 3.96875,27.78125 Z';
       fillColor: Color red;
       borderColor: Color black;
       borderWidth: 1.2;
       scale: 1.4);
   alignCenter;
   elementsOn: myElems.
RTEdgeBuilder new
   view: view;
   shape: (RTArrowedLine new
       color: Color white;
       yourself);
   elements: shapes;
   connectFrom: 1 to: 2.
RTTreeLayout new
   verticalGap: 30;
   horizontalGap: 10;
   applyOn: shapes.
view addAll: shapes.
view inspect.

Doing some experiments the following frightening modification aligns
the two labeled composites, obviously destroying all other cases:

alignFromCenterUsing: anElement
   | topX newX topY newY |

   topX := anElement encompassingRectangle center x.
   topY := anElement encompassingRectangle center y.
   elements do: [ :s |
       newX := topX + (s encompassingRectangle width / 2).
       newY := topY + (s encompassingRectangle height / 2).
       (s isKindOf: TRLabelShape)
           ifTrue: [ s translateTo: newX @ newY ]
           ifFalse: [ s translateTo: (topX / 2) @ (newY) ]
   ]

I would love to have more time to learn RTAlignment, but unfortunately
I'm on a deadline.
You may find the coded attached to this mail.

Cheers,

Hernán



2018-08-31 22:03 GMT-03:00 Alexandre Bergel <[hidden email]>:
Hi!

Just to make sure I have not missed anything. You told me on discord that you fixed the problem, don’t you? What is your solution?

Cheers,
Alexandre


On Aug 29, 2018, at 10:35 PM, Hernán Morales Durand <[hidden email]> wrote:

Hi Alex,

My problem using labeled elements is that adding another box, labeled text gets overlaped:

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
| view shapes myElems |
view := RTView new.
myElems := 1 to: 3.
shapes := (RTSVGPath new
  path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C 22.489583,23.8125
17.197917,34.395833 3.96875,27.78125 Z';
  fillColor: Color red;
  borderColor: Color black;
  borderWidth: 1.2;
  scale: 1.4) elementsOn: myElems.
view addAll: shapes.
shapes @ (RTLabeled new text: 'Long text message').
RTEdgeBuilder new
  view: view;
  shape: (RTArrowedLine new
      color: Color black;
      yourself);
  elements: shapes;
  connectFrom: 1 to: 3.
RTTreeLayout new
  verticalGap: 30;
  horizontalGap: 30;
  applyOn: shapes.
view inspect.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Maybe another suggestion?

Cheers,

Hernán


2018-08-29 22:09 GMT-03:00 Alexandre Bergel <[hidden email]>:
Hi!

An easy thing to do, is to make the elements labeled. Which is different than creating a composite shape (I can detail why there are two ways to label elements).

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
| view shapes myElems |
view := RTView new.
myElems := 1 to: 2.
shapes := (RTSVGPath new
  path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C 22.489583,23.8125
17.197917,34.395833 3.96875,27.78125 Z';
  fillColor: Color red;
  borderColor: Color black;
  borderWidth: 1.2;
  scale: 1.4) elementsOn: myElems.
view addAll: shapes.
shapes @ (RTLabeled new text: 'hello').
RTEdgeBuilder new
  view: view;
  shape: (RTArrowedLine new
      color: Color black;
      yourself);
  elements: shapes;
  connectFrom: 1 to: 2.
RTTreeLayout new
  verticalGap: 30;
  horizontalGap: 30;
  applyOn: shapes.
view inspect.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Here is the result
<Screenshot 2018-08-28 15.32.19.png>


Cheers,
Alexandre


On Aug 23, 2018, at 2:31 PM, Hernán Morales Durand <[hidden email]> wrote:

Hi,

When connecting two composite shapes with RTEdgeBuilder, the connector
position loose its center over the connecting shapes.

It's easier to explain with two scripts:

This one looks good, the connector (RTArrowedLine) is centered:

| view shapes myElems |
view := RTView new.
myElems := 1 to: 2.
shapes := (RTSVGPath new
  path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C 22.489583,23.8125
17.197917,34.395833 3.96875,27.78125 Z';
  fillColor: Color red;
  borderColor: Color black;
  borderWidth: 1.2;
  scale: 1.4) elementsOn: myElems.
view addAll: shapes.
RTEdgeBuilder new
  view: view;
  shape: (RTArrowedLine new
      color: Color white;
      yourself);
  elements: shapes;
  connectFrom: 1 to: 2.
RTTreeLayout new
  verticalGap: 30;
  horizontalGap: 30;
  applyOn: shapes.
view inspect.

However when adding a label in a composite, both label and arrow looks shifted:

| view shape shapes myElems |
view := RTView new.
myElems := 1 to: 2.
shape := RTCompositeShape new
  add: (RTLabel new text: 'Test');
  add: (RTSVGPath new
      path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C
22.489583,23.8125 17.197917,34.395833 3.96875,27.78125 Z';
      fillColor: Color red;
      borderColor: Color black;
      borderWidth: 1.2;
      scale: 1.4);
  vertical;
  yourself.
shapes := shape elementsOn: myElems.
view addAll: shapes.
RTEdgeBuilder new
  view: view;
  shape: (RTArrowedLine new
      color: Color white;
      yourself);
  elements: shapes;
  connectFrom: 1 to: 2.
RTTreeLayout new
  verticalGap: 30;
  horizontalGap: 30;
  applyOn: shapes.
view inspect.

Any idea how to align these shapes?

Cheers,

Hernán
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev


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


<Align_Test2.png>_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
<TRCompositeShape-alignCenter.st><RTCompositeShape-#RT-Extensions.st><RTAlignment-#RT-Extensions.st><Multiple_Composites.png><Two_Composites.png>_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev


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