| 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 |
string theFont; |
| 21 |
theFont := "tyxbtt"; |
| 22 |
|
| 23 |
beginfig(1); |
| 24 |
draw "xxx" infont defaultfont scaled defaultscale shifted (0,0); |
| 25 |
draw "yyy" infont (iFont.name) scaled (iFont.scale) shifted (25, 0); |
| 26 |
|
| 27 |
Picture.p("foo, bar, baz"); |
| 28 |
p.nw = (0,0); |
| 29 |
drawObject(p); |
| 30 |
|
| 31 |
Picture.q("qux, norf"); |
| 32 |
drawObjectAt(q)( q.nw = (30,30) ); |
| 33 |
|
| 34 |
FontInfo.foo("tyxbtt", 1); |
| 35 |
PictureInfo.iNice(3,6,5,10)(foo); |
| 36 |
iNice.boxed := 1; |
| 37 |
|
| 38 |
EPicture.myPic(iNice)("Custom iPicture"); |
| 39 |
drawObjectAt(myPic)( myPic.nw = (70,0)); |
| 40 |
endfig; |
| 41 |
|
| 42 |
beginfig(2); |
| 43 |
save p, q, r, t; |
| 44 |
|
| 45 |
Picture.p("foo"); |
| 46 |
Picture.q("bar"); |
| 47 |
p.nw = (10, 10); |
| 48 |
q.nw = (20, 20); |
| 49 |
|
| 50 |
drawObject(p); |
| 51 |
drawObject(q); |
| 52 |
|
| 53 |
drawObjects(p, q); |
| 54 |
|
| 55 |
Picture.a0("root" infont defaultfont); |
| 56 |
Picture.a1("toof"); |
| 57 |
|
| 58 |
a[0].nw = (30, 30); |
| 59 |
a[1].nw = (50, 50); |
| 60 |
|
| 61 |
drawObjects(scantokens listArray(a)(2)); |
| 62 |
endfig; |
| 63 |
|
| 64 |
beginfig(3); |
| 65 |
save p, q, r, t, u, pp; |
| 66 |
|
| 67 |
bboxmargin := 0; |
| 68 |
|
| 69 |
picture pp; |
| 70 |
pp = "a" infont theFont; |
| 71 |
Picture.p(pp); |
| 72 |
Picture.q("foo" infont theFont); |
| 73 |
Picture.r("bar" infont theFont); |
| 74 |
Picture.t("baz"); |
| 75 |
Picture.u("norf" infont theFont); |
| 76 |
|
| 77 |
p.nw = (0,0); |
| 78 |
setObjectJoin(pa.left=pb.left; pa.bottom = pb.top + 1); |
| 79 |
joinDrawObjects(p, q, r, t, u); |
| 80 |
|
| 81 |
defaultdy:=0; |
| 82 |
boxjoin(a.sw=b.nw; a.se=b.ne); |
| 83 |
boxit.A0("foo1"); |
| 84 |
boxit.A1("bar1"); |
| 85 |
boxit.A2("baz2"); |
| 86 |
boxit.A3("norf2"); |
| 87 |
boxit.A4(".."); |
| 88 |
A0.nw=(50,0); |
| 89 |
drawboxed(A0,A1,A2,A3,A4); |
| 90 |
|
| 91 |
myy := 10; |
| 92 |
|
| 93 |
bboxmargin := 0; |
| 94 |
|
| 95 |
pair p; |
| 96 |
p := (30,myy); |
| 97 |
dotlabel.lrt(".", p); |
| 98 |
picture x; |
| 99 |
x := "f: int" infont theFont; |
| 100 |
draw bbox(x) shifted p; |
| 101 |
draw x shifted p; |
| 102 |
|
| 103 |
pair q; |
| 104 |
q := (70,myy); |
| 105 |
dotlabel.lrt(".", q); |
| 106 |
picture y; |
| 107 |
y := "goofy: int" infont theFont; |
| 108 |
draw bbox(y) shifted q; |
| 109 |
draw y shifted q; |
| 110 |
|
| 111 |
pair qq; |
| 112 |
qq := (135,myy); |
| 113 |
dotlabel.lrt(".", qq); |
| 114 |
picture y; |
| 115 |
y := "goot" infont theFont; |
| 116 |
draw bbox(y) shifted qq; |
| 117 |
draw y shifted qq; |
| 118 |
|
| 119 |
draw (0,myy)--(150, myy) dashed evenly; |
| 120 |
|
| 121 |
myyb := 30; |
| 122 |
Picture.aa(btex goof etex); |
| 123 |
aa.sw = (30, myyb); |
| 124 |
Picture_draw.aa; |
| 125 |
|
| 126 |
draw (0,myyb)--(100, myyb) dashed evenly; |
| 127 |
endfig; |
| 128 |
|
| 129 |
beginfig(4); |
| 130 |
save a, b; |
| 131 |
FontInfo.myFont(theFont, 1); |
| 132 |
PictureInfo.myWay(0,0,0,0)(myFont); |
| 133 |
myWay.boxed := 1; |
| 134 |
|
| 135 |
EPicture.a0(myWay)("goof"); |
| 136 |
EPicture.a1(myWay)("Aoorian"); |
| 137 |
EPicture.a2(myWay)("fpp"); |
| 138 |
EPicture.a3(myWay)("f: int"); |
| 139 |
EPicture.a4(myWay)("aa()"); |
| 140 |
|
| 141 |
a0.nw = (0,0); |
| 142 |
setObjectJoin(pa.bottom = pb.bottom; pa.right = pb.left - 10); |
| 143 |
joinDrawObjects(scantokens listArray(a)(5)); |
| 144 |
|
| 145 |
draw a0.sw -- a4.se withcolor black dashed evenly; |
| 146 |
|
| 147 |
myWay.ignoreNegativeBase := 1; |
| 148 |
EPicture.b0(myWay)("foo"); |
| 149 |
EPicture.b1(myWay)("Bar baz"); |
| 150 |
EPicture.b2(myWay)("qux"); |
| 151 |
EPicture.b3(myWay)("f: int"); |
| 152 |
EPicture.b4(myWay)("aa()"); |
| 153 |
|
| 154 |
b0.nw = (0,-20); |
| 155 |
setObjectJoin(pa.bottom = pb.bottom; pa.right = pb.left - 10); |
| 156 |
joinDrawObjects(scantokens listArray(b)(5)); |
| 157 |
|
| 158 |
draw b0.sw -- b4.se withcolor black dashed evenly; |
| 159 |
endfig; |
| 160 |
|
| 161 |
beginfig(5); |
| 162 |
truecorners := 1; |
| 163 |
bboxmargin := 0; |
| 164 |
save p; |
| 165 |
picture basepict; |
| 166 |
basepict := "<<foo>>" infont "tyxtt"; |
| 167 |
|
| 168 |
draw basepict; |
| 169 |
draw bbox basepict; |
| 170 |
endfig; |
| 171 |
|
| 172 |
beginfig(6); |
| 173 |
item.foo(iPictBoxed)("foo bar baz")(foo.nw = (0,0)); |
| 174 |
item.bar(iPict)("x: int")(bar.nw = (20,20)); |
| 175 |
|
| 176 |
aitem(iPictBoxed)("an anounymous item")(obj.nw = (40,10)); |
| 177 |
endfig; |
| 178 |
|
| 179 |
beginfig(7); |
| 180 |
save a, b, c, d, e, myFixed; |
| 181 |
PictureInfoCopy.myFixed(iPict); |
| 182 |
myFixed.ignoreNegativeBase := 1; |
| 183 |
myFixed.fixedWidth := 20; |
| 184 |
myFixed.boxed := 1; |
| 185 |
|
| 186 |
EPicture.a(myFixed)("a"); |
| 187 |
EPicture.b(myFixed)("bar"); |
| 188 |
EPicture.c(myFixed)(".-."); |
| 189 |
EPicture.d(myFixed)("baz"); |
| 190 |
EPicture.e(myFixed)("qux norf"); |
| 191 |
|
| 192 |
leftToRight.bottom(20)(a, b, c, d, e); |
| 193 |
|
| 194 |
drawObjects(a, b, c, d, e); |
| 195 |
endfig; |
| 196 |
|
| 197 |
beginfig(8); |
| 198 |
save a, b, c, d, e, myFixed; |
| 199 |
PictureInfoCopy.myFixed(iPict); |
| 200 |
myFixed.halign := "center"; |
| 201 |
myFixed.ignoreNegativeBase := 1; |
| 202 |
myFixed.fixedWidth := 20; |
| 203 |
myFixed.boxed := 1; |
| 204 |
|
| 205 |
EPicture.a(myFixed)("a"); |
| 206 |
EPicture.b(myFixed)("bar"); |
| 207 |
EPicture.c(myFixed)(".-."); |
| 208 |
EPicture.d(myFixed)("baz"); |
| 209 |
EPicture.e(myFixed)("qux norf"); |
| 210 |
|
| 211 |
leftToRight.bottom(20)(a, b, c, d, e); |
| 212 |
|
| 213 |
drawObjects(a, b, c, d, e); |
| 214 |
endfig; |
| 215 |
|
| 216 |
beginfig(9); |
| 217 |
save a, b, c, d, e, myFixed; |
| 218 |
PictureInfoCopy.myFixed(iPict); |
| 219 |
myFixed.halign := "center"; |
| 220 |
myFixed.ignoreNegativeBase := 1; |
| 221 |
myFixed.fixedWidth := 20; |
| 222 |
myFixed.fixedHeight := 30; |
| 223 |
myFixed.boxed := 1; |
| 224 |
|
| 225 |
EPicture.a(myFixed)("a"); |
| 226 |
EPicture.b(myFixed)("bar"); |
| 227 |
EPicture.c(myFixed)(".-."); |
| 228 |
EPicture.d(myFixed)("baz"); |
| 229 |
EPicture.e(myFixed)("qux norf"); |
| 230 |
|
| 231 |
leftToRight.bottom(20)(a, b, c, d, e); |
| 232 |
|
| 233 |
drawObjects(a, b, c, d, e); |
| 234 |
endfig; |
| 235 |
|
| 236 |
beginfig(10); |
| 237 |
save a, b, c, d, e, myFixed; |
| 238 |
PictureInfoCopy.myFixed(iPict); |
| 239 |
myFixed.halign := "center"; |
| 240 |
myFixed.valign := "center"; |
| 241 |
myFixed.ignoreNegativeBase := 1; |
| 242 |
myFixed.fixedWidth := 20; |
| 243 |
myFixed.fixedHeight := 30; |
| 244 |
myFixed.boxed := 1; |
| 245 |
|
| 246 |
EPicture.a(myFixed)("a"); |
| 247 |
EPicture.b(myFixed)("bar"); |
| 248 |
EPicture.c(myFixed)(".-."); |
| 249 |
EPicture.d(myFixed)("baz"); |
| 250 |
EPicture.e(myFixed)("qux norf"); |
| 251 |
|
| 252 |
leftToRight.bottom(20)(a, b, c, d, e); |
| 253 |
|
| 254 |
drawObjects(a, b, c, d, e); |
| 255 |
endfig; |
| 256 |
|
| 257 |
beginfig(11); |
| 258 |
save a, b, c; |
| 259 |
Picture.a("goo"); |
| 260 |
a.info.textDecoration := "underline"; |
| 261 |
|
| 262 |
Picture.b("foo()"); |
| 263 |
b.info.textDecoration := "underline"; |
| 264 |
|
| 265 |
Picture.c("x"); |
| 266 |
c.info.textDecoration := "underline"; |
| 267 |
|
| 268 |
topToBottom(5)(a, b, c); |
| 269 |
|
| 270 |
drawObjects(a, b, c); |
| 271 |
endfig; |
| 272 |
|
| 273 |
end |