From 28ed8918eaf62969f507fc678b4ac31f195bf257 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Mon, 14 Oct 2024 23:45:19 +0200 Subject: more class diagram --- docs/class-diag.puml | 145 ++++++++++++++++++++++++++++++++++----------------- docs/style.ipuml | 4 +- 2 files changed, 98 insertions(+), 51 deletions(-) diff --git a/docs/class-diag.puml b/docs/class-diag.puml index 34c9506..a686394 100644 --- a/docs/class-diag.puml +++ b/docs/class-diag.puml @@ -48,7 +48,6 @@ rectangle Group_FileReading as "File reading" <> { HTTPFile --> CPR.Response CPR.Response - CPR.Url } - rectangle Group_ParsingDeserialization as "Parsing & deserialization" <> { class Parser { + parse(File, Deserializer) <> @@ -122,74 +121,76 @@ rectangle Group_Model as "Model" <> { + rows : unsigned int + columns : unsigned int } - rectangle Group_Tile_Appearance as "Tile appearance" <> { - struct Color { - red : unsigned int - green : unsigned int - blue : unsigned int - } - class TileAppearance { - + get_color(string) : Color <> - + register_color(string, Color) <> - } - Tile --> Color + Museum --> People + Museum --> Canvas - Color <.. TileAppearance - } - rectangle Group_Tile_Behavior as "Tile behavior" <> { - interface TileBehaviorStrategy + Canvas --> Tile + People --> Artist - class TileBehavior + Tile -> TileData + Artist -l> ArtistData + Canvas -> CanvasData - together { - class NullTileBehavior + ' LAYOUT + Artist -r[hidden] Tile +} - class GrayTileBehavior - class RedTileBehavior - class BlueTileBehavior - class YellowTileBehavior +rectangle Group_TileAppearance as "Tile appearance" <> { + struct Color { + red : unsigned int + green : unsigned int + blue : unsigned int + } + class TileAppearance { + + get_color(string) : Color <> + + register_color(string, Color) <> + } - NullTileBehavior -d[hidden]- GrayTileBehavior - GrayTileBehavior -d[hidden]- RedTileBehavior - RedTileBehavior -d[hidden]- BlueTileBehavior - BlueTileBehavior -d[hidden]- YellowTileBehavior - } + Tile --> Color - TileBehaviorStrategy <|.. NullTileBehavior - TileBehaviorStrategy <|.. GrayTileBehavior - TileBehaviorStrategy <|.. RedTileBehavior - TileBehaviorStrategy <|.. BlueTileBehavior - TileBehaviorStrategy <|.. YellowTileBehavior + Color <.. TileAppearance +} +rectangle Group_TileBehavior as "Tile behavior" <> { + interface TileBehaviorStrategy - Tile --> "state" TileBehavior + class TileBehavior - TileBehavior .> TileBehaviorStrategy - TileBehavior <. TileBehaviorStrategy - } + together { + class NullTileBehavior - Museum --> People - Museum --> Canvas + class GrayTileBehavior + class RedTileBehavior + class BlueTileBehavior + class YellowTileBehavior - Canvas --> Tile - People --> Artist + NullTileBehavior -d[hidden]- GrayTileBehavior + GrayTileBehavior -d[hidden]- RedTileBehavior + RedTileBehavior -d[hidden]- BlueTileBehavior + BlueTileBehavior -d[hidden]- YellowTileBehavior + } - Tile --> TileData - Artist --> ArtistData + TileBehaviorStrategy <|.. NullTileBehavior + TileBehaviorStrategy <|.. GrayTileBehavior + TileBehaviorStrategy <|.. RedTileBehavior + TileBehaviorStrategy <|.. BlueTileBehavior + TileBehaviorStrategy <|.. YellowTileBehavior - Canvas -> CanvasData + Tile --> "state" TileBehavior - ' LAYOUT - Artist -r[hidden] Tile + TileBehavior .l> TileBehaviorStrategy + TileBehavior <. TileBehaviorStrategy } -rectangle "Visualization" <> { +rectangle Group_Visualization as "Visualization" <> { struct Rectangle { x : unsigned int y : unsigned int width : unsigned int height : unsigned int } + enum Scancode { + } package SDL2 { } class View { @@ -198,8 +199,38 @@ rectangle "Visualization" <> { + update() } - ViewController --> View - View --> SDL2 + ViewController ..> View + ViewController <-- View + View -> SDL2 +} + +rectangle Group_Commands as "Commands" <> { + class Command <> { + #museum : Museum& + #view : View& + #controller : ViewController& + +Command(museum, view, controller) + } + + class MuseumPauseCommand { + +toggle() + +set(paused : bool) + } + class OpenFileGUICommand { + +execute() + } + class ArtistVisibilityCommand { + +toggle() + +set(paused : bool) + } + + Command <|-u- MuseumPauseCommand + Command <|-u- OpenFileGUICommand + Command <|-u- ArtistVisibilityCommand + + Command .d..> Museum + Command ...d[norank]> View + Command ...d[norank]> ViewController } ' PeopleDeserializer <... People @@ -210,5 +241,21 @@ ParserStrategy ..> FileStrategy ' Museum .> Deserializer : friend Deserializer .> Museum +ViewController -[norank]> Command + +main --> Museum +main --[norank]> Deserializer +main --[norank]> View +' DETAIL: main ..[norank]> FileReader +' DETAIL: main ..[norank]> Parser + +' LAYOUT +Group_ParsingDeserialization -d[hidden] Group_FileReading +Group_TileBehavior -r[hidden] Group_TileAppearance +Group_Model -r[hidden] Group_ParsingDeserialization +Group_Model -l[hidden] main +' Group_Model -d[hidden] Group_TileBehavior +' Group_Model -d[hidden] Group_TileAppearance + @enduml diff --git a/docs/style.ipuml b/docs/style.ipuml index ceb1e65..ca4ece7 100644 --- a/docs/style.ipuml +++ b/docs/style.ipuml @@ -11,8 +11,8 @@ skinparam Ranksep 25 skinparam RoundCorner 0 skinparam PackageStyle rectangle skinparam PackageFontStyle italic -' skinparam Nodesep 25 -' skinparam Padding 0 +skinparam Nodesep 45 +skinparam Padding 0 hide class circle ' class <> for third-party classes -- cgit v1.2.3