| 1 |
% Part of the MetaUML manual. |
| 2 |
% Copyright (C) 2005 Ovidiu Gheorghies |
| 3 |
% |
| 4 |
% This program is free software; you can redistribute it and/or |
| 5 |
% modify it under the terms of the GNU General Public License |
| 6 |
% as published by the Free Software Foundation; either version 2 |
| 7 |
% of the License, or (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, write to the Free Software |
| 16 |
% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 |
|
| 18 |
input metauml; |
| 19 |
|
| 20 |
beginfig(1); |
| 21 |
pair za, zb; |
| 22 |
za = (10,10); |
| 23 |
zb = (10,-5); |
| 24 |
path cool; |
| 25 |
cool := za .. za+(20,10) .. |
| 26 |
zb+(20,-20) .. |
| 27 |
zb+(-10,-30) -- zb; |
| 28 |
link(aggregationUni)(cool); |
| 29 |
endfig; |
| 30 |
|
| 31 |
beginfig(2); |
| 32 |
save A, B; |
| 33 |
Class.A("A")()(); |
| 34 |
Class.B("B")()(); |
| 35 |
|
| 36 |
B.sw = A.ne + (10,10); |
| 37 |
|
| 38 |
drawObjects(A, B); |
| 39 |
|
| 40 |
link(aggregationUni) |
| 41 |
(rpathManhattanX(A.e, B.s)); |
| 42 |
link(inheritance) |
| 43 |
(pathManhattanY(A.n, B.w)); |
| 44 |
endfig; |
| 45 |
|
| 46 |
beginfig(3); |
| 47 |
save A, B; |
| 48 |
Class.A("A")()(); |
| 49 |
Class.B("B")()(); |
| 50 |
|
| 51 |
B.sw = A.ne + (10,10); |
| 52 |
|
| 53 |
drawObjects(A, B); |
| 54 |
|
| 55 |
stepX:=60; |
| 56 |
link(aggregationUni) |
| 57 |
(pathStepX(A.e, B.e, stepX)); |
| 58 |
|
| 59 |
stepY:=20; |
| 60 |
link(inheritance) |
| 61 |
(pathStepY(B.n, A.n, stepY)); |
| 62 |
|
| 63 |
pair X,Y; |
| 64 |
X := A.se + (0,-30); |
| 65 |
Y := X + (stepX, 0); |
| 66 |
draw A.se -- X dashed evenly; |
| 67 |
draw (xpart Y, ypart A.e) -- Y dashed evenly; |
| 68 |
drawdblarrow X + (0,15) -- Y + (0,15); |
| 69 |
label.top(btex stepX etex, .5[X,Y]); |
| 70 |
|
| 71 |
pair X,Y; |
| 72 |
X := B.n + (-70,-0); |
| 73 |
Y := X + (0, stepY); |
| 74 |
|
| 75 |
draw B.n -- X dashed evenly; |
| 76 |
draw B.n + (0,stepY) -- Y dashed evenly; |
| 77 |
drawdblarrow X + (15,0) -- Y + (15,0); |
| 78 |
label.lft(btex stepY etex, .5[X,Y]); |
| 79 |
endfig; |
| 80 |
|
| 81 |
% horizontal, vertical |
| 82 |
beginfig(4); |
| 83 |
save A, B; |
| 84 |
Class.A("A")()(); |
| 85 |
Class.B("B")("b")(); |
| 86 |
Class.C("C")("foo: int")(); |
| 87 |
|
| 88 |
B.sw = A.se + (30,5); |
| 89 |
C.sw = A.nw + (0, 30); |
| 90 |
|
| 91 |
drawObjects(A, B, C); |
| 92 |
|
| 93 |
untilX := B.left; |
| 94 |
drawRelation(association) |
| 95 |
(pathHorizontal(A.e, untilX)); |
| 96 |
|
| 97 |
draw B.nw -- B.sw + (0,-10) dashed evenly; |
| 98 |
label.bot(btex untilX etex, B.sw + (0,-10)); |
| 99 |
|
| 100 |
untilY:= C.bottom; |
| 101 |
drawRelation(association)(pathVertical(A.n, untilY)); |
| 102 |
|
| 103 |
draw C.sw -- C.sw + (-20,0) dashed evenly; |
| 104 |
label.lft(btex untilY etex, C.sw + (-20,-0)); |
| 105 |
|
| 106 |
endfig; |
| 107 |
|
| 108 |
beginfig(5); |
| 109 |
save A,B; |
| 110 |
Activity.A("A"); |
| 111 |
Activity.B("B"); |
| 112 |
|
| 113 |
B.nw = A.ne + (40,30); |
| 114 |
drawObjects(A,B); |
| 115 |
|
| 116 |
z = A.se + (30, -10); |
| 117 |
link(transition)(pathCut(A, B) |
| 118 |
(A.c -- z -- B.c)); |
| 119 |
endfig; |
| 120 |
|
| 121 |
beginfig(6); |
| 122 |
save A,B; |
| 123 |
Class.A("A")()(); |
| 124 |
Class.B("B")()(); |
| 125 |
|
| 126 |
B.nw = A.ne + (20,30); |
| 127 |
drawObjects(A,B); |
| 128 |
|
| 129 |
clink(inheritance)(A, B); |
| 130 |
endfig; |
| 131 |
|
| 132 |
end |