<commit_before>Class {
	#name : #RSMondrian,
	#superclass : #Object,
	#instVars : [
		'canvas',
		'layoutBuilder',
		'shapeBuilder',
		'nodesForLayout',
		'lineBuilder',
		'depth'
	],
	#category : #'Roassal3-Mondrian-Core'
}

{ #category : #'building - graph' }
RSMondrian >> applyLayout [
	layoutBuilder on: nodesForLayout
]

{ #category : #'building - graph' }
RSMondrian >> arrowedLine [
	lineBuilder := RSLineBuilder arrowedLineWithOffset.
	lineBuilder canvas: canvas.
	lineBuilder shapes: canvas nodes.
	lineBuilder withBorderAttachPoint.
	lineBuilder color: self defaultLineColor.
	^ lineBuilder
]

{ #category : #'public - opening and public' }
RSMondrian >> build [
	"This is a public method. It is used to actually build the visualization from the description provided by the user."
	| interaction |
	self applyLayout.
	
	interaction := RSHighlightable new.
	interaction highlightBorder: (RSBorder new color: Color black; width: 2).
	interaction withOutgoingEdges.
	self canvas nodes @ interaction.
	
	self canvas pushBackEdges.
		 
]

{ #category : #accessing }
RSMondrian >> canvas [
	"Return the canvas that contains the visualization built by Mondrian"
	^ canvas
]

{ #category : #accessing }
RSMondrian >> canvas: aCanvas [
	canvas := aCanvas
]

{ #category : #configuration }
RSMondrian >> defaultLineColor [
	^ Color gray translucent
]

{ #category : #visualization }
RSMondrian >> gtInspectorViewIn: composite [

	<gtInspectorPresentationOrder: -10>
	composite roassal3
		title: [ 'Canvas' ];
		initializeCanvas: [ self build; canvas ]
]

{ #category : #'building - graph' }
RSMondrian >> initialize [
	super initialize.
	shapeBuilder := RSShapeBuilder new.
	layoutBuilder := RSLayoutBuilder new.
	canvas := RSCanvas new @ RSCanvasController.
	nodesForLayout := RSGroup new.
	depth := 0
]

{ #category : #'building - graph' }
RSMondrian >> layout [
	^ layoutBuilder
]

{ #category : #'building - graph' }<commit_msg>Make `RSMondrian` happy with the new Spec inspector<commit_after>Class {
	#name : #RSMondrian,
	#superclass : #Object,
	#instVars : [
		'canvas',
		'layoutBuilder',
		'shapeBuilder',
		'nodesForLayout',
		'lineBuilder',
		'depth'
	],
	#category : #'Roassal3-Mondrian-Core'
}

{ #category : #'building - graph' }
RSMondrian >> applyLayout [
	layoutBuilder on: nodesForLayout
]

{ #category : #'building - graph' }
RSMondrian >> arrowedLine [
	lineBuilder := RSLineBuilder arrowedLineWithOffset.
	lineBuilder canvas: canvas.
	lineBuilder shapes: canvas nodes.
	lineBuilder withBorderAttachPoint.
	lineBuilder color: self defaultLineColor.
	^ lineBuilder
]

{ #category : #'public - opening and public' }
RSMondrian >> build [
	"This is a public method. It is used to actually build the visualization from the description provided by the user."
	| interaction |
	self applyLayout.
	
	interaction := RSHighlightable new.
	interaction highlightBorder: (RSBorder new color: Color black; width: 2).
	interaction withOutgoingEdges.
	self canvas nodes @ interaction.
	
	self canvas pushBackEdges.
		 
]

{ #category : #accessing }
RSMondrian >> canvas [
	"Return the canvas that contains the visualization built by Mondrian"
	^ canvas
]

{ #category : #accessing }
RSMondrian >> canvas: aCanvas [
	canvas := aCanvas
]

{ #category : #configuration }
RSMondrian >> defaultLineColor [
	^ Color gray translucent
]

{ #category : #visualization }
RSMondrian >> gtInspectorViewIn: composite [

	<gtInspectorPresentationOrder: -10>
	composite roassal3
		title: [ 'Canvas' ];
		initializeCanvas: [ self build; canvas ]
]

{ #category : #'building - graph' }
RSMondrian >> initialize [
	super initialize.
	shapeBuilder := RSShapeBuilder new.
	layoutBuilder := RSLayoutBuilder new.
	canvas := RSCanvas new @ RSCanvasController.
	nodesForLayout := RSGroup new.
	depth := 0
]

{ #category : #visualization }
RSMondrian >> inspectorVisualization [
	<inspectorPresentationOrder: 90 title: 'Mondrian'>
	self build.
	^ SpRoassal3InspectorPresenter new
		canvas: self canvas;
		yourself

]

{ #category : #visualization }
RSMondrian >> inspectorVisualizationContext: aContext [
  
  aContext withoutEvaluator
]

{ #category : #'building - graph' }
RSMondrian >> layout [
	^ layoutBuilder
]

{ #category : #'building - graph' }
{'fraction_non_alphanumeric': 0.11029759093056211, 'fraction_numerical': 0.0035427491733585263, 'mean_word_length': 4.5, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 46, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2354512', 'n_tokens_mistral': 1414, 'n_tokens_neox': 1357, 'n_words': 370}