Debian Codegraph @

texmf-dist/doc/metapost/metauml/manual/fig/test_paths.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 iPict.boxed := 1;
21
22 beginfig(1);
23 iClass.shade := 3;
24 Class.F("Foo")("a: int","b: int")();
25 Class.B("Bar")()();
26
27 B.nw = F.ne + (20,-20);
28
29 drawObjects(B, F);
30
31 link(association)(B.nw -- F.ne);
32
33 draw objectBorder(B) withcolor red;
34 draw objectBorder(F) withcolor blue;
35
36 link(association)(pathCut(B,F)(B.c--F.c));
37 endfig;
38
39 beginfig(2);
40 save A, B;
41
42 Picture.A("A");
43 Picture.B("Blue");
44
45 B.sw = A.ne + (20,20);
46
47 drawObjects(A, B);
48
49 link(associationUni)(pathManhattanX(A.e, B));
50 endfig;
51
52 beginfig(3);
53 save A, B, C, D, O;
54
55 Picture.A("Alpha");
56 Picture.B("Beta");
57 Picture.C("Gamma");
58 Picture.D("Delta");
59 Picture.O("Omega");
60
61 A.c = O.c + (-50,50);
62 B.c = O.c + (50,50);
63 C.c = O.c + (-50,-50);
64 D.c = O.c + (50,-50);
65
66 drawObjects(O, A, B, C, D);
67
68 link(associationUni)(pathManhattanX(O, A));
69 link(associationUni)(pathManhattanX(O, B));
70 link(associationUni)(pathManhattanX(O, C));
71 link(associationUni)(pathManhattanX(O, D));
72 endfig;
73
74 beginfig(3);
75 show "";
76 show "";
77 show " FIGURE 3";
78
79 save A, B, C, D, O;
80
81 Picture.A("Alpha");
82 Picture.B("Beta");
83 Picture.C("Gamma");
84 Picture.D("Delta");
85 Picture.O("Omega");
86
87 A.c = O.c + (-50,50);
88 B.c = O.c + (50,50);
89 C.c = O.c + (-50,-50);
90 D.c = O.c + (50,-50);
91
92 drawObjects(O, A, B, C, D);
93
94 link(associationUni)(pathManhattanX(O, A));
95 link(associationUni)(pathManhattanX(O, B));
96 link(associationUni)(pathManhattanX(O, C));
97 link(associationUni)(pathManhattanX(O, D));
98 endfig;
99
100 end