Debian Codegraph @

texmf-dist/tex/generic/circuitikz/pgfcircquadpoles.tex

raw
1 % Copyright 2018-2026 by Romano Giannetti
2 % Copyright 2015-2026 by Stefan Lindner
3 % Copyright 2013-2026 by Stefan Erhardt
4 % Copyright 2007-2026 by Massimo Redaelli
5 %
6 % This file may be distributed and/or modified
7 %
8 % 1. under the LaTeX Project Public License and/or
9 % 2. under the GNU Public License.
10 %
11 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
12
13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14 %% Quadripoles
15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16
17
18 % Setting for Transformers and similar quadpoles%<<<1
19
20 \ctikzset{quadpoles/transformer/inner/.initial=0.4}
21 \ctikzset{quadpoles/transformer/width/.initial=1.5}
22 \ctikzset{quadpoles/transformer/width1/.initial=.4}
23 \ctikzset{quadpoles/transformer/height/.initial=1.5}
24 \ctikzset{quadpoles/transformer/height1/.initial=.8}
25 \ctikzset{quadpoles/transformer core/inner/.initial=0.4}
26 \ctikzset{quadpoles/transformer core/width/.initial=1.5}
27 \ctikzset{quadpoles/transformer core/height/.initial=1.5}
28 \ctikzset{quadpoles/transformer core/core height/.initial=.5}
29 \ctikzset{quadpoles/transformer core/core width/.initial=.05}
30 \ctikzset{transformer core/relative thickness/.initial=1}
31 \ctikzset{transformer core/color/.initial=default}
32 \ctikzset{transformer core/dash/.initial=default}
33 \ctikzset{quadpoles/gyrator/inner/.initial=0.4}
34 \ctikzset{quadpoles/gyrator/width/.initial=1.5}
35 \ctikzset{quadpoles/gyrator/height/.initial=1.5}
36 \ctikzset{quadpoles/fourport/width/.initial=1.3}
37 \ctikzset{quadpoles/fourport/height/.initial=1.3}
38 \ctikzset{quadpoles/coupler/width/.initial=1.3}
39 \ctikzset{quadpoles/coupler/height/.initial=1.3}
40 \ctikzset{quadpoles/coupler2/width/.initial=1.3}
41 \ctikzset{quadpoles/coupler2/height/.initial=1.3}
42 \ctikzset{quadpoles/double bipole/inner/.initial=0.4}
43 \ctikzset{quadpoles/double bipole/width/.initial=1.5}
44 \ctikzset{quadpoles/double bipole/width1/.initial=.4}
45 \ctikzset{quadpoles/double bipole/height/.initial=1.5}
46 \ctikzset{quadpoles/double bipole/height1/.initial=.8}
47
48 \ctikzset{quadpoles style/.is choice}
49 \ctikzset{quadpoles style/inward/.code={% default value
50 \ctikzset{quadpoles/transformer/inner=0.4}%
51 \ctikzset{quadpoles/transformer/width=1.5}%
52 \ctikzset{quadpoles/transformer core/inner=0.4}%
53 \ctikzset{quadpoles/transformer core/width=1.5}%
54 \ctikzset{quadpoles/gyrator/inner=0.4}%
55 \ctikzset{quadpoles/gyrator/width=1.5}%
56 \ctikzset{quadpoles/double bipole/inner=0.4}%
57 \ctikzset{quadpoles/double bipole/width=1.5}%
58 }%
59 }
60 \ctikzset{quadpoles style/inline/.code={% now horizontal baffle
61 \ctikzset{quadpoles/transformer/inner=1}%
62 \ctikzset{quadpoles/transformer/width=0.6}%
63 \ctikzset{quadpoles/transformer core/inner=1}%
64 \ctikzset{quadpoles/transformer core/width=0.6}%
65 \ctikzset{quadpoles/gyrator/inner=1} % FIXME
66 \ctikzset{quadpoles/gyrator/width=0.6}%
67 \ctikzset{quadpoles/double bipole/inner=1}%
68 \ctikzset{quadpoles/double bipole/width=0.6}%
69 }%
70 }
71 %%>>>
72
73 %% Node shapes for quadpoles (basically transformers)%<<<
74
75 \long\def\pgfcircdeclarequadpole#1#2#3{
76 \pgfdeclareshape{#1}
77 {
78 \savedmacro{\ctikzclass}{\edef\ctikzclass{inductors}}
79 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
80 % shapename
81 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
82 \savedmacro{\stretto}{\def\stretto{\ctikzvalof{quadpoles/#1/inner}}}
83 \savedanchor\northwest{%
84 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
85 \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen
86 \pgf@y=.5\pgf@y
87 \pgf@x=.5\pgf@circ@scaled@Rlen
88 \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x
89 }
90 %% we define the upper right (positive coord) inner and outer dots (on the side of B1)
91 \savedanchor{\innerdot}{%
92 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
93 \pgf@xa=.5\pgf@circ@scaled@Rlen
94 \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa
95 % by default use the cute inductor size
96 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@scaled@Rlen/2}
97 % check if it's american
98 \edef\pgf@circ@temp{\ctikzvalof{inductor}}
99 \edef\pgf@temp{american}
100 \ifx\pgf@circ@temp\pgf@temp
101 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/americaninductor/height}*\pgf@circ@scaled@Rlen/2}
102 \fi
103 % check if it's european
104 \edef\pgf@temp{european}
105 \ifx\pgf@circ@temp\pgf@temp
106 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/fullgeneric/height}*\pgf@circ@scaled@Rlen/2}
107 \fi
108 \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen}
109 }
110 \savedanchor{\outerdot}{%
111 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
112 \pgf@xa=.5\pgf@circ@scaled@Rlen
113 \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa
114 % by default use the cute inductor size
115 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@scaled@Rlen/2}
116 % check if it's american
117 \edef\pgf@circ@temp{\ctikzvalof{inductor}}
118 \edef\pgf@temp{american}
119 \ifx\pgf@circ@temp\pgf@temp
120 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/americaninductor/height}*\pgf@circ@scaled@Rlen/2}
121 \fi
122 % check if it's european
123 \edef\pgf@temp{european}
124 \ifx\pgf@circ@temp\pgf@temp
125 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/fullgeneric/height}*\pgf@circ@scaled@Rlen/2}
126 \fi
127 \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen}
128 }
129 % geographical
130 \anchor{center}{\northwest\pgf@x=0pt\pgf@y=0pt}
131 \pgfcirc@northwest@symmetric@geoanchors
132 \anchor{base}{\northwest\pgf@x=0pt}
133 % external wires
134 \anchor{A2}{\northwest\pgf@y=-\pgf@y}
135 \anchor{B1}{\northwest\pgf@x=-\pgf@x}
136 \anchor{A1}{\northwest}
137 \anchor{B2}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
138 %% dot's anchors
139 \anchor{inner dot A1}{\innerdot\pgf@x=-\pgf@x}
140 \anchor{outer dot A1}{\outerdot\pgf@x=-\pgf@x}
141 \anchor{inner dot A2}{\innerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
142 \anchor{outer dot A2}{\outerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
143 \anchor{inner dot B1}{\innerdot}
144 \anchor{outer dot B1}{\outerdot}
145 \anchor{inner dot B2}{\innerdot\pgf@y=-\pgf@y}
146 \anchor{outer dot B2}{\outerdot\pgf@y=-\pgf@y}
147 % text above
148 \savedanchor{\textoffset}{%
149 \pgf@x= -.5\wd\pgfnodeparttextbox % (set)
150 \pgf@y= .6\ht\pgfnodeparttextbox % (sum)
151 }
152 \anchor{text}{\pgfextractx{\pgf@xa}{\textoffset}\pgfextracty{\pgf@ya}{\textoffset}
153 \northwest
154 \pgf@x=\pgf@xa \advance\pgf@y by \pgf@ya
155 }
156 #3%
157 \pgf@circ@draw@component{
158 \pgf@circ@setcolor
159
160 \northwest
161 \pgf@circ@res@up = \pgf@y
162 \pgf@circ@res@down = -\pgf@y
163 \pgf@circ@res@right = -\pgf@x
164 \pgf@circ@res@left = \pgf@x
165 #2%
166 }
167 }
168 }
169
170
171 % these are deprecated anchors (really I do not know what they are --- Romano.)
172 % They are here for compatibility, I suppose. Don't use.
173 \def\pgf@circ@drawtransformerbasicanchor{
174 % \ctikzvalof{quadpoles/trans/height}
175 \anchor{AA2}{
176 \northwest
177 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
178 \pgf@x=.7\pgf@x
179 \pgf@y=-\pgf@y
180 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
181 }
182 \anchor{BB1}{
183 \northwest
184 \pgf@x=-\pgf@x
185 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
186 \pgf@x=.7\pgf@x
187 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
188 }
189 \anchor{AA1}{
190 \northwest
191 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
192 \pgf@x=.7\pgf@x
193 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
194 }
195 \anchor{BB2}{
196 \northwest
197 \pgf@x=-\pgf@x
198 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
199 \pgf@x=.7\pgf@x
200 \pgf@y=-\pgf@y
201 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
202 }
203 }
204
205 %% Null styles that can be used to change individually the L1 and L2
206 %% inductors of the transformer.
207
208 \ctikzset{transformer L1/.style={}}
209 \ctikzset{transformer L2/.style={}}
210
211 \def\pgf@circ@drawtransformerbasicbody{
212 \pgfscope
213 \pgfslopedattimetrue
214 \pgfallowupsidedownattimetrue
215 \pgftransformlineattime{.5}{%
216 \pgfpoint%
217 {\stretto\pgf@circ@res@left}%
218 {\pgf@circ@res@up}%
219 }{%
220 \pgfpoint
221 {\stretto\pgf@circ@res@left}%
222 {\pgf@circ@res@down}%
223 }
224
225 \pgfkeys{\circuitikzbasekey/.cd, transformer L1}
226 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
227 \def\pgf@temp{european}%
228 \ifx\pgf@temp\pgf@circ@temp%
229 \pgfnode{fullgenericshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
230 \else%
231 \def\pgf@temp{cute}
232 \ifx\pgf@temp\pgf@circ@temp%
233 \pgfnode{cuteinductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
234 \else%
235 \pgfnode{americaninductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
236 \fi%
237 \fi%
238
239
240 \endpgfscope
241 \pgfscope
242 \pgfslopedattimetrue
243 \pgfallowupsidedownattimetrue
244 \pgftransformlineattime{.5}{%
245 \pgfpoint%
246 {\stretto\pgf@circ@res@right}%
247 {\pgf@circ@res@down}%
248 }{%
249 \pgfpoint
250 {\stretto\pgf@circ@res@right}%
251 {\pgf@circ@res@up}%
252 }
253
254 \pgfkeys{\circuitikzbasekey/.cd, transformer L2}
255 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
256 \def\pgf@temp{european}%
257 \ifx\pgf@temp\pgf@circ@temp%
258 \pgfnode{fullgenericshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
259 \else%
260 \def\pgf@temp{cute}
261 \ifx\pgf@temp\pgf@circ@temp%
262 \pgfnode{cuteinductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
263 \else%
264 \pgfnode{americaninductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
265 \fi%
266 \fi%
267
268 \endpgfscope
269
270 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
271 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}}
272 \pgfpathlineto{\pgfpointanchor{\thisshape-L1}{b}}
273
274 \pgfpathmoveto{\pgfpointanchor{\thisshape-L1}{a}}
275 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}}
276 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
277
278 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
279 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}}
280 \pgfpathlineto{\pgfpointanchor{\thisshape-L2}{a}}
281
282 \pgfpathmoveto{\pgfpointanchor{\thisshape-L2}{b}}
283 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}}
284 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
285
286 \pgfusepath{draw}
287
288 }
289
290
291 \pgfcircdeclarequadpole{transformer}{
292 \pgf@circ@drawtransformerbasicbody
293 }{\pgf@circ@drawtransformerbasicanchor}
294
295 \pgfcircdeclarequadpole{transformer core}{
296
297 \pgf@circ@drawtransformerbasicbody
298
299 % use the chocke line thickness
300 \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}*\ctikzvalof{transformer core/relative thickness}*\pgflinewidth}
301 \pgf@circ@subset@color@dash{transformer core}
302
303 % Find the distance from center for the lines representing the core
304 % the 2.5 is for backward compatibility --- the distance was calculated as a fraction
305 % of the whole component, now as a fraction of the distance between coils, to be
306 % compatible with the quadpoles "inner" style.
307 \pgfmathsetlength{\pgf@circ@res@other}{2.5*\stretto*\ctikzvalof{quadpoles/transformer core/core width}*\pgf@circ@res@right}
308
309 \pgfpathmoveto{\pgfpoint%
310 {\pgf@circ@res@other}%
311 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}%
312 }
313 \pgfpathlineto{
314 \pgfpoint%
315 {\pgf@circ@res@other}%
316 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}%
317 }
318
319 %% this should be just -\pgf@circ@res@other, but in case someone define an asymmetric trafo someday...
320 \pgfmathsetlength{\pgf@circ@res@other}{2.5*\stretto*\ctikzvalof{quadpoles/transformer core/core width}*\pgf@circ@res@left}
321 \pgfpathmoveto{\pgfpoint%
322 {\pgf@circ@res@other}%
323 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}%
324 }
325 \pgfpathlineto{
326 \pgfpoint%
327 {\pgf@circ@res@other}%
328 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}%
329 }
330
331 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
332 \pgfusepath{draw}
333 }{\pgf@circ@drawtransformerbasicanchor}
334
335
336 \pgfcircdeclarequadpole{gyrator}{
337
338 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
339 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}}
340 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}}
341 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
342
343 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
344 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}}
345 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}}
346 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
347
348 \pgfusepath{draw}
349
350 \pgf@circ@setlinewidth{quadpoles}{\pgflinewidth}
351 \pgfmathsetlength{\pgf@circ@res@other}{min(.7*\stretto*\pgf@circ@res@up, .8*\pgf@circ@res@right)} % radius
352 \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@left}{-\pgf@circ@res@other}}
353 \pgfpatharc{-90}{90}{\pgf@circ@res@other}
354 \pgfpathclose
355 \pgf@circ@draworfill
356
357 \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@other}}
358 \pgfpatharc{90}{270}{\pgf@circ@res@other}
359 \pgfpathclose
360 \pgf@circ@draworfill
361 }{}
362 % %>>>
363
364 % Node shapes for generic double bipoles %<<<
365 %
366 \long\def\pgfcircdeclaredbipole#1#2#3{
367 \pgfdeclareshape{#1}
368 {
369 \savedmacro{\ctikzclass}{\edef\ctikzclass{misc}}
370 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
371 % shapename
372 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
373 \savedmacro{\stretto}{\def\stretto{\ctikzvalof{quadpoles/#1/inner}}}
374 \savedanchor\northwest{%
375 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
376 \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen
377 \pgf@y=.5\pgf@y
378 \pgf@x=.5\pgf@circ@scaled@Rlen
379 \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x
380 }
381 %% we define the upper right (positive coord) inner and outer dot (near B1)
382 %% in the generic case, we just place the dot position in a fixed spot
383 %% we do not know the width of the component there...
384 \savedanchor{\innerdot}{%
385 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
386 \pgf@xa=.5\pgf@circ@scaled@Rlen
387 \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa
388 \pgfmathsetlength\pgf@x{-0.5*\stretto*\pgf@xa}
389 \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen}
390 }
391 \savedanchor{\outerdot}{%
392 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
393 \pgf@xa=.5\pgf@circ@scaled@Rlen
394 \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa
395 \pgfmathsetlength\pgf@x{-1.5*\stretto*\pgf@xa}
396 \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen}
397 }
398 % geographical
399 \anchor{center}{\northwest\pgf@x=0pt\pgf@y=0pt}
400 \pgfcirc@northwest@symmetric@geoanchors
401 \anchor{base}{\northwest\pgf@x=0pt}
402 % external wires
403 \anchor{A2}{\northwest\pgf@y=-\pgf@y}
404 \anchor{B1}{\northwest\pgf@x=-\pgf@x}
405 \anchor{A1}{\northwest}
406 \anchor{B2}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
407 %% dot's anchors
408 \anchor{inner dot A1}{\innerdot\pgf@x=-\pgf@x}
409 \anchor{outer dot A1}{\outerdot\pgf@x=-\pgf@x}
410 \anchor{inner dot A2}{\innerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
411 \anchor{outer dot A2}{\outerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
412 \anchor{inner dot B1}{\innerdot}
413 \anchor{outer dot B1}{\outerdot}
414 \anchor{inner dot B2}{\innerdot\pgf@y=-\pgf@y}
415 \anchor{outer dot B2}{\outerdot\pgf@y=-\pgf@y}
416 % text above
417 \savedanchor{\textoffset}{%
418 \pgf@x= -.5\wd\pgfnodeparttextbox % (set)
419 \pgf@y= .6\ht\pgfnodeparttextbox % (sum)
420 }
421 \anchor{text}{\pgfextractx{\pgf@xa}{\textoffset}\pgfextracty{\pgf@ya}{\textoffset}
422 \northwest
423 \pgf@x=\pgf@xa \advance\pgf@y by \pgf@ya
424 }
425 #3%
426 \pgf@circ@draw@component{
427 \pgf@circ@setcolor
428 \northwest
429 \pgf@circ@res@up = \pgf@y
430 \pgf@circ@res@down = -\pgf@y
431 \pgf@circ@res@right = -\pgf@x
432 \pgf@circ@res@left = \pgf@x
433 #2%
434 }
435 }
436 }
437
438 \ctikzset{every double bipole L/.style={}}
439 \ctikzset{every double bipole R/.style={}}
440 \ctikzset{double bipole L/.initial=genericshape}
441 \ctikzset{double bipole R/.initial=vsourceAMshape}
442 \newif\ifpgf@circ@dbipoleL@invert\pgf@circ@dbipoleL@invertfalse
443 \newif\ifpgf@circ@dbipoleR@invert\pgf@circ@dbipoleR@invertfalse
444 \ctikzset{double bipole L invert/.is if=pgf@circ@dbipoleL@invert}
445 \ctikzset{double bipole R invert/.is if=pgf@circ@dbipoleR@invert}
446
447 \def\pgf@circ@drawdbipolebasicbody{
448 \pgfscope
449 \ifpgf@circ@dbipoleL@invert
450 \pgf@circ@res@temp=\pgf@circ@res@down
451 \pgf@circ@res@other=\pgf@circ@res@up
452 \else
453 \pgf@circ@res@temp=\pgf@circ@res@up
454 \pgf@circ@res@other=\pgf@circ@res@down
455 \fi
456 \pgfslopedattimetrue
457 \pgfallowupsidedownattimetrue
458 \pgftransformlineattime{.5}{%
459 \pgfpoint%
460 {\stretto\pgf@circ@res@left}%
461 {\pgf@circ@res@temp}%
462 }{%
463 \pgfpoint
464 {\stretto\pgf@circ@res@left}%
465 {\pgf@circ@res@other}%
466 }
467 \pgfkeys{\circuitikzbasekey/.cd, every double bipole L}
468 \edef\pgf@circ@temp{\ctikzvalof{double bipole L}}%
469 \pgfnode{\pgf@circ@temp}{center}{}{\thisshape-L}{\pgfusepath{stroke}}
470 \endpgfscope
471 \pgfscope
472 \ifpgf@circ@dbipoleR@invert
473 \pgf@circ@res@temp=\pgf@circ@res@down
474 \pgf@circ@res@other=\pgf@circ@res@up
475 \else
476 \pgf@circ@res@temp=\pgf@circ@res@up
477 \pgf@circ@res@other=\pgf@circ@res@down
478 \fi
479 \pgfslopedattimetrue
480 \pgfallowupsidedownattimetrue
481 \pgftransformlineattime{.5}{%
482 \pgfpoint%
483 {\stretto\pgf@circ@res@right}%
484 {\pgf@circ@res@other}%
485 }{%
486 \pgfpoint
487 {\stretto\pgf@circ@res@right}%
488 {\pgf@circ@res@temp}%
489 }
490 %
491 \pgfkeys{\circuitikzbasekey/.cd, every double bipole R}
492 \edef\pgf@circ@temp{\ctikzvalof{double bipole R}}%
493 \pgfnode{\pgf@circ@temp}{center}{}{\thisshape-R}{\pgfusepath{stroke}}
494 \endpgfscope
495 %
496 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
497 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}}
498 \pgfpathlineto{\pgfpointanchor{\thisshape-L}{\ifpgf@circ@dbipoleL@invert a\else b\fi}}
499 %
500 \pgfpathmoveto{\pgfpointanchor{\thisshape-L}{\ifpgf@circ@dbipoleL@invert b\else a\fi}}
501 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}}
502 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
503 %
504 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
505 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}}
506 \pgfpathlineto{\pgfpointanchor{\thisshape-R}{\ifpgf@circ@dbipoleR@invert b\else a\fi}}
507 %
508 \pgfpathmoveto{\pgfpointanchor{\thisshape-R}{\ifpgf@circ@dbipoleR@invert a\else b\fi}}
509 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}}
510 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
511 \pgfusepath{draw}
512 }
513 \pgfcircdeclaredbipole{double bipole}{
514 \pgf@circ@drawdbipolebasicbody
515 }{}
516
517
518 % %>>>
519
520 %%%%%%%%%%%%%%%%%%%
521 %% Block diagrams
522 %%%%%%%%%%%%%%%%%%%
523
524 % Definitions and options for blocks (twoports and so)%<<<1
525
526 \ctikzset{bipoles/twoport/width/.initial=.7}
527 \ctikzset{bipoles/twoport/height/.initial=.7}
528 \ctikzset{bipoles/twoport/text/.initial=}
529 \ctikzset{bipoles/twoportsplit/width/.initial=.7}
530 \ctikzset{bipoles/twoportsplit/height/.initial=.7}
531 \ctikzset{bipoles/twoport/text in/.initial=}
532 \ctikzset{bipoles/twoport/text out/.initial=}
533 \ctikzset{text/.style={t=#1}}
534 \ctikzset{t/.code={%
535 \ctikzsetvalof{bipoles/twoport/text}{#1}%
536 }}
537 \ctikzset{text in/.style={t1=#1}}
538 \ctikzset{t1/.code={%
539 \ctikzsetvalof{bipoles/twoport/text in}{#1}%
540 }}
541 \ctikzset{text out/.style={t2=#1}}
542 \ctikzset{t2/.code={%
543 \ctikzsetvalof{bipoles/twoport/text out}{#1}%
544 }}
545 \ctikzset{bipoles/vco/width/.initial=.7}
546 \ctikzset{bipoles/bandpass/width/.initial=.7}
547 \ctikzset{bipoles/bandstop/width/.initial=.7}
548 \ctikzset{bipoles/highpass/width/.initial=.7}
549 \ctikzset{bipoles/highpass2/width/.initial=.7}
550 \ctikzset{bipoles/lowpass/width/.initial=.7}
551 \ctikzset{bipoles/lowpass2/width/.initial=.7}
552 \ctikzset{bipoles/allpass/width/.initial=.7}
553 \ctikzset{bipoles/vallpass/width/.initial=.7}
554 \ctikzset{bipoles/bgenerator/width/.initial=.7}
555 \ctikzset{bipoles/qgenerator/width/.initial=.7}
556 \ctikzset{bipoles/cgenerator/width/.initial=.7}
557 \ctikzset{bipoles/ngenerator/width/.initial=.7}
558 \ctikzset{bipoles/adc/width/.initial=.7}
559 \ctikzset{bipoles/dac/width/.initial=.7}
560 \ctikzset{bipoles/dsp/width/.initial=.7}
561 \ctikzset{bipoles/fft/width/.initial=.7}
562 \ctikzset{bipoles/amp/width/.initial=.7}
563 \ctikzset{bipoles/iamp/width/.initial=.7}
564 \ctikzset{bipoles/vamp/width/.initial=.7}
565 \ctikzset{bipoles/piattenuator/width/.initial=.7}
566 \ctikzset{bipoles/vpiattenuator/width/.initial=.7}
567 \ctikzset{bipoles/tattenuator/width/.initial=.7}
568 \ctikzset{bipoles/vtattenuator/width/.initial=.7}
569 \ctikzset{bipoles/phaseshifter/width/.initial=.7}
570 \ctikzset{bipoles/vphaseshifter/width/.initial=.7}
571 \ctikzset{bipoles/biast/width/.initial=.7}
572 \ctikzset{bipoles/sinetable/width/.initial=.7}
573 \ctikzset{bipoles/register/width/.initial=.7}
574 \ctikzset{bipoles/detector/width/.initial=.7}
575 \ctikzset{bipoles/saturation/width/.initial=.7}
576 \ctikzset{bipoles/sigmoid/width/.initial=.7}
577 \ctikzset{bipoles/allornothing/width/.initial=.7}
578
579 \ctikzset{bipoles/camera/height/.initial=1.2}
580 \ctikzset{bipoles/camera/depth/.initial=.3}
581 \ctikzset{bipoles/camera/width/.initial=.4}
582 \ctikzset{bipoles/tvset/width/.initial=0.6}
583 \ctikzset{bipoles/tvset/height/.initial=.4}
584 \ctikzset{bipoles/trx/width/.initial=1}
585 \ctikzset{bipoles/trx/height/.initial=.4}
586 \ctikzset{bipoles/swr/width/.initial=0.6}
587 \ctikzset{bipoles/swr/height/.initial=.4}
588 \ctikzset{bipoles/power/width/.initial=1}
589 \ctikzset{bipoles/power/height/.initial=.4}
590
591 \ctikzset{tripoles/mixer/width/.initial=0.7}
592 \ctikzset{tripoles/adder/width/.initial=0.7}
593 \ctikzset{tripoles/circulator/width/.initial=.7}
594 \ctikzset{tripoles/oscillator/width/.initial=.7}
595 \ctikzset{bipoles/fiber/width/.initial=.7}
596
597 \ctikzset{tripoles/wilkinson/height/.initial=1.3}
598 \ctikzset{tripoles/wilkinson/width/.initial=1.3}
599
600 \ctikzset{tripoles/splitter/height/.initial=1.3}
601 \ctikzset{tripoles/splitter/width/.initial=1.3}
602
603 \ctikzset{tripoles/genericsplitter/height/.initial=1.3}
604 \ctikzset{tripoles/genericsplitter/width/.initial=1.3}
605
606 \ctikzset{tripoles/mzm/height/.initial=1.3}
607 \ctikzset{tripoles/mzm/width/.initial=1.3}
608
609 % Option ">" for twoports
610 \newif\ifpgf@circuit@inputarrow
611 \ctikzset{>/.add code={}{\pgf@circuit@inputarrowtrue}}
612 \ctikzset{inputarrow/.is choice}
613 \ctikzset{inputarrow/true/.code={\pgf@circuit@inputarrowtrue}}
614 \ctikzset{inputarrow/false/.code={\pgf@circuit@inputarrowfalse}}
615
616 % Option "boxed" for nodes and twoports
617 \newif\ifpgf@circuit@boxed
618 \newif\ifpgf@circuit@boxedcircled\pgf@circuit@boxedcircledtrue
619 \pgfkeys{/tikz/boxed/.add code={}{\pgf@circuit@boxedtrue\pgf@circuit@boxedcircledtrue}}
620 \ctikzset{boxed/.add code={}{\pgf@circuit@boxedtrue\pgf@circuit@boxedcircledtrue}}
621 \pgfkeys{/tikz/box/.add code={}{\pgf@circuit@boxedtrue\pgf@circuit@boxedcircledtrue}}
622 \ctikzset{box/.add code={}{\pgf@circuit@boxedtrue\pgf@circuit@boxedcircledtrue}}
623 % boxed, no circle
624 \pgfkeys{/tikz/boxed only/.add code={}{\pgf@circuit@boxedtrue\pgf@circuit@boxedcircledfalse}}
625 \ctikzset{boxed only/.add code={}{\pgf@circuit@boxedtrue\pgf@circuit@boxedcircledfalse}}
626 \pgfkeys{/tikz/box only/.add code={}{\pgf@circuit@boxedtrue\pgf@circuit@boxedcircledfalse}}
627 \ctikzset{box only/.add code={}{\pgf@circuit@boxedtrue\pgf@circuit@boxedcircledfalse}}
628
629 % Option "dashed" for nodes and twoports
630 \newif\ifpgf@circuit@dashed
631 \pgfkeys{/tikz/dashed/.add code={}{\pgf@circuit@dashedtrue}}
632 \ctikzset{dashed/.add code={}{\pgf@circuit@dashedtrue}}%
633 % Also draw internal things dashed
634 \newif\ifpgf@circuit@full@dashed
635 \ctikzset{inner blocks dashed/.is if=pgf@circuit@full@dashed}%
636 % Default block dash
637 \ctikzset{dashed blocks pattern/.initial={{0.1cm}{0.1cm}}}
638 %
639 % powerelectronic blocks
640 \ctikzset{bipoles/sacdc/width/.initial=.7}
641 \ctikzset{bipoles/sdcac/width/.initial=.7}
642 \ctikzset{bipoles/sdcdc/width/.initial=.7}
643 \ctikzset{bipoles/tacdc/width/.initial=.7}
644 \ctikzset{bipoles/tdcac/width/.initial=.7}
645 \ctikzset{quadpoles/gridnode/width/.initial=.7} %not sure if quadpole?
646 % plot-type filters
647 \ctikzset{bipoles/lowpassp/width/.initial=.7}
648 \ctikzset{bipoles/highpassp/width/.initial=.7}
649 \ctikzset{bipoles/bandpassp/width/.initial=.7}
650 \ctikzset{bipoles/bandstopp/width/.initial=.7}
651 \ctikzset{bipoles/resonantp/width/.initial=.7}
652 \ctikzset{bipoles/notchp/width/.initial=.7}
653 % plot-type filters grid options
654 \ctikzset{blocks/filter grid/.is family}
655 \ctikzset{blocks/filter grid/dash/.initial={{0.04cm}{0.04cm}}}
656 \ctikzset{blocks/filter grid/color/.initial=default}
657 \ctikzset{blocks/filter grid/thickness/.initial=0.5}
658 \ctikzset{blocks/filter grid/opacity/.initial=0.3}
659 \ctikzset{blocks/filter plot/relative thickness/.initial=2}
660 \ctikzset{blocks/filter plot/rounding/.initial=0.15}
661 % Switch the plot-type filter to ideal shapes
662 \newif\ifpgf@circuit@idealfilter
663 \ctikzset{ideal filter/.is if=pgf@circuit@idealfilter}%
664 \tikzset{ideal filter/.is if=pgf@circuit@idealfilter}%
665 % Add small "0" and "1" to ideal filters plots
666 \newif\ifpgf@circuit@idealfilter@numbers
667 \ctikzset{ideal filter numbers/.is if=pgf@circuit@idealfilter@numbers}%
668 \tikzset{ideal filter numbers/.is if=pgf@circuit@idealfilter@numbers}%
669 \ctikzset{ideal filter number low/.initial={0}}
670 \ctikzset{ideal filter number high/.initial={1}}
671 % set up plot-type drawing
672 \def\pgfcirc@setup@plot@filters{%
673 \ifpgf@circuit@idealfilter
674 \pgfcirc@twoport@draw@linax
675 \else
676 \pgfcirc@twoport@draw@logax
677 \fi
678 \edef\@@tmp{\ctikzvalof{blocks/filter plot/relative thickness}}
679 \pgfsetlinewidth{\@@tmp\pgflinewidth}
680 % ideal filters are "square"
681 \ifpgf@circuit@idealfilter\else
682 \edef\@@tmp{\ctikzvalof{blocks/filter plot/rounding}}
683 \pgfsetcornersarced{\pgfpoint{\@@tmp\pgf@circ@res@step}{\@@tmp\pgf@circ@res@step}}
684 \fi
685 }
686 % draw a fake lin-lin grid for ideal plot-type filters
687 \def\pgfcirc@twoport@draw@linax{%
688 \pgfscope
689 \edef\@@opacity{\ctikzvalof{blocks/filter grid/opacity}}
690 \ifdim\@@opacity pt>0pt
691 \pgfmathsetmacro{\@@scale}{\pgf@circ@res@step/1cm}
692 \pgftransformxscale{\@@scale}
693 \pgftransformyscale{\@@scale}
694 \def\@@gridx{0.7cm}\def\@@gridy{0.6cm}
695 % horizontal lin
696 \pgfpathmoveto{\pgfpoint{-\@@gridx}{-\@@gridy}}
697 \pgfpathlineto{\pgfpoint{\@@gridx}{-\@@gridy}}
698 \pgfpathmoveto{\pgfpoint{-\@@gridx}{-0.5*\@@gridy}}
699 \pgfpathlineto{\pgfpoint{\@@gridx}{-0.5*\@@gridy}}
700 \pgfpathmoveto{\pgfpoint{-\@@gridx}{0cm}}
701 \pgfpathlineto{\pgfpoint{\@@gridx}{0cm}}
702 \pgfpathmoveto{\pgfpoint{-\@@gridx}{0.5*\@@gridy}}
703 \pgfpathlineto{\pgfpoint{\@@gridx}{0.5*\@@gridy}}
704 \pgfpathmoveto{\pgfpoint{-\@@gridx}{\@@gridy}}
705 \pgfpathlineto{\pgfpoint{\@@gridx}{\@@gridy}}
706 % vertical lin
707 \pgfpathmoveto{\pgfpoint{-\@@gridx}{-\@@gridy}}
708 \pgfpathlineto{\pgfpoint{-\@@gridx}{\@@gridy}}
709 \pgfpathmoveto{\pgfpoint{-0.5*\@@gridx}{-\@@gridy}}
710 \pgfpathlineto{\pgfpoint{-0.5*\@@gridx}{\@@gridy}}
711 \pgfpathmoveto{\pgfpoint{0cm}{-\@@gridy}}
712 \pgfpathlineto{\pgfpoint{0cm}{\@@gridy}}
713 \pgfpathmoveto{\pgfpoint{0.5*\@@gridx}{-\@@gridy}}
714 \pgfpathlineto{\pgfpoint{0.5*\@@gridx}{\@@gridy}}
715 \pgfpathmoveto{\pgfpoint{\@@gridx}{-\@@gridy}}
716 \pgfpathlineto{\pgfpoint{\@@gridx}{\@@gridy}}
717 %
718 \pgf@circ@subset@thickness{blocks/filter grid}
719 \pgf@circ@subset@color@dash{blocks/filter grid}
720 \pgfsetstrokeopacity{\@@opacity}
721 \pgfusepath{draw}
722 \ifpgf@circuit@idealfilter@numbers
723 \pgftext[right,at={\pgfpoint{-\@@gridx}{-\@@gridy}}]{%
724 \scriptsize\ctikzvalof{ideal filter number low}\kern1pt}
725 \pgftext[right,at={\pgfpoint{-\@@gridx}{\@@gridy}}]{%
726 \scriptsize\ctikzvalof{ideal filter number high}\kern1pt}
727 \fi
728 \fi
729 \endpgfscope
730 }
731 % draw a fake log-dB(lin) grid for plot-style filters
732 \def\pgfcirc@twoport@draw@logax{%
733 \pgfscope
734 \edef\@@opacity{\ctikzvalof{blocks/filter grid/opacity}}
735 \ifdim\@@opacity pt>0pt
736 \pgfmathsetmacro{\@@scale}{\pgf@circ@res@step/1cm}
737 \pgftransformxscale{\@@scale}
738 \pgftransformyscale{\@@scale}
739 % horizontal lin
740 \pgfpathmoveto{\pgfpoint{-0.8cm}{-0.8cm}}
741 \pgfpathlineto{\pgfpoint{0.8cm}{-0.8cm}}
742 \pgfpathmoveto{\pgfpoint{-0.8cm}{-0.4cm}}
743 \pgfpathlineto{\pgfpoint{0.8cm}{-0.4cm}}
744 \pgfpathmoveto{\pgfpoint{-0.8cm}{0cm}}
745 \pgfpathlineto{\pgfpoint{0.8cm}{0cm}}
746 \pgfpathmoveto{\pgfpoint{-0.8cm}{0.4cm}}
747 \pgfpathlineto{\pgfpoint{0.8cm}{0.4cm}}
748 \pgfpathmoveto{\pgfpoint{-0.8cm}{0.8cm}}
749 \pgfpathlineto{\pgfpoint{0.8cm}{0.8cm}}
750 % vertical
751 \pgfpathmoveto{\pgfpoint{-0.8cm}{-0.8cm}}
752 \pgfpathlineto{\pgfpoint{-0.8cm}{0.8cm}}
753 \pgfpathmoveto{\pgfpoint{-0.3cm}{-0.8cm}}
754 \pgfpathlineto{\pgfpoint{-0.3cm}{0.8cm}}
755 \pgfpathmoveto{\pgfpoint{-0.1cm}{-0.8cm}}
756 \pgfpathlineto{\pgfpoint{-0.1cm}{0.8cm}}
757 \pgfpathmoveto{\pgfpoint{0cm}{-0.8cm}}
758 \pgfpathlineto{\pgfpoint{0cm}{0.8cm}}
759 \pgfpathmoveto{\pgfpoint{0.5cm}{-0.8cm}}
760 \pgfpathlineto{\pgfpoint{0.5cm}{0.8cm}}
761 \pgfpathmoveto{\pgfpoint{0.7cm}{-0.8cm}}
762 \pgfpathlineto{\pgfpoint{0.7cm}{0.8cm}}
763 \pgfpathmoveto{\pgfpoint{0.8cm}{-0.8cm}}
764 \pgfpathlineto{\pgfpoint{0.8cm}{0.8cm}}
765 %
766 \pgf@circ@subset@thickness{blocks/filter grid}
767 \pgf@circ@subset@color@dash{blocks/filter grid}
768 \pgfsetstrokeopacity{\@@opacity}
769 \pgfusepath{draw}
770 \fi
771 \endpgfscope
772 }
773 %>>>
774
775 %% Node shapes definition for path-style block diagrams%<<<
776
777 %% Draw the two-port fillable box
778 \def\pgf@circ@twoportbox{%
779 \pgfscope
780 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}%
781 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}%
782 \pgf@circ@draworfill
783 \endpgfscope
784 }
785 \def\pgf@circ@inputarrow{%
786 \ifpgf@circuit@inputarrow
787 {%
788 % Remove this: the line will overrun the tip, resulting in bad look. See issue #613, thanks to Laurenz Preindl
789 % \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
790 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}%
791 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}%
792 }%
793 \fi
794 }
795 %%% blocks additional anchors
796 \ctikzset{block left anchors pos/.initial=0.5}
797 \ctikzset{block right anchors pos/.initial=0.5}
798 \ctikzset{block lateral anchors pos/.code={
799 \ctikzset{block left anchors pos=#1}%
800 \ctikzset{block right anchors pos=#1}%
801 }}
802 \def\pgcirc@twoport@additional@anchors{%
803 \savedmacro{\blockleftanchorpos}{\edef\blockleftanchorpos{\ctikzvalof{block left anchors pos}}}
804 \savedmacro{\blockrightanchorpos}{\edef\blockrightanchorpos{\ctikzvalof{block right anchors pos}}}
805 \anchor{right down}{\northeast\pgf@y=-\blockrightanchorpos\pgf@y}
806 \anchor{left down}{\northeast\pgf@x=-\pgf@x\pgf@y=-\blockleftanchorpos\pgf@y}
807 \anchor{left up}{\northeast\pgf@x=-\pgf@x\pgf@y=\blockleftanchorpos\pgf@y}
808 \anchor{right up}{\northeast\pgf@y=\blockrightanchorpos\pgf@y}
809 \anchor{up}{\northeast\pgf@x=0pt\relax}
810 \anchor{down}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt\relax}
811 }
812
813 %%% definition to help define the blocks. Notice that the height, width, etc are different, so we can't
814 %%% simplify more...
815 \def\pfgcirc@twoport@get@symbol@rotation{
816 %%% put the needed rotation in \@@rotation
817 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
818 \def\@@rotation{0}
819 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
820 \def\@@rotation{270}
821 \fi\fi
822 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225
823 \def\@@rotation{180}
824 \fi\fi
825 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
826 \def\@@rotation{90}
827 \fi\fi
828 }
829 %
830 \def\pfgcirc@twoport@rotate@inner@symbol{%
831 % rotate inner symbol
832 \pfgcirc@twoport@get@symbol@rotation
833 \pgftransformrotate{\@@rotation}
834 }
835 % enact dashing if needed
836 \def\pgfcirc@twoport@maybedash{%
837 \ifpgf@circuit@dashed
838 \edef\@@tmp{\ctikzvalof{dashed blocks pattern}}
839 \expandafter\pgfsetdash\expandafter{\@@tmp}{0cm}
840 \fi
841 }
842 % debug
843 \def\@@printrot{%
844 \pgfsetcolor{red}
845 \pgftext[center,x=0,y=0,]{\tiny\ttfamily\pgf@circ@direction > \@@rotation}
846 }
847 %
848 \ctikzset{blocks/inner thickness/.initial=1}
849 \ctikzset{blocks/inner color/.initial=default}
850 \def\pgfcirc@twoport@setup#1{%
851 \pgf@circ@res@step = #1\pgf@circ@scaled@Rlen%6 is the real width parameter
852 \divide \pgf@circ@res@step by 2
853 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
854 \pgfsetarrows{-}
855 % let set the dash for the next operations
856 \pgfcirc@twoport@maybedash
857 }
858 %
859 \def\pgfcirc@twoport@draw@sine#1#2{% #1 -> y shift; #2 -> crossed out if != 0
860 % draw inner sine waves; ...res@step must be defined
861 \pgfscope
862 \pgfsetlinewidth{\pgfstartlinewidth}
863 \pgftransformyshift{#1\pgf@circ@res@step}
864 \pgfpathmoveto{\pgfpoint{-.5\pgf@circ@res@step}{0\pgf@circ@res@step}}
865 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
866 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
867 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
868 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
869 \ifnum #2=0\else
870 \pgfpathmoveto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}}
871 \pgfpathlineto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}}
872 \fi
873 \pgfusepath{draw}
874 \endpgfscope
875 }
876 %
877 \def\pgfcirc@twoport@draw@narrowsine#1{% #1 -> y shift
878 \pgfscope
879 \pgfsetlinewidth{\pgfstartlinewidth}
880 \pgftransformyshift{#1\pgf@circ@res@step}
881 \pgfpathmoveto{\pgfpoint{.125\pgf@circ@res@step}{0\pgf@circ@res@step}}
882 \pgfpathsine{\pgfpoint{.125\pgf@circ@res@step}{.125\pgf@circ@res@step}}
883 \pgfpathcosine{\pgfpoint{.125\pgf@circ@res@step}{-.125\pgf@circ@res@step}}
884 \pgfpathsine{\pgfpoint{.125\pgf@circ@res@step}{-.125\pgf@circ@res@step}}
885 \pgfpathcosine{\pgfpoint{.125\pgf@circ@res@step}{.125\pgf@circ@res@step}}
886 \pgfusepath{draw}
887 \endpgfscope
888 }
889 %
890 \def\pgfcirc@twoport@draw@splitline{%
891 \pgfscope
892 \pgfcirc@twoport@maybedash
893 \pgfsetlinewidth{\pgfstartlinewidth}
894 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
895 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
896 \pgfusepath{draw}
897 \endpgfscope
898 }
899 %
900 \long\def\pgfcirc@define@twoports#1#2#3#4#5#6#7{
901 \pgfcircdeclarebipolescaled{#1}
902 {
903 \pgcirc@twoport@additional@anchors
904 #2
905 }
906 {#3}
907 {#4}
908 {#5}
909 {#6}
910 {
911 \pgfcirc@twoport@setup{#6}
912 % draw outer box
913 \pgf@circ@twoportbox
914 % draw solid line for inner symbol if no box is drawn and not fully dashed
915 \ifpgf@circuit@full@dashed\else\pgfsetdash{}{0pt}\fi
916 \pgf@circ@inputarrow
917 \pfgcirc@twoport@rotate@inner@symbol
918 % set inner symbol options
919 \pgf@circ@subset@color{blocks/inner color}
920 \pgf@circ@set@relative@thickness{inner thickness}
921 #7
922 }
923 }
924 %
925 \long\def\pgfcirc@define@twoports@norotate#1#2#3#4#5#6#7{
926 \pgfcircdeclarebipolescaled{#1}
927 {
928 \pgcirc@twoport@additional@anchors
929 #2
930 }
931 {#3}
932 {#4}
933 {#5}
934 {#6}
935 {
936 \pgfcirc@twoport@setup{#6}
937 % draw outer box
938 \pgf@circ@twoportbox
939 % draw solid line for inner symbol if no box is drawn and not fully dashed
940 \ifpgf@circuit@full@dashed\else\pgfsetdash{}{0pt}\fi
941 \pgf@circ@inputarrow
942 % set inner symbol options
943 \pgf@circ@subset@color{blocks/inner color}
944 \pgf@circ@set@relative@thickness{inner thickness}
945 #7
946 }
947 }
948 %% Generic two port box
949 \pgfcirc@define@twoports{blocks}
950 {}
951 {\ctikzvalof{bipoles/twoport/height}}
952 {twoport}
953 {\ctikzvalof{bipoles/twoport/height}}
954 {\ctikzvalof{bipoles/twoport/width}}
955 {
956 % draw inner symbol
957 \pgf@circ@text@strokecolor
958 \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}}
959
960 }
961 %% twoport split
962 \pgfcirc@define@twoports{blocks}
963 {}
964 {\ctikzvalof{bipoles/twoportsplit/height}}
965 {twoportsplit}
966 {\ctikzvalof{bipoles/twoportsplit/height}}
967 {\ctikzvalof{bipoles/twoportsplit/width}}
968 {
969 %get texts
970 \def\pgfcirc@tin{\ctikzvalof{bipoles/twoport/text in}}
971 \def\pgfcirc@tout{\ctikzvalof{bipoles/twoport/text out}}
972 % shuffle text depending on rotation
973 \pgfcirc@twoport@draw@splitline
974 %
975 \pgf@circ@text@strokecolor
976 % see where we want the text to reside
977 \ifpgf@circ@center@text
978 \ifnum\@@rotation<145
979 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\pgfcirc@tin}
980 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\pgfcirc@tout}
981 \else
982 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\pgfcirc@tout}
983 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\pgfcirc@tin}
984 \fi
985 \else
986 \edef\@@dist{\ctikzvalof{border text distance}}
987 \ifnum\@@rotation<145
988 \pgftext[top,left,x=\pgf@circ@res@left+\@@dist,y=\pgf@circ@res@up-\@@dist]{\pgfcirc@tin}
989 \pgftext[bottom,right,x=\pgf@circ@res@right-\@@dist,y=\pgf@circ@res@down+\@@dist]{\pgfcirc@tout}
990 \else
991 \pgftext[top,left,x=\pgf@circ@res@left+\@@dist,y=\pgf@circ@res@up-\@@dist]{\pgfcirc@tout}
992 \pgftext[bottom,right,x=\pgf@circ@res@right-\@@dist,y=\pgf@circ@res@down+\@@dist]{\pgfcirc@tin}
993 \fi
994 \fi
995 }
996 %% bandpass filter
997 \pgfcirc@define@twoports{blocks}
998 {}
999 {\ctikzvalof{bipoles/bandpass/width}}
1000 {bandpass}
1001 {\ctikzvalof{bipoles/bandpass/width}}
1002 {\ctikzvalof{bipoles/bandpass/width}}
1003 {
1004 \pgfcirc@twoport@draw@sine{0.5}{1}
1005 \pgfcirc@twoport@draw@sine{0.0}{0}
1006 \pgfcirc@twoport@draw@sine{-0.5}{1}
1007 }
1008 %% bandstop filter
1009 \pgfcirc@define@twoports{blocks}
1010 {}
1011 {\ctikzvalof{bipoles/bandstop/width}}
1012 {bandstop}
1013 {\ctikzvalof{bipoles/bandstop/width}}
1014 {\ctikzvalof{bipoles/bandstop/width}}
1015 {
1016 \pgfcirc@twoport@draw@sine{0.5}{0}
1017 \pgfcirc@twoport@draw@sine{0.0}{1}
1018 \pgfcirc@twoport@draw@sine{-0.5}{0}
1019 }
1020 %% highpass filter
1021 \pgfcirc@define@twoports{blocks}
1022 {}
1023 {\ctikzvalof{bipoles/highpass/width}}
1024 {highpass}
1025 {\ctikzvalof{bipoles/highpass/width}}
1026 {\ctikzvalof{bipoles/highpass/width}}
1027 {
1028 \pgfcirc@twoport@draw@sine{0.5}{0}
1029 \pgfcirc@twoport@draw@sine{0.0}{1}
1030 \pgfcirc@twoport@draw@sine{-0.5}{1}
1031 }
1032 %% highpass2 filter ---simplyfied with just two waves
1033 \pgfcirc@define@twoports{blocks}
1034 {}
1035 {\ctikzvalof{bipoles/highpass2/width}}
1036 {highpass2}
1037 {\ctikzvalof{bipoles/highpass2/width}}
1038 {\ctikzvalof{bipoles/highpass2/width}}
1039 {
1040 \pgfcirc@twoport@draw@sine{0.25}{0}
1041 \pgfcirc@twoport@draw@sine{-0.25}{1}
1042 }
1043 %% lowpass filter
1044 \pgfcirc@define@twoports{blocks}
1045 {}
1046 {\ctikzvalof{bipoles/lowpass/width}}
1047 {lowpass}
1048 {\ctikzvalof{bipoles/lowpass/width}}
1049 {\ctikzvalof{bipoles/lowpass/width}}
1050 {
1051 \pgfcirc@twoport@draw@sine{0.5}{1}
1052 \pgfcirc@twoport@draw@sine{0.0}{1}
1053 \pgfcirc@twoport@draw@sine{-0.5}{0}
1054 }
1055 %% lowpass2 filter: simplyfied with just two waves
1056 \pgfcirc@define@twoports{blocks}
1057 {}
1058 {\ctikzvalof{bipoles/lowpass2/width}}
1059 {lowpass2}
1060 {\ctikzvalof{bipoles/lowpass2/width}}
1061 {\ctikzvalof{bipoles/lowpass2/width}}
1062 {
1063 \pgfcirc@twoport@draw@sine{0.25}{1}
1064 \pgfcirc@twoport@draw@sine{-0.25}{0}
1065 }
1066 %% allpass filter
1067 \pgfcirc@define@twoports{blocks}
1068 {}
1069 {\ctikzvalof{bipoles/allpass/width}}
1070 {allpass}
1071 {\ctikzvalof{bipoles/allpass/width}}
1072 {\ctikzvalof{bipoles/allpass/width}}
1073 {
1074 \pgfcirc@twoport@draw@sine{0.5}{0}
1075 \pgfcirc@twoport@draw@sine{0.0}{0}
1076 \pgfcirc@twoport@draw@sine{-0.5}{0}
1077 }
1078 %% variable allpass filter
1079 \pgfcirc@define@twoports{blocks}
1080 {}
1081 {\ctikzvalof{bipoles/vallpass/width}}
1082 {vallpass}
1083 {\ctikzvalof{bipoles/vallpass/width}}
1084 {\ctikzvalof{bipoles/vallpass/width}}
1085 {
1086 \pgfcirc@twoport@draw@sine{0.5}{0}
1087 \pgfcirc@twoport@draw@sine{0.0}{0}
1088 \pgfcirc@twoport@draw@sine{-0.5}{0}
1089 \pgfcirc@set@arrows{tunable}{}{latex}
1090 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
1091 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
1092 \pgfusepath{draw}
1093 }
1094 %% Block Generator
1095 \pgfcirc@define@twoports{blocks}
1096 {}
1097 {\ctikzvalof{bipoles/bgenerator/width}}
1098 {bgenerator}
1099 {\ctikzvalof{bipoles/bgenerator/width}}
1100 {\ctikzvalof{bipoles/bgenerator/width}}
1101 {
1102 \pgfcirc@twoport@draw@narrowsine{0.25}
1103 \pgfcirc@twoport@draw@narrowsine{0.0}
1104 \pgfcirc@twoport@draw@narrowsine{-0.25}
1105 \pgftext[x=0.45\pgf@circ@res@left]{\ctikzvalof{bipoles/twoport/text}}
1106 }
1107 %% Crystal Generator
1108 \pgfcirc@define@twoports{blocks}
1109 {}
1110 {\ctikzvalof{bipoles/qgenerator/width}}
1111 {qgenerator}
1112 {\ctikzvalof{bipoles/qgenerator/width}}
1113 {\ctikzvalof{bipoles/qgenerator/width}}
1114 {
1115 \pgfcirc@twoport@draw@narrowsine{0.45}
1116 \pgfcirc@twoport@draw@narrowsine{0.20}
1117 \pgfcirc@twoport@draw@narrowsine{-0.05}
1118 \pgftext[x=0.45\pgf@circ@res@left,y=0.25\pgf@circ@res@up]{\ctikzvalof{bipoles/twoport/text}}
1119 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
1120 \pgfpathlineto{\pgfpoint{ 0.7\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
1121 \pgfusepath{draw}
1122 \pgfpathrectangle{\pgfpoint{-0.7\pgf@circ@res@step}{-0.7\pgf@circ@res@step}}
1123 {\pgfpoint{1.4\pgf@circ@res@step}{0.2\pgf@circ@res@step}}
1124 \pgfusepath{draw}
1125 \pgfpathmoveto{\pgfpoint{-0.7\pgf@circ@res@step}{-0.8\pgf@circ@res@step}}
1126 \pgfpathlineto{\pgfpoint{ 0.7\pgf@circ@res@step}{-0.8\pgf@circ@res@step}}
1127 \pgfpathmoveto{\pgfpoint{-0.7\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
1128 \pgfpathlineto{\pgfpoint{ 0.7\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
1129 \pgfusepath{draw}
1130 }
1131 %% Clock generator
1132 \pgfcirc@define@twoports{blocks}
1133 {}
1134 {\ctikzvalof{bipoles/cgenerator/width}}
1135 {cgenerator}
1136 {\ctikzvalof{bipoles/cgenerator/width}}
1137 {\ctikzvalof{bipoles/cgenerator/width}}
1138 {
1139 \pgfpathmoveto{\pgfpoint{-0.70\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
1140 \pgfpathlineto{\pgfpoint{-0.42\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
1141 \pgfpathlineto{\pgfpoint{-0.42\pgf@circ@res@step}{+0.35\pgf@circ@res@step}}
1142 \pgfpathlineto{\pgfpoint{-0.14\pgf@circ@res@step}{+0.35\pgf@circ@res@step}}
1143 \pgfpathlineto{\pgfpoint{-0.14\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
1144 \pgfpathlineto{\pgfpoint{+0.14\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
1145 \pgfpathlineto{\pgfpoint{+0.14\pgf@circ@res@step}{+0.35\pgf@circ@res@step}}
1146 \pgfpathlineto{\pgfpoint{+0.42\pgf@circ@res@step}{+0.35\pgf@circ@res@step}}
1147 \pgfpathlineto{\pgfpoint{+0.42\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
1148 \pgfpathlineto{\pgfpoint{+0.70\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
1149 \pgfusepath{draw}
1150 }
1151 %% Generic generator
1152 \pgfcirc@define@twoports{blocks}
1153 {}
1154 {\ctikzvalof{bipoles/ngenerator/width}}
1155 {ngenerator}
1156 {\ctikzvalof{bipoles/ngenerator/width}}
1157 {\ctikzvalof{bipoles/ngenerator/width}}
1158 {
1159 \pgfcirc@twoport@draw@sine{0.5}{0}
1160 \pgftext[y=-0.35\pgf@circ@res@up]{\ctikzvalof{bipoles/twoport/text}}
1161 }
1162 %% ADC
1163 \pgfcirc@define@twoports{blocks}
1164 {}
1165 {\ctikzvalof{bipoles/adc/width}}
1166 {adc}
1167 {\ctikzvalof{bipoles/adc/width}}
1168 {\ctikzvalof{bipoles/adc/width}}
1169 {
1170 \pgfcirc@twoport@draw@splitline
1171 %
1172 \pgf@circ@text@strokecolor
1173 \ifnum\@@rotation<145
1174 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{A}
1175 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{D}
1176 \else
1177 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{D}
1178 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{A}
1179 \fi
1180 }
1181
1182 %% DAC
1183 \pgfcirc@define@twoports{blocks}
1184 {}
1185 {\ctikzvalof{bipoles/dac/width}}
1186 {dac}
1187 {\ctikzvalof{bipoles/dac/width}}
1188 {\ctikzvalof{bipoles/dac/width}}
1189 {
1190 \pgfcirc@twoport@draw@splitline
1191 %
1192 \pgf@circ@text@strokecolor
1193 \ifnum\@@rotation<145
1194 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{D}
1195 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{A}
1196 \else
1197 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{A}
1198 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{D}
1199 \fi
1200 }
1201
1202 %% DSP
1203 \pgfcirc@define@twoports{blocks}
1204 {}
1205 {\ctikzvalof{bipoles/dsp/width}}
1206 {dsp}
1207 {\ctikzvalof{bipoles/dsp/width}}
1208 {\ctikzvalof{bipoles/dsp/width}}
1209 {
1210 \pgf@circ@text@strokecolor
1211 \pgftext[center,x=0,y=0]{\textsf{DSP}}
1212 }
1213 %% FFT
1214 \pgfcirc@define@twoports{blocks}
1215 {}
1216 {\ctikzvalof{bipoles/fft/width}}
1217 {fft}
1218 {\ctikzvalof{bipoles/fft/width}}
1219 {\ctikzvalof{bipoles/fft/width}}
1220 {
1221 \pgf@circ@text@strokecolor
1222 \pgftext[center,x=0,y=0]{\textsf{FFT}}
1223 }
1224 %% pi attenuator
1225 \pgfcirc@define@twoports{blocks}
1226 {}
1227 {\ctikzvalof{bipoles/piattenuator/width}}
1228 {piattenuator}
1229 {\ctikzvalof{bipoles/piattenuator/width}}
1230 {\ctikzvalof{bipoles/piattenuator/width}}
1231 {
1232 % draw inner symbol
1233 \pgfsetlinewidth{\pgfstartlinewidth}
1234 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
1235 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
1236 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
1237 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
1238 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
1239 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
1240 \pgfusepath{draw}
1241 }
1242 %% variable pi attenuator
1243 \pgfcirc@define@twoports{blocks}
1244 {}
1245 {\ctikzvalof{bipoles/vpiattenuator/width}}
1246 {vpiattenuator}
1247 {\ctikzvalof{bipoles/vpiattenuator/width}}
1248 {\ctikzvalof{bipoles/vpiattenuator/width}}
1249 {
1250 % draw inner symbol
1251 \pgfsetlinewidth{\pgfstartlinewidth}
1252 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
1253 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
1254 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
1255 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
1256 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
1257 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
1258 \pgfusepath{draw}
1259 \pgfcirc@set@arrows{tunable}{}{latex}
1260 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
1261 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
1262 \pgfusepath{draw}
1263 }
1264 %% T attenuator
1265 \pgfcirc@define@twoports{blocks}
1266 {}
1267 {\ctikzvalof{bipoles/tattenuator/width}}
1268 {tattenuator}
1269 {\ctikzvalof{bipoles/tattenuator/width}}
1270 {\ctikzvalof{bipoles/tattenuator/width}}
1271 {
1272 % draw inner symbol
1273 \pgfsetlinewidth{\pgfstartlinewidth}
1274 \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}}
1275 \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}}
1276 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
1277 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
1278 \pgfusepath{draw}
1279 }
1280 %% variable T attenuator
1281 \pgfcirc@define@twoports{blocks}
1282 {}
1283 {\ctikzvalof{bipoles/vtattenuator/width}}
1284 {vtattenuator}
1285 {\ctikzvalof{bipoles/vtattenuator/width}}
1286 {\ctikzvalof{bipoles/vtattenuator/width}}
1287 {
1288 % draw inner symbol
1289 \pgfsetlinewidth{\pgfstartlinewidth}
1290 \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}}
1291 \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}}
1292 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
1293 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
1294 \pgfusepath{draw}
1295 \pgfcirc@set@arrows{tunable}{}{latex}
1296 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
1297 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
1298 \pgfusepath{draw}
1299 }
1300 %% phase shifter
1301 \pgfcirc@define@twoports{blocks}
1302 {}
1303 {\ctikzvalof{bipoles/phaseshifter/width}}
1304 {phaseshifter}
1305 {\ctikzvalof{bipoles/phaseshifter/width}}
1306 {\ctikzvalof{bipoles/phaseshifter/width}}
1307 {
1308 % inner symbol
1309 \pgf@circ@text@strokecolor
1310 \pgftext[center,x=0,y=0]{\Large$\varphi$}
1311 }
1312 %% variable phase shifter
1313 \pgfcirc@define@twoports{blocks}
1314 {}
1315 {\ctikzvalof{bipoles/phaseshifter/width}}
1316 {vphaseshifter}
1317 {\ctikzvalof{bipoles/vphaseshifter/width}}
1318 {\ctikzvalof{bipoles/vphaseshifter/width}}
1319 {
1320 \pgfsetlinewidth{\pgfstartlinewidth}
1321 \pgfcirc@set@arrows{tunable}{}{latex}
1322 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.65\pgf@circ@res@down}}
1323 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.65\pgf@circ@res@up}}
1324 \pgfusepath{draw}
1325 % inner symbol
1326 \pgf@circ@text@strokecolor
1327 \pgftext[center,x=0,y=0]{\Large$\varphi$}
1328 }
1329 %% BIAS-T
1330 \pgfcirc@define@twoports{blocks}
1331 {}
1332 {\ctikzvalof{bipoles/biast/width}}
1333 {biast}
1334 {\ctikzvalof{bipoles/biast/width}}
1335 {\ctikzvalof{bipoles/biast/width}}
1336 {
1337 \pgfpathmoveto{\pgfpoint{-0.80\pgf@circ@res@step}{-0.50\pgf@circ@res@step}} % Line to Plate 1
1338 \pgfpathlineto{\pgfpoint{-0.50\pgf@circ@res@step}{-0.50\pgf@circ@res@step}}
1339 \pgfpathmoveto{\pgfpoint{-0.50\pgf@circ@res@step}{-0.50\pgf@circ@res@step}} % Plate 1
1340 \pgfpathlineto{\pgfpoint{-0.50\pgf@circ@res@step}{-0.20\pgf@circ@res@step}}
1341 \pgfpathmoveto{\pgfpoint{-0.50\pgf@circ@res@step}{-0.50\pgf@circ@res@step}}
1342 \pgfpathlineto{\pgfpoint{-0.50\pgf@circ@res@step}{-0.80\pgf@circ@res@step}}
1343 \pgfpathmoveto{\pgfpoint{-0.30\pgf@circ@res@step}{-0.50\pgf@circ@res@step}} % Plate 1
1344 \pgfpathlineto{\pgfpoint{-0.30\pgf@circ@res@step}{-0.20\pgf@circ@res@step}}
1345 \pgfpathmoveto{\pgfpoint{-0.30\pgf@circ@res@step}{-0.50\pgf@circ@res@step}}
1346 \pgfpathlineto{\pgfpoint{-0.30\pgf@circ@res@step}{-0.80\pgf@circ@res@step}}
1347 \pgfpathmoveto{\pgfpoint{-0.30\pgf@circ@res@step}{-0.50\pgf@circ@res@step}} % Line to Center
1348 \pgfpathlineto{\pgfpoint{ 0.00\pgf@circ@res@step}{-0.50\pgf@circ@res@step}}
1349 \pgfusepath{draw}
1350 \pgfpathcircle{\pgfpoint{ 0.00\pgf@circ@res@step}{-0.50\pgf@circ@res@step}}{0.075\pgf@circ@res@step}
1351 \pgfusepath{fill}
1352 \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{-0.50\pgf@circ@res@step}} % Line to Right
1353 \pgfpathlineto{\pgfpoint{ 0.80\pgf@circ@res@step}{-0.50\pgf@circ@res@step}}
1354 \pgfusepath{draw}
1355 \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{-0.50\pgf@circ@res@step}} % Line to Coils
1356 \pgfpathlineto{\pgfpoint{ 0.00\pgf@circ@res@step}{-0.20\pgf@circ@res@step}}
1357 \pgfusepath{draw}
1358 \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{-0.20\pgf@circ@res@step}} % Arc1
1359 \pgfpatharc{-90}{90}{0.09\pgf@circ@res@step}
1360 \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{-0.02\pgf@circ@res@step}} % Arc2
1361 \pgfpatharc{-90}{90}{0.09\pgf@circ@res@step}
1362 \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{+0.16\pgf@circ@res@step}} % Arc3
1363 \pgfpatharc{-90}{90}{0.09\pgf@circ@res@step}
1364 \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{+0.36\pgf@circ@res@step}} % Arc4
1365 \pgfpatharc{-90}{90}{0.09\pgf@circ@res@step}
1366 \pgfusepath{draw}
1367 \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{+0.52\pgf@circ@res@step}} % Line to Coils
1368 \pgfpathlineto{\pgfpoint{ 0.00\pgf@circ@res@step}{+0.80\pgf@circ@res@step}}
1369 \pgfusepath{draw}
1370 }
1371 %% Sine table
1372 \pgfcirc@define@twoports{blocks}
1373 {}
1374 {\ctikzvalof{bipoles/sinetable/width}}
1375 {sinetable}
1376 {\ctikzvalof{bipoles/sinetable/width}}
1377 {\ctikzvalof{bipoles/sinetable/width}}
1378 {
1379 \pgfcirc@twoport@draw@sine{0.0}{0}
1380 \pgfcirc@set@arrows{tunable}{}{latex}
1381 \pgfpathmoveto{\pgfpoint{-0.70\pgf@circ@res@step}{-0.70\pgf@circ@res@step}}
1382 \pgfpathlineto{\pgfpoint{+0.70\pgf@circ@res@step}{-0.70\pgf@circ@res@step}}
1383 \pgfusepath{draw}
1384 \pgfpathmoveto{\pgfpoint{-0.70\pgf@circ@res@step}{-0.70\pgf@circ@res@step}}
1385 \pgfpathlineto{\pgfpoint{-0.70\pgf@circ@res@step}{+0.70\pgf@circ@res@step}}
1386 \pgfusepath{draw}
1387 }
1388 %% Register
1389 \pgfcirc@define@twoports{blocks}
1390 {
1391 \savedanchor\northwest{
1392 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
1393 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
1394 \pgf@y=.5\pgf@y
1395 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
1396 \pgf@x=.5\pgf@x
1397 }
1398 \anchor{clk}{\northwest\pgf@y=0.5\pgf@y}
1399 }
1400 {\ctikzvalof{bipoles/register/width}}
1401 {register}
1402 {\ctikzvalof{bipoles/register/width}}
1403 {\ctikzvalof{bipoles/register/width}}
1404 {
1405 \pgfpathmoveto{\pgfpoint{-1.00\pgf@circ@res@step}{+0.70\pgf@circ@res@step}}
1406 \pgfpathlineto{\pgfpoint{-0.60\pgf@circ@res@step}{+0.50\pgf@circ@res@step}}
1407 \pgfpathlineto{\pgfpoint{-1.00\pgf@circ@res@step}{+0.30\pgf@circ@res@step}}
1408 \pgfusepath{draw}
1409 \pgf@circ@text@strokecolor
1410 \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}}
1411 }
1412 %% detector
1413 \pgfcirc@define@twoports@norotate{blocks}
1414 {}
1415 {\ctikzvalof{bipoles/detector/width}}
1416 {detector}
1417 {\ctikzvalof{bipoles/detector/width}}
1418 {\ctikzvalof{bipoles/detector/width}}
1419 {
1420 % draw inner stuff
1421 \pgfsetlinewidth{0.8\pgfstartlinewidth}
1422 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0}}
1423 \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@right}{0}}
1424 \pgfusepath{draw}
1425 \ifpgf@circuit@fulldiode
1426 \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width}}
1427 \pgftransformscale{\pgfmathresult}
1428 \pgfnode{fulldiodeshape}{center}{}{pgf@fulldiode}{\pgfusepath{fill}}
1429 \else
1430 \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width}}
1431 \pgftransformscale{\pgfmathresult}
1432 \pgfnode{emptydiodeshape}{center}{}{pgf@emptydiode}{\pgfusepath{fill}}
1433 \fi
1434 }
1435 %% saturation block, contributed by P.Sacco <paul.sacco@estaca,eu>
1436 \pgfcirc@define@twoports{blocks}
1437 {}
1438 {\ctikzvalof{bipoles/saturation/width}}
1439 {saturation}
1440 {\ctikzvalof{bipoles/saturation/width}}
1441 {\ctikzvalof{bipoles/saturation/width}}
1442 {
1443 \pgfsetlinewidth{1.2\pgfstartlinewidth}
1444 \pgfpathmoveto{\pgfpointorigin}
1445 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{.4\pgf@circ@res@step}}
1446 \pgfpathlineto{\pgfpoint{0.65\pgf@circ@res@step}{.4\pgf@circ@res@step}}
1447 %
1448 \pgfpathmoveto{\pgfpointorigin}
1449 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@step}{-.4\pgf@circ@res@step}}
1450 \pgfpathlineto{\pgfpoint{-0.65\pgf@circ@res@step}{-.4\pgf@circ@res@step}}
1451 \pgfusepath{draw}
1452 }
1453 %% sigmoid
1454 \pgfcirc@define@twoports{blocks}
1455 {}
1456 {\ctikzvalof{bipoles/sigmoid/width}}
1457 {sigmoid}
1458 {\ctikzvalof{bipoles/sigmoid/width}}
1459 {\ctikzvalof{bipoles/sigmoid/width}}
1460 {
1461 \pgfsetlinewidth{1.2\pgfstartlinewidth}
1462 \pgfpathmoveto{\pgfpoint{-.65\pgf@circ@res@step}{-.4\pgf@circ@res@step}}
1463 \pgfpathlineto{\pgfpoint{-.45\pgf@circ@res@step}{-.4\pgf@circ@res@step}}
1464 \pgfpathparabola{\pgfpointorigin}{\pgfpoint{.45\pgf@circ@res@step}{.4\pgf@circ@res@step}}
1465 %
1466 \pgfpathmoveto{\pgfpoint{.65\pgf@circ@res@step}{.4\pgf@circ@res@step}}
1467 \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@step}{.4\pgf@circ@res@step}}
1468 \pgfpathparabola{\pgfpointorigin}{\pgfpoint{-.45\pgf@circ@res@step}{-.4\pgf@circ@res@step}}
1469 \pgfusepath{draw}
1470 }
1471 %% all-or-nothing (comparator) block
1472 \pgfcirc@define@twoports{blocks}
1473 {}
1474 {\ctikzvalof{bipoles/allornothing/width}}
1475 {allornothing}
1476 {\ctikzvalof{bipoles/allornothing/width}}
1477 {\ctikzvalof{bipoles/allornothing/width}}
1478 {
1479 \pgfsetlinewidth{1.2\pgfstartlinewidth}
1480 \pgfpathmoveto{\pgfpoint{-0.55\pgf@circ@res@step}{-.4\pgf@circ@res@step}}
1481 \pgfpathlineto{\pgfpoint{+0pt}{-.4\pgf@circ@res@step}}
1482 \pgfpathlineto{\pgfpoint{+0pt}{.4\pgf@circ@res@step}}
1483 \pgfpathlineto{\pgfpoint{0.55\pgf@circ@res@step}{.4\pgf@circ@res@step}}
1484 \pgfusepath{draw}
1485 }
1486
1487 %% Camera:
1488 \pgfcircdeclarebipolescaled{misc}
1489 {}
1490 {\ctikzvalof{bipoles/camera/depth}}
1491 {camera}
1492 {\ctikzvalof{bipoles/camera/height}}
1493 {\ctikzvalof{bipoles/camera/width}}{
1494 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.7\pgf@circ@res@up}}
1495 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
1496 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{.7\pgf@circ@res@up}}
1497 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@left}{\pgf@circ@res@up}}
1498 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{\pgf@circ@res@up}}
1499 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{.7\pgf@circ@res@up}}
1500 \pgfpathclose
1501 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
1502 \pgf@circ@draworfill
1503 }
1504
1505 % TV:
1506 \pgfcirc@define@twoports{blocks}
1507 {}
1508 {\ctikzvalof{bipoles/tvset/height}}
1509 {tvset}
1510 {\ctikzvalof{bipoles/tvset/height}}
1511 {\ctikzvalof{bipoles/tvset/width}}
1512 {
1513 \pgfsetlinewidth{2\pgflinewidth} % double in size
1514 % Legs
1515 \pgfpathmoveto{\pgfpoint{+0.60\pgf@circ@res@step}{-1.10\pgf@circ@res@step}}
1516 \pgfpathlineto{\pgfpoint{+0.30\pgf@circ@res@step}{-0.70\pgf@circ@res@step}}
1517 \pgfusepath{draw}
1518 %
1519 \pgfpathmoveto{\pgfpoint{-0.60\pgf@circ@res@step}{-1.10\pgf@circ@res@step}}
1520 \pgfpathlineto{\pgfpoint{-0.30\pgf@circ@res@step}{-0.70\pgf@circ@res@step}}
1521 \pgfusepath{draw}
1522 }
1523
1524 % Transceiver (TRX)
1525 \pgfcirc@define@twoports{blocks}
1526 {
1527 \anchor{plus}{\northeast \advance\pgf@y by -0.2\pgf@x\pgf@x=-\pgf@x}
1528 \anchor{minus}{\northeast \advance\pgf@y by -0.2\pgf@x\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
1529 }
1530 {\ctikzvalof{bipoles/trx/height}}
1531 {trx}
1532 {\ctikzvalof{bipoles/trx/height}}
1533 {\ctikzvalof{bipoles/trx/width}}
1534 {
1535 % VFO-Wheel:
1536 \pgfpathcircle{\pgfpoint{0.60\pgf@circ@res@step}{0.00\pgf@circ@res@step}}{0.25\pgf@circ@res@step}
1537 \pgfpathcircle{\pgfpoint{0.68\pgf@circ@res@step}{0.10\pgf@circ@res@step}}{0.06\pgf@circ@res@step}
1538 % Volume and Squelch:
1539 \pgfpathcircle{\pgfpoint{-0.8\pgf@circ@res@step}{+0.15\pgf@circ@res@step}}{0.1\pgf@circ@res@step}
1540 \pgfpathcircle{\pgfpoint{-0.8\pgf@circ@res@step}{-0.15\pgf@circ@res@step}}{0.1\pgf@circ@res@step}
1541 % Display:
1542 \pgfpathrectangle{\pgfpoint{-0.55\pgf@circ@res@step}{-0.25\pgf@circ@res@step}}
1543 {\pgfpoint{+0.75\pgf@circ@res@step}{+0.5\pgf@circ@res@step}}%
1544 \pgfusepath{draw}
1545 }
1546 % Standing Wave Ratio (SWR) Meter
1547 \pgfcirc@define@twoports{blocks}
1548 {}
1549 {\ctikzvalof{bipoles/swr/height}}
1550 {swr}
1551 {\ctikzvalof{bipoles/swr/height}}
1552 {\ctikzvalof{bipoles/swr/width}}
1553 {
1554 % Screen:
1555 \pgfscope
1556 \pgfsetstrokecolor{gray}\pgfsetdash{{1.5pt}{1pt}}{0pt}
1557 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.25\pgf@circ@res@step}}
1558 \pgfpatharc{160}{110}{1.1\pgf@circ@res@step}
1559 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@step}{-0.25\pgf@circ@res@step}}
1560 \pgfpatharc{-160}{-110}{-1.1\pgf@circ@res@step}
1561 \pgfusepath{draw}
1562 \endpgfscope
1563 \pgfpathmoveto{\pgfpoint{-0.7\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
1564 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
1565 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.2\pgf@circ@res@step}}
1566 \pgfpathlineto{\pgfpoint{0pt}{-0.4\pgf@circ@res@step}}
1567 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{-0.2\pgf@circ@res@step}}
1568 \pgfpathclose
1569 \pgfpathmoveto{\pgfpoint{-0.35\pgf@circ@res@step}{-0.3\pgf@circ@res@step}}
1570 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@step}{0.3\pgf@circ@res@step}}
1571 \pgfpathmoveto{\pgfpoint{0.35\pgf@circ@res@step}{-0.3\pgf@circ@res@step}}
1572 \pgfpathlineto{\pgfpoint{-0.3\pgf@circ@res@step}{0.3\pgf@circ@res@step}}
1573 \pgfusepath{draw}
1574 }
1575 % Power supply
1576 \pgfcirc@define@twoports{blocks}
1577 {
1578 \anchor{u1}{\northeast \advance\pgf@y by -0.2\pgf@x\pgf@x=-\pgf@x}
1579 \anchor{u2}{\northeast \advance\pgf@y by -0.2\pgf@x\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
1580 \anchor{plus}{\northeast \advance\pgf@y by -0.2\pgf@x \advance\pgf@x by -0.25\pgf@x}
1581 \anchor{minus}{\northeast \advance\pgf@y by -0.2\pgf@x\pgf@y=-\pgf@y \advance\pgf@x by -0.25\pgf@x}
1582 }
1583 {\ctikzvalof{bipoles/power/height}}
1584 {power}
1585 {\ctikzvalof{bipoles/power/height}}
1586 {\ctikzvalof{bipoles/power/width}}
1587 {
1588 % Displays:
1589 \pgfpathrectangle{\pgfpoint{-0.5\pgf@circ@res@step}{0.00\pgf@circ@res@step}}{\pgfpoint{+0.4\pgf@circ@res@step}{+0.25\pgf@circ@res@step}}%
1590 \pgfpathrectangle{\pgfpoint{-0.0\pgf@circ@res@step}{0.00\pgf@circ@res@step}}{\pgfpoint{+0.4\pgf@circ@res@step}{+0.25\pgf@circ@res@step}}%
1591 % Poti:
1592 \pgfpathcircle{\pgfpoint{-0.30\pgf@circ@res@step}{-0.20\pgf@circ@res@step}}{0.075\pgf@circ@res@step}%
1593 \pgfusepath{draw}
1594 % Switch:
1595 \pgfpathrectangle{\pgfpoint{-0.9\pgf@circ@res@step}{0.00\pgf@circ@res@step}}{\pgfpoint{+0.15\pgf@circ@res@step}{+0.25\pgf@circ@res@step}}%
1596 \pgfpathmoveto{\pgfpoint{-0.90\pgf@circ@res@step}{0.125\pgf@circ@res@step}}
1597 \pgfpathlineto{\pgfpoint{-0.75\pgf@circ@res@step}{0.125\pgf@circ@res@step}}
1598 \pgfusepath{draw}
1599 % Plus:
1600 \color{red}
1601 \pgfsetstrokecolor{red}
1602 \pgfpathcircle{\pgfpoint{0.75\pgf@circ@res@step}{0.20\pgf@circ@res@step}}{0.075\pgf@circ@res@step}%
1603 \pgfusepath{fill}
1604 \pgfpathmoveto{\pgfpoint{0.50\pgf@circ@res@step}{0.20\pgf@circ@res@step}}
1605 \pgfpathlineto{\pgfpoint{0.60\pgf@circ@res@step}{0.20\pgf@circ@res@step}}
1606 \pgfpathmoveto{\pgfpoint{0.55\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
1607 \pgfpathlineto{\pgfpoint{0.55\pgf@circ@res@step}{0.15\pgf@circ@res@step}}
1608 \pgfusepath{stroke}
1609 % Minus:
1610 \color{black}
1611 \pgfsetstrokecolor{black}
1612 \pgfpathcircle{\pgfpoint{0.75\pgf@circ@res@step}{-0.20\pgf@circ@res@step}}{0.075\pgf@circ@res@step}%
1613 \pgfusepath{fill}
1614 \pgfpathmoveto{\pgfpoint{0.50\pgf@circ@res@step}{-0.20\pgf@circ@res@step}}
1615 \pgfpathlineto{\pgfpoint{0.60\pgf@circ@res@step}{-0.20\pgf@circ@res@step}}
1616 \pgfusepath{stroke}
1617 }
1618
1619 %% converters help function
1620 %% definition for styling the DC symbols (GitHub issue #680)
1621 \ctikzset{blocks dc in segments/.initial=1}
1622 \ctikzset{blocks dc out segments/.initial=1}
1623 \ctikzset{blocks dc segments/.code={%
1624 \ctikzset{blocks dc in segments=#1}%
1625 \ctikzset{blocks dc out segments=#1}%
1626 }
1627 }
1628 \def\pgf@circ@twoport@converter@dc#1#2{%
1629 \pgfscope
1630 \pgftransformshift{\pgfpoint{#1\pgf@circ@res@step}{#2\pgf@circ@res@step}}
1631 % upper line, always continuos
1632 \pgfpathmoveto{\pgfpoint{-0.25\pgf@circ@res@step}{0.125\pgf@circ@res@step}}
1633 \pgfpathlineto{\pgfpoint{0.25\pgf@circ@res@step}{0.125\pgf@circ@res@step}}
1634 \pgfusepath{draw}
1635 % lower line, may be dashed
1636 % let us dash everything is needed (this is a change from before)
1637 \ifdim\dimexpr#1\pgf@circ@res@step\relax<0pt
1638 % this is the upper side
1639 \edef\@@tmp{\ctikzvalof{blocks dc in segments}}
1640 \else
1641 % this is the lower side
1642 \edef\@@tmp{\ctikzvalof{blocks dc out segments}}
1643 \fi
1644 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@step/(4*\@@tmp-2)}
1645 \ifnum\@@tmp>1
1646 % we can't use dash here; the dash length is not scaled
1647 \pgf@circ@do@n@hdashes{\@@tmp}{\pgf@circ@res@other}{-0.25\pgf@circ@res@step}{-0.125\pgf@circ@res@step}
1648 \else
1649 \pgfpathmoveto{\pgfpoint{-0.25\pgf@circ@res@step}{-0.125\pgf@circ@res@step}}
1650 \pgfpathlineto{\pgfpoint{0.25\pgf@circ@res@step}{-0.125\pgf@circ@res@step}}
1651 \fi
1652 \pgfusepath{draw}
1653 \endpgfscope
1654 }
1655 \def\pgf@circ@twoport@converter@dc@up{%
1656 \pgf@circ@twoport@converter@dc{-0.5}{0.5}
1657 }
1658 \def\pgf@circ@twoport@converter@dc@down{%
1659 \pgf@circ@twoport@converter@dc{0.5}{-0.5}
1660 }
1661 \def\pgf@circ@twoport@converter@ac#1#2{%
1662 \pgfscope
1663 \pgftransformshift{\pgfpoint{#1\pgf@circ@res@step}{#2\pgf@circ@res@step}}
1664 \pgfpathmoveto{\pgfpoint{-.31\pgf@circ@res@step}{0\pgf@circ@res@step}}
1665 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
1666 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
1667 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
1668 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
1669 \pgfusepath{draw}
1670 \endpgfscope
1671 }
1672 \def\pgf@circ@twoport@converter@ac@up{%
1673 \pgf@circ@twoport@converter@ac{-0.45}{0.5}
1674 }
1675 \def\pgf@circ@twoport@converter@ac@down{%
1676 \pgf@circ@twoport@converter@ac{0.45}{-0.5}
1677 }
1678 \def\pgf@circ@twoport@converter@tac@up{%
1679 \pgf@circ@twoport@converter@ac{-0.45}{0.65}
1680 \pgf@circ@twoport@converter@ac{-0.45}{0.5}
1681 \pgf@circ@twoport@converter@ac{-0.45}{0.35}
1682 }
1683 \def\pgf@circ@twoport@converter@tac@down{%
1684 \pgf@circ@twoport@converter@ac{0.45}{-0.65}
1685 \pgf@circ@twoport@converter@ac{0.45}{-0.5}
1686 \pgf@circ@twoport@converter@ac{0.45}{-0.35}
1687 }
1688 %% single phase ac/dc converter
1689 \pgfcirc@define@twoports{blocks}
1690 {
1691 % these two are left for backward compatibiliyt
1692 \anchor{dc1}{\northeast\pgf@y=.4\pgf@y}
1693 \anchor{dc2}{\northeast\pgf@y=-.4\pgf@y}
1694 % better
1695 \anchor{ac up in}{\northeast\pgf@y=.4\pgf@y\pgf@x=-\pgf@x}
1696 \anchor{ac down in}{\northeast\pgf@y=-.4\pgf@y\pgf@x=-\pgf@x}
1697 \anchor{dc up out}{\northeast\pgf@y=.4\pgf@y}
1698 \anchor{dc down out}{\northeast\pgf@y=-.4\pgf@y}
1699 }
1700 {\ctikzvalof{bipoles/sacdc/width}}
1701 {sacdc}
1702 {\ctikzvalof{bipoles/sacdc/width}}
1703 {\ctikzvalof{bipoles/sacdc/width}}
1704 {
1705 \pgfcirc@twoport@draw@splitline
1706 \ifnum\@@rotation<145 % swap dc/ac for "backward" and "up" symbol
1707 \pgf@circ@twoport@converter@ac@up
1708 \pgf@circ@twoport@converter@dc@down
1709 \else
1710 \pgf@circ@twoport@converter@dc@up
1711 \pgf@circ@twoport@converter@ac@down
1712 \fi
1713 }
1714 %% dc/dc converter
1715 \pgfcirc@define@twoports{blocks}
1716 {
1717 % these two are left for backward compatibiliyt
1718 \anchor{dc1}{\northeast\pgf@y=.4\pgf@y\pgf@x=-\pgf@x}
1719 \anchor{dc2}{\northeast\pgf@y=-.4\pgf@y\pgf@x=-\pgf@x}
1720 % better
1721 \anchor{dc up in}{\northeast\pgf@y=.4\pgf@y\pgf@x=-\pgf@x}
1722 \anchor{dc down in}{\northeast\pgf@y=-.4\pgf@y\pgf@x=-\pgf@x}
1723 \anchor{dc up out}{\northeast\pgf@y=.4\pgf@y}
1724 \anchor{dc down out}{\northeast\pgf@y=-.4\pgf@y}
1725 }
1726 {\ctikzvalof{bipoles/sdcdc/width}}
1727 {sdcdc}
1728 {\ctikzvalof{bipoles/sdcdc/width}}
1729 {\ctikzvalof{bipoles/sdcdc/width}}
1730 {
1731 \pgfcirc@twoport@draw@splitline
1732 % No need to switch here
1733 \pgf@circ@twoport@converter@dc@up
1734 \pgf@circ@twoport@converter@dc@down
1735 }
1736 %% single phase dc/ac converter
1737 \pgfcirc@define@twoports{blocks}
1738 {
1739 % these two are left for backward compatibiliyt
1740 \anchor{dc1}{\northeast\pgf@y=.4\pgf@y\pgf@x=-\pgf@x}
1741 \anchor{dc2}{\northeast\pgf@y=-.4\pgf@y\pgf@x=-\pgf@x}
1742 % better
1743 \anchor{dc up in}{\northeast\pgf@y=.4\pgf@y\pgf@x=-\pgf@x}
1744 \anchor{dc down in}{\northeast\pgf@y=-.4\pgf@y\pgf@x=-\pgf@x}
1745 \anchor{ac up out}{\northeast\pgf@y=.4\pgf@y}
1746 \anchor{ac down out}{\northeast\pgf@y=-.4\pgf@y}
1747 }
1748 {\ctikzvalof{bipoles/sdcac/width}}
1749 {sdcac}
1750 {\ctikzvalof{bipoles/sdcac/width}}
1751 {\ctikzvalof{bipoles/sdcac/width}}
1752 {
1753 \pgfcirc@twoport@draw@splitline
1754 \ifnum\@@rotation<145 % swap dc/ac for "backward" and "up" symbol
1755 \pgf@circ@twoport@converter@dc@up
1756 \pgf@circ@twoport@converter@ac@down
1757 \else
1758 \pgf@circ@twoport@converter@ac@up
1759 \pgf@circ@twoport@converter@dc@down
1760 \fi
1761 }
1762 %% single phase ac/ac converter
1763 \pgfcirc@define@twoports{blocks}
1764 {
1765 \anchor{ac up in}{\northeast\pgf@y=.4\pgf@y\pgf@x=-\pgf@x}
1766 \anchor{ac down in}{\northeast\pgf@y=-.4\pgf@y\pgf@x=-\pgf@x}
1767 \anchor{ac up out}{\northeast\pgf@y=.4\pgf@y}
1768 \anchor{ac down out}{\northeast\pgf@y=-.4\pgf@y}
1769 }
1770 {\ctikzvalof{bipoles/sdcac/width}}
1771 {sacac}
1772 {\ctikzvalof{bipoles/sdcac/width}}
1773 {\ctikzvalof{bipoles/sdcac/width}}
1774 {
1775 \pgfcirc@twoport@draw@splitline
1776 \pgf@circ@twoport@converter@ac@up
1777 \pgf@circ@twoport@converter@ac@down
1778 }
1779 %% threephase ac/dc converter
1780 \pgfcirc@define@twoports{blocks}
1781 {
1782 % legacy, let for compatibility
1783 \anchor{dc1}{\northeast\pgf@y=.4\pgf@y}
1784 \anchor{dc2}{\northeast\pgf@y=-.4\pgf@y}
1785 \anchor{ac1}{\northeast\pgf@y=.6\pgf@y\pgf@x=-\pgf@x}
1786 \anchor{ac2}{\northeast\pgf@y=0\pgf@y\pgf@x=-\pgf@x}
1787 \anchor{ac3}{\northeast\pgf@y=-.6\pgf@y\pgf@x=-\pgf@x}
1788 %better
1789 \anchor{dc up out}{\northeast\pgf@y=.4\pgf@y}
1790 \anchor{dc down out}{\northeast\pgf@y=-.4\pgf@y}
1791 \anchor{ac up in}{\northeast\pgf@y=.6\pgf@y\pgf@x=-\pgf@x}
1792 \anchor{ac mid in}{\northeast\pgf@y=0\pgf@y\pgf@x=-\pgf@x}
1793 \anchor{ac down in}{\northeast\pgf@y=-.6\pgf@y\pgf@x=-\pgf@x}
1794 }
1795 {\ctikzvalof{bipoles/tacdc/width}}
1796 {tacdc}
1797 {\ctikzvalof{bipoles/tacdc/width}}
1798 {\ctikzvalof{bipoles/tacdc/width}}
1799 {
1800 \pgfcirc@twoport@draw@splitline
1801 \ifnum\@@rotation<145 % swap dc/ac for "backward" and "up" symbol
1802 \pgf@circ@twoport@converter@tac@up
1803 \pgf@circ@twoport@converter@dc@down
1804 \else
1805 \pgf@circ@twoport@converter@dc@up
1806 \pgf@circ@twoport@converter@tac@down
1807 \fi
1808 }
1809 %% threephase dc/ac converter
1810 \pgfcirc@define@twoports{blocks}
1811 {
1812 % legacy, let for compatibility
1813 \anchor{dc1}{\northeast\pgf@y=.4\pgf@y\pgf@x=-\pgf@x}
1814 \anchor{dc2}{\northeast\pgf@y=-.4\pgf@y\pgf@x=-\pgf@x}
1815 \anchor{ac1}{\northeast\pgf@y=.6\pgf@y}
1816 \anchor{ac2}{\northeast\pgf@y=0\pgf@y}
1817 \anchor{ac3}{\northeast\pgf@y=-.6\pgf@y}
1818 %better
1819 \anchor{dc up in}{\northeast\pgf@y=.4\pgf@y\pgf@x=-\pgf@x}
1820 \anchor{dc down in}{\northeast\pgf@y=-.4\pgf@y\pgf@x=-\pgf@x}
1821 \anchor{ac up out}{\northeast\pgf@y=.6\pgf@y}
1822 \anchor{ac mid out}{\northeast\pgf@y=0\pgf@y}
1823 \anchor{ac down out}{\northeast\pgf@y=-.6\pgf@y}
1824 }
1825 {\ctikzvalof{bipoles/tdcac/width}}
1826 {tdcac}
1827 {\ctikzvalof{bipoles/tdcac/width}}
1828 {\ctikzvalof{bipoles/tdcac/width}}
1829 {
1830 \pgfcirc@twoport@draw@splitline
1831 \ifnum\@@rotation<145 % swap dc/ac for "backward" and "up" symbol
1832 \pgf@circ@twoport@converter@dc@up
1833 \pgf@circ@twoport@converter@tac@down
1834 \else
1835 \pgf@circ@twoport@converter@tac@up
1836 \pgf@circ@twoport@converter@dc@down
1837 \fi
1838 }
1839 %% threephase ac/ac converter
1840 \pgfcirc@define@twoports{blocks}
1841 {
1842 \anchor{ac up in}{\northeast\pgf@y=.6\pgf@y\pgf@x=-\pgf@x}
1843 \anchor{ac mid in}{\northeast\pgf@y=0\pgf@y\pgf@x=-\pgf@x}
1844 \anchor{ac down in}{\northeast\pgf@y=-.6\pgf@y\pgf@x=-\pgf@x}
1845 \anchor{ac up out}{\northeast\pgf@y=.6\pgf@y}
1846 \anchor{ac mid out}{\northeast\pgf@y=0\pgf@y}
1847 \anchor{ac down out}{\northeast\pgf@y=-.6\pgf@y}
1848 }
1849 {\ctikzvalof{bipoles/tdcac/width}}
1850 {tacac}
1851 {\ctikzvalof{bipoles/tdcac/width}}
1852 {\ctikzvalof{bipoles/tdcac/width}}
1853 {
1854 \pgfcirc@twoport@draw@splitline
1855 \pgf@circ@twoport@converter@tac@down
1856 \pgf@circ@twoport@converter@tac@up
1857 }
1858 %%%% Non-square blocks. We do not use the standard macros
1859 %%%% this one is adapted to do the boxed thing
1860 %
1861 \long\def\pgfcirc@define@twoports@boxed#1#2#3#4#5#6#7{
1862 \pgfcircdeclarebipolescaled{#1}
1863 {
1864 \savedmacro{\componentisboxed}{\edef\componentisboxed{\ifpgf@circuit@boxed 1\else 0\fi}}
1865 \pgcirc@twoport@additional@anchors
1866 #2
1867 }
1868 {#3}
1869 {#4}
1870 {#5}
1871 {#6}
1872 {
1873 \pgf@circ@res@step=#6\pgf@circ@scaled@Rlen %6 is the real width parameter
1874 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
1875 \pgfsetarrows{-}
1876 \pgfcirc@twoport@maybedash
1877 % draw outer box
1878 \ifpgf@circuit@boxed
1879 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
1880 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
1881 \pgf@circ@draworfill
1882 \fi
1883 \pgf@circ@inputarrow
1884 \ifpgf@circuit@boxed
1885 \pgfsetlinewidth{\pgfstartlinewidth}
1886 % draw solid line for inner symbol if no box is drawn and not fully dashed
1887 % set inner symbol options
1888 \pgf@circ@subset@color{blocks/inner color}
1889 \pgf@circ@set@relative@thickness{inner thickness}
1890 \ifpgf@circuit@full@dashed\else\pgfsetdash{}{0pt}\fi
1891 \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box
1892 \else
1893 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
1894 \fi
1895 #7
1896 }
1897 }
1898 %% voltage controled oscillator
1899 \pgfcirc@define@twoports@boxed{blocks}
1900 {}
1901 {\ctikzvalof{bipoles/vco/width}}
1902 {vco}
1903 {\ctikzvalof{bipoles/twoport/width}}
1904 {\ctikzvalof{bipoles/vco/width}}
1905 {
1906 % ok, this is a bit of incoherence
1907 \divide \pgf@circ@res@step by 2
1908 % draw circle
1909 \pgfscope
1910 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
1911 \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@step}
1912 \pgf@circ@draworfill
1913 \endpgfscope
1914 \pfgcirc@twoport@rotate@inner@symbol
1915 \pgfcirc@twoport@draw@sine{0}{0}
1916 }
1917 %% amplifier, iamplifier, and vamplifier
1918 %% Amplifier %% Beware, not using the generic twoport(s) macros.
1919 \pgfcirc@define@twoports@boxed{blocks}
1920 {
1921 \anchor{up}{%
1922 \northeast\pgf@x=0pt\relax
1923 \ifnum\componentisboxed=0
1924 \pgf@y=0.55\pgf@y
1925 \fi
1926 }
1927 \anchor{down}{%
1928 \northeast\pgf@x=0pt\pgf@y=-\pgf@y\relax
1929 \ifnum\componentisboxed=0
1930 \pgf@y=0.55\pgf@y
1931 \fi
1932 }
1933 }
1934 {\ifpgf@circuit@boxed\ctikzvalof{bipoles/twoport/width}\else\ctikzvalof{bipoles/amp/width}\fi}
1935 {amp}
1936 {\ifpgf@circuit@boxed\ctikzvalof{bipoles/twoport/width}\else\ctikzvalof{bipoles/amp/width}\fi}
1937 {\ifpgf@circuit@boxed\ctikzvalof{bipoles/twoport/width}\else\ctikzvalof{bipoles/amp/width}\fi}
1938 {
1939 % draw triangle
1940 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}}
1941 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}}
1942 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}}
1943 \pgfpathclose
1944 \pgf@circ@draworfill
1945 \pfgcirc@twoport@get@symbol@rotation
1946 % draw inner text
1947 \pgf@circ@text@strokecolor
1948 \ifnum\@@rotation=180
1949 \pgftransformrotate{180}
1950 \pgftext[center,x=0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
1951 \else
1952 \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
1953 \fi
1954 }
1955 %% Instrumentation amplifier %% Beware, not using the generic twoport(s) macros.
1956 \pgfcirc@define@twoports@boxed{blocks}
1957 {
1958 \anchor{up}{%
1959 \northeast\pgf@x=0pt\relax
1960 \ifnum\componentisboxed=0
1961 \pgf@y=0.75\pgf@y
1962 \fi
1963 }
1964 \anchor{down}{%
1965 \northeast\pgf@x=0pt\pgf@y=-\pgf@y\relax
1966 \ifnum\componentisboxed=0
1967 \pgf@y=0.75\pgf@y
1968 \fi
1969 }
1970 }
1971 {\ifpgf@circuit@boxed\ctikzvalof{bipoles/twoport/width}\else\ctikzvalof{bipoles/amp/width}\fi}
1972 {iamp}
1973 {\ifpgf@circuit@boxed\ctikzvalof{bipoles/twoport/width}\else\ctikzvalof{bipoles/amp/width}\fi}
1974 {\ifpgf@circuit@boxed\ctikzvalof{bipoles/twoport/width}\else\ctikzvalof{bipoles/amp/width}\fi}
1975 {
1976 % draw blunt triangle
1977 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}}
1978 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0.2\pgf@circ@res@step}}
1979 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-0.2\pgf@circ@res@step}}
1980 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}}
1981 \pgfpathclose
1982 \pgf@circ@draworfill
1983 \pfgcirc@twoport@get@symbol@rotation
1984 % draw inner text
1985 \pgf@circ@text@strokecolor
1986 \ifnum\@@rotation=180
1987 \pgftransformrotate{180}
1988 \pgftext[center,x=0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
1989 \else
1990 \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
1991 \fi
1992 }
1993 %% variable amplifier %% Beware, not using the generic twoport(s) macros.
1994 \pgfcirc@define@twoports@boxed{blocks}
1995 {
1996 \anchor{up}{%
1997 \northeast\pgf@x=0pt\relax
1998 \ifnum\componentisboxed=0
1999 \pgf@y=0.55\pgf@y
2000 \fi
2001 }
2002 \anchor{down}{%
2003 \northeast\pgf@x=0pt\pgf@y=-\pgf@y\relax
2004 \ifnum\componentisboxed=0
2005 \pgf@y=0.55\pgf@y
2006 \fi
2007 }
2008 }
2009 {\ifpgf@circuit@boxed\ctikzvalof{bipoles/twoport/width}\else\ctikzvalof{bipoles/amp/width}\fi}
2010 {vamp}
2011 {\ifpgf@circuit@boxed\ctikzvalof{bipoles/twoport/width}\else\ctikzvalof{bipoles/amp/width}\fi}
2012 {\ifpgf@circuit@boxed\ctikzvalof{bipoles/twoport/width}\else\ctikzvalof{bipoles/amp/width}\fi}
2013 {
2014 % draw triangle
2015 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}}
2016 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}}
2017 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}}
2018 \pgfpathclose
2019 \pgf@circ@draworfill
2020 \pfgcirc@twoport@get@symbol@rotation
2021 % draw arrow
2022 \pgfsetlinewidth{\pgfstartlinewidth}
2023 \pgfcirc@set@arrows{tunable}{}{latex}
2024 \pgfpathmoveto{\pgfpoint{-0.8\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
2025 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@step}{0.6\pgf@circ@res@step}}
2026 \pgfusepath{draw}
2027 % draw inner text
2028 \pgf@circ@text@strokecolor
2029 \ifnum\@@rotation=180
2030 \pgftransformrotate{180}
2031 \pgftext[center,x=0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
2032 \else
2033 \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
2034 \fi
2035 }
2036
2037 %% optical fiber
2038 \pgfcirc@define@twoports@norotate{blocks}
2039 {}
2040 {\ctikzvalof{bipoles/fiber/width}}
2041 {fiber}
2042 {\ctikzvalof{bipoles/fiber/width}}
2043 {\ctikzvalof{bipoles/fiber/width}}
2044 {
2045 \pgfpathcircle{\pgfpoint{0.2\pgf@circ@res@left}{0.4\pgf@circ@res@up}}{0.4\pgf@circ@res@up}
2046 \pgfpathcircle{\pgfpoint{0\pgf@circ@res@left}{0.4\pgf@circ@res@up}}{0.4\pgf@circ@res@up}
2047 \pgfpathcircle{\pgfpoint{-0.2\pgf@circ@res@left}{0.4\pgf@circ@res@up}}{0.4\pgf@circ@res@up}
2048 \pgfusepath{draw}
2049 % always use basic line width for this
2050 \pgfsetlinewidth{\pgfstartlinewidth}
2051 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
2052 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
2053 \pgfusepath{draw}
2054 }
2055 \pgfcirc@activate@bipole@simple{l}{fiber}
2056 %
2057 % plot-type filters
2058 %
2059 %% lowpass plot-type filter
2060 \pgfcirc@define@twoports{blocks}
2061 {}
2062 {\ctikzvalof{bipoles/lowpassp/width}}
2063 {lowpassp}
2064 {\ctikzvalof{bipoles/lowpassp/width}}
2065 {\ctikzvalof{bipoles/lowpassp/width}}
2066 {
2067 \pgfcirc@setup@plot@filters
2068 \pgfpathmoveto{\pgfpoint{-0.7\pgf@circ@res@step}{0.6\pgf@circ@res@step}}
2069 \pgfpathlineto{\pgfpoint{0pt}{0.6\pgf@circ@res@step}}
2070 \ifpgf@circuit@idealfilter
2071 \pgfpathlineto{\pgfpoint{ 0pt}{-0.6\pgf@circ@res@step}}
2072 \pgfpathlineto{\pgfpoint{ 0.7\pgf@circ@res@step}{-0.6\pgf@circ@res@step}}
2073 \else
2074 \pgfpathlineto{\pgfpoint{ 0.7\pgf@circ@res@step}{-0.6\pgf@circ@res@step}}
2075 \fi
2076 \pgfusepath{draw}
2077 }
2078 %% highpass plot-type filter
2079 \pgfcirc@define@twoports{blocks}
2080 {}
2081 {\ctikzvalof{bipoles/highpassp/width}}
2082 {highpassp}
2083 {\ctikzvalof{bipoles/highpassp/width}}
2084 {\ctikzvalof{bipoles/highpassp/width}}
2085 {
2086 \pgfcirc@setup@plot@filters
2087 \pgfpathmoveto{\pgfpoint{-0.7\pgf@circ@res@step}{-0.6\pgf@circ@res@step}}
2088 \ifpgf@circuit@idealfilter
2089 \pgfpathlineto{\pgfpoint{0pt}{-0.6\pgf@circ@res@step}}
2090 \fi
2091 \pgfpathlineto{\pgfpoint{0pt}{0.6\pgf@circ@res@step}}
2092 \pgfpathlineto{\pgfpoint{ 0.7\pgf@circ@res@step}{0.6\pgf@circ@res@step}}
2093 \pgfusepath{draw}
2094 }
2095 %% bandpass plot-type filter
2096 \pgfcirc@define@twoports{blocks}
2097 {}
2098 {\ctikzvalof{bipoles/bandpassp/width}}
2099 {bandpassp}
2100 {\ctikzvalof{bipoles/bandpassp/width}}
2101 {\ctikzvalof{bipoles/bandpassp/width}}
2102 {
2103 \pgfcirc@setup@plot@filters
2104 \pgfpathmoveto{\pgfpoint{-0.7\pgf@circ@res@step}{-0.6\pgf@circ@res@step}}
2105 \ifpgf@circuit@idealfilter
2106 \pgfpathlineto{\pgfpoint{-0.35\pgf@circ@res@step}{-0.6\pgf@circ@res@step}}
2107 \pgfpathlineto{\pgfpoint{-0.35\pgf@circ@res@step}{0.6\pgf@circ@res@step}}
2108 \pgfpathlineto{\pgfpoint{0.35\pgf@circ@res@step}{0.6\pgf@circ@res@step}}
2109 \pgfpathlineto{\pgfpoint{0.35\pgf@circ@res@step}{-0.6\pgf@circ@res@step}}
2110 \else
2111 \pgfpathlineto{\pgfpoint{-0.4\pgf@circ@res@step}{0.6\pgf@circ@res@step}}
2112 \pgfpathlineto{\pgfpoint{ 0.4\pgf@circ@res@step}{0.6\pgf@circ@res@step}}
2113 \fi
2114 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.6\pgf@circ@res@step}}
2115 \pgfusepath{draw}
2116 }
2117 %% bandstop plot-type filter
2118 \pgfcirc@define@twoports{blocks}
2119 {}
2120 {\ctikzvalof{bipoles/bandstopp/width}}
2121 {bandstopp}
2122 {\ctikzvalof{bipoles/bandstopp/width}}
2123 {\ctikzvalof{bipoles/bandstopp/width}}
2124 {
2125 \pgfcirc@setup@plot@filters
2126 \pgfpathmoveto{\pgfpoint{-0.7\pgf@circ@res@step}{0.6\pgf@circ@res@step}}
2127 \ifpgf@circuit@idealfilter
2128 \pgfpathlineto{\pgfpoint{-0.35\pgf@circ@res@step}{0.6\pgf@circ@res@step}}
2129 \pgfpathlineto{\pgfpoint{-0.35\pgf@circ@res@step}{-0.6\pgf@circ@res@step}}
2130 \pgfpathlineto{\pgfpoint{0.35\pgf@circ@res@step}{-0.6\pgf@circ@res@step}}
2131 \pgfpathlineto{\pgfpoint{0.35\pgf@circ@res@step}{0.6\pgf@circ@res@step}}
2132 \else
2133 \pgfpathlineto{\pgfpoint{-0.4\pgf@circ@res@step}{-0.6\pgf@circ@res@step}}
2134 \pgfpathlineto{\pgfpoint{ 0.4\pgf@circ@res@step}{-0.6\pgf@circ@res@step}}
2135 \fi
2136 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{0.6\pgf@circ@res@step}}
2137 \pgfusepath{draw}
2138 }
2139 %% resonant plot-type filter
2140 \pgfcirc@define@twoports{blocks}
2141 {}
2142 {\ctikzvalof{bipoles/resonantp/width}}
2143 {resonantp}
2144 {\ctikzvalof{bipoles/resonantp/width}}
2145 {\ctikzvalof{bipoles/resonantp/width}}
2146 {
2147 \pgfcirc@setup@plot@filters
2148 \pgfpathmoveto{\pgfpoint{-0.7\pgf@circ@res@step}{-0.6\pgf@circ@res@step}}
2149 \ifpgf@circuit@idealfilter
2150 \pgfpathlineto{\pgfpoint{0pt}{-0.6\pgf@circ@res@step}}
2151 \pgfpathlineto{\pgfpoint{0pt}{0.6\pgf@circ@res@step}}
2152 \pgfpathlineto{\pgfpoint{ 0pt}{-0.6\pgf@circ@res@step}}
2153 \else
2154 \pgfpathlineto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.6\pgf@circ@res@step}}
2155 \pgfpathlineto{\pgfpoint{0pt}{0.7\pgf@circ@res@step}}
2156 \pgfpathlineto{\pgfpoint{ 0.15\pgf@circ@res@step}{-0.6\pgf@circ@res@step}}
2157 \fi
2158 \pgfpathlineto{\pgfpoint{ 0.7\pgf@circ@res@step}{-0.6\pgf@circ@res@step}}
2159 \pgfusepath{draw}
2160 }
2161 %% notch plot-type filter
2162 \pgfcirc@define@twoports{blocks}
2163 {}
2164 {\ctikzvalof{bipoles/notchp/width}}
2165 {notchp}
2166 {\ctikzvalof{bipoles/notchp/width}}
2167 {\ctikzvalof{bipoles/notchp/width}}
2168 {
2169 \pgfcirc@setup@plot@filters
2170 \pgfpathmoveto{\pgfpoint{-0.7\pgf@circ@res@step}{0.6\pgf@circ@res@step}}
2171 \ifpgf@circuit@idealfilter
2172 \pgfpathlineto{\pgfpoint{0pt}{0.6\pgf@circ@res@step}}
2173 \pgfpathlineto{\pgfpoint{0pt}{-0.6\pgf@circ@res@step}}
2174 \pgfpathlineto{\pgfpoint{ 0pt}{0.6\pgf@circ@res@step}}
2175 \else
2176 \pgfpathlineto{\pgfpoint{-0.15\pgf@circ@res@step}{0.6\pgf@circ@res@step}}
2177 \pgfpathlineto{\pgfpoint{0pt}{-0.7\pgf@circ@res@step}}
2178 \pgfpathlineto{\pgfpoint{ 0.15\pgf@circ@res@step}{0.6\pgf@circ@res@step}}
2179 \fi
2180 \pgfpathlineto{\pgfpoint{ 0.7\pgf@circ@res@step}{0.6\pgf@circ@res@step}}
2181 \pgfusepath{draw}
2182 }
2183 % %>>>
2184
2185 %% Path definitions for Blocks%<<<
2186
2187 \pgfcirc@activate@bipole@simple{l}{twoport}
2188 \pgfcirc@activate@bipole@simple{l}{twoportsplit}
2189 \pgfcirc@activate@bipole@simple{l}{vco}
2190 \pgfcirc@activate@bipole@simple{l}{bandpass}
2191 \pgfcirc@activate@bipole@simple{l}{bandstop}
2192 \pgfcirc@activate@bipole@simple{l}{highpass}
2193 \pgfcirc@activate@bipole@simple{l}{highpass2}
2194 \pgfcirc@activate@bipole@simple{l}{lowpass}
2195 \pgfcirc@activate@bipole@simple{l}{lowpass2}
2196 \pgfcirc@activate@bipole@simple{l}{allpass}
2197 \pgfcirc@activate@bipole@simple{l}{vallpass}
2198 \pgfcirc@activate@bipole@simple{l}{bgenerator}
2199 \pgfcirc@activate@bipole@simple{l}{qgenerator}
2200 \pgfcirc@activate@bipole@simple{l}{cgenerator}
2201 \pgfcirc@activate@bipole@simple{l}{ngenerator}
2202 \pgfcirc@activate@bipole@simple{l}{adc}
2203 \pgfcirc@activate@bipole@simple{l}{dac}
2204 \pgfcirc@activate@bipole@simple{l}{dsp}
2205 \pgfcirc@activate@bipole@simple{l}{fft}
2206 \pgfcirc@activate@bipole@simple{l}{amp}
2207 \pgfcirc@activate@bipole@simple{l}{iamp}
2208 \pgfcirc@activate@bipole@simple{l}{vamp}
2209 \pgfcirc@activate@bipole@simple{l}{piattenuator}
2210 \pgfcirc@activate@bipole@simple{l}{vpiattenuator}
2211 \pgfcirc@activate@bipole@simple{l}{tattenuator}
2212 \pgfcirc@activate@bipole@simple{l}{vtattenuator}
2213 \pgfcirc@activate@bipole@simple{l}{phaseshifter}
2214 \pgfcirc@activate@bipole@simple{l}{vphaseshifter}
2215 \pgfcirc@activate@bipole@simple{l}{biast}
2216 \pgfcirc@activate@bipole@simple{l}{sinetable}
2217 \pgfcirc@activate@bipole@simple{l}{register}
2218 \pgfcirc@activate@bipole@simple{l}{detector}
2219 \pgfcirc@activate@bipole@simple{l}{saturation}
2220 \pgfcirc@activate@bipole@simple{l}{sigmoid}
2221 \pgfcirc@activate@bipole@simple{l}{allornothing}
2222 \pgfcirc@activate@bipole@simple{l}{camera}
2223 \pgfcirc@activate@bipole@simple{l}{tvset}
2224 \pgfcirc@activate@bipole@simple{l}{trx}
2225 \pgfcirc@activate@bipole@simple{l}{swr}
2226 \pgfcirc@activate@bipole@simple{l}{power}
2227 \pgfcirc@activate@bipole@simple{l}{fiber}
2228 \pgfcirc@activate@bipole@simple{l}{sacdc}
2229 \pgfcirc@activate@bipole@simple{l}{sdcac}
2230 \pgfcirc@activate@bipole@simple{l}{sdcdc}
2231 \pgfcirc@activate@bipole@simple{l}{sacac}
2232 \pgfcirc@activate@bipole@simple{l}{tacdc}
2233 \pgfcirc@activate@bipole@simple{l}{tdcac}
2234 \pgfcirc@activate@bipole@simple{l}{tacac}
2235 \pgfcirc@activate@bipole@simple{l}{lowpassp}
2236 \pgfcirc@activate@bipole@simple{l}{highpassp}
2237 \pgfcirc@activate@bipole@simple{l}{bandpassp}
2238 \pgfcirc@activate@bipole@simple{l}{bandstopp}
2239 \pgfcirc@activate@bipole@simple{l}{notchp}
2240 \pgfcirc@activate@bipole@simple{l}{resonantp}
2241 % %>>>
2242
2243 %% Node shapes for Block elements %<<<
2244 %
2245 \def\pgcirc@twoport@additional@northwest@anchors{%
2246 \savedmacro{\blockleftanchorpos}{\edef\blockleftanchorpos{\ctikzvalof{block left anchors pos}}}
2247 \savedmacro{\blockrightanchorpos}{\edef\blockrightanchorpos{\ctikzvalof{block right anchors pos}}}
2248 \anchor{left down}{\northwest\pgf@y=-\blockleftanchorpos\pgf@y}
2249 \anchor{right down}{\northwest\pgf@x=-\pgf@x\pgf@y=-\blockrightanchorpos\pgf@y}
2250 \anchor{right up}{\northwest\pgf@x=-\pgf@x\pgf@y=\blockrightanchorpos\pgf@y}
2251 \anchor{left up}{\northwest\pgf@y=\blockleftanchorpos\pgf@y}
2252 \anchor{up}{\northwest\pgf@x=0pt\relax}
2253 \anchor{down}{\northwest\pgf@y=-\pgf@y\pgf@x=0pt\relax}
2254 }
2255 % utility macro for the anchors
2256 \def\pgf@circ@circular@rf@anchors#1{%
2257 \savedanchor\northwest{
2258 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
2259 \ifpgf@circuit@boxed
2260 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
2261 \pgf@y=.5\pgf@y
2262 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
2263 \pgf@x=.5\pgf@x
2264 \else
2265 \pgf@y=\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
2266 \pgf@y=.5\pgf@y
2267 \pgf@x=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
2268 \pgf@x=.5\pgf@x
2269 \fi
2270 }
2271 % border anchors
2272 \anchorborder{
2273 \pgf@circ@res@left=\pgf@x
2274 \pgf@circ@res@up=\pgf@y
2275 \ifnum\componentisboxed=0
2276 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
2277 }{\pgfpoint{\ctikzvalof{tripoles/#1/width}*\scaledRlen/2}{\ctikzvalof{tripoles/#1/width}*\scaledRlen/2}}
2278 \else
2279 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
2280 }{\pgfpoint{\ctikzvalof{tripoles/#1/width}*\scaledRlen/2}{\ctikzvalof{tripoles/#1/width}*\scaledRlen/2}}
2281 \fi
2282 }
2283 \pgfcirc@northwest@symmetric@geoanchors
2284 \anchor{geocenter}{\pgfpointorigin}
2285 \pgcirc@twoport@additional@northwest@anchors
2286 % Deprecated number anchors
2287 \anchor{1}{\northwest\pgf@y=0pt}
2288 \anchor{2}{\northwest\pgf@y=-\pgf@y\pgf@x=0pt}
2289 \anchor{3}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
2290 \anchor{4}{\northwest\pgf@y=\pgf@y\pgf@x=0pt}
2291 % input output anchors (also quite bad)
2292 \anchor{in 1}{\northwest\pgf@y=0pt}
2293 \anchor{in1}{\northwest\pgf@y=0pt}
2294 \anchor{in}{\northwest\pgf@y=0pt}
2295 \anchor{in 2}{\northwest\pgf@y=-\pgf@y\pgf@x=0pt}
2296 \anchor{in2}{\northwest\pgf@y=-\pgf@y\pgf@x=0pt}
2297 \anchor{out}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
2298 \savedanchor{\textoffset}{%
2299 \pgf@x= -.5\wd\pgfnodeparttextbox % (set)
2300 \pgf@y= \dimexpr-.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox\relax % (sum)
2301 }
2302 \anchor{text}{\pgfextractx{\pgf@xa}{\textoffset}\pgfextracty{\pgf@ya}{\textoffset}
2303 \northwest
2304 \pgf@x=\pgf@xa \advance\pgf@y by \pgf@ya
2305 }
2306 }
2307 % draw the body rectangle and circle if and when needed
2308 \def\pgf@circ@circular@rf@box@circle{%
2309 \pgfstartlinewidth=\pgflinewidth
2310 % draw outer box
2311 \ifpgf@circuit@boxed
2312 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
2313 \fi
2314 % draw outer circle
2315 \ifpgf@circuit@boxed
2316 \pgf@circ@res@step=.7\pgf@circ@res@step
2317 % draw solid line for inner symbol if no box is drawn and not fully dashed
2318 \ifpgf@circuit@full@dashed\else\pgfsetdash{}{0pt}\fi
2319 \pgf@circ@subset@color{blocks/inner color}
2320 \pgf@circ@set@relative@thickness{inner thickness}
2321 \else
2322 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
2323 \fi
2324 \ifpgf@circuit@boxedcircled
2325 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
2326 \fi
2327 \pgf@circ@draworfill
2328 }
2329 %
2330 \pgfdeclareshape{mixer}
2331 {
2332 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
2333 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
2334 \savedmacro{\componentisboxed}{\edef\componentisboxed{\ifpgf@circuit@boxed 1\else 0\fi}}
2335 % build the anchor set
2336 \anchor{center}{\pgfpointorigin}
2337 \pgf@circ@circular@rf@anchors{mixer}
2338 \pgf@circ@draw@component{
2339 \pgf@circ@setcolor
2340 \pgf@circ@scaled@Rlen=\scaledRlen
2341 \pgf@circ@res@step=\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen
2342 \pgfscope
2343 \pgf@circ@circular@rf@box@circle
2344 % draw inner stuff
2345 % draw solid line for inner symbol if no box is drawn and not fully dashed
2346 \ifpgf@circuit@full@dashed\else\pgfsetdash{}{0pt}\fi
2347 \pgfsetlinewidth{\pgfstartlinewidth}
2348 \pgf@circ@subset@color{blocks/inner color}
2349 \pgf@circ@set@relative@thickness{inner thickness}
2350 \pgfpathmoveto{\pgfpointorigin}
2351 \pgfpathmoveto{\pgfpointpolar{135}{0.5\pgf@circ@res@step}}
2352 \pgfpathlineto{\pgfpointpolar{-45}{0.5\pgf@circ@res@step}}
2353 \pgfpathmoveto{\pgfpointorigin}
2354 \pgfpathmoveto{\pgfpointpolar{45}{0.5\pgf@circ@res@step}}
2355 \pgfpathlineto{\pgfpointpolar{-135}{0.5\pgf@circ@res@step}}
2356 \pgfusepath{draw}
2357 \endpgfscope
2358 }
2359 }
2360
2361 \pgfdeclareshape{adder}
2362 {
2363 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
2364 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
2365 \savedmacro{\componentisboxed}{\edef\componentisboxed{\ifpgf@circuit@boxed 1\else 0\fi}}
2366 % build the anchor set
2367 \anchor{center}{\pgfpointorigin}
2368 \pgf@circ@circular@rf@anchors{adder}
2369 \pgf@circ@draw@component{
2370 \pgf@circ@setcolor
2371 \pgf@circ@scaled@Rlen=\scaledRlen
2372 \pgf@circ@res@step=\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen
2373 \pgfscope
2374 \pgf@circ@circular@rf@box@circle
2375 % draw inner stuff
2376 % draw solid line for inner symbol if no box is drawn and not fully dashed
2377 \ifpgf@circuit@full@dashed\else\pgfsetdash{}{0pt}\fi
2378 \pgfsetlinewidth{\pgfstartlinewidth}
2379 \pgf@circ@subset@color{blocks/inner color}
2380 \pgf@circ@set@relative@thickness{inner thickness}
2381 \pgfpathmoveto{\pgfpointorigin}
2382 \pgfpathmoveto{\pgfpointpolar{0}{0.3\pgf@circ@res@step}}
2383 \pgfpathlineto{\pgfpointpolar{180}{0.3\pgf@circ@res@step}}
2384 \pgfpathmoveto{\pgfpointorigin}
2385 \pgfpathmoveto{\pgfpointpolar{90}{0.3\pgf@circ@res@step}}
2386 \pgfpathlineto{\pgfpointpolar{270}{0.3\pgf@circ@res@step}}
2387 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
2388 \pgfusepath{draw}
2389 \endpgfscope
2390 }
2391 }
2392
2393 \pgfdeclareshape{oscillator}
2394 {
2395 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
2396 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
2397 \savedmacro{\componentisboxed}{\edef\componentisboxed{\ifpgf@circuit@boxed 1\else 0\fi}}
2398 % build the anchor set --- the center of an oscillator is on the right
2399 \anchor{center}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
2400 \pgf@circ@circular@rf@anchors{oscillator}
2401 % text anchor, in the south-east corner
2402 \savedanchor{\textheight}{%
2403 \pgf@y= \ht\pgfnodeparttextbox %
2404 }
2405 \anchor{text}{\pgfextracty{\pgf@ya}{\textheight}
2406 \northwest \pgf@x=-1.1\pgf@x \pgf@y=-\pgf@y
2407 \advance\pgf@y by -0.1\pgf@ya
2408 }
2409 \pgf@circ@draw@component{
2410 \pgf@circ@setcolor
2411 \pgf@circ@scaled@Rlen=\scaledRlen
2412 \pgf@circ@res@step=\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen{}
2413 \pgfscope
2414 \pgf@circ@circular@rf@box@circle
2415 % draw inner sine waves
2416 % draw solid line for inner symbol if no box is drawn and not fully dashed
2417 \ifpgf@circuit@full@dashed\else\pgfsetdash{}{0pt}\fi
2418 \pgfsetlinewidth{\pgfstartlinewidth}
2419 \pgf@circ@subset@color{blocks/inner color}
2420 \pgf@circ@set@relative@thickness{inner thickness}
2421 \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners!
2422 \pgfpathmoveto{\pgfpoint{-0.3\pgf@circ@res@step}{0\pgf@circ@res@step}}
2423 \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}}
2424 \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}}
2425 \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}}
2426 \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}}
2427 \pgfusepath{draw}
2428 \endpgfscope
2429 }
2430 }
2431
2432 \pgfdeclareshape{circulator}
2433 {
2434 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
2435 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
2436 \savedmacro{\componentisboxed}{\edef\componentisboxed{\ifpgf@circuit@boxed 1\else 0\fi}}
2437 % build the anchor set
2438 \anchor{center}{\pgfpointorigin}
2439 \pgf@circ@circular@rf@anchors{circulator}
2440 \pgf@circ@draw@component{
2441 \pgf@circ@setcolor
2442 \pgf@circ@scaled@Rlen=\scaledRlen
2443 \pgf@circ@res@step=\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen
2444 \pgfscope
2445 \pgf@circ@circular@rf@box@circle
2446 % inner arrow
2447 % draw solid line for inner symbol if no box is drawn and not fully dashed
2448 \ifpgf@circuit@full@dashed\else\pgfsetdash{}{0pt}\fi
2449 \pgfsetlinewidth{\pgfstartlinewidth}
2450 \pgf@circ@subset@color{blocks/inner color}
2451 \pgf@circ@set@relative@thickness{inner thickness}
2452 \pgfsetarrowsend{latex}
2453 \pgfpathmoveto{\pgfpoint{-0.25\pgf@circ@res@step}{0}}
2454 \pgfpatharc{180}{-90} {0.25\pgf@circ@res@step}
2455 \pgfpathlineto{\pgfpoint{-5pt}{-0.2\pgf@circ@res@step}}
2456 \pgfusepath{draw}
2457 \endpgfscope
2458 }
2459 }
2460
2461 %% gridnode
2462 \pgfkeys{tikz/gridlines/.code={\ctikzset{blocks/gridnode/gridlines=#1}}}
2463 \pgfkeys{tikz/gridlines/.default=\ctikzvalof{blocks/gridnode/gridlines}}
2464 \ctikzset{blocks/gridnode/gridlines/.initial=7}
2465
2466 \pgfdeclareshape{gridnode}
2467 {
2468 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
2469 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
2470 \savedmacro{\gridlines}{\edef\gridlines{\ctikzvalof{blocks/gridnode/gridlines}}}
2471 \savedanchor\northwest{
2472 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
2473 \pgf@y=\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
2474 \pgf@y=.5\pgf@y
2475 \pgf@x=-\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
2476 \pgf@x=.5\pgf@x
2477 }
2478 \pgfcirc@northwest@symmetric@geoanchors
2479 \pgcirc@twoport@additional@northwest@anchors
2480 \anchor{center}{\pgfpointorigin}
2481 \anchor{right}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
2482 \anchor{left}{\northwest\pgf@y=0pt}
2483 % text anchor, in the south-east corner
2484 \savedanchor{\textheight}{%
2485 \pgf@y= \ht\pgfnodeparttextbox %
2486 }
2487 \anchor{text}{\pgfextracty{\pgf@ya}{\textheight}
2488 \northwest \pgf@x=-1.1\pgf@x \pgf@y=-\pgf@y
2489 \advance\pgf@y by -0.1\pgf@ya
2490 }
2491 \pgf@circ@draw@component{
2492 \pgf@circ@setcolor
2493 \pgf@circ@scaled@Rlen=\scaledRlen
2494 \pgf@circ@res@step=\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
2495 \northwest
2496 \pgf@circ@res@up = \pgf@y
2497 \pgf@circ@res@down = -\pgf@y
2498 \pgf@circ@res@right = -\pgf@x
2499 \pgf@circ@res@left = \pgf@x
2500 \pgf@circ@res@step = \ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
2501 \divide \pgf@circ@res@step by 2
2502 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
2503 \pgf@circ@res@other = \pgf@circ@res@left
2504 \advance\pgf@circ@res@other by \pgf@circ@res@step
2505 \pgfcirc@twoport@maybedash
2506 % draw outer box
2507 \pgfstartlinewidth=\pgflinewidth
2508 \pgf@circ@twoportbox
2509 \pgf@circ@inputarrow
2510 \ifpgf@circuit@full@dashed\else\pgfsetdash{}{0pt}\fi
2511 \pgfsetarrows{-} %never draw arrows
2512 \pgfstartlinewidth=\pgflinewidth
2513 \pgf@circ@subset@color{blocks/inner color}
2514 \pgf@circ@set@relative@thickness{inner thickness}
2515 % draw grid
2516 \ifodd\gridlines
2517 \edef\gridmiddleline{\numexpr(\gridlines+1)/2\relax}
2518 \else
2519 \edef\gridmiddleline{\numexpr\gridlines/2+1\relax}
2520 \fi
2521 \foreach \line in {\gridmiddleline,...,\gridlines}
2522 {
2523 \pgfmathsetmacro\relpos{4*\line/(\gridlines+1) - 3}
2524 \pgfpathmoveto{\pgfpoint{\relpos\pgf@circ@res@right}{\pgf@circ@res@up}}
2525 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\relpos\pgf@circ@res@up}}
2526 \pgfpathmoveto{\pgfpoint{\relpos\pgf@circ@res@left}{\pgf@circ@res@up}}
2527 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\relpos\pgf@circ@res@up}}
2528 }
2529 %prevent from draw the inner cross twice
2530 \foreach \line in {1,...,\numexpr\gridmiddleline-1\relax}
2531 {
2532 \pgfmathsetmacro\relpos{1 - 4*\line/(\gridlines+1)}
2533 \pgfpathmoveto{\pgfpoint{\relpos\pgf@circ@res@right}{\pgf@circ@res@down}}
2534 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\relpos\pgf@circ@res@down}}
2535 \pgfpathmoveto{\pgfpoint{\relpos\pgf@circ@res@left}{\pgf@circ@res@down}}
2536 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\relpos\pgf@circ@res@down}}
2537 }
2538 \pgfusepath{draw}
2539 }
2540 }
2541 % Wilkinson divider
2542 \pgfdeclareshape{wilkinson}{
2543 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
2544 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
2545 \savedanchor\northwest{%
2546 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
2547 \pgf@y=\ctikzvalof{tripoles/wilkinson/height}\pgf@circ@scaled@Rlen
2548 \pgf@y=.5\pgf@y
2549 \pgf@x= \pgf@circ@scaled@Rlen
2550 \pgf@x=.5\pgf@x
2551 \pgf@x=-\ctikzvalof{tripoles/wilkinson/width}\pgf@x
2552 }
2553 \pgfcirc@northwest@symmetric@geoanchors
2554 \pgcirc@twoport@additional@northwest@anchors
2555 \anchor{right}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
2556 \anchor{left}{\northwest\pgf@y=0pt}
2557 \anchor{center}{\pgfpointorigin}
2558 \anchor{in}{\northwest\pgf@y=0pt}
2559 \anchor{out1}{\northwest\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
2560 \anchor{out2}{\northwest\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
2561 \savedanchor{\textoffset}{%
2562 \pgf@y = 0.5\ht\pgfnodeparttextbox % (add)
2563 \pgf@x = -0.5\wd\pgfnodeparttextbox % (set)
2564 }
2565 \anchor{text}{\pgfextractx{\pgf@xa}{\textoffset}\pgfextracty{\pgf@ya}{\textoffset}%
2566 \northwest
2567 \pgf@x = \pgf@xa \advance \pgf@y by \pgf@ya
2568 }
2569 \pgf@circ@draw@component{
2570 \pgf@circ@setcolor
2571 \pgf@circ@scaled@Rlen=\scaledRlen
2572 %
2573 \northwest
2574 \pgf@circ@res@up = \pgf@y
2575 \pgf@circ@res@down = -\pgf@y
2576 \pgf@circ@res@right = -\pgf@x
2577 \pgf@circ@res@left = \pgf@x
2578 %
2579 \pgfstartlinewidth=\pgflinewidth
2580 % draw outer box
2581 \pgf@circ@twoportbox
2582 \pgf@circ@inputarrow
2583 % draw inner stuff
2584 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
2585 \pgfsetarrows{-} %never draw arrows
2586 \pgfsetlinewidth{\pgfstartlinewidth}
2587 % set inner symbol options
2588 \pgf@circ@subset@color{blocks/inner color}
2589 \pgf@circ@set@relative@thickness{inner thickness}
2590 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
2591 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
2592 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
2593 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
2594 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
2595 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
2596 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
2597 \pgfusepath{draw}
2598 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
2599 % draw inner resisitor - european or american style is recognised
2600 {
2601 \pgftransformshift{\pgfpoint{0.5\pgf@circ@res@right}{0pt}}
2602 \pgftransformrotate{90}
2603 % calculate size of resistor
2604 \ifpgf@circuit@europeanresistor
2605 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width} / 2}
2606 \pgftransformscale{\pgfmathresult}
2607 \pgfnode{genericshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
2608 \else
2609 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width} / 2}
2610 \pgftransformscale{\pgfmathresult}
2611 \pgfnode{resistorshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
2612 \fi
2613 }
2614 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
2615 \pgfpathlineto{\pgfpointanchor{wilk@int@R}{right}}
2616 \pgfpathmoveto{\pgfpointanchor{wilk@int@R}{left}}
2617 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
2618 \pgfusepath{draw}
2619 }
2620 }
2621
2622 %% resistive splitter
2623 \pgfdeclareshape{splitter}{
2624 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
2625 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
2626 \savedanchor\northwest{%
2627 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
2628 \pgf@y=\ctikzvalof{tripoles/splitter/height}\pgf@circ@scaled@Rlen
2629 \pgf@y=.5\pgf@y
2630 \pgf@x= \pgf@circ@scaled@Rlen
2631 \pgf@x=.5\pgf@x
2632 \pgf@x=-\ctikzvalof{tripoles/splitter/width}\pgf@x
2633 }
2634 \pgfcirc@northwest@symmetric@geoanchors
2635 \pgcirc@twoport@additional@northwest@anchors
2636 \anchor{center}{\pgfpointorigin}
2637 \anchor{right}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
2638 \anchor{left}{\northwest\pgf@y=0pt}
2639 \anchor{in}{\northwest\pgf@y=0pt}
2640 \anchor{out1}{\northwest\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
2641 \anchor{out2}{\northwest\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
2642 \savedanchor{\textoffset}{%
2643 \pgf@y = 0.5\ht\pgfnodeparttextbox % (add)
2644 \pgf@x = -0.5\wd\pgfnodeparttextbox % (set)
2645 }
2646 \anchor{text}{\pgfextractx{\pgf@xa}{\textoffset}\pgfextracty{\pgf@ya}{\textoffset}%
2647 \northwest
2648 \pgf@x = \pgf@xa \advance \pgf@y by \pgf@ya
2649 }
2650 \pgf@circ@draw@component{
2651 \pgf@circ@setcolor
2652 \pgf@circ@scaled@Rlen=\scaledRlen
2653 %
2654 \northwest
2655 \pgf@circ@res@up = \pgf@y
2656 \pgf@circ@res@down = -\pgf@y
2657 \pgf@circ@res@right = -\pgf@x
2658 \pgf@circ@res@left = \pgf@x
2659 %
2660 \pgfstartlinewidth=\pgflinewidth
2661 % draw outer box
2662 \pgf@circ@twoportbox
2663 \pgf@circ@inputarrow
2664 % draw inner stuff
2665 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
2666 \pgfsetarrows{-} %never draw arrows
2667 \pgfsetlinewidth{\pgfstartlinewidth}
2668 % set inner symbol options
2669 \pgf@circ@subset@color{blocks/inner color}
2670 \pgf@circ@set@relative@thickness{inner thickness}
2671 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
2672 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
2673 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
2674 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
2675 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
2676 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
2677 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
2678 \pgfusepath{draw}
2679 %
2680 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
2681 % draw inner resisitors - european or american style is recognised
2682 \foreach \respt/\resang/\linepta/\lineptb in %
2683 { \pgfpoint{0.5\pgf@circ@res@right}{0pt}/90/%
2684 \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}/\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down},%
2685 \pgfpoint{0}{0.25\pgf@circ@res@up}/25/%
2686 \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}/\pgfpoint{0.5\pgf@circ@res@left}{0},%
2687 \pgfpoint{0}{0.25\pgf@circ@res@down}/-25/%
2688 \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}/\pgfpoint{0.5\pgf@circ@res@left}{0}}
2689 {
2690 {
2691 \pgftransformshift{\respt}
2692 \pgftransformrotate{\resang}
2693 % calculate size of resistor
2694 \ifpgf@circuit@europeanresistor
2695 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width} / 2}
2696 \pgftransformscale{\pgfmathresult}
2697 \pgfnode{genericshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
2698 \else
2699 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width} / 2}
2700 \pgftransformscale{\pgfmathresult}
2701 \pgfnode{resistorshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
2702 \fi
2703 }
2704 \pgfpathmoveto{\linepta}
2705 \pgfpathlineto{\pgfpointanchor{wilk@int@R}{right}}
2706 \pgfpathmoveto{\pgfpointanchor{wilk@int@R}{left}}
2707 \pgfpathlineto{\lineptb}
2708 \pgfusepath{draw}
2709 }
2710 }
2711 }
2712
2713 %% generic splitter
2714 \pgfdeclareshape{genericsplitter}{
2715 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
2716 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
2717 \savedanchor\northwest{%
2718 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
2719 \pgf@y=\ctikzvalof{tripoles/genericsplitter/height}\pgf@circ@scaled@Rlen
2720 \pgf@y=.5\pgf@y
2721 \pgf@x= \pgf@circ@scaled@Rlen
2722 \pgf@x=.5\pgf@x
2723 \pgf@x=-\ctikzvalof{tripoles/genericsplitter/width}\pgf@x
2724 }
2725 \pgfcirc@northwest@symmetric@geoanchors
2726 \pgcirc@twoport@additional@northwest@anchors
2727 \anchor{center}{\pgfpointorigin}
2728 \anchor{right}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
2729 \anchor{left}{\northwest\pgf@y=0pt}
2730 \anchor{in}{\northwest\pgf@y=0pt}
2731 \anchor{out1}{\northwest\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
2732 \anchor{out2}{\northwest\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
2733 \savedanchor{\textanchor}{%
2734 \pgf@y = -.5\ht\pgfnodeparttextbox % (set)
2735 \pgf@x = -.2\wd\pgfnodeparttextbox % (set)
2736 }
2737 \anchor{text}{\textanchor}
2738 \pgf@circ@draw@component{
2739 \pgf@circ@setcolor
2740 \pgf@circ@scaled@Rlen=\scaledRlen
2741 %
2742 \northwest
2743 \pgf@circ@res@up = \pgf@y
2744 \pgf@circ@res@down = -\pgf@y
2745 \pgf@circ@res@right = -\pgf@x
2746 \pgf@circ@res@left = \pgf@x
2747 %
2748 \pgfstartlinewidth=\pgflinewidth
2749 % draw outer box
2750 \pgf@circ@twoportbox
2751 \pgf@circ@inputarrow
2752 % draw inner stuff
2753 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
2754 \pgfsetarrows{-} %never draw arrows
2755 \pgfsetlinewidth{\pgfstartlinewidth}
2756 % set inner symbol options
2757 \pgf@circ@subset@color{blocks/inner color}
2758 \pgf@circ@set@relative@thickness{inner thickness}
2759 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
2760 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
2761 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
2762 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
2763 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
2764 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
2765 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
2766 \pgfusepath{draw}
2767 %
2768 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
2769 \foreach \linepta/\lineptb in %
2770 { \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}/\pgfpoint{0.5\pgf@circ@res@left}{0},%
2771 \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}/\pgfpoint{0.5\pgf@circ@res@left}{0}}
2772 {
2773 \pgfpathmoveto{\linepta}
2774 \pgfpathlineto{\lineptb}
2775 \pgfusepath{draw}
2776 }
2777 }
2778 }
2779
2780 %% four-ports generics
2781 \long\def\pgfcircdeclarefourport#1#2{
2782 \pgfdeclareshape{#1}{
2783 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
2784 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
2785 \savedanchor\northwest{%
2786 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
2787 \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen
2788 \pgf@y=.5\pgf@y
2789 \pgf@x=.5\pgf@circ@scaled@Rlen
2790 \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x
2791 }
2792 \pgfcirc@northwest@symmetric@geoanchors
2793 \pgcirc@twoport@additional@northwest@anchors
2794 \anchor{center}{\pgfpointorigin}
2795 \anchor{right}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
2796 \anchor{left}{\northwest\pgf@y=0pt}
2797 \anchor{port1}{\northwest\pgf@y=-0.5\pgf@y}
2798 \anchor{port2}{\northwest\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
2799 \anchor{port3}{\northwest\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
2800 \anchor{port4}{\northwest\pgf@y=0.5\pgf@y}
2801 %1,2,3,4 are deprecated
2802 \anchor{1}{\northwest\pgf@y=-0.5\pgf@y}
2803 \anchor{2}{\northwest\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
2804 \anchor{3}{\northwest\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
2805 \anchor{4}{\northwest\pgf@y=0.5\pgf@y}
2806 \savedanchor{\textoffset}{%
2807 \pgf@y = 0.5\ht\pgfnodeparttextbox % (add)
2808 \pgf@x = -0.5\wd\pgfnodeparttextbox % (set)
2809 }
2810 \anchor{text}{\pgfextractx{\pgf@xa}{\textoffset}\pgfextracty{\pgf@ya}{\textoffset}%
2811 \northwest
2812 \pgf@x = \pgf@xa \advance \pgf@y by \pgf@ya
2813 }
2814 \pgf@circ@draw@component{
2815 \pgf@circ@setcolor
2816 \northwest
2817 \pgf@circ@res@up = \pgf@y
2818 \pgf@circ@res@down = -\pgf@y
2819 \pgf@circ@res@right = -\pgf@x
2820 \pgf@circ@res@left = \pgf@x
2821 \pgf@circ@scaled@Rlen=\scaledRlen
2822 %
2823 \pgfstartlinewidth=\pgflinewidth
2824 % draw outer box
2825 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
2826 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
2827 \pgf@circ@draworfill
2828 % draw inner stuff
2829 % set inner symbol options
2830 \pgf@circ@subset@color{blocks/inner color}
2831 \pgf@circ@set@relative@thickness{inner thickness}
2832 #2%
2833 % draw inner text
2834 \pgf@circ@text@strokecolor
2835 \pgftext[center,x=-0.15\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
2836 }
2837 }
2838 }
2839
2840 % four-port
2841 \pgfcircdeclarefourport{fourport}{}
2842
2843 % straight coupler
2844 \pgfcircdeclarefourport{coupler}{
2845 \pgfsetlinewidth{\pgfstartlinewidth}
2846 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}}
2847 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
2848 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
2849 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
2850 \pgfusepath{draw}
2851
2852 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
2853 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
2854 \pgfsetarrows{latex-latex}
2855 \pgfusepath{draw}
2856 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
2857 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
2858 \pgfsetarrows{latex-latex}
2859 \pgfusepath{draw}
2860 }
2861
2862 % "bended" coupler
2863 \pgfcircdeclarefourport{coupler2}{
2864 \pgfsetlinewidth{\pgfstartlinewidth}
2865 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}}
2866 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
2867 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
2868 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
2869 \pgfusepath{draw}
2870
2871 \pgfscope
2872 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}}
2873 \pgfpatharc{0}{90} {0.4\pgf@circ@res@up}
2874 \pgfsetarrowsend{latex}
2875 \pgfusepath{draw}
2876 \endpgfscope
2877 \pgfscope
2878 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}}
2879 \pgfpatharc{0}{-90} {0.4\pgf@circ@res@up}
2880 \pgfsetarrowsend{latex}
2881 \pgfusepath{draw}
2882 \endpgfscope
2883 \pgfscope
2884 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}}
2885 \pgfpatharc{180}{90} {0.4\pgf@circ@res@up}
2886 \pgfsetarrowsend{latex}
2887 \pgfusepath{draw}
2888 \endpgfscope
2889 \pgfscope
2890 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}}
2891 \pgfpatharc{-180}{-90} {0.4\pgf@circ@res@up}
2892 \pgfsetarrowsend{latex}
2893 \pgfusepath{draw}
2894 \endpgfscope
2895 }
2896
2897 % mach zehnder modulator
2898 \pgfdeclareshape{mzm}{
2899 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
2900 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
2901 \savedanchor\northwest{%
2902 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
2903 \pgf@y=\ctikzvalof{tripoles/mzm/height}\pgf@circ@scaled@Rlen
2904 \pgf@y=.5\pgf@y
2905 \pgf@x= \pgf@circ@scaled@Rlen
2906 \pgf@x=.5\pgf@x
2907 \pgf@x=-\ctikzvalof{tripoles/mzm/width}\pgf@x
2908 }
2909 \pgfcirc@northwest@symmetric@geoanchors
2910 \pgcirc@twoport@additional@northwest@anchors
2911 \anchor{center}{\pgfpointorigin}
2912 \anchor{in}{ \northwest \pgf@y=0pt }
2913 \anchor{mod}{ \northwest \pgf@x=0pt }
2914 \anchor{out}{ \northwest \pgf@x=-\pgf@x \pgf@y=0pt }
2915 \savedanchor{\textoffset}{%
2916 \pgf@y = 0.5\ht\pgfnodeparttextbox % (add)
2917 \pgf@x = -0.5\wd\pgfnodeparttextbox % (set)
2918 }
2919 \anchor{text}{\pgfextractx{\pgf@xa}{\textoffset}\pgfextracty{\pgf@ya}{\textoffset}%
2920 \northwest
2921 \pgf@x = \pgf@xa \advance \pgf@y by \pgf@ya
2922 }
2923 \pgf@circ@draw@component{
2924 \pgf@circ@setcolor
2925 \pgf@circ@scaled@Rlen=\scaledRlen
2926 \northwest
2927 \pgf@circ@res@up = \pgf@y
2928 \pgf@circ@res@down = -\pgf@y
2929 \pgf@circ@res@right = -\pgf@x
2930 \pgf@circ@res@left = \pgf@x
2931 \pgfstartlinewidth=\pgflinewidth
2932 % draw outer box
2933 \pgf@circ@twoportbox
2934 \pgf@circ@inputarrow
2935 % draw inner stuff
2936 \pfgcirc@twoport@rotate@inner@symbol
2937 % draw inner symbol
2938 \ifpgf@circuit@full@dashed\else\pgfsetdash{}{0pt}\fi
2939 \pgfsetarrows{-} %never draw arrows
2940 \pgfsetlinewidth{\pgfstartlinewidth}
2941 % set inner symbol options
2942 \pgf@circ@subset@color{blocks/inner color}
2943 \pgf@circ@set@relative@thickness{inner thickness}
2944 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
2945 \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@left}{\pgf@circ@res@zero}}
2946 %
2947 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{\pgf@circ@res@zero}}
2948 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@up}}
2949 %
2950 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{\pgf@circ@res@zero}}
2951 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
2952 %
2953 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
2954 \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@right}{\pgf@circ@res@zero}}
2955 %
2956 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@right}{\pgf@circ@res@zero}}
2957 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@up}}
2958 %
2959 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@right}{\pgf@circ@res@zero}}
2960 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@down}}
2961 %
2962 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@up}}
2963 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@up}}
2964 %
2965 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@down}}
2966 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
2967 %
2968 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
2969 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{0.35\pgf@circ@res@up}}
2970 \pgfpathlineto{\pgfpoint{0.25\pgf@circ@res@right}{0.1\pgf@circ@res@up}}
2971 \pgfusepath{draw}
2972 }
2973 }
2974 % %>>>
2975
2976 % vim: set fdm=marker fmr=%<<<,%>>>: