216 |
maxwidctr(%%.maxwid, %%.cls); |
maxwidctr(%%.maxwid, %%.cls); |
217 |
|
|
218 |
%%.sep = nullpicture; |
%%.sep = nullpicture; |
219 |
addto %%.sep doublepath (0,0)--(%%.maxwid,0) withpen currentpen; |
addto %%.sep doublepath (0,0)--(%%.maxwid,0) withpen currentpen; |
220 |
%%.pict = stackpics(%%.stereo, %%.cls, %%.sep, %%.meth, %%.sep, %%.fiel); |
""" |
221 |
|
if self.fields and self.methods: |
222 |
|
s = s + """ |
223 |
|
%%.pict = stackpics(%%.stereo, %%.cls, %%.sep, %%.meth, %%.sep, %%.fiel); |
224 |
|
""" |
225 |
|
elif self.fields or self.methods: |
226 |
|
s = s + """ |
227 |
|
%%.pict = stackpics(%%.stereo, %%.cls, %%.sep, %%.meth, %%.fiel); |
228 |
|
""" |
229 |
|
else: |
230 |
|
s = s + """ |
231 |
|
%%.pict = stackpics(%%.stereo, %%.cls, %%.meth, %%.fiel); |
232 |
|
""" |
233 |
|
s = s + """ |
234 |
|
setbounds %%.pict to bbox %%.pict; |
235 |
picmeasurements(%%); |
picmeasurements(%%); |
236 |
""" |
""" |
237 |
s = s.replace("FIELDS", ", ".join( |
s = s.replace("FIELDS", ", ".join( |
265 |
s = """ |
s = """ |
266 |
picture %%.pict; |
picture %%.pict; |
267 |
%%.pict = classTitle("%name%"); |
%%.pict = classTitle("%name%"); |
268 |
|
setbounds %%.pict to bbox %%.pict; |
269 |
picmeasurements(%%); |
picmeasurements(%%); |
270 |
""" |
""" |
271 |
return self.repl(s) |
return self.repl(s) |
310 |
%%.titl = classTitle("%name%"); |
%%.titl = classTitle("%name%"); |
311 |
%%.pict = %%.titl; |
%%.pict = %%.titl; |
312 |
addto %%.pict doublepath bbox %%.titl; |
addto %%.pict doublepath bbox %%.titl; |
313 |
|
setbounds %%.pict to bbox %%.pict; |
314 |
picmeasurements(%%); |
picmeasurements(%%); |
315 |
""" |
""" |
316 |
return self.repl(s) |
return self.repl(s) |
317 |
|
def draw_code(self): |
318 |
|
s = """ |
319 |
|
drawmeasuredpic(%%); |
320 |
|
""" |
321 |
|
return self.repl(s) |
322 |
|
|
323 |
class mpinterface(navidoc.mp.SimpleElement): |
class mpinterface(navidoc.mp.SimpleElement): |
324 |
key = 'interface' |
key = 'interface' |
378 |
s = """ |
s = """ |
379 |
picture %%.titl.pict; |
picture %%.titl.pict; |
380 |
%%.titl.pict = classTitle("%name%"); |
%%.titl.pict = classTitle("%name%"); |
381 |
|
setbounds %%.titl.pict to bbox %%.titl.pict; |
382 |
addto %%.titl.pict doublepath (urcorner(%%.titl.pict)--lrcorner(%%.titl.pict)) withpen currentpen; |
addto %%.titl.pict doublepath (urcorner(%%.titl.pict)--lrcorner(%%.titl.pict)) withpen currentpen; |
383 |
addto %%.titl.pict doublepath (ulcorner(%%.titl.pict)--llcorner(%%.titl.pict)) withpen currentpen; |
addto %%.titl.pict doublepath (ulcorner(%%.titl.pict)--llcorner(%%.titl.pict)) withpen currentpen; |
384 |
addto %%.titl.pict doublepath (ulcorner(%%.titl.pict)--urcorner(%%.titl.pict)) withpen currentpen; |
addto %%.titl.pict doublepath (ulcorner(%%.titl.pict)--urcorner(%%.titl.pict)) withpen currentpen; |
457 |
if mat: |
if mat: |
458 |
self.role = mat.group(1) |
self.role = mat.group(1) |
459 |
continue |
continue |
460 |
|
mat = re.match("^multi\((.*)\)$", el) |
461 |
|
if mat: |
462 |
|
self.multi = mat.group(1) |
463 |
|
continue |
464 |
raise UMLException("Invalid assoc adorn "+el) |
raise UMLException("Invalid assoc adorn "+el) |
465 |
def setup_code(self): |
def setup_code(self): |
466 |
s = """ |
s = """ |
484 |
self.var = var or random_var() |
self.var = var or random_var() |
485 |
self.name = "" |
self.name = "" |
486 |
|
|
487 |
|
# XXX This might not be a good idea. Anyway, the point is to allow |
488 |
|
# creating very simple assoc with only "assoc foo" without '-' at start. |
489 |
|
# as in "assoc - foo". |
490 |
|
if toks.count('-') == 0: |
491 |
|
toks.insert(1, '-') |
492 |
|
|
493 |
self.a = self.end(self.var+".a", toks) |
self.a = self.end(self.var+".a", toks) |
494 |
toks.reverse() |
toks.reverse() |
495 |
self.b = self.end(self.var+".b", toks) |
self.b = self.end(self.var+".b", toks) |