2006/08/08 17:41:25
ChemoJun050 (2006/08/08) Copyright 2002-2006 National Institute of Informatics, Research Organization of Information and Systems.
category:
-
ChemoJun-Topology-Graph
inheritance:
instance variables:
class instance variables:
class variables:
pool variables:
instance methods:
-
arrange [arranging]
self arrangeConcentricRectangles: nil.
self isConcentricArrangement
ifTrue:
[| attributeTable |
self arcsDo:
[:arc |
arc firstPointAlignment: #center.
arc lastPointAlignment: #center].
attributeTable := self
arrangeConcentricCirclesAttributeSymbol: self arrangeAttributeSymbol.
(attributeTable at: #nodeCenterTable)
keysAndValuesDo: [:node :center | node center: center]].
self isHierarchicalArrangement
ifTrue:
[| attributeTable |
self arcsDo:
[:arc |
arc firstPointAlignment: #center.
arc lastPointAlignment: #center].
attributeTable := self arrangeForest.
(attributeTable at: #nodeOriginTable)
keysAndValuesDo: [:node :origin | node origin: origin]].
self isNoneArrangement
ifTrue:
[| aTable |
aTable := self noneArrangementTable.
self arcsDo:
[:arc |
arc firstPointAlignment: #center.
arc lastPointAlignment: #center].
self nodesDo:
[:node |
(aTable includesKey: node uniqueNumber)
ifTrue: [node locationPoint: (aTable at: node uniqueNumber)]]].
self flushBoundingBox.
^self yourself
-
arrangeForest: attibuteTable startNode: aNode originPoint: aPoint [arranging]
| extent width height level count x y |
(JunSensorUtility shiftDown or: [JunSensorUtility altDown])
ifTrue:
[^super
arrangeForest: attibuteTable
startNode: aNode
originPoint: aPoint].
extent := aPoint.
width := 0.
height := 0.
self nodesDo:
[:node |
width := width max: node bounds width.
height := height max: node bounds height].
level := 0.
count := 0.
self nodesBreadthFirstDo:
[:node :indent :sequence |
level ~= indent
ifTrue:
[count := 0.
level := indent].
x := aPoint x + (width * indent + (self arrangeForestInterval * indent)).
y := aPoint y + (height * count + (self arrangeForestMargin * count)).
(attibuteTable at: #visitingTable) at: node put: #visited.
(attibuteTable at: #nodeOriginTable) at: node put: x @ y.
extent := extent max: x @ y + node bounds extent.
count := count + 1]
startNode: aNode.
^extent
-
arrangeWithAnimation: aGrapher [arranging]
| aNode |
(JunSensorUtility shiftDown or: [JunSensorUtility altDown])
ifTrue: [^super arrangeWithAnimation: aGrapher].
self arrangeConcentricRectangles: nil.
aNode := aGrapher selection.
self isConcentricArrangement
ifTrue:
[| attributeTable |
self arcsDo:
[:arc |
arc firstPointAlignment: #center.
arc lastPointAlignment: #center].
attributeTable := self
arrangeConcentricCirclesAttributeSymbol: self arrangeAttributeSymbol.
(aNode notNil and: [aNode center = Point zero])
ifFalse:
[| oldPoint newPoint howMany aTable aCollection |
oldPoint := aGrapher scrollAmount.
newPoint := Point zero + aGrapher viewBounds center.
howMany := 25.
aTable := Dictionary new: attributeTable size.
(attributeTable at: #nodeCenterTable) keysAndValuesDo:
[:node :center |
aCollection := OrderedCollection new: howMany + 1.
0 to: howMany
do: [:n | aCollection add: node center + ((center - node center) / howMany * n)].
aTable at: node put: aCollection].
(0 to: howMany) do:
[:n |
self nodesDo: [:node | node center: ((aTable at: node) at: n + 1) rounded].
aGrapher scrollTo: oldPoint + ((newPoint - oldPoint) / howMany * n).
aGrapher redisplay.
(Delay forMilliseconds: 40) wait].
aGrapher flushBoundingBox].
(attributeTable at: #nodeCenterTable)
keysAndValuesDo: [:node :center | node center: center]].
self isHierarchicalArrangement
ifTrue:
[| attributeTable |
self arcsDo:
[:arc |
arc firstPointAlignment: #center.
arc lastPointAlignment: #center].
attributeTable := self arrangeForest.
(aNode notNil
and: [((attributeTable at: #nodeOriginTable) at: aNode) ~= aNode origin])
ifTrue:
[| oldPoint newPoint howMany aTable aCollection |
oldPoint := aGrapher scrollAmount.
newPoint := Point zero + self arrangeForestMargin asPoint.
howMany := 25.
aTable := Dictionary new: attributeTable size.
(attributeTable at: #nodeOriginTable) keysAndValuesDo:
[:node :origin |
aCollection := OrderedCollection new: howMany + 1.
0 to: howMany
do: [:n | aCollection add: node origin + ((origin - node origin) / howMany * n)].
aTable at: node put: aCollection].
(0 to: howMany) do:
[:n |
self nodesDo: [:node | node origin: ((aTable at: node) at: n + 1) rounded].
aGrapher scrollTo: oldPoint + ((newPoint - oldPoint) / howMany * n).
aGrapher redisplay.
(Delay forMilliseconds: 40) wait].
aGrapher flushBoundingBox].
(attributeTable at: #nodeOriginTable)
keysAndValuesDo: [:node :origin | node origin: origin]].
self isNoneArrangement
ifTrue:
[| aTable |
aTable := self noneArrangementTable.
self arcsDo:
[:arc |
arc firstPointAlignment: #center.
arc lastPointAlignment: #center].
self nodesDo:
[:node |
(aTable includesKey: node uniqueNumber)
ifTrue: [node locationPoint: (aTable at: node uniqueNumber)]]].
aNode isNil
ifFalse:
[| oldPoint newPoint howMany |
oldPoint := aGrapher scrollAmount.
self isHierarchicalArrangement
ifTrue:
[newPoint := aNode bounds origin negated + self arrangeForestMargin asPoint]
ifFalse: [newPoint := aNode center negated + aGrapher viewBounds center].
oldPoint = newPoint
ifFalse:
[howMany := 25.
(0 to: howMany) do:
[:n |
aGrapher scrollTo: oldPoint + ((newPoint - oldPoint) / howMany * n).
(Delay forMilliseconds: 40) wait]]].
self flushBoundingBox.
^self yourself
-
roots [accessing nodes]
| roots |
roots := self selections.
roots isEmpty ifTrue: [^super roots].
^roots
class methods:
-
copyright [copyright]
^'ChemoJun050 (2006/08/08) Copyright 2002-2006 National Institute of Informatics, Research Organization of Information and Systems.'
-
defaultArrangeConcentricRadius [defaults]
"ChemoJunGraph flushAttributes."
^200
-
defaultNodeClass [defaults]
^ChemoJunNode
-
system [copyright]
^'ChemoJun'
-
version [copyright]
^'050'