From 4c30a361eee60be54502480b984e1b28975dde94 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 9 May 2022 20:28:17 +0000 Subject: circuitikz (9may22) git-svn-id: svn://tug.org/texlive/trunk@63269 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/generic/circuitikz/pgfcircbipoles.tex | 154 +++++++++- .../tex/generic/circuitikz/pgfcirctripoles.tex | 315 +++++++++++++++++---- 2 files changed, 409 insertions(+), 60 deletions(-) (limited to 'Master/texmf-dist/tex/generic') diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex index 94212962fb4..d09e907a8de 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex @@ -3239,6 +3239,9 @@ \ctikzset{bipoles/diode/height/.initial=.50} \ctikzset{bipoles/diode/width/.initial=.40} +% for horizontally-double-sided diodes, like tvs diodes (transorb) +\ctikzset{bipoles/ddiode/width/.initial=.80}% must be 2*diode width +% for vertically taller diodes \ctikzset{bipoles/bidirectionaldiode/height/.initial=1.1} \ctikzset{bipoles/bidirectionaldiode/width/.initial=1} \ctikzset{bipoles/bidirectionaldiode/diode width left/.initial=.3} @@ -3803,6 +3806,65 @@ \pgfusepath{draw} } +%% Transorbs +%% Empty zigzag TVS diode (transorb) +\pgfcircdeclarebipolescaled{diodes} +{% fix the anchor border + \pgfcirc@border@extend@updown{1.3}{1.3} +} +{\ctikzvalof{bipoles/diode/height}} +{emptytvsdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/ddiode/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfscope + \pgfscope + \pgftransformxscale{0.5} + \pgftransformxshift{\pgf@circ@res@left} + \pgf@circ@basicdiodeshape + \endpgfscope + \pgfscope + \pgftransformxscale{-0.5} + \pgftransformxshift{\pgf@circ@res@left} + \pgf@circ@basicdiodeshape + \endpgfscope + \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{1.3\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{1.3\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} +%% Black zigzag TVS diode (transorb) +\pgfcircdeclarebipolescaled{diodes} +{% fix the anchor border + \pgfcirc@border@extend@updown{1.3}{1.3} +} +{\ctikzvalof{bipoles/diode/height}} +{fulltvsdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/ddiode/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfscope + \pgftransformxscale{0.5} + \pgftransformxshift{\pgf@circ@res@left} + \pgf@circ@fulldiode@triangle@shift + \endpgfscope + \pgfscope + \pgftransformxscale{-0.5} + \pgftransformxshift{\pgf@circ@res@left} + \pgf@circ@fulldiode@triangle@shift + \endpgfscope + \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{1.3\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{1.3\pgf@circ@res@down}} + \pgfusepath{draw} +} + + %% Empty bidirectionaldiode \pgfcircdeclarebipolescaled{diodes} {} @@ -4174,6 +4236,8 @@ \pgfcirc@style@to@style{#1 photodiode}{pD#2} \pgfcirc@activate@bipole{l}{#1varcap}{#1varcap}{#1 varcap} \pgfcirc@style@to@style{#1 varcap}{VC#2} + \pgfcirc@activate@bipole{l}{#1tvsdiode}{#1tvsdiode}{#1 TVS diode} + \pgfcirc@style@to@style{#1 TVS diode}{tvsD#2} \pgfcirc@activate@bipole{l}{#1bidirectionaldiode}{#1bidirectionaldiode}{#1 bidirectionaldiode} \pgfcirc@style@to@style{#1 bidirectionaldiode}{biD#2} \pgfcirc@activate@bipole{l}{#1thyristor}{#1thyristor}{#1 thyristor} @@ -4210,6 +4274,8 @@ \pgfcirc@style@to@style{#1 photodiode}{pD#2} \pgfcirc@node@to@style{l}{emptyvarcap}{#1 varcap}{\circuitikzbasekey/bipole/is strokedsymbol=true} \pgfcirc@style@to@style{#1 varcap}{VC#2} + \pgfcirc@node@to@style{l}{emptytvsdiode}{#1 TVS diode}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 TVS diode}{tvsD#2} \pgfcirc@node@to@style{l}{emptybidirectionaldiode}{#1 bidirectionaldiode}{\circuitikzbasekey/bipole/is strokedsymbol=true} \pgfcirc@style@to@style{#1 bidirectionaldiode}{biD#2} \pgfcirc@node@to@style{l}{emptythyristor}{#1 thyristor}{\circuitikzbasekey/bipole/is strokedsymbol=true} @@ -4242,12 +4308,12 @@ \pgfcirc@style@to@style{led}{leD} \pgfcirc@style@to@style{\pgfcircdiodestylemacro photodiode}{photodiode} \pgfcirc@style@to@style{photodiode}{pD} - \pgfcirc@style@to@style{\pgfcircdiodestylemacro laser diode}{laser diode} \pgfcirc@style@to@style{laser diode}{lasD} - \pgfcirc@style@to@style{\pgfcircdiodestylemacro varcap}{varcap} \pgfcirc@style@to@style{varcap}{VC} +\pgfcirc@style@to@style{\pgfcircdiodestylemacro TVS diode}{TVS diode} +\pgfcirc@style@to@style{TVS diode}{tvsD} \pgfcirc@style@to@style{\pgfcircdiodestylemacro bidirectionaldiode}{bidirectionaldiode} \pgfcirc@style@to@style{bidirectionaldiode}{biD} \pgfcirc@style@to@style{\pgfcircdiodestylemacro thyristor}{thyristor} @@ -4966,6 +5032,90 @@ \pgfcirc@activate@bipole{l}{cuteopeningswitch}{cuteopeningswitch}{cute opening switch} \pgfcirc@style@to@style{cute opening switch}{cogsw}% %>>> +%% Proximity switch auxiliary shapes%<<< +%% proximeter shape, for usage with switches +\ctikzset{proximeter/width/.initial=0.3} +\ctikzset{proximeter/hlines thickness/.initial=0.5} +\ctikzset{proximeter/hlines position/.initial=0.3} +\pgfdeclareshape{proximeter} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedmacro{\hlinepos}{\edef\hlinepos{\ctikzvalof{proximeter/hlines position}}} + \savedanchor\northeast{% + \pgfmathsetlength{\pgf@y}{\ctikzvalof{proximeter/width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + \pgf@x=\pgf@y + } + \anchor{center}{\pgfpointorigin} + % geo anchors based on north-east + \pgfcirc@northeast@symmetric@geoanchors + \anchor{text}{% + \northeast + \pgf@x=\dimexpr -.5\wd\pgfnodeparttextbox\relax + \advance\pgf@y by .6\ht\pgfnodeparttextbox\relax + } + \anchor{hlines ne}{% + \northeast + \pgf@y=\hlinepos\pgf@y + \advance\pgf@x by -\pgf@y + } + \anchor{hlines nw}{% + \northeast + \pgf@y=\hlinepos\pgf@y + \advance\pgf@x by -\pgf@y\pgf@x=-\pgf@x + } + \anchor{hlines se}{% + \northeast + \pgf@y=\hlinepos\pgf@y + \advance\pgf@x by -\pgf@y + \pgf@y=-\pgf@y + } + \anchor{hlines sw}{% + \northeast + \pgf@y=\hlinepos\pgf@y + \advance\pgf@x by -\pgf@y\pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchorborder{ + % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y} + \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)} + \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)} + \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)} + \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)} + \pgfextracty{\pgf@circ@res@up}{\northeast} + % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up} + % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy} + \pgfpointintersectionoflines + {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}} + {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}} + % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y} + \pgf@x=\@@switchx\pgf@x + \pgf@y=\@@switchy\pgf@y + } + \pgf@circ@draw@component{ + \northeast\pgf@circ@res@temp=\pgf@y + \pgf@circ@setcolor + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@temp}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@temp}} + \pgfpathclose + \pgf@circ@draworfill + \pgfsetlinewidth{\ctikzvalof{proximeter/hlines thickness}*\pgflinewidth} + \pgfmathsetlength{\pgf@circ@res@up}{\hlinepos*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@circ@res@right}{\pgf@circ@res@temp-\pgf@circ@res@up} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up}} + \pgfusepath{draw} + } + +} +\pgfcirc@node@to@path{proximeter}{inline proximeter}{} +% %>>> + %%%%%%%%%%%%%%%%% %% Instruments %%%%%%%%%%%%%%%%% diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex index 711276dd77f..596171c5add 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex @@ -3370,11 +3370,64 @@ \newif\ifpgf@circ@trcircle\pgf@circ@trcirclefalse \ctikzset{tr circle/.is if=pgf@circ@trcircle} \tikzset{tr circle/.is if=pgf@circ@trcircle} +% partial borders styles +% this can be "none" or 4 numbers saying the style for each part: +% 0 --- nothing, 1 --- solid, 2 --- dashed +\ctikzset{transistor circle/partial borders/.initial=none} % Value none for normal borders +\ctikzset{transistor circle/partial border dash/.initial={{2pt}{2pt}}} %%>>> %% definitions of transistor shapes%<<< % +% draw partial transistor outline +% +\def\pgf@circ@trcircle@split#1#2#3#4\relax{%split the six numbers + \edef\@@a{#1}\edef\@@b{#2}\edef\@@c{#3}\edef\@@d{#4}% +} +\def\pgf@circ@trcircle@setdash{% + \edef\@@dash{\ctikzvalof{transistor circle/partial border dash}}% + % \typeout{DASH:\@@dash}% + \expandafter\pgfsetdash\expandafter{\@@dash}{0pt}% +} +% this is the same as the tubes' one, but let's keep it separated +\def\pgf@circ@trcircle@draw@style#1{% + \ifcase#1 + \pgfusepath{discard}% case 0, will discard the path + \or + \pgfsetdash{}{0pt}\pgfusepath{draw}% case 1, solid + \or + \pgf@circ@trcircle@setdash\pgfusepath{draw}% case 2, dashed + \else + \pgfutil@packagewarning{circuitikz}{Transistor circle draw style not known!}% + \pgfusepath{draw}% + \fi +} +% % add a circle to the transistor: +\def\pgf@circ@trcircle@draw@partial#1{% + \expandafter\pgf@circ@trcircle@split#1\relax + \typeout{PARTIAL: \@@a:\@@b:\@@c:\@@d} + \pgfscope % right side upper arc + \pgfpathmoveto{\pgfpoint{\circleleft+\circleradius}{\circleradius}} + \pgfpatharc{90}{0}{\circleradius} + \pgf@circ@trcircle@draw@style{\@@a} + \endpgfscope + \pgfscope % right side lower arc + \pgfpathmoveto{\pgfpoint{\circleleft+2*\circleradius}{0pt}} + \pgfpatharc{0}{-90}{\circleradius} + \pgf@circ@trcircle@draw@style{\@@b} + \endpgfscope + \pgfscope % left side lower arc + \pgfpathmoveto{\pgfpoint{\circleleft+\circleradius}{-\circleradius}} + \pgfpatharc{-90}{-180}{\circleradius} + \pgf@circ@trcircle@draw@style{\@@c} + \endpgfscope + \pgfscope % left side upper arc + \pgfpathmoveto{\pgfpoint{\circleleft}{0pt}} + \pgfpatharc{-180}{-270}{\circleradius} + \pgf@circ@trcircle@draw@style{\@@d} + \endpgfscope +} % \def\pgfcirc@transistorcircle{ \ifpgf@circ@trcircle @@ -3394,7 +3447,15 @@ % \pgfmathsetlength{\pgf@circ@res@temp}{((#2+\extrabodydiodelen)-(#1)+(#3)*(#3)/((#2+\extrabodydiodelen)-(#1)))/2} % \pgfpathcircle{\pgfpoint{#1+\pgf@circ@res@temp}{0pt}}{\pgf@circ@res@temp} \pgfpathcircle{\pgfpoint{\circleleft+\circleradius}{0pt}}{\circleradius} - \pgf@circ@draworfill + \edef\@@partial{\ctikzvalof{transistor circle/partial borders}} + \ifx\@@partial\pgf@nonetext + % Circle fill and draw if it's not partial... for speed + \pgf@circ@draworfill + \else + % otherwise, just fill and do the partial fill + \pgf@circ@maybefill + \pgf@circ@trcircle@draw@partial{\@@partial} + \fi \endpgfscope \fi } @@ -3539,6 +3600,19 @@ \anchor{circle center}{ \pgf@y=0pt\pgf@x=\circleleft\advance\pgf@x by\circleradius } + \anchor{circle top}{ + \pgf@y=\circleradius\pgf@x=\circleleft\advance\pgf@x by\circleradius + } + \anchor{circle bottom}{ + \pgf@y=-\circleradius\pgf@x=\circleleft\advance\pgf@x by\circleradius + } + \anchor{circle left}{ + \pgf@y=0pt\pgf@x=\circleleft + } + \anchor{circle right}{ + \pgf@y=0pt\pgf@x=\circleleft + \advance\pgf@x by \circleradius\advance\pgf@x by \circleradius + } \savedanchor{\centergap}{% this is the center position between gate and base % get "left" \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} @@ -7965,6 +8039,11 @@ \ctikzset{tubes/cathode right extend/.initial=0.075} % extension at the right side \ctikzset{tubes/filament distance/.initial=0.1} % distance from cathode \ctikzset{tubes/filament angle/.initial=15} % Angle from centerpoint +% partial borders styles +% this can be "none" or 6 numbers saying the style for each part: +% 0 --- nothing, 1 --- solid, 2 --- dashed +\ctikzset{tubes/partial borders/.initial=none} % Value none for normal borders +\ctikzset{tubes/partial border dash/.initial={{2pt}{2pt}}} \ctikzset{/tikz/circuitikz/tripoles/magnetron/width/.initial=1} @@ -8138,27 +8217,135 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Electronic tubes, submitted by J. op den Brouw %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - +% +% draw partial tube outline +% +\def\pgf@circ@tubes@split#1#2#3#4#5#6\relax{%split the six numbers + \edef\@@a{#1}\edef\@@b{#2}\edef\@@c{#3}\edef\@@d{#4}\edef\@@e{#5}\edef\@@f{#6}% +} +\def\pgf@circ@tubes@setdash{% + \edef\@@dash{\ctikzvalof{tubes/partial border dash}}% + % \typeout{DASH:\@@dash}% + \expandafter\pgfsetdash\expandafter{\@@dash}{0pt}% +} +% this is the same as the transistor circles' one, but let's keep it separated +\def\pgf@circ@tubes@draw@style#1{% + \ifcase#1 + \pgfusepath{discard}% case 0, will discard the path + \or + \pgfsetdash{}{0pt}\pgfusepath{draw}% case 1, solid + \or + \pgf@circ@tubes@setdash\pgfusepath{draw}% case 2, dashed + \else + \pgfutil@packagewarning{circuitikz}{Tube border draw style not known!}% + \pgfusepath{draw}% + \fi +} +\def\pgf@circ@tubes@draw@partial#1{% + \expandafter\pgf@circ@tubes@split#1\relax + % \typeout{PARTIAL: \@@a:\@@b:\@@c:\@@d:\@@e:\@@f} + \ifdim\ctikzvalof{tubes/width}pt>\ctikzvalof{tubes/height}pt\relax + % horizontal tube + \pgfutil@tempdima=\pgf@circ@res@right + \advance\pgfutil@tempdima by -\pgf@circ@res@up + \pgfscope % left side upper arc + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{0pt}} + \pgfpatharc{180}{90}{\pgf@circ@res@up} + \pgf@circ@tubes@draw@style{\@@a} + \endpgfscope + \pgfscope % upper horizontal part + \pgfpathmoveto{\pgfpoint{-\pgfutil@tempdima}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgfutil@tempdima}{\pgf@circ@res@up}} + \pgf@circ@tubes@draw@style{\@@b} + \endpgfscope + \pgfscope % right side upper arc + \pgfpathmoveto{\pgfpoint{\pgfutil@tempdima}{\pgf@circ@res@up}} + \pgfpatharc{90}{0}{\pgf@circ@res@up} + \pgf@circ@tubes@draw@style{\@@c} + \endpgfscope + \pgfscope % right side lower arc + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpatharc{0}{-90}{\pgf@circ@res@up} + \pgf@circ@tubes@draw@style{\@@d} + \endpgfscope + \pgfscope % lower horizontal part + \pgfpathmoveto{\pgfpoint{\pgfutil@tempdima}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgfutil@tempdima}{-\pgf@circ@res@up}} + \pgf@circ@tubes@draw@style{\@@e} + \endpgfscope + \pgfscope % left side lower arc + \pgfpathmoveto{\pgfpoint{-\pgfutil@tempdima}{-\pgf@circ@res@up}} + \pgfpatharc{270}{180}{\pgf@circ@res@up} + \pgf@circ@tubes@draw@style{\@@f} + \endpgfscope + \else + % vertical tube + \pgfutil@tempdima=\pgf@circ@res@up + \advance\pgfutil@tempdima by -\pgf@circ@res@right + \pgfscope % left side upper arc + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpatharc{90}{0}{\pgf@circ@res@right} + \pgf@circ@tubes@draw@style{\@@a} + \endpgfscope + \pgfscope % right vertical part + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgfutil@tempdima}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfutil@tempdima}} + \pgf@circ@tubes@draw@style{\@@b} + \endpgfscope + \pgfscope % right side lower arc + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{-\pgfutil@tempdima}} + \pgfpatharc{0}{-90}{\pgf@circ@res@right} + \pgf@circ@tubes@draw@style{\@@c} + \endpgfscope + \pgfscope % right side lower arc + \pgfpathmoveto{\pgfpoint{0pt}{-\pgf@circ@res@up}} + \pgfpatharc{-90}{-180}{\pgf@circ@res@right} + \pgf@circ@tubes@draw@style{\@@d} + \endpgfscope + \pgfscope % left vertical part + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{-\pgfutil@tempdima}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}} + \pgf@circ@tubes@draw@style{\@@e} + \endpgfscope + \pgfscope % left side upper arc + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}} + \pgfpatharc{180}{90}{\pgf@circ@res@right} + \pgf@circ@tubes@draw@style{\@@f} + \endpgfscope + \fi +} % Draw tube outline \def\pgf@circ@tubes@drawtube{% - \ifdim\ctikzvalof{tubes/width}pt>\ctikzvalof{tubes/height}pt\relax - \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} - \pgfutil@tempdima=\pgf@circ@res@right - \advance\pgfutil@tempdima by -\pgf@circ@res@up - \pgfpathlineto{\pgfpoint{\pgfutil@tempdima}{\pgf@circ@res@up}} - \pgfpatharc{90}{-90}{\pgf@circ@res@up} - \pgfpathlineto{\pgfpoint{-\pgfutil@tempdima}{-\pgf@circ@res@up}} - \pgfpatharc{270}{90}{\pgf@circ@res@up} - \else - \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{0pt}} - \pgfutil@tempdima=\pgf@circ@res@up - \advance\pgfutil@tempdima by -\pgf@circ@res@right - \pgfpathlineto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}} - \pgfpatharc{180}{0}{\pgf@circ@res@right} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfutil@tempdima}} - \pgfpatharc{180}{0}{-\pgf@circ@res@right} - \fi - \pgfpathclose + \ifdim\ctikzvalof{tubes/width}pt>\ctikzvalof{tubes/height}pt\relax + % horizontal tube + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfutil@tempdima=\pgf@circ@res@right + \advance\pgfutil@tempdima by -\pgf@circ@res@up + \pgfpathlineto{\pgfpoint{\pgfutil@tempdima}{\pgf@circ@res@up}} + \pgfpatharc{90}{-90}{\pgf@circ@res@up} + \pgfpathlineto{\pgfpoint{-\pgfutil@tempdima}{-\pgf@circ@res@up}} + \pgfpatharc{270}{90}{\pgf@circ@res@up} + \else + % vertical tube + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{0pt}} + \pgfutil@tempdima=\pgf@circ@res@up + \advance\pgfutil@tempdima by -\pgf@circ@res@right + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}} + \pgfpatharc{180}{0}{\pgf@circ@res@right} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfutil@tempdima}} + \pgfpatharc{180}{0}{-\pgf@circ@res@right} + \fi + \pgfpathclose + \edef\@@partial{\ctikzvalof{tubes/partial borders}} + \ifx\@@partial\pgf@nonetext + % Tube fill and draw if it's not partial... for speed + \pgf@circ@draworfill + \else + % otherwise, just fill and do the partial fill + \pgf@circ@maybefill + \pgf@circ@tubes@draw@partial{\@@partial} + % + \fi } %% The diode (tube), triode, tetrode and pentode only differ in the @@ -8169,9 +8356,6 @@ \pgfdeclareshape{#1}{ \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}} \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} - \anchor{center}{ - \pgfpointorigin - } \savedanchor\northwest{% \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen @@ -8182,40 +8366,58 @@ \pgf@x=-\pgf@circ@res@right \pgf@x=.5\pgf@x } - \anchor{north} {% - \northwest - \pgf@x=0pt - } - \anchor{east}{% - \northwest - \pgf@x=-\pgf@x - \pgf@y=0pt - } - \anchor{south}{% - \northwest - \pgf@y=-\pgf@y - \pgf@x=0pt - } - \anchor{west}{% - \northwest - \pgf@y=0pt - } - \anchor{north west}{% - \northwest - } - \anchor{north east}{% - \northwest - \pgf@x=-\pgf@x - } - \anchor{south east}{ - \northwest - \pgf@x=-\pgf@x - \pgf@y=-\pgf@y + \savedanchor\tubene{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@temp=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen + \pgf@circ@res@other=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@up=\ctikzvalof{tubes/tube radius}\pgf@circ@res@temp + \pgf@circ@res@right=\ctikzvalof{tubes/tube radius}\pgf@circ@res@other + \pgf@y=\pgf@circ@res@up + \pgf@x=\pgf@circ@res@right } - \anchor{south west}{ - \northwest - \pgf@y=-\pgf@y + \savedanchor\tubesquarene{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@temp=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen + \pgf@circ@res@other=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@up=\ctikzvalof{tubes/tube radius}\pgf@circ@res@temp + \pgf@circ@res@right=\ctikzvalof{tubes/tube radius}\pgf@circ@res@other + \ifdim\ctikzvalof{tubes/width}pt>\ctikzvalof{tubes/height}pt\relax + % horizontal + \pgf@y=\pgf@circ@res@up + \pgf@x=\pgf@circ@res@right\advance\pgf@x by -\pgf@circ@res@up + \else + % vertical + \pgf@x=\pgf@circ@res@right + \pgf@y=\pgf@circ@res@up\advance\pgf@y by -\pgf@circ@res@right + \fi } + \anchor{tube ne}{\tubene} + \anchor{tubesq ne}{\tubesquarene} + % tube shape anchors: geo + \anchor{tube top}{\tubene\pgf@x=0pt\relax} + \anchor{tube bottom}{\tubene\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{tube right}{\tubene\pgf@y=0pt\relax} + \anchor{tube left}{\tubene\pgf@y=0pt\pgf@x=-\pgf@x} + % tube shape straight part anchors + \anchor{tube top right}{\tubesquarene} + \anchor{tube bottom right}{\tubesquarene\pgf@y=-\pgf@y} + \anchor{tube top left}{\tubesquarene\pgf@x=-\pgf@x} + \anchor{tube bottom left}{\tubesquarene\pgf@y=-\pgf@y\pgf@x=-\pgf@x} + % tube shape centers + \anchor{tube top center}{\tubesquarene\pgf@x=0pt\relax} + \anchor{tube bottom center}{\tubesquarene\pgf@y=-\pgf@y\pgf@x=0pt\relax} + \anchor{tube right center}{\tubesquarene\pgf@y=0pt\relax} + \anchor{tube left center}{\tubesquarene\pgf@x=-\pgf@x\pgf@y=0pt\relax} + % rest of anchors + \anchor{center}{\pgfpointorigin} + % geo anchors based on north-west + \pgfcirc@northwest@symmetric@geoanchors + % text anchor + \anchor{text}{% + \northwest\pgf@x=-\pgf@x + \pgf@y=-.5\ht\pgfnodeparttextbox + } + % specific anchors \anchor{anode} {% \northwest \pgf@x=0pt @@ -8271,9 +8473,6 @@ \pgf@circ@res@up=0.5\pgf@circ@res@up \pgf@circ@res@right=0.5\pgf@circ@res@right - % Tube fill color (if any) - \pgf@circ@draworfill - % Grid drawing #3% -- cgit v1.2.3