Debian Codegraph @

texmf-dist/metapost/metauml/metauml_class_assoc.mp

raw
1 % Copyright 2005 2015 Ovidiu Gheorghies
2 % Licensed under the Apache License, Version 2.0.
3
4 if known _metauml_class_assoc_mp:
5 expandafter endinput
6 fi;
7 _metauml_class_assoc_mp:=1;
8
9 % Sadly, this copy of the macro is needed to prevent multiple file loads being shown by MetaPost.
10 % The guard values (such as _metauml_mp) do ensure that the file isn't loaded multiple times,
11 % but this macro makes sure that MetaPost won't try to load the file and display a message for that.
12 def inputonce text libraryFile=
13 if not known scantokens ("_" & str libraryFile & "_mp"):
14 %includeonce% show "Loading " & str libraryFile;
15 scantokens ("input " & str libraryFile);
16 else:
17 %includeonce% show str libraryFile & " already loaded.";
18 fi;
19 enddef;
20
21 inputonce util_log;
22 inputonce metauml_defaults;
23
24 FontInfo.assocFont(metauml_defaultFont, .7);
25 PictureInfo.iAssoc(2, 2, 2, 2)(assocFont);
26 iAssoc.ignoreNegativeBase := 1;
27
28 vardef QualifiedAssociationInfo@#=
29 color @#background;
30 color @#borderColor;
31 numeric @#borderScale;
32
33 @#background := .9white;
34 @#borderColor := black;
35 @#borderScale := .5;
36
37 FontInfo.@#iFont(metauml_defaultFont, .9);
38 PictureInfo.@#iPict(2, 2, 2, 2)(@#iFont);
39 PictureStackInfo.@#iStack(2, 2, 1, 1)(7)(@#iPict);
40
41 @#iStack.iPict.ignoreNegativeBase := 1;
42 enddef;
43
44 vardef QualifiedAssociationInfoCopy@#(text src)=
45 color @#background;
46 color @#borderColor;
47 numeric @#borderScale;
48
49 @#background := src.background;
50 @#borderColor := src.borderColor;
51 @#borderScale := src.borderScale;
52
53 FontInfoCopy.@#iFont(src.iFont);
54 PictureInfoCopy.@#iPict(src.iPict);
55 PictureStackInfoCopy.@#iStack(src.iStack);
56 enddef;
57
58 QualifiedAssociationInfo.iQualifiedAssociation;
59
60 %
61 % QualifiedAssociation
62 %
63 vardef EQualifiedAssociation@#(text _info)(text qualifiedAssociations) =
64 ObjectEquations(@#);
65 @#className := "QualifiedAssociation";
66
67 QualifiedAssociationInfoCopy.@#info(_info);
68
69 EPictureStack.@#elementsStack(@#info.iStack)(qualifiedAssociations)("vleftbase");
70
71 @#nw = @#elementsStack.nw;
72 @#se = @#elementsStack.se;
73 enddef;
74
75 vardef QualifiedAssociation@#(text qualifiedAssociations)=
76 EQualifiedAssociation@#(iQualifiedAssociation)(qualifiedAssociations);
77 enddef;
78
79 vardef QualifiedAssociation_paintSkin@# =
80 log "Painting qualifiedAssociation skin...";
81
82 fill objectBox(@#) withcolor @#info.background;
83
84 draw objectBox(@#)
85 withpen pencircle scaled @#info.borderScale withcolor @#info.borderColor;
86 enddef;
87
88 vardef QualifiedAssociation_draw@# =
89 PictureStack_layout.@#elementsStack;
90
91 QualifiedAssociation_paintSkin.@#;
92 drawObject(@#elementsStack);
93 enddef;