diff --git a/C4.puml b/C4.puml index 6ec4334c..ec5a0a86 100644 --- a/C4.puml +++ b/C4.puml @@ -1293,6 +1293,57 @@ rectangle "$getBoundary($label, $type)" $toStereos("boundary", $boundaryTags) as ' Boundary Styling UpdateBoundaryStyle("", $bgColor=$BOUNDARY_BG_COLOR, $fontColor=$BOUNDARY_COLOR, $borderColor=$BOUNDARY_COLOR) +' Index +' ################################## + +' Dynamic/Sequence diagram supports (automatically) numbered interactions: +' preferred function calls +' (Uppercase) LastIndex(): return the last used index (function which can be used as argument) +' (Uppercase) Index($offset=1): returns current index and calculates next index (function which can be used as argument) +' (Uppercase) SetIndex($new_index): returns new set index and calculates next index (function which can be used as argument) + +' old procedures calls +' (lowercase) increment($offset=1): increase current index (procedure which has no direct output) +' (lowercase) setIndex($new_index): set the new index (procedure which has no direct output) + +!$lastIndex = 0 +!$index = 1 + +!procedure increment($offset=1) + !$lastIndex = $index + !$index = $index + $offset +!endprocedure + +!procedure setIndex($new_index) + !$lastIndex = $index + !$index = $new_index +!endprocedure + +!function Index($offset=1) + !$lastIndex = $index + !$index = $lastIndex + $offset + !return $lastIndex +!endfunction + +!function LastIndex() + !return $lastIndex +!endfunction + +!function SetIndex($new_index, $offset=1) + !$lastIndex = $new_index + !$index = $new_index + $offset + !return $lastIndex +!endfunction + +!unquoted function $getPrefix($index) + !if ($index == "") + !$pre = Index() + ": " + !else + !$pre = $index + ": " + !endif + !return $pre +!endfunction + ' Relationship ' ################################## diff --git a/C4_Dynamic.puml b/C4_Dynamic.puml index 8633ec48..fa408ba8 100644 --- a/C4_Dynamic.puml +++ b/C4_Dynamic.puml @@ -20,38 +20,6 @@ ' (Uppercase) Index($offset=1): returns current index and calculates next index (function which can be used as argument) ' (Uppercase) SetIndex($new_index): returns new set index and calculates next index (function which can be used as argument) -' Index -' ################################## - -!$lastIndex = 0 -!$index = 1 - -!procedure increment($offset=1) - !$lastIndex = $index - !$index = $index + $offset -!endprocedure - -!procedure setIndex($new_index) - !$lastIndex = $index - !$index = $new_index -!endprocedure - -!function Index($offset=1) - !$lastIndex = $index - !$index = $lastIndex + $offset - !return $lastIndex -!endfunction - -!function LastIndex() - !return $lastIndex -!endfunction - -!function SetIndex($new_index, $offset=1) - !$lastIndex = $new_index - !$index = $new_index + $offset - !return $lastIndex -!endfunction - ' Relationship override ' ################################## @@ -65,39 +33,47 @@ $getRel($direction, $alias1, $alias2, $e_index + ": " + $label, "", "", "", "", $getRel($direction, $alias1, $alias2, $e_index + ": " + $label, $techn, "", "", "", "") !endprocedure -!unquoted procedure Rel($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("-->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) +' all RelIndex... calls are outdated, Rel(..., $index=...) calls should be used !!!! + +!unquoted procedure Rel($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="", $index="") +!$pre = $getPrefix($index) +$getRel("-->>", $from, $to, $pre + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure RelIndex($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") $getRel("-->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_Back($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("<<--", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) +!unquoted procedure Rel_Back($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="", $index="") +!$pre = $getPrefix($index) +$getRel("<<--", $from, $to, $pre + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure RelIndex_Back($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") $getRel("<<--", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_Neighbor($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) +!unquoted procedure Rel_Neighbor($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="", $index="") +!$pre = $getPrefix($index) +$getRel("->>", $from, $to, $pre + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure RelIndex_Neighbor($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") $getRel("->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_Back_Neighbor($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("<<-", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) +!unquoted procedure Rel_Back_Neighbor($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="", $index="") +!$pre = $getPrefix($index) +$getRel("<<-", $from, $to, $pre + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure RelIndex_Back_Neighbor($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") $getRel("<<-", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_D($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel($down("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) +!unquoted procedure Rel_D($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="", $index="") +!$pre = $getPrefix($index) +$getRel($down("-","->>"), $from, $to, $pre + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_Down($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel($down("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) +!unquoted procedure Rel_Down($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="", $index="") +!$pre = $getPrefix($index) +$getRel($down("-","->>"), $from, $to, $pre + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure RelIndex_D($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") $getRel($down("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) @@ -106,11 +82,13 @@ $getRel($down("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $getRel($down("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_U($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel($up("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) +!unquoted procedure Rel_U($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="", $index="") +!$pre = $getPrefix($index) +$getRel($up("-","->>"), $from, $to, $pre + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_Up($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel($up("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) +!unquoted procedure Rel_Up($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="", $index="") +!$pre = $getPrefix($index) +$getRel($up("-","->>"), $from, $to, $pre + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure RelIndex_U($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") $getRel($up("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) @@ -119,11 +97,13 @@ $getRel($up("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $s $getRel($up("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_L($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel($left("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) +!unquoted procedure Rel_L($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="", $index="") +!$pre = $getPrefix($index) +$getRel($left("-","->>"), $from, $to, $pre + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure Rel_Left($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel($left("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) +!$pre = $getPrefix($index) +$getRel($left("-","->>"), $from, $to, $pre + $label, $techn, $descr, $sprite, $tags, $link, $index="") !endprocedure !unquoted procedure RelIndex_L($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") $getRel($left("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) @@ -132,11 +112,13 @@ $getRel($left("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $getRel($left("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_R($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel($right("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) +!unquoted procedure Rel_R($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="", $index="") +!$pre = $getPrefix($index) +$getRel($right("-","->>"), $from, $to, $pre + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure -!unquoted procedure Rel_Right($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel($right("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) +!unquoted procedure Rel_Right($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="", $index="") +!$pre = $getPrefix($index) +$getRel($right("-","->>"), $from, $to, $pre + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure RelIndex_R($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") $getRel($right("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) diff --git a/C4_Sequence.puml b/C4_Sequence.puml index 16701bef..5938c813 100644 --- a/C4_Sequence.puml +++ b/C4_Sequence.puml @@ -61,6 +61,16 @@ UpdateBoundaryStyle("container", $bgColor=$CONTAINER_BOUNDARY_BG_COLOR, $fontCol !endif !endprocedure +!global $show_index = %false() +' All relation specific (default) ordinary index numbers can be shown with this call +!unquoted procedure SHOW_INDEX($show="true") +!if ($show == "true") + !global $show_index = %true() +!else + !global $show_index = %false() +!endif +!endprocedure + ' ======= if no theme is defined hide foot box and activate C4_blue styles !if (%variable_exists("$THEME")) !else @@ -365,55 +375,20 @@ end box Boundary($alias, $label, "", $allTags, $link) !endprocedure - -' Index -' ################################## - -!$lastIndex = 0 -!$index = 1 - -!procedure increment($offset=1) - !$lastIndex = $index - !$index = $index + $offset -!endprocedure - -!procedure setIndex($new_index) - !$lastIndex = $index - !$index = $new_index -!endprocedure - -!function Index($offset=1) - !$lastIndex = $index - !$index = $lastIndex + $offset - !return $lastIndex -!endfunction - -!function LastIndex() - !return $lastIndex -!endfunction - -!function SetIndex($new_index, $offset=1) - !$lastIndex = $new_index - !$index = $new_index + $offset - !return $lastIndex -!endfunction - ' Relationship (redefinition) ' ################################## -!unquoted procedure Rel_($e_index, $alias1, $alias2, $label, $direction) -$getRel($direction, $alias1, $alias2, $e_index + ": " + $label, "", "", "", "", "") -!endprocedure -!unquoted procedure Rel_($e_index, $alias1, $alias2, $label, $techn, $direction) -$getRel($direction, $alias1, $alias2, $e_index + ": " + $label, $techn, "", "", "", "") -!endprocedure +' only Rel is supported in sequence diagram -!unquoted procedure Rel($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("->", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) -!endprocedure -!unquoted procedure RelIndex($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("->", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) -!endprocedure -!unquoted procedure RelSpecialIndex($rel, $e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel($rel, $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) +' don't add empty lines in procedure otherwise & calls are not working anymore '& a -> b: call' are not working anymore +!unquoted procedure Rel($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="", $index="", $rel="") + !if ($show_index == %true()) + !$pre = $getPrefix($index) + !else + !$pre = "" + !endif + !if ($rel == "") + !$rel = "->" + !endif +$getRel($rel, $from, $to, $pre + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure diff --git a/LayoutOptions.md b/LayoutOptions.md index 730b8875..f1df309a 100644 --- a/LayoutOptions.md +++ b/LayoutOptions.md @@ -18,6 +18,10 @@ C4-PlantUML comes with some layout options. - [Using SHOW_PERSON_SPRITE(sprite)](#using-show_person_spritesprite) - [Using SHOW_PERSON_PORTRAIT()](#using-show_person_portrait) - [Using SHOW_PERSON_OUTLINE()](#using-show_person_outline) + - [(C4 styled) Sequence diagram specific layout options](#c4-styled-sequence-diagram-specific-layout-options) + - [SHOW_ELEMENT_DESCRIPTIONS(?show)](#show_element_descriptionsshow) + - [SHOW_FOOT_BOXES(?show)](#show_foot_boxesshow) + - [SHOW_INDEX(?show)](#show_indexshow) - [📄 Themes](Themes.md#themes) - samples - [📄 C4 Model Diagrams](samples/C4CoreDiagrams.md#c4-model-diagrams) @@ -557,3 +561,78 @@ Rel(web_app, twitter, "Gets tweets from", "HTTPS") ``` ![SHOW_PERSON_OUTLINE() Sample](https://www.plantuml.com/plantuml/png/RL5BQzj04BxhLqpTWcLm919wAXJY6jCK4bj4SdCK8sbYB-nZsHqXJEb_xopAeuVeeDNEV8_vHhUHCV1eDDHtXwUssZtMXtrxE3Rtl_QxV0Kr6gyf-wHihyU1uCpiuxUo33WL9yNdiHiZXTvP9ij5xqpfDTeaU1LvqAehjr-lgbGwFjoN1YDJa5Ax5GOgIw7mWiso3zsphA8GdSrnCCgkOR59fueSa5rOhBBw8dgc_U56Es2uvFtr6fRpoCiL_Cb0dZUdVAAkHUz5vuaws7YlLO-id5r8QVjv3PkwAlQxHYY1uAQuXeVVszJRQEsc22bf17OWCJqAn8oQbNX1CocMOC3Aa1QlABFzVPakvxafEYymQMPBKC-0u2db0nMJPYVC0GHpbaxqGJ41dycc5mJg6Ur9p3HUtCY9CqR1uqdIlIvgrXEh-JwBpL8IvClyzNqnmsxI88-aNzVxlfzZb0XotZLDLGigWTwwxtb-4aUvKZgUWpF_Ksx93kdF_WC0 "SHOW_PERSON_OUTLINE()") + +## (C4 styled) Sequence diagram specific layout options + +- **SHOW_ELEMENT_DESCRIPTIONS(?show)**: show or hide (hidden is default) all element/participant related descriptions +- **SHOW_FOOT_BOXES(?show)**: show or hide (hidden is default) all element/participant related foot boxes +- **SHOW_INDEX(?show)**: show or hide (hidden is default) the relationship (call) related index (sequence number) + +show is defined with `$show=true` and hide is defined with `$show=false` + +### SHOW_ELEMENT_DESCRIPTIONS(?show) + +```plantuml +@startuml +!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Sequence.puml + +SHOW_ELEMENT_DESCRIPTIONS() + +Person(admin, "Administrator", "People that administrates the products") +System_Boundary(c1, 'Sample') + Container(web_app, "Web Application", "C#, ASP.NET Core 2.1 MVC", "Allows users to compare multiple Twitter timelines") +' in a sequence diagram Boundary_End() has to be used instead of { } +Boundary_End() +System(twitter, "Twitter") + +Rel(admin, web_app, "Uses", "HTTPS") +Rel(web_app, twitter, "Gets tweets from", "HTTPS") +@enduml +``` + +![SHOW_ELEMENT_DESCRIPTIONS() Sample](https://www.plantuml.com/plantuml/png/LL1DRzD04BtxLmpX44TARHLnujHWB5gfIQtQfKThx9qsA-t7iZihgqByTtOX8U3Boc_Unvkv2OoUerR5Esbc5GN1aTc5JtNjSQbU9H_Z50FvsHecmzLiTUqKcgov2YoKdEhcurMNeQVzVQqnCFa4ZJrzZsHcgbosB_hRX-UnlM_txM4OlxHzytZN3NSFXxxS54L7FbXJej3IR66rowyCx96jNoMW8-iK0H-H0Iz32WaYSDwAE7DOROh-BSNhyREDHg1_A-VhBQnxr4cztXIGliOQHcd8bmjD8pgNx9zfWfrpIix8qfgSsBpVmgxlgaCx98ad-51Tm_vRasSxfUmI89yb05kOhNQOA3egbhddi4Xcyi1IaqfPkTaQf064SBeA28cl7ZMSguwj4UK6ZlZRSg9iBv8cCA40-mBm0tuM_xDFwvRy9ozLEoMdlEAHrFcWbqsV0eMymkqmT7rYPTBVwSNcAt58lvIV5s_rlv8RCY9gzGi0 "SHOW_ELEMENT_DESCRIPTIONS() Sample") + +### SHOW_FOOT_BOXES(?show) + +```plantuml +@startuml +!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Sequence.puml + +SHOW_FOOT_BOXES() + +Person(admin, "Administrator") +System_Boundary(c1, 'Sample') + Container(web_app, "Web Application", "C#, ASP.NET Core 2.1 MVC", "Allows users to compare multiple Twitter timelines") +' in a sequence diagram Boundary_End() has to be used instead of { } +Boundary_End() +System(twitter, "Twitter") + +Rel(admin, web_app, "Uses", "HTTPS") +Rel(web_app, twitter, "Gets tweets from", "HTTPS") +@enduml +``` + +![SHOW_FOOT_BOXES() Sample](https://www.plantuml.com/plantuml/png/LL1DRzD04BtlhnZ28OwKsYhYnAbf5EY1aWYxb9irzawRbVPZsPrLL27-ExEY8U3Bo3FluxszoOo9YxFgZV6pBPhWo1ppXwvBU6gV3H_BL3AbENWcp-qSN1Sj-igvogojcRhj-wj3NJtSV-uSPgOagx6d7uNyJ6siygg_sp-E7_VxORpTVz_rpKgf0wKSV8FQ6R-6nQPEapaXXxHOgVv5fDnu6uhNc5wQ-NeDonvTjBHSAP1lAw7GU4hDYQOHOnILHvfW4wCrCx89VY6hxTirRFf3-sKt22KHl6kluVxRjjusrePJXben0mUGVX45uefb8qumd0nB8s3Zo8fNbcHBC1uGycj3q0QV4peuHnrtNZShE6ALX8cgl1QEz44DuGdW9_nI_w7FTHl-uoVHNft5JtqbUtwcIzE7B65atWt3eHTK1VszNcG-4MVvfJgUKd3_Kcx8w-BiRm00 "SHOW_FOOT_BOXES() Sample") + +### SHOW_INDEX(?show) + +```plantuml +@startuml +!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Sequence.puml + +SHOW_INDEX() + +Person(admin, "Administrator") +System_Boundary(c1, 'Sample') + Container(web_app, "Web Application", "C#, ASP.NET Core 2.1 MVC", "Allows users to compare multiple Twitter timelines") +' in a sequence diagram Boundary_End() has to be used instead of { } +Boundary_End() +System(twitter, "Twitter") + +Rel(admin, web_app, "Uses", "HTTPS") +Rel(web_app, twitter, "Gets tweets from", "HTTPS") +@enduml +``` + +![SHOW_INDEX() Sample](https://www.plantuml.com/plantuml/png/LL1DRzD04BtlhnZ28OwKsYhYnAaXH1I9bWYxb9irzawRbVPZsPsLLI7-ExEYeU3Bo3Fluxszoeo9YxFgbV6pBPhWn1ppkwvBkBIFXazbAfdI73oJvtOEheiMVULSPDRMJDt-xSMnhkvkFdSECrEIrTZJZq9-fZPMUTLVVxaVFzr-E7nlDaeTAUNW6zJE-2siTdMQp0avfDL6zK-YuiRteNYDwQcPBxUmxj55I-kD0ldsaWUDfzGiD8qOewZSqmIx6AsPaKtmArdjNszXrn_RsyCWb4Jmfhs4cs_xUjjP6vOCjLq63Y3L8Wh45Sj6d61O34iPOEF8YbUMP6im7X3oSpdG1XyJEZX77GzUDniuOPM4YQgy5exqGGtX0U0d_5B_eSzr6_xZ9z6UdSLFVILxVgQNfdTPmiYy7ePZBwWA-djzaVb8dEMNwdX8mVrBkIAlYxE_0G00 "SHOW_INDEX() Sample") + diff --git a/README.md b/README.md index b7346878..69ebf676 100644 --- a/README.md +++ b/README.md @@ -255,7 +255,7 @@ SHOW_LEGEND() ### Container diagram - Import: `!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml` - - Additional Macros: + - Additional Macros (based on context diagram macros): - `Container(alias, label, ?techn, ?descr, ?sprite, ?tags, ?link)` - `ContainerDb` - `ContainerQueue` @@ -267,7 +267,7 @@ SHOW_LEGEND() ### Component diagram - Import: `!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml` - - Additional Macros: + - Additional Macros (based on container diagram macros): - `Component(alias, label, ?techn, ?descr, ?sprite, ?tags, ?link)` - `ComponentDb` - `ComponentQueue` @@ -278,8 +278,7 @@ SHOW_LEGEND() ### Dynamic diagram - Import: `!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Dynamic.puml` - - Additional Macros (based on the component diagram macros): - - `RelIndex(index, from, to, label, ?tags, ?link)` + - Additional Macros (based on component diagram macros): - (lowercase) `increment($offset=1)`: increase current index (procedure which has no direct output) - (lowercase) `setIndex($new_index)`: set the new index (procedure which has no direct output) - `LastIndex()`: return the last used index (function which can be used as argument) @@ -288,6 +287,11 @@ SHOW_LEGEND() - `Index($offset=1)`: returns current index and calculates next index (function which can be used as argument) - `SetIndex($new_index)`: returns new set index and calculates next index (function which can be used as argument) + - All relationship macros are extended with `?index= `: + + > All `RelIndex...()` calls are obsolete and can be replaced with calls like Rel($index=..., ...) or Rel(..., $index=). + > A full sample see [samples/C4_Dynamic Diagram Sample - message bus.puml](samples/C4_Dynamic%20Diagram%20Sample%20-%20message%20bus.puml) + ### Deployment diagram - Import: `!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Deployment.puml` @@ -311,22 +315,22 @@ but existing elements and relationships can be reused as participants and calls - **boundaries have to be defined without `{` and `}`** and instead of `}` the **`Boundary_End()`** macro has to be called - Additional (element specific) Macros: - `Boundary_End()` - - Additional (element specific) Layout Options: + - Additional Layout Options: - `SHOW_ELEMENT_DESCRIPTIONS(?show)` - `SHOW_FOOT_BOXES(?show)` - - Only following 3 relationship specific macros are supported: - - `Rel($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")` - - `RelIndex($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")` - - `RelSpecialIndex($rel, $e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")`: + - `SHOW_INDEX(?show)` + - Only following (extended) relationship specific macros is supported: + - `Rel($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="", $index="", $rel="")` + `$index` enables the definition of active/next index with e.g. the related index macros below `$rel` enables the definition of all PlantUML specific arrow types, details see e.g. [All arrow types](https://plantuml.com/sequence-diagram#4764f83f72ed032f) and [Slanted or odd arrows](https://plantuml.com/sequence-diagram#5bd6712206960fab) - - The 5 index related macros (like the dynamic diagram) - - (lowercase) `increment($offset=1)`: increase current index (procedure which has no direct output) - - (lowercase) `setIndex($new_index)`: set the new index (procedure which has no direct output) - - `LastIndex()`: return the last used index (function which can be used as argument) + - The index related macros (like the dynamic diagram) - `Index($offset=1)`: returns current index and calculates next index (function which can be used as argument) - `SetIndex($new_index)`: returns new set index and calculates next index (function which can be used as argument) + - `LastIndex()`: return the last used index (function which can be used as argument) + - (lowercase) `increment($offset=1)`: increase current index (procedure which has no direct output) + - (lowercase) `setIndex($new_index)`: set the new index (procedure which has no direct output) - (Typically additional used) PlantUML statements: - [Grouping message](https://plantuml.com/sequence-diagram#425ba4350c02142c) diff --git a/percy/TestSequenceSkinparams.puml b/percy/TestSequenceSkinparams.puml index 5c26be5e..e2be6ef2 100644 --- a/percy/TestSequenceSkinparams.puml +++ b/percy/TestSequenceSkinparams.puml @@ -71,12 +71,14 @@ sequenceDiagram { !include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Sequence.puml !endif +SHOW_INDEX(true) + Person(Alice, "Alice") Person(Bob, "Bob") activate Bob -Rel(Alice, Bob, "Authentication Request") +Rel(Alice, Bob, "Authentication Request", $index = SetIndex(1), $rel= "->(39)") alt successful case Rel(Bob, Alice, "Authentication Accepted") diff --git a/samples/C4CoreDiagrams.md b/samples/C4CoreDiagrams.md index e6dcbdfe..885f168a 100644 --- a/samples/C4CoreDiagrams.md +++ b/samples/C4CoreDiagrams.md @@ -51,13 +51,13 @@ Source: [C4_Context Diagram Sample - bigbankplc-landscape.puml](C4_Context%20Dia Source: [C4_Dynamic Diagram Sample - bigbankplc.puml](C4_Dynamic%20Diagram%20Sample%20-%20bigbankplc.puml) -![C4_Dynamic Diagram Sample - bigbankplc](https://www.plantuml.com/plantuml/png/NP9BRnD13CVl-HIcfmIrYO2Ua13Dew95VKHD2k8KUMUTtH7pMDdUHX7YkpEpQPGkDu_7zlytVy-LABAstWtUsM1SMnBKgerydamOT-FAQjqMhH2R69I2ZatqayPXo3qNegMpnMH-UR7CgUVxkub7KUAKsYps0RqruoPF7znDVpq-hpS_RzStcxlhRzSFY-5eC9YdgMW3yQ8OcijpE5kWOe52Pob-8eTgOq07npIiJ4qUy-rA8vD0PWEcoefoLmqsR2FxBZw76gMc4h3Lce9QSoWnJ6K-efDpG6D815oiqe7KZCz69wwX-P2rRAWSNIon8fWsZNkTap6-umkk3Dj60KC9qr2r3ZdVB3c-s984q3c8MqW4S1kKE912WU5t6WhRDfZ36wtkGIEOLZHwOe4NYxd7CkoeW8BZJeXxS9jPR4E9l1yMIM-wlEt1ZU3F060UVHC31HsQJ_abP5fEKgTyvsN36MP667haVRfk7rHcIh5Lo1qsMMng35K-D2YoYroUREp9Vyn2gI-P0Fa979qZVYD__sEUD4J_kvqw5tU7HSjHEmcdi6_fxDNIrLwKV9R_EqZ8cwTkXmVvjl1MvUt-GMEtnjNZm-HclLwkKb_gwd0xn-ReKfMLwUaBKJaSGNRuE3_LTRzNo95HU0zRZlwLU5SJKnS7z0HVu6kdjvZDK_yLXRBrxXy0 "C4_Dynamic Diagram Sample - bigbankplc") +![C4_Dynamic Diagram Sample - bigbankplc](https://www.plantuml.com/plantuml/png/fLLHRo8t47xdLqpJIWKf0ILgNofLEW9HanC970kA-hIQzHhMgjUsR2-KLltl7IyOd5jUJfU7ZJqQVzytttZC9-VH-gQMlH-4Oh8fELJU6_VRQ6HnFzmANpL5uxXbMdck_93fUcGagd3cplbIYc8q-ULk4KBhrzceHkUvfL0-FIYi1HkQWDwRZV-ShrVvQhx8f_Ftj_uWHjvVLi_vxEcFfxSf1NiBRfrMVTOuhsjkRs5oNjsC8OPl1htiG4Hr_gWRLQ8zzDazPSHaU54RRMlqGgkR0VpR0_gRK0ae5BTzD2PD7XiZ1JicK_mpxj0nAuo_XR7QDX9j28-br7jtbk30QwXHuPQ3hxYmOApU2Cb9sqUsU28d6tU2yPGwEuOYxIranWgrXKUjVGYkAWv62-L1Rm0Puyu1LNPM0U9IQ8UufcoIbrC32Uhrk8F7nWNa9HQ5yAzVMXQBoXbjVOjDwK858hxZohiEhEKXbLGc1IrZBAresHI7y7zYENhkG0MbKZXUGeaUMx8p69Z66krubm-RKlY4QnpsAS_anz7mxMaLbWkhTw8aBcstg8HhZRdRKmW2J4kqGIOaBRjKq-BIhB98-pGblGMwbcvkaKaEzmyix3AlBNVN6zA1JxmZ_DIsbE3ra7sP9TWOdVk7dDjnwmYxlGzINffrTXHBg3Jx1cE99B4rx0BtKsX-t4OfQNM0XMxywPA0hz13XJjE7sEuuYNH_TVhBRdCfyau7qTlRShsHbJ2nR61KCWsK3slLekCJjFHuwHs1oW2NBNzWlGvcx-D4hXyUMKOqux7Eezk2jM2J1ydT3nMqZd_SSeohif4LjFgF9ka0o2wWsAq-4ceal_z-qluzWTtzqU9wmv5D8qQjn6sZfXNmMReV0HyE8cUVNm8kkFx_QgxRqBASztOBb3lvrCG61PGSA1odGUqMzAWeI_5N-rR2rgMGApjqU5mIEbIkW7vv41gjGNXGJZOM-4zLx0Nlefimv1-kWgdKCPFZlrAbdtLplZqVBDFHrU-Al6X0vXEOBGemf59P4dsF7-__3n-8lwcbly3 "C4_Dynamic Diagram Sample - bigbankplc") ### Sequence Diagram Source: [C4_Sequence Diagram Sample - bigbankplc.puml](C4_Sequence%20Diagram%20Sample%20-%20bigbankplc.puml) -![C4_Sequence Diagram Sample - bigbankplc](http://www.plantuml.com/plantuml/png/NL9BRnCn4BxdLmmv1PGc0df2GZIFYXRr4NKB7ADPxsJNmXulzhXH_psURQE6tEnvV8_FlaY2KR9tetUMZSiDGIVIfo_pUSJzhBNIvJedYYQm4ClC13_l7RBkd2LfdAtdg_EpZPP-tjxCFIQXM4hRYlvcOaEpNk57gmA0bYbEpCSfZ2lBhQEp3RO4Yxvtrg3OmEFI-e5FM9beUm7a1XRSPeTHEviOdcn32T0v23kGZk2Q2n-JG8tyfu32BhDHA7HMda42c9maU8e9dYpgZesmfnhg6FR5sMpy_aZTTXaoDnYV9tKXN6okZzMLIO1Ly7rWOfcOJuEHbk6QGH5YS8xYMAjzL2stlrRmG4bEkWld2ZLehaaL9iMmN8x_Mrg-MggUIwX-Tah_MOd8v5YCljMFw9U4V9pRIJOFv52eEIZG3SjJC1rogvSUKzg7sAGfa1YbFuIplUHcSXpRkfwOyyAqHi4Q4ochmh-GmQ4CbUd8etOh2P5UCe18hKqITLfps8NeX_CKEamTDO1PEc9vVGOmaHgzeYlIq1XA2LnettIE2lVmprwUADVUIZfU0md3Lwlkx-PNZu-RgYpfZiuFkQxGbIcR5c_CL2n3uCDacHei9t9a13x0BWR_-gRxZY8DPqPFy1M-3MphvQfiZwgh-z_RcyllbtVh4k85SPEz-mS0 "C4_Sequence Diagram Sample - bigbankplc") +![C4_Sequence Diagram Sample - bigbankplc](https://www.plantuml.com/plantuml/png/NL9BRnCn4BxdLmmv1PGc0df2GZIFYXRr4NKB7ADPxsJNmXulzhXH_psURQE6tEnvV8_FlaY2KR9tetUMZSiDGIVIfo_pUSJzhBNIvJedYYQm4ClC13_l7RBkd2LfdAtdg_EpZPP-tjxCFIQXM4hRYlvcOaEpNk57gmA0bYbEpCSfZ2lBhQEp3RO4Yxvtrg3OmEFI-e5FM9beUm7a1XRSPeTHEviOdcn32T0v23kGZk2Q2n-JG8tyfu32BhDHA7HMda42c9maU8e9dYpgZesmfnhg6FR5sMpy_aZTTXaoDnYV9tKXN6okZzMLIO1Ly7rWOfcOJuEHbk6QGH5YS8xYMAjzL2stlrRmG4bEkWld2ZLehaaL9iMmN8x_Mrg-MggUIwX-Tah_MOd8v5YCljMFw9U4V9pRIJOFv52eEIZG3SjJC1rogvSUKzg7sAGfa1YbFuIplUHcSXpRkfwOyyAqHi4Q4ochmh-GmQ4CbUd8etOh2P5UCe18hKqITLfps8NeX_CKEamTDO1PEc9vVGOmaHgzeYlIq1XA2LnettIE2lVmprwUADVUIZfU0md3Lwlkx-PNZu-RgYpfZiuFkQxGbIcR5c_CL2n3uCDacHei9t9a13x0BWR_-gRxZY8DPqPFy1M-3MphvQfiZwgh-z_RcyllbtVh4k85SPEz-mS0 "C4_Sequence Diagram Sample - bigbankplc") ### Deployment Diagram diff --git a/samples/C4_Dynamic Diagram Sample - message bus.puml b/samples/C4_Dynamic Diagram Sample - message bus.puml index 5d88d67d..8bb106e0 100644 --- a/samples/C4_Dynamic Diagram Sample - message bus.puml +++ b/samples/C4_Dynamic Diagram Sample - message bus.puml @@ -1,4 +1,3 @@ - @startuml !include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Dynamic.puml @@ -21,12 +20,15 @@ Rel_D(customer, app, "Updates his profile using", "HTTPS") Rel(app, customer_service, "Updates customer information using", "JSON/HTTPS") Rel_R(customer_service, customer_db, "Stores data in", "JDBC") -RelIndex_D(Index()-1, customer_service, message_bus, "Sends customer update events to", "async") -RelIndex_U(LastIndex()-2, customer_service, app, "Confirm update to", "async") +Rel_D(customer_service, message_bus, "Sends customer update events to", "async", $index=Index()-1) +Rel_U(customer_service, app, "Confirm update to", "async", $index=LastIndex()-2) + +Rel_L(message_bus, reporting_service, "Sends customer update events to", "async", $index=Index()-1) +Rel(reporting_service, reporting_db, "Stores data in", $index=Index()-1) -RelIndex_L(Index()-1, message_bus, reporting_service, "Sends customer update events to", "async") -RelIndex(Index()-1, reporting_service, reporting_db, "Stores data in") +' $index cab be first arg too (like the old RelIndex... calls), as long it is written with $index=.... +Rel_R($index=SetIndex(5)-2, message_bus, audit_service, "Sends customer update events to", "async") +Rel($index=Index()-2, audit_service, audit_store, "Stores events in") -RelIndex_R(SetIndex(5)-2, message_bus, audit_service, "Sends customer update events to", "async") -RelIndex(Index()-2, audit_service, audit_store, "Stores events in") -@enduml +SHOW_LEGEND() +@enduml \ No newline at end of file