diff --git a/C4/C4.puml b/C4/C4.puml index bef1de5fc..3f824160a 100644 --- a/C4/C4.puml +++ b/C4/C4.puml @@ -1,5 +1,18 @@ ' C4-PlantUML +'Version +' ################################## +!function C4Version() + !return "2.4.0" +!end function + +!procedure C4VersionDetails() +rectangle C4VersionDetailsArea <> [ +| PlantUML | **%version()** | +| C4-PlantUML | **C4Version()** | +] +!end procedure + ' Colors ' ################################## @@ -130,13 +143,41 @@ skinparam rectangle<> { !$tags = %substr($tags, $brPos+1) !$brPos = %strpos($tags, "+") !endwhile - !if (%strlen($tags)>0) + !if (%strlen($tags) > 0) !$stereos = $stereos + '<<' + $tags + '>>' %set_variable_value("$" + $tags + "_LineLegend", %true()) !endif !return $stereos !endfunction +' if $sprite/$techn is an empty argument, try to calculate it via the defined $tag +!unquoted function $toRelArg($arg, $tags, $varPostfix) + !if ($arg > "") + !return $arg + !endif + + !if (%strlen($tags) == 0) + !return $arg + !endif + !$brPos = %strpos($tags, "+") + !while ($brPos >= 0) + !$tag = %substr($tags, 0, $brPos) + !$newArg = %get_variable_value("$" + $tag + $varPostfix) + !if ($newArg > "") + !return $newArg + !endif + !$tags = %substr($tags, $brPos+1) + !$brPos = %strpos($tags, "+") + !endwhile + !if (%strlen($tags) > 0) + !$newArg = %get_variable_value("$" + $tags + $varPostfix) + !if ($newArg > "") + !return $newArg + !endif + !endif + !return $arg +!endfunction + ' element specific (unused are hidden based on mask) !unquoted function $toStereos($elementType, $tags) !if (%strlen($tags) == 0) @@ -158,7 +199,7 @@ skinparam rectangle<> { !$tags = %substr($tags, $brPos+1) !$brPos = %strpos($tags, "+") !endwhile - !if (%strlen($tags)>0) + !if (%strlen($tags) > 0) !$stereos = $stereos + '<<' + $tags + '>>' !$mergedMask = $combineMaskWithTag($mask, $tags) !if ($mergedMask != $mask) @@ -176,18 +217,55 @@ skinparam rectangle<> { !return $stereos !endfunction +' if $sprite/$techn is an empty argument, try to calculate it via the defined $tag +!unquoted function $toElementArg($arg, $tags, $varPostfix, $elementType) + !if ($arg > "") + !return $arg + !endif + + !if (%strlen($tags) == 0) + !$newArg = %get_variable_value("$" + $elementType + $varPostfix) + !if ($newArg > "") + !return $newArg + !else + !return $arg + !endif + !endif + !$brPos = %strpos($tags, "+") + !while ($brPos >= 0) + !$tag = %substr($tags, 0, $brPos) + !$newArg = %get_variable_value("$" + $tag + $varPostfix) + !if ($newArg > "") + !return $newArg + !endif + !$tags = %substr($tags, $brPos+1) + !$brPos = %strpos($tags, "+") + !endwhile + !if (%strlen($tags) > 0) + !$newArg = %get_variable_value("$" + $tags + $varPostfix) + !if ($newArg > "") + !return $newArg + !endif + !$newArg = %get_variable_value("$" + $elementType + $varPostfix) + !if ($newArg > "") + !return $newArg + !endif + !endif + !return $arg +!endfunction + !function $elementTagSkinparams($element, $tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape) - !$elementSkin = "skinparam " + $element +"<<" + $tagStereo + ">> {" + %newline() - !if ($fontColor!="") + !$elementSkin = "skinparam " + $element + "<<" + $tagStereo + ">> {" + %newline() + !if ($fontColor != "") !if ($tagStereo != "boundary") !$elementSkin = $elementSkin + " StereotypeFontColor " + $fontColor + %newline() !endif !$elementSkin = $elementSkin + " FontColor " + $fontColor + %newline() !endif - !if ($bgColor!="") + !if ($bgColor != "") !$elementSkin = $elementSkin + " BackgroundColor " + $bgColor + %newline() !endif - !if ($borderColor!="") + !if ($borderColor != "") !$elementSkin = $elementSkin + " BorderColor " + $borderColor+ %newline() !endif !if ($shadowing == "true") @@ -197,7 +275,7 @@ skinparam rectangle<> { !$elementSkin = $elementSkin + " Shadowing<<" + $tagStereo + ">> " + "false" + %newline() !endif ' only rectangle supports shape(d corners), define both skinparam that overlays are working - !if ($shape!="" && $element == "rectangle") + !if ($shape != "" && $element == "rectangle") !if ($shape == $ROUNDED_BOX) !$elementSkin = $elementSkin + " RoundCorner " + $ROUNDED_BOX_SIZE+ %newline() !$elementSkin = $elementSkin + " DiagonalCorner " + "0" + %newline() @@ -218,7 +296,7 @@ skinparam rectangle<> { ' actor has style awesome, therefore $fontColor is ignored and text uses $bgColor too !$tagSkin = $tagSkin + $elementTagSkinparams("actor", $tagStereo, $bgColor, $bgColor, $borderColor, $shadowing, "") !$tagSkin = $tagSkin + $elementTagSkinparams("person", $tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, "") - !if ($tagStereo == "boundary" && $bgColor!="") + !if ($tagStereo == "boundary" && $bgColor != "") !$tagSkin = $tagSkin + "skinparam package<>StereotypeFontColor " + $bgColor + %newline() !$tagSkin = $tagSkin + "skinparam rectangle<>StereotypeFontColor " + $bgColor + %newline() !endif @@ -236,13 +314,13 @@ $tagSkin !unquoted procedure $defineRelSkinparams($tagStereo, $textColor, $lineColor, $lineStyle) !$elementSkin = "skinparam arrow<<" + $tagStereo + ">> {" + %newline() !$elementSkin = $elementSkin + " Color " - !if ($lineColor!="") + !if ($lineColor != "") !$elementSkin = $elementSkin + $colorWithoutHash($lineColor) !endif - !if ($textColor!="") + !if ($textColor != "") !$elementSkin = $elementSkin + ";text:" + $colorWithoutHash($textColor) !endif - !if ($lineStyle!="") + !if ($lineStyle != "") !$elementSkin = $elementSkin + ";line." + $lineStyle !endif !$elementSkin = $elementSkin + %newline() @@ -250,7 +328,7 @@ $tagSkin $elementSkin !endprocedure -' %is_dark() requires PlantUML version >=1.2021.6 +' %is_dark() requires PlantUML version >= 1.2021.6 !if (%function_exists("%is_dark")) !$PlantUMLSupportsDynamicLegendColor = %true() !else @@ -300,18 +378,19 @@ $elementSkin !return "1" !endfunction -!function $tagLegendMask($bgColor, $fontColor, $borderColor, $shadowing, $shape) +!function $tagLegendMask($bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite) !$mask = "" !$mask = $addMaskFlag($mask, $bgColor) !$mask = $addMaskFlag($mask, $fontColor) !$mask = $addMaskFlag($mask, $borderColor) !$mask = $addMaskFlag($mask, $shadowing) !$mask = $addMaskFlag($mask, $shape) + !$mask = $addMaskFlag($mask, $sprite) !return $mask !endfunction !function $resetMask() - !return "00000" + !return "000000" !endfunction !function $combineMasks($mask1, $mask2) @@ -321,12 +400,13 @@ $elementSkin !$mask = $mask + $orFlags(%substr($mask1, 2, 1), %substr($mask2, 2, 1)) !$mask = $mask + $orFlags(%substr($mask1, 3, 1), %substr($mask2, 3, 1)) !$mask = $mask + $orFlags(%substr($mask1, 4, 1), %substr($mask2, 4, 1)) + !$mask = $mask + $orFlags(%substr($mask1, 5, 1), %substr($mask2, 5, 1)) !return $mask !endfunction !function $combineMaskWithTag($mask1, $tag) !$mask2 = %get_variable_value("$" + $tag+ "LegendMask") - !if ($mask2=="") + !if ($mask2 == "") ' !log combineMaskWithTag $mask1, $tag, ... only $mask1 !return $mask1 !endif @@ -335,7 +415,34 @@ $elementSkin !return $combineMasks($mask1, $mask2) !endfunction -!function $tagLegendEntry($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape) +' element symbols typically 4 times too big in legend +!function $smallVersionSprite($sprite) + ' ,scale= ... has to be first (...,color=black,scale=0.25... is invalid too) + !if (%strpos($sprite, "=") < 0) + !if (%substr($sprite, 0, 4) == "img:") + !$smallSprite = $sprite + "{scale=0.25}" + !else + !$smallSprite = $sprite + ",scale=0.25" + !endif + !else + !$smallSprite = $sprite + !endif + !return $smallSprite +!endfunction + +' format sprite that it can be used in diagram +!function $getSprite($sprite) + ' if it starts with & it's a OpenIconic, details see https://useiconic.com/open/ + ' if it starts with img: it's an image, details see https://plantuml.com/creole + !if (%substr($sprite, 0, 1) != "&" && %substr($sprite, 0, 4) != "img:") + !$formatted = "<$" + $sprite + ">" + !else + !$formatted = "<" + $sprite + ">" + !endif + !return $formatted +!endfunction + +!function $tagLegendEntry($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $legendText, $legendSprite) !$bg = $bgColor !$fo = $fontColor !$bo = $borderColor @@ -376,110 +483,126 @@ $elementSkin !endif !$tagEntry = "|" - !$tagEntry = $tagEntry + "<" + $colorWithHash($bg) +">" + !$tagEntry = $tagEntry + "<" + $colorWithHash($bg) +">" ' ..white rectangle !$tagEntry = $tagEntry + " " !$tagEntry = $tagEntry + "" - !$tagEntry = $tagEntry + " " + $tagStereo + " " - !if ($shadowing == "true") - !$tagEntry = $tagEntry + $LEGEND_SHADOW_TEXT - !endif - !if ($shadowing == "false") - !$tagEntry = $tagEntry + $LEGEND_NO_SHADOW_TEXT + !if ($legendSprite != "") + !$tagEntry = $tagEntry + $getSprite($legendSprite) + " " !endif - !if ($shape == $ROUNDED_BOX) - !$tagEntry = $tagEntry + $LEGEND_ROUNDED_BOX - !endif - !if ($shape == $EIGHT_SIDED) - !$tagEntry = $tagEntry + $LEGEND_EIGHT_SIDED - !endif - !if ($fontColor == "" && $bgColor == "") - !$tagEntry = $tagEntry + $LEGEND_NO_FONT_BG_TEXT - !else - !if ($fontColor == "") - !$tagEntry = $tagEntry + $LEGEND_NO_FONT_TEXT + !if ($legendText == "") + !$tagEntry = $tagEntry + " " + $tagStereo + " " + !if ($shadowing == "true") + !$tagEntry = $tagEntry + $LEGEND_SHADOW_TEXT !endif - !if ($bgColor == "") - !$tagEntry = $tagEntry + $LEGEND_NO_BG_TEXT + !if ($shadowing == "false") + !$tagEntry = $tagEntry + $LEGEND_NO_SHADOW_TEXT !endif + !if ($shape == $ROUNDED_BOX) + !$tagEntry = $tagEntry + $LEGEND_ROUNDED_BOX + !endif + !if ($shape == $EIGHT_SIDED) + !$tagEntry = $tagEntry + $LEGEND_EIGHT_SIDED + !endif + !if ($fontColor == "" && $bgColor == "") + !$tagEntry = $tagEntry + $LEGEND_NO_FONT_BG_TEXT + !else + !if ($fontColor == "") + !$tagEntry = $tagEntry + $LEGEND_NO_FONT_TEXT + !endif + !if ($bgColor == "") + !$tagEntry = $tagEntry + $LEGEND_NO_BG_TEXT + !endif + !endif + !else + !$tagEntry = $tagEntry + " " + $legendText + " " !endif + !$tagEntry = $tagEntry + " " !$tagEntry = $tagEntry + "|" - !return $tagEntry + !return $tagEntry !endfunction -!function $tagRelLegendEntry($tagStereo, $textColor, $lineColor, $lineStyle) +!function $tagRelLegendEntry($tagStereo, $textColor, $lineColor, $lineStyle, $legendText, $legendSprite) !$tc = $textColor !$lc = $lineColor - !if ($tc=="") -!if ($PlantUMLSupportsDynamicLegendColor) - !$tc = $flatLegend($ARROW_COLOR) -!else - !$tc = $LEGEND_DARK_COLOR -!endif + !if ($tc == "") + !if ($PlantUMLSupportsDynamicLegendColor) + !$tc = $flatLegend($ARROW_COLOR) + !else + !$tc = $LEGEND_DARK_COLOR + !endif !endif - !if ($lc=="") -!if ($PlantUMLSupportsDynamicLegendColor) - !$lc = $flatLegend($ARROW_COLOR) -!else - !$lc = $LEGEND_DARK_COLOR -!endif + !if ($lc == "") + !if ($PlantUMLSupportsDynamicLegendColor) + !$lc = $flatLegend($ARROW_COLOR) + !else + !$lc = $LEGEND_DARK_COLOR + !endif !endif !$tagEntry = "|" ' ..white line !$tagEntry = $tagEntry + " " !$tagEntry = $tagEntry + "" - !$tagEntry = $tagEntry + " " + $tagStereo + " " - !if ($textColor == "") - !$tagEntry = $tagEntry + $LEGEND_NO_FONT_TEXT + !if ($legendSprite != "") + !$tagEntry = $tagEntry + $getSprite($legendSprite) + " " !endif - !if ($lineColor == "") - !$tagEntry = $tagEntry + $LEGEND_NO_LINE_TEXT - !endif - !if ($lineStyle != "") - !if ($lineStyle == $DOTTED_LINE) - !$tagEntry = $tagEntry + $LEGEND_DOTTED_LINE - !elseif ($lineStyle == $DASHED_LINE) - !$tagEntry = $tagEntry + $LEGEND_DASHED_LINE - !elseif ($lineStyle == $BOLD_LINE) - !$tagEntry = $tagEntry + $LEGEND_BOLD_LINE - !else - !$tagEntry = $tagEntry + "(" + $lineStyle + ") " + !if ($legendText == "") + !$tagEntry = $tagEntry + " " + $tagStereo + " " + !if ($textColor == "") + !$tagEntry = $tagEntry + $LEGEND_NO_FONT_TEXT !endif + !if ($lineColor == "") + !$tagEntry = $tagEntry + $LEGEND_NO_LINE_TEXT + !endif + !if ($lineStyle != "") + !if ($lineStyle == $DOTTED_LINE) + !$tagEntry = $tagEntry + $LEGEND_DOTTED_LINE + !elseif ($lineStyle == $DASHED_LINE) + !$tagEntry = $tagEntry + $LEGEND_DASHED_LINE + !elseif ($lineStyle == $BOLD_LINE) + !$tagEntry = $tagEntry + $LEGEND_BOLD_LINE + !else + !$tagEntry = $tagEntry + "(" + $lineStyle + ") " + !endif + !endif + !else + !$tagEntry = $tagEntry + " " + $legendText + " " !endif + !$tagEntry = $tagEntry + " " !$tagEntry = $tagEntry + "|" - !return $tagEntry + !return $tagEntry !endfunction !global $LEGEND_DOTTED_LINE = "(dotted) " !global $LEGEND_DASHED_LINE = "(dashed) " !global $LEGEND_BOLD_LINE = "(bold) " -!unquoted procedure $addTagToLegend($tagStereo, $bgColor="", $fontColor="", $borderColor="", $shadowing="", $shape="") +!unquoted procedure $addTagToLegend($tagStereo, $bgColor="", $fontColor="", $borderColor="", $shadowing="", $shape="", $legendText="", $legendSprite="") '' if a combined element tag is defined (e.g. "v1.0&v1.1") then it is typically a merged color, -'' like a new $fontColor="#fdae61" therefore it should be added to the legend +'' like a new $fontColor="#fdae61" therefore it should be added to the legend '' and the & combined tags will be not removed -' !if (%strpos($tagStereo, "&")<0) - !$tagEntry = $tagLegendEntry($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape) +' !if (%strpos($tagStereo, "&") < 0) + !$tagEntry = $tagLegendEntry($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $legendText, $legendSprite) %set_variable_value("$" + $tagStereo + "LegendEntry", $tagEntry) - !$tagCustomLegend = $tagCustomLegend + $tagStereo + "\n" - !$tagMask = $tagLegendMask( $bgColor, $fontColor, $borderColor, $shadowing, $shape) + !$tagCustomLegend = $tagCustomLegend + $tagStereo + "\n" + !$tagMask = $tagLegendMask( $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite) %set_variable_value("$" + $tagStereo + "LegendMask", $tagMask) ' !endif !endprocedure -!unquoted procedure $addRelTagToLegend($tagStereo, $textColor="", $lineColor="", $lineStyle="") +!unquoted procedure $addRelTagToLegend($tagStereo, $textColor="", $lineColor="", $lineStyle="", $legendText="", $legendSprite="") '' Arrows have a bug with stereotype/skinparams and cannot combine text colors of one stereotype -'' and the line color of another stereotype. Therefore the text color of one tag and the line color +'' and the line color of another stereotype. Therefore the text color of one tag and the line color '' of another tag have to be combined via a "workaround" tag ("v1.0&v1.1"). -'' This workaround tag could be theoretically removed in the legend but after that there would -'' be an inconsistency between the element tags and the rel tags and therefore +'' This workaround tag could be theoretically removed in the legend but after that there would +'' be an inconsistency between the element tags and the rel tags and therefore '' & combined workaround tags are not removed too (and in unlikely cases the color itself could be changed) -' !if (%strpos($tagStereo, "&")<0) - !$tagEntry = $tagRelLegendEntry($tagStereo, $textColor, $lineColor, $lineStyle) +' !if (%strpos($tagStereo, "&") < 0) + !$tagEntry = $tagRelLegendEntry($tagStereo, $textColor, $lineColor, $lineStyle, $legendText, $legendSprite) %set_variable_value("$" + $tagStereo + "_LineLegendEntry", $tagEntry) !$tagCustomLegend = $tagCustomLegend + $tagStereo + "_Line\n" ' !endif @@ -495,7 +618,7 @@ $elementSkin %get_variable_value("$" + $tagStereo + "LegendEntry") !endif !endwhile - !if (%strlen($allDefined)>0) + !if (%strlen($allDefined) > 0) !$tagStereo = $allDefined !if (%variable_exists("$" + $tagStereo + "Legend")) %get_variable_value("$" + $tagStereo + "LegendEntry") @@ -524,24 +647,52 @@ $elementSkin !endfunction ' used by new defined tags -!unquoted procedure AddElementTag($tagStereo, $bgColor="", $fontColor="", $borderColor="", $shadowing="", $shape="") +!unquoted procedure AddElementTag($tagStereo, $bgColor="", $fontColor="", $borderColor="", $shadowing="", $shape="", $sprite="", $techn="", $legendText="", $legendSprite="") $defineSkinparams($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape) -$addTagToLegend($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape) + !if ($sprite!="") +%set_variable_value("$" + $tagStereo + "ElementTagSprite", $sprite) + !if ($legendSprite == "") + !$legendSprite = $smallVersionSprite($sprite) + !endif + !endif + !if ($techn != "") +%set_variable_value("$" + $tagStereo + "ElementTagTechn", $techn) + !endif +$addTagToLegend($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $legendText, $legendSprite) !endprocedure ' used by new defined rel tags -!unquoted procedure AddRelTag($tagStereo, $textColor="", $lineColor="", $lineStyle = "") +!unquoted procedure AddRelTag($tagStereo, $textColor="", $lineColor="", $lineStyle = "", $sprite="", $techn="", $legendText="", $legendSprite="") $defineRelSkinparams($tagStereo, $textColor, $lineColor, $lineStyle) -$addRelTagToLegend($tagStereo, $textColor, $lineColor, $lineStyle) + !if ($sprite != "") +%set_variable_value("$" + $tagStereo + "RelTagSprite", $sprite) + !if ($legendSprite == "") + ' relation symbols typically 1:1 no additional scale required + !$legendSprite = $sprite + !endif + !endif + !if ($techn != "") +%set_variable_value("$" + $tagStereo + "RelTagTechn", $techn) + !endif +$addRelTagToLegend($tagStereo, $textColor, $lineColor, $lineStyle, $legendText, $legendSprite) !endprocedure ' update the style of existing elements like person, ... -!unquoted procedure UpdateElementStyle($elementName, $bgColor="", $fontColor="", $borderColor="", $shadowing="", $shape="") +!unquoted procedure UpdateElementStyle($elementName, $bgColor="", $fontColor="", $borderColor="", $shadowing="", $shape="", $sprite="", $techn="", $legendText="", $legendSprite="") $defineSkinparams($elementName, $bgColor, $fontColor, $borderColor, $shadowing, $shape) - !$tagEntry = $tagLegendEntry($elementName, $bgColor, $fontColor, $borderColor, $shadowing, $shape) + !if ($sprite != "") +%set_variable_value("$" + $elementName + "ElementTagSprite", $sprite) + !if ($legendSprite == "") + !$legendSprite = $smallVersionSprite($sprite) + !endif + !endif + !if ($techn != "") +%set_variable_value("$" + $elementName + "ElementTagTechn", $techn) + !endif + !$tagEntry = $tagLegendEntry($elementName, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $legendText, $legendSprite) %set_variable_value("$" + $elementName + "LegendEntry", $tagEntry) ' default tags sets at least bgColor and fontColor - !$tagMask = $tagLegendMask("CHANGED", "CHANGED", $borderColor, $shadowing, $shape) + !$tagMask = $tagLegendMask("CHANGED", "CHANGED", $borderColor, $shadowing, $shape, $sprite) %set_variable_value("$" + $elementName + "LegendMask", $tagMask) !endprocedure @@ -559,7 +710,7 @@ UpdateElementStyle($elementName, $bgColor, $fontColor, $borderColor, $shadowing) $elementSkin !endprocedure -' tags/stereotypes have to be delimited with \n +' tags/stereotypes have to be delimited with \n !unquoted procedure SetDefaultLegendEntries($tagStereoEntries) !$tagDefaultLegend = $tagStereoEntries !endprocedure @@ -568,7 +719,7 @@ $elementSkin ' ################################## !function $getLink($link) - !if ($link!="") + !if ($link != "") !return "[[" + $link + "]]" !else !return "" @@ -590,9 +741,9 @@ $elementSkin !$multiLine = "" !if (%strpos($descr, "\n") >= 0) !else - !while (%strlen($descr)>$width) - !$brPos = $width - !while ($brPos>0 && %substr($descr, $brPos, 1)!= ' ') + !while (%strlen($descr) > $width) + !$brPos = $width + !while ($brPos > 0 && %substr($descr, $brPos, 1) != ' ') !$brPos = $brPos - 1 !endwhile @@ -610,7 +761,7 @@ $elementSkin !endif !endwhile !endif -!if (%strlen($descr)>0) +!if (%strlen($descr) > 0) !$multiLine = $multiLine + $descr !endif !return $multiLine @@ -627,9 +778,9 @@ $elementSkin !$techn = %substr($techn, $brPos+2) !endwhile !else - !while (%strlen($techn)>$width) + !while (%strlen($techn) > $width) !$brPos = $width - !while ($brPos>0 && %substr($techn, $brPos, 1)!= ' ') + !while ($brPos > 0 && %substr($techn, $brPos, 1) != ' ') !$brPos = $brPos - 1 !endwhile @@ -647,7 +798,7 @@ $elementSkin !endif !endwhile !endif -!if (%strlen($techn)>0) +!if (%strlen($techn) > 0) !$multiLine = $multiLine + $techn !endif !return $multiLine @@ -719,19 +870,19 @@ SetPropertyHeader("Property","Value") ' Layout ' ################################## -!procedure $getHideStereotype($hideStereotype) -!if ($hideStereotype=="true") +!procedure $getHideStereotype($hideStereotype) +!if ($hideStereotype == "true") hide stereotype !endif !endprocedure -!procedure $getLegendTable() +!procedure $getLegendTable() <#00000000,#00000000>|**Legend** | $showActiveLegendEntries($tagDefaultLegend) $showActiveLegendEntries($tagCustomLegend) !endprocedure -!procedure $getLegendArea($areaAlias, $hideStereotype) +!procedure $getLegendArea($areaAlias, $hideStereotype) $getHideStereotype($hideStereotype) rectangle $areaAlias<> [ $getLegendTable() @@ -749,11 +900,52 @@ skinparam defaultFontName "Comic Sans MS" center footer Warning: Created for discussion, needs to be validated !endprocedure +!global $fix_direction=%false() + +!function $down($start,$end) +!if ($fix_direction) +!return $start+"RIGHT"+$end +!else +!return $start+"DOWN"+$end +!endif +!endfunction + +!function $up($start,$end) +!if ($fix_direction) +!return $start+"LEFT"+$end +!else +!return $start+"UP"+$end +!endif +!endfunction + +!function $left($start,$end) +!if ($fix_direction) +!return $start+"UP"+$end +!else +!return $start+"LEFT"+$end +!endif +!endfunction + +!function $right($start,$end) +!if ($fix_direction) +!return $start+"DOWN"+$end +!else +!return $start+"RIGHT"+$end +!endif +!endfunction + !procedure LAYOUT_TOP_DOWN() +!global $fix_direction=%false() top to bottom direction !endprocedure !procedure LAYOUT_LEFT_RIGHT() +!global $fix_direction = %false() +left to right direction +!endprocedure + +!procedure LAYOUT_LANDSCAPE() +!global $fix_direction = %true() left to right direction !endprocedure @@ -802,19 +994,16 @@ rectangle "$getBoundary($label, $type)" $toStereos("boundary", $tags) as $alias ' ################################## !function $getRel($direction, $alias1, $alias2, $label, $techn, $descr, $sprite, $tags, $link) + !$sprite = $toRelArg($sprite, $tags, "RelTagSprite") + !$techn = $toRelArg($techn, $tags, "RelTagTechn") !$rel = $alias1 + ' ' + $direction + ' ' + $alias2 !if ($tags != "") !$rel = $rel + ' ' + $toStereos($tags) - !endif + !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 + $getSprite($sprite) + ' ' + !endif !if ($link != "") !$rel = $rel + '**[[' + $link + ' ' + $label + ']]**' !else @@ -854,64 +1043,68 @@ $getRel("<<--", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) $getRel("->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure +!unquoted procedure BiRel_Neighbor($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +$getRel("<<->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) +!endprocedure + !unquoted procedure Rel_Back_Neighbor($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") $getRel("<<-", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure Rel_D($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("-DOWN->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) +$getRel($down("-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure Rel_Down($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("-DOWN->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) +$getRel($down("-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure BiRel_D($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("<<-DOWN->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) +$getRel($down("<<-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure BiRel_Down($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("<<-DOWN->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) +$getRel($down("<<-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure Rel_U($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("-UP->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) +$getRel($up("-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure Rel_Up($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("-UP->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) +$getRel($up("-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure BiRel_U($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("<<-UP->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) +$getRel($up("<<-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure BiRel_Up($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("<<-UP->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) +$getRel($up("<<-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure Rel_L($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("-LEFT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) +$getRel($left("-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure Rel_Left($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("-LEFT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) +$getRel($left("-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure BiRel_L($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("<<-LEFT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) +$getRel($left("<<-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure BiRel_Left($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("<<-LEFT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) +$getRel($left("<<-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure Rel_R($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("-RIGHT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) +$getRel($right("-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure Rel_Right($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("-RIGHT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) +$getRel($right("-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure BiRel_R($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("<<-RIGHT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) +$getRel($right("<<-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure BiRel_Right($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("<<-RIGHT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link) +$getRel($right("<<-","->>"), $from, $to, $label, $techn, $descr, $sprite, $tags, $link) !endprocedure ' Layout Helpers diff --git a/C4/C4_Component.puml b/C4/C4_Component.puml index 549acffe1..53eee74dd 100644 --- a/C4/C4_Component.puml +++ b/C4/C4_Component.puml @@ -21,6 +21,14 @@ 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) +' shortcuts with default colors +!unquoted procedure AddComponentTag($tagStereo, $bgColor=$COMPONENT_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$COMPONENT_BORDER_COLOR, $shadowing="", $shape="", $sprite="", $techn="", $legendText="", $legendSprite="") + AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, $techn, $legendText, $legendSprite) +!endprocedure +!unquoted procedure AddExternalComponentTag($tagStereo, $bgColor=$EXTERNAL_COMPONENT_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$EXTERNAL_COMPONENT_BORDER_COLOR, $shadowing="", $shape="", $sprite="", $techn="", $legendText="", $legendSprite="") + AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, $techn, $legendText, $legendSprite) +!endprocedure + ' Layout ' ################################## @@ -49,36 +57,48 @@ endlegend !return '=='+$label+'\n//['+$techn+']//' !endif !if ($descr == "") && ($sprite != "") -!return '<$'+$sprite+'>\n=='+$label+'\n//['+$techn+']//' +!return $getSprite($sprite)+'\n=='+$label+'\n//['+$techn+']//' !endif !if ($descr != "") && ($sprite == "") !return '=='+$label+'\n//['+$techn+']//\n\n '+$descr !endif !if ($descr != "") && ($sprite != "") -!return '<$'+$sprite+'>\n=='+$label+'\n//['+$techn+']//\n\n '+$descr +!return $getSprite($sprite)+'\n=='+$label+'\n//['+$techn+']//\n\n '+$descr !endif !endfunction -!unquoted procedure Component($alias, $label, $techn, $descr="", $sprite="", $tags="", $link="") +!unquoted procedure Component($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "component") +!$techn=$toElementArg($techn, $tags, "ElementTagTechn", "component") rectangle "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("component",$tags) as $alias $getLink($link) !endprocedure -!unquoted procedure ComponentDb($alias, $label, $techn, $descr="", $sprite="", $tags="", $link="") +!unquoted procedure ComponentDb($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "component") +!$techn=$toElementArg($techn, $tags, "ElementTagTechn", "component") database "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("component",$tags) as $alias $getLink($link) !endprocedure -!unquoted procedure ComponentQueue($alias, $label, $techn, $descr="", $sprite="", $tags="", $link="") +!unquoted procedure ComponentQueue($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "component") +!$techn=$toElementArg($techn, $tags, "ElementTagTechn", "component") queue "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("component",$tags) as $alias $getLink($link) !endprocedure -!unquoted procedure Component_Ext($alias, $label, $techn, $descr="", $sprite="", $tags="", $link="") +!unquoted procedure Component_Ext($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "external_component") +!$techn=$toElementArg($techn, $tags, "ElementTagTechn", "external_component") rectangle "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_component",$tags) as $alias $getLink($link) !endprocedure -!unquoted procedure ComponentDb_Ext($alias, $label, $techn, $descr="", $sprite="", $tags="", $link="") +!unquoted procedure ComponentDb_Ext($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "external_component") +!$techn=$toElementArg($techn, $tags, "ElementTagTechn", "external_component") database "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_component",$tags) as $alias $getLink($link) !endprocedure -!unquoted procedure ComponentQueue_Ext($alias, $label, $techn, $descr="", $sprite="", $tags="", $link="") +!unquoted procedure ComponentQueue_Ext($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "external_component") +!$techn=$toElementArg($techn, $tags, "ElementTagTechn", "external_component") queue "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_component",$tags) as $alias $getLink($link) !endprocedure diff --git a/C4/C4_Container.puml b/C4/C4_Container.puml index 76a127485..43a31ef46 100644 --- a/C4/C4_Container.puml +++ b/C4/C4_Container.puml @@ -18,6 +18,14 @@ 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) +' shortcuts with default colors +!unquoted procedure AddContainerTag($tagStereo, $bgColor=$CONTAINER_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$CONTAINER_BORDER_COLOR, $shadowing="", $shape="", $sprite="", $techn="", $legendText="", $legendSprite="") + AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, $techn, $legendText, $legendSprite) +!endprocedure +!unquoted procedure AddExternalContainerTag($tagStereo, $bgColor=$EXTERNAL_CONTAINER_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$EXTERNAL_CONTAINER_BORDER_COLOR, $shadowing="", $shape="", $sprite="", $techn="", $legendText="", $legendSprite="") + AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, $techn, $legendText, $legendSprite) +!endprocedure + ' Layout ' ################################## @@ -44,37 +52,49 @@ endlegend !return '=='+$label+'\n//['+$techn+']//' !endif !if ($descr == "") && ($sprite != "") -!return '<$'+$sprite+'>\n=='+$label+'\n//['+$techn+']//' +!return $getSprite($sprite)+'\n=='+$label+'\n//['+$techn+']//' !endif !if ($descr != "") && ($sprite == "") !return '=='+$label+'\n//['+$techn+']//\n\n '+$descr !endif !if ($descr != "") && ($sprite != "") -!return '<$'+$sprite+'>\n=='+$label+'\n//['+$techn+']//\n\n '+$descr +!return $getSprite($sprite)+'\n=='+$label+'\n//['+$techn+']//\n\n '+$descr !endif !endfunction -!unquoted procedure Container($alias, $label, $techn, $descr="", $sprite="", $tags="", $link="") +!unquoted procedure Container($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "container") +!$techn=$toElementArg($techn, $tags, "ElementTagTechn", "container") rectangle "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("container", $tags) as $alias $getLink($link) !endprocedure -!unquoted procedure ContainerDb($alias, $label, $techn, $descr="", $sprite="", $tags="", $link="") +!unquoted procedure ContainerDb($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "container") +!$techn=$toElementArg($techn, $tags, "ElementTagTechn", "container") database "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("container", $tags) as $alias $getLink($link) !endprocedure -!unquoted procedure ContainerQueue($alias, $label, $techn, $descr="", $sprite="", $tags="", $link="") +!unquoted procedure ContainerQueue($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "container") +!$techn=$toElementArg($techn, $tags, "ElementTagTechn", "container") queue "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("container", $tags) as $alias $getLink($link) !endprocedure -!unquoted procedure Container_Ext($alias, $label, $techn, $descr="", $sprite="", $tags="", $link="") +!unquoted procedure Container_Ext($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "external_container") +!$techn=$toElementArg($techn, $tags, "ElementTagTechn", "external_container") rectangle "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_container", $tags) as $alias $getLink($link) !endprocedure -!unquoted procedure ContainerDb_Ext($alias, $label, $techn, $descr="", $sprite="", $tags="", $link="") +!unquoted procedure ContainerDb_Ext($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "external_container") +!$techn=$toElementArg($techn, $tags, "ElementTagTechn", "external_container") database "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_container", $tags) as $alias $getLink($link) !endprocedure -!unquoted procedure ContainerQueue_Ext($alias, $label, $techn, $descr="", $sprite="", $tags="", $link="") +!unquoted procedure ContainerQueue_Ext($alias, $label, $techn="", $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "external_container") +!$techn=$toElementArg($techn, $tags, "ElementTagTechn", "external_container") queue "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_container", $tags) as $alias $getLink($link) !endprocedure diff --git a/C4/C4_Context.puml b/C4/C4_Context.puml index 6898d5c78..516c114bb 100644 --- a/C4/C4_Context.puml +++ b/C4/C4_Context.puml @@ -25,6 +25,19 @@ UpdateElementStyle("external_person", $EXTERNAL_PERSON_BG_COLOR, $ELEMENT_FONT_C 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) +' shortcuts with default colors +!unquoted procedure AddPersonTag($tagStereo, $bgColor=$PERSON_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$PERSON_BORDER_COLOR, $shadowing="", $shape="", $sprite="", $legendText="", $legendSprite="") + AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, "", $legendText, $legendSprite) +!endprocedure +!unquoted procedure AddExternalPersonTag($tagStereo, $bgColor=$EXTERNAL_PERSON_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$EXTERNAL_PERSON_BORDER_COLOR, $shadowing="", $shape="", $sprite="", $legendText="", $legendSprite="") + AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, "", $legendText, $legendSprite) +!endprocedure +!unquoted procedure AddSystemTag($tagStereo, $bgColor=$SYSTEM_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$SYSTEM_BORDER_COLOR, $shadowing="", $shape="", $sprite="", $legendText="", $legendSprite="") + AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, "", $legendText, $legendSprite) +!endprocedure +!unquoted procedure AddExternalSystemTag($tagStereo, $bgColor=$EXTERNAL_SYSTEM_BG_COLOR, $fontColor=$ELEMENT_FONT_COLOR, $borderColor=$EXTERNAL_SYSTEM_BORDER_COLOR, $shadowing="", $shape="", $sprite="", $legendText="", $legendSprite="") + AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, "", $legendText, $legendSprite) +!endprocedure ' Sprites ' ################################## @@ -178,20 +191,20 @@ endlegend ' ################################## !function $getPerson($label, $descr, $sprite) -!if ($sprite == "") && ($defaultPersonSprite!="") +!if ($sprite == "") && ($defaultPersonSprite != "") !$sprite = $defaultPersonSprite !endif !if ($descr == "") && ($sprite == "") !return '=='+$label !endif !if ($descr == "") && ($sprite != "") - !return '<$'+$sprite+'>\n=='+$label + !return $getSprite($sprite)+'\n=='+$label !endif !if ($descr != "") && ($sprite == "") !return '=='+$label+'\n\n '+$descr !endif !if ($descr != "") && ($sprite != "") - !return '<$'+$sprite+'>\n=='+$label+'\n\n '+$descr + !return $getSprite($sprite)+'\n=='+$label+'\n\n '+$descr !endif !endfunction @@ -200,17 +213,18 @@ endlegend !return '=='+$label !endif !if ($descr == "") && ($sprite != "") -!return '<$'+$sprite+'>\n=='+$label +!return $getSprite($sprite)+'\n=='+$label !endif !if ($descr != "") && ($sprite == "") !return '=='+$label+'\n\n '+$descr !endif !if ($descr != "") && ($sprite != "") -!return '<$'+$sprite+'>\n=='+$label+'\n\n '+$descr +!return $getSprite($sprite)+'\n=='+$label+'\n\n '+$descr !endif !endfunction !unquoted procedure Person($alias, $label, $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "person") !if ($portraitPerson == "portrait") && ($sprite == "") actor "$getPerson($label, $descr, $sprite)$getProps()" $toStereos("person", $tags) as $alias $getLink($link) !elseif ($portraitPerson == "outline") && ($sprite == "") @@ -221,6 +235,7 @@ rectangle "$getPerson($label, $descr, $sprite)$getProps()" $toStereos("person", !endprocedure !unquoted procedure Person_Ext($alias, $label, $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "external_person") !if ($portraitPerson == "portrait") && ($sprite == "") actor "$getPerson($label, $descr, $sprite)$getProps()" $toStereos("external_person", $tags) as $alias $getLink($link) !elseif ($portraitPerson == "outline") && ($sprite == "") @@ -231,26 +246,32 @@ rectangle "$getPerson($label, $descr, $sprite)$getProps()" $toStereos("external_ !endprocedure !unquoted procedure System($alias, $label, $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "system") rectangle "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("system", $tags) as $alias $getLink($link) !endprocedure !unquoted procedure System_Ext($alias, $label, $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "external_system") rectangle "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("external_system", $tags) as $alias $getLink($link) !endprocedure !unquoted procedure SystemDb($alias, $label, $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "system") database "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("system", $tags) as $alias $getLink($link) !endprocedure !unquoted procedure SystemQueue($alias, $label, $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "system") queue "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("system", $tags) as $alias $getLink($link) !endprocedure !unquoted procedure SystemDb_Ext($alias, $label, $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "external_system") database "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("external_system", $tags) as $alias $getLink($link) !endprocedure !unquoted procedure SystemQueue_Ext($alias, $label, $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "external_system") queue "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("external_system", $tags) as $alias $getLink($link) !endprocedure diff --git a/C4/C4_Deployment.puml b/C4/C4_Deployment.puml index 50839e6c5..ed5a82520 100644 --- a/C4/C4_Deployment.puml +++ b/C4/C4_Deployment.puml @@ -10,13 +10,17 @@ ' Styling ' ################################## -' orig was without background -'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<> { FontStyle normal } +' shortcuts with default colors +' node specific: $type reuses $techn definition of $tags +!unquoted procedure AddNodeTag($tagStereo, $bgColor=$NODE_BG_COLOR, $fontColor=$NODE_FONT_COLOR, $borderColor=$NODE_BORDER_COLOR, $shadowing="", $shape="", $sprite="", $techn="", $legendText="", $legendSprite="") + AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, $techn, $legendText, $legendSprite) +!endprocedure + ' Layout ' ################################## @@ -31,7 +35,7 @@ SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_sy ' 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 +!global $NODE_DESCR_MAX_CHAR_WIDTH = 32 !unquoted function $breakNode($type, $widthStr) !$width = %intval($widthStr) @@ -43,9 +47,9 @@ SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_sy !$type = %substr($type, $brPos+2) !endwhile !else - !while (%strlen($type)>$width) + !while (%strlen($type) > $width) !$brPos = $width - !while ($brPos>0 && %substr($type, $brPos, 1)!= ' ') + !while ($brPos > 0 && %substr($type, $brPos, 1) != ' ') !$brPos = $brPos - 1 !endwhile @@ -63,7 +67,7 @@ SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_sy !endif !endwhile !endif -!if (%strlen($type)>0) +!if (%strlen($type) > 0) !$multiLine = $multiLine + $type !endif !return $multiLine @@ -75,7 +79,7 @@ SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_sy !function $getNode($label, $type, $descr, $sprite) !$nodeText = "" !if ($sprite != "") - !$nodeText = $nodeText + '<$'+$sprite+'>\n' + !$nodeText = $nodeText + $getSprite($sprite) + '\n' !endif !$nodeText = $nodeText + '==' + $label !if ($type != "") @@ -90,7 +94,7 @@ SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_sy !function $getNode_L($label, $type, $descr, $sprite) !$nodeText = "" !if ($sprite != "") - !$nodeText = $nodeText + '<$'+$sprite+'>\l' + !$nodeText = $nodeText + $getSprite($sprite) + '\l' !endif !$nodeText = $nodeText + '==' + $label !if ($type != "") @@ -105,7 +109,7 @@ SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_sy !function $getNode_R($label, $type, $descr, $sprite) !$nodeText = "" !if ($sprite != "") - !$nodeText = $nodeText + '<$'+$sprite+'>\r' + !$nodeText = $nodeText + $getSprite($sprite) + '\r' !endif !$nodeText = $nodeText + '==' + $label !if ($type != "") @@ -118,25 +122,43 @@ SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_sy !endfunction !unquoted procedure Deployment_Node($alias, $label, $type="", $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "node") +' nodes $type reuses $techn definition of $tags +!$type=$toElementArg($type, $tags, "ElementTagTechn", "node") rectangle "$getNode($label, $type, $descr, $sprite)$getProps()" $toStereos("node",$tags) as $alias $getLink($link) !endprocedure !unquoted procedure Deployment_Node_L($alias, $label, $type="", $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "node") +' nodes $type reuses $techn definition of $tags +!$type=$toElementArg($type, $tags, "ElementTagTechn", "node") rectangle "$getNode_L($label, $type, $descr, $sprite)$getProps_L()" $toStereos("node",$tags) as $alias $getLink($link) !endprocedure !unquoted procedure Deployment_Node_R($alias, $label, $type="", $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "node") +' nodes $type reuses $techn definition of $tags +!$type=$toElementArg($type, $tags, "ElementTagTechn", "node") rectangle "$getNode_R($label, $type, $descr, $sprite)$getProps_R()" $toStereos("node",$tags) as $alias $getLink($link) !endprocedure !unquoted procedure Node($alias, $label, $type="", $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "node") +' nodes $type reuses $techn definition of $tags +!$type=$toElementArg($type, $tags, "ElementTagTechn", "node") rectangle "$getNode($label, $type, $descr, $sprite)$getProps()" $toStereos("node",$tags) as $alias $getLink($link) !endprocedure !unquoted procedure Node_L($alias, $label, $type="", $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "node") +' nodes $type reuses $techn definition of $tags +!$type=$toElementArg($type, $tags, "ElementTagTechn", "node") rectangle "$getNode_L($label, $type, $descr, $sprite)$getProps_L()" $toStereos("node",$tags) as $alias $getLink($link) !endprocedure !unquoted procedure Node_R($alias, $label, $type="", $descr="", $sprite="", $tags="", $link="") +!$sprite=$toElementArg($sprite, $tags, "ElementTagSprite", "node") +' nodes $type reuses $techn definition of $tags +!$type=$toElementArg($type, $tags, "ElementTagTechn", "node") rectangle "$getNode_R($label, $type, $descr, $sprite)$getProps_R()" $toStereos("node",$tags) as $alias $getLink($link) !endprocedure diff --git a/C4/C4_Dynamic.puml b/C4/C4_Dynamic.puml index 73a6f688a..cf5dcc365 100644 --- a/C4/C4_Dynamic.puml +++ b/C4/C4_Dynamic.puml @@ -28,7 +28,7 @@ !procedure setIndex($new_index) !$lastIndex = $index - !$index= $new_index + !$index = $new_index !endprocedure !function Index($offset=1) @@ -89,53 +89,53 @@ $getRel("<<-", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $t !endprocedure !unquoted procedure Rel_D($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("-DOWN->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) +$getRel($down("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure Rel_Down($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("-DOWN->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) +$getRel($down("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure RelIndex_D($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("-DOWN->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) +$getRel($down("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure RelIndex_Down($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("-DOWN->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) +$getRel($down("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure Rel_U($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("-UP->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) +$getRel($up("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure Rel_Up($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("-UP->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) +$getRel($up("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure RelIndex_U($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("-UP->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) +$getRel($up("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure RelIndex_Up($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("-UP->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) +$getRel($up("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure Rel_L($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("-LEFT->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) +$getRel($left("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure Rel_Left($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("-LEFT->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) +$getRel($left("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure RelIndex_L($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("-LEFT->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) +$getRel($left("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure RelIndex_Left($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("-LEFT->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) +$getRel($left("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure Rel_R($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("-RIGHT->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) +$getRel($right("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure Rel_Right($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("-RIGHT->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) +$getRel($right("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure RelIndex_R($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("-RIGHT->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) +$getRel($right("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure !unquoted procedure RelIndex_Right($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="") -$getRel("-RIGHT->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) +$getRel($right("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link) !endprocedure diff --git a/C4/INFO b/C4/INFO index f379e825e..0e2f0ca02 100644 --- a/C4/INFO +++ b/C4/INFO @@ -1,2 +1,2 @@ -VERSION=2.3.0 +VERSION=2.4.0 SOURCE=https://github.com/plantuml-stdlib/C4-PlantUML \ No newline at end of file