Merge branch 'feature/126' into extended

pull/140/head
KIRCHSTH 5 years ago
commit ab198039a4

@ -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,12 +69,33 @@ skinparam rectangle<<boundary>> {
!global $tagDefaultLegend = ""
!global $tagCustomLegend = ""
' rel specific
!unquoted function $toStereos($tags)
!if (%strlen($tags) == 0)
!return ''
!endif
!$stereos = ''
!$brPos = %strpos($tags, "+")
!while ($brPos >= 0)
!$tag = %substr($tags, 0, $brPos)
!$stereos = $stereos + '<<' + $tag + '>>'
%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())
!endif
!return $stereos
!endfunction
!unquoted function $toStereos($elementType, $tags)
!if (%strlen($tags) == 0)
!$stereos = '<<' + $elementType + '>>'
%set_variable_value("$" + $elementType + "Legend", %true())
!return $stereos
!endif
!endif
!$stereos = ''
!$brPos = %strpos($tags, "+")
!while ($brPos >= 0)
@ -116,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) != "#")
@ -141,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> "
@ -161,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)
@ -191,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
@ -203,6 +304,84 @@ $defineSkinparams($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing)
!$tagDefaultLegend = $tagStereoEntries
!endprocedure
' Line breaks
' ##################################
' PlantUML supports no DETERMINISTIC/automatic line breaks of "PlantUML line" (C4 Relashionships)
' therefore Rel...() implements an automatic line break based on spaces (like in all other objects).
' If a $type contains \n then these are used (and no automatic space based line breaks are done)
' $REL_TECHN_MAX_CHAR_WIDTH defines the automatic line break position
!global $REL_TECHN_MAX_CHAR_WIDTH = 35
!global $REL_DESCR_MAX_CHAR_WIDTH = 32
!unquoted function $breakDescr($descr, $widthStr)
!$width = %intval($widthStr)
!$multiLine = ""
!if (%strpos($descr, "\n") >= 0)
!else
!while (%strlen($descr)>$width)
!$brPos = $width
!while ($brPos>0 && %substr($descr, $brPos, 1)!= ' ')
!$brPos = $brPos - 1
!endwhile
!if ($brPos < 1)
!$brPos = %strpos($descr, " ")
!else
!endif
!if ($brPos > 0)
!$multiLine = $multiLine + %substr($descr, 0, $brPos) + "\n"
!$descr = %substr($descr, $brPos + 1)
!else
!$multiLine = $multiLine+ $descr
!$descr = ""
!endif
!endwhile
!endif
!if (%strlen($descr)>0)
!$multiLine = $multiLine + $descr
!endif
!return $multiLine
!endfunction
' $breakTechn() supports //...//; $breakNode() in C4_Deployment supports no //....//
!unquoted function $breakTechn($techn, $widthStr)
!$width = %intval($widthStr)
!$multiLine = ""
!if (%strpos($techn, "\n") >= 0)
!while (%strpos($techn, "\n") >= 0)
!$brPos = %strpos($techn, "\n")
!$multiLine = $multiLine + %substr($techn, 0, $brPos) + '</size>//\n//<size:'+$TECHN_FONT_SIZE+'>'
!$techn = %substr($techn, $brPos+2)
!endwhile
!else
!while (%strlen($techn)>$width)
!$brPos = $width
!while ($brPos>0 && %substr($techn, $brPos, 1)!= ' ')
!$brPos = $brPos - 1
!endwhile
!if ($brPos < 1)
!$brPos = %strpos($techn, " ")
!else
!endif
!if ($brPos > 0)
!$multiLine = $multiLine + %substr($techn, 0, $brPos) + '</size>//\n//<size:'+$TECHN_FONT_SIZE+'>'
!$techn = %substr($techn, $brPos + 1)
!else
!$multiLine = $multiLine+ $techn
!$techn = ""
!endif
!endwhile
!endif
!if (%strlen($techn)>0)
!$multiLine = $multiLine + $techn
!endif
!return $multiLine
!endfunction
' Element properties
' ##################################
@ -289,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
@ -319,6 +498,32 @@ rectangle "$getBoundary($label, $type)" $toStereos("boundary", $tags) as $alias
' Relationship
' ##################################
!function $getRel($direction, $alias1, $alias2, $label, $techn, $descr, $sprite, $tags)
!$rel = $alias1 + ' ' + $direction + ' ' + $alias2
!if ($tags != "")
!$rel = $rel + ' ' + $toStereos($tags)
!endif
!$rel = $rel + ' : '
!if ($sprite != "")
' if it starts with & it's a OpenIconic, details see https://useiconic.com/open/
!if (%substr($sprite, 0, 1) != "&")
!$rel = $rel + '<$'+$sprite+'> '
!else
!$rel = $rel + '<'+$sprite+'> '
!endif
!endif
!$rel = $rel + '**' + $label + '**'
!if ($techn != "")
' line break is not deterministic, calculate it
!$rel = $rel + '\n//<size:' + $TECHN_FONT_SIZE + '>[' + $breakTechn($techn, $REL_TECHN_MAX_CHAR_WIDTH) + ']</size>//'
!endif
!if ($descr != "")
' line break is not deterministic, calculate it
!$rel = $rel + '\n\n' + $breakDescr($descr, $REL_DESCR_MAX_CHAR_WIDTH)
!endif
!return $rel
!endfunction
!unquoted procedure Rel_($alias1, $alias2, $label, $direction)
$alias1 $direction $alias2 : **$label**
!endprocedure
@ -326,143 +531,80 @@ $alias1 $direction $alias2 : **$label**
$alias1 $direction $alias2 : **$label**\n//<size:$TECHN_FONT_SIZE>[$techn]</size>//
!endprocedure
!unquoted procedure Rel($from, $to, $label)
Rel_($from, $to, $label, "-->>")
!endprocedure
!unquoted procedure Rel($from, $to, $label, $techn)
Rel_($from, $to, $label, $techn, "-->>")
!unquoted procedure Rel($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("-->>", $from, $to, $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure BiRel($from, $to, $label)
Rel_($from, $to, $label, "<<-->>")
!endprocedure
!unquoted procedure BiRel($from, $to, $label, $techn)
Rel_($from, $to, $label, $techn, "<<-->>")
!unquoted procedure BiRel($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("<<-->>", $from, $to, $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure Rel_Back($from, $to, $label)
Rel_($from, $to, $label, "<<--")
!endprocedure
!unquoted procedure Rel_Back($from, $to, $label, $techn)
Rel_($from, $to, $label, $techn, "<<--")
!unquoted procedure Rel_Back($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("<<--", $from, $to, $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure Rel_Neighbor($from, $to, $label)
Rel_($from, $to, $label, "->>")
!endprocedure
!unquoted procedure Rel_Neighbor($from, $to, $label, $techn)
Rel_($from, $to, $label, $techn, "->>")
!unquoted procedure Rel_Neighbor($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("->>", $from, $to, $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure Rel_Back_Neighbor($from, $to, $label)
Rel_($from, $to, $label, "<<-")
!endprocedure
!unquoted procedure Rel_Back_Neighbor($from, $to, $label, $techn)
Rel_($from, $to, $label, $techn, "<<-")
!unquoted procedure Rel_Back_Neighbor($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("<<-", $from, $to, $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure Rel_D($from, $to, $label)
Rel_($from, $to, $label, "-DOWN->>")
!endprocedure
!unquoted procedure Rel_D($from, $to, $label, $techn)
Rel_($from, $to, $label, $techn, "-DOWN->>")
!endprocedure
!unquoted procedure Rel_Down($from, $to, $label)
Rel_($from, $to, $label, "-DOWN->>")
!unquoted procedure Rel_D($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("-DOWN->>", $from, $to, $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure Rel_Down($from, $to, $label, $techn)
Rel_($from, $to, $label, $techn, "-DOWN->>")
!unquoted procedure Rel_Down($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("-DOWN->>", $from, $to, $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure BiRel_D($from, $to, $label)
Rel_($from, $to, $label, "<<-DOWN->>")
!unquoted procedure BiRel_D($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("<<-DOWN->>", $from, $to, $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure BiRel_D($from, $to, $label, $techn)
Rel_($from, $to, $label, $techn, "<<-DOWN->>")
!endprocedure
!unquoted procedure BiRel_Down($from, $to, $label)
Rel_($from, $to, $label, "<<-DOWN->>")
!endprocedure
!unquoted procedure BiRel_Down($from, $to, $label, $techn)
Rel_($from, $to, $label, $techn, "<<-DOWN->>")
!unquoted procedure BiRel_Down($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("<<-DOWN->>", $from, $to, $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure Rel_U($from, $to, $label)
Rel_($from, $to, $label, "-UP->>")
!endprocedure
!unquoted procedure Rel_U($from, $to, $label, $techn)
Rel_($from, $to, $label, $techn, "-UP->>")
!unquoted procedure Rel_U($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("-UP->>", $from, $to, $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure Rel_Up($from, $to, $label)
Rel_($from, $to, $label, "-UP->>")
!endprocedure
!unquoted procedure Rel_Up($from, $to, $label, $techn)
Rel_($from, $to, $label, $techn, "-UP->>")
!unquoted procedure Rel_Up($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("-UP->>", $from, $to, $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure BiRel_U($from, $to, $label)
Rel_($from, $to, $label, "<<-UP->>")
!endprocedure
!unquoted procedure BiRel_U($from, $to, $label, $techn)
Rel_($from, $to, $label, $techn, "<<-UP->>")
!endprocedure
!unquoted procedure BiRel_Up($from, $to, $label)
Rel_($from, $to, $label, "<<-UP->>")
!unquoted procedure BiRel_U($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("<<-UP->>", $from, $to, $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure BiRel_Up($from, $to, $label, $techn)
Rel_($from, $to, $label, $techn, "<<-UP->>")
!unquoted procedure BiRel_Up($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("<<-UP->>", $from, $to, $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure Rel_L($from, $to, $label)
Rel_($from, $to, $label, "-LEFT->>")
!unquoted procedure Rel_L($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("-LEFT->>", $from, $to, $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure Rel_L($from, $to, $label, $techn)
Rel_($from, $to, $label, $techn, "-LEFT->>")
!endprocedure
!unquoted procedure Rel_Left($from, $to, $label)
Rel_($from, $to, $label, "-LEFT->>")
!endprocedure
!unquoted procedure Rel_Left($from, $to, $label, $techn)
Rel_($from, $to, $label, $techn, "-LEFT->>")
!unquoted procedure Rel_Left($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("-LEFT->>", $from, $to, $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure BiRel_L($from, $to, $label)
Rel_($from, $to, $label, "<<-LEFT->>")
!endprocedure
!unquoted procedure BiRel_L($from, $to, $label, $techn)
Rel_($from, $to, $label, $techn, "<<-LEFT->>")
!unquoted procedure BiRel_L($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("<<-LEFT->>", $from, $to, $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure BiRel_Left($from, $to, $label)
Rel_($from, $to, $label, "<<-LEFT->>")
!endprocedure
!unquoted procedure BiRel_Left($from, $to, $label, $techn)
Rel_($from, $to, $label, $techn, "<<-LEFT->>")
!unquoted procedure BiRel_Left($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("<<-LEFT->>", $from, $to, $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure Rel_R($from, $to, $label)
Rel_($from, $to, $label, "-RIGHT->>")
!endprocedure
!unquoted procedure Rel_R($from, $to, $label, $techn)
Rel_($from, $to, $label, $techn, "-RIGHT->>")
!endprocedure
!unquoted procedure Rel_Right($from, $to, $label)
Rel_($from, $to, $label, "-RIGHT->>")
!unquoted procedure Rel_R($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("-RIGHT->>", $from, $to, $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure Rel_Right($from, $to, $label, $techn)
Rel_($from, $to, $label, $techn, "-RIGHT->>")
!unquoted procedure Rel_Right($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("-RIGHT->>", $from, $to, $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure BiRel_R($from, $to, $label)
Rel_($from, $to, $label, "<<-RIGHT->>")
!endprocedure
!unquoted procedure BiRel_R($from, $to, $label, $techn)
Rel_($from, $to, $label, $techn, "<<-RIGHT->>")
!endprocedure
!unquoted procedure BiRel_Right($from, $to, $label)
Rel_($from, $to, $label, "<<-RIGHT->>")
!unquoted procedure BiRel_R($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("<<-RIGHT->>", $from, $to, $label, $techn, $descr, $sprite, $tags)
!endprocedure
!unquoted procedure BiRel_Right($from, $to, $label, $techn)
Rel_($from, $to, $label, $techn, "<<-RIGHT->>")
!unquoted procedure BiRel_Right($from, $to, $label, $techn="", $descr="", $sprite="", $tags="")
$getRel("<<-RIGHT->>", $from, $to, $label, $techn, $descr, $sprite, $tags)
!endprocedure
' Layout Helpers

@ -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
}
@ -28,20 +28,17 @@ skinparam rectangle<<node>> {
' comment if node should not be added to legend. No dynamic legend extension required
SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_system\nexternal_container\nnode")
' Special
' Line breaks
' ##################################
' PlantUML supports no automatic line breaks of "PlantUML containers" (C4 Deployment_Node is a "PlantUML container")
' therefore Deployment_Node() implements an automatic line break based on spaces (like in all other objects).
' If a $type contains \n then the these are used (and no automatic space based line breaks are done)
' therefore (Deployment_)Node() implements an automatic line break based on spaces (like in all other objects).
' If a $type contains \n then these are used (and no automatic space based line breaks are done)
' $NODE_TYPE_MAX_CHAR_WIDTH defines the automatic line break position
!global $NODE_TYPE_MAX_CHAR_WIDTH = 35
!global $NODE_DESCR_MAX_CHAR_WIDTH=32
' Elements
' ##################################
!unquoted function $breakType($type, $widthStr)
!unquoted function $breakNode($type, $widthStr)
!$width = %intval($widthStr)
!$multiLine = ""
!if (%strpos($type, "\n") >= 0)
@ -77,36 +74,8 @@ SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_sy
!return $multiLine
!endfunction
!unquoted function $breakDescr($descr, $widthStr)
!$width = %intval($widthStr)
!$multiLine = ""
!if (%strpos($descr, "\n") >= 0)
!else
!while (%strlen($descr)>$width)
!$brPos = $width
!while ($brPos>0 && %substr($descr, $brPos, 1)!= ' ')
!$brPos = $brPos - 1
!endwhile
!if ($brPos < 1)
!$brPos = %strpos($descr, " ")
!else
!endif
!if ($brPos > 0)
!$multiLine = $multiLine + %substr($descr, 0, $brPos) + "\n"
!$descr = %substr($descr, $brPos + 1)
!else
!$multiLine = $multiLine+ $descr
!$descr = ""
!endif
!endwhile
!endif
!if (%strlen($descr)>0)
!$multiLine = $multiLine + $descr
!endif
!return $multiLine
!endfunction
' Elements
' ##################################
!function $getNode($label, $type, $descr, $sprite)
!$nodeText = ""
@ -115,7 +84,7 @@ SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_sy
!endif
!$nodeText = $nodeText + '==' + $label
!if ($type != "")
!$nodeText = $nodeText + '\n<size:' + $TECHN_FONT_SIZE + '>[' + $breakType($type, $NODE_TYPE_MAX_CHAR_WIDTH) + ']</size>'
!$nodeText = $nodeText + '\n<size:' + $TECHN_FONT_SIZE + '>[' + $breakNode($type, $NODE_TYPE_MAX_CHAR_WIDTH) + ']</size>'
!endif
!if ($descr != "")
!$nodeText = $nodeText + '\n\n' + $breakDescr($descr, $NODE_DESCR_MAX_CHAR_WIDTH)
@ -130,7 +99,7 @@ SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_sy
!endif
!$nodeText = $nodeText + '==' + $label
!if ($type != "")
!$nodeText = $nodeText + '\l<size:' + $TECHN_FONT_SIZE + '>[' + $breakType($type, $NODE_TYPE_MAX_CHAR_WIDTH) + ']</size>'
!$nodeText = $nodeText + '\l<size:' + $TECHN_FONT_SIZE + '>[' + $breakNode($type, $NODE_TYPE_MAX_CHAR_WIDTH) + ']</size>'
!endif
!if ($descr != "")
!$nodeText = $nodeText + '\l\l' + $breakDescr($descr, $NODE_DESCR_MAX_CHAR_WIDTH)
@ -145,7 +114,7 @@ SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_sy
!endif
!$nodeText = $nodeText + '==' + $label
!if ($type != "")
!$nodeText = $nodeText + '\r<size:' + $TECHN_FONT_SIZE + '>[' + $breakType($type, $NODE_TYPE_MAX_CHAR_WIDTH) + ']</size>'
!$nodeText = $nodeText + '\r<size:' + $TECHN_FONT_SIZE + '>[' + $breakNode($type, $NODE_TYPE_MAX_CHAR_WIDTH) + ']</size>'
!endif
!if ($descr != "")
!$nodeText = $nodeText + '\r\r' + $breakDescr($descr, $NODE_DESCR_MAX_CHAR_WIDTH)

@ -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](http://www.plantuml.com/plantuml/png/PL1DhzCm4BpxLopbq5GgYOeuSMg8IelKGjIa84wHcop4mX-MlL6e4F_zRTI-zadFbvLtPdTcTXr91XgCXdt-yzkfRlQRptLp_BBTrL19upMADygsUkWGUY8VFsPPa6FwMr4_d8U8eNMMq5BQEfFzKQ7j8_LPyU5TgQMbqs6VuL_6E-ousHHCbifYI3rh2l5AD5a8KMA8pYQoCyekOPPFLKKAaboOBKHrYOIc-UG6sybmIThL4kPNh_C5_1F0xwwJZ7XkfFUyvmUU8VTUgrQISdR6hUBj4lAgJBzkQXu92E_J5Ho-5nEMQ-t625F42EI0ytd953DeKgm5zQY8C00fWvgr8dlxVtENq1NaFJSQW-A8-ZdLmzOfyYJNNLsN5RCcqXrzhDaYHVxYL7u5PrwEhFc-VCud "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](http://www.plantuml.com/plantuml/png/PL1Fxz904BtlfnZnG4cm3SQJ9sebO0BOs2Bnr2pjQ3VkdytkD9KOlxlJW63osyjavxsPzzwi8yb0Wz6mpxzzFjND-LEzQ_QRxURu4Iffl4RnIjbM3nr2J-JZ-omBSan_AEg7on0njCuIMafRPxAVAhHzf3uhthqfjRHqEkmp_CLuXnqtcuB9KbaCgMTH8Lwg9WiXIWpHsKHsHjabpFAfgaX1aWkpXQYkaT0q7znWEnckIRjQmlncThw0tmBuFOII4I-Dz9xtdF42kVTQjPAKipDk5Q-Na5TbUjpKF18GtgOhE7mj9YpNseqHfemHo047z98fPj2aM0lgKH5X0586DMj5zlRdxYwX6yXxxZG6nHVK_r8zRPqYJtBTrNLPCMiYFT3dcYrIv2zEvNjmvl-HDH-Ox_aN "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/kirchsth/C4-PlantUML/extended/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/JKzDJ-f05DttLypZBIW9hmqlhbnH2m4JmCOMYQjcQAzsudnCPkwa4kD_zpOYE9kJkUSZvymzSeT1oUYFq8qCBR0EqVhRD7MyJru5Tk4OFBZ6Q0IDIMDK-YPSqtdiqlpcNo6vnlrsay8xyIsqTAnp4dEXmILsY8uASDxecBTAw2aRPGCAZuwZSQD9L9uyWghlJD0jTwUucKtPkEJAIXXFs4V4w5qYunwEDRUMSWvmP9crKZGSXT4ZEkL_fomhYsIthCZYWFrFPcpxb0zS9gNfFHlMU8Q6qHJBIQA2H64biAeNYE0O2WLIQF3KxVFSBiPladBECYAZHv0_gwwrzfwSXEkgAafI3Q8BUurP0NhwmW0lpgZVbgXSFnpgnVCkszxdzMQvMkuMyIIQWsw3aby0 "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()

@ -128,7 +128,7 @@ Rel_R(api, db, "Reads/Writes")
Rel(admin, spaAdmin, "Uses", "https")
Rel(spaAdmin, api, "Uses", "https")
SHOW_DYNAMIC_LEGEND()
SHOW_LEGEND()
@enduml
```
@ -247,7 +247,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)
@ -262,7 +262,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")`.
@ -270,9 +270,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.
@ -298,7 +298,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
```
@ -306,7 +306,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
@ -324,10 +324,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")
@ -340,7 +340,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

@ -0,0 +1,72 @@
@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
System(RelFrom, RelFrom)
System(BiRelFrom, BiRelFrom)
System(RelShort, RelShort)
System(BiRelShort, BiRelShort)
System(RelLong, RelLong)
System(BiRelLong, BiRelLong)
Rel_(RelFrom, To_Rel_UP, "A label", "-UP->>")
Rel_(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")
BiRel(BiRelFrom, "To_BiRel", "A label")
BiRel(BiRelFrom, "To_BiRel_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")
BiRel_D(BiRelShort, "To_BiRel_D", "A label")
BiRel_D(BiRelShort, "To_BiRel_D_Tech", "A label", "A techn")
BiRel_Down(BiRelLong, "To_BiRel_Down", "A label")
BiRel_Down(BiRelLong, "To_BiRel_Down_Tech", "A label", "A techn")
BiRel_L(BiRelShort, "To_BiRel_L", "A label")
BiRel_L(BiRelShort, "To_BiRel_L_Tech", "A label", "A techn")
BiRel_Left(BiRelLong, "To_BiRel_Left", "A label")
BiRel_Left(BiRelLong, "To_BiRel_Left_Tech", "A label", "A techn")
BiRel_R(BiRelShort, "To_BiRel_R", "A label")
BiRel_R(BiRelShort, "To_BiRel_R_Tech", "A label", "A techn")
BiRel_Right(BiRelLong, "To_BiRel_Right", "A label")
BiRel_Right(BiRelLong, "To_BiRel_Right_Tech", "A label", "A techn")
BiRel_U(BiRelShort, "To_BiRel_U", "A label")
BiRel_U(BiRelShort, "To_BiRel_U_Tech", "A label", "A techn")
BiRel_Up(BiRelLong, "To_BiRel_Up", "A label")
BiRel_Up(BiRelLong, "To_BiRel_Up_Tech", "A label", "A techn")
Lay_U(RelFrom, BiRelFrom)
Lay_D(RelFrom, RelShort)
Lay_D(RelShort, RelLong)
Lay_R(RelLong, BiRelShort)
Lay_L(RelLong, BiRelLong)
@enduml

@ -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