forked from chilit-nl/plantuml-event-modeling
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevent-modeling-lib.iuml
700 lines (584 loc) · 25.3 KB
/
event-modeling-lib.iuml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
@startuml
/'
Event Modeling library for PlantUML
This library is built for fast creation of Event Modeling diagrams in PlantUML.
More info: https://github.com/chilit-nl/plantuml-event-modeling
Author: Marries van de Hoef
Version: 1.0
Tested with PlantUML version: 1.2023.0 - 1.2023.3beta5
License: GPLv3 - https://www.gnu.org/licenses/gpl-3.0.html
'/
<style>
.command {
BackgroundColor lightblue
}
.event {
BackgroundColor orange
}
.view {
BackgroundColor palegreen
}
.concept {
BackgroundColor yellow
}
.extra {
BackgroundColor #eee
}
.wireframe {
BackgroundColor #fff
}
.hidden {
FontSize 0
LineThickness 0
LineColor #fff
BackgroundColor #fff
}
.eventarrow {
arrow {
LineColor orange
LineThickness 2
}
}
.commandarrow {
arrow {
LineColor lightblue
LineThickness 2
}
}
.defaultarrow {
arrow {
LineColor black
LineThickness 2
}
}
</style>
/'
**************** PlantUML configuration commands *********************
'/
' Other linetypes than ortho are not rendered correctly
skinparam linetype ortho
skinparam defaultTextAlignment center
' allowmixing (using figures from other diagrams than deployment) is not supported as it currently disallows arrow stereotypes (styles)
' A workaround is possible by not using arrow stereotypes, but instead style them within the arrow: -[#pink,thickness=10]->
' allowmixing
hide <<extra>> stereotype
/'
**************** Configuration variables *********************
'/
!$default_figure = "file"
!$default_heading_name = " "
!$default_heading_alias = "heading"
!$default_heading_figure = "rectangle"
!$default_heading_stereotype = "hidden"
!$event_heading_default_figure = $default_figure
!$wireframe_heading_default_figure = "actor"
!$context_default_figure = "frame"
!$configuration_enable_auto_alias = 0
!$configuration_enable_auto_spacing = 0
!$autospacing_averagePixelsPerCharacter = 7
!$autospacing_defaultNodeWidth = 55
!$autospacing_pixelsPerLineIncrement = 35
/'
**************** Pseudo data structures used *********************
The PlantUML preprocessor does not support any data structure, not even arrays.
Data structures are faked by using configurable variable names.
This section describes all configurable variable names.
The variables can be mutated using $_get, $_set, and $_exists
'/
' *********** Data structures used to record for rendering:
' * Lane types
!function $_laneTypeOrder($laneTypeIndex) !return "$laneTypeOrder-" + $laneTypeIndex
!$_laneTypeOrderMaxIndex = "$laneTypeOrder-maxIndex"
' * Lanes
!function $_laneMaxIndex($laneType) !return "$" + $laneType + "-maxIndex"
' * Lane heading
' Supported properties: name, alias, figure, stereotype
!function $_heading($laneType, $laneIndex, $property) !return "$" + $laneType + "-" + $laneIndex + "-heading-" + $property
' * Lane context
' Supported properties: name, alias
!function $_context($laneType, $laneIndex, $property) !return "$" + $laneType + "-" + $laneIndex + "-context-" + $property
' * Nodes
' Supported properties: name, alias, figure, stereotype, distanceToPrevious
!function $_node($laneType, $laneIndex, $itemIndex, $property) !return "$" + $laneType + "-" + $laneIndex + "-items-" + $itemIndex + "-" + $property
!function $_nodeMaxIndex($laneType, $laneIndex) !return "$" + $laneType + "-" + $laneIndex + "-items-maxIndex"
' * Arrows
' Supported properties: fromAlias, toAlias, stereotype, arrowHead
!function $_arrow($arrowIndex, $property) !return "$arrows-" + $arrowIndex + "-" + $property
!$_arrowsMaxIndex = "$arrows-maxIndex"
' *********** Temporary data structures used during recording:
!function $_aliasStorage($alias) !return "$aliasStorage-" + $alias
!function $_laneIndexLookup($laneType, $laneAlias) !return "$" + $laneType + "-indexlookup-" + $laneAlias
!function $_contextNameToAlias($contextName) !return "$contextNameToAlias-" + $contextName
' Tracks current lane width for autospacing
!function $_laneWidth($laneType, $laneIndex) !return "$" + $laneType + "-" + $laneIndex + "-laneWidth"
' Tracks desired position of new insertions
!$_currentWidth = "$autospacing-currentWidth"
' Remembers some properties of the previously added node, to use when autoadding an arrow between nodes
' Supported properties: alias, stereotype
!function $_previousNode($property) !return "$autoArrowPrevious-" + $property
' *********** Temporary data structures used during rendering:
!$_previousHeadingNodeAlias = "$render-previousHeadingNodeAlias"
!$_previousLaneContext = "$render-previousLaneContextAlias"
/'
**************** Utility functions *********************
'/
!function $_get($varName)
!return %get_variable_value($varName)
!endfunction
!function $_set($varName, $value)
!return %set_variable_value($varName, $value)
!endfunction
!function $_exists($varName)
!return %variable_exists($varName)
!endfunction
!function $_getAppendIndex($maxIndexStorageVariableName)
!$index = 0
!if $_exists($maxIndexStorageVariableName)
!$index = $_get($maxIndexStorageVariableName) + 1
!endif
$_set($maxIndexStorageVariableName, $index)
!return $index
!endfunction
!function $_incrementsNeededForUnusedVariableName($variableName)
!$increment = 1
!while $_exists($variableName + $increment)
!$increment = $increment + 1
!endwhile
!return $increment
!endfunction
!function $_removeSpaces($text)
!$spacePos = %strpos($text, " ")
!while $spacePos >= 0
!$split1 = %substr($text, 0, $spacePos)
!$split2 = %substr($text, $spacePos + 1)
!$text = $split1 + $split2
!$spacePos = %strpos($text, " ")
!endwhile
!return $text
!endfunction
!function $_createOrVerifyAlias($name, $alias = "")
!if $alias == ""
!$alias = $name
!endif
!$alias = $_removeSpaces($alias)
' Check if alias already exists
!if $_exists($_aliasStorage($alias))
!if $configuration_enable_auto_alias == 0
!$errormessage = "Name or alias already exists: " + $alias
!$suggestion "
-----------------------------
Enable automatic alias generation by calling 'enableAutoAlias()'.
This will generate Name, Name1, Name2, etc.
-----------------------------"
!assert %false() : $errormessage
!else
' Generate a new alias by enumerating on the name
!$increments = $_incrementsNeededForUnusedVariableName($_aliasStorage($alias))
!$alias = $alias + $increments
!endif
!endif
' Record the existence of this alias
$_set($_aliasStorage($alias), 1)
!return $alias
!endfunction
' Converts lane alias to lane index
!function $_lookupLaneIndex($laneType, $laneAlias)
!$laneIndex = 0
!if $_exists($_laneIndexLookup($laneType, $laneAlias))
' Lane is already known
!$laneIndex = $_get($_laneIndexLookup($laneType, $laneAlias))
!else
' Register new lane
!$laneIndex = $_getAppendIndex($_laneMaxIndex($laneType))
$_set($_laneIndexLookup($laneType, $laneAlias), $laneIndex)
!endif
!return $laneIndex
!endfunction
!function $_getVarOrDefault($variableName, $default)
!if $_exists($variableName)
!return $_get($variableName)
!endif
!return $default
!endfunction
!function $_max($a, $b)
!if $a > $b
!return $a
!endif
!return $b
!endfunction
!function $_divRounded($a, $b)
!return (2*$a + $b) / (2*$b)
!endfunction
!function $_repeatString($str, $times)
!$times = %intval($times)
!$result = ""
!$index = 0
!while $index < $times
!$result = $result + $str
!$index = $index + 1
!endwhile
!return $result
!endfunction
!function $_estimateTextWidthInPixels($text)
!return %strlen($text) * $autospacing_averagePixelsPerCharacter
!endfunction
' For multiline text, find the line with the highest estimated width
!function $_longestLineWidthInPixels($text)
!$lineBreakPos = %strpos($text, "\n")
!$maxWidth = 0
!while $lineBreakPos >= 0
!$split1 = %substr($text, 0, $lineBreakPos)
!$split2 = %substr($text, $lineBreakPos + 2)
!$maxWidth = $_max($maxWidth, $_estimateTextWidthInPixels($split1))
!$text = $split2
!$lineBreakPos = %strpos($text, "\n")
!endwhile
!$maxWidth = $_max($maxWidth, $_estimateTextWidthInPixels($text))
!return $maxWidth
!endfunction
' This is a bit of magic as exact numbers cannot be extracted from PlantUML
!function $_estimateNodeWidthInPixels($figure, $name)
!if $figure == "file" || $figure == "rectangle"
' 55 pixels was measured (incl margin, padding, and default line to next node)
!return 55 + $_longestLineWidthInPixels($name)
!elseif $figure == "actor"
' 36 is the margin + default line width, 26 is the actor with
!return 36 + $_max(26, $_longestLineWidthInPixels($name))
!endif
!return $autospacing_defaultNodeWidth + $_longestLineWidthInPixels($name)
!endfunction
/'
**************** Private procedures to record nodes, lanes, and arrows *********************
'/
!procedure $_addArrow($fromAlias, $toAlias, $stereotype, $arrowHead = ">")
!$arrowIndex = $_getAppendIndex($_arrowsMaxIndex)
!$fromAlias = $_removeSpaces($fromAlias)
!$toAlias = $_removeSpaces($toAlias)
$_set($_arrow($arrowIndex, "fromAlias"), $fromAlias)
$_set($_arrow($arrowIndex, "toAlias"), $toAlias)
$_set($_arrow($arrowIndex, "stereotype"), $stereotype)
$_set($_arrow($arrowIndex, "arrowHead"), $arrowHead)
!endprocedure
!procedure $_autoConfigureLaneTypes()
$_set($_laneTypeOrder(0), "extra")
$_set($_laneTypeOrder(1), "wireframe")
$_set($_laneTypeOrder(2), "commandview")
$_set($_laneTypeOrder(3), "event")
$_set($_laneTypeOrderMaxIndex, 3)
!endprocedure
$_autoConfigureLaneTypes()
!procedure $_configureLane($laneType, $laneIndex, $laneAlias, $headingName, $headingFigure, $headingStereotype, $headingAlias, $contextName = "")
$_set($_heading($laneType, $laneIndex, "name"), $headingName)
$_set($_heading($laneType, $laneIndex, "alias"), $headingAlias)
$_set($_heading($laneType, $laneIndex, "figure"), $headingFigure)
$_set($_heading($laneType, $laneIndex, "stereotype"), $headingStereotype)
!if $contextName != ""
' Retrieve a previous contextAlias for this name, if present
!$contextAlias = ""
!if $_exists($_contextNameToAlias($contextName))
!$contextAlias = $_get($_contextNameToAlias($contextName))
!else
!$contextAlias = $_createOrVerifyAlias($contextName)
$_set($_contextNameToAlias($contextName), $contextAlias)
!endif
$_set($_context($laneType, $laneIndex, "name"), $contextName)
$_set($_context($laneType, $laneIndex, "alias"), $contextAlias)
!endif
!endprocedure
!procedure $_storeNode($laneType, $laneIndex, $itemIndex, $name, $alias, $figure, $stereotype, $distanceToPrevious)
$_set($_node($laneType, $laneIndex, $itemIndex, "name"), $name)
$_set($_node($laneType, $laneIndex, $itemIndex, "alias"), $alias)
$_set($_node($laneType, $laneIndex, $itemIndex, "figure"), $figure)
$_set($_node($laneType, $laneIndex, $itemIndex, "stereotype"), $stereotype)
$_set($_node($laneType, $laneIndex, $itemIndex, "distanceToPrevious"), $distanceToPrevious)
!endprocedure
!procedure $_insertHeadingNode($laneType, $laneIndex, $itemIndex)
' Retrieve heading info
!$headingName = $default_heading_name
!$headingAlias = $default_heading_alias + $laneType + $laneIndex
!$headingFigure = $default_heading_figure
!$headingStereotype = $default_heading_stereotype
!if $_exists($_heading($laneType, $laneIndex, "name"))
!$headingName = $_get($_heading($laneType, $laneIndex, "name"))
!endif
!if $_exists($_heading($laneType, $laneIndex, "alias"))
!$headingAlias = $_get($_heading($laneType, $laneIndex, "alias"))
!else
!$headingAlias = $_createOrVerifyAlias($headingName, $headingAlias)
!endif
!if $_exists($_heading($laneType, $laneIndex, "figure"))
!$headingFigure = $_get($_heading($laneType, $laneIndex, "figure"))
!endif
!if $_exists($_heading($laneType, $laneIndex, "stereotype"))
!$headingStereotype = $_get($_heading($laneType, $laneIndex, "stereotype"))
!endif
$_storeNode($laneType, $laneIndex, $itemIndex, $headingName, $headingAlias, $headingFigure, $headingStereotype, 0)
!if $configuration_enable_auto_spacing == 1
' Initialize laneWidth
' The center of the heading nodes are the starting point for the laneWidth (because these centers are positioned vertically beneath each other)
!$startingWidth = $_divRounded($_estimateNodeWidthInPixels($headingFigure, $headingName), 2)
$_set($_laneWidth($laneType, $laneIndex), $startingWidth)
!endif
!endprocedure
!function $_computeAutoSpacing($laneType, $laneIndex, $name, $figure, $offset)
' The desired position is based on the pixel position defined in $currentWidth
' It is determined based on the previous node:
' - It is placed on the same horizontal position as the previous node
' - Except after an event. Then it moves to the right of the event
' Note that a node can be automatically moved to the right when no space is available in the current lane
' In that case, all following nodes will also move to the right
!$currentWidth = $_getVarOrDefault($_currentWidth, 0)
!$desiredPosition = $currentWidth
' Calculate the necessary number of line segments to add
!$laneWidth = $_getVarOrDefault($_laneWidth($laneType, $laneIndex), 0)
!$distanceInPixelsToAdd = $desiredPosition - $laneWidth
!$distanceToPrevious = $_divRounded($distanceInPixelsToAdd, $autospacing_pixelsPerLineIncrement) + %intval($offset)
!if $distanceToPrevious < 0
!$distanceToPrevious = 0
' Bump current positioning to right if this lane filled up
$_set($_currentWidth, $laneWidth)
!endif
' Update laneWidth
!$laneWidth = %intval($laneWidth + $_estimateNodeWidthInPixels($figure, $name) + $distanceToPrevious * $autospacing_pixelsPerLineIncrement)
$_set($_laneWidth($laneType, $laneIndex), $laneWidth)
!return $distanceToPrevious
!endfunction
!procedure $_addNode($laneType, $laneIndex, $name, $alias = "", $figure, $stereotype = "", $offset = 0, $autoArrow = 0)
!$alias = $_createOrVerifyAlias($name, $alias)
' Compute array append index
!$itemIndex = $_getAppendIndex($_nodeMaxIndex($laneType, $laneIndex))
!if $itemIndex == 0
' First insertion of this lane: add header and register lane
$_insertHeadingNode($laneType, $laneIndex, $itemIndex)
' Update index for the coming node
!$itemIndex = $_getAppendIndex($_nodeMaxIndex($laneType, $laneIndex))
' Register lane (for laneTypes with only 1 lane. Named lanes are registered in $_lookupLaneIndex)
!if %not($_exists($_laneMaxIndex($laneType)))
$_set($_laneMaxIndex($laneType), 0)
!endif
!endif
' Compute spacing
!$distanceToPrevious = $offset
!if $configuration_enable_auto_spacing == 1
!$distanceToPrevious = $_computeAutoSpacing($laneType, $laneIndex, $name, $figure, $offset)
!endif
' Write into array
$_storeNode($laneType, $laneIndex, $itemIndex, $name, $alias, $figure, $stereotype, $distanceToPrevious)
' Enable optional support for automatically adding an arrow from the previous node
$_autoAddArrow($alias, $stereotype, $autoArrow)
!endprocedure
!procedure $_autoAddArrow($currentNodeAlias, $currentNodeStereotype, $writeArrow)
!if $writeArrow == 1 && $_exists($_previousNode("alias")) && $_exists($_previousNode("stereotype"))
!$previousNodeAlias = $_get($_previousNode("alias"))
!$previousNodeStereotype = $_get($_previousNode("stereotype"))
' Arrow is only placed on sensible nodeType order
!if $previousNodeStereotype == "wireframe"
!if $currentNodeStereotype == "command"
$arrow($previousNodeAlias, $currentNodeAlias)
!endif
!elseif $previousNodeStereotype == "command"
!if $currentNodeStereotype == "event"
$commandarrow($previousNodeAlias, $currentNodeAlias)
!endif
!elseif $previousNodeStereotype == "event"
!if $currentNodeStereotype == "view" || $currentNodeStereotype == "extra"
$eventarrow($previousNodeAlias, $currentNodeAlias)
!endif
!elseif $previousNodeStereotype == "view"
!if $currentNodeStereotype == "wireframe"
$arrow($previousNodeAlias, $currentNodeAlias)
!endif
!elseif $previousNodeStereotype == "extra"
!if $currentNodeStereotype == "command"
$commandarrow($previousNodeAlias, $currentNodeAlias)
!endif
!endif
!endif
$_set($_previousNode("alias"), $currentNodeAlias)
$_set($_previousNode("stereotype"), $currentNodeStereotype)
!endprocedure
/'
**************** Private procedures to render nodes, lanes, and arrows *********************
'/
!procedure $_renderNodesForLane($laneType, $laneIndex, $itemMaxIndex)
' Render in backward order for correct left-to-right display
!$itemIndex = $itemMaxIndex
!while $itemIndex >= 0
' Fetch node data
!$name = $_get($_node($laneType, $laneIndex, $itemIndex, "name"))
!$alias = $_get($_node($laneType, $laneIndex, $itemIndex, "alias"))
!$figure = $_get($_node($laneType, $laneIndex, $itemIndex, "figure"))
!$stereotype = $_get($_node($laneType, $laneIndex, $itemIndex, "stereotype"))
' Render node
!$stereotypePart = "<<" + $stereotype + ">>"
!if $stereotype == ""
!$stereotypePart = ""
!endif
$figure "$name" as $alias $stereotypePart
!$itemIndex = $itemIndex - 1
!endwhile
!endprocedure
!procedure $_renderLaneInternalArrows($laneType, $laneIndex, $itemMaxIndex)
' Render lane-internal arrows to keep all nodes horizontal and in order
!$itemIndex = 0
!$previousNodeAlias = $_get($_node($laneType, $laneIndex, $itemIndex, "alias"))
!$itemIndex = 1
!while $itemIndex <= $itemMaxIndex
!$currentNodeAlias = $_get($_node($laneType, $laneIndex, $itemIndex, "alias"))
!$currentNodeDistanceToPrevious = $_get($_node($laneType, $laneIndex, $itemIndex, "distanceToPrevious"))
!$arrowPart = "-[norank,hidden]" + $_repeatString("-", $currentNodeDistanceToPrevious) + "-"
' Render arrow
$previousNodeAlias $arrowPart $currentNodeAlias
!$previousNodeAlias = $currentNodeAlias
!$itemIndex = $itemIndex + 1
!endwhile
!endprocedure
!procedure $_renderStructuralArrowToPreviousLane($laneType, $laneIndex, $itemMaxIndex)
' Render arrow between headings to create a correct lane layout from top to bottom
!$currentHeadingNodeAlias = $_get($_node($laneType, $laneIndex, 0, "alias"))
!if $_exists($_previousHeadingNodeAlias)
!$previousHeadingNodeAlias = $_get($_previousHeadingNodeAlias)
' Render the arrow
$previousHeadingNodeAlias -[hidden]d-> $currentHeadingNodeAlias
!endif
$_set($_previousHeadingNodeAlias, $currentHeadingNodeAlias)
!endprocedure
!procedure $_renderContextWrapper($laneType, $laneIndex)
!$contextName = $_getVarOrDefault($_context($laneType, $laneIndex, "name"), "")
!$contextAlias = $_getVarOrDefault($_context($laneType, $laneIndex, "alias"), "")
!$previousContextAlias = $_getVarOrDefault($_previousLaneContext, "")
!if $contextAlias != $previousContextAlias
!if $previousContextAlias != ""
' Render context close
' Note that the closing accolade for the final line may be placed in $_renderLaneTypes
}
!endif
!if $contextAlias != ""
' Render context
$context_default_figure "$contextName" as $contextAlias {
!endif
!endif
$_set($_previousLaneContext, $contextAlias)
!endprocedure
!procedure $_renderLanesForType($laneType)
!$laneIndex = 0
!$laneMaxIndex = $_getVarOrDefault($_laneMaxIndex($laneType), -1)
!while $laneIndex <= $laneMaxIndex
!$itemMaxIndex = $_getVarOrDefault($_nodeMaxIndex($laneType, $laneIndex), -1)
' Check if the lane is not empty and contains more than just the heading node
!if $itemMaxIndex > 0
' Render context wrapper, if configured
$_renderContextWrapper($laneType, $laneIndex)
' Render hidden container for all nodes
!$containerNodeName = "rect-" + $laneType + "-" + $laneIndex
rectangle $containerNodeName <<hidden>> {
$_renderNodesForLane($laneType, $laneIndex, $itemMaxIndex)
$_renderLaneInternalArrows($laneType, $laneIndex, $itemMaxIndex)
}
$_renderStructuralArrowToPreviousLane($laneType, $laneIndex, $itemMaxIndex)
!endif
!$laneIndex = $laneIndex + 1
!endwhile
!endprocedure
!procedure $_renderLaneTypes()
!$laneTypeIndex = 0
!$laneTypeMaxIndex = $_get($_laneTypeOrderMaxIndex)
!$laneType = ""
!while $laneTypeIndex <= $laneTypeMaxIndex
!$laneType = $_get($_laneTypeOrder($laneTypeIndex))
$_renderLanesForType($laneType)
!$laneTypeIndex = $laneTypeIndex + 1
!endwhile
' Close the remaining context, if present
!if $_getVarOrDefault($_previousLaneContext, "") != ""
}
!endif
!endprocedure
!procedure $_renderArrows()
!$arrowIndex = 0
!$arrowMaxIndex = $_getVarOrDefault($_arrowsMaxIndex, -1)
!while $arrowIndex <= $arrowMaxIndex
!$fromAlias = $_get($_arrow($arrowIndex, "fromAlias"))
!$toAlias = $_get($_arrow($arrowIndex, "toAlias"))
!$stereotype = $_get($_arrow($arrowIndex, "stereotype"))
!$arrowHead = $_get($_arrow($arrowIndex, "arrowHead"))
!$arrowPart = "-[norank]-" + $arrowHead
!$stereotypePart = "<<" + $stereotype + ">>"
!if $stereotype == ""
!$stereotypePart = ""
!endif
' Render the arrow
$fromAlias $arrowPart $toAlias $stereotypePart
!$arrowIndex = $arrowIndex + 1
!endwhile
!endprocedure
/'
**************** Public configuration procedures *********************
'/
!procedure $enableAutoAlias()
!$configuration_enable_auto_alias = 1
!endprocedure
!procedure $enableAutoSpacing()
!$configuration_enable_auto_spacing = 1
!endprocedure
!unquoted procedure $configureWireframeLane($laneAlias, $headingName = "", $headingAlias = "")
!if $headingName == ""
!$headingName = $laneAlias
!endif
!$laneAlias = $_createOrVerifyAlias($laneAlias)
!if $headingAlias == ""
!$headingAlias = $laneAlias + "heading"
!endif
!$headingAlias = $_createOrVerifyAlias($headingName, $headingAlias)
!$laneIndex = $_lookupLaneIndex("wireframe", $laneAlias)
$_configureLane("wireframe", $laneIndex, $laneAlias, $headingName, $wireframe_heading_default_figure, "", $headingAlias)
!endprocedure
!unquoted procedure $configureEventLane($laneAlias, $headingName = "", $headingAlias = "", $context = "")
!if $headingName == ""
!$headingName = $laneAlias
!endif
!$laneAlias = $_createOrVerifyAlias($laneAlias)
!if $headingAlias == ""
!$headingAlias = $laneAlias + "heading"
!endif
!$headingAlias = $_createOrVerifyAlias($headingName, $headingAlias)
!$laneIndex = $_lookupLaneIndex("event", $laneAlias)
$_configureLane("event", $laneIndex, $laneAlias, $headingName, $event_heading_default_figure, "concept", $headingAlias, $context)
!endprocedure
/'
**************** Public procedures to record nodes and arrows *********************
'/
!unquoted procedure $extra($name, $offset = 0, $arrow = 1, $alias = "", $figure = $default_figure)
$_addNode("extra", 0, $name, $alias, $figure, "extra", $offset, $arrow)
!endprocedure
!unquoted procedure $wireframe($name, $laneAlias = "defaultLane", $offset = 0, $arrow = 1, $alias = "", $figure = $default_figure)
!$laneIndex = $_lookupLaneIndex("wireframe", $laneAlias)
$_addNode("wireframe", $laneIndex, $name, $alias, $figure, "wireframe", $offset, $arrow)
!endprocedure
!unquoted procedure $command($name, $offset = 0, $arrow = 1, $alias = "", $figure = $default_figure)
$_addNode("commandview", 0, $name, $alias, $figure, "command", $offset, $arrow)
!endprocedure
!unquoted procedure $view($name, $offset = 0, $arrow = 1, $alias = "", $figure = $default_figure)
$_addNode("commandview", 0, $name, $alias, $figure, "view", $offset, $arrow)
!endprocedure
!unquoted procedure $event($name, $laneAlias = "defaultLane", $offset = 0, $arrow = 1, $alias = "", $figure = $default_figure)
!$laneIndex = $_lookupLaneIndex("event", $laneAlias)
$_addNode("event", $laneIndex, $name, $alias, $figure, "event", $offset, $arrow)
!endprocedure
!unquoted procedure $commandarrow($from, $to)
$_addArrow($from, $to, commandarrow)
!endprocedure
!unquoted procedure $eventarrow($from, $to)
$_addArrow($from, $to, eventarrow)
!endprocedure
!unquoted procedure $arrow($from, $to)
$_addArrow($from, $to, defaultarrow)
!endprocedure
/'
**************** Public procedures to render the recorded nodes *********************
'/
!procedure $renderEventModelingDiagram()
$_renderLaneTypes()
$_renderArrows()
!endprocedure
@enduml