mirror of
https://github.com/plantuml-stdlib/C4-PlantUML.git
synced 2022-10-18 01:14:54 +00:00
#227 Boundaries can be styled via
This commit is contained in:
@@ -48,6 +48,8 @@ rectangle C4VersionDetailsArea <<legendArea>> [
|
||||
!global $LEGEND_DOTTED_LINE = "(dotted) "
|
||||
!global $LEGEND_DASHED_LINE = "(dashed) "
|
||||
!global $LEGEND_BOLD_LINE = "(bold) "
|
||||
!global $LEGEND_DASHED_BOUNDARY = "boundary (dashed) "
|
||||
!global $LEGEND_DASHED_TRANSPARENT_BOUNDARY = "boundary (dashed, transparent) "
|
||||
|
||||
!global $SKETCH_FOOTER_WARNING = "Warning:"
|
||||
!global $SKETCH_FOOTER_TEXT = "Created for discussion, needs to be validated"
|
||||
@@ -115,6 +117,14 @@ skinparam person {
|
||||
}
|
||||
|
||||
' Some boundary skinparams have to be set as package skinparams too (PlantUML uses internal packages)
|
||||
' UpdateBoundaryStyle() called in boundary section below
|
||||
skinparam rectangle<<boundary>> {
|
||||
Shadowing false
|
||||
StereotypeFontSize 6
|
||||
StereotypeFontColor $BOUNDARY_BG_COLOR
|
||||
BorderStyle dashed
|
||||
}
|
||||
|
||||
skinparam package {
|
||||
StereotypeFontSize 6
|
||||
StereotypeFontColor $BOUNDARY_BG_COLOR
|
||||
@@ -122,16 +132,6 @@ skinparam package {
|
||||
BackgroundColor $BOUNDARY_BG_COLOR
|
||||
}
|
||||
|
||||
skinparam rectangle<<boundary>> {
|
||||
Shadowing false
|
||||
StereotypeFontSize 6
|
||||
StereotypeFontColor $BOUNDARY_BG_COLOR
|
||||
FontColor $BOUNDARY_COLOR
|
||||
BorderColor $BOUNDARY_COLOR
|
||||
BackgroundColor $BOUNDARY_BG_COLOR
|
||||
BorderStyle dashed
|
||||
}
|
||||
|
||||
' Legend and Tags
|
||||
' ##################################
|
||||
!global $tagDefaultLegend = ""
|
||||
@@ -265,7 +265,7 @@ skinparam rectangle<<boundary>> {
|
||||
!function $elementTagSkinparams($element, $tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape)
|
||||
!$elementSkin = "skinparam " + $element + "<<" + $tagStereo + ">> {" + %newline()
|
||||
!if ($fontColor != "")
|
||||
!if ($tagStereo != "boundary")
|
||||
!if (%strpos($tagStereo, "boundary") < 0)
|
||||
!$elementSkin = $elementSkin + " StereotypeFontColor " + $fontColor + %newline()
|
||||
!endif
|
||||
!$elementSkin = $elementSkin + " FontColor " + $fontColor + %newline()
|
||||
@@ -304,9 +304,9 @@ skinparam rectangle<<boundary>> {
|
||||
' 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 != "")
|
||||
!$tagSkin = $tagSkin + "skinparam package<<boundary>>StereotypeFontColor " + $bgColor + %newline()
|
||||
!$tagSkin = $tagSkin + "skinparam rectangle<<boundary>>StereotypeFontColor " + $bgColor + %newline()
|
||||
!if (%strpos($tagStereo, "boundary") >= 0 && $bgColor != "")
|
||||
!$tagSkin = $tagSkin + "skinparam package<<" + $tagStereo + ">>StereotypeFontColor " + $bgColor + %newline()
|
||||
!$tagSkin = $tagSkin + "skinparam rectangle<<" + $tagStereo + ">>StereotypeFontColor " + $bgColor + %newline()
|
||||
!endif
|
||||
$tagSkin
|
||||
!endprocedure
|
||||
@@ -499,7 +499,26 @@ $elementSkin
|
||||
!$tagEntry = $tagEntry + $getSprite($legendSprite) + " "
|
||||
!endif
|
||||
!if ($legendText == "")
|
||||
!$tagEntry = $tagEntry + " " + $tagStereo + " "
|
||||
!if ($tagStereo == "boundary")
|
||||
!if ($bgColor == "#00000000" || %lower($bgColor) == "transparent")
|
||||
!$tagEntry = $tagEntry + " " + $LEGEND_DASHED_TRANSPARENT_BOUNDARY
|
||||
!else
|
||||
!$tagEntry = $tagEntry + " " + $LEGEND_DASHED_BOUNDARY
|
||||
!endif
|
||||
!elseif (%strpos($tagStereo, "boundary") >= 0)
|
||||
' if contains/ends with _boundary remove _boundary and add "boundary (dashed)"
|
||||
!$pos = %strpos($tagStereo, "_boundary")
|
||||
!if ($pos > 0)
|
||||
!$tagEntry = $tagEntry + " " + %substr($tagStereo, 0 ,$pos)
|
||||
!if ($bgColor == "#00000000" || %lower($bgColor) == "transparent")
|
||||
!$tagEntry = $tagEntry + " " + $LEGEND_DASHED_TRANSPARENT_BOUNDARY
|
||||
!else
|
||||
!$tagEntry = $tagEntry + " " + $LEGEND_DASHED_BOUNDARY
|
||||
!endif
|
||||
!endif
|
||||
!else
|
||||
!$tagEntry = $tagEntry + " " + $tagStereo + " "
|
||||
!endif
|
||||
!if ($shadowing == "true")
|
||||
!$tagEntry = $tagEntry + $LEGEND_SHADOW_TEXT
|
||||
!endif
|
||||
@@ -1032,6 +1051,43 @@ $getLegendArea($alias, $hideStereotype)
|
||||
' Boundaries
|
||||
' ##################################
|
||||
|
||||
!unquoted procedure UpdateBoundaryStyle($elementName="", $bgColor="", $fontColor="", $borderColor="", $shadowing="", $shape="", $type="", $legendText="")
|
||||
!if ($elementName != "")
|
||||
!$elementBoundary = $elementName + '_boundary'
|
||||
UpdateElementStyle($elementBoundary, $bgColor, $fontColor, $borderColor, $shadowing, $shape, "", $type, $legendText, "")
|
||||
!else
|
||||
UpdateElementStyle("boundary", $bgColor, $fontColor, $borderColor, $shadowing, $shape, "", $type, $legendText, "")
|
||||
' simulate color inheritance
|
||||
UpdateBoundaryStyle("enterprise", $bgColor, $fontColor, $borderColor, $shadowing, $shape, "Enterprise", "")
|
||||
UpdateBoundaryStyle("system", $bgColor, $fontColor, $borderColor, $shadowing, $shape, "System", "")
|
||||
UpdateBoundaryStyle("container", $bgColor, $fontColor, $borderColor, $shadowing, $shape, "Container", "")
|
||||
!endif
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure AddBoundaryTag($tagStereo, $bgColor="", $fontColor="", $borderColor="", $shadowing="", $shape="", $type="", $legendText="")
|
||||
!$tagBoundary = $tagStereo + '_boundary'
|
||||
AddElementTag($tagBoundary, $bgColor, $fontColor, $borderColor, $shadowing, $shape, "", $type, $legendText, "")
|
||||
!endprocedure
|
||||
|
||||
' add _boundary to all tags that short tag version can be used
|
||||
!unquoted function $addBoundaryPostfix($tags)
|
||||
!if (%strlen($tags) == 0)
|
||||
!return ''
|
||||
!endif
|
||||
!$boundaryTags = ''
|
||||
!$brPos = %strpos($tags, "+")
|
||||
!while ($brPos >= 0)
|
||||
!$tag = %substr($tags, 0, $brPos)
|
||||
!$boundaryTags = $boundaryTags + $tag + '_boundary+'
|
||||
!$tags = %substr($tags, $brPos+1)
|
||||
!$brPos = %strpos($tags, "+")
|
||||
!endwhile
|
||||
!if (%strlen($tags) > 0)
|
||||
!$boundaryTags = $boundaryTags + $tags + '_boundary'
|
||||
!endif
|
||||
!return $boundaryTags
|
||||
!endfunction
|
||||
|
||||
!function $getBoundary($label, $type)
|
||||
!if ($type == "")
|
||||
!return '==' + $label
|
||||
@@ -1042,9 +1098,15 @@ $getLegendArea($alias, $hideStereotype)
|
||||
!endfunction
|
||||
|
||||
!unquoted procedure Boundary($alias, $label, $type="", $tags="", $link="")
|
||||
rectangle "$getBoundary($label, $type)" $toStereos("boundary", $tags) as $alias $getLink($link)
|
||||
!$boundaryTags = $addBoundaryPostfix($tags)
|
||||
' nodes $type reuses $techn definition of $boundaryTags
|
||||
!$type=$toElementArg($type, $boundaryTags, "ElementTagTechn", "boundary")
|
||||
rectangle "$getBoundary($label, $type)" $toStereos("boundary", $boundaryTags) as $alias $getLink($link)
|
||||
!endprocedure
|
||||
|
||||
' Boundary Styling
|
||||
UpdateBoundaryStyle("", $bgColor=$BOUNDARY_BG_COLOR, $fontColor=$BOUNDARY_COLOR, $borderColor=$BOUNDARY_COLOR)
|
||||
|
||||
' Relationship
|
||||
' ##################################
|
||||
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ UpdateElementStyle("external_component", $EXTERNAL_COMPONENT_BG_COLOR, $COMPONEN
|
||||
' Layout
|
||||
' ##################################
|
||||
|
||||
SetDefaultLegendEntries("person\nsystem\ncontainer\ncomponent\nexternal_person\nexternal_system\nexternal_container\nexternal_component")
|
||||
SetDefaultLegendEntries("person\nsystem\ncontainer\ncomponent\nexternal_person\nexternal_system\nexternal_container\nexternal_component\nenterprise_boundary\nsystem_boundary\ncontainer_boundary\nboundary")
|
||||
|
||||
!procedure LAYOUT_WITH_LEGEND()
|
||||
hide stereotype
|
||||
|
||||
+14
-2
@@ -23,6 +23,8 @@
|
||||
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)
|
||||
|
||||
UpdateBoundaryStyle("container", $bgColor=$BOUNDARY_BG_COLOR, $fontColor=$BOUNDARY_COLOR, $borderColor=$BOUNDARY_COLOR, $type="Container")
|
||||
|
||||
' 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)
|
||||
@@ -31,10 +33,14 @@ UpdateElementStyle("external_container", $EXTERNAL_CONTAINER_BG_COLOR, $ELEMENT_
|
||||
AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, $techn, $legendText, $legendSprite)
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure UpdateContainerBoundaryStyle($bgColor=$BOUNDARY_BG_COLOR, $fontColor=$BOUNDARY_COLOR, $borderColor=$BOUNDARY_COLOR, $shadowing="", $shape="", $type="Container", $legendText="")
|
||||
UpdateBoundaryStyle("container", $bgColor, $fontColor, $borderColor, $shadowing, $shape, $type, $legendText)
|
||||
!endprocedure
|
||||
|
||||
' Layout
|
||||
' ##################################
|
||||
|
||||
SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_system\nexternal_container")
|
||||
SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_system\nexternal_container\nenterprise_boundary\nsystem_boundary\ncontainer_boundary\nboundary")
|
||||
|
||||
!procedure LAYOUT_WITH_LEGEND()
|
||||
hide stereotype
|
||||
@@ -107,5 +113,11 @@ queue "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("ex
|
||||
' ##################################
|
||||
|
||||
!unquoted procedure Container_Boundary($alias, $label, $tags="", $link="")
|
||||
Boundary($alias, $label, "Container", $tags, $link)
|
||||
!if ($tags != "")
|
||||
!$allTags = $tags + '+container'
|
||||
!else
|
||||
!$allTags = 'container'
|
||||
!endif
|
||||
' $type defined via $tag style
|
||||
Boundary($alias, $label, "", $allTags, $link)
|
||||
!endprocedure
|
||||
|
||||
+25
-3
@@ -30,6 +30,9 @@ 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)
|
||||
|
||||
UpdateBoundaryStyle("enterprise", $bgColor=$BOUNDARY_BG_COLOR, $fontColor=$BOUNDARY_COLOR, $borderColor=$BOUNDARY_COLOR, $type="Enterprise")
|
||||
UpdateBoundaryStyle("system", $bgColor=$BOUNDARY_BG_COLOR, $fontColor=$BOUNDARY_COLOR, $borderColor=$BOUNDARY_COLOR, $type="System")
|
||||
|
||||
' 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)
|
||||
@@ -44,6 +47,13 @@ UpdateElementStyle("external_system", $EXTERNAL_SYSTEM_BG_COLOR, $ELEMENT_FONT_C
|
||||
AddElementTag($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $shape, $sprite, "", $legendText, $legendSprite)
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure UpdateEnterpriseBoundaryStyle($bgColor=$BOUNDARY_BG_COLOR, $fontColor=$BOUNDARY_COLOR, $borderColor=$BOUNDARY_COLOR, $shadowing="", $shape="", $type="Enterprise", $legendText="")
|
||||
UpdateBoundaryStyle("enterprise", $bgColor, $fontColor, $borderColor, $shadowing, $shape, $type, $legendText)
|
||||
!endprocedure
|
||||
!unquoted procedure UpdateSystemBoundaryStyle($bgColor=$BOUNDARY_BG_COLOR, $fontColor=$BOUNDARY_COLOR, $borderColor=$BOUNDARY_COLOR, $shadowing="", $shape="", $type="System", $legendText="")
|
||||
UpdateBoundaryStyle("system", $bgColor, $fontColor, $borderColor, $shadowing, $shape, $type, $legendText)
|
||||
!endprocedure
|
||||
|
||||
' Sprites
|
||||
' ##################################
|
||||
|
||||
@@ -152,7 +162,7 @@ sprite $person2 [48x48/16] {
|
||||
' Layout
|
||||
' ##################################
|
||||
|
||||
SetDefaultLegendEntries("person\nsystem\nexternal_person\nexternal_system")
|
||||
SetDefaultLegendEntries("person\nsystem\nexternal_person\nexternal_system\nenterprise_boundary\nsystem_boundary\nboundary")
|
||||
|
||||
!procedure LAYOUT_WITH_LEGEND()
|
||||
hide stereotype
|
||||
@@ -284,9 +294,21 @@ queue "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("external_syst
|
||||
' ##################################
|
||||
|
||||
!unquoted procedure Enterprise_Boundary($alias, $label, $tags="", $link="")
|
||||
Boundary($alias, $label, "Enterprise", $tags, $link)
|
||||
!if ($tags != "")
|
||||
!$allTags = $tags + '+enterprise'
|
||||
!else
|
||||
!$allTags = 'enterprise'
|
||||
!endif
|
||||
' $type defined via $tag style
|
||||
Boundary($alias, $label, "", $allTags, $link)
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure System_Boundary($alias, $label, $tags="", $link="")
|
||||
Boundary($alias, $label, "System", $tags, $link)
|
||||
!if ($tags != "")
|
||||
!$allTags = $tags + '+system'
|
||||
!else
|
||||
!$allTags = 'system'
|
||||
!endif
|
||||
' $type defined via $tag style
|
||||
Boundary($alias, $label, "", $allTags, $link)
|
||||
!endprocedure
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ skinparam rectangle<<node>> {
|
||||
' ##################################
|
||||
|
||||
' comment if node should not be added to legend. No calculated legend extension required
|
||||
SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_system\nexternal_container\nnode")
|
||||
SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_system\nexternal_container\nnode\nenterprise_boundary\nsystem_boundary\ncontainer_boundary\nboundary")
|
||||
|
||||
' Line breaks
|
||||
' ##################################
|
||||
|
||||
@@ -462,10 +462,15 @@ Additional tags/stereotypes can be added to the existing element stereotypes (co
|
||||
Introduces a new element tag. The styles of the tagged elements are updated and the tag is displayed in the calculated legend.
|
||||
* `AddRelTag(tagStereo, ?textColor, ?lineColor, ?lineStyle, ?sprite, ?techn, ?legendText, ?legendSprite)`:
|
||||
Introduces a new Relationship tag. The styles of the tagged relationships are updated and the tag is displayed in the calculated legend.
|
||||
* `AddBoundaryTag(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?type, ?legendText)`:
|
||||
Introduces a new Boundary tag. The styles of the tagged boundaries are updated and the tag is displayed in the calculated legend.
|
||||
* `UpdateElementStyle(elementName, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?techn, ?legendText, ?legendSprite)`:
|
||||
This call updates the default style of the elements (component, ...) and creates no additional legend entry.
|
||||
* `UpdateRelStyle(textColor, lineColor)`:
|
||||
This call updates the default relationship colors and creates no additional legend entry.
|
||||
* `UpdateBoundaryStyle(?elementName, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?type, ?legendText)
|
||||
This call updates the default style of the existing boundaries and creates no additional legend entry.
|
||||
If the element name is "" then it updates generic, enterprise, system and container boundary style in on call.
|
||||
* `RoundedBoxShape()`: This call returns the name of the rounded box shape and can be used as ?shape argument.
|
||||
* `EightSidedShape()`: This call returns the name of the eight sided shape and can be used as ?shape argument.
|
||||
* `DashedLine()`: This call returns the name of the dashed line and can be used as ?lineStyle argument.
|
||||
@@ -498,6 +503,13 @@ Following calls introduces new element tags with element specific default colors
|
||||
* `AddNodeTag(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?techn, ?legendText, ?legendSprite)`
|
||||
(node specific: $type reuses $techn definition of $tags)
|
||||
|
||||
**Boundary specific tag definitions**
|
||||
|
||||
Like the element specific tag definitions exist boundary specific calls with their default colors **and type**:
|
||||
* `UpdateContainerBoundaryStyle(?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?type, ?legendText)`
|
||||
* `UpdateSystemBoundaryStyle(?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?type, ?legendText)`
|
||||
* `UpdateEnterpriseBoundaryStyle(?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?type, ?legendText)`
|
||||
|
||||
**Comments**
|
||||
|
||||
* `SHOW_LEGEND()` supports the customized stereotypes
|
||||
@@ -616,6 +628,55 @@ SHOW_LEGEND()
|
||||
|
||||

|
||||
|
||||
**Sample with different boundary tag combinations**
|
||||
|
||||
```plantuml
|
||||
@startuml
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml
|
||||
|
||||
' Update the generic boundary style and the "system", "enterprise", "container" boundaries styles too
|
||||
UpdateBoundaryStyle($bgColor="gold", $fontColor="brown", $borderColor="brown")
|
||||
' (Re-)Updates the system boundary styles; re-set $bgColor avoids '(no back color)' in legend too
|
||||
UpdateSystemBoundaryStyle($bgColor="gold", $fontColor="white", $borderColor="white")
|
||||
|
||||
Boundary(b, "A Boundary") {
|
||||
}
|
||||
|
||||
Container_Boundary(cb, "A Container Boundary") {
|
||||
}
|
||||
|
||||
System_Boundary(sb, "A System Boundary") {
|
||||
}
|
||||
|
||||
' defines a new border style incl. new border type
|
||||
AddBoundaryTag("repository", $bgColor="green", $fontColor="white", $borderColor="white", $shadowing="true", $shape = RoundedBoxShape(), $type="GitHub repository")
|
||||
|
||||
Boundary(c4Respository, "plantuml-stdlib/C4-PlantUML", $tags="repository") {
|
||||
Component(readMe, "README.md", "Markdown")
|
||||
}
|
||||
|
||||
' boundary tags are internally extended with '_boundary' that it uses a different name space
|
||||
' this enables different element and boundary styles for the same tag name
|
||||
AddBoundaryTag("v1", $bgColor="lightgreen", $fontColor="green", $borderColor="green")
|
||||
AddElementTag("v1", $bgColor="lightred", $fontColor="red", $borderColor="red")
|
||||
|
||||
Boundary(anotherBoundary, "Another Boundary", $type="BOUNDARY TYPE", $tags="v1") {
|
||||
Component(anotherComponent, "Another Component", $techn="COMPONENT TYPE", $tags="v1", $descr="Component and boundary use different tag name spaces that both v1 tags can use different styles")
|
||||
}
|
||||
|
||||
Lay_R(b, cb)
|
||||
Lay_R(cb, sb)
|
||||
|
||||
Lay_D(b, c4Respository)
|
||||
|
||||
Lay_R(c4Respository, anotherBoundary)
|
||||
|
||||
SHOW_LEGEND()
|
||||
@enduml
|
||||
```
|
||||
|
||||

|
||||
|
||||
**Custom schema definition**
|
||||
|
||||
If the custom (color) schema is defined via `UpdateElementStyle()` then the legend of existing elements is updated too.
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
@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/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml
|
||||
!endif
|
||||
|
||||
UpdateBoundaryStyle($bgColor="gold", $fontColor="brown", $borderColor="brown")
|
||||
' re-set $bgColor avoids '(no back color)' in legend
|
||||
UpdateSystemBoundaryStyle($bgColor="gold", $fontColor="white", $borderColor="white")
|
||||
|
||||
AddBoundaryTag("specialSystem", $bgColor="green", $fontColor="white", $borderColor="blue", $shadowing="true", $shape = RoundedBoxShape(), $type="A SPECIAL SYSTEM BOUNDARY")
|
||||
AddBoundaryTag("existingContainersBoundary", $bgColor="red", $fontColor="white", $borderColor="white", $type="Existing CONTAINER BOUNDARY", $legendText="container boundary with existing components")
|
||||
|
||||
System_Boundary(sb, "A System Boundary") {
|
||||
}
|
||||
|
||||
System_Boundary(sb1, "Special System 1 Boundary", $tags="specialSystem") {
|
||||
Container_Boundary(cb1, "Container Boundary\nwith tag", $tags="existingContainersBoundary") {
|
||||
Component(e1, "existing 1", "xyz")
|
||||
Component(e2, "existing 2", "xyz")
|
||||
}
|
||||
Container_Boundary(cb2, "A Container Boundary") {
|
||||
Component(c2, "Component", "xyz")
|
||||
}
|
||||
}
|
||||
|
||||
System_Boundary(sb2, "Special System 2 Boundary", $tags="specialSystem") {
|
||||
}
|
||||
|
||||
' boundary tags are internally extended with '_boundary' that it uses a different name space
|
||||
' this enables different element and boundary styles for the same tag name
|
||||
AddBoundaryTag("v1", $bgColor="lightgreen", $fontColor="green", $borderColor="green")
|
||||
AddElementTag("v1", $bgColor="lightred", $fontColor="red", $borderColor="red")
|
||||
|
||||
Boundary(anotherBoundary, "Another Boundary", $type="BOUNDARY TYPE", $tags="v1") {
|
||||
Component(anotherComponent, "Another Component", $techn="COMPONENT TYPE", $tags="v1", $descr="Component and boundary use different tag name spaces that both v1 tags can use different styles")
|
||||
}
|
||||
|
||||
Boundary(aBoundary, "A Boundary") {
|
||||
}
|
||||
|
||||
Lay_R(sb, sb1)
|
||||
Lay_R(sb1, sb2)
|
||||
Lay_R(sb2, anotherBoundary)
|
||||
|
||||
SHOW_LEGEND()
|
||||
@enduml
|
||||
Reference in New Issue
Block a user