Matthieu, you have done an impressive piece of work.
I played a bit with it. Check out this cool video (athens based :-) https://dl.dropboxusercontent.com/u/31543901/online/ForceBasedLayout.mov
I slightly modified the following method, by adding a "super step" :
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
ROForceBasedLayout_N>>step
"run a step of the force layout algorithm"
| from to fp tp x y len k quad old |
super step. "<<<<<<< line to add"
edges do: [ :e |
from := e from. fp := from position.
to := e to. tp := to position.
...
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Execute the following script, drag element and click on it:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Preambule. It includes the initialization. "view interaction on: ROMouseClick do: [ :event |
| rawView view layout |
rawView := ROView new.
view := ROMondrianViewBuilder view: rawView.
"enter your script below"
"-------------"
"-------------"
view interaction on: ROMouseEnter do: [ :n |
| nodes |
nodes := view raw elementsFromModels: n element model allSubclasses.
ROHighlightElements on: nodes ].
view interaction on: ROMouseLeave do: [ :n |
| nodes |
nodes := view raw elementsFromModels: n element model allSubclasses.
ROUnhighlightElements on: nodes ].
layout := ROForceBasedLayout_N new.
layout fix: event element at: event element position.
layout iterationsToSendEvent: 10.
layout on: ROLayoutStep do: [ :ev | view raw signalUpdate. World doOneCycle ].
view layout: layout.
view applyLayout ].
view shape rectangle size: 10.
view nodes: (Collection withAllSubclasses).
view edgesFrom: #superclass.
layout := ROForceBasedLayout_N new.
layout fix: (view nodes last) at: 450@450;
gravityAt: 437@38 .
view layout: layout.
"-------------"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"-------------"
"Below is the initiation of the menu and opening the visualization"
ROEaselMorphic new populateMenuOn: view.
view open
Good job Mathieu! Continue!
Cheers,
Alexandre
--
On Apr 30, 2013, at 11:07 AM, stephane ducasse <stephane.ducasse@free.fr> wrote:
> excellent!
> I want to see that.
>
> Stef
>
> On Apr 30, 2013, at 1:28 PM, mathieubmddehouck@mailoo.org wrote:
>
>> Hello
>>
>>
>> I've added new features for the force based layout.
>>
>> You can change the gravity center, tell where you want to see your fixed nodes and so on.
>>
>> I still have a bug with padding, and resizeStrategy, for example when you click on Example in the view.
>>
>>
>> Gofer it
>> smalltalkhubUser: 'MathieuDehouck' project: 'RoassalAlgorithm';
>> package: 'RoassalForceBaseLayout';
>> load.
>>
>>
>> Try this :
>>
>> ---------------------------
>>
>> "Preambule. It includes the initialization. "
>> | rawView view layout |
>> rawView := ROView new.
>> view := ROMondrianViewBuilder view: rawView.
>> "enter your script below"
>> "-------------"
>> "-------------"
>>
>> view interaction on: ROMouseEnter do: [ :n |
>> | nodes |
>> nodes := view raw elementsFromModels: n element model allSubclasses.
>> ROHighlightElements on: nodes ].
>>
>> view interaction on: ROMouseLeave do: [ :n |
>> | nodes |
>> nodes := view raw elementsFromModels: n element model allSubclasses.
>> ROUnhighlightElements on: nodes ].
>>
>> view shape rectangle size: 10.
>> view nodes: (Collection withAllSubclasses).
>> view edgesFrom: #superclass.
>>
>> layout := ROForceBasedLayout_N new.
>> layout fix: (view nodes last) at: 450@450;
>> gravityAt: 437@38 .
>>
>> view layout: layout.
>> view applyLayout.
>>
>> "-------------"
>> "-------------"
>> "Below is the initiation of the menu and opening the visualization"
>> ROEaselMorphic new populateMenuOn: view.
>> view open
>>
>> ---------------------------------------
>>
>>
>> Mathieu
>>
>>
>> _______________________________________________
>> Moose-dev mailing list
>> Moose-dev@iam.unibe.ch
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
> _______________________________________________
> Moose-dev mailing list
> Moose-dev@iam.unibe.ch
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev