Skip to content

Commit

Permalink
update references of roassal in roassal layouts
Browse files Browse the repository at this point in the history
  • Loading branch information
akevalion committed Oct 9, 2023
1 parent 24a5cfc commit c85084a
Show file tree
Hide file tree
Showing 28 changed files with 128 additions and 733 deletions.
6 changes: 6 additions & 0 deletions src/Roassal-Layouts/BlockClosure.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Extension { #name : #BlockClosure }

{ #category : #'*Roassal-Layouts' }
BlockClosure >> rsValue: value [
^ self cull: value
]
8 changes: 8 additions & 0 deletions src/Roassal-Layouts/ManifestRoassalLayouts.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"
Please describe the package using the class comment of the included manifest class. The manifest class also includes other additional metadata for the package. These meta data are used by other tools such as the SmalllintManifestChecker and the critics Browser
"
Class {
#name : #ManifestRoassalLayouts,
#superclass : #PackageManifest,
#category : #'Roassal-Layouts-Manifest'
}
6 changes: 6 additions & 0 deletions src/Roassal-Layouts/Object.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Extension { #name : #Object }

{ #category : #'*Roassal-Layouts' }
Object >> rsValue: anArgument [
^ self
]
4 changes: 2 additions & 2 deletions src/Roassal-Layouts/RSAbstractGraphLayout.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,12 @@ RSAbstractGraphLayout >> rootNodesFor: aCollection [
(self parentsFor: node) isEmpty ]
]

{ #category : #hook }
{ #category : #utilities }
RSAbstractGraphLayout >> rootNodesFromCycles: shapes [
| graph groups |
graph := RSDSMGraph new: shapes size.
shapes doWithIndex: [ :shape :index1 |
shape outgoingShapes do: [ :otherShape | | index2 |
shape outgoingNodes do: [ :otherShape | | index2 |
index2 := shapes indexOf: otherShape.
"added only when index2 is valid"
index2 == 0 ifFalse: [ graph addEdge: index1 to: index2 ].
Expand Down
8 changes: 4 additions & 4 deletions src/Roassal-Layouts/RSAbstractRegularTreeLayout.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ RSAbstractRegularTreeLayout >> horizontallyReverse [
RSAbstractRegularTreeLayout >> horizontallyReverse: shapes [
"Horizontally reverse the elements, as well as the attachpoints"
| g largeur |
g := shapes asGroup.
g := shapes.
largeur := g extent x.
shapes
do: [ :el | el translateTo: (largeur - el position x) @ el position y ]
Expand Down Expand Up @@ -171,11 +171,11 @@ RSAbstractRegularTreeLayout >> verticallyReverse [
]

{ #category : #reversing }
RSAbstractRegularTreeLayout >> verticallyReverse: elements [
RSAbstractRegularTreeLayout >> verticallyReverse: shapes [
"Vertically reverse the elements, as well as the attachpoints"
| g hauteur |
g := elements asGroup.
g := shapes.
hauteur := g extent y.
elements
shapes
do: [ :el | el translateTo: el position x @ (hauteur - el position y) ]
]
2 changes: 1 addition & 1 deletion src/Roassal-Layouts/RSAbstractShapeHandling.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ RSAbstractShapeHandling >> shapes [

{ #category : #accessing }
RSAbstractShapeHandling >> shapes: someShapes [
shapes := someShapes asGroup
shapes := someShapes
]
79 changes: 0 additions & 79 deletions src/Roassal-Layouts/RSAlignment.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -20,85 +20,6 @@ Class {
#category : #'Roassal-Layouts-PositionAndResize'
}

{ #category : #examples }
RSAlignment class >> exampleAlignBottom [
| canvas boxes |
canvas := RSCanvas new.
boxes := (1 to: 5) collect: [ :v |
RSBox new
color: Color gray translucent;
size: v * 5 ] as: RSGroup.
RSHorizontalLineLayout new alignBottom; on: boxes.
"align := self new.
align shapes: boxes.
align bottom."
canvas addAll: boxes.
^ canvas open
]

{ #category : #examples }
RSAlignment class >> exampleAlignCenter [
| canvas boxes |
canvas := RSCanvas new.
boxes := (1 to: 5) collect: [ :v | RSBox new size: v * 5 ] as: RSGroup.
RSVerticalLineLayout new alignCenter; on: boxes.

"align := self new.
align shapes: boxes.
align center."
canvas addAll: boxes.
^ canvas open
]

{ #category : #examples }
RSAlignment class >> exampleAlignLabel [
| canvas labels |
canvas := RSCanvas new.
labels := (1 to: 5) collect: [ :v |
RSLabel new
text: v;
fontSize: v * 5 ] as: RSGroup.
RSHorizontalLineLayout new alignLabel; on: labels.

"align := self new.
align shapes: labels.
align label."
canvas addAll: labels.
"note that each label, have different encompassing rectangle"
canvas showEncompassingRectangles.
^ canvas open
]

{ #category : #examples }
RSAlignment class >> exampleAlignMiddle [
| canvas boxes |
canvas := RSCanvas new.
boxes := (1 to: 5) collect: [ :v |
RSBox new
color: Color gray translucent;
size: v * 5 ] as: RSGroup.
RSHorizontalLineLayout new alignMiddle; on: boxes.
"align := self new.
align shapes: boxes.
align middle."
canvas addAll: boxes.
^ canvas open
]

{ #category : #examples }
RSAlignment class >> exampleAlignRight [
| canvas boxes |
canvas := RSCanvas new.
boxes := (1 to: 5) collect: [ :v | RSBox new size: v * 5 ] as: RSGroup.
RSVerticalLineLayout new alignRight; on: boxes.

"align := self new.
align shapes: boxes.
align right."
canvas addAll: boxes.
^ canvas open
]

{ #category : #alignment }
RSAlignment >> alignFromBottomUsing: aShape [
"The argument aShape is a fix point. It does not move"
Expand Down
29 changes: 0 additions & 29 deletions src/Roassal-Layouts/RSCircleLayout.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,6 @@ Class {
#category : #'Roassal-Layouts-Circle'
}

{ #category : #examples }
RSCircleLayout class >> example1 [
| aLayout objects |
aLayout := self new.
aLayout center: 200@200.
aLayout radius: 100.
objects := RSBox models: (1 to: 10).
aLayout on: objects.
^ RSCanvas new
addAll: objects;
@ RSCanvasController;
open
]

{ #category : #examples }
RSCircleLayout class >> example2 [
| nodes canvas shapes |
nodes := (1 to: 5).

canvas := RSCanvas new.
shapes := RSCircle models: nodes.
shapes size: 30.
canvas addAll: shapes.

self new radius: 20; on: shapes.
canvas @ RSCanvasController.
^ canvas open
]

{ #category : #'instance creation' }
RSCircleLayout class >> scaleBy: aNumber [

Expand Down
27 changes: 0 additions & 27 deletions src/Roassal-Layouts/RSClusterRadialTreeLayout.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,6 @@ Class {
#category : #'Roassal-Layouts-Tree'
}

{ #category : #examples }
RSClusterRadialTreeLayout class >> exampleWithNumber [
| canvas shapes color |
canvas := RSCanvas new.

color := RSColorPalette sequential bupu3.
shapes := (1 to: 100) collect: [ :m |
RSBox new
size: 7;
model: m;
draggable;
withBorder;
color: (color scale: m);
yourself.
].
RSLineBuilder line
shapes: shapes;
canvas: canvas;
connectFrom: [ :n | n // 2 ].
canvas edges do: #withBorder.
canvas addAll: shapes.
canvas shapes @ RSHighlightable red.
self on: shapes.
canvas zoomToFit.
^ canvas open
]

{ #category : #'drawing - general' }
RSClusterRadialTreeLayout >> draw: aNode [
self draw: aNode level: 1.
Expand Down
8 changes: 4 additions & 4 deletions src/Roassal-Layouts/RSClusteringLayout.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,19 @@ RSClusteringLayout >> forEachLayout: anObject [
forEachLayout := anObject
]

{ #category : #hook }
{ #category : #utilities }
RSClusteringLayout >> getClusterFor: shapes [
| result resultWithGroups |
result := OrderedCollection new.
shapes do: [ :s | | t |
t := s allRecursiveConnectedShapes.
t := s allRecursiveConnectedNodes.
(result includes: t)
ifFalse: [ result add: t ]
].

resultWithGroups := result
collect: [ :coll |(coll asArray sortedAs: #asString) asGroup ]
as: RSGroup.
collect: [ :coll |(coll asArray sortedAs: #asString) asOrderedCollection ]
as: OrderedCollection.
^ resultWithGroups
]

Expand Down
8 changes: 4 additions & 4 deletions src/Roassal-Layouts/RSConditionalLayout.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ RSConditionalLayout >> doExecute: shapes [
"Performs the layout"

| thenShapes elseShapes |
thenShapes := (shapes select: if) asGroup.
elseShapes := (shapes reject: if) asGroup.
thenShapes := shapes select: if.
elseShapes := shapes reject: if.
thenLayout on: thenShapes.
elseLayout on: elseShapes.

Expand Down Expand Up @@ -71,13 +71,13 @@ RSConditionalLayout >> if: aOneArgBlockOrSymbol [

{ #category : #accessing }
RSConditionalLayout >> ifConnectedThen: aLayout [
self if: [ :shape | shape hasEdges ].
self if: [ :shape | shape hasLines ].
self then: aLayout
]

{ #category : #accessing }
RSConditionalLayout >> ifNotConnectedThen: aLayout [
self if: [ :shape | shape hasEdges not ].
self if: [ :shape | shape hasLines not ].
self then: aLayout
]

Expand Down
47 changes: 0 additions & 47 deletions src/Roassal-Layouts/RSDraggableForceInteraction.class.st

This file was deleted.

18 changes: 0 additions & 18 deletions src/Roassal-Layouts/RSFlowLayout.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,6 @@ Class {
#category : #'Roassal-Layouts-Flow'
}

{ #category : #examples }
RSFlowLayout class >> exampleLabel [

| words r wordShapes c |
words := (String loremIpsum: 100) substrings.
r := Random new.
wordShapes := words collect: [ :w |
RSLabel new
fontSize: (r nextInteger: 30);
text: w ] as: RSGroup.

c := RSCanvas new.
c addAll: wordShapes.
self new alignLabel; on: wordShapes.
c @ RSCanvasController.
^ c open
]

{ #category : #alignment }
RSFlowLayout >> alignBottom [
self alignment: #bottom
Expand Down
9 changes: 4 additions & 5 deletions src/Roassal-Layouts/RSForceBasedLayout.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -462,11 +462,10 @@ RSForceBasedLayout >> stepNodeRepulsion [
"Handle fixed nodes. Do this after all forces in a step were already applied."
quadtree := RSQuadTreeForce withAll: nodes.
self accumulate: quadtree.
nodes
do: [ :each |
each isFixed
ifTrue: [ each translateTo: each fixPosition ]
ifFalse: [ self repulse: each from: quadtree ] ]
nodes do: [ :each |
each isFixed
ifTrue: [ each translateTo: each fixPosition ]
ifFalse: [ self repulse: each from: quadtree ] ]
]

{ #category : #accessing }
Expand Down

0 comments on commit c85084a

Please sign in to comment.