diff options
Diffstat (limited to 'graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex')
-rw-r--r-- | graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex | 167 |
1 files changed, 86 insertions, 81 deletions
diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex index 5be686bdff..4978311dca 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex @@ -282,6 +282,26 @@ \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} \pgfusepath{draw} } +% +% generic slashed, suggested by Jana on TeX.stackexchange.com +% https://tex.stackexchange.com/questions/711702/european-relay-with-circuitikz +% inherit "generic" properties +% +\pgfcircdeclarebipolescaled{resistors} +{} +{\ctikzvalof{bipoles/generic/height}} +{sgeneric} +{\ctikzvalof{bipoles/generic/height}} +{\ctikzvalof{bipoles/generic/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + % slash it + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} +} %% Generic empty tunable \pgfcircdeclarebipolescaled{resistors} { @@ -805,6 +825,7 @@ \pgfcirc@activate@bipole@simple{l}{ageneric} \pgfcirc@activate@bipole@simple{l}{tgeneric} \pgfcirc@activate@bipole@simple{l}{xgeneric} +\pgfcirc@activate@bipole@simple{l}{sgeneric} \pgfcirc@activate@bipole@simple{l}{fullgeneric} \pgfcirc@activate@bipole@simple{l}{tfullgeneric} \pgfcirc@activate@bipole@simple{l}{short} @@ -4809,12 +4830,22 @@ \pgf@circ@subset@color@dash{switch arrows} \pgfcirc@set@arrows{switch}{}{latexslim} } +\def\pgf@circ@savedanchor@trad@midlever#1#2{% #1 -> name #2 -> relative height + \savedanchor\midlever{% this is the full height of the "handle" of switch + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/#1/height}\pgf@circ@scaled@Rlen + \pgf@x=0pt\pgf@y=0.5\pgf@y + } + \anchor{mid}{\midlever\pgf@y=#2\pgf@y} +} %%>>> %% Shapes Node for bipoles switches and similar things%<<< %% (Closing) SPST \pgfcircdeclarebipolescaled{switches} -{} +{ + \pgf@circ@savedanchor@trad@midlever{spst}{0.6} +} {\ctikzvalof{bipoles/spst/depth}} {cspst} {\ctikzvalof{bipoles/spst/height}} @@ -4836,7 +4867,9 @@ %% Opening SPST \pgfcircdeclarebipolescaled{switches} -{} +{ + \pgf@circ@savedanchor@trad@midlever{spst}{0.6} +} {\ctikzvalof{bipoles/spst/depth}} {ospst} {\ctikzvalof{bipoles/spst/height}} @@ -4858,7 +4891,9 @@ %% Normal open Switch \pgfcircdeclarebipolescaled{switches} -{} +{ + \pgf@circ@savedanchor@trad@midlever{nos}{0.5} +} {\ctikzvalof{bipoles/nos/depth}} {nos} {\ctikzvalof{bipoles/nos/height}} @@ -4873,7 +4908,9 @@ %% Normal closed Switch \pgfcircdeclarebipolescaled{switches} -{} +{ + \pgf@circ@savedanchor@trad@midlever{ncs}{0.5} +} {\ctikzvalof{bipoles/ncs/depth}} {ncs} {\ctikzvalof{bipoles/ncs/height}} @@ -4892,7 +4929,9 @@ % Opening normal closed Switch \pgfcircdeclarebipolescaled{switches} -{} +{ + \pgf@circ@savedanchor@trad@midlever{ncs}{0.5} +} {\ctikzvalof{bipoles/ncs/depth}} {oncs} {\ctikzvalof{bipoles/ncs/height}} @@ -4920,7 +4959,9 @@ %% Closing normal closed Switch \pgfcircdeclarebipolescaled{switches} -{} +{ + \pgf@circ@savedanchor@trad@midlever{ncs}{0.5} +} {\ctikzvalof{bipoles/ncs/depth}} {cncs} {\ctikzvalof{bipoles/ncs/height}} @@ -4948,7 +4989,9 @@ %% Opening normal open Switch \pgfcircdeclarebipolescaled{switches} -{} +{ + \pgf@circ@savedanchor@trad@midlever{ncs}{0.5} +} {\ctikzvalof{bipoles/ncs/depth}} {onos} {\ctikzvalof{bipoles/ncs/height}} @@ -4976,7 +5019,9 @@ %% Closing normal open Switch \pgfcircdeclarebipolescaled{switches} -{} +{ + \pgf@circ@savedanchor@trad@midlever{ncs}{0.5} +} {\ctikzvalof{bipoles/ncs/depth}} {cnos} {\ctikzvalof{bipoles/ncs/height}} @@ -5006,6 +5051,8 @@ \pgfcircdeclarebipolescaled{switches} { \anchor{tip}{\northeast\pgf@x=0pt\relax} + % we can use the generic here, the "bar" is related to bipoles/*/height + \pgf@circ@savedanchor@trad@midlever{pushbutton}{0.5} } {\ctikzvalof{bipoles/pushbutton/height 2}} {pushbutton} @@ -5029,6 +5076,11 @@ \pgfcircdeclarebipolescaled{switches} { \anchor{tip}{\northeast\pgf@x=0pt\relax} + \savedanchor{\nodeheight}{ + \pgf@x=0pt\pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen + } + \anchor{mid}{\nodeheight\pgf@y=-\pgf@y} + % \pgf@circ@savedanchor@trad@midlever{pushbutton}{0.5} } {\ctikzvalof{bipoles/pushbutton/height 2}} {ncpushbutton} @@ -5054,11 +5106,15 @@ %% https://github.com/circuitikz/circuitikz/issues/128#issuecomment-731771299 \pgfcircdeclarebipolescaled{switches} { + \savedanchor{\nodeheight}{ + \pgf@x=0pt\pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen + } \anchor{tip}{ - \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen + \nodeheight\pgf@circ@res@temp=\pgf@y \northeast\divide\pgf@y by 2\advance\pgf@y by \pgf@circ@res@temp \pgf@x=0pt\relax } + \anchor{mid}{\nodeheight} } {\ctikzvalof{bipoles/pushbutton/height 2}} {pushbuttonc} @@ -5082,11 +5138,15 @@ %% Normally closed Push Button now open \pgfcircdeclarebipolescaled{switches} { + \savedanchor{\nodeheight}{ + \pgf@x=0pt\pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen + } \anchor{tip}{ - \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen + \nodeheight\pgf@circ@res@temp=\pgf@y \northeast\divide\pgf@y by 2\advance\pgf@y by \pgf@circ@res@temp \pgf@x=0pt\relax } + \anchor{mid}{\northeast\pgf@x=0pt\pgf@y=-0.5\pgf@y} } {\ctikzvalof{bipoles/pushbutton/height 2}} {ncpushbuttono} @@ -5110,7 +5170,9 @@ } %%% reed switches \pgfcircdeclarebipolescaled{switches} -{} +{ + \pgf@circ@savedanchor@trad@midlever{nos}{0.5} +} {\ctikzvalof{bipoles/reed/depth}} {reed} {\ctikzvalof{bipoles/reed/height}} @@ -5237,14 +5299,10 @@ } \pgfcircdeclarebipole{ - \anchor{out 1}{ - \northeast - \pgf@y=0cm - } - \anchor{out 2}{ - \northeast - \pgf@y=.8\pgf@y - } + \anchor{out 1}{\northeast\pgf@y=0pt\relax} + \anchor{out 2}{\northeast\pgf@y=.8\pgf@y} + \anchor{in}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} + \anchor{mid}{\northeast\pgf@x=0.2\pgf@x\pgf@y=0.25\pgf@y} } {\ctikzvalof{tripoles/toggleswitch/height 2}} {toggleswitch} @@ -5304,82 +5362,30 @@ \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } - \anchor{left}{% - \northwest - \pgf@y=0pt - } - \anchor{in}{ - \northwest - \pgf@y=0pt - } - \anchor{out 1}{ - \northwest - \pgf@x=-\pgf@x - } - \anchor{out 2}{ - \northwest - \pgf@x=-\pgf@x - \pgf@y=-\pgf@y - } - \anchor{center}{ - \pgf@y=0pt - \pgf@x=0pt - } - \anchor{east}{ - \northwest - \pgf@y=0pt - \pgf@x=-\pgf@x - } - \anchor{west}{ - \northwest - \pgf@y=0pt - } - \anchor{south}{ - \northwest - \pgf@x=0pt - \pgf@y=-\pgf@y - } - \anchor{north}{ - \northwest - \pgf@x=0pt - } - \anchor{south west}{ - \northwest - \pgf@y=-\pgf@y - } - \anchor{north east}{ - \northwest - \pgf@x=-\pgf@x - } - \anchor{north west}{ - \northwest - } - \anchor{south east}{ - \northwest - \pgf@x=-\pgf@x - \pgf@y=-\pgf@y - } + \pgfcirc@northwest@symmetric@geoanchors + \anchor{in}{\northwest\pgf@y=0pt} + \anchor{out 1}{\northwest\pgf@x=-\pgf@x} + % this is "by eye", it'll be wrong with non-standard ocirc + \anchor{mid}{\northwest\pgf@x=0pt\pgf@y=0.37\pgf@y} + \anchor{out 2}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y} + \anchor{center}{\pgf@y=0pt\pgf@x=0pt} \pgf@circ@draw@component{ \pgf@circ@setcolor - \northwest \pgf@circ@res@up = \pgf@y \pgf@circ@res@down = -\pgf@y \pgf@circ@res@right = -\pgf@x \pgf@circ@res@left = \pgf@x \pgf@circ@res@other = \ctikzvalof{tripoles/spdt/margin}\pgf@circ@res@left - - + % \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} - + % \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfusepath{draw} - \pgfscope \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} \pgfnode{ocirc}{center}{}{spdt1}{\pgfusepath{stroke}} @@ -5392,7 +5398,6 @@ \pgftransformshift{\pgfpoint{\pgf@circ@res@other}{0pt}} \pgfnode{ocirc}{center}{}{spdt2}{\pgfusepath{stroke}} \endpgfscope - \pgfscope \pgfpathmoveto{\pgfpointshapeborder{spdt2}{\pgfpointorigin}} \pgfpathlineto{ |