diff --git a/C4_Context.puml b/C4_Context.puml index 1817311..1259c67 100644 --- a/C4_Context.puml +++ b/C4_Context.puml @@ -46,6 +46,9 @@ skinparam rectangle<> { BorderColor #8A8A8A } +' Sprites +' ################################## + sprite $person [48x48/16] { 000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000 @@ -97,6 +100,57 @@ sprite $person [48x48/16] { 000000000000000000000000000000000000000000000000 } +sprite $person2 [48x48/16] { +0000000000000000000049BCCA7200000000000000000000 +0000000000000000006EFFFFFFFFB3000000000000000000 +00000000000000001CFFFFFFFFFFFF700000000000000000 +0000000000000001EFFFFFFFFFFFFFF80000000000000000 +000000000000000CFFFFFFFFFFFFFFFF6000000000000000 +000000000000007FFFFFFFFFFFFFFFFFF100000000000000 +00000000000001FFFFFFFFFFFFFFFFFFF900000000000000 +00000000000006FFFFFFFFFFFFFFFFFFFF00000000000000 +0000000000000BFFFFFFFFFFFFFFFFFFFF40000000000000 +0000000000000EFFFFFFFFFFFFFFFFFFFF70000000000000 +0000000000000FFFFFFFFFFFFFFFFFFFFF80000000000000 +0000000000000FFFFFFFFFFFFFFFFFFFFF80000000000000 +0000000000000DFFFFFFFFFFFFFFFFFFFF60000000000000 +0000000000000AFFFFFFFFFFFFFFFFFFFF40000000000000 +00000000000006FFFFFFFFFFFFFFFFFFFE00000000000000 +00000000000000EFFFFFFFFFFFFFFFFFF800000000000000 +000000000000007FFFFFFFFFFFFFFFFFF100000000000000 +000000000000000BFFFFFFFFFFFFFFFF5000000000000000 +0000000000000001DFFFFFFFFFFFFFF70000000000000000 +00000000000000000BFFFFFFFFFFFF500000000000000000 +0000000000000000005DFFFFFFFFA1000000000000000000 +0000000000000000000037ABB96100000000000000000000 +000000000002578888300000000005888864100000000000 +0000000007DFFFFFFFFD9643347BFFFFFFFFFB4000000000 +00000004EFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB10000000 +0000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD2000000 +000006FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE100000 +00003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB00000 +0000BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF50000 +0003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD0000 +0009FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2000 +000DFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6000 +000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000 +001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB000 +001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB000 +001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB000 +001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA000 +000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000 +000DFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6000 +0009FFFFFFFF8FFFFFFFFFFFFFFFFFFFFFF8FFFFFFFF2000 +0003FFFFFFFF8FFFFFFFFFFFFFFFFFFFFFF8FFFFFFFD0000 +0000BFFFFFFF8FFFFFFFFFFFFFFFFFFFFFF8FFFFFFF50000 +00003FFFFFFF8FFFFFFFFFFFFFFFFFFFFFF8FFFFFFB00000 +000006FFFFFF8FFFFFFFFFFFFFFFFFFFFFF8FFFFFE100000 +0000007FFFFF8FFFFFFFFFFFFFFFFFFFFFF8FFFFD2000000 +00000004EFFF8FFFFFFFFFFFFFFFFFFFFFF8FFFB10000000 +0000000007DF8FFFFFFFFFFFFFFFFFFFFFF8FB4000000000 +000000000002578888888888888888888864100000000000 +} + ' Layout ' ################################## @@ -111,21 +165,38 @@ legend right endlegend !endprocedure +!global $defaultPersonSprite = "person" + +!procedure HIDE_PERSON_SPRITE() + !$defaultPersonSprite = "" +!endprocedure + +!unquoted procedure SHOW_PERSON_SPRITE($sprite="") + !if ($sprite == "") + !$defaultPersonSprite = "person" + !else + !$defaultPersonSprite = $sprite + !endif +!endprocedure + ' Elements ' ################################## !function $getPerson($label, $descr, $sprite) +!if ($sprite == "") && ($defaultPersonSprite!="") + !$sprite = $defaultPersonSprite +!endif !if ($descr == "") && ($sprite == "") -!return '<$person>\n=='+$label + !return '=='+$label !endif !if ($descr == "") && ($sprite != "") -!return '<$'+$sprite+'>\n=='+$label + !return '<$'+$sprite+'>\n=='+$label !endif !if ($descr != "") && ($sprite == "") -!return '<$person>\n=='+$label+'\n\n '+$descr + !return '=='+$label+'\n\n '+$descr !endif !if ($descr != "") && ($sprite != "") -!return '<$'+$sprite+'>\n=='+$label+'\n\n '+$descr + !return '<$'+$sprite+'>\n=='+$label+'\n\n '+$descr !endif !endfunction diff --git a/LayoutOptions.md b/LayoutOptions.md index 5174d96..a48d4f0 100644 --- a/LayoutOptions.md +++ b/LayoutOptions.md @@ -89,7 +89,7 @@ One thing which is often ignored is the fact, that these software architecture s Without any proof * if they are technically possible -* if they can fullfil all requirements +* if they can fulfill all requirements * if they keep what they promise More often these sketches are used by many people as facts and are manifested into their documentations. @@ -140,3 +140,92 @@ Rel(web_app, twitter, "Gets tweets from", "HTTPS") ![HIDE_STEREOTYPE Sample](http://www.plantuml.com/plantuml/png/NL1DJ-j03Bplh_3hEpIL-XBrYHEdXX1H90fHau8uHTl4a1NxiTfr52h4VsUZbXPnikmPpuozzCGTzKh2wlOwhyigt-GFrNEHGycLbSZ-2Dt8laNeYAo_J1B7X_XLKDVlUe-kCPfGKzmObRm9rtIUkYIx-5T8hccxlalmFU0jjc5OPu7CXKONs-38s2_BQCPOWSuR7V5M2Js7IJfMuSbnCcuoO-NU4whwolIwvMuVDOivJ0z9fpFuO0009vTem5tDhGqwJxY3r5ef6ax2w4aOPN_da9P5V9zNOSKX_8yNi7xCHYoLqWmUnWCza876ACi3HVMIX9K8rI28q049XL9ez27Rvp5TH0Smw1nf0MGRbDzNdMDjFVhHRrLLHHbO8-c4dcLka7neSImlpgYVAylmtV6PNm00 "HIDE_STEREOTYPE Sample") +## HIDE_PERSON_SPRITE() or SHOW_PERSON_SPRITE($sprite="") + +With the macros `HIDE_PERSON_SPRITE()` and `SHOW_PERSON_SPRITE()` it is possible to change the person related default sprite. `SHOW_PERSON_SPRITE()` is the default. + +- **HIDE_PERSON_SPRITE()**: deactivates the default sprite +- **SHOW_PERSON_SPRITE()**: activates the default sprite "person" +- **SHOW_PERSON_SPRITE($sprite)**: activates a specific sprite as default sprite + +"person" and "person2" are predefined sprites which can be used as default sprite too. + +```csharp +@startuml predefined sprites Sample +!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml + +Person(userA, "User A", "with predefined sprite person", "person") +Person(userB, "User B", "with predefined sprite person2", "person2") +@enduml +``` + +![Predefined sprites Sample](http://www.plantuml.com/plantuml/png/XOxDIiKm48NtUOfuLrxmDY2kNFLdgr2GhYLjHXj89c5cGb_VH2m8BbpDOVZupkbPB4c9GMS21nyUmMdEv0LOlzcO0wWxZrie3lGkaldP6B97z-bbBsjXe2sX04gtfMXoiDXiDnON_6gcfzlSNilhYucM1QY-tgU4OciJTRcoIir0dF2-oOO7VLdgrSEbfgEM_1scypVVW9zq_QqOJyNuh-An4MUygXxGrK5V "Predefined sprites Sample") + + +**Using HIDE_PERSON_SPRITE()** + +```csharp +@startuml HIDE_PERSON_SPRITE Sample +!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml + +HIDE_PERSON_SPRITE() + +Person(admin, "Administrator") +System_Boundary(c1, 'Sample') { + Container(web_app, "Web Application", "C#, ASP.NET Core 2.1 MVC", "Allows users to compare multiple Twitter timelines") +} +System(twitter, "Twitter") + +Rel(admin, web_app, "Uses", "HTTPS") +Rel(web_app, twitter, "Gets tweets from", "HTTPS") +@enduml +``` + +![HIDE_PERSON_SPRITE Sample](http://www.plantuml.com/plantuml/png/PL1TgzD047tVNp7MXvj2Ry8LdtowCGPRi3KqgJw6JJBQXVrOTYU48lvtPsbj1VCoPCwPyx6laMIWsMZOxZxLVLCVsw-7lcsEkww6LXglKRnHTjJpX70cyl53KGIvv3yLdUTXZXX6PmajvQCpXTVI9hNdI9DMGr6zVsxIwhJ_KXWP2GEl-eelfB8OSizS8VwtpjP2D1YYivcSZB8RM9LfgaX1aWkhjMWlaT3q7zri9naksVYoWQThugSr_1B0tzqeMt3efVUiynq7ABtNQfIad5tngdgxWR9jyaFTyKb0U9U_mFvRbR1IQxT4I4KZa0DkwILJpAn9iHTqYoB20AGCQlQAdEttBLr6Lv1rRZG6nH7rtrQFMAU8CVbjkwvfcPL8T_GXynafyY-cyICuy-_9AzeflUSV "HIDE_PERSON_SPRITE Sample") + +**Using SHOW_PERSON_SPRITE()** + +```csharp +@startuml SHOW_PERSON_SPRITE Sample +!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml + +/' Not needed because this is the default with sprite "person" '/ +SHOW_PERSON_SPRITE() + +Person(admin, "Administrator") +System_Boundary(c1, 'Sample') { + Container(web_app, "Web Application", "C#, ASP.NET Core 2.1 MVC", "Allows users to compare multiple Twitter timelines") +} +System(twitter, "Twitter") + +Rel(admin, web_app, "Uses", "HTTPS") +Rel(web_app, twitter, "Gets tweets from", "HTTPS") +@enduml +``` + +![SHOW_PERSON_SPRITE Sample](http://www.plantuml.com/plantuml/png/PL5DQzmm4BthLqpTWxsmiKdfgQUuPcaApSQidUPeP6lI5UX3I6DCAFtl7JLfjb1V1i-yz-QzqKqY6Mcr1eRR-yUfFvo6--CqzAUlum46QOD1yKwxnQmAuKmKqgUcYNAhVsWwh_EQC2xU4Jgg5s-ROAJBQbU9bD5pqtsywdFhuUvROsKYZDoQEcP8xJ3MWR52D2KSFO53LAXWnaMoBj1P9z29AuB29xaQWestGWfH4q8HC2Rl2YWRyR_vQYT4_mTGIMMrsqFHvgeJHKa-5ZinFBCXEttsgrCoFbVBzHxAbypb3duAuE_DQhNXFCaGMESHPsX3C7gHfDa0jxhtUsY7lZuUHgP4X0_rDTnzx_AiDSPl2VAf4f07lbEG3B4SIFCk63aLOGJI5WtlIkpjrwkxYbw6hFCAuw4ueVcRwcBh8J6Jw-quzWEZCkXjUf7vWfJu5tDvYjx-Ixb1f_AB_0O0 "SHOW_PERSON_SPRITE Sample") + +**Using SHOW_PERSON_SPRITE(sprite)** + +```csharp +@startuml SHOW_PERSON_SPRITE(sprite) Sample +!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml +!define osaPuml https://raw.githubusercontent.com/Crashedmind/PlantUML-opensecurityarchitecture2-icons/master +!include osaPuml/Common.puml +!include osaPuml/User/all.puml + +SHOW_PERSON_SPRITE("osa_user_green_architect") + +Person(admin, "Administrator") +System_Boundary(c1, 'Sample') { + Container(web_app, "Web Application", "C#, ASP.NET Core 2.1 MVC", "Allows users to compare multiple Twitter timelines") +} +System(twitter, "Twitter") + +Rel(admin, web_app, "Uses", "HTTPS") +Rel(web_app, twitter, "Gets tweets from", "HTTPS") +@enduml +``` + +![SHOW_PERSON_SPRITE(sprite) Sample](http://www.plantuml.com/plantuml/png/ZL1DQzj04BthLspSGsIm9H9wwYckC4sXIOIbD4UnbYRnmduiCoDKK_hVEuiLkvGUgelOUM_UU_FkY3NowAngxfzUkdgxQvuUkwRUVMstEKKq34lLQ1SjP5V6ztOSG1sO8tqgIzHJyMRuCEv70ko3P_1SzC6LqMgVLDV4WpNxilguhjFe-U5RwJGne8owActyu28ACxiQuDLuK85qBU__CAbGqm46P_nGlgklGmHFq8-I_AYnFnY6daU4sxMHNPhTBxVCTcKLd0j-Zl8t-4mIM5jxWhD_LBKGQfS2Tcy8uBkpzMAPPJKW1P_h57Mb5flqDyIeEQ3WpP4ONFSvZ7xGUCpxcvMwFdL-lLG_CoLVgaeR3vXFiEzqZABp0dkrYT6QNhC9VY6ZwiDARPgwUDosieAWReiRzV2zIjZ6sZ2HIY59SL1IOTH2SQDb8rwgdGmpe6BZm8eNIRPVSxgSJw3epBHqs0xi-rMNM58M9R_xjgqROINI6Rt8V04cUKBwlM9mVwxSWHzIqxy1 "SHOW_PERSON_SPRITE(sprite)") + diff --git a/README.md b/README.md index c0c4ab3..6498526 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ At the top of your C4 PlantUML `.puml` file, you need to include the `C4_Context To be independent of any internet connectivity, you can also download the files found in the `root` and reference it locally with -```c# +```csharp !include path/to/C4.puml !include path/to/C4_Context.puml !include path/to/C4_Container.puml @@ -40,7 +40,7 @@ Just remember to change the `!include` statements at the top of the files. If you want to use the always up-to-date version in this repo, use the following: -```c# +```csharp !include https://raw.githubusercontent.com/kirchsth/C4-PlantUML/extended/C4_Container.puml ``` @@ -85,7 +85,7 @@ Rel(web_app, twitter, "Gets tweets from", "HTTPS") Entities can also be decorated with icons using the last parameter, for example: -```cs +```csharp @startuml !include https://raw.githubusercontent.com/kirchsth/C4-PlantUML/extended/C4_Container.puml @@ -180,13 +180,18 @@ In rare cases, you can force the layout using hidden relationships, `Lay_U`, `La ## Layout Options -C4-PlantUML also comes with some layout options to make it easy and reuseable to create nice and useful diagrams: +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()](LayoutOptions.md#layout_with_legend) * [LAYOUT_AS_SKETCH()](LayoutOptions.md#layout_as_sketch) * [HIDE_STEREOTYPE()](LayoutOptions.md#hide_stereotype) +C4-PlantUML also comes with some default person sprite options: + +* [HIDE_PERSON_SPRITE()](LayoutOptions.md#hide_person_sprite) +* [SHOW_PERSON_SPRITE_ACTIVE()](LayoutOptions.md#show_person_sprite) + ## Snippets for Visual Studio Code Because the PlantUML support inside of Visual Studio Code is excellent with the [PlantUML extension](https://marketplace.visualstudio.com/items?itemName=jebbs.plantuml), you can also find VS Code snippets for C4-PlantUML at [.vscode/C4.code-snippets](.vscode/C4.code-snippets).