Debian Codegraph @

texmf-dist/doc/metapost/metauml/manual/fig/test_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 iPict.boxed := 1;
21 spacing := 5;
22 string strA, strB, strC;
23 strA := "a";
24 strB := "...";
25 strC := "XYZ";
26
27 beginfig(1);
28 save A, B, C, X, Y, Z;
29
30 Picture.A(strA);
31 Picture.B(strB);
32 Picture.C(strC);
33
34 align(top, left, right)(spacing)("+")(A, B, C);
35
36 drawObjects(A, B, C);
37
38 draw (A.left, A.top) -- (C.right, A.top);
39
40 %%%%
41
42 Picture.X(strA);
43 Picture.Y(strB);
44 Picture.Z(strC);
45
46 leftToRight.top(spacing)(X, Y, Z);
47
48 X.top = A.bottom - 10;
49
50 drawObjects(X, Y, Z);
51
52 draw (X.left, X.top) -- (Z.right, X.top);
53 endfig;
54
55 beginfig(2);
56 save A, B, C, X, Y, Z;
57
58 Picture.A(strA);
59 Picture.B(strB);
60 Picture.C(strC);
61
62 align(midy, left, right)(spacing)("+")(A, B, C);
63
64 drawObjects(A, B, C);
65
66 draw (A.left, A.midy) -- (C.right, A.midy);
67
68 %%%%
69
70 Picture.X(strA);
71 Picture.Y(strB);
72 Picture.Z(strC);
73
74 leftToRight.midy(spacing)(X, Y, Z);
75
76 X.top = A.bottom - 10;
77
78 drawObjects(X, Y, Z);
79
80 draw (X.left, X.midy) -- (Z.right, X.midy);
81 endfig;
82
83 beginfig(3);
84 save A, B, C, X, Y, Z;
85
86 Picture.A(strA);
87 Picture.B(strB);
88 Picture.C(strC);
89
90 align(bottom, left, right)(spacing)("+")(A, B, C);
91
92 drawObjects(A, B, C);
93
94 draw (A.left, A.bottom) -- (C.right, A.bottom);
95
96 %%%%
97
98 Picture.X(strA);
99 Picture.Y(strB);
100 Picture.Z(strC);
101
102 leftToRight.bottom(spacing)(X, Y, Z);
103
104 X.top = A.bottom - 10;
105
106 drawObjects(X, Y, Z);
107
108 draw (X.left, X.bottom) -- (Z.right, X.bottom);
109 endfig;
110
111 beginfig(4);
112 save A, B, C, X, Y, Z;
113
114 Picture.A(strA);
115 Picture.B(strB);
116 Picture.C(strC);
117
118 align(left, top, bottom)(spacing)("-")(A, B, C);
119
120 drawObjects(A, B, C);
121
122 draw (A.left, A.top) -- (A.left, C.bottom);
123
124 %%%%
125
126 Picture.X(strA);
127 Picture.Y(strB);
128 Picture.Z(strC);
129
130 topToBottom.left(spacing)(X, Y, Z);
131
132 X.top = C.bottom - 10;
133
134 drawObjects(X, Y, Z);
135
136 draw (X.left, X.top) -- (X.left, Z.bottom);
137 endfig;
138
139 beginfig(5);
140 save A, B, C, X, Y, Z;
141
142 Picture.A(strA);
143 Picture.B(strB);
144 Picture.C(strC);
145
146 align(midx, top, bottom)(spacing)("-")(A, B, C);
147
148 drawObjects(A, B, C);
149
150 draw (A.midx, A.top) -- (A.midx, C.bottom);
151
152 %%%%
153
154 Picture.X(strA);
155 Picture.Y(strB);
156 Picture.Z(strC);
157
158 topToBottom.midx(spacing)(X, Y, Z);
159
160 X.top = C.bottom - 10;
161
162 drawObjects(X, Y, Z);
163
164 draw (X.midx, X.top) -- (X.midx, Z.bottom);
165 endfig;
166
167 beginfig(6);
168 save A, B, C, X, Y, Z;
169
170 Picture.A(strA);
171 Picture.B(strB);
172 Picture.C(strC);
173
174 align(right, top, bottom)(spacing)("-")(A, B, C);
175
176 drawObjects(A, B, C);
177
178 draw (A.right, A.top) -- (A.right, C.bottom);
179
180 %%%%
181
182 Picture.X(strA);
183 Picture.Y(strB);
184 Picture.Z(strC);
185
186 topToBottom.right(spacing)(X, Y, Z);
187
188 X.top = C.bottom - 10;
189
190 drawObjects(X, Y, Z);
191
192 draw (X.right, X.top) -- (X.right, Z.bottom);
193 endfig;
194
195 end