Hi!,
I want to present you RTCircularTreeMapBuilder a variation of RTTreeMapBuilder.
For example to visualize the RTObject subclasses, type the next piece of code:
.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=
| b |
b := RTCircularTreeMapBuilder new.
b shape
color: Color transparent;
borderWidth: 1;
borderColor: Color black;
if: [ :cls | cls subclasses isEmpty ] fillColor: [ :cls|
(Smalltalk includesKey: (cls name, 'Test') asSymbol) ifTrue: [ Color green ]
ifFalse: [ Color purple ] ].
b
baseradius: 200;
weight: [ :cls | cls withAllSubclasses size].
b explore: RTObject
using: #subclasses.
b build.
^ b view
.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=
Another example in the file system.
.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=
| b dirSize |
b := RTCircularTreeMapBuilder new.
b shape
color: Color transparent;
borderWidth: 1;
borderColor: Color white;
if: [ :f | f isDirectory ] fillColor: Color transparent;
if: [ :f | f isDirectory not ] fillColor: Color white.
dirSize := nil.
dirSize := [ :file | | size |
file isDirectory
ifTrue: [
size := 0.
file children do: [ :child | size := size + (dirSize value: child)].
size isZero ifTrue: [ 1 ] ifFalse: [ size ] ]
ifFalse: [ size := file size.
size isNumber ifTrue: [ size ] ifFalse: [ 1 ] ] ].
b
baseradius: 200;
weight: [:file | file isDirectory ifTrue: [ dirSize value: file ] ifFalse: [ file size ] ].
b explore: FileLocator home asFileReference
using: [:file | | children |
[ children := file isDirectory ifTrue: [ file children ] ifFalse: [ #() ] ]
on: Error do: [ children := #() ].
children ] .
b build.
b view canvas color: Color black.
b view
.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=
You can see the result in the next link
Cheers,
Milton