From 9ce48ef613b32c9f5ccd0d2e90ce2573e8cbdfa0 Mon Sep 17 00:00:00 2001 From: Adrian Lupu Date: Sun, 29 Mar 2020 15:45:14 +0300 Subject: [PATCH] added bidirectional relationships https://github.com/RicardoNiepel/C4-PlantUML/issues/43 --- .vscode/C4.code-snippets | 18 ++++++++++++++ C4.puml | 54 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) diff --git a/.vscode/C4.code-snippets b/.vscode/C4.code-snippets index 76c64c2..8766176 100644 --- a/.vscode/C4.code-snippets +++ b/.vscode/C4.code-snippets @@ -257,6 +257,24 @@ ], "description": "Add unidirectional Relationship with Technology to C4 diagram" }, + "C4_Relationship_Bi": { + "scope": "diagram", + "prefix": "Bidirectional Relationship", + "body": [ + "BiRel(${1:from_alias}, ${2:to_alias}, \"${3:label}\")", + "$0" + ], + "description": "Add bidirectional Relationship to C4 diagram" + }, + "C4_Relationship_Bi_Techn": { + "scope": "diagram", + "prefix": "Bidirectional Relationship with Technology", + "body": [ + "BiRel(${1:from_alias}, ${2:to_alias}, \"${3:label}\", \"${4:technology}\")", + "$0" + ], + "description": "Add bidirectional Relationship with Technology to C4 diagram" + }, "C4_Relationship_Index": { "scope": "diagram", "prefix": "Relationship with Index", diff --git a/C4.puml b/C4.puml index c4e501c..25d3061 100644 --- a/C4.puml +++ b/C4.puml @@ -94,6 +94,12 @@ Rel_($from, $to, $label, "-->>") !unquoted function Rel($from, $to, $label, $techn) Rel_($from, $to, $label, $techn, "-->>") !endfunction +!unquoted function BiRel($from, $to, $label) +Rel_($from, $to, $label, "<<-->>") +!endfunction +!unquoted function BiRel($from, $to, $label, $techn) +Rel_($from, $to, $label, $techn, "<<-->>") +!endfunction !unquoted function Rel_Back($from, $to, $label) Rel_($from, $to, $label, "<<--") @@ -128,6 +134,18 @@ Rel_($from, $to, $label, "-DOWN->>") !unquoted function Rel_Down($from, $to, $label, $techn) Rel_($from, $to, $label, $techn, "-DOWN->>") !endfunction +!unquoted function BiRel_D($from, $to, $label) +Rel_($from, $to, $label, "<<-DOWN->>") +!endfunction +!unquoted function BiRel_D($from, $to, $label, $techn) +Rel_($from, $to, $label, $techn, "<<-DOWN->>") +!endfunction +!unquoted function BiRel_Down($from, $to, $label) +Rel_($from, $to, $label, "<<-DOWN->>") +!endfunction +!unquoted function BiRel_Down($from, $to, $label, $techn) +Rel_($from, $to, $label, $techn, "<<-DOWN->>") +!endfunction !unquoted function Rel_U($from, $to, $label) Rel_($from, $to, $label, "-UP->>") @@ -141,6 +159,18 @@ Rel_($from, $to, $label, "-UP->>") !unquoted function Rel_Up($from, $to, $label, $techn) Rel_($from, $to, $label, $techn, "-UP->>") !endfunction +!unquoted function BiRel_U($from, $to, $label) +Rel_($from, $to, $label, "<<-UP->>") +!endfunction +!unquoted function BiRel_U($from, $to, $label, $techn) +Rel_($from, $to, $label, $techn, "<<-UP->>") +!endfunction +!unquoted function BiRel_Up($from, $to, $label) +Rel_($from, $to, $label, "<<-UP->>") +!endfunction +!unquoted function BiRel_Up($from, $to, $label, $techn) +Rel_($from, $to, $label, $techn, "<<-UP->>") +!endfunction !unquoted function Rel_L($from, $to, $label) Rel_($from, $to, $label, "-LEFT->>") @@ -154,6 +184,18 @@ Rel_($from, $to, $label, "-LEFT->>") !unquoted function Rel_Left($from, $to, $label, $techn) Rel_($from, $to, $label, $techn, "-LEFT->>") !endfunction +!unquoted function BiRel_L($from, $to, $label) +Rel_($from, $to, $label, "<<-LEFT->>") +!endfunction +!unquoted function BiRel_L($from, $to, $label, $techn) +Rel_($from, $to, $label, $techn, "<<-LEFT->>") +!endfunction +!unquoted function BiRel_Left($from, $to, $label) +Rel_($from, $to, $label, "<<-LEFT->>") +!endfunction +!unquoted function BiRel_Left($from, $to, $label, $techn) +Rel_($from, $to, $label, $techn, "<<-LEFT->>") +!endfunction !unquoted function Rel_R($from, $to, $label) Rel_($from, $to, $label, "-RIGHT->>") @@ -167,6 +209,18 @@ Rel_($from, $to, $label, "-RIGHT->>") !unquoted function Rel_Right($from, $to, $label, $techn) Rel_($from, $to, $label, $techn, "-RIGHT->>") !endfunction +!unquoted function BiRel_R($from, $to, $label) +Rel_($from, $to, $label, "<<-RIGHT->>") +!endfunction +!unquoted function BiRel_R($from, $to, $label, $techn) +Rel_($from, $to, $label, $techn, "<<-RIGHT->>") +!endfunction +!unquoted function BiRel_Right($from, $to, $label) +Rel_($from, $to, $label, "<<-RIGHT->>") +!endfunction +!unquoted function BiRel_Right($from, $to, $label, $techn) +Rel_($from, $to, $label, $techn, "<<-RIGHT->>") +!endfunction ' Layout Helpers ' ##################################