Debian Codegraph @

texmf-dist/doc/metapost/base/source-manual/mpman-charts.mp

raw
1 verbatimtex
2 \def\appl#1{\applfontx#1\strut}
3 \def\ext#1{\extfontx#1\strut}
4 \font\applfontx=ec-lmri10
5 \font\extfontx=ec-lmtt10
6 \font\extfontvii=ec-lmtt8 at 7pt
7 etex
8
9 % Use the boxes package for drawing charts.
10 input boxes
11 input charts
12 %prologues:=3;
13
14 if scantokens(mpversion) < 1.200:
15 filenametemplate
16 else:
17 outputtemplate :=
18 fi
19 "%j-%c.mps";
20
21
22 beginfig(1);
23 interim applwidth := 72bp;
24 interim applheight := 28bp;
25 interim extwidth := 48bp;
26 interim extheight := 28bp;
27 interim rowscale := 56bp;
28 interim colscale := 100bp;
29 interim ahangle := 30;
30
31 % Build and draw boxes.
32 ext_rc(fig.mp, (0,0), btex \ext{fig.mp} etex);
33 appl_rc(mpost, (1,0), btex \appl{MetaPost} etex);
34 ext_rc(fig.1, (2,0), btex \ext{fig.1} etex);
35 ext_rc(doc.tex, (0,2), btex \ext{doc.tex} etex);
36 appl_rc(tex, (1,2), btex \appl{\TeX} etex);
37 ext_rc(doc.dvi, (2,2), btex \ext{doc.dvi} etex);
38 appl_rc(dvips, (3,1), btex \appl{dvips} etex);
39 ext_rc(doc.ps, (4,1), btex \ext{doc.ps} etex);
40
41 % Draw connections.
42 line(fig.mp, mpost);
43 line(mpost, fig.1);
44 line(doc.tex, tex);
45 line(tex, doc.dvi);
46 curve(fig.1, dvips, -90, 0);
47 curve(doc.dvi, dvips, -90, 180);
48 line(dvips, doc.ps);
49
50 % Draw bounding box link.
51 boxit.bb(btex
52 \vbox{
53 \hbox to 50bp {\hfil\strut bounding\hfil}
54 \hbox to 50bp {\hfil\strut box\hfil}
55 }
56 etex scaled .8);
57 path p;
58 p := fig.1.e{right}..{right}tex.w;
59 bb.c = point 0.5 of p;
60 drawunboxed(bb);
61 draw p cutafter bpath bb dashed evenly;
62 drawarrow p cutbefore subpath (1,3) of bpath bb dashed evenly;
63 endfig;
64
65
66 verbatimtex
67 \font\applfontx=ec-lmbxi10
68 etex
69
70 beginfig(2);
71 % Pre-define workflow segment parameters.
72 wfsegments := 6;% counter
73 wfsegangle = 360/wfsegments;% angle
74 wfstart := 90;% angle
75 wfdiam := 200bp;% dimension
76 wfthick := 48bp;% dimension
77 wfgap := 8;% angle
78 wfinset := 8;% angle
79
80 % Pre-define colors of some graphic elements.
81 color wf_col, appl_col, ext_col;
82 wf_col = .9white;
83 appl_col = (.1, .1, .7);
84 ext_col = 0white;
85
86 % The size of the user icon.
87 usersize := 20bp;
88
89 % Construct a workflow segment.
90 %
91 % * The anchor point of a workflow segment is at its center.
92 %
93 % * Array wfang[] stores the angle on a circle corresponding
94 % to a vertex of a workflow segment. The mapping of indices
95 % to vertices is:
96 %
97 % 2---------0
98 % / /
99 % 3 1
100 % \ \
101 % 2---------0
102 %
103 % * For array wfscale[] the mapping is:
104 %
105 % 3---------0
106 % / /
107 % < <
108 % \ \
109 % 2---------1
110 %
111 numeric wfang[], wfscale[];
112 path wfseg;
113 wfang0 = .5(-wfsegangle + wfgap - wfinset);
114 wfang1 = .5(-wfsegangle + wfgap + wfinset);
115 wfang2 = .5( wfsegangle - wfgap - wfinset);
116 wfang3 = .5( wfsegangle - wfgap + wfinset);
117 wfscale[0] = 1 + wfthick/wfdiam;
118 wfscale[1] = 1 - wfthick/wfdiam;
119 wfscale[2] = 1 - 1.0*wfthick/wfdiam;
120 wfscale[3] = 1 + 1.0*wfthick/wfdiam;
121 wfseg := 0.5dir(wfang0)*wfscale0 {dir(wfang0-180)}
122 ..{dir(wfang1+135)} 0.5dir(wfang1) {dir(wfang1-135)}
123 ..{dir(wfang0+180)} 0.5dir(wfang0)*wfscale1 {dir(wfang0+90)}
124 ..{dir(wfang2+90)} 0.5dir(wfang2)*wfscale2 {dir(wfang2)}
125 ..{dir(wfang3+45)} 0.5dir(wfang3) {dir(wfang3-45)}
126 ..{dir(wfang2)} 0.5dir(wfang2)*wfscale3 {dir(wfang2-90)}
127 ..{dir(wfang0-90)} cycle;
128
129 % Store user icon in picture variable.
130 picture unituserLeft, unituserRight;
131 unituserRight := image(
132 % This clip-art has been taken from the Open Clip-Art Library at
133 % <URL:http://www.openclipart.org/about>. The original SVG file by
134 % 'yyycatch' is licensed as Public Domain and can be found at
135 % <URL:http://www.openclipart.org/detail/18601>. It has been
136 % converted to MetaPost by exporting the SVG file to EPS in Inkscape
137 % and then coordinates, colours and pens have been manually translated
138 % to the corresponding MetaPost commands.
139 path p[];
140 p1 =
141 (39.387, 60.034) .. controls (17.117, 59.401) and (-0.352, 22.932)
142 .. (7.887, 10.565) .. controls (16.125, -1.802) and (64.465, -1.802)
143 .. (72.34, 10.565) .. controls (80.215, 22.932) and (62.383, 60.686)
144 .. cycle;
145 p2 =
146 (22.809, 52.588)
147 -- (59.93, 52.588) .. controls (59.93, 52.588) and (60.523, 15.705)
148 .. (47.293, 15.705) .. controls (34.852, 15.705) and (22.809, 52.588)
149 .. cycle;
150 p3 =
151 (69.125, 67.963) .. controls (69.125, 50.881) and (56.723, 37.037)
152 .. (41.422, 37.037) .. controls (26.125, 37.037) and (13.723, 50.881)
153 .. (13.723, 67.963) .. controls (13.723, 85.045) and (26.125, 98.893)
154 .. (41.422, 98.893) .. controls (56.633, 98.893) and (69, 85.198)
155 .. cycle;
156 p4 =
157 (31.047, 76.764) .. controls (31.047, 76.764) and (43.93, 63.147)
158 .. (57.152, 64.209) .. controls (70.398, 65.276) and (79.316, 71.444)
159 .. (79.316, 71.444) .. controls (79.316, 71.444) and (72.488, 108.674)
160 .. (41.977, 109.291) .. controls (18.086, 109.791) and (6.324, 86.862)
161 .. (2.84, 71.444) .. controls (-0.691, 55.83) and (4.152, 55.889)
162 .. (9.313, 57.221) .. controls (14.477, 58.549) and (31.047, 76.764)
163 .. cycle;
164 p5 =
165 (84.211, 30.416) .. controls (87.586, 25.877) and (85.977, 18.955)
166 .. (80.617, 14.967) .. controls (75.258, 10.979) and (68.164, 11.428)
167 .. (64.785, 15.971)
168 -- (64.734, 16.037) .. controls (62.766, 18.741) and (62.41, 30.342)
169 .. (65.918, 32.764) .. controls (69.781, 35.428) and (80.832, 34.955)
170 .. cycle;
171 interim linecap := butt;
172 interim linejoin := mitered;
173 fill p1 withcolor (1, 0.501961, 0.501961);
174 draw p1 withcolor 0.219608 withpen pencircle scaled 2.577288;
175 fill p2 withcolor 1;
176 draw p2 withcolor 0.219608 withpen pencircle scaled 2.782928;
177 fill p3 withcolor (1, 0.8, 0.666667);
178 draw p3 withcolor 0.219608 withpen pencircle scaled 3.31912;
179 fill p4 withcolor (0.827451, 0.552941, 0.372549);
180 draw p4 withcolor 0.219608 withpen pencircle scaled 3.262816;
181 fill p5 withcolor (1, 0.8, 0.666667);
182 draw p5 withcolor 0.219608 withpen pencircle scaled 2.4;
183 );
184 % Normalize user icon.
185 unituserRight := unituserRight shifted (-llcorner unituserRight -.5urcorner unituserRight);
186 unituserRight := unituserRight scaled (.5/ypart urcorner unituserRight);
187 unituserLeft := unituserRight reflectedabout ((0,0), (0,1));
188
189 % Helper function: transform location on workflow circle in
190 % degrees into cartesian coordinates.
191 def degtoxy(expr deg) =
192 (point deg/45 of fullcircle scaled wfdiam)
193 enddef;
194
195 % Draw workflow segments.
196 for i=0 upto wfsegments-1:
197 fill wfseg scaled wfdiam rotated (wfstart+i*wfsegangle) withcolor wf_col;
198 endfor
199
200 % Fill-in workflow segment descriptions.
201 label(unituserLeft scaled usersize, degtoxy(wfstart+wfsegangle*0));
202 label(btex \appl{Editor} etex, degtoxy(wfstart+wfsegangle*1)) withcolor appl_col;
203 label(btex \ext{fig.mp} etex, degtoxy(wfstart+wfsegangle*2)) withcolor ext_col;
204 label(btex \appl{MetaPost} etex, degtoxy(wfstart+wfsegangle*3)) withcolor appl_col;
205 label(btex \ext{fig.1} etex, degtoxy(wfstart+wfsegangle*4+wfsegangle/7)) withcolor ext_col;
206 label(btex \ext{fig.log} etex, degtoxy(wfstart+wfsegangle*4-wfsegangle/7)) withcolor .7[ext_col, wf_col];
207 label(btex \appl{Previewer} etex, degtoxy(wfstart+wfsegangle*5)) withcolor appl_col;
208 endfig;
209
210 end