| 1 |
%% |
| 2 |
%% This is file `expeg.mp', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% expressg.dtx (with options: `eg') |
| 8 |
%% |
| 9 |
%% Author: Peter Wilson (CUA) now at [email protected] until June 2004 |
| 10 |
%% (or [email protected]) |
| 11 |
%% Copyright 1996, 2003 Peter R. Wilson |
| 12 |
%% |
| 13 |
%% v1.0 1996/05/09 (first release) |
| 14 |
%% v1.2 1999/11/15 |
| 15 |
%% v1.3 2000/05/22 |
| 16 |
%% v1.4 2000/07/10 |
| 17 |
%% v1.5 2003/07/31 |
| 18 |
%% v1.6 2004/02/29 |
| 19 |
%% v1.61 2004/03/17 |
| 20 |
%% |
| 21 |
%% This work may be distributed and/or modified under the |
| 22 |
%% conditions of the LaTeX Project Public License, either |
| 23 |
%% version 1.3 of this license or (at your option) any |
| 24 |
%% later version. |
| 25 |
%% The latest version of the license is in |
| 26 |
%% http://www.latex-project.org/lppl.txt |
| 27 |
%% and version 1.3 or later is part of all distributions of |
| 28 |
%% LaTeX version 2003/06/01 or later. |
| 29 |
%% |
| 30 |
%% This work has the LPPL maintenance status "author-maintained". |
| 31 |
%% |
| 32 |
%% This work consists of the files listed in the README file. |
| 33 |
%% This program is provided under the terms of the |
| 34 |
%% LaTeX Project Public License distributed from CTAN |
| 35 |
%% archives in directory macros/latex/base/lppl.txt. |
| 36 |
%% |
| 37 |
%%% EXPEG.MP Example MetaPost EXPRESS-G diagrams |
| 38 |
|
| 39 |
|
| 40 |
verbatimtex \def\twolines#1#2{\vbox{\hbox{#1} \hbox{#2}}} etex |
| 41 |
|
| 42 |
input expressg |
| 43 |
|
| 44 |
beginfig(1) |
| 45 |
|
| 46 |
z1=(0,0); |
| 47 |
drawEXPRESSION(1); |
| 48 |
|
| 49 |
z2bl=z1tr; |
| 50 |
drawINTEGER(2); |
| 51 |
|
| 52 |
z3bl=z2tr; |
| 53 |
drawBOOLEAN(3); |
| 54 |
|
| 55 |
z4bm=z3tm; |
| 56 |
drawcirclebox(4, namespace(btex ABS etex)(nextra))(btex ABS etex); |
| 57 |
|
| 58 |
numeric diam; |
| 59 |
diam = namespace(btex ABS etex)(nextra); |
| 60 |
|
| 61 |
z5bm=z4tm; |
| 62 |
drawcirclebox(5, diam)(btex SAB etex); |
| 63 |
|
| 64 |
x5ml-x5tl = x5tr-x6bl; |
| 65 |
y6mr=y5tm; |
| 66 |
drawENT(6, pconl, enth)(btex an\_ent etex); |
| 67 |
|
| 68 |
z7bm=(x6tm,y6tm+u); |
| 69 |
drawLEVENT(7, pconl, eventh)(btex levent etex); |
| 70 |
|
| 71 |
z8=(x7tl, y7tr+u); |
| 72 |
drawGEVENT(8, pconl, eventh)(btex gevent etex); |
| 73 |
|
| 74 |
z9br=1/8[z3tl,z3tr]; |
| 75 |
drawSCHEMA(9, pconl, schemah)(btex a\_schema etex); |
| 76 |
|
| 77 |
numeric xmid, len; |
| 78 |
xmid = x8tr + diam; |
| 79 |
len = 2diam; |
| 80 |
|
| 81 |
z11=(xmid, y1ml); z111=z11 shifted (len, 0); |
| 82 |
drawdashO(11, 111); |
| 83 |
|
| 84 |
pair moveright; |
| 85 |
moveright = (len, 0); |
| 86 |
|
| 87 |
z12=(xmid, y2ml); z121=z12 shifted moveright; |
| 88 |
drawnormalO(12, 121); |
| 89 |
|
| 90 |
z13=(xmid, y3ml); z131=z13 shifted moveright; |
| 91 |
drawthickO(13, 131); |
| 92 |
|
| 93 |
pair moveup; |
| 94 |
moveup = (0, y13-y12); |
| 95 |
|
| 96 |
z14=z13 shifted moveup; z141=z14 shifted moveright; |
| 97 |
drawnormalD(14, 141); |
| 98 |
|
| 99 |
z15=z14 shifted moveup; z151=z15 shifted moveright; |
| 100 |
drawnormalCA(15, 151); |
| 101 |
|
| 102 |
z16=z15 shifted moveup; z161=z16 shifted moveright; |
| 103 |
drawnormalOA(16, 161); |
| 104 |
|
| 105 |
z17=z16 shifted moveup; z171=z17 shifted moveright; |
| 106 |
drawnormalF(17, 171); |
| 107 |
|
| 108 |
z300=(0,y8tm+diam); z301=(x111,y300); |
| 109 |
draw z300--z301 dashes; |
| 110 |
|
| 111 |
numeric mup; mup := onelineh; |
| 112 |
|
| 113 |
z302=(0,y300+mup); |
| 114 |
drawcardbox(302, pconl, onelineh, 1/4onelineh)(""); |
| 115 |
|
| 116 |
z303bm=(x302tm, y302tm+mup); |
| 117 |
drawdiamondbox(303, pconl, 2onelineh)(btex jewel etex); |
| 118 |
|
| 119 |
z304=(0, y303tm+mup); |
| 120 |
drawdoublerectangle(304, pconl, 2onelineh, 3/4); |
| 121 |
label(btex top etex, z304ct); |
| 122 |
|
| 123 |
z305=(0, y304tm+mup); |
| 124 |
drawtriplerectangle(305, pconl, 3onelineh, 2/5, 0.2); |
| 125 |
label(btex top etex, z305ct); |
| 126 |
label("middle", z305cm); |
| 127 |
|
| 128 |
z306=(0,y305tm+mup); |
| 129 |
drawindexbox(306, 2pconl, 3onelineh, 3/4pconl, onelineh)(btex pack etex); |
| 130 |
z307=1/8[z306bl,z306tr]; |
| 131 |
drawENT(307, 1/4pconl, onelineh)(btex E etex); |
| 132 |
|
| 133 |
z308=(0, y306P.tl+mup); |
| 134 |
z309ml=z308c; |
| 135 |
drawcardbox(308, pconl, 2onelineh, 1/4onelineh)(btex covered etex); |
| 136 |
drawdashboxover(309, pconl, onelineh); |
| 137 |
|
| 138 |
z310bm=(x306bm,y309tm+mup); |
| 139 |
drawovalbox(310, 2pconl, 2onelineh)(""); |
| 140 |
|
| 141 |
z311ml=(x310mr+mup, y310ml); |
| 142 |
drawroundedbox(311, 2pconl, 2onelineh, 1/2onelineh)("rounded"); |
| 143 |
|
| 144 |
z312ml=(x311mr+mup, y311mr); |
| 145 |
drawroundedbox(312, 2pconl, 2onelineh, 3/2onelineh)(btex large radius etex); |
| 146 |
|
| 147 |
z314=(x312bm-1/4pconl, y312bm-1/2mup); |
| 148 |
hiderectangle(314, 1/2pconl, (3/2onelineh + mup)); |
| 149 |
|
| 150 |
z315tm=(x312bm, y312bm-mup); |
| 151 |
drawdashellipse(315, 2pconl, 2onelineh); |
| 152 |
|
| 153 |
z316tm=(x315bm, y315bm-mup); |
| 154 |
drawdashcircle(316, diam); |
| 155 |
|
| 156 |
z317bc=(x311bm,y304br); |
| 157 |
drawdrum(317, pconl, 3onelineh)(btex drum etex); |
| 158 |
z317A=(x317tc, y317tc+2onelineh); |
| 159 |
drawnormalthree(317tml, 317A, 317tmr); |
| 160 |
smooth(317tml, 317A, 317tmr); |
| 161 |
|
| 162 |
z320bm = (x317bm, y302); |
| 163 |
drawstickman(320, onelineh, 2onelineh); |
| 164 |
|
| 165 |
z325bm = (x320bm, y306); |
| 166 |
drawoutputbox(325, pconl, 2onelineh)(btex output etex); |
| 167 |
|
| 168 |
z330 = (x320bm, y309ml); |
| 169 |
drawCircledDot(330, 3/2onelineh); |
| 170 |
|
| 171 |
z401bm=(1/2[x11,x111], y301+mup); |
| 172 |
drawcircleA(401, diam); |
| 173 |
|
| 174 |
z402=(xmid, y401tm+mup); z502=(x111, y402); |
| 175 |
drawdashA(402, 502); |
| 176 |
|
| 177 |
z403=(xmid, y402+mup); z503=(x111, y403); |
| 178 |
drawdashOA(403, 503); |
| 179 |
|
| 180 |
z404=(xmid, y403+mup); z504=(x111, y404); |
| 181 |
drawnormalOD(404, 504); |
| 182 |
|
| 183 |
z405=(xmid, y404+mup); z505=(x111, y405); |
| 184 |
drawnormalCD(405, 505); |
| 185 |
|
| 186 |
z406=(xmid, y405+mup); z506=(x111, y406); |
| 187 |
drawnormalDCA(406, 506); |
| 188 |
|
| 189 |
numeric ang; ang = 180/7; |
| 190 |
z600=(xmid, y406+2mup); |
| 191 |
z699=(x600+len, y600); |
| 192 |
z601=z699 rotatedaround(z600, ang); |
| 193 |
z602=z699 rotatedaround(z600, 2ang); |
| 194 |
z603=z699 rotatedaround(z600, 3ang); |
| 195 |
z604=z699 rotatedaround(z600, 4ang); |
| 196 |
z605=z699 rotatedaround(z600, 5ang); |
| 197 |
z606=z699 rotatedaround(z600, 6ang); |
| 198 |
z607=z699 rotatedaround(z600, 7ang); |
| 199 |
drawnormalCA(600,601); |
| 200 |
drawnormalOA(600,602); |
| 201 |
drawnormalF(600,603); |
| 202 |
drawdashA(600,604); |
| 203 |
drawnormalOD(600,605); |
| 204 |
drawnormalCD(600,606); |
| 205 |
|
| 206 |
endfig; % end figure 1 |
| 207 |
|
| 208 |
beginfig(2) % schema level model |
| 209 |
|
| 210 |
numeric lb, hb; % length & height of boxes |
| 211 |
lb=20u; hb=schemah; |
| 212 |
numeric upshift; % vertical distance between rows |
| 213 |
upshift = 20u; |
| 214 |
numeric sideshift; % horizontal distance between boxes |
| 215 |
sideshift = 10u; |
| 216 |
|
| 217 |
%%% bottom row |
| 218 |
|
| 219 |
z9=(lb+sideshift,0); |
| 220 |
drawSCHEMA(9, lb, hb)("nine"); |
| 221 |
|
| 222 |
z11=(x9br+sideshift,y9); |
| 223 |
drawSCHEMA(11, lb, hb)("eleven"); |
| 224 |
|
| 225 |
%%% middle row |
| 226 |
|
| 227 |
z1=(0,y9tl+upshift); |
| 228 |
drawSCHEMA(1, lb, hb)("one"); |
| 229 |
|
| 230 |
z3=(x1br+sideshift, y1); |
| 231 |
drawSCHEMA(3, lb, hb)("three"); |
| 232 |
|
| 233 |
z5=(x3br+sideshift, y1); |
| 234 |
drawSCHEMA(5, lb, hb)("five"); |
| 235 |
|
| 236 |
z7=(x5br+sideshift, y1); |
| 237 |
drawSCHEMA(7, lb, hb)("seven"); |
| 238 |
|
| 239 |
%%% top row |
| 240 |
|
| 241 |
x50 = 1/2[x3br,x5bl]; |
| 242 |
z31bm=(x50,y1tl+upshift); |
| 243 |
drawSCHEMA(31, lb, hb)("thirtyone"); |
| 244 |
|
| 245 |
%%% connectors |
| 246 |
|
| 247 |
drawdashOO(9tm, 3bm); % three/nine |
| 248 |
drawdashO(5bm, 11tm); % five/eleven |
| 249 |
drawdashO(3ml, 1mr); % three/one |
| 250 |
drawdashO(3mr, 5ml); % three/five |
| 251 |
drawdashOO(9mr, 11ml); % nine/eleven |
| 252 |
|
| 253 |
%%% thirtyone/nine |
| 254 |
z90=((x1bl-sideshift), y9ml); |
| 255 |
z31A=3/4[z31bl,z31tl]; |
| 256 |
VH(90, 31A); |
| 257 |
drawdashO(90vh, 31A); |
| 258 |
drawdashthreeO(90vh, 90, 9ml); |
| 259 |
pickup thickpen; |
| 260 |
draw z90; |
| 261 |
pickup normalpen; |
| 262 |
label.lft("z90", z90); |
| 263 |
|
| 264 |
%%% one/eleven |
| 265 |
z1A=1/3[z1bl,z1br]; |
| 266 |
z11A=(x11bm, (y11bm-sideshift)); |
| 267 |
VH(1A, 11A); |
| 268 |
drawdashthree(1A, 1A.vh, 11A); % note it is 1A.vh and not 1Avh |
| 269 |
drawdashO(11A, 11bm); |
| 270 |
dotlabel.rt("z11A", z11A); |
| 271 |
dotlabel.lft("z1A.vh", z1A.vh); % note it is z1A.vh and not z1Avh |
| 272 |
|
| 273 |
%%% thirtyone/eleven |
| 274 |
z31B=3/4[z31br,z31tr]; |
| 275 |
x31BC=x7br+sideshift; |
| 276 |
HxH(31B, 31BC, 11mr); |
| 277 |
drawdashfourO(31B, 31B.hxh, 11mr.hxh, 11mr); |
| 278 |
|
| 279 |
%%% thirtyone/seven |
| 280 |
z31D=1/4[z31br,z31tr]; |
| 281 |
VH(7tm, 31D); |
| 282 |
drawnormalthreeO(31D, 7tm.vh, 7tm); |
| 283 |
|
| 284 |
%%% thirtyone/one |
| 285 |
z31C=1/4[z31bl,z31tl]; |
| 286 |
VH(1tm, 31C); |
| 287 |
drawdashO(1tm.vh, 31C); |
| 288 |
drawdashO(1tm.vh, 1tm); |
| 289 |
|
| 290 |
%%% thirtyone/three |
| 291 |
z31E=1/4[z31bl,z31br]; |
| 292 |
VhV(31E, 3tm); |
| 293 |
drawnormalfourO(31E, 31E.vhv, 3tm.vhv, 3tm); |
| 294 |
|
| 295 |
%%% thirtyone/five |
| 296 |
z31F=3/4[z31bl,z31br]; |
| 297 |
VhV(31F, 5tm); |
| 298 |
drawnormalfourO(31F, 31F.vhv, 5tm.vhv, 5tm); |
| 299 |
|
| 300 |
%%% labeled arrow |
| 301 |
z3111=1/4[z31B,z31B.hxh]; |
| 302 |
numeric arrowsize; |
| 303 |
arrowsize := schemah; |
| 304 |
z3112=(x3111, y3111+arrowsize); |
| 305 |
drawnormalCA(3112, 3111); |
| 306 |
label.rt(btex an\_import etex, 1/2[z3111, z3112]); |
| 307 |
|
| 308 |
endfig; % end fig 2 |
| 309 |
|
| 310 |
|
| 311 |
%%%% some commonly used variables & values |
| 312 |
|
| 313 |
numeric pl, ph; % length & height of numeric page connectors |
| 314 |
pl:=pconl; ph:=pconh; % for eg., 9,9 (9,9) |
| 315 |
numeric plnamed; % length of named page connector |
| 316 |
numeric irh; % height of interschema boxes |
| 317 |
irh:=ish; % normally one line of text |
| 318 |
numeric sdtl, sdth; % length & height of SDT (e.g. INTEGER) boxes |
| 319 |
sdtl:=sdtbl; sdth:=sdtbh; |
| 320 |
numeric edtl, edth; % length & height of enum boxes (inset is sdtbs) |
| 321 |
edth:=sdtbh; % normally one text line |
| 322 |
numeric el, eh; % length & height of entity boxes |
| 323 |
eh:=enth; % normally one text line |
| 324 |
numeric upshift; % vertical space between rows of boxes |
| 325 |
numeric nextup; % vertical space between bases of rows of boxes |
| 326 |
picture sindex, pindex; |
| 327 |
sindex := btex eleven.Index etex; % interschema reference text |
| 328 |
pindex := btex 9,9 Index etex; % page reference text |
| 329 |
numeric slindex, plindex; |
| 330 |
slindex := namespace(sindex)(nextra); % length of Index interschema |
| 331 |
plindex := namespace(pindex)(nextra); % length of Index page reference |
| 332 |
numeric hspace[]; % horizontal spaces |
| 333 |
numeric lyc[]; % Y coords of box bases |
| 334 |
|
| 335 |
%%%%%%%%%%% end commonly used variables & values |
| 336 |
|
| 337 |
beginfig(3) % example fig 3 |
| 338 |
%%%drawgrid; |
| 339 |
|
| 340 |
edtl := namespace(btex standard\_data\_name etex)(niextra); |
| 341 |
upshift=2sdth; |
| 342 |
nextup=sdth+upshift; |
| 343 |
%%% the y coords of box bases |
| 344 |
lyc1:=0; |
| 345 |
lyc2:=lyc1+nextup; |
| 346 |
lyc3:=lyc2+nextup; |
| 347 |
lyc4:=lyc3+nextup; |
| 348 |
lyc5:=lyc4+nextup; |
| 349 |
lyc6:=lyc5+nextup; |
| 350 |
lyc7:=lyc6+nextup; |
| 351 |
lyc8:=lyc7+nextup; |
| 352 |
hspace1 := 1/3edtl; % space between data enums |
| 353 |
hspace2 := 2/3edtl; % initial space at start of second row |
| 354 |
|
| 355 |
%%% bottom two rows (1 & 2) |
| 356 |
|
| 357 |
z11=(0,lyc1); |
| 358 |
drawENUM(11, edtl, edth)(btex coordinates etex); |
| 359 |
|
| 360 |
z22=(hspace2, lyc2); |
| 361 |
drawENUM(22, edtl, edth)(btex solution\_data etex); |
| 362 |
|
| 363 |
z31=(x11br+hspace1, lyc1); |
| 364 |
drawENUM(31, edtl, edth)(btex pressure\_loads etex); |
| 365 |
|
| 366 |
z42=(x22br+hspace1, lyc2); |
| 367 |
drawENUM(42, edtl, edth)(btex nondimensional etex); |
| 368 |
|
| 369 |
z51=(x31br+hspace1, lyc1); |
| 370 |
drawENUM(51, edtl, edth)(btex temperature etex); |
| 371 |
|
| 372 |
z62=(x42br+hspace1, lyc2); |
| 373 |
drawENUM(62, edtl, edth)(btex force\_loads etex); |
| 374 |
|
| 375 |
%%% third row (horizontal line between 2 & 4 row) |
| 376 |
|
| 377 |
z13=(x11tm,lyc3); |
| 378 |
VyV(11tm, 13, 62tm); |
| 379 |
drawnormal(11tm.vyv, 62tm.vyv); |
| 380 |
z23=(x22tm,lyc3); z33=(x31tm,lyc3); z43=(x42tm,lyc3); z53=(x51tm,lyc3); |
| 381 |
drawnormalO(11tm.vyv,11tm); |
| 382 |
drawnormalO(23,22tm); |
| 383 |
drawnormalO(33,31tm); |
| 384 |
drawnormalO(43,42tm); |
| 385 |
drawnormalO(53,51tm); |
| 386 |
drawnormalO(62tm.vyv,62tm); |
| 387 |
|
| 388 |
%%% fourth row |
| 389 |
|
| 390 |
z3224=1/3[z13,z62tm.vyv]; |
| 391 |
z3554=2/3[z13,z62tm.vyv]; |
| 392 |
|
| 393 |
%%% standard_data_name |
| 394 |
z24bm=(x3224,lyc4); |
| 395 |
drawSELECT(24, edtl, edth)(btex standard\_data\_name etex); |
| 396 |
drawnormal(24bm,3224); |
| 397 |
|
| 398 |
%%% adhoc_data_name |
| 399 |
z54bm=(x3554,lyc4); |
| 400 |
drawTYPE(54, edtl, edth)(btex adhoc\_data\_name etex); |
| 401 |
|
| 402 |
%%% STRING |
| 403 |
z64br=(x62br,lyc4); |
| 404 |
drawSTRING(64); |
| 405 |
|
| 406 |
%%% fifth row |
| 407 |
|
| 408 |
z35=(1/2[x24tm,x54tm], lyc5); |
| 409 |
VyV(24tm, 35, 54tm); |
| 410 |
drawnormalthreeO(35, 24tm.vyv, 24tm); |
| 411 |
drawnormalthreeO(35, 54tm.vyv, 54tm); |
| 412 |
|
| 413 |
%%% sixth row |
| 414 |
|
| 415 |
z36bm=(x35,lyc6); |
| 416 |
drawSELECT(36,edtl, edth)(btex data\_name etex); |
| 417 |
drawnormal(36bm,35); |
| 418 |
|
| 419 |
%%% data_name |
| 420 |
z66=(x62,lyc6); |
| 421 |
drawPREF(66, sdtl, ph)(btex 3,1 (4) etex); |
| 422 |
|
| 423 |
%%%% rest of the connectors |
| 424 |
|
| 425 |
%%% adhoc/STRING (54, 64) |
| 426 |
drawnormalO(54mr,64ml); |
| 427 |
|
| 428 |
%%% PREF/data_name (36, 66) |
| 429 |
drawdashO(66ml,36mr); |
| 430 |
|
| 431 |
endfig; % end fig 3 |
| 432 |
|
| 433 |
|
| 434 |
beginfig(4) % example 4 |
| 435 |
%%%drawgrid; |
| 436 |
|
| 437 |
%%% length of named page reference boxes |
| 438 |
plnamed := namespace(btex 9,9 data\_name etex)(nextra); |
| 439 |
|
| 440 |
%%% length of entity boxes |
| 441 |
el := namespace(btex (ABS) Data\_t etex)(nextra); |
| 442 |
|
| 443 |
upshift := 2sdth; % vertical space between boxes |
| 444 |
nextup := sdth+upshift; % vertical space between bases of boxes |
| 445 |
hspace1 := 1/2el; % space between entity boxes |
| 446 |
|
| 447 |
%%% the y coords of box bases |
| 448 |
lyc1:=0; |
| 449 |
lyc2:=lyc1+nextup; |
| 450 |
lyc3:=lyc2+nextup; |
| 451 |
lyc4:=lyc3+nextup; |
| 452 |
lyc5:=lyc4+nextup; |
| 453 |
lyc6:=lyc5+nextup; |
| 454 |
lyc7:=lyc6+nextup; |
| 455 |
lyc8:=lyc7+nextup; |
| 456 |
|
| 457 |
%%%% 2nd row |
| 458 |
|
| 459 |
%%% IntArray |
| 460 |
z12=(0,lyc2); |
| 461 |
drawENT(12, el, eh)(btex IntArray etex); |
| 462 |
|
| 463 |
%%% RealArray |
| 464 |
z22=(x12br+hspace1, lyc2); |
| 465 |
drawENT(22, el, eh)(btex RealArray etex); |
| 466 |
|
| 467 |
%%% CharArray |
| 468 |
z42=(x22br+hspace1, lyc2); |
| 469 |
drawENT(42, el, eh)(btex CharArray etex); |
| 470 |
|
| 471 |
%%% BitArray |
| 472 |
z52=(x42br+hspace1, lyc2); |
| 473 |
drawENT(52, el, eh)(btex BitArray etex); |
| 474 |
|
| 475 |
%%%% 1st row |
| 476 |
|
| 477 |
z11bm=(x12bm,lyc1); |
| 478 |
drawINTEGER(11); |
| 479 |
|
| 480 |
z21bm=(x22bm,lyc1); |
| 481 |
drawREAL(21); |
| 482 |
|
| 483 |
z41bm=(x42bm,lyc1); |
| 484 |
drawSTRING(41); |
| 485 |
|
| 486 |
z51bm=(x52bm,lyc1); |
| 487 |
drawBINARY(51); |
| 488 |
|
| 489 |
%%% 3rd row |
| 490 |
|
| 491 |
y13= y23= y43= y53=lyc3; |
| 492 |
x13=x12tm; x23=x22tm; x43=x42tm; x53=x52tm; |
| 493 |
drawthick(13,53); % horizontal line |
| 494 |
%%% vertical connectors |
| 495 |
drawthickO(13,12tm); drawthickO(23,22tm); |
| 496 |
drawthickO(43, 42tm); drawthickO(53, 52tm); |
| 497 |
|
| 498 |
z33=1/2[z13,z53]; % midpoint of horizontal line |
| 499 |
|
| 500 |
%%% 4th row |
| 501 |
|
| 502 |
%%% Data_t |
| 503 |
z34bm=(x33,lyc4); |
| 504 |
drawENT(34, el, 3eh)(btex \twolines{(ABS)}{Data\_t} etex); |
| 505 |
drawthick(34bm,33); |
| 506 |
label.urt("1", z33); % label the connection point |
| 507 |
|
| 508 |
%%% Index |
| 509 |
z14=(0,lyc4); |
| 510 |
drawPREF(14, plindex, ph)(pindex); |
| 511 |
|
| 512 |
%%% INTEGER |
| 513 |
z54br=(x51br,lyc4); |
| 514 |
drawINTEGER(54); |
| 515 |
|
| 516 |
%%% 5th row |
| 517 |
|
| 518 |
lyc5:=y34tm-ph; % change the initial y coord value |
| 519 |
|
| 520 |
%%% Index |
| 521 |
z15=(0,lyc5); |
| 522 |
drawPREF(15, plindex, ph)(pindex); |
| 523 |
|
| 524 |
%%% DataType |
| 525 |
z55=(x54,lyc5); |
| 526 |
drawPREF(55, plnamed, ph)(btex 3,1 data\_name etex); |
| 527 |
|
| 528 |
%%% 6th row |
| 529 |
|
| 530 |
%%% PREF to Data_t |
| 531 |
lyc6:=lyc5+nextup; |
| 532 |
z36bm=(x34tm,lyc6); |
| 533 |
drawPREF(36, pl, ph)(btex 7,5 (6) etex); |
| 534 |
|
| 535 |
%%%% attributes |
| 536 |
|
| 537 |
%%% Sizes Data_t/Index (34, 14) |
| 538 |
z3414=(x34,y14mr); |
| 539 |
drawnormal(3414,14mr); |
| 540 |
label.ulft(btex Sizes A[1:Limit] etex, z3414); |
| 541 |
|
| 542 |
%%% num Data_t/INTEGER (34, 54) |
| 543 |
z3454=(x34mr,y54ml); |
| 544 |
drawnormalO(3454,54ml); |
| 545 |
label.urt(btex (DER) num etex, z3454); |
| 546 |
|
| 547 |
%%% Limit Data_t/Index (34, 15) |
| 548 |
z3415=(x34,y15mr); |
| 549 |
drawnormal(3415,15mr); |
| 550 |
label.ulft(btex Limit etex, z3415); |
| 551 |
|
| 552 |
%%% Kind Data_t/data_name (34, 55) |
| 553 |
z3455=(x34mr, y55ml); |
| 554 |
drawnormal(3455, 55ml); |
| 555 |
label.urt(btex Kind etex, z3455); |
| 556 |
|
| 557 |
%%% PREF into Data_t (36, 34) |
| 558 |
drawdashO(36bm, 34tm); |
| 559 |
|
| 560 |
%%% Data IntArray/INTEGER (12, 11) |
| 561 |
drawnormalO(12bm, 11tm); |
| 562 |
label.lrt(btex Data A[1:num] etex, z12bm); |
| 563 |
|
| 564 |
%%% Data RealArray/REAL (22, 21) |
| 565 |
drawnormalO(22bm, 21tm); |
| 566 |
label.lrt(btex Data A[1:num] etex, z22bm); |
| 567 |
|
| 568 |
%%% Data CharArray/STRING (42, 41) |
| 569 |
drawnormalO(42bm, 41tm); |
| 570 |
label.lrt(btex Data A[1:num] etex, z42bm); |
| 571 |
|
| 572 |
%%% Data BitArray/BINARY (52, 51) |
| 573 |
drawnormalO(52bm, 51tm); |
| 574 |
label.lrt(btex Data A[1:num] etex, z52bm); |
| 575 |
|
| 576 |
endfig; % end fig 4 |
| 577 |
|
| 578 |
beginfig(5) % example 5 |
| 579 |
%%drawgrid; |
| 580 |
|
| 581 |
plnamed := namespace(btex 7,4 Unstructured\_Donor etex)(nextra); |
| 582 |
|
| 583 |
numeric irls, irll; % length of short and long ISR boxes |
| 584 |
irls = namespace(btex eleven.MeshLocation etex)(nextra); |
| 585 |
irll = namespace(btex eleven.MeshConnectivityType etex)(nextra); |
| 586 |
|
| 587 |
upshift := irh; |
| 588 |
nextup := irh+upshift; |
| 589 |
|
| 590 |
numeric maxrx; % max x coordinate value of LH of right column boxes |
| 591 |
maxrx := maxx-irrl; |
| 592 |
numeric xmid; % x coord of figure center |
| 593 |
xmid := 1/2[irls, maxx-irll]; |
| 594 |
|
| 595 |
el := namespace(btex MeshConnectivity1\_1 etex)(nextra); |
| 596 |
eh := irh; |
| 597 |
|
| 598 |
%%% y coords |
| 599 |
lyc1 := 0; |
| 600 |
lyc2 := lyc1+nextup; |
| 601 |
lyc3 := lyc2+nextup; |
| 602 |
lyc4 := lyc3+nextup+irh; |
| 603 |
lyc5 := lyc4+nextup; |
| 604 |
lyc6 := lyc5+nextup; |
| 605 |
lyc7 := lyc6+nextup; |
| 606 |
lyc8 := lyc7+nextup; |
| 607 |
lyc9 := lyc8+nextup; |
| 608 |
|
| 609 |
%%% Zcol/row |
| 610 |
%%% row 1 |
| 611 |
|
| 612 |
%%% PREF for Overlapping |
| 613 |
z21bm=(xmid,lyc1); |
| 614 |
drawPREF(21, pl, ph)(btex 5,3 (8) etex) |
| 615 |
|
| 616 |
%%% row 2 |
| 617 |
|
| 618 |
%%% OverlappingArea |
| 619 |
z22bm=(x21bm,lyc2); |
| 620 |
drawENT(22, el, eh)(btex OverlappingArea etex); |
| 621 |
|
| 622 |
%%% row 3 |
| 623 |
|
| 624 |
%%% IndexArray |
| 625 |
z13=(pl,lyc3); |
| 626 |
drawISR(13, irls, irh)(btex eleven.IndexArray etex); |
| 627 |
|
| 628 |
%%% Index |
| 629 |
z23bm=(x22bm,lyc3); |
| 630 |
drawISR(23, slindex, irh)(sindex); |
| 631 |
|
| 632 |
%%% MeshLocation |
| 633 |
z33br=(maxx,lyc3); |
| 634 |
drawISR(33, irls, irh)(btex eleven.MeshLocation etex); |
| 635 |
|
| 636 |
%%% row 4 |
| 637 |
|
| 638 |
%%% MeshConnectivity |
| 639 |
z24bm=(x23bm,lyc4); |
| 640 |
drawENT(24, el, eh)(btex MeshConnectivity etex); |
| 641 |
|
| 642 |
%%% PREF for MeshConnectivity |
| 643 |
z14ml=(pl,y24ml); |
| 644 |
drawPREF(14, pl, ph)(btex 5,2 (8) etex); |
| 645 |
|
| 646 |
%%% Structured_Donor |
| 647 |
z34br=(maxx,lyc4); |
| 648 |
drawPREF(34, plnamed, ph)(btex 7,5 Structured\_Donor etex); |
| 649 |
|
| 650 |
%%% row 5 |
| 651 |
|
| 652 |
%%% Unstructured_donor |
| 653 |
z35br=(maxx,lyc5); |
| 654 |
drawPREF(35, plnamed, ph)(btex 7,4 Unstructured\_Donor etex); |
| 655 |
|
| 656 |
%%% row 6 |
| 657 |
|
| 658 |
%%% MeshConnType |
| 659 |
z36br=(maxx,lyc6); |
| 660 |
drawISR(36, irll, irh)(btex eleven.MeshConnectivityType etex); |
| 661 |
|
| 662 |
%%% row 7 |
| 663 |
|
| 664 |
%%% IndexRange |
| 665 |
z17=(0,lyc7); |
| 666 |
drawISR(17, irls, irh)(btex eleven.IndexRange etex); |
| 667 |
|
| 668 |
%%% INTEGER |
| 669 |
x27bm=x24bm; y27ml=y17mr; |
| 670 |
drawINTEGER(27); |
| 671 |
|
| 672 |
%%% Zone |
| 673 |
z37br=(maxx,lyc7); |
| 674 |
drawISR(37, irls, irh)(btex seven.Zone etex); |
| 675 |
|
| 676 |
%%% row 8 |
| 677 |
|
| 678 |
%%% 1to1 |
| 679 |
z28bm=(x24bm,lyc8); |
| 680 |
drawENT(28, el, eh)(btex MeshConnectivity1\_1 etex); |
| 681 |
|
| 682 |
%%% row 9 |
| 683 |
|
| 684 |
%%% PREF to 1to1 |
| 685 |
z29bm=(x28bm,lyc9); |
| 686 |
drawPREF(29, pl, ph)(btex 5,1 (8) etex); |
| 687 |
|
| 688 |
%%%% attributes, etc |
| 689 |
|
| 690 |
drawthickO(21tm,22bm); % PREF to Overlap (21, 22) |
| 691 |
drawthickO(14mr,24ml); % PREF to MeshConn (14, 24) |
| 692 |
drawthickO(29bm,28tm); % PREF to 1to1 (29, 28) |
| 693 |
|
| 694 |
%%% PointListSize (22, 23) |
| 695 |
drawdashO(22tm,23bm); |
| 696 |
label.llft(btex PointListSize etex, z23bm); |
| 697 |
|
| 698 |
%%% PointRange (22, 17) |
| 699 |
z22A=1/4[z22bl,z22tl]; z17A=(1/2[0,x13], y17); |
| 700 |
VH(17A,22A); |
| 701 |
drawdashthreeO(22A, 17A.vh, 17A); |
| 702 |
label.ulft(btex PointRange etex, z22A); |
| 703 |
|
| 704 |
%%% PointList (22, 13) |
| 705 |
z22B=3/4[z22bl,z22tl]; |
| 706 |
VH(13bm,22B); |
| 707 |
drawdashthreeO(22B, 13bm.vh, 13bm); |
| 708 |
label.ulft(btex PointList etex, z22B); |
| 709 |
|
| 710 |
%%% MeshLocation (22, 33) |
| 711 |
z22C=1/4[z22br,z22tr]; |
| 712 |
z33B=2/3[z33bl,z33br]; |
| 713 |
VH(33B,22C); |
| 714 |
drawnormalthreeO(22C, 33B.vh, 33B); |
| 715 |
label.urt(btex (DER) Location etex, z22C); |
| 716 |
|
| 717 |
%%% Meshloc (22, 33) |
| 718 |
z22D=3/4[z22br,z22tr]; |
| 719 |
z33A=1/3[z33bl,z33br]; |
| 720 |
VH(33A,22D); |
| 721 |
drawdashthreeO(22D, 33A.vh, 33A); |
| 722 |
label.urt(btex Meshloc etex, z22D); |
| 723 |
|
| 724 |
%%% PointListSize (24, 23) |
| 725 |
drawnormalO(24bm, 23tm); |
| 726 |
label.ulft(btex PointListSize etex, z23tm); |
| 727 |
|
| 728 |
%%% StructuredDonor (24, 34) |
| 729 |
z24A=(x24br,y34ml); |
| 730 |
draw z24A--z34ml dashes; |
| 731 |
label.lrt(btex StructuredDonor etex, z24A); |
| 732 |
|
| 733 |
%%% UnstructuredDonor (24, 35) |
| 734 |
z24B=3/4[z24br,z24tr]; |
| 735 |
HvH(24B,35ml); |
| 736 |
drawdashfourO(24B, 24B.hvh, 35ml.hvh, 35ml); |
| 737 |
label.urt(btex UnstructuredDonor etex, z24B.hvh); |
| 738 |
|
| 739 |
%%% Meshloc (24, 33) |
| 740 |
z24C=4/6[z24bl,z24br]; |
| 741 |
z33C=(x33A,y33tm); |
| 742 |
y2433C=1/3[y33C,y24C]; |
| 743 |
VyV(24C, 2433C, 33C); |
| 744 |
drawdashfourO(24C, 24C.vyv, 33C.vyv, 33C); |
| 745 |
label.lrt(btex Meshloc etex, z24C.vyv); |
| 746 |
|
| 747 |
%%% Location (24, 33) |
| 748 |
z24D=5/6[z24bl,z24br]; |
| 749 |
z33D=(x33B,y33tm); |
| 750 |
y2433D=2/3[y33D,y24D]; |
| 751 |
VyV(24D, 2433D, 33D); |
| 752 |
drawnormalfourO(24D, 24D.vyv, 33D.vyv, 33D); |
| 753 |
label.lrt(btex (DER) Location etex, z24D.vyv); |
| 754 |
|
| 755 |
%%% ConnectivityType (24, 36) |
| 756 |
z24H=(x24D,y24tr); |
| 757 |
z36H=z36bm; |
| 758 |
y2436H=1/2[y35tr,y36br]; |
| 759 |
VyV(24H, 2436H, 36H); |
| 760 |
drawnormalfourO(24H, 24H.vyv, 36H.vyv, 36H); |
| 761 |
label.urt(btex (DER) ConnectivityType etex, z24H.vyv); |
| 762 |
|
| 763 |
%%% Meshcon (24, 36) |
| 764 |
z24G=(x24C,y24tr); |
| 765 |
z36G=z36ml; |
| 766 |
VH(24G,36G); |
| 767 |
drawdashthreeO(24G, 24G.vh, 36G); |
| 768 |
label.urt(btex Meshcon etex, z24G.vh); |
| 769 |
|
| 770 |
%%% K (24, 27) |
| 771 |
drawnormalO(24tm, 27bm); |
| 772 |
label.ulft(btex K etex, z24tm); |
| 773 |
|
| 774 |
%%% PointRange (24, 17) |
| 775 |
z24E=1/4[z24tl,z24tr]; |
| 776 |
x17br-x17E = x17A-x17bl; |
| 777 |
y17E = y17A; |
| 778 |
VhV(24E,17E); |
| 779 |
drawdashfourO(24E, 24E.vhv, 17E.vhv, 17E); |
| 780 |
label.ulft(btex PointRange etex, z24E); |
| 781 |
|
| 782 |
%%% PointList (24, 13) |
| 783 |
z24F=1/4[z24bl,z24br]; |
| 784 |
z13F=1/2[z13tl,z13tr]; |
| 785 |
VhV(24F,13F); |
| 786 |
drawnormalfourO(24F, 24F.vhv, 13F.vhv, 13F); |
| 787 |
label.llft(btex PointList etex, z24F); |
| 788 |
|
| 789 |
%%% N (28, 27) |
| 790 |
z27A=1/5[z27tl,z27tr]; |
| 791 |
z28A=(x27A,y28bl); |
| 792 |
drawnormalO(28A,27A); |
| 793 |
label.llft(btex N etex, z28A); |
| 794 |
|
| 795 |
%%% trans (28, 27) |
| 796 |
z27B=1/2[z27tl,z27tr]; |
| 797 |
z28B=(x27B,y28bl); |
| 798 |
drawdashO(28B,27B); |
| 799 |
label.lrt(btex \twolines{trans}{A[1:N]} etex, z28B); |
| 800 |
|
| 801 |
%%% Transform (28, 27) |
| 802 |
z27C=1/2[z27br,z27tr]; |
| 803 |
z28C=(1/2[x27C,x28br], y28br); |
| 804 |
VH(28C,27C); |
| 805 |
drawnormalthreeO(28C,28C.vh,27C); |
| 806 |
label.lrt(btex (DER) Transform A[1:N] etex , z28C); |
| 807 |
|
| 808 |
%%% DonorZone (28, 37) |
| 809 |
z28D=1/2[z28br,z28tr]; |
| 810 |
z37D=z37tm; |
| 811 |
VH(37D,28D); |
| 812 |
drawdashthreeO(28D,37D.vh,37D); |
| 813 |
label.urt(btex DonorZone etex, z28D); |
| 814 |
|
| 815 |
%%% DonorPointRange (28, 17) |
| 816 |
z28G=3/4[z28bl,z28tl]; |
| 817 |
z17G=(x17A,y17tl); |
| 818 |
VH(17G,28G); |
| 819 |
drawnormalthreeO(28G,17G.vh,17G); |
| 820 |
label.ulft(btex DonorPointRange etex, z28G); |
| 821 |
|
| 822 |
%%% PointRange (28, 17) |
| 823 |
z28H=1/4[z28bl,z28tl]; |
| 824 |
z17H=(x17E,y17G); |
| 825 |
VH(17H,28H); |
| 826 |
drawnormalthreeO(28H,17H.vh,17H); |
| 827 |
label.ulft(btex PointRange etex, z28H); |
| 828 |
|
| 829 |
endfig; % end fig 5 |
| 830 |
|
| 831 |
|
| 832 |
beginfig(6) % example 6 EXPRESS-G |
| 833 |
%%%drawgrid; |
| 834 |
|
| 835 |
upshift := 3/2onelineh; |
| 836 |
nextup := onelineh+upshift; |
| 837 |
|
| 838 |
el := namespace(btex manufacturer etex)(nextra); |
| 839 |
eh := onelineh; |
| 840 |
|
| 841 |
hspace1 := 1/2el; |
| 842 |
|
| 843 |
%%% y coords |
| 844 |
lyc1 := 0; |
| 845 |
lyc2 := lyc1+nextup; |
| 846 |
lyc3 := lyc2+nextup; |
| 847 |
lyc4 := lyc3+nextup; |
| 848 |
lyc5 := lyc4+nextup; |
| 849 |
|
| 850 |
%%% Zcol/row |
| 851 |
|
| 852 |
%%% rows 4 and 5 |
| 853 |
z14=(0,lyc4); |
| 854 |
drawENT(14, el, eh)(btex manufacturer etex); |
| 855 |
|
| 856 |
z25=(x14br+hspace1, lyc5); |
| 857 |
drawSTRING(25); |
| 858 |
|
| 859 |
z34=(x25br+hspace1, lyc4); |
| 860 |
drawENT(34, el, eh)(btex car\_model etex); |
| 861 |
|
| 862 |
%%% row 3 |
| 863 |
|
| 864 |
z33bm=(x34bm, lyc3); |
| 865 |
drawENT(33, el, eh)(btex car etex); |
| 866 |
|
| 867 |
%%% row 2 |
| 868 |
|
| 869 |
z22=(x25, lyc2); |
| 870 |
drawINTEGER(22); |
| 871 |
|
| 872 |
%%% row 1 |
| 873 |
|
| 874 |
z21=(x22, lyc1); |
| 875 |
drawSTRING(21); |
| 876 |
|
| 877 |
%%% attributes |
| 878 |
|
| 879 |
%%% manufacturer name (14, 25) |
| 880 |
VH(14tm, 25ml); |
| 881 |
drawnormalthreeO(14tm, 14tm.vh, 25ml); |
| 882 |
label.urt(btex *name etex, z14tm.vh); |
| 883 |
|
| 884 |
%%% model name (34, 25) |
| 885 |
VH(34tm, 25mr); |
| 886 |
drawnormalthreeO(34tm, 34tm.vh, 25mr); |
| 887 |
label.ulft(btex *name etex, z34tm.vh); |
| 888 |
|
| 889 |
%%% made_by (34, 14) |
| 890 |
drawnormalO(34ml, 14mr); |
| 891 |
label.ulft(btex made\_by etex, z34ml); |
| 892 |
|
| 893 |
%%% model_type (33, 34) |
| 894 |
drawnormalO(33tm, 34bm); |
| 895 |
label.urt(btex model\_type etex, z33tm); |
| 896 |
|
| 897 |
%%% DER made_by (33, 14) |
| 898 |
VH(14bm, 33ml); |
| 899 |
drawnormalthreeO(33ml, 14bm.vh, 14bm); |
| 900 |
label.ulft(btex (DER) *made\_by etex, z33ml); |
| 901 |
|
| 902 |
%%% year (33, 22) |
| 903 |
z33A=1/3[z33bl, z33br]; |
| 904 |
VH(33A, 22mr); |
| 905 |
drawnormalthreeO(33A, 33A.vh, 22mr); |
| 906 |
label.ulft(btex year etex, z33A.vh); |
| 907 |
|
| 908 |
%%% serial_no |
| 909 |
z33B=2/3[z33bl, z33br]; |
| 910 |
VH(33B, 21mr); |
| 911 |
drawnormalthreeO(33B, 33B.vh, 21mr); |
| 912 |
label.ulft(btex *serial\_no etex, z33B.vh); |
| 913 |
|
| 914 |
endfig; % end fig 6 |
| 915 |
|
| 916 |
|
| 917 |
beginfig(7) % example 7 |
| 918 |
%%%drawgrid; |
| 919 |
|
| 920 |
el := namespace(btex MANUFACTURER etex)(niextra); |
| 921 |
eh := onelineh; |
| 922 |
|
| 923 |
hspace1 := namespace(btex made by maker of etex)(4ndextra); |
| 924 |
|
| 925 |
hspace2 := 6onelineh; % height of CAR |
| 926 |
hspace3 := 5onelineh; % space between rows |
| 927 |
hspace4 := 3onelineh; % height of MANUFACTURER |
| 928 |
|
| 929 |
%%% y coords |
| 930 |
lyc1 := 0; |
| 931 |
lyc2 := lyc1+hspace2+hspace3; |
| 932 |
|
| 933 |
%%% Zcol/row |
| 934 |
|
| 935 |
%%% row 2 |
| 936 |
|
| 937 |
z12=(0, lyc2); |
| 938 |
drawENT(12, el, hspace4)(""); |
| 939 |
x121=x12+sdtbs; |
| 940 |
label.rt(btex MANUFACTURER etex, (x121, 2/3[y12bl, y12tl])); |
| 941 |
label.rt(btex * manuf-name etex, (x121, 1/3[y12bl, y12tl])); |
| 942 |
|
| 943 |
z22=(x12br+hspace1, lyc2); |
| 944 |
drawENT(22, el, hspace4)(""); |
| 945 |
x221=x22+sdtbs; |
| 946 |
label.rt(btex CAR-MODEL etex, (x221, 2/3[y12bl, y12tl])); |
| 947 |
label.rt(btex * model-name etex, (x221, 1/3[y12bl, y12tl])); |
| 948 |
|
| 949 |
%%% row 1 |
| 950 |
|
| 951 |
z21=(x22, lyc1); |
| 952 |
drawENT(21, el, hspace2)(""); |
| 953 |
x211=x21+sdtbs; |
| 954 |
label.rt(btex CAR etex, (x211, 5/6[y21bl, y21tl])); |
| 955 |
label.rt(btex o year etex, (x211, 4/6[y21bl, y21tl])); |
| 956 |
label.rt(btex o model (R) etex, (x211, 3/6[y21bl, y21tl])); |
| 957 |
label.rt(btex * serial-no etex, (x211, 2/6[y21bl, y21tl])); |
| 958 |
label.rt(btex * maker (R) etex, (x211, 1/6[y21bl, y21tl])); |
| 959 |
|
| 960 |
%%%%% relationship lines |
| 961 |
|
| 962 |
%%% MANUFACTURER / CAR-MODEL (12, 22) |
| 963 |
drawnormalDCA(12mr, 22ml); |
| 964 |
drawnormalCA(22ml, 12mr); |
| 965 |
label.urt(btex { }{ }made by etex, z12mr); |
| 966 |
label.llft(btex maker of{ }{ } etex, z22ml); |
| 967 |
|
| 968 |
%%% MANUFACTURER / CAR (12, 21) |
| 969 |
VH(12bm, 21ml); |
| 970 |
drawnormalCA(12bm.vh, 12bm); |
| 971 |
drawnormalDCA(12bm.vh, 21ml); |
| 972 |
label.llft(btex { }{ }made by etex, z12bm); |
| 973 |
label.ulft(btex maker of{ }{ } etex, z21ml); |
| 974 |
|
| 975 |
%%% CAR-MODEL / CAR (22, 21) |
| 976 |
drawnormalDCA(22bm, 21tm); |
| 977 |
drawnormalCA(21tm, 22bm); |
| 978 |
label.lrt(btex { }one of etex, z22bm); |
| 979 |
label.ulft(btex type of{ } etex, z21tm); |
| 980 |
|
| 981 |
endfig; % end fig 7 |
| 982 |
|
| 983 |
|
| 984 |
beginfig(8) % example 8 IDEF1X |
| 985 |
%%%drawgrid; |
| 986 |
|
| 987 |
el := namespace(btex MANUFACTURER etex)(niextra); |
| 988 |
eh := onelineh; |
| 989 |
|
| 990 |
hspace1 := namespace(btex made by maker of etex)(4ndextra); |
| 991 |
|
| 992 |
hspace2 := 5onelineh; % height of CAR |
| 993 |
hspace3 := 5onelineh; % space between rows |
| 994 |
hspace4 := 3onelineh; % height of MANUFACTURER |
| 995 |
|
| 996 |
%%% y coords |
| 997 |
lyc1 := 0; |
| 998 |
lyc2 := lyc1+hspace2+hspace3; |
| 999 |
|
| 1000 |
%%% Zcol/row |
| 1001 |
|
| 1002 |
%%% row 2 |
| 1003 |
|
| 1004 |
z12=(0, lyc2); |
| 1005 |
drawdoublerectangle(12, el, hspace4, 1/2); |
| 1006 |
label.urt(btex Manufacturer etex, z12tl); |
| 1007 |
x121=x12+sdtbs; |
| 1008 |
label.rt(btex manuf-name etex, (x121, 3/4[y12bl, y12tl])); |
| 1009 |
|
| 1010 |
z22=(x12br+hspace1, lyc2); |
| 1011 |
drawdoublerectangle(22, el, hspace4, 1/2); |
| 1012 |
label.urt(btex Car-model etex, z22tl); |
| 1013 |
x221=x22+sdtbs; |
| 1014 |
label.rt(btex Model-name etex, (x221, 3/4[y12bl, y12tl])); |
| 1015 |
label.rt(btex Manuf-name (FK) etex, (x221, 1/4[y12bl, y12tl])); |
| 1016 |
|
| 1017 |
%%% row 1 |
| 1018 |
|
| 1019 |
z21=(x22, lyc1); |
| 1020 |
drawroundedbox(21, el, hspace2, 2sdtbs)(""); |
| 1021 |
label.urt(btex Car etex, z21tl); |
| 1022 |
draw z21ml--z21mr; |
| 1023 |
x211=x21+sdtbs; |
| 1024 |
label.rt(btex Serial-no etex, (x211, 5/6[y21bl, y21tl])); |
| 1025 |
label.rt(btex Manuf-name (FK) etex, (x211, 4/6[y21bl, y21tl])); |
| 1026 |
label.rt(btex Model-name (FK) etex, (x211, 2/6[y21bl, y21tl])); |
| 1027 |
label.rt(btex Year etex, (x211, 1/6[y21bl, y21tl])); |
| 1028 |
|
| 1029 |
%%%%% relationship lines |
| 1030 |
|
| 1031 |
%%% MANUFACTURER / CAR-MODEL (12, 22) |
| 1032 |
drawnormalD(12mr, 22ml); |
| 1033 |
label.top(btex of etex, 1/2[z12mr, z22ml]); |
| 1034 |
|
| 1035 |
%%% MANUFACTURER / CAR (12, 21) |
| 1036 |
VH(12bm, 21ml); |
| 1037 |
drawnormalthreeD(12bm, 12bm.vh, 21ml); |
| 1038 |
label.top(btex makes etex, 1/2[z12bm.vh, z21ml]); |
| 1039 |
label.ulft(btex P{ } etex, z21ml); |
| 1040 |
|
| 1041 |
%%% CAR-MODEL / CAR (22, 21) |
| 1042 |
drawnormalD(22bm, 21tm); |
| 1043 |
label.lft(btex of etex, 1/2[z21tm,z22bm]); |
| 1044 |
label.urt(btex { }P etex, z21tm); |
| 1045 |
|
| 1046 |
endfig; % end fig 8 |
| 1047 |
|
| 1048 |
|
| 1049 |
beginfig(9) % example 9 OMT |
| 1050 |
%%%drawgrid; |
| 1051 |
|
| 1052 |
el := namespace(btex {\bf MANUFACTURER} etex)(niextra); |
| 1053 |
eh := onelineh; |
| 1054 |
|
| 1055 |
hspace1 := namespace(btex made by maker of etex)(4ndextra); |
| 1056 |
|
| 1057 |
hspace2 := 4onelineh; % height of CAR |
| 1058 |
hspace3 := 4onelineh; % space between rows |
| 1059 |
hspace4 := 3onelineh; % height of MANUFACTURER |
| 1060 |
|
| 1061 |
%%% y coords |
| 1062 |
lyc1 := 0; |
| 1063 |
lyc2 := lyc1+hspace2+hspace3; |
| 1064 |
|
| 1065 |
%%% Zcol/row |
| 1066 |
|
| 1067 |
%%% row 2 |
| 1068 |
|
| 1069 |
z12=(0, lyc2); |
| 1070 |
drawdoublerectangle(12, el, hspace4, 1/2); |
| 1071 |
x121=x12+sdtbs; |
| 1072 |
label.rt(btex {\bf Manufacturer} etex, (x121, 3/4[y12bl, y12tl])); |
| 1073 |
label.rt(btex name : String etex, (x121, 1/4[y12bl, y12tl])); |
| 1074 |
|
| 1075 |
z22=(x12br+hspace1, lyc2); |
| 1076 |
drawdoublerectangle(22, el, hspace4, 1/2); |
| 1077 |
x221=x22+sdtbs; |
| 1078 |
label.rt(btex {\bf Car Model} etex, (x221, 3/4[y22bl, y22tl])); |
| 1079 |
label.rt(btex name: String etex, (x221, 1/4[y22bl, y22tl])); |
| 1080 |
|
| 1081 |
%%% row 1 |
| 1082 |
|
| 1083 |
z21=(x22, lyc1); |
| 1084 |
drawdoublerectangle(21, el, hspace2, 1/3); |
| 1085 |
x211=x21+sdtbs; |
| 1086 |
label.rt(btex {\bf Car} etex, (x211, 5/6[y21bl, y21tl])); |
| 1087 |
label.rt(btex serial-no : String etex, (x211, 4/9[y21bl, y21tl])); |
| 1088 |
label.rt(btex year : Integer etex, (x211, 2/9[y21bl, y21tl])); |
| 1089 |
|
| 1090 |
%%%%% relationship lines |
| 1091 |
|
| 1092 |
%%% MANUFACTURER / CAR-MODEL (12, 22) |
| 1093 |
drawnormalD(12mr, 22ml); |
| 1094 |
label.top(btex {\it makes} etex, 1/2[z12mr, z22ml]); |
| 1095 |
label.ulft(btex 1+{ } etex, z22ml); |
| 1096 |
|
| 1097 |
%%% MANUFACTURER / CAR (12, 21) |
| 1098 |
VH(12bm, 21ml); |
| 1099 |
drawnormalthreeD(12bm, 12bm.vh, 21ml); |
| 1100 |
label.top(btex {\it makes} etex, 1/2[z12bm.vh, z21ml]); |
| 1101 |
label.ulft(btex 1+{ } etex, z21ml); |
| 1102 |
|
| 1103 |
%%% CAR-MODEL / CAR (22, 21) |
| 1104 |
drawnormalD(22bm, 21tm); |
| 1105 |
label.lft(btex {\it produced as} etex, 1/2[z21tm,z22bm]); |
| 1106 |
|
| 1107 |
endfig; % end fig 9 |
| 1108 |
|
| 1109 |
|
| 1110 |
beginfig(10) % example 10 E-R |
| 1111 |
%%%drawgrid; |
| 1112 |
|
| 1113 |
numeric diam; diam := 2onelineh; |
| 1114 |
|
| 1115 |
upshift := diam; % circle diameter |
| 1116 |
nextup := diam+upshift; |
| 1117 |
|
| 1118 |
el := namespace(btex MANUFACTURER etex)(niextra); |
| 1119 |
eh := onelineh; |
| 1120 |
|
| 1121 |
numeric dl, dh; % length and height of diamond boxes |
| 1122 |
dl := 1/2el; dh := 2eh; |
| 1123 |
|
| 1124 |
numeric marg; marg := 4u; % double the seperation between parallel lines |
| 1125 |
|
| 1126 |
hspace1 := 1/2el; |
| 1127 |
|
| 1128 |
%%% y coords |
| 1129 |
lyc1 := 0; |
| 1130 |
lyc2 := lyc1+nextup; |
| 1131 |
lyc3 := lyc2+nextup; |
| 1132 |
lyc4 := lyc3+nextup; |
| 1133 |
lyc5 := lyc4+nextup; |
| 1134 |
|
| 1135 |
%%% Zcol/row |
| 1136 |
%%% row 4 |
| 1137 |
|
| 1138 |
z14=(0,lyc4); |
| 1139 |
drawENT(14, el, eh)(btex manufacturer etex); |
| 1140 |
|
| 1141 |
z34ml=(x14br+hspace1, y14mr); |
| 1142 |
drawdiamondbox(34, dl, dh)(btex has etex); |
| 1143 |
|
| 1144 |
z54ml=(x34mr+hspace1, y34mr); |
| 1145 |
drawENT(54, el, eh)(btex car\_model etex); |
| 1146 |
|
| 1147 |
%%% row 5 |
| 1148 |
|
| 1149 |
z15bm=(x14bm, lyc5); |
| 1150 |
drawcirclebox(15, diam)(btex Name etex); |
| 1151 |
|
| 1152 |
z55bm=(x54bm, lyc5); |
| 1153 |
drawcirclebox(55, diam)(btex Name etex); |
| 1154 |
|
| 1155 |
%%% row 3 |
| 1156 |
|
| 1157 |
z53bm=(x54bm, lyc3); |
| 1158 |
drawdiamondbox(53, dl, dh)(btex of etex); |
| 1159 |
|
| 1160 |
z13c=(x14bm, y53c); |
| 1161 |
drawtwodiamondbox(13, dl+marg, dh+marg, 2/5marg)(btex Makes etex); |
| 1162 |
|
| 1163 |
%%% row 2 |
| 1164 |
|
| 1165 |
z32bm=(x34bm, lyc2); |
| 1166 |
drawENT(32, el, eh)(btex car etex); |
| 1167 |
z31c=z32c; |
| 1168 |
drawENT(31, el+marg, eh+marg)(""); |
| 1169 |
|
| 1170 |
%%% row 1 |
| 1171 |
|
| 1172 |
z21bm=(x32bl, lyc1); |
| 1173 |
drawcirclebox(21, 5/4diam)(btex \twolines{Serial}{No} etex); |
| 1174 |
|
| 1175 |
z41bm=(x32br, lyc1); |
| 1176 |
drawcirclebox(41, diam)(btex Year etex); |
| 1177 |
|
| 1178 |
%%%%%% lines |
| 1179 |
|
| 1180 |
%%% Name / manufacturer (15, 14) |
| 1181 |
drawnormal(15bm, 14tm); |
| 1182 |
|
| 1183 |
%%% Name / model (55, 54) |
| 1184 |
drawnormal(55bm, 54tm); |
| 1185 |
|
| 1186 |
%%% Mnf / has (14, 34) |
| 1187 |
drawnormal(14mr, 34ml); |
| 1188 |
label.top(btex 1 etex, 1/2[z14mr,z34ml]); |
| 1189 |
|
| 1190 |
%%% has/ model (34, 54) |
| 1191 |
drawnormal(34mr, 54ml); |
| 1192 |
label.top(btex N etex, 1/2[z34mr,z54ml]); |
| 1193 |
|
| 1194 |
%%% Mnf / makes (14, 13) |
| 1195 |
drawnormal(14bm, 13tm); |
| 1196 |
label.rt(btex 1 etex, 1/2[z14bm,z13tm]); |
| 1197 |
|
| 1198 |
%%% model / of (54, 53) |
| 1199 |
drawnormal(54bm, 53tm); |
| 1200 |
label.rt(btex 1 etex, 1/2[z54bm,z53tm]); |
| 1201 |
|
| 1202 |
%%% makes / car (13, 31) |
| 1203 |
drawnormal(13bm, 31ml); |
| 1204 |
z31A=(x31ml, y31ml+1/2marg); |
| 1205 |
z13U-z31A = z13bm-z31ml; |
| 1206 |
z13A = whatever[z13U,z31A] = whatever[z13bm,z13mr]; |
| 1207 |
draw z13A--z31A; |
| 1208 |
label.urt(btex N etex, 1/2[z13A,z31A]); |
| 1209 |
|
| 1210 |
%%% of / car (53, 31) |
| 1211 |
drawnormal(53bm, 31mr); |
| 1212 |
z31B=(x31mr, y31mr+1/2marg); |
| 1213 |
z53U - z31B = z53bm - z31mr; |
| 1214 |
z53B = whatever[z53U,z31B] = whatever[z53bm,z53ml]; |
| 1215 |
draw z53B--z31B; |
| 1216 |
label.ulft(btex N etex, 1/2[z53B,z31B]); |
| 1217 |
|
| 1218 |
%%% car / serial no (31, 21) |
| 1219 |
z31C=(x21tm, y31bl); |
| 1220 |
drawnormal(31C, 21tm); |
| 1221 |
|
| 1222 |
%%% car / year (31, 41) |
| 1223 |
z31D=(x41tm, y31br); |
| 1224 |
drawnormal(31D, 41tm); |
| 1225 |
|
| 1226 |
endfig; % end fig 10 |
| 1227 |
|
| 1228 |
|
| 1229 |
beginfig(11) % example 11 NIAM |
| 1230 |
%%%drawgrid; |
| 1231 |
|
| 1232 |
numeric diam; diam := 2onelineh; % circle diameter |
| 1233 |
|
| 1234 |
upshift := diam; |
| 1235 |
nextup := diam+upshift; |
| 1236 |
|
| 1237 |
numeric hel, vel; % length of horizontal and vertical box pairs |
| 1238 |
eh := onelineh; |
| 1239 |
hel = namespace(btex made by etex)(nextra); |
| 1240 |
vel = namespace(btex of prod etex)(nextra); |
| 1241 |
|
| 1242 |
numeric del, deh; % horizontal & vertical diameters of oval boxes |
| 1243 |
del := namespace(btex MANUFACTURER etex)(niextra); |
| 1244 |
deh := 2eh; |
| 1245 |
|
| 1246 |
numeric marg; marg := 2u; % margin for doubly enclosed oval boxes |
| 1247 |
numeric lmarg; lmarg := marg; % gap for short lines |
| 1248 |
|
| 1249 |
numeric dashel, dasheh; % diameters of dashed ellipses |
| 1250 |
dashel := del+2marg; |
| 1251 |
dasheh := deh+2marg; |
| 1252 |
|
| 1253 |
hspace1 := diam; |
| 1254 |
|
| 1255 |
%%% y coords |
| 1256 |
lyc1 := 0; |
| 1257 |
lyc2 := lyc1+nextup; |
| 1258 |
lyc3 := lyc2+nextup; |
| 1259 |
|
| 1260 |
%%% Zcol/row |
| 1261 |
|
| 1262 |
%%% row 3 |
| 1263 |
|
| 1264 |
x13ml=0; y13bm=lyc3; |
| 1265 |
drawovalbox(13, del, deh)(btex manufacturer etex); |
| 1266 |
z14=z13c; |
| 1267 |
drawdashellipse(14, dashel, dasheh); |
| 1268 |
|
| 1269 |
z23ml=(x14mr+hspace1, y14mr); |
| 1270 |
drawENT(23, hel, eh)(btex of etex); |
| 1271 |
|
| 1272 |
z33bl=z23br; |
| 1273 |
drawENT(33, hel, eh)(btex made by etex); |
| 1274 |
|
| 1275 |
z44ml=(x33mr+hspace1, y33mr); |
| 1276 |
drawdashellipse(44, dashel, dasheh); |
| 1277 |
z43=z44c; |
| 1278 |
drawovalbox(43, del, deh)(btex car model etex); |
| 1279 |
|
| 1280 |
z53ml=(x44mr+hspace1, y44mr); |
| 1281 |
drawdashcircle(53, diam); |
| 1282 |
label(btex year etex, z53c); |
| 1283 |
|
| 1284 |
%%% row 2 |
| 1285 |
|
| 1286 |
z22c=(x23bm,lyc2); |
| 1287 |
drawcirclebox(22, namespace(btex U etex)(2nextra))(btex U etex); |
| 1288 |
|
| 1289 |
x42tm=x43bm; y42ml=lyc2; |
| 1290 |
drawdoublerectangle(42, vel, 2eh, 1/2); |
| 1291 |
label(btex of etex, z42ct); |
| 1292 |
label(btex is of etex, z42cb); |
| 1293 |
|
| 1294 |
%%z52c=(x53x,lyc2); |
| 1295 |
x52tm=x53bm; y52ml=lyc2; |
| 1296 |
drawdoublerectangle(52, vel, 2eh, 1/2); |
| 1297 |
label(btex of prod etex, z52ct); |
| 1298 |
label(btex prod in etex, z52cb); |
| 1299 |
|
| 1300 |
%%% row 1 |
| 1301 |
|
| 1302 |
z11ml=(x13ml,lyc1); |
| 1303 |
drawdashellipse(11, del, deh); |
| 1304 |
label(btex serial no etex, z11c); |
| 1305 |
|
| 1306 |
z21ml=(x23ml,lyc1); |
| 1307 |
drawENT(21, hel, eh)(btex of etex); |
| 1308 |
|
| 1309 |
z31bl=z21br; |
| 1310 |
drawENT(31, hel, eh)(btex has etex); |
| 1311 |
|
| 1312 |
z41c=(x43c,lyc1); |
| 1313 |
drawcirclebox(41, diam)(btex car etex); |
| 1314 |
|
| 1315 |
%%%%%% lines |
| 1316 |
|
| 1317 |
%%% manufacturer / of (14, 23) |
| 1318 |
drawnormal(14mr, 23ml); |
| 1319 |
|
| 1320 |
%%% made by / car model (33, 44) |
| 1321 |
drawnormal(33mr, 44ml); |
| 1322 |
draw (x33tl, y33tl+lmarg)--(x33tr, y33tl+lmarg); |
| 1323 |
draw (x33mr, y33mr+lmarg)--(x33mr+eh, y33mr+lmarg); |
| 1324 |
|
| 1325 |
%%% serial no / of (11, 21) |
| 1326 |
drawnormal(11mr, 21ml); |
| 1327 |
|
| 1328 |
%%% of / of (23, 22, 21) |
| 1329 |
drawnormal(23bm, 22tm); drawnormal(22bm, 21tm); |
| 1330 |
label.rt(btex id etex, z22mr); |
| 1331 |
|
| 1332 |
%%% has / car (31, 41) |
| 1333 |
drawnormal(31mr, 41ml); |
| 1334 |
draw (x31tl, y31tl+lmarg)--(x31tr, y31tl+lmarg); |
| 1335 |
draw (x31mr, y31mr+lmarg)--(x33mr+eh, y31mr+lmarg); |
| 1336 |
|
| 1337 |
%%% model / of (44, 42) |
| 1338 |
drawnormal(43bm, 42tm); |
| 1339 |
|
| 1340 |
%%% is of / car (42, 41) |
| 1341 |
drawnormal(42bm, 41tm); |
| 1342 |
draw (x42tfr+lmarg, y42tfr)--(x42tfr+lmarg, y42br); |
| 1343 |
draw (x42bm+lmarg, y42bm)--(x42bm+lmarg, y42bm-eh); |
| 1344 |
|
| 1345 |
%%% year / of prod (53, 52) |
| 1346 |
drawnormal(53bm, 52tm); |
| 1347 |
|
| 1348 |
%%% prod in / car (52, 41) |
| 1349 |
VH(52bm,41mr); |
| 1350 |
drawnormalthree(52bm, 52bm.vh, 41mr); |
| 1351 |
draw (x52tfr+lmarg, y52tfr)--(x52tfr+lmarg, y52br); |
| 1352 |
draw (x52bm+lmarg, y52bm)--(x52bm+lmarg, y52bm-eh); |
| 1353 |
|
| 1354 |
endfig; % end fig 11 |
| 1355 |
|
| 1356 |
end |
| 1357 |
|