Hi all,
Thanks for the replies. Let me ask you one more question.
As an exercise, I want to reproduce in Roassal2 the top view of CodeCity.
So I took this script from CCScriptExamples>>cityOfJavaSystem:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| models builder |
models := MooseModel root allModels.
builder := CCBuilder new.
models notEmpty
ifTrue: [
| namespaces classes classNormalizer packageNormalizer |
builder packingLayout.
namespaces := models first allModelNamespaces.
classes := namespaces flatCollect: #classes.
packageNormalizer := CCColorNormalizer new
low: (Color gray: 0.6);
high: (Color gray: 0.95);
transformation: #nestingLevel;
population: namespaces.
builder shapeBuilder platform color: packageNormalizer.
builder nodes: namespaces.
classNormalizer := CCColorNormalizer new
low: (Color gray: 0.25);
high: Color blue;
transformation: #numberOfLinesOfCode;
population: classes.
builder shapeBuilder box
color: classNormalizer;
height: #numberOfMethods;
width: #numberOfAttributes;
depth: #numberOfAttributes.
builder nodes: classes.
builder nest: namespaces node: #yourself in: #parentScope.
builder nest: classes node: #yourself in: #namespaceScope ].
builder open
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
It produced this view:
[image: Inline images 1]
Then I produced the following Roassal2 script based on the nodes from the
previous builder object:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
v := RTView new.
classes := builder nodes reject: [ :e | e model class = FAMIXNamespace ].
packages := builder nodes select: [ :e | e model class = FAMIXNamespace ].
els1 := (RTBox new
height: #depth;
width: #width;
color: #color) elementsOn: classes.
els2 := (RTBox new
height: [ :e | e contentBoundingVolume depth ];
width: [ :e | e contentBoundingVolume width ];
color: #color) elementsOn: packages.
els1
do: [ :e | e translateTo: (e model position x + (e model depth / 2)) @ (e
model position z + (e model width / 2)) ].
els2
do: [ :e |
e
translateTo:
(e model position x + (e model contentBoundingVolume depth / 2))
@ (e model position z + (e model contentBoundingVolume width / 2)) ].
v addAll: els2 , els1.
els2 @ RTDraggable.
v
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Although the boxes that represent classes seem correct, I have trouble
positioning the boxes that corresponds to packages.
Does anyone have an idea of how to fix this?
[image: Inline images 2]
Best regards,
Leonel Merino
PhD student
University of Bern
+41 78 405 43 38
merino(a)inf.unibe.ch
2016-12-14 18:32 GMT+01:00 Stephan Eggermont <stephan(a)stack.nl>nl>:
A pre-spur pre-pharo5, that is.
Stephan
Verstuurd vanaf mijn iPhone
Op 14 dec. 2016 om 17:06 heeft Tudor Girba
<tudor(a)tudorgirba.com> het
volgende geschreven:
Code City should work in Pharo 5.
_______________________________________________
Moose-dev mailing list
Moose-dev(a)list.inf.unibe.ch
https://www.list.inf.unibe.ch/listinfo/moose-dev