| 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 |
HumanInfoCopy.iDwarf(iHuman); |
| 21 |
iDwarf.width := 60; |
| 22 |
iDwarf.height := 20; |
| 23 |
iDwarf.foreColor := blue; |
| 24 |
iDwarf.shadeColor := .8blue; |
| 25 |
|
| 26 |
beginfig(1); |
| 27 |
Human.h; |
| 28 |
drawObject(h); |
| 29 |
draw objectBox(h); |
| 30 |
|
| 31 |
Human.h1; |
| 32 |
h1.n = (35, 0); |
| 33 |
h1.info.foreColor := red; |
| 34 |
drawObject(h1); |
| 35 |
|
| 36 |
Human.h2; |
| 37 |
h2.info.height := 90; |
| 38 |
h2.nw = (50,0); |
| 39 |
drawObject(h2); |
| 40 |
draw objectBox(h2); |
| 41 |
|
| 42 |
EHuman.d(iDwarf); |
| 43 |
drawObjectAt(d)(d.s = (10,-50)); |
| 44 |
|
| 45 |
EHuman.d2(iDwarf); |
| 46 |
d2.info.shadeColor := red; |
| 47 |
drawObjectAt(d2)(d2.s = (10,-80)); |
| 48 |
endfig; |
| 49 |
|
| 50 |
beginfig(2); |
| 51 |
save a,b; |
| 52 |
|
| 53 |
Actor.a("foo"); |
| 54 |
drawObject(a); |
| 55 |
|
| 56 |
Actor.b("Actor line one", "and line two"); |
| 57 |
Actor_setDebugMode.b; |
| 58 |
b.n = (70,0); |
| 59 |
drawObject(b); |
| 60 |
endfig; |
| 61 |
|
| 62 |
beginfig(3); |
| 63 |
Usecase.u("foo"); |
| 64 |
drawObject(u); |
| 65 |
|
| 66 |
draw objectBox(u) withpen pencircle scaled .1; |
| 67 |
|
| 68 |
draw u.n withpen pencircle scaled 2 withcolor red; |
| 69 |
draw u.s withpen pencircle scaled 2 withcolor red; |
| 70 |
draw u.e withpen pencircle scaled 2 withcolor red; |
| 71 |
draw u.w withpen pencircle scaled 2 withcolor red; |
| 72 |
|
| 73 |
draw u.ulft withpen pencircle scaled 2 withcolor blue; |
| 74 |
draw u.urt withpen pencircle scaled 2 withcolor blue; |
| 75 |
draw u.llft withpen pencircle scaled 2 withcolor blue; |
| 76 |
draw u.lrt withpen pencircle scaled 2 withcolor blue; |
| 77 |
|
| 78 |
Usecase.login("Log in for an eagerly", "awaiting user", "which spans well into a very long 3rd line."); |
| 79 |
login.s = (0, 5); |
| 80 |
drawObject(login); |
| 81 |
|
| 82 |
Usecase.t("Line 1 goo bar", "Line 2"); |
| 83 |
t.s = login.n + (0,10); |
| 84 |
drawObject(t); |
| 85 |
|
| 86 |
Usecase.q("Line 1 abcdefg hij", "abcde", "Line 3 abc def ghe jkl", "Line 4 x"); |
| 87 |
q.s = t.n + (0,10); |
| 88 |
drawObject(q); |
| 89 |
|
| 90 |
endfig; |
| 91 |
|
| 92 |
beginfig(4); |
| 93 |
Actor.userA("User A2", "line 2", "line 3 long long long"); |
| 94 |
% Any Actor object is made of two sub-objects: nameStack and human. |
| 95 |
% Each individual picture in the nameStack can be configured individually. |
| 96 |
% |
| 97 |
% However, it is not possible to configure all the lines in the nameStack at |
| 98 |
% once now, saying something like: |
| 99 |
% |
| 100 |
% userA.nameStack.info.iPict.iFont.scale := 3; |
| 101 |
% |
| 102 |
% This happens because the information above is copied into the Picture objects |
| 103 |
% in the Actor constructor (and it is useless to modify it afterwards). |
| 104 |
% |
| 105 |
% If you do want to make such global modifications of the settings, see the |
| 106 |
% next two examples. |
| 107 |
|
| 108 |
userA.nameStack.pict[0].info.iFont.scale := 1.2; |
| 109 |
userA.nameStack.pict[1].info.iFont.scale := .7; |
| 110 |
userA.nameStack.info.borderColor := blue; |
| 111 |
userA.nameStack.info.boxed := 1; |
| 112 |
userA.nameStack.group.info.left := 30; |
| 113 |
userA.nameStack.group.info.right := 5; |
| 114 |
userA.human.info.foreColor := red; |
| 115 |
|
| 116 |
drawObject(userA); |
| 117 |
%draw objectBox(userA.nameStack); |
| 118 |
%draw objectBox(userA.human); |
| 119 |
endfig; |
| 120 |
|
| 121 |
beginfig(5); |
| 122 |
save userA; |
| 123 |
% If you want to have preset a info for specific objects |
| 124 |
|
| 125 |
ActorInfoCopy.iBig(iActor); |
| 126 |
|
| 127 |
% ActorInfo contains info-s for two objects |
| 128 |
% iNameStack: for the stack representing the actor's name |
| 129 |
% iHuman: for the little human |
| 130 |
|
| 131 |
iBig.iNameStack.iPict.iFont.scale := 3; |
| 132 |
iBig.iNameStack.spacing := 25; |
| 133 |
iBig.iHuman.height := 25; |
| 134 |
|
| 135 |
EActor.userA(iBig)("User A", "Specifically configured"); |
| 136 |
drawObject(userA); |
| 137 |
endfig; |
| 138 |
|
| 139 |
beginfig(6); |
| 140 |
save userA; |
| 141 |
|
| 142 |
iActor.iNameStack.iPict.iFont.scale := 2; |
| 143 |
iActor.iNameStack.spacing := 18; |
| 144 |
|
| 145 |
Actor.userA("User A", "Globally configured"); |
| 146 |
drawObject(userA); |
| 147 |
endfig; |
| 148 |
|
| 149 |
beginfig(7); |
| 150 |
save usecaseA; |
| 151 |
Usecase.usecaseA("A highly customizable", "usecase. Foo bar!"); |
| 152 |
usecaseA.info.iNameStack.iPict.iFont.scale := .5; |
| 153 |
drawObject(usecaseA); |
| 154 |
endfig; |
| 155 |
|
| 156 |
beginfig(8); |
| 157 |
save usecaseA; |
| 158 |
Usecase.usecaseA("A highly customizable", "usecase. Foo bar 2!"); |
| 159 |
usecaseA.info.iNameStack.iPict.iFont.scale := 1.1; |
| 160 |
usecaseA.info.foreColor := red; |
| 161 |
usecaseA.info.borderColor := blue; |
| 162 |
usecaseA.info.iShade.background := green; |
| 163 |
usecaseA.info.iShade.shift := 4; |
| 164 |
drawObject(usecaseA); |
| 165 |
endfig; |
| 166 |
|
| 167 |
beginfig(9); |
| 168 |
save usecaseA; |
| 169 |
UsecaseInfoCopy.iMyUsecase(iUsecase); |
| 170 |
iMyUsecase.iNameStack.iPict.iFont.scale := .6; |
| 171 |
iMyUsecase.iNameStack.spacing := 5; |
| 172 |
iMyUsecase.foreColor := green; |
| 173 |
iMyUsecase.iShade.background := red; |
| 174 |
|
| 175 |
EUsecase.usecaseA(iMyUsecase)("A highly ", " customizable usecase."); |
| 176 |
EUsecase.usecaseB(iMyUsecase)("Another very ", " customizable usecase."); |
| 177 |
|
| 178 |
usecaseB.info.iShade.background := green; |
| 179 |
|
| 180 |
leftToRight(20)(usecaseA, usecaseB); |
| 181 |
drawObjects(usecaseA, usecaseB); |
| 182 |
endfig; |
| 183 |
|
| 184 |
end |
| 185 |
|