#126: C4 relationships support description, sprite/openIconic and tags (2 - incl legend)

add procedures: AddRelTagSupport(), UpdateRelStyle()
rename procedures: SHOW_DYNAMIC_LEGEND() to SHOW_LEGEND(), UpdateSkinparamsAndLegendEntry() to UpdateElementStyle()
pull/130/head
KIRCHSTH 5 years ago
parent 4d5dee275b
commit 433db676fb

@ -11,8 +11,15 @@
!global $LEGEND_FONT_COLOR = "#FFFFFF"
!global $LEGEND_TITLE_COLOR = "#000000"
!global $LEGEND_UNDEFINED_BK_COLOR = "#87AECA"
!global $LEGEND_UNDEFINED_FONT_COLOR = "#B7DEFA"
!global $LEGEND_UNDEFINED_BG_COLOR = "#D5CFEE"
!global $LEGEND_UNDEFINED_FONT_COLOR = "#8B77E4"
!global $LEGEND_SHADOW_TEXT = "(shadow) "
!global $LEGEND_NO_SHADOW_TEXT = "(no shadow) "
!global $LEGEND_NO_FONT_BG_TEXT = "(no text, no back color) "
!global $LEGEND_NO_FONT_TEXT = "(no text color) "
!global $LEGEND_NO_BG_TEXT = "(no back color) "
!global $LEGEND_NO_LINE_TEXT = "(no line color) "
' Styling
' ##################################
@ -62,6 +69,7 @@ skinparam rectangle<<boundary>> {
!global $tagDefaultLegend = ""
!global $tagCustomLegend = ""
' rel specific
!unquoted function $toStereos($tags)
!if (%strlen($tags) == 0)
!return ''
@ -71,13 +79,13 @@ skinparam rectangle<<boundary>> {
!while ($brPos >= 0)
!$tag = %substr($tags, 0, $brPos)
!$stereos = $stereos + '<<' + $tag + '>>'
%set_variable_value("$" + $tag + "LineLegend", %true())
%set_variable_value("$" + $tag + "_LineLegend", %true())
!$tags = %substr($tags, $brPos+1)
!$brPos = %strpos($tags, "+")
!endwhile
!if (%strlen($tags)>0)
!$stereos = $stereos + '<<' + $tags + '>>'
%set_variable_value("$" + $tags + "LineLegend", %true())
%set_variable_value("$" + $tags + "_LineLegend", %true())
!endif
!return $stereos
!endfunction
@ -136,12 +144,26 @@ skinparam rectangle<<boundary>> {
$tagSkin
!endprocedure
!unquoted procedure $defineRelSkinparams($tagStereo, $textColor, $lineColor)
!$elementSkin = "skinparam Arrow<<" + $tagStereo + ">> {" + %newline()
!$elementSkin = $elementSkin + " Color "
!if ($lineColor!="")
!$elementSkin = $elementSkin + $lineColor
!endif
!if ($textColor!="")
!$elementSkin = $elementSkin + ";text:" + $textColor
!endif
!$elementSkin = $elementSkin + %newline()
!$elementSkin = $elementSkin + "}" + %newline()
$elementSkin
!endprocedure
!function $tagLegendEntry($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing)
!$tagEntry = "|"
!if ($bgColor!="")
!$bg = $bgColor
!else
!$bg = $LEGEND_UNDEFINED_BK_COLOR
!$bg = $LEGEND_UNDEFINED_BG_COLOR
!endif
' named colors have to start with # too
!if (%substr($bg, 0, 1) != "#")
@ -161,19 +183,19 @@ $tagSkin
!endif
!$tagEntry = $tagEntry + " " + $tagStereo + " "
!if ($shadowing == "true")
!$tagEntry = $tagEntry + "(shadow) "
!$tagEntry = $tagEntry + $LEGEND_SHADOW_TEXT
!endif
!if ($shadowing == "false")
!$tagEntry = $tagEntry + "(no shadow) "
!$tagEntry = $tagEntry + $LEGEND_NO_SHADOW_TEXT
!endif
!if ($fontColor == "" && $bgColor == "")
!$tagEntry = $tagEntry + "(no font, no back color) "
!$tagEntry = $tagEntry + $LEGEND_NO_FONT_BG_TEXT
!else
!if ($fontColor == "")
!$tagEntry = $tagEntry + "(no font color) "
!$tagEntry = $tagEntry + $LEGEND_NO_FONT_TEXT
!endif
!if ($bgColor == "")
!$tagEntry = $tagEntry + "(no back color) "
!$tagEntry = $tagEntry + $LEGEND_NO_BG_TEXT
!endif
!endif
!$tagEntry = $tagEntry + "</color> "
@ -181,10 +203,54 @@ $tagSkin
!return $tagEntry
!endfunction
!function $tagRelLegendEntry($tagStereo, $textColor, $lineColor)
!$tagEntry = "|"
!$bg = $LEGEND_UNDEFINED_BG_COLOR
' named colors have to start with # too
!if (%substr($bg, 0, 1) != "#")
!$bg = "#" + $bg
!endif
' !$tagEntry = $tagEntry + "<" + $bg +">"
' <U+23AF> ..white line
!if ($lineColor!="")
!$tagEntry = $tagEntry + "<color:"+$lineColor+"> <U+23AF></color> "
!else
' !$tagEntry = $tagEntry + "<color:"+$bg+"> <U+23AF></color> "
!$tagEntry = $tagEntry + " <U+23AF> "
!endif
!if ($textColor!="")
!$tagEntry = $tagEntry + "<color:"+$textColor+">"
!else
!$tagEntry = $tagEntry + "<color:"+$LEGEND_UNDEFINED_FONT_COLOR+">"
!endif
!$tagEntry = $tagEntry + " " + $tagStereo + " "
!if ($textColor == "")
!$tagEntry = $tagEntry + $LEGEND_NO_FONT_TEXT
!endif
!if ($lineColor == "")
!$tagEntry = $tagEntry + $LEGEND_NO_LINE_TEXT
!endif
!$tagEntry = $tagEntry + "</color> "
!$tagEntry = $tagEntry + "|"
!return $tagEntry
!endfunction
!unquoted procedure $addTagToDynamicLegend($tagStereo, $bgColor="", $fontColor="", $borderColor="", $shadowing="")
!$tagEntry = $tagLegendEntry($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing)
'' ignore workaround tags with &
' !if (%strpos($tagStereo, "&")<0)
!$tagEntry = $tagLegendEntry($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing)
%set_variable_value("$" + $tagStereo + "LegendEntry", $tagEntry)
!$tagCustomLegend = $tagCustomLegend + $tagStereo + "\n"
!$tagCustomLegend = $tagCustomLegend + $tagStereo + "\n"
' !endif
!endprocedure
!unquoted procedure $addRelTagToDynamicLegend($tagStereo, $textColor="", $lineColor="")
'' ignore workaround tags with &
' !if (%strpos($tagStereo, "&")<0)
!$tagEntry = $tagRelLegendEntry($tagStereo, $textColor, $lineColor)
%set_variable_value("$" + $tagStereo + "_LineLegendEntry", $tagEntry)
!$tagCustomLegend = $tagCustomLegend + $tagStereo + "_Line\n"
' !endif
!endprocedure
!procedure $showActiveLegendEntries($allDefined)
@ -211,11 +277,26 @@ $defineSkinparams($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing)
$addTagToDynamicLegend($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing)
!endprocedure
' used by existing elements like person, ...
!unquoted procedure UpdateSkinparamsAndLegendEntry($tagStereo, $bgColor="", $fontColor="", $borderColor="", $shadowing="")
$defineSkinparams($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing)
!$tagEntry = $tagLegendEntry($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing)
%set_variable_value("$" + $tagStereo + "LegendEntry", $tagEntry)
' used by new defined rel tags
!unquoted procedure AddRelTagSupport($tagStereo, $textColor="", $lineColor="")
$defineRelSkinparams($tagStereo, $textColor, $lineColor)
$addRelTagToDynamicLegend($tagStereo, $textColor, $lineColor)
!endprocedure
' update the style of existing elements like person, ...
!unquoted procedure UpdateElementStyle($elementName, $bgColor="", $fontColor="", $borderColor="", $shadowing="")
$defineSkinparams($elementName, $bgColor, $fontColor, $borderColor, $shadowing)
!$tagEntry = $tagLegendEntry($elementName, $bgColor, $fontColor, $borderColor, $shadowing)
%set_variable_value("$" + $elementName + "LegendEntry", $tagEntry)
!endprocedure
' update the style of default relation, it has to set both properties (combined statement not working)
!unquoted procedure UpdateRelStyle($textColor, $lineColor)
!$elementSkin = "skinparam Arrow {" + %newline()
!$elementSkin = $elementSkin + " Color " + $lineColor + %newline()
!$elementSkin = $elementSkin + " FontColor " + $textColor + %newline()
!$elementSkin = $elementSkin + "}" + %newline()
$elementSkin
!endprocedure
' tags/stereotypes have to be delimited with \n
@ -387,7 +468,7 @@ left to right direction
!endprocedure
' has to be last call in diagram
!unquoted procedure SHOW_DYNAMIC_LEGEND($hideStereotype="true")
!unquoted procedure SHOW_LEGEND($hideStereotype="true")
!if ($hideStereotype=="true")
hide stereotype
!endif

@ -23,8 +23,8 @@
' Styling
' ##################################
UpdateSkinparamsAndLegendEntry("component", $COMPONENT_BG_COLOR, $COMPONENT_FONT_COLOR, $COMPONENT_BORDER_COLOR)
UpdateSkinparamsAndLegendEntry("external_component", $EXTERNAL_COMPONENT_BG_COLOR, $COMPONENT_FONT_COLOR, $EXTERNAL_COMPONENT_BORDER_COLOR)
UpdateElementStyle("component", $COMPONENT_BG_COLOR, $COMPONENT_FONT_COLOR, $COMPONENT_BORDER_COLOR)
UpdateElementStyle("external_component", $EXTERNAL_COMPONENT_BG_COLOR, $COMPONENT_FONT_COLOR, $EXTERNAL_COMPONENT_BORDER_COLOR)
' Layout
' ##################################

@ -20,8 +20,8 @@
' Styling
' ##################################
UpdateSkinparamsAndLegendEntry("container", $CONTAINER_BG_COLOR, $ELEMENT_FONT_COLOR, $CONTAINER_BORDER_COLOR)
UpdateSkinparamsAndLegendEntry("external_container", $EXTERNAL_CONTAINER_BG_COLOR, $ELEMENT_FONT_COLOR, $EXTERNAL_CONTAINER_BORDER_COLOR)
UpdateElementStyle("container", $CONTAINER_BG_COLOR, $ELEMENT_FONT_COLOR, $CONTAINER_BORDER_COLOR)
UpdateElementStyle("external_container", $EXTERNAL_CONTAINER_BG_COLOR, $ELEMENT_FONT_COLOR, $EXTERNAL_CONTAINER_BORDER_COLOR)
' Layout
' ##################################

@ -25,10 +25,10 @@
' Styling
' ##################################
UpdateSkinparamsAndLegendEntry("person", $PERSON_BG_COLOR, $ELEMENT_FONT_COLOR, $PERSON_BORDER_COLOR)
UpdateSkinparamsAndLegendEntry("external_person", $EXTERNAL_PERSON_BG_COLOR, $ELEMENT_FONT_COLOR, $EXTERNAL_PERSON_BORDER_COLOR)
UpdateSkinparamsAndLegendEntry("system", $SYSTEM_BG_COLOR, $ELEMENT_FONT_COLOR, $SYSTEM_BORDER_COLOR)
UpdateSkinparamsAndLegendEntry("external_system", $EXTERNAL_SYSTEM_BG_COLOR, $ELEMENT_FONT_COLOR, $EXTERNAL_SYSTEM_BORDER_COLOR)
UpdateElementStyle("person", $PERSON_BG_COLOR, $ELEMENT_FONT_COLOR, $PERSON_BORDER_COLOR)
UpdateElementStyle("external_person", $EXTERNAL_PERSON_BG_COLOR, $ELEMENT_FONT_COLOR, $EXTERNAL_PERSON_BORDER_COLOR)
UpdateElementStyle("system", $SYSTEM_BG_COLOR, $ELEMENT_FONT_COLOR, $SYSTEM_BORDER_COLOR)
UpdateElementStyle("external_system", $EXTERNAL_SYSTEM_BG_COLOR, $ELEMENT_FONT_COLOR, $EXTERNAL_SYSTEM_BORDER_COLOR)
' Sprites

@ -16,8 +16,8 @@
' ##################################
' orig was without background
'UpdateSkinparamsAndLegendEntry("node", $fontColor=$NODE_FONT_COLOR, $borderColor=$NODE_BORDER_COLOR)
UpdateSkinparamsAndLegendEntry("node", $bgColor=$NODE_BG_COLOR, $fontColor=$NODE_FONT_COLOR, $borderColor=$NODE_BORDER_COLOR)
'UpdateElementStyle("node", $fontColor=$NODE_FONT_COLOR, $borderColor=$NODE_BORDER_COLOR)
UpdateElementStyle("node", $bgColor=$NODE_BG_COLOR, $fontColor=$NODE_FONT_COLOR, $borderColor=$NODE_BORDER_COLOR)
skinparam rectangle<<node>> {
FontStyle normal
}

@ -58,161 +58,89 @@
' Relationship
' ##################################
!unquoted procedure Rel_($e_index, $alias1, $alias2, $label, $direction="")
!unquoted procedure Rel_($e_index, $alias1, $alias2, $label, $direction)
$alias1 $direction $alias2 : **$e_index: $label**
!endprocedure
!unquoted procedure Rel_($e_index, $alias1, $alias2, $label, $techn, $direction="")
!unquoted procedure Rel_($e_index, $alias1, $alias2, $label, $techn, $direction)
$alias1 $direction $alias2 : **$e_index: $label**\n//<size:$TECHN_FONT_SIZE>[$techn]</size>//
!endprocedure
!unquoted procedure Rel($from, $to, $label)
Rel_(Index(), $from, $to, $label, "-->>")
!unquoted procedure Rel($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("-->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure Rel($from, $to, $label, $techn)
Rel_(Index(), $from, $to, $label, $techn, "-->>")
!endprocedure
!unquoted procedure RelIndex($e_index, $from, $to, $label)
Rel_($e_index, $from, $to, $label, "-->>")
!endprocedure
!unquoted procedure RelIndex($e_index, $from, $to, $label, $tech)
Rel_($e_index, $from, $to, $label, $tech, "-->>")
!unquoted procedure RelIndex($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("-->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure Rel_Back($from, $to, $label)
Rel_(Index(), $from, $to, $label, "<<--")
!endprocedure
!unquoted procedure Rel_Back($from, $to, $label, $techn)
Rel_(Index(), $from, $to, $label, $techn, "<<--")
!unquoted procedure Rel_Back($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("<<--", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure RelIndex_Back($e_index, $from, $to, $label)
Rel_($e_index, $from, $to, $label, "<<--")
!endprocedure
!unquoted procedure RelIndex_Back($e_index, $from, $to, $label, $techn)
Rel_($e_index, $from, $to, $label, $techn, "<<--")
!unquoted procedure RelIndex_Back($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("<<--", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure Rel_Neighbor($from, $to, $label)
Rel_(Index(), $from, $to, $label, "->>")
!endprocedure
!unquoted procedure Rel_Neighbor($from, $to, $label, $techn)
Rel_(Index(), $from, $to, $label, $techn, "->>")
!endprocedure
!unquoted procedure RelIndex_Neighbor($e_index, $from, $to, $label)
Rel_($e_index, $from, $to, $label, "->>")
!unquoted procedure Rel_Neighbor($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure RelIndex_Neighbor($e_index, $from, $to, $label, $techn)
Rel_($e_index, $from, $to, $label, $techn, "->>")
!unquoted procedure RelIndex_Neighbor($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel($e_index, $from, $to, $label, $techn, "->>")
!endprocedure
!unquoted procedure Rel_Back_Neighbor($from, $to, $label)
Rel_(Index(), $from, $to, $label, "<<-")
!unquoted procedure Rel_Back_Neighbor($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("<<-", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure Rel_Back_Neighbor($from, $to, $label, $techn)
Rel_(Index(), $from, $to, $label, $techn, "<<-")
!endprocedure
!unquoted procedure RelIndex_Back_Neighbor($e_index, $from, $to, $label)
Rel_($e_index, $from, $to, $label, "<<-")
!endprocedure
!unquoted procedure RelIndex_Back_Neighbor($e_index, $from, $to, $label, $techn)
Rel_($e_index, $from, $to, $label, $techn, "<<-")
!unquoted procedure RelIndex_Back_Neighbor($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel($e_index, $from, $to, $label, $techn, "<<-")
!endprocedure
!unquoted procedure Rel_D($from, $to, $label)
Rel_(Index(), $from, $to, $label, "-DOWN->>")
!endprocedure
!unquoted procedure Rel_D($from, $to, $label, $techn)
Rel_(Index(), $from, $to, $label, $techn, "-DOWN->>")
!endprocedure
!unquoted procedure Rel_Down($from, $to, $label)
Rel_(Index(), $from, $to, $label, "-DOWN->>")
!endprocedure
!unquoted procedure Rel_Down($from, $to, $label, $techn)
Rel_(Index(), $from, $to, $label, $techn, "-DOWN->>")
!endprocedure
!unquoted procedure RelIndex_D($e_index, $from, $to, $label)
Rel_($e_index, $from, $to, $label, "-DOWN->>")
!unquoted procedure Rel_D($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("-DOWN->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure RelIndex_D($e_index, $from, $to, $label, $techn)
Rel_($e_index, $from, $to, $label, $techn, "-DOWN->>")
!unquoted procedure Rel_Down($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("-DOWN->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure RelIndex_Down($e_index, $from, $to, $label)
Rel_($e_index, $from, $to, $label, "-DOWN->>")
!unquoted procedure RelIndex_D($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("-DOWN->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure RelIndex_Down($e_index, $from, $to, $label, $techn)
Rel_($e_index, $from, $to, $label, $techn, "-DOWN->>")
!unquoted procedure RelIndex_Down($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("-DOWN->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure Rel_U($from, $to, $label)
Rel_(Index(), $from, $to, $label, "-UP->>")
!unquoted procedure Rel_U($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("-UP->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure Rel_U($from, $to, $label, $techn)
Rel_(Index(), $from, $to, $label, $techn, "-UP->>")
!unquoted procedure Rel_Up($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("-UP->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure Rel_Up($from, $to, $label)
Rel_(Index(), $from, $to, $label, "-UP->>")
!unquoted procedure RelIndex_U($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("-UP->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure Rel_Up($from, $to, $label, $techn)
Rel_(Index(), $from, $to, $label, $techn, "-UP->>")
!endprocedure
!unquoted procedure RelIndex_U($e_index, $from, $to, $label)
Rel_($e_index, $from, $to, $label, "-UP->>")
!endprocedure
!unquoted procedure RelIndex_U($e_index, $from, $to, $label, $techn)
Rel_($e_index, $from, $to, $label, $techn, "-UP->>")
!endprocedure
!unquoted procedure RelIndex_Up($e_index, $from, $to, $label)
Rel_($e_index, $from, $to, $label, "-UP->>")
!endprocedure
!unquoted procedure RelIndex_Up($e_index, $from, $to, $label, $techn)
Rel_($e_index, $from, $to, $label, $techn, "-UP->>")
!unquoted procedure RelIndex_Up($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("-UP->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure Rel_L($from, $to, $label)
Rel_(Index(), $from, $to, $label, "-LEFT->>")
!endprocedure
!unquoted procedure Rel_L($from, $to, $label, $techn)
Rel_(Index(), $from, $to, $label, $techn, "-LEFT->>")
!endprocedure
!unquoted procedure Rel_Left($from, $to, $label)
Rel_(Index(), $from, $to, $label, "-LEFT->>")
!unquoted procedure Rel_L($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("-LEFT->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure Rel_Left($from, $to, $label, $techn)
Rel_(Index(), $from, $to, $label, $techn, "-LEFT->>")
!unquoted procedure Rel_Left($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("-LEFT->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure RelIndex_L($e_index, $from, $to, $label)
Rel_($e_index, $from, $to, $label, "-LEFT->>")
!unquoted procedure RelIndex_L($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("-LEFT->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure RelIndex_L($e_index, $from, $to, $label, $techn)
Rel_($e_index, $from, $to, $label, $techn, "-LEFT->>")
!endprocedure
!unquoted procedure RelIndex_Left($e_index, $from, $to, $label)
Rel_($e_index, $from, $to, $label, "-LEFT->>")
!endprocedure
!unquoted procedure RelIndex_Left($e_index, $from, $to, $label, $techn)
Rel_($e_index, $from, $to, $label, $techn, "-LEFT->>")
!unquoted procedure RelIndex_Left($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("-LEFT->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure Rel_R($from, $to, $label)
Rel_(Index(), $from, $to, $label, "-RIGHT->>")
!endprocedure
!unquoted procedure Rel_R($from, $to, $label, $techn)
Rel_(Index(), $from, $to, $label, $techn, "-RIGHT->>")
!endprocedure
!unquoted procedure Rel_Right($from, $to, $label)
Rel_(Index(), $from, $to, $label, "-RIGHT->>")
!endprocedure
!unquoted procedure Rel_Right($from, $to, $label, $techn)
Rel_(Index(), $from, $to, $label, $techn, "-RIGHT->>")
!endprocedure
!unquoted procedure RelIndex_R($e_index, $from, $to, $label)
Rel_($e_index, $from, $to, $label, "-RIGHT->>")
!unquoted procedure Rel_R($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("-RIGHT->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure RelIndex_R($e_index, $from, $to, $label, $techn)
Rel_($e_index, $from, $to, $label, $techn, "-RIGHT->>")
!unquoted procedure Rel_Right($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("-RIGHT->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure RelIndex_Right($e_index, $from, $to, $label)
Rel_($e_index, $from, $to, $label, "-RIGHT->>")
!unquoted procedure RelIndex_R($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("-RIGHT->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure RelIndex_Right($e_index, $from, $to, $label, $techn)
Rel_($e_index, $from, $to, $label, $techn, "-RIGHT->>")
!unquoted procedure RelIndex_Right($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("-RIGHT->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags)
!endprocedure

@ -53,7 +53,7 @@ Rel(web_app, twitter, "Gets tweets from", "HTTPS")
![LAYOUT_LEFT_RIGHT Sample](https://www.plantuml.com/plantuml/png/PL1DIyD05BplhrZheIdKX8edJusXjaAhfKaLJs6RFEt2Vh7xrb34_-uBhLPmBmDlvhsPsMb0uJ5gnPVvwzEsgfUp-whUFCmN5I-5TWhOXJIDYYtmFQ8BjrdcHPU-Izp7NGpW6siG3AQDrPbelHJcGqKNi-BcQgs4mUrgcIc14916TK5g8Gtur94fO_zSan5ZQ_31caIqMfen7-Gzoe1UeFM34IiF0K7NTpQQLlX3qap6V7WCEnpnJyRf_Vea7UnguHpTUO4TpvrJiX4ehHdGgBWSyxnSfu-pYbOyyEjqmbVFHS_bIjakyBvZu6Wv5NI293egbEJ5gquYWkSeDIZo2fJjwvGkmID9Tquo8ja6r4-hSwnje4t2HLMjIrBreb_sV6OEI34wwE7DM_rtPGgcfU_y1W00 "LAYOUT_LEFT_RIGHT Sample")
## LAYOUT_WITH_LEGEND() or SHOW_DYNAMIC_LEGEND(?hideStereotype)
## LAYOUT_WITH_LEGEND() or SHOW_LEGEND(?hideStereotype)
Colors can help to add additional information or simply to make the diagram more aesthetically pleasing.
It can also help to save some space.
@ -80,16 +80,16 @@ Rel(web_app, twitter, "Gets tweets from", "HTTPS")
![LAYOUT_WITH_LEGEND Sample](https://www.plantuml.com/plantuml/png/PL1DJy905BplhrZnG4cm3SQJ9sebO0BOs2Bnr2pjKpRPh-o-sX3ZV_Sr89YubqdUp7ipizE0mcEh5L-cRy-Rije-bOjgEPlFre-y4DefO5VIrAfjWEyHNRXF4Y-w-4FYljsr0Nnj3OB1kBOw4OsNmdogrhL9TdUJAs5mirecIY04f56LaLf80pvsvChOVzjen5WEFbWJYKPBC-Q3j4SPq0kqVZ1YnI4WwEh1jgOH_X3Lap4V7jCEH_oBSNfdewY3NIMSepjRsF7KEILhWTAQ0Osowp5FYpnUpqfQyS1lumbVlMOzbofbky3xae6ZvTJG2PBeLg4aBrvs4X4yHwb1aLUWRD-dT14UIRfpaX79Na3zjhh4sWJQ95oKPLwGgXUTsSkPEI35wA27Ts_rtvKfc8R-ymS0 "LAYOUT_WITH_LEGEND Sample")
Instead of a static legend (activated with `LAYOUT_WITH_LEGEND()`) a dynamic legend can be activated with `SHOW_DYNAMIC_LEGEND(?hideStereotype)`.
Instead of a static legend (activated with `LAYOUT_WITH_LEGEND()`) a dynamic legend can be activated with `SHOW_LEGEND(?hideStereotype)`.
The dynamic legend has following differences:
* only relevant elements are listed
* custom tags/stereotypes are supported
* stereotypes can remain visible (with `SHOW_DYNAMIC_LEGEND(false)`)
* **`SHOW_DYNAMIC_LEGEND()` has to be last call in the diagram**
* custom tags/styles are supported
* stereotypes can remain visible (with `SHOW_LEGEND(false)`)
* **`SHOW_LEGEND()` has to be last call in the diagram**
```csharp
@startuml SHOW_DYNAMIC_LEGEND Sample
@startuml SHOW_LEGEND Sample
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
Person(admin, "Administrator")
@ -101,11 +101,11 @@ System(twitter, "Twitter")
Rel(admin, web_app, "Uses", "HTTPS")
Rel(web_app, twitter, "Gets tweets from", "HTTPS")
SHOW_DYNAMIC_LEGEND()
SHOW_LEGEND()
@enduml
```
![SHOW_DYNAMIC_LEGEND Sample](http://www.plantuml.com/plantuml/png/RL5Dgzf05DtFhxYrYnV1bs3fgYlJA5fG6vfOwIfCajiwC1_3p0r1IlzxRz1g5o-RIyx7uHnc5Ka66eo6QlVrtAn_7FF3bwBPRxQRunegQRn6yKxPJWyzmeN8nqzP5kIO_b9q6TeXOkYS9RIKTivaNaixnRr6whLgi-BZQpb1fyC-Cp8I1eQQWXrIMGofPwqG9OReR29xe-m2PlbqLQGWoONPN5HNDfhcinjiByCrwPOBUBbrUvd3Rm7yFIAJ4Tj6UiyvPsmXzrwhJf9oTiPGyNu1ULMcnqtDbe3m8Lt2uNinSRdMRemmJOf03dYFbomnWoRbDK8zAY8CGCgWLXOZT_jpRvVGZUISkun9yGtrlrNFMgV8JhwxkYuhLasY1_kCsI95_iNf_0pE_6yHRxnMCXShjFrWz5y0 "LAYOUT_WITH_LEGEND Sample")
![SHOW_LEGEND Sample](http://www.plantuml.com/plantuml/png/JL4z3zem4DtzAwvq84YGYAfJ9z8KmG0qQa8P8oUv5al-iEoB8bJrl_SYAE3bv7iVVa_UH9A11gEXsd-_D8VjRdlw1fKqNgFue6odXnxXIkJZbomBSan_AxeExH0nTCuIMaexPpAlfPriLf5whTgi-BmgfzNvUCYCZ8I1Lqt12gaiXjGpLuWIGtGsaRrHTWcpV9egKf3amcmXgXiBJVFL3RQNuPPqwoNCxzdc2_WZWC_JCXcnRQJtx7F15dBljUeaAMTdl2e-BY6lolIqhLaI43wbQpZ-B2OirzgD4QPA4SW1z_6IAMRGfBn6g4T5X0586TJyLkHiVn_f4hg3xFEWCIX-eFxVwXNh75d9Sr_NPSMiYVH4NpOxfCXNdCQluCoxHBpzKh8G6xJzOFG_ "LAYOUT_WITH_LEGEND Sample")
## LAYOUT_AS_SKETCH()

@ -119,7 +119,7 @@ Rel_R(api, db, "Reads/Writes")
Rel(admin, spaAdmin, "Uses", "https")
Rel(spaAdmin, api, "Uses", "https")
SHOW_DYNAMIC_LEGEND()
SHOW_LEGEND()
@enduml
```
@ -238,7 +238,7 @@ Rel_L(x, s4, "uses")
C4-PlantUML also comes with some layout options to make it easy and reusable to create nice and useful diagrams:
* [LAYOUT_TOP_DOWN() or LAYOUT_LEFT_RIGHT()](LayoutOptions.md#layout_top_down-or-layout_left_right)
* [LAYOUT_WITH_LEGEND() or SHOW_DYNAMIC_LEGEND(?hideStereotype)](LayoutOptions.md#layout_with_legend-or-show_dynamic_legend)
* [LAYOUT_WITH_LEGEND() or SHOW_LEGEND(?hideStereotype)](LayoutOptions.md#layout_with_legend-or-SHOW_LEGEND)
* [LAYOUT_AS_SKETCH()](LayoutOptions.md#layout_as_sketch)
* [HIDE_STEREOTYPE()](LayoutOptions.md#hide_stereotype)
@ -253,7 +253,7 @@ Additional tags/stereotypes can be added to the existing element stereotypes (co
* `AddTagSupport(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing)`:
After this call the given tag can be used in the diagram, the styles of the tagged elements are updated and the tag is be displayed in the dynamic legend.
* `UpdateSkinparamsAndLegendEntry(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing)`
* `UpdateElementStyle(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing)`
This call updates the style of the default element stereotypes (component, ...) and creates no additional legend entry.
Each element can be extended with one or multiple custom tags/stereotypes via the keyword argument `$tags="..."`, like `Container(spaAdmin, "Admin SPA", $tags="v1.1")`.
@ -261,9 +261,9 @@ Multiple tags can be combined with `+`, like `Container(api, "API", $tags="v1.0+
**Comments**
* `SHOW_DYNAMIC_LEGEND()` supports the customized stereotypes
* `SHOW_LEGEND()` supports the customized stereotypes
(`LAYOUT_WITH_LEGEND()` cannot be used, if the custom tags/stereotypes should be displayed in the legend).
* `SHOW_DYNAMIC_LEGEND()` has to be last line in diagram.
* `SHOW_LEGEND()` has to be last line in diagram.
* Don't use space between `$tags` and `=` (PlantUML does not support it).
* Don't use `,` as part of the tag names (PlantUML does not support it in combination with keyword arguments).
* If 2 tags defines the same skinparameter, the first definition is used.
@ -289,7 +289,7 @@ Rel(spaAdmin, api, "Uses", "https")
Rel_L(spa, spa2, "Updates", "https")
Rel_R(spaAdmin, spaAdmin2, "Updates", "https")
SHOW_DYNAMIC_LEGEND(false)
SHOW_LEGEND(false)
@enduml
```
@ -297,7 +297,7 @@ SHOW_DYNAMIC_LEGEND(false)
**Custom schema definition**
If the custom (color) schema is defined via `UpdateSkinparamsAndLegendEntry()` then the legend of existing elements is updated too.
If the custom (color) schema is defined via `UpdateElementStyle()` then the legend of existing elements is updated too.
```csharp
@startuml
@ -315,10 +315,10 @@ If the custom (color) schema is defined via `UpdateSkinparamsAndLegendEntry()` t
!$COLOR_B_4 = "#542788"
!$COLOR_B_5 = "#2d004b"
UpdateSkinparamsAndLegendEntry("person", $bgColor=$COLOR_A_5, $fontColor=$COLOR_NEUTRAL, $borderColor=$COLOR_A_1, $shadowing="true")
UpdateSkinparamsAndLegendEntry("external_person", $bgColor=$COLOR_B_5, $fontColor=$COLOR_NEUTRAL, $borderColor=$COLOR_B_1)
UpdateSkinparamsAndLegendEntry("system", $bgColor=$COLOR_A_4, $fontColor=$COLOR_NEUTRAL, $borderColor=$COLOR_A_2)
UpdateSkinparamsAndLegendEntry("external_system", $bgColor=$COLOR_B_4, $fontColor=$COLOR_NEUTRAL, $borderColor=$COLOR_B_2)
UpdateElementStyle("person", $bgColor=$COLOR_A_5, $fontColor=$COLOR_NEUTRAL, $borderColor=$COLOR_A_1, $shadowing="true")
UpdateElementStyle("external_person", $bgColor=$COLOR_B_5, $fontColor=$COLOR_NEUTRAL, $borderColor=$COLOR_B_1)
UpdateElementStyle("system", $bgColor=$COLOR_A_4, $fontColor=$COLOR_NEUTRAL, $borderColor=$COLOR_A_2)
UpdateElementStyle("external_system", $bgColor=$COLOR_B_4, $fontColor=$COLOR_NEUTRAL, $borderColor=$COLOR_B_2)
Person(customer, "Personal Banking Customer")
System(banking_system, "Internet Banking System")
@ -331,7 +331,7 @@ Rel_Back(customer, mail_system, "Sends e-mails to")
Rel_Neighbor(banking_system, mail_system, "Sends e-mails")
Rel(banking_system, mainframe, "Uses")
SHOW_DYNAMIC_LEGEND()
SHOW_LEGEND()
@enduml
```

@ -64,5 +64,5 @@ Rel(api, db, "Reads from and writes to", "JDBC")
Rel(api, db2, "Reads from and writes to", "JDBC")
Rel_R(db, db2, "Replicates data to")
SHOW_DYNAMIC_LEGEND()
SHOW_LEGEND()
@enduml

@ -53,5 +53,5 @@ Rel(api, db, "Reads from and writes to", "JDBC")
Rel(api, db2, "Reads from and writes to", "JDBC")
Rel_R(db, db2, "Replicates data to")
SHOW_DYNAMIC_LEGEND()
SHOW_LEGEND()
@enduml

@ -0,0 +1,52 @@
@startuml
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
!if %variable_exists("RELATIVE_INCLUDE")
!include ./../C4_Component.puml
!else
!include https://raw.githubusercontent.com/kirchsth/C4-PlantUML/extended/C4_Component.puml
!endif
SHOW_PERSON_SPRITE(person2)
UpdateElementStyle("system", $bgColor="chocolate", $fontColor="orange", $borderColor="orange")
UpdateRelStyle(black, black)
AddTagSupport("role1", $bgColor="green", $fontColor="white", $borderColor="#d73027", $shadowing="false")
AddTagSupport("role2", $fontColor="#d73027", $shadowing="true")
AddTagSupport("role3", $bgColor="orange")
AddTagSupport("role4", $borderColor="blue")
AddTagSupport("unusedRole")
AddRelTagSupport("line1", $lineColor="green", $textColor="blue")
AddRelTagSupport("line2", $lineColor="blue", $textColor="green")
AddRelTagSupport("line3", $textColor="orange")
AddRelTagSupport("line4", $lineColor="orange")
' PlantUML cannot combine line styles, a combination has to be added as workaround as first additional tag
AddRelTagSupport("line3&line4", $lineColor="orange", $textColor="orange")
AddRelTagSupport("unusedLine", $lineColor="red", $textColor="red")
Person(person, "Person")
Person(person1, "Person1", $tags="role1")
Person(person2, "Person2", $tags="role2")
Person(person21, "Person21", $tags="role2+role1")
Person(person321, "Person321", $tags="role3+role2+role1")
Person(person4321, "Person43", $tags="role4+role3")
Person(person31, "Person31", $tags="role3+role1")
Person(person13, "Person13", $tags="role1+role3")
Person(allInOne, "AllInOne", $tags="role4+role3+role2+role1")
Component(component, "Component 1", "PlantUML")
System(system1A, "System 1A")
System(system2, "System 2")
Rel(allInOne, component, "without a tag")
Rel(allInOne, component, "uses line 1", $tags="line1")
Rel(allInOne, component, "uses line 2", $tags="line2")
Rel(allInOne, system1A, "uses line 3", $tags="line3")
Rel(allInOne, system1A, "uses line 4", $tags="line4")
Rel(allInOne, system2, "line 3+4 cannot be combined without workaround", $tags="line3+line4")
Rel(allInOne, system2, "line 3+4 with workaround", $tags="line3&line4+line3+line4")
SHOW_LEGEND(false)
@enduml

@ -6,14 +6,14 @@
!include https://raw.githubusercontent.com/kirchsth/C4-PlantUML/extended/C4_Component.puml
!endif
[RelFrom]
[BiRelFrom]
System(RelFrom, RelFrom)
System(BiRelFrom, BiRelFrom)
[RelShort]
[BiRelShort]
System(RelShort, RelShort)
System(BiRelShort, BiRelShort)
[RelLong]
[BiRelLong]
System(RelLong, RelLong)
System(BiRelLong, BiRelLong)
Rel_(RelFrom, To_Rel_UP, "A label", "-UP->>")
Rel_(RelFrom, To_Rel_DOWN, "A label", "A techn", "-DOWN->>")

@ -0,0 +1,71 @@
@startuml
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
!if %variable_exists("RELATIVE_INCLUDE")
!include ./../C4_Dynamic.puml
!else
!include https://raw.githubusercontent.com/kirchsth/C4-PlantUML/extended/C4_Dynamic.puml
!endif
System(RelFrom, RelFrom)
System(RelShort, RelShort)
System(RelLong, RelLong)
System(RelIndexFrom, RelIndexFrom)
System(RelIndexShort, RelIndexShort)
System(RelIndexLong, RelIndexLong)
Rel_(Index(), RelFrom, To_Rel_UP, "A label", "-UP->>")
Rel_(Index(), RelFrom, To_Rel_DOWN, "A label", "A techn", "-DOWN->>")
Rel(RelFrom, "To_Rel", "A label")
Rel(RelFrom, "To_Rel_Tech", "A label", "A techn")
Rel_Back(RelFrom, "To_Rel_Back", "A label")
Rel_Back(RelFrom, "To_Rel_Back_Tech", "A label", "A techn")
Rel_Neighbor(RelFrom, "To_Rel_Neighbor", "A label")
Rel_Neighbor(RelFrom, "To_Rel_Neighbor_Tech", "A label", "A techn")
Rel_Back_Neighbor(RelFrom, "To_Rel_Back_Neighbor", "A label")
Rel_Back_Neighbor(RelFrom, "To_Rel_Back_Neighbor_Tech", "A label", "A techn")
RelIndex(Index(), RelIndexFrom, "To_RelIndex", "A label")
RelIndex(Index(), RelIndexFrom, "To_RelIndex_Tech", "A label", "A techn")
Rel_D(RelShort, "To_Rel_D", "A label")
Rel_D(RelShort, "To_Rel_D_Tech", "A label", "A techn")
Rel_Down(RelLong, "To_Rel_Down", "A label")
Rel_Down(RelLong, "To_Rel_Down_Tech", "A label", "A techn")
Rel_L(RelShort, "To_Rel_L", "A label")
Rel_L(RelShort, "To_Rel_L_Tech", "A label", "A techn")
Rel_Left(RelLong, "To_Rel_Left", "A label")
Rel_Left(RelLong, "To_Rel_Left_Tech", "A label", "A techn")
Rel_R(RelShort, "To_Rel_R", "A label")
Rel_R(RelShort, "To_Rel_R_Tech", "A label", "A techn")
Rel_Right(RelLong, "To_Rel_Right", "A label")
Rel_Right(RelLong, "To_Rel_Right_Tech", "A label", "A techn")
Rel_U(RelShort, "To_Rel_U", "A label")
Rel_U(RelShort, "To_Rel_U_Tech", "A label", "A techn")
Rel_Up(RelLong, "To_Rel_Up", "A label")
Rel_Up(RelLong, "To_Rel_Up_Tech", "A label", "A techn")
RelIndex_D(Index(), RelIndexShort, "To_RelIndex_D", "A label")
RelIndex_D(Index(), RelIndexShort, "To_RelIndex_D_Tech", "A label", "A techn")
RelIndex_Down(Index(), RelIndexLong, "To_RelIndex_Down", "A label")
RelIndex_Down(Index(), RelIndexLong, "To_RelIndex_Down_Tech", "A label", "A techn")
RelIndex_L(Index(), RelIndexShort, "To_RelIndex_L", "A label")
RelIndex_L(Index(), RelIndexShort, "To_RelIndex_L_Tech", "A label", "A techn")
RelIndex_Left(Index(), RelIndexLong, "To_RelIndex_Left", "A label")
RelIndex_Left(Index(), RelIndexLong, "To_RelIndex_Left_Tech", "A label", "A techn")
RelIndex_R(Index(), RelIndexShort, "To_RelIndex_R", "A label")
RelIndex_R(Index(), RelIndexShort, "To_RelIndex_R_Tech", "A label", "A techn")
RelIndex_Right(Index(), RelIndexLong, "To_RelIndex_Right", "A label")
RelIndex_Right(Index(), RelIndexLong, "To_RelIndex_Right_Tech", "A label", "A techn")
RelIndex_U(Index(), RelIndexShort, "To_RelIndex_U", "A label")
RelIndex_U(Index(), RelIndexShort, "To_RelIndex_U_Tech", "A label", "A techn")
RelIndex_Up(Index(), RelIndexLong, "To_RelIndex_Up", "A label")
RelIndex_Up(Index(), RelIndexLong, "To_RelIndex_Up_Tech", "A label", "A techn")
Lay_U(RelFrom, RelIndexFrom)
Lay_D(RelFrom, RelShort)
Lay_D(RelShort, RelLong)
Lay_R(RelLong, RelIndexShort)
Lay_L(RelLong, RelIndexLong)
@enduml

@ -58,8 +58,8 @@ Rel(mobile, api, "Makes API calls to", "json/HTTPS")
Rel(spa, api, "Makes API calls to", "json/HTTPS")
Rel_U(web, spa, "Delivers to the customer's web browser")
Rel(api, db, "Reads from and writes to", "JDBC")
Rel(api, db2, "Reads from and writes to", "JDBC")
Rel_R(db, db2, "Replicates data to")
Rel(api, db2, "Reads from and writes to", "JDBC", $descr="only in case of a problem", $sprite="person", $tags="fallback")
Rel_R(db, db2, "Replicates data to", "message" , $descr="only in case of a problem only in case of a problem", $sprite="&envelope-closed", $tags="fallback")
SHOW_DYNAMIC_LEGEND()
SHOW_LEGEND()
@enduml

@ -50,5 +50,5 @@ Rel(api, db, "Reads from and writes to", "JDBC")
Rel(api, db2, "Reads from and writes to", "JDBC")
Rel_R(db, db2, "Replicates data to")
SHOW_DYNAMIC_LEGEND()
SHOW_LEGEND()
@enduml
Loading…
Cancel
Save