Debian Codegraph @

texmf-dist/doc/metapost/metauml/manual/fig/positioning.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 Class.A("A")()();
22 Class.B("B")()();
23 Class.C("C")()();
24 Class.Base("Base")()();
25
26
27 A.ne = B.nw - (20,0);
28 B.ne = C.nw - (20,0);
29 Base.s = B.n + (0,20);
30
31 drawObjects(Base, A, B, C);
32 endfig;
33
34 beginfig(2);
35 save A, B, C, Base;
36
37 Class.A("A")()();
38 Class.B("B")()();
39 Class.C("C")()();
40 Class.Base("Base")()();
41
42 leftToRight(20)(A, B, C);
43 topToBottom(20)(Base, B);
44
45 drawObjects(Base, A, B, C);
46 endfig;
47
48 iPict.boxed := 1;
49 spacing := 5;
50 string strA, strB, strC;
51 strA := "a";
52 strB := "...";
53 strC := "Cyan";
54
55 beginfig(3);
56 save A, B, C, X, Y, Z;
57
58 Picture.X(strA);
59 Picture.Y(strB);
60 Picture.Z(strC);
61
62 leftToRight.top(spacing)(X, Y, Z);
63
64 drawObjects(X, Y, Z);
65
66 draw (X.left, X.top) -- (Z.right, X.top) dashed evenly withpen pencircle withcolor red;
67 endfig;
68
69 beginfig(4);
70 save A, B, C, X, Y, Z;
71
72 Picture.X(strA);
73 Picture.Y(strB);
74 Picture.Z(strC);
75
76 leftToRight.midy(spacing)(X, Y, Z);
77
78 drawObjects(X, Y, Z);
79
80 draw (X.left, X.midy) -- (Z.right, X.midy) dashed evenly withpen pencircle withcolor red;;
81 endfig;
82
83 beginfig(5);
84 save A, B, C, X, Y, Z;
85
86 Picture.X(strA);
87 Picture.Y(strB);
88 Picture.Z(strC);
89
90 leftToRight.bottom(spacing)(X, Y, Z);
91
92 drawObjects(X, Y, Z);
93
94 draw (X.left, X.bottom) -- (Z.right, X.bottom) dashed evenly withpen pencircle withcolor red;;
95 endfig;
96
97 beginfig(6);
98 save A, B, C, X, Y, Z;
99
100 Picture.X(strA);
101 Picture.Y(strB);
102 Picture.Z(strC);
103
104 topToBottom.left(spacing)(X, Y, Z);
105
106 drawObjects(X, Y, Z);
107
108 draw (X.left, X.top) -- (X.left, Z.bottom) dashed evenly withpen pencircle withcolor red;;
109 endfig;
110
111 beginfig(7);
112 save A, B, C, X, Y, Z;
113
114 Picture.X(strA);
115 Picture.Y(strB);
116 Picture.Z(strC);
117
118 topToBottom.midx(spacing)(X, Y, Z);
119
120 drawObjects(X, Y, Z);
121
122 draw (X.midx, X.top) -- (X.midx, Z.bottom) dashed evenly withpen pencircle withcolor red;;
123 endfig;
124
125 beginfig(8);
126 save A, B, C, X, Y, Z;
127
128 Picture.X(strA);
129 Picture.Y(strB);
130 Picture.Z(strC);
131
132 topToBottom.right(spacing)(X, Y, Z);
133
134 drawObjects(X, Y, Z);
135
136 draw (X.right, X.top) -- (X.right, Z.bottom) dashed evenly withpen pencircle withcolor red;;
137 endfig;
138
139 end