Debian Codegraph @

texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.ee.IEC.code.tex

raw
1 % Copyright 2018 by Till Tantau and others Wibrow
2 %
3 % This file may be distributed and/or modified
4 %
5 % 1. under the LaTeX Project Public License and/or
6 % 2. under the GNU Public License.
7 %
8 % See the file doc/generic/pgf/licenses/LICENSE for more details.
9
10
11 %
12 % Resistor shape based on a zig-zag-line
13 %
14
15 \pgfdeclareshape{var resistor IEC}
16 {%
17 \inheritsavedanchors[from=rectangle ee]%
18 \inheritanchor[from=rectangle ee]{center}%
19 \inheritanchor[from=rectangle ee]{north}%
20 \inheritanchor[from=rectangle ee]{south}%
21 \inheritanchor[from=rectangle ee]{east}%
22 \inheritanchor[from=rectangle ee]{west}%
23 \inheritanchor[from=rectangle ee]{north east}%
24 \inheritanchor[from=rectangle ee]{north west}%
25 \inheritanchor[from=rectangle ee]{south east}%
26 \inheritanchor[from=rectangle ee]{south west}%
27 \inheritanchor[from=rectangle ee]{input}%
28 \inheritanchor[from=rectangle ee]{output}%
29 \inheritanchorborder[from=rectangle ee]%
30
31 \backgroundpath{
32 \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}
33 \pgf@xa=\pgf@x \pgf@ya=\pgf@y
34 \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
35 \pgf@xb=\pgf@x \pgf@yb=\pgf@y
36 % Middle line
37 \pgf@yc=.5\pgf@ya
38 \advance\pgf@yc by.5\pgf@yb
39 % Height
40 \pgf@xc=-.5\pgf@ya
41 \advance\pgf@xc by.5\pgf@yb
42 % Start point
43 \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@yc}}
44 % Lines
45 \advance\pgf@xb by.1pt%
46 \pgfutil@loop%
47 \advance\pgf@xa by4\pgf@xc\relax%
48 \ifdim\pgf@xa<\pgf@xb%
49 \advance\pgf@xa by-3\pgf@xc%
50 \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}%
51 \advance\pgf@xa by2\pgf@xc%
52 \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}%
53 \advance\pgf@xa by\pgf@xc%
54 \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yc}}%
55 \pgfutil@repeat%
56 \advance\pgf@xb by-.1pt%
57 \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yc}}%
58 }%
59 }%
60
61
62
63 %
64 % Inductor shape based on a bumpy line
65 %
66
67 \pgfdeclareshape{inductor IEC}
68 {%
69 \savedanchor\northeast{%
70 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
71 \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
72 \pgf@x=\pgf@xa%
73 \advance\pgf@x by .5\pgf@xb%
74 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
75 \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}%
76 \pgf@y=\pgf@ya%
77 \advance\pgf@y by\pgf@yb%
78 }%
79 \savedanchor\southwest{%
80 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
81 \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
82 \pgf@x=-\pgf@xa%
83 \advance\pgf@x by -.5\pgf@xb%
84 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
85 \pgf@y=-\pgf@ya%
86 }%
87
88 \anchor{center}{\pgfpointorigin}%
89 \inheritanchor[from=rectangle ee]{north}%
90 \inheritanchor[from=rectangle ee]{south}%
91 \inheritanchor[from=rectangle ee]{east}%
92 \inheritanchor[from=rectangle ee]{west}%
93 \inheritanchor[from=rectangle ee]{north east}%
94 \inheritanchor[from=rectangle ee]{north west}%
95 \inheritanchor[from=rectangle ee]{south east}%
96 \inheritanchor[from=rectangle ee]{south west}%
97 \inheritanchor[from=rectangle ee]{input}%
98 \inheritanchor[from=rectangle ee]{output}%
99
100 \anchorborder{%
101 \ifdim\pgf@y<0pt%
102 % tricky... simpilfy to the origin...
103 \pgf@xc=\pgf@x%
104 \pgf@yc=\pgf@y%
105 \pgf@process{\southwest}%
106 \advance\pgf@y by-0.5pt%
107 \pgf@xa=\pgf@x%
108 \pgf@ya=\pgf@y%
109 \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\pgfqpoint{-\pgf@xa}{-\pgf@ya}}}%
110 \else%
111 \pgf@xc=\pgf@x%
112 \pgf@yc=\pgf@y%
113 \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\northeast}}%
114 \fi%
115 }%
116
117 \backgroundpath{
118 \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
119 \pgf@xa=-\pgf@x \pgf@ya=0pt
120 \pgf@xb=\pgf@x \pgf@yb=\pgf@y
121 % Height
122 \pgf@xc=\pgf@yb%
123 % Start point
124 \pgfpathmoveto{\pgfqpoint{\pgf@xa}{0pt}}
125 % Lines
126 \advance\pgf@xb by.1pt%
127 \pgfutil@loop%
128 \advance\pgf@xa by2\pgf@xc\relax%
129 \ifdim\pgf@xa<\pgf@xb%
130 \pgfpatharc{180}{0}{\pgf@xc}%
131 \pgfutil@repeat%
132 \advance\pgf@xb by-.1pt%
133 \pgfpathlineto{\pgfqpoint{\pgf@xb}{0pt}}%
134 }%
135 }%
136
137
138
139
140 %
141 % Simple capacitor, consisting of two parallel lines
142 %
143
144 \pgfdeclareshape{capacitor IEC}
145 {%
146 \inheritsavedanchors[from=rectangle ee]%
147 \inheritanchor[from=rectangle ee]{center}%
148 \inheritanchor[from=rectangle ee]{north}%
149 \inheritanchor[from=rectangle ee]{south}%
150 \inheritanchor[from=rectangle ee]{east}%
151 \inheritanchor[from=rectangle ee]{west}%
152 \inheritanchor[from=rectangle ee]{north east}%
153 \inheritanchor[from=rectangle ee]{north west}%
154 \inheritanchor[from=rectangle ee]{south east}%
155 \inheritanchor[from=rectangle ee]{south west}%
156 \inheritanchor[from=rectangle ee]{input}%
157 \inheritanchor[from=rectangle ee]{output}%
158 \inheritanchorborder[from=rectangle ee]%
159
160 \backgroundpath{
161 \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}
162 \pgf@xa=\pgf@x \pgf@ya=\pgf@y
163 \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
164 \pgf@xb=\pgf@x \pgf@yb=\pgf@y
165 \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
166 \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}
167 \pgfpathmoveto{\pgfqpoint{\pgf@xb}{\pgf@ya}}
168 \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
169 }%
170 }%
171
172
173
174
175 %
176 % Simple ground, consisting of three lines, getting smaller
177 %
178
179 \pgfdeclareshape{ground IEC}
180 {%
181 \inheritsavedanchors[from=rectangle ee]%
182 \inheritanchor[from=rectangle ee]{center}%
183 \inheritanchor[from=rectangle ee]{north}%
184 \inheritanchor[from=rectangle ee]{south}%
185 \inheritanchor[from=rectangle ee]{east}%
186 \inheritanchor[from=rectangle ee]{west}%
187 \inheritanchor[from=rectangle ee]{north east}%
188 \inheritanchor[from=rectangle ee]{north west}%
189 \inheritanchor[from=rectangle ee]{south east}%
190 \inheritanchor[from=rectangle ee]{south west}%
191 \inheritanchor[from=rectangle ee]{input}%
192 \inheritanchor[from=rectangle ee]{output}%
193 \inheritanchorborder[from=rectangle ee]%
194
195 \backgroundpath{
196 \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}
197 \pgf@xa=\pgf@x \pgf@ya=\pgf@y
198 \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
199 \pgf@xb=\pgf@x \pgf@yb=\pgf@y
200 % First line, simple
201 \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
202 \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}
203 % Advance to middle
204 \pgfmathsetlength\pgf@xa{.5\pgf@xa+.5\pgf@xb}
205 % Make smaller
206 \pgfmathsetlength\pgf@yc{.16666\[email protected]\pgf@ya}
207 \advance\pgf@ya by\pgf@yc
208 \advance\pgf@yb by-\pgf@yc
209 \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
210 \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}
211 % Make even smaller
212 \advance\pgf@ya by\pgf@yc
213 \advance\pgf@yb by-\pgf@yc
214 \pgfpathmoveto{\pgfqpoint{\pgf@xb}{\pgf@ya}}
215 \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
216 }%
217 }%
218
219
220
221 %
222 % Battery, consisting of two parallel lines, one smaller than
223 % the other
224 %
225
226 \pgfdeclareshape{battery IEC}
227 {%
228 \inheritsavedanchors[from=rectangle ee]%
229 \inheritanchor[from=rectangle ee]{center}%
230 \inheritanchor[from=rectangle ee]{north}%
231 \inheritanchor[from=rectangle ee]{south}%
232 \inheritanchor[from=rectangle ee]{east}%
233 \inheritanchor[from=rectangle ee]{west}%
234 \inheritanchor[from=rectangle ee]{north east}%
235 \inheritanchor[from=rectangle ee]{north west}%
236 \inheritanchor[from=rectangle ee]{south east}%
237 \inheritanchor[from=rectangle ee]{south west}%
238 \inheritanchor[from=rectangle ee]{input}%
239 \inheritanchor[from=rectangle ee]{output}%
240 \inheritanchorborder[from=rectangle ee]%
241
242 \backgroundpath{
243 \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}
244 \pgf@xa=\pgf@x \pgf@ya=\pgf@y
245 \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
246 \pgf@xb=\pgf@x \pgf@yb=\pgf@y
247 % First line, simple
248 \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
249 \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}
250 % Make smaller
251 \pgfmathsetlength\pgf@yc{.25\[email protected]\pgf@ya}
252 \advance\pgf@ya by\pgf@yc
253 \advance\pgf@yb by-\pgf@yc
254 \pgfpathmoveto{\pgfqpoint{\pgf@xb}{\pgf@ya}}
255 \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
256 }%
257 }%
258
259
260 %
261 % Special diodes
262 %
263
264
265 \pgfdeclareshape{breakdown diode IEC}
266 {%
267 \inheritsavedanchors[from=rectangle ee]%
268 \inheritanchor[from=rectangle ee]{center}%
269 \inheritanchor[from=rectangle ee]{north}%
270 \inheritanchor[from=rectangle ee]{south}%
271 \inheritanchor[from=rectangle ee]{east}%
272 \inheritanchor[from=rectangle ee]{west}%
273 \inheritanchor[from=rectangle ee]{north east}%
274 \inheritanchor[from=rectangle ee]{north west}%
275 \inheritanchor[from=rectangle ee]{south east}%
276 \inheritanchor[from=rectangle ee]{south west}%
277 \inheritanchor[from=rectangle ee]{input}%
278 \inheritanchor[from=rectangle ee]{output}%
279 \inheritanchorborder[from=rectangle ee]%
280
281 \backgroundpath{
282 \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}
283 \pgf@xa=\pgf@x \pgf@ya=\pgf@y
284 \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
285 \pgf@xb=\pgf@x \pgf@yb=\pgf@y
286 \pgf@xc=.5\pgf@xa \advance\pgf@xc by.5\pgf@xb
287 \pgf@yc=.5\pgf@ya
288 \advance\pgf@yc by .5\pgf@yb
289 % Triangles:
290 \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
291 \pgfpathlineto{\pgfqpoint{\pgf@xc}{\pgf@yc}}
292 \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}
293 \pgfpathclose
294 \pgfpathmoveto{\pgfqpoint{\pgf@xb}{\pgf@ya}}
295 \pgfpathlineto{\pgfqpoint{\pgf@xc}{\pgf@yc}}
296 \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
297 \pgfpathclose
298 }%
299
300
301 \beforebackgroundpath{
302 {
303 \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}
304 \pgf@xa=\pgf@x \pgf@ya=\pgf@y
305 \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
306 \pgf@xb=\pgf@x \pgf@yb=\pgf@y
307 \pgf@yc=.5\pgf@ya
308 \advance\pgf@yc by.5\pgf@yb
309 \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@yc}}
310 \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yc}}
311 \pgfusepathqstroke
312 \pgf@xc=.5\pgf@xa
313 \advance\pgf@xc by.5\pgf@xb
314 \pgftransformshift{\pgfqpoint{\pgf@xc}{\pgf@yc}}
315 \pgf@yc=.5\pgf@yb
316 \advance\pgf@yc by-.5\pgf@ya
317 \pgftransformscale{\pgf@sys@tonumber{\pgf@yc}}
318 \pgfpathmoveto{\pgfqpoint{-.5pt}{-1pt}}
319 \pgfpathlineto{\pgfqpoint{0pt}{-1pt}}
320 \pgfpathlineto{\pgfqpoint{0pt}{1pt}}
321 \pgfpathlineto{\pgfqpoint{.5pt}{1pt}}
322 \pgfusepathqstroke
323 }
324 }%
325 }%
326
327
328
329
330
331
332 % Generic shapes
333 %
334 % When these shapes are used, you can set a key derived form the
335 % shapes name to some code that will be executed as the before
336 % background path. This means that the basic shape is fixed, but
337 % things like a special line inside the shape or at the border can be
338 % added without having to define a whole new shape.
339
340
341 \pgfdeclareshape{generic circle IEC}
342 {%
343 % This shape is a generic circle, to which you can add something to
344 % the before background path using the key
345 % /pgf/generic circle IEC/before background
346 % When this key is invoked, the transformation matrix will have been
347 % setup such that the circle's center is at the origin and that the
348 % position \pgfpoint{1pt}{0pt} lies exactly on the top of the circle
349 % (and, there, on the middle of the line).
350
351 \inheritsavedanchors[from=circle ee]%
352 \inheritanchorborder[from=circle ee]%
353 \inheritanchor[from=circle ee]{north}%
354 \inheritanchor[from=circle ee]{north west}%
355 \inheritanchor[from=circle ee]{north east}%
356 \inheritanchor[from=circle ee]{center}%
357 \inheritanchor[from=circle ee]{west}%
358 \inheritanchor[from=circle ee]{east}%
359 \inheritanchor[from=circle ee]{south}%
360 \inheritanchor[from=circle ee]{south west}%
361 \inheritanchor[from=circle ee]{south east}%
362 \inheritanchor[from=circle ee]{input}%
363 \inheritanchor[from=circle ee]{output}%
364 \inheritbackgroundpath[from=circle ee]%
365
366 \beforebackgroundpath{
367 {
368 \centerpoint%
369 \pgf@xc=\pgf@x%
370 \pgf@yc=\pgf@y%
371 \pgftransformshift{}
372 \pgfutil@tempdima=\radius%
373 \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%
374 \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
375 \ifdim\pgf@xb<\pgf@yb%
376 \advance\pgfutil@tempdima by-\pgf@yb%
377 \else%
378 \advance\pgfutil@tempdima by-\pgf@xb%
379 \fi%
380 \pgftransformscale{\pgf@sys@tonumber{\pgfutil@tempdima}}
381 \pgfkeysvalueof{/pgf/generic circle IEC/before background}
382 }
383 }%
384 }%
385
386
387
388 %
389 % Generic diode, based on a rectangle
390 %
391
392 \pgfdeclareshape{generic diode IEC}
393 {%
394 % This shape is a generic diode, to which you can add something to
395 % the before background path using the key
396 % /pgf/generic diode IEC/before background
397 % When this key is invoked, the transformation matrix will have been
398 % setup such that the center is at the tip of the diode. The
399 % position \pgfpoint{1pt}{0pt} lies exactly on the top of the
400 % (suggested) line before the diode.
401
402 \inheritsavedanchors[from=rectangle ee]%
403 \inheritanchor[from=rectangle ee]{center}%
404 \inheritanchor[from=rectangle ee]{north}%
405 \inheritanchor[from=rectangle ee]{south}%
406 \inheritanchor[from=rectangle ee]{east}%
407 \inheritanchor[from=rectangle ee]{west}%
408 \inheritanchor[from=rectangle ee]{north east}%
409 \inheritanchor[from=rectangle ee]{north west}%
410 \inheritanchor[from=rectangle ee]{south east}%
411 \inheritanchor[from=rectangle ee]{south west}%
412 \inheritanchor[from=rectangle ee]{input}%
413 \inheritanchor[from=rectangle ee]{output}%
414 \inheritanchorborder[from=rectangle ee]%
415
416 \backgroundpath{
417 \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}
418 \pgf@xa=\pgf@x \pgf@ya=\pgf@y
419 \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
420 \pgf@xb=\pgf@x \pgf@yb=\pgf@y
421 % Move tip back a little bit
422 \advance\pgf@xb by-.5\pgflinewidth
423 % Triangle triangle:
424 \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
425 \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}
426 \pgf@yc=.5\pgf@ya
427 \advance\pgf@yc by .5\pgf@yb
428 \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yc}}
429 \pgfpathclose
430 }%
431
432
433 \beforebackgroundpath{
434 {
435 \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}
436 \pgf@xa=\pgf@x \pgf@ya=\pgf@y
437 \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
438 \pgf@xb=\pgf@x \pgf@yb=\pgf@y
439 \pgf@yc=.5\pgf@ya
440 \advance\pgf@yc by.5\pgf@yb
441 \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@yc}}
442 \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yc}}
443 \pgfusepathqstroke
444 \pgftransformshift{\pgfqpoint{\pgf@xb}{\pgf@yc}}
445 \pgf@yc=.5\pgf@yb
446 \advance\pgf@yc by-.5\pgf@ya
447 \pgftransformscale{\pgf@sys@tonumber{\pgf@yc}}
448 \pgfkeysvalueof{/pgf/generic diode IEC/before background}
449 }
450 }%
451 }%
452
453
454 \pgfkeys{
455 /pgf/generic circle IEC/before background/.initial=,
456 /pgf/generic diode IEC/before background/.initial=,
457 }%
458
459
460
461
462
463 %
464 % Contacts
465 %
466
467 \pgfdeclareshape{make contact IEC}
468 {%
469 \savedanchor\northeast{%
470 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
471 \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
472 \pgf@x=\pgf@xa%
473 \advance\pgf@x by .5\pgf@xb%
474 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
475 \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}%
476 \pgf@y=\pgf@ya%
477 \advance\pgf@y by\pgf@yb%
478 }%
479 \savedanchor\southwest{%
480 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
481 \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
482 \pgf@x=-.5\pgf@xa%
483 \advance\pgf@x by -.5\pgf@xb%
484 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
485 \pgf@y=-\pgf@ya%
486 }%
487
488 \anchor{center}{\pgfpointorigin}%
489 \inheritanchor[from=rectangle ee]{north}%
490 \inheritanchor[from=rectangle ee]{south}%
491 \inheritanchor[from=rectangle ee]{east}%
492 \inheritanchor[from=rectangle ee]{west}%
493 \inheritanchor[from=rectangle ee]{north east}%
494 \inheritanchor[from=rectangle ee]{north west}%
495 \inheritanchor[from=rectangle ee]{south east}%
496 \inheritanchor[from=rectangle ee]{south west}%
497 \inheritanchor[from=rectangle ee]{input}%
498 \inheritanchor[from=rectangle ee]{output}%
499
500 \anchorborder{%
501 \ifdim\pgf@y<0pt%
502 % tricky... simplify to the origin...
503 \pgf@xc=\pgf@x%
504 \pgf@yc=\pgf@y%
505 \pgf@process{\southwest}%
506 \advance\pgf@y by-0.5pt%
507 \pgf@xa=\pgf@x%
508 \pgf@ya=\pgf@y%
509 \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\pgfqpoint{-\pgf@xa}{-\pgf@ya}}}%
510 \else%
511 \pgf@xc=\pgf@x%
512 \pgf@yc=\pgf@y%
513 \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\northeast}}%
514 \fi%
515 }%
516
517 \backgroundpath{
518 \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
519 \pgf@xa=-\pgf@x \pgf@ya=0pt
520 \pgf@xb=\pgf@x \pgf@yb=\pgf@y
521 % Start point
522 \pgfpathmoveto{\pgfqpoint{\pgf@xa}{0pt}}
523 \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
524 }%
525 }%
526
527
528
529 %
530 % Contacts
531 %
532
533 \pgfdeclareshape{var make contact IEC}
534 {%
535 \savedanchor\northeast{%
536 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
537 \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
538 \pgf@x=\pgf@xa%
539 \advance\pgf@x by .5\pgf@xb%
540 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
541 \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}%
542 \pgf@y=\pgf@ya%
543 \advance\pgf@y by\pgf@yb%
544 }%
545 \savedanchor\southwest{%
546 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
547 \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
548 \pgf@x=-.5\pgf@xa%
549 \advance\pgf@x by -.5\pgf@xb%
550 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
551 \pgf@y=-\pgf@ya%
552 \pgf@xc=0.083333\pgf@x%
553 \advance\pgf@y by\pgf@xc%
554 }%
555
556 \anchor{center}{\pgfpointorigin}%
557 \inheritanchor[from=rectangle ee]{north}%
558 \inheritanchor[from=rectangle ee]{south}%
559 \inheritanchor[from=rectangle ee]{east}%
560 \inheritanchor[from=rectangle ee]{west}%
561 \inheritanchor[from=rectangle ee]{north east}%
562 \inheritanchor[from=rectangle ee]{north west}%
563 \inheritanchor[from=rectangle ee]{south east}%
564 \inheritanchor[from=rectangle ee]{south west}%
565 \inheritanchor[from=rectangle ee]{input}%
566 \inheritanchor[from=rectangle ee]{output}%
567
568 \anchorborder{%
569 \ifdim\pgf@y<0pt%
570 % tricky... simplify to the origin...
571 \pgf@xc=\pgf@x%
572 \pgf@yc=\pgf@y%
573 \pgf@process{\southwest}%
574 \pgf@xa=\pgf@x%
575 \pgf@ya=\pgf@y%
576 \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\pgfqpoint{-\pgf@xa}{-\pgf@ya}}}%
577 \else%
578 \pgf@xc=\pgf@x%
579 \pgf@yc=\pgf@y%
580 \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\northeast}}%
581 \fi%
582 }%
583
584 \backgroundpath{
585 \pgf@process{\pgfpointadd{\northeast}{
586 \pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
587 \pgf@xa=-\pgf@x \pgf@ya=0pt
588 \pgf@xb=\pgf@x \pgf@yb=\pgf@y
589 \pgf@xc=\pgf@xa
590 \pgfutil@tempdima=2\pgf@xb%
591 \pgfutil@tempdima=0.083333\pgfutil@tempdima%
592 \advance\pgf@xa by \pgfutil@tempdima
593 % Circle
594 {\pgfpathcircle{\pgfqpoint{\pgf@xa}{0pt}}{\pgfutil@tempdima}}
595 % Height
596 % Start point
597 \pgf@process{\pgfpointnormalised{\pgfpointdiff{\pgfqpoint{\pgf@xa}{0pt}}{\pgfqpoint{\pgf@xb}{\pgf@yb}}}}
598 \pgf@xc=\pgf@x
599 \pgf@yc=\pgf@y
600 \pgfpathmoveto{\pgfpointadd{\pgfqpoint{\pgf@xa}{0pt}}{%
601 \pgfpointscale{\pgfutil@tempdima}{\pgfqpoint{\pgf@xc}{\pgf@yc}}}}
602 \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
603 }%
604 }%
605
606
607
608 \pgfdeclareshape{break contact IEC}
609 {%
610 \savedanchor\northeast{%
611 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
612 \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
613 \pgf@x=\pgf@xa%
614 \advance\pgf@x by .5\pgf@xb%
615 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
616 \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}%
617 \pgf@y=\pgf@ya%
618 \advance\pgf@y by\pgf@yb%
619 }%
620 \savedanchor\southwest{%
621 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
622 \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
623 \pgf@x=-.5\pgf@xa%
624 \advance\pgf@x by -.5\pgf@xb%
625 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
626 \pgf@y=-\pgf@ya%
627 }%
628
629 \anchor{center}{\pgfpointorigin}%
630 \inheritanchor[from=rectangle ee]{north}%
631 \inheritanchor[from=rectangle ee]{south}%
632 \inheritanchor[from=rectangle ee]{east}%
633 \inheritanchor[from=rectangle ee]{west}%
634 \inheritanchor[from=rectangle ee]{north east}%
635 \inheritanchor[from=rectangle ee]{north west}%
636 \inheritanchor[from=rectangle ee]{south east}%
637 \inheritanchor[from=rectangle ee]{south west}%
638 \inheritanchor[from=rectangle ee]{input}%
639 \inheritanchor[from=rectangle ee]{output}%
640
641 \anchorborder{%
642 \ifdim\pgf@y<0pt%
643 % tricky... simplify to the origin...
644 \pgf@xc=\pgf@x%
645 \pgf@yc=\pgf@y%
646 \pgf@process{\southwest}%
647 \advance\pgf@y by-0.5pt%
648 \pgf@xa=\pgf@x%
649 \pgf@ya=\pgf@y%
650 \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\pgfqpoint{-\pgf@xa}{-\pgf@ya}}}%
651 \else%
652 \pgf@xc=\pgf@x%
653 \pgf@yc=\pgf@y%
654 \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\northeast}}%
655 \fi%
656 }%
657
658 \backgroundpath{
659 \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
660 \pgf@xa=-\pgf@x \pgf@ya=0pt
661 \pgf@xb=\pgf@x \pgf@yb=\pgf@y
662 % Start point
663 \pgfpathmoveto{\pgfqpoint{\pgf@xa}{0pt}}
664 \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
665 % Break point
666 \pgf@xc=.2\pgf@xb
667 \advance\pgf@xc by-.2\pgf@xa
668 \pgfpathmoveto{\pgfqpoint{\pgf@xb}{0pt}}
669 \advance\pgf@xb by-\pgf@xc
670 \pgfpathlineto{\pgfqpoint{\pgf@xb}{0pt}}
671 \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
672 }%
673 }%
674
675
676
677
678
679 \endinput