TelescopeSt / Telescope

Telescope is an engine for efficiently creating meaningful visualizations
MIT License
31 stars 9 forks source link

TLProjectMap is not right #155

Open jecisc opened 4 years ago

jecisc commented 4 years ago

In Metacello versions do not implement the equality right. Thus we need to update the code of the visu.

I have a proto:

buildVisualization
    super buildVisualization.
    self addNodesFromEntities: self versionsNodes.
    self nodes
        do: [ :each | 
            (each entity projects collect: [ :e | self nodes detect: [ :n | n entity = e version and: [ n entity projectLabel = e version projectLabel ] ] ifNone: [ nil ] ])
                asSet do: [ :n | n ifNotNil: [ each connectToNode: n ] ] ].
    self styleSheet
        nodeLabel: [ :each | #(#ConfigurationOf #BaselineOf) inject: each asString into: [ :name :toRemove | name copyReplaceAll: toRemove with: '' ] ];
        nodeLabelPosition: #bottom;
        labelSize: 11.
    self layout: self defaultLayout

I little ugly but working. It does not manage well configurations, only baselines.

jecisc commented 4 years ago

In fact it is not the configurations that it does not manage. It's the dependencies not loaded in the image.

jecisc commented 4 years ago

Here is a much better version:

| project |
project := BaselineOfMoose.
substringsOfProjectsToHighlight := #(#Famix #Fame #Moose #TestResource).

visu := TLVisualization new.
visu addNodesFromEntities: ((BaselineOfMoose project version withDeepCollect: [ :each | each projects collect: #version ])
        inject: OrderedCollection new
        into: [ :coll :vers | 
            coll detect: [ :each | each versionNumber = vers versionNumber and: [ each projectLabel = vers projectLabel ] ] ifNone: [ coll add: vers ].
            coll ]).

visu nodes
        do: [ :each | 
            (each entity projects collect: [ :e | visu nodes detect: [ :n | n entity = e version and: [ n entity projectLabel = e version projectLabel ] ] ifNone: [ nil ] ])
                asSet do: [ :n | n ifNotNil: [ each connectToNode: n ] ] ].

visu styleSheet
        nodeLabel: [ :each | each projectLabel withoutPrefix: #BaselineOf ];
        nodeLabelPosition: #bottom;
        backgroundColor: [ :each | (substringsOfProjectsToHighlight anySatisfy: [ :e | each projectLabel includesSubstring: e ]) ifTrue: [ MDLColor green ] ifFalse: [ MDLColor orange ] ];
        labelSize: 11.

visu layout: (TLTreeLayout rightToLeft
        leavesGap: 70;
        levelGap: 100;
        yourself).

visu addInteractions:
            {(TLStyleCustomizationAction
                custom: [ :style :drawable | 
                    drawable isConnection
                        ifTrue: [ style
                                color: MDLColor blue;
                                width: 3 ]
                        ifFalse: [ style
                                labelSize: 20;
                                textColor: MDLColor blue ].
                    self ]
                target: [ :aDrawable | aDrawable incomingConnections flatCollectAsSet: #withConnectedNodes ]) onMouseOver propagateToChildren . (TLStyleCustomizationAction
                custom: [ :style :drawable | 
                    drawable isConnection
                        ifTrue: [ style
                                color: MDLColor orange;
                                width: 3 ]
                        ifFalse: [ style
                                labelSize: 20;
                                textColor: MDLColor orange ].
                    self ]
                target: [ :aDrawable | aDrawable outgoingConnections flatCollectAsSet: #withConnectedNodes ]) onMouseOver propagateToChildren}.

visu open