summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex')
-rw-r--r--Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex27
1 files changed, 23 insertions, 4 deletions
diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex
index 8fe1397467d..44fa367b4ce 100644
--- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex
+++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex
@@ -1,5 +1,4 @@
-\pgf@circ@Rlen = \pgfkeysvalueof{/tikz/circuitikz/bipoles/length}
\def\pgf@circ@direction{0.0}
% Names
@@ -44,26 +43,43 @@
}
}
+%% Helper function for path-function to ensure using anchors between nodes
+\def\set@explicit@center@anchor#1{
+ \pgfutil@ifundefined{pgf@sh@ns@#1}
+ {
+ %This coordinate is no node(but a relative position or a coordinate), no further handling needed
+ }{
+ \pgfutil@in@.{#1}
+ \ifpgfutil@in@
+ % Anchor is used, do nothing!
+ \else%
+ \let\tikz@moveto@waiting=\relax
+ \pgfpathmoveto{\tikz@last@position}%force movement, because tikz@moveto@waiting
+ \edef#1{#1.center}%ensure using center anchor
+ \fi
+ }
+}
+
%% Generic bipole path
\def\pgf@circ@bipole@path#1#2{
\pgfextra{
+ \set@explicit@center@anchor{\tikztostart}
+ \set@explicit@center@anchor{\tikztotarget}
+ \pgfsyssoftpath@getcurrentpath{\myp@th}%% save current path to extend after calculation of correct start/end coordinates
\ctikzset{bipole/kind = #1}
-
\edef\pgf@temp{\ctikzvalof{bipole/name}}
\def\pgf@circ@temp{}
\ifx\pgf@temp\pgf@circ@temp % if it has not a name
\pgfmathrandominteger{\pgf@circ@rand}{1000}{9999}
\ctikzset{bipole/name = #2\pgf@circ@rand} % create it
\fi
- \pgfsyssoftpath@getcurrentpath{\myp@th}%% save current path to extend after calculation of correct start/end coordinates
}
(\tikztostart) coordinate (\ctikzvalof{bipole/name}start)%necessary to get correct coordinates in the case of relativ start/end or constructions like ((node1)-|(node2))
(\tikztotarget) coordinate (\ctikzvalof{bipole/name}end)
\pgfextra{
- \let\tikz@moveto@waiting=\relax%necessary, if \tikztatarget is a node
\pgfmathanglebetweenpoints{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}}
{\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}}
\edef\pgf@circ@direction{\pgfmathresult}%Calculate direction(angle) of path
@@ -115,6 +131,7 @@
\pgf@circ@ifkeyempty{bipole/annotation/name}\else\pgf@circ@drawlabels{annotation}\fi
\pgf@circ@ifkeyempty{bipole/voltage/label/name}\else\pgf@circ@drawvoltage\fi
\pgf@circ@ifkeyempty{bipole/current/label/name}\else\pgf@circ@drawcurrent\fi
+ \pgf@circ@ifkeyempty{bipole/flow/label/name}\else\pgf@circ@drawflow\fi
\pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#1}}
\ifx\pgf@temp\pgf@circ@temp % if it is an open
(\ctikzvalof{bipole/name}end)%Move to end of path
@@ -242,6 +259,7 @@
\def\pgf@circ@twoport@path#1{\pgf@circ@bipole@path{twoport}{#1}}
\def\pgf@circ@vco@path#1{\pgf@circ@bipole@path{vco}{#1}}
\def\pgf@circ@bandpass@path#1{\pgf@circ@bipole@path{bandpass}{#1}}
+\def\pgf@circ@bandstop@path#1{\pgf@circ@bipole@path{bandstop}{#1}}
\def\pgf@circ@highpass@path#1{\pgf@circ@bipole@path{highpass}{#1}}
\def\pgf@circ@lowpass@path#1{\pgf@circ@bipole@path{lowpass}{#1}}
\def\pgf@circ@adc@path#1{\pgf@circ@bipole@path{adc}{#1}}
@@ -356,6 +374,7 @@
\compattikzset{twoport/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@twoport@path}}
\compattikzset{vco/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vco@path}}
\compattikzset{bandpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bandpass@path}}
+\compattikzset{bandstop/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bandstop@path}}
\compattikzset{highpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@highpass@path}}
\compattikzset{lowpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@lowpass@path}}
\compattikzset{adc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@adc@path}}