The function of the layout is to locate nodes. As soon as a layout has to change the size of a node, this means that you do not want to use the Mondrian builder, but instead create your own builder. In your case, I think you need to adjust the shape from the script,
I do not think that this is good to force the client to specify a specific width for packing.
What you want is either specify a ratio or a starting size or a maxium size
and the algorithm should either do not change the node size or compute the ecart-type and either apply a linear shrink or a outlier decrease.
Probably we should have PackingMaxSize PackingRatio
and not from the layout. For example, Mathieu's code is
-=-=-=-=-=-=-=-=-=-=-=-= b := 30. view shape rectangle width: [ :cls | cls numberOfVariables * 5 ]; height: #numberOfMethods; color: (Color r: 0 g: 1 b: 1 ). view nodes: TestCase withAllSubclasses. view nodes do: [ :e | (e width > b ) ifTrue: [ e shapes first color: (Color r: 1 g: 0 b: 1 ) ] ]. view layout:(( RORectanglePacking new)ratioWidth: 10 height: 10; padding: 4; logWidthIfMoreThan: b scale: 5). -=-=-=-=-=-=-=-=-=-=-=-=
It could simply be:
-=-=-=-=-=-=-=-=-=-=-=-= view shape rectangle width: [ :cls | (cls numberOfVariables + 1) log * 30 ]; height: #numberOfMethods; color: (Color r: 0 g: 1 b: 1 ); if: [ :cls | cls numberOfVariables > 10 ] fillColor: (Color r: 1 g: 0 b: 1) .
view nodes: TestCase withAllSubclasses. view layout: (( RORectanglePacking new) ratioWidth: 10 height: 10; padding: 4). -=-=-=-=-=-=-=-=-=-=-=-=
Cheers, Alexandre
If this is necessary, then a new builder is necessary. We are currently working on two new builder (one for DSMs and another for Sunburst).
Alexandre
On May 28, 2013, at 9:12 AM, mathieubmddehouck@mailoo.org wrote:
Hi
I've fixed a big on ROArc, so that it draws well.
And I've commented and added methods to RORectanglePacking to reduce biggest nodes, and so on.
try:
Gofer new smalltalkhubUser: 'MathieuDehouck' project: 'RoassalAlgorithm'; package: 'Roassal-New'; load
| view rawView n b | rawView := ROView new. view := ROMondrianViewBuilder view: rawView. "-------------" "-------------" b := 30.
view shape rectangle width: [ :cls | cls numberOfVariables * 5 ]; height: #numberOfMethods; color: (Color r: 0 g: 1 b: 1 ).
view nodes: TestCase withAllSubclasses.
view nodes do: [ :e | (e width > b ) ifTrue: [ e shapes first color: (Color r: 1 g: 0 b: 1 ) ] ].
view layout:(( RORectanglePacking new)ratioWidth: 10 height: 10; padding: 4; logWidthIfMoreThan: b scale: 5).
"-------------" "-------------" "Below is the initiation of the menu and opening the visualization" ROEaselMorphic new populateMenuOn: view. view open.
There are other log... methods, and scale represent the factor to multiply the logs by. (yes log 10 = 1 and that's pretty small in pixel)
Regards
Mathieu
P.S. The screens have been made with the width and the height in the same time.
<RECT TestCase log 30.png><Rect after.png>_______________________________________________ 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
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