├── README.md ├── Makefile ├── examples ├── index.html ├── activity1.gv ├── usecase1.gv └── usecase2.gv └── uml.ps /README.md: -------------------------------------------------------------------------------- 1 | graphviz uml 2 | -------------- 3 | 4 | This is the begin of an external postscript procedure file and examples for 5 | producing UML graphs. 6 | 7 | Use it like following: 8 | 9 | dot -Tps -l uml.ps -o usecase1.ps examples/usecase1.gv 10 | 11 | For examples how to use and create use-case diagrams check the examples. -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | 2 | EXAMPLES = \ 3 | examples/usecase1.png \ 4 | examples/activity1.png \ 5 | examples/usecase2.png 6 | 7 | %.png: %.gv uml.ps 8 | @echo "Rendering graph: $@" 9 | @dot -Teps -l uml.ps $< | gs -q -dEPSCrop -r150 -dNOPAUSE -dBATCH -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -sOutputFile=$@ - 10 | 11 | all: $(EXAMPLES) 12 | 13 | clean: 14 | rm -f $(EXAMPLES) 15 | 16 | -------------------------------------------------------------------------------- /examples/index.html: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 |
12 |
Simplest form of use-case (usecase1.gv)
13 |
14 | Here follows an overview of the simples form of use case diagram, 15 | a main objective with its related actors.
16 |
17 | 18 |
19 |
20 | 21 | 22 |
23 |
Use case resturant model (usecase2.gv)
24 |
25 | Here we show a use case resturant model
26 |
27 |
28 |
29 | 30 | 31 | -------------------------------------------------------------------------------- /examples/activity1.gv: -------------------------------------------------------------------------------- 1 | digraph G { 2 | /* basic setup */ 3 | compound=true; 4 | rankdir = LR; 5 | fontname="Helvetica"; 6 | fontsize="10"; 7 | node [ 8 | shape=activity, 9 | peripheries=0, 10 | label="", 11 | fontname="Helvetica", 12 | fontsize="10" 13 | ]; 14 | 15 | /* Swimlanes */ 16 | { 17 | edge [style=invis] 18 | node [shape=plaintext, fontsize=12] 19 | 20 | /* Actors */ 21 | customer[label="Customer"] 22 | support[label="Support"] 23 | sales[label="Sales"] 24 | 25 | customer->sales->support 26 | } 27 | 28 | /* Activities */ 29 | start [shape=start, width=0.5, fixedsize=true] 30 | order [label="Submit purchase order"]; 31 | process_po [label="Process purchase order"]; 32 | deliv_licenses [label="Deliver of licenses"]; 33 | stop [shape=stop, width=0.5, fixedsize=true]; 34 | 35 | /* Flow */ 36 | start->order 37 | order->process_po 38 | process_po->deliv_licenses 39 | deliv_licenses->stop 40 | 41 | /* Assign activities to actors */ 42 | { rank=same; customer; start; order; stop; } 43 | { rank=same; sales; process_po; } 44 | { rank=same; support; deliv_licenses; } 45 | 46 | } -------------------------------------------------------------------------------- /examples/usecase1.gv: -------------------------------------------------------------------------------- 1 | digraph G { 2 | /* basic setup */ 3 | rankdir = LR; 4 | fontname="Helvetica"; 5 | fontsize="10"; 6 | edge [arrowhead=none]; 7 | node [shape=objective, peripheries=0, label="", fontname="Helvetica", fontsize="10"]; 8 | 9 | /* Actors */ 10 | subgraph clusterCustomer {label="Customer"; labelloc="b"; peripheries=0; 11 | customer [shape=actor, width=0.7, fixedsize=true];}; 12 | 13 | subgraph clusterSales {label="Sales"; labelloc="b"; peripheries=0; 14 | sales [shape=actor, width=0.7, fixedsize=true];}; 15 | 16 | subgraph clusterSupport {label="Support"; labelloc="b"; peripheries=0; 17 | support [shape=actor, width=0.7, fixedsize=true];}; 18 | 19 | /* Group Objectives */ 20 | subgraph clusterObjectives {order; process_po; deliv_licenses; peripheries=0;} 21 | 22 | /* Objectives */ 23 | order [label="Submit\nPurchase Order"]; 24 | process_po [label="Process\nPurchase Order"]; 25 | deliv_licenses [label="Deliver of\nlicenses"]; 26 | 27 | /* Relations */ 28 | customer->order 29 | order->process_po 30 | process_po->sales 31 | process_po->support 32 | support->deliv_licenses 33 | deliv_licenses->customer 34 | } 35 | -------------------------------------------------------------------------------- /examples/usecase2.gv: -------------------------------------------------------------------------------- 1 | digraph G { 2 | /* basic setup */ 3 | rankdir = LR; 4 | fontname="Helvetica"; 5 | fontsize="10"; 6 | edge [arrowsize=0.7, arrowhead=none, fontsize="9"]; 7 | 8 | node [shape=objective, peripheries=0, label="", fontname="Helvetica", fontsize="10"]; 9 | 10 | /* Actors */ 11 | subgraph clusterWaiter { 12 | label="waiter"; labelloc="b"; peripheries=0; 13 | waiter [shape=actor, width=0.7, fixedsize=true]; 14 | }; 15 | subgraph clusterClient { 16 | label="client"; labelloc="b"; peripheries=0; 17 | client [shape=actor, width=0.7, fixedsize=true]; 18 | }; 19 | 20 | subgraph clusterChef { 21 | label="chef"; labelloc="b"; peripheries=0; 22 | chef [shape=actor, width=0.7, fixedsize=true]; 23 | }; 24 | 25 | subgraph clusterCashier { 26 | label="cashier"; labelloc="b"; peripheries=0; 27 | cashier [shape=actor, width=0.7, fixedsize=true]; 28 | }; 29 | 30 | /* Objectives */ 31 | order_food [label="Order food"]; 32 | order_wine [label="Order wine"]; 33 | serve_food [label="Serve food"]; 34 | serve_wine [label="Serve wine"]; 35 | eat_food [label="Eat food"]; 36 | drink_wine [label="Drink wine"]; 37 | cook_food [label="Cook food"]; 38 | pay_food [label="Pay for food"]; 39 | pay_wine [label="Pay for wine"]; 40 | 41 | /* Relations */ 42 | client->order_food [label="place order"] 43 | order_wine->order_food [arrowhead=vee style=dashed label="<>"] 44 | order_food->waiter [label="receive order"] 45 | order_food->chef [label="confirm order"] 46 | client->eat_food; 47 | drink_wine->eat_food [arrowhead=vee style=dashed label="<>"] 48 | client->pay_food [label="pay"] 49 | waiter->pay_food [label="facilitate payment"] 50 | waiter->serve_food 51 | serve_wine->serve_food [arrowhead=vee style=dashed label="<>"] 52 | pay_food->cashier [label="accept payment"] 53 | pay_wine->pay_food [arrowhead=vee style=dashed label="<>"] 54 | chef->cook_food; 55 | 56 | } 57 | -------------------------------------------------------------------------------- /uml.ps: -------------------------------------------------------------------------------- 1 | % graphviz UML postscript library 2 | % Copyright (C) 2013 Henrik Andersson 3 | % 4 | % This program is free software: you can redistribute it and/or modify 5 | % it under the terms of the GNU General Public License as published by 6 | % the Free Software Foundation, either version 3 of the License, or 7 | % (at your option) any later version. 8 | % 9 | % This program is distributed in the hope that it will be useful, 10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | % GNU General Public License for more details. 13 | % 14 | % You should have received a copy of the GNU General Public License 15 | % along with this program. If not, see . 16 | 17 | /xdef {exch def} bind def 18 | 19 | /_ellipse { 20 | 4 dict begin 21 | /yr xdef /xr xdef /cy xdef /cx xdef 22 | /savematrix matrix currentmatrix def 23 | cx cy translate 24 | xr yr scale 25 | 0 0 1 0 360 arc 26 | savematrix setmatrix 27 | end 28 | } bind def 29 | 30 | /_rrect { 31 | 4 dict begin 32 | /y1 xdef /x1 xdef /y0 xdef /x0 xdef 33 | x1 x0 sub 2 div x0 add /xh xdef 34 | y1 y0 sub 2 div y0 add /yh xdef 35 | y1 y0 sub 0.2 mul /r xdef 36 | /savematrix matrix currentmatrix def 37 | xh y1 moveto 38 | x1 y1 x1 yh r arct 39 | x1 y0 xh y0 r arct 40 | x0 y0 x0 yh r arct 41 | x0 y1 xh y1 r arct 42 | closepath 43 | savematrix setmatrix 44 | end 45 | } bind def 46 | 47 | /_start { 48 | 4 dict begin 49 | /yr xdef /xr xdef /cy xdef /cx xdef 50 | /savematrix matrix currentmatrix def 51 | cx cy translate 52 | xr 2 div /xs xdef 53 | xs xs scale 54 | 0 0 1 0 360 arc 55 | savematrix setmatrix 56 | end 57 | } bind def 58 | 59 | /_stop { 60 | 4 dict begin 61 | /yr xdef /xr xdef /cy xdef /cx xdef 62 | /savematrix matrix currentmatrix def 63 | cx cy translate 64 | xr 2 div /xs xdef 65 | xs xs scale 66 | 0 0 0.8 0 360 arc fill 67 | 0 0 1 0 360 arc 68 | savematrix setmatrix 69 | end 70 | } bind def 71 | 72 | /_actor { 73 | 4 dict begin 74 | /yr xdef /xr xdef /cy xdef /cx xdef 75 | /savematrix matrix currentmatrix def 76 | cx cx translate 77 | xr xr scale 78 | newpath 0 0.30 0.225 0 360 arc 79 | -0.5 -0.1 moveto 80 | 0.5 -0.1 lineto 81 | 0 0.1 moveto 82 | 0 -0.5 lineto 83 | -0.45 -1.0 moveto 84 | 0 -0.5 lineto 85 | 0.45 -1.0 lineto 86 | savematrix setmatrix 87 | end 88 | } bind def 89 | 90 | /objective { 91 | 10 dict begin 92 | /fflag xdef 93 | /sides xdef 94 | 95 | aload pop 96 | /y1 xdef /x1 xdef 97 | pop pop 98 | /y0 xdef /x0 xdef 99 | pop pop pop pop 100 | 101 | x1 x0 sub 2 div /xr xdef 102 | y1 y0 sub 2 div /yr xdef 103 | x0 xr add /xc xdef 104 | y0 yr add /yc xdef 105 | 106 | /savematrix matrix currentmatrix def 107 | xc yc translate 108 | 0.85 setgray 109 | newpath -0.25 -0.25 xr yr _ellipse stroke 110 | 0.25 setgray 111 | newpath 0.25 0.25 xr yr _ellipse stroke 112 | 0 setgray 113 | newpath 0 0 xr yr _ellipse stroke 114 | savematrix setmatrix 115 | end 116 | } bind def 117 | 118 | /actor { 119 | 10 dict begin 120 | /fflag xdef 121 | /sides xdef 122 | 123 | aload pop 124 | /y1 xdef /x1 xdef 125 | pop pop 126 | /y0 xdef /x0 xdef 127 | pop pop pop pop 128 | 129 | x1 x0 sub 2 div /xs xdef 130 | y1 y0 sub 2 div /ys xdef 131 | x0 xs add /xc xdef 132 | y0 ys add /yc xdef 133 | 134 | /savematrix matrix currentmatrix def 135 | xc yc translate 136 | 0.85 setgray 137 | newpath -0.25 -0.25 xs ys _actor stroke 138 | 0.25 setgray 139 | newpath 0.25 0.25 xs ys _actor stroke 140 | 0 setgray 141 | newpath 0 0 xs ys _actor stroke 142 | savematrix setmatrix 143 | end 144 | } bind def 145 | 146 | /start { 147 | 10 dict begin 148 | /fflag xdef 149 | /sides xdef 150 | 151 | aload pop 152 | /y1 xdef /x1 xdef 153 | pop pop 154 | /y0 xdef /x0 xdef 155 | pop pop pop pop 156 | 157 | x1 x0 sub 2 div /xs xdef 158 | y1 y0 sub 2 div /ys xdef 159 | x0 xs add /xc xdef 160 | y0 ys add /yc xdef 161 | 162 | /savematrix matrix currentmatrix def 163 | xc yc translate 164 | 0.85 setgray 165 | newpath -0.25 -0.25 xs ys _start fill 166 | 0.25 setgray 167 | newpath 0.25 0.25 xs ys _start fill 168 | 0 setgray 169 | newpath 0 0 xs ys _start fill 170 | savematrix setmatrix 171 | end 172 | } bind def 173 | 174 | /stop { 175 | 10 dict begin 176 | /fflag xdef 177 | /sides xdef 178 | 179 | aload pop 180 | /y1 xdef /x1 xdef 181 | pop pop 182 | /y0 xdef /x0 xdef 183 | pop pop pop pop 184 | 185 | x1 x0 sub 2 div /xs xdef 186 | y1 y0 sub 2 div /ys xdef 187 | x0 xs add /xc xdef 188 | y0 ys add /yc xdef 189 | 190 | /savematrix matrix currentmatrix def 191 | xc yc translate 192 | 0.85 setgray 193 | newpath -0.25 -0.25 xs ys _stop stroke 194 | 0.25 setgray 195 | newpath 0.25 0.25 xs ys _stop stroke 196 | 0 setgray 197 | newpath 0 0 xs ys _stop stroke 198 | savematrix setmatrix 199 | end 200 | } bind def 201 | 202 | /activity { 203 | 10 dict begin 204 | /fflag xdef 205 | /sides xdef 206 | 207 | aload pop 208 | /y1 xdef /x1 xdef 209 | pop pop 210 | /y0 xdef /x0 xdef 211 | pop pop pop pop 212 | 213 | x1 x0 sub 2 div /xs xdef 214 | y1 y0 sub 2 div /ys xdef 215 | 216 | /savematrix matrix currentmatrix def 217 | 0.85 setgray 218 | -0.25 -0.25 translate 219 | newpath x0 y0 x1 y1 _rrect stroke 220 | 0.25 setgray 221 | 0.5 0.5 translate 222 | newpath x0 y0 x1 y1 _rrect stroke 223 | 0 setgray 224 | -0.25 -0.25 translate 225 | newpath x0 y0 x1 y1 _rrect stroke 226 | savematrix setmatrix 227 | end 228 | } bind def --------------------------------------------------------------------------------