-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add exporter of MermaidUML in roasaal
- Loading branch information
Showing
5 changed files
with
70 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/MermaidPharo-Roassal-ClassDiagram/ManifestMermaidPharoRoassalClassDiagram.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
" | ||
This package includes a backend writter to export MermaidJS ClassDiagram into a Roassal visualisation | ||
" | ||
Class { | ||
#name : #ManifestMermaidPharoRoassalClassDiagram, | ||
#superclass : #PackageManifest, | ||
#category : #'MermaidPharo-Roassal-ClassDiagram-Manifest' | ||
} |
55 changes: 55 additions & 0 deletions
55
src/MermaidPharo-Roassal-ClassDiagram/MeRSClassDiagramExporter.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
" | ||
My entrypoint is `visitClassDiagram: aClassDiagram`. | ||
I provide a canvas with the rossal class diagram | ||
" | ||
Class { | ||
#name : #MeRSClassDiagramExporter, | ||
#superclass : #MeWritterVisitor, | ||
#instVars : [ | ||
'canvas', | ||
'builder', | ||
'diagram' | ||
], | ||
#category : #'MermaidPharo-Roassal-ClassDiagram-Manifest' | ||
} | ||
|
||
{ #category : #visiting } | ||
MeRSClassDiagramExporter >> rsClassDescriptor [ | ||
|
||
^ RSUMLClassDescriptor new | ||
classname: #name; | ||
instVars: [ :cls | cls attributes ]; | ||
methods: [ :meClass | meClass methods ]; | ||
isAbstract: false; | ||
superclass: [ :meClass | | ||
(diagram relations select: [ :rel | | ||
rel toClass = meClass and: [ | ||
rel fromRelationType isKindOf: MeCDInheritanceRelationType ] ]) | ||
ifNotEmpty: [ :inheritanceRelations | | ||
inheritanceRelations anyOne fromClass ] | ||
ifEmpty: [ nil ] ]; | ||
methodsLimit: SmallInteger maxVal | ||
] | ||
|
||
{ #category : #visiting } | ||
MeRSClassDiagramExporter >> visitClass: aMeClass [ | ||
builder classes add: aMeClass | ||
|
||
] | ||
|
||
{ #category : #visiting } | ||
MeRSClassDiagramExporter >> visitClassDiagram: aClassDiagram [ | ||
|
||
diagram := aClassDiagram. | ||
canvas := RSCanvas new. | ||
builder := RSUMLClassBuilder new. | ||
builder modelDescriptor: self rsClassDescriptor. | ||
aClassDiagram classes ifNotEmpty: [ :classes |. | ||
builder classes: OrderedCollection new. | ||
classes do: [ :class | class accept: self ] ]. | ||
builder build. | ||
builder renderIn: canvas. | ||
canvas zoomToFit. | ||
canvas @ RSCanvasController. | ||
^ canvas | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Package { #name : #'MermaidPharo-Roassal-ClassDiagram' } |