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 <hernan.morales@gmail.com> 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 <alexandre.bergel@me.com>:
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 <hernan.morales@gmail.com> 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 <alexandre.bergel@me.com>:
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 <hernan.morales@gmail.com> 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
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


<Align_Test2.png>_______________________________________________
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
<TRCompositeShape-alignCenter.st><RTCompositeShape-#RT-Extensions.st><RTAlignment-#RT-Extensions.st><Multiple_Composites.png><Two_Composites.png>_______________________________________________
Moose-dev mailing list
Moose-dev@list.inf.unibe.ch
https://www.list.inf.unibe.ch/listinfo/moose-dev