Debian Codegraph @

texmf-dist/doc/metapost/metauml/manual/fig/paths_man.mp

raw
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 save A, B;
22 Class.A("A")("foo:int")("bar()");
23 Class.B("B")()();
24
25 A.nw = (0,0);
26 B.s = A.ne + (30,30);
27
28 Class_draw.A;
29 Class_draw.B;
30
31 drawRelation(aggregationUni)
32 (A.n ..(30,30)..B.w);
33 path cool;
34 cool := A.e .. A.e+(20,10) ..
35 B.s+(20,-40) .. B.s+(-10,-30)
36 -- B.s;
37 drawRelation(inheritance)(cool);
38 endfig;
39
40 beginfig(2);
41 save A, B;
42 Class.A("A")()();
43 Class.B("B")()();
44
45 A.nw = (0,0);
46 B.sw = A.ne + (10,10);
47
48 Class_draw.A;
49 Class_draw.B;
50
51 drawRelation(aggregationUni)
52 (pathManhattanX(A.e, B.s));
53 drawRelation(inheritance)
54 (pathManhattanY(A.n, B.w));
55 endfig;
56
57 beginfig(3);
58 save A, B;
59 Class.A("A")()();
60 Class.B("B")()();
61
62 A.nw = (0,0);
63 B.sw = A.ne + (10,10);
64
65 Class_draw.A;
66 Class_draw.B;
67
68 stepX:=60;
69 drawRelation(aggregationUni)
70 (pathStepX(A.e, B.e, stepX));
71
72 stepY:=20;
73 drawRelation(inheritance)
74 (pathStepY(B.n, A.n, stepY));
75
76 pair X,Y;
77 X := A.se + (0,-30);
78 Y := X + (stepX, 0);
79 draw A.se -- X dashed evenly;
80 draw (xpart Y, ypart A.e) -- Y dashed evenly;
81 drawdblarrow X + (0,15) -- Y + (0,15);
82 label.top(btex stepX etex, .5[X,Y]);
83
84 pair X,Y;
85 X := B.n + (-70,-0);
86 Y := X + (0, stepY);
87
88 draw B.n -- X dashed evenly;
89 draw B.n + (0,stepY) -- Y dashed evenly;
90 drawdblarrow X + (15,0) -- Y + (15,0);
91 label.lft(btex stepY etex, .5[X,Y]);
92 endfig;
93
94 beginfig(4);
95 save A, B;
96 Class.A("A")()();
97 Class.B("B")("a")();
98
99 A.nw = (0,0);
100 B.sw = A.se + (30,5);
101
102 Class_draw.A;
103 Class_draw.B;
104
105 untilX := B.left;
106 drawRelation(association)
107 (pathHorizontal(A.e, untilX));
108
109 draw B.nw -- B.sw + (0,-10) dashed evenly;
110 label.bot(btex untilX etex, B.sw + (0,-10));
111 endfig;
112
113 beginfig(5);
114 save A, B;
115 Class.A("A")()();
116 Class.B("B")("a")("foo()");
117
118 A.nw = (0,0);
119 B.sw = A.ne + (-20,20);
120
121 Class_draw.A;
122 Class_draw.B;
123
124 untilY:= B.bottom;
125 drawRelation(association)
126 (pathVertical(A.n, untilY));
127
128 draw B.sw -- B.sw + (-20,0) dashed evenly;
129 label.lft(btex untilY etex, B.sw + (-20,-0));
130 endfig;
131
132 beginfig(6);
133 save A,B;
134 Class.A("A")()();
135 Class.B("B")()();
136
137 B.nw = A.ne + (40,30);
138 drawObjects(A,B);
139
140 link(inheritance)(pathCut(A,B)(A.c -- B.c));
141 endfig;
142
143 end