Debian Codegraph @

texmf-dist/tex/latex/tikz-swigs/tikzlibraryswigs.code.tex

raw
1 %%%%
2 %%% swig shapes
3 %%% code for creating multi-part nodes corresponding to split ellipses with a gap
4 %%%
5 %%% swig hsplit : ellipse split horizontally
6 %%% swig vsplit : ellipse split vertically
7 %%%
8 %%%
9 %%% Modified from the file:
10 %%% pgflibraryshapes.multipart.code.tex (Copyright 2007 by Till Tantau and Mark Wibrow)
11 %%%
12 %%% Copyright 2018 Thomas S. Richardson
13
14 % This file may be distributed and/or modified
15 %
16 % 1. under the LaTeX Project Public License and/or
17 % 2. under the GNU Public License.
18 %
19 % See the file doc/generic/pgf/licenses/LICENSE for more details
20
21
22 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
23
24 %%% swig horizontal split
25 %%% This is a multi-part node consisting of an ellipse split horizontally into
26 %%% upper and lower parts
27
28 %%Very useful code allows groups of options to be set as: [... shape=swig hsplit, swig hsplit={ .... }]
29 \pgfkeys{/tikz/swig hsplit/.code={%
30 \pgfkeys{/tikz/swig hsplit/.cd,#1}%
31 }}%
32 %\pgfkeys{/tikz/swig hsplit/color/.initial = black}%
33 \pgfkeys{/tikz/swig hsplit/line color upper/.initial = \pgfutil@empty}%
34 \pgfkeys{/tikz/swig hsplit/line color lower/.initial = \pgfutil@empty}%
35 \pgfkeys{/tikz/swig hsplit/fill color upper/.initial = \pgfutil@empty}%
36 \pgfkeys{/tikz/swig hsplit/fill color lower/.initial = \pgfutil@empty}%
37 %\pgfkeys{/tikz/swig hsplit/gap/.initial = \pgfutil@empty}%
38 \pgfkeys{/tikz/swig hsplit/gap/.initial = 1.0em}
39 \pgfkeys{/tikz/swig hsplit/line width upper/.initial = \the\pgflinewidth}%
40 \pgfkeys{/tikz/swig hsplit/line width lower/.initial = \the\pgflinewidth}%
41 \pgfkeys{/tikz/swig hsplit/inner line width upper/.initial = 0pt}%
42 \pgfkeys{/tikz/swig hsplit/inner line width lower/.initial = 0pt}%
43 %\pgfkeys{/pgf/ellipse splitb/dash/.initial = {{{0.5cm}{0.5cm}{0.1cm}{0.2cm}}{0cm}}
44
45 \newbox\pgfnodepartlowerbox %%Associated with anchor "upper"; see pgfmanual3.1, page 1035
46 \newbox\pgfnodepartupperbox %%Associated with anchor "lower"; see pgfmanual3.1, page 1035
47 %%% Every node must have a center anchor
48 %%% See pgf manual 3.1; p.1036
49
50 \pgfdeclareshape{swig hsplit}{%
51 \nodeparts{upper,lower}%
52 \savedanchor\upper{%
53 \pgf@x0pt\pgf@y0pt\relax%
54 }%
55 %https://tex.stackexchange.com/questions/21555/using-patterns-inside-pgf-shapes
56 \savedmacro\uppercolor{%
57 \edef\tikz@temp{\pgfkeysvalueof{/tikz/swig hsplit/line color upper}}%
58 \ifx\tikz@temp\pgfutil@empty\relax%
59 \ifx\tikz@strokecolor\pgfutil@empty%if not defined even with draw=
60 \def\uppercolor{.}%
61 \else%
62 \def\uppercolor{\tikz@strokecolor}% if defined with draw=
63 \fi%
64 \else%
65 \def\uppercolor{\expandafter\pgfkeysvalueof{/tikz/swig hsplit/line color upper}}%if defined
66 \fi} %%%Important: adding { } around the last def statement would break this
67 \savedmacro\lowercolor{%
68 \edef\tikz@temp{\pgfkeysvalueof{/tikz/swig hsplit/line color lower}}%
69 \ifx\tikz@temp\pgfutil@empty\relax%
70 \ifx\tikz@strokecolor\pgfutil@empty%if not defined even with draw=
71 \def\lowercolor{.}%
72 \else%
73 \def\lowercolor{\tikz@strokecolor}% if defined with draw=
74 \fi%
75 \else%
76 \def\lowercolor{\expandafter\pgfkeysvalueof{/tikz/swig hsplit/line color lower}}%if defined
77 \fi} %%%Important: adding { } around the last def statement would break this
78 %
79 \savedmacro\upperfillcolor{%
80 \edef\tikz@temp{\pgfkeysvalueof{/tikz/swig hsplit/fill color upper}}%
81 \ifx\tikz@temp\pgfutil@empty\relax%
82 \ifx\tikz@fillcolor\pgfutil@empty%if not defined even with fill=
83 \def\upperfillcolor{white}%
84 \else%
85 \def\upperfillcolor{\tikz@fillcolor}% if defined with fill=
86 \fi%
87 \else%
88 \def\upperfillcolor{\expandafter\pgfkeysvalueof{/tikz/swig hsplit/fill color upper}}%if defined
89 \fi}%
90 \savedmacro\lowerfillcolor{%
91 \edef\tikz@temp{\pgfkeysvalueof{/tikz/swig hsplit/fill color lower}}%
92 \ifx\tikz@temp\pgfutil@empty\relax%
93 \ifx\tikz@fillcolor\pgfutil@empty%if not defined even with fill=
94 \def\lowerfillcolor{white}%
95 \else%
96 \def\lowerfillcolor{\tikz@fillcolor}% if defined with fill=
97 \fi%
98 \else%
99 \def\lowerfillcolor{\expandafter\pgfkeysvalueof{/tikz/swig hsplit/fill color lower}}%if defined
100 \fi}%
101 %
102 \savedanchor\linewidthupper{%
103 \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/tikz/swig hsplit/line width upper}}%
104 \pgfmathsetlength\pgf@x{0pt}%
105 }%
106 \savedanchor\linewidthlower{%
107 \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/tikz/swig hsplit/line width lower}}%
108 \pgfmathsetlength\pgf@x{0pt}%
109 }%
110 \savedanchor\gap{% This is a coordinate, but \pgf@x is redundant
111 \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/tikz/swig hsplit/gap}}%
112 %%%%%%%%
113 \pgfmathsetlength\pgf@x{0pt}%
114 }
115 \savedanchor\radii{%
116 \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
117 \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
118 \[email protected]\pgf@y%
119 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/tikz/swig hsplit/line width upper}}%Added to allow for different widths
120 \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/tikz/swig hsplit/line width lower}}%% of lines upper and lower
121 \ifdim\pgf@yb>\pgf@ya%
122 \pgf@ya\pgf@yb%
123 \fi%
124 \advance\[email protected]\pgf@ya%
125 \[email protected]\wd\pgfnodepartupperbox%
126 \[email protected]\wd\pgfnodepartlowerbox%
127 \advance\pgf@xa\pgf@x%
128 \advance\pgf@xb\pgf@x%
129 \pgf@ya\ht\pgfnodepartupperbox%
130 \advance\pgf@ya\dp\pgfnodepartupperbox%
131 \pgf@yb\ht\pgfnodepartlowerbox%
132 \advance\pgf@yb\dp\pgfnodepartlowerbox%
133 \advance\pgf@ya\pgf@y%
134 \advance\pgf@yb\pgf@y%
135 \ifdim\pgf@xa>\pgf@xb%
136 \[email protected]\pgf@xa%
137 \else%
138 \[email protected]\pgf@xb%
139 \fi%
140 \ifdim\pgf@ya>\pgf@yb%
141 \[email protected]\pgf@ya%
142 \else%
143 \[email protected]\pgf@yb%
144 \fi%
145 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}%
146 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}%
147 \ifdim\pgf@x<.5\pgf@xa%
148 \[email protected]\pgf@xa%
149 \fi%
150 \ifdim\pgf@y<.5\pgf@ya%
151 \[email protected]\pgf@ya%
152 \fi%
153 \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
154 \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
155 }
156 \savedanchor\lower{%
157 \[email protected]\wd\pgfnodepartlowerbox%
158 \advance\[email protected]\wd\pgfnodepartupperbox%
159 \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
160 \[email protected]\pgf@y%
161 %\advance\pgf@y-\pgflinewidth%
162 \advance\pgf@y-\dp\pgfnodepartupperbox%
163 \advance\pgf@y-\ht\pgfnodepartlowerbox%
164 %%%%%%
165 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/tikz/swig hsplit/gap}}%
166 %%%%%%%
167 \advance\pgf@y-\pgf@ya% %% Added by TSR for gap
168 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/tikz/swig hsplit/line width upper}}%%%
169 \advance\[email protected]\pgf@ya%
170 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/tikz/swig hsplit/line width lower}}%%%
171 \advance\[email protected]\pgf@ya%
172 }
173 \savedanchor\uppercenterpoint{% NOTE: *Not* the same as anchor "upper center" (this saved anchor is in the middle of the line)
174 \[email protected]\wd\pgfnodepartupperbox%
175 \pgfmathsetlength\pgf@y{-\pgfkeysvalueof{/pgf/inner ysep}}%
176 \advance\pgf@y-\dp\pgfnodepartupperbox%
177 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/tikz/swig hsplit/line width upper}}%%%
178 \advance\[email protected]\pgf@ya%
179 }%
180 \savedanchor{\greaterlinewidth}{%since seemingly hard to include conditional calculations in anchors (!)
181 \pgfmathsetlength{\pgf@xa}{\pgfkeysvalueof{/tikz/swig hsplit/line width upper}}%
182 \pgfmathsetlength{\pgf@x}{\pgfkeysvalueof{/tikz/swig hsplit/line width lower}}%%
183 \ifdim\pgf@xa>\pgf@x%
184 \pgf@x\pgf@xa%
185 \fi%
186 \pgf@y0pt%
187 }%
188 \savedanchor\basepoint{%
189 \[email protected]\wd\pgfnodepartupperbox%
190 \pgf@y0pt\relax%
191 }%
192 \savedanchor\gapcenter{%
193 \[email protected]\wd\pgfnodepartupperbox%
194 \pgfmathsetlength\pgf@y{-\pgfkeysvalueof{/pgf/inner ysep}}%
195 \advance\pgf@y-\dp\pgfnodepartupperbox%
196 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/tikz/swig hsplit/line width upper}}%%%
197 \advance\[email protected]\pgf@ya%
198 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/tikz/swig hsplit/line width lower}}%%%
199 \advance\[email protected]\pgf@ya%
200 %%%%%%%
201 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/tikz/swig hsplit/gap}}%
202 %%%%%%%
203 \advance\[email protected]\pgf@ya%
204 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/tikz/swig hsplit/line width upper}}%Added to allow for different widths
205 \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/tikz/swig hsplit/line width lower}}%% of lines upper and lower
206 }%
207 \savedanchor\basepointlower{%
208 \[email protected]\wd\pgfnodepartupperbox%
209 %
210 \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
211 \[email protected]\pgf@y%
212 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/tikz/swig hsplit/line width upper}}%%%
213 \advance\[email protected]\pgf@ya%
214 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/tikz/swig hsplit/line width lower}}%%%
215 \advance\[email protected]\pgf@ya%
216 \advance\pgf@y-\dp\pgfnodepartupperbox%
217 \advance\pgf@y-\ht\pgfnodepartlowerbox%
218 %%%%%%%%%
219 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/tikz/swig hsplit/gap}}%
220 %%%%%%%%%%
221 \advance\pgf@y-\pgf@ya% %% Added by TSR for gap
222 }%
223 \savedanchor\midpoint{%
224 \[email protected]\wd\pgfnodepartupperbox%
225 \pgfmathsetlength\pgf@y{.5ex}%
226 }%
227 \savedanchor\midpointlower{%
228 \[email protected]\wd\pgfnodepartupperbox% Note: Origin is SW corner of upper text box
229 %
230 \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
231 \[email protected]\pgf@y%
232 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/tikz/swig hsplit/line width upper}}%%%
233 \advance\[email protected]\pgf@ya%
234 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/tikz/swig hsplit/line width lower}}%%%
235 \advance\[email protected]\pgf@ya%
236 \advance\pgf@y-\dp\pgfnodepartupperbox%
237 \advance\pgf@y-\ht\pgfnodepartlowerbox%
238 %%%%%%%%%
239 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/tikz/swig hsplit/gap}}%
240 %%%%%%%%%%
241 \advance\pgf@y-\pgf@ya%
242 \pgfmathsetlength\pgf@ya{.5ex}%
243 \advance\pgf@y\pgf@ya%
244 }%
245 \anchor{upper center}{\linewidthupper\[email protected]\pgf@y\uppercenterpoint\advance\pgf@y\pgf@ya}
246 %%% Required see PGF Manual p.1036
247 \anchor{center}{\gapcenter}
248 \anchor{lower center}{\linewidthlower\[email protected]\pgf@y\gap\advance\pgf@ya-\pgf@y\uppercenterpoint\advance\pgf@y\pgf@ya}%
249 %\pgfpointadd{\uppercenterpoint}{\gap\pgf@y-\pgf@y}}
250 \anchor{lower}{\lower}
251 \anchor{upper}{\upper}
252 \anchor{text}{\upper}
253 \anchor{lower base}{\basepointlower}
254 \anchor{lower mid}{\midpointlower}
255 \anchor{mid}{\midpoint}
256 \anchor{mid east}{\greaterlinewidth\[email protected]\pgf@x\radii\advance\pgf@xa\pgf@x\midpoint\advance\pgf@x\pgf@xa}
257 \anchor{mid west}{\greaterlinewidth\[email protected]\pgf@x\radii\advance\pgf@xa\pgf@x\midpoint\advance\pgf@x-\pgf@xa}
258 \anchor{upper base}{\basepoint}
259 \anchor{base}{\basepoint}
260 \anchor{base east}{\greaterlinewidth\[email protected]\pgf@x\radii%call \radii; this sets pgf@x and pgf@y
261 \advance\pgf@xa\pgf@x%store pgf@x into pgf@xa
262 \basepoint %call \basepoint; this sets pgf@x and pgf@y
263 \advance\pgf@x\pgf@xa} % Add \pgf@xa to contents of \pgf@x (!!)
264 %%
265 \anchor{base west}{\greaterlinewidth\[email protected]\pgf@x\radii\advance\pgf@xa\pgf@x\basepoint\advance\pgf@x-\pgf@xa}
266 \anchor{north}{\linewidthupper\[email protected]\pgf@y\radii\advance\pgf@ya\pgf@y\uppercenterpoint\advance\pgf@y\pgf@ya}%
267 %\pgfpointadd{\uppercenterpoint}{\radii\pgf@x0pt}}%
268 \anchor{south}{\linewidthlower\[email protected]\pgf@y\gap\advance\pgf@ya-\pgf@y\radii\advance\pgf@ya-\pgf@y\uppercenterpoint\advance\pgf@y\pgf@ya}%
269 %\pgfpointadd{\uppercenterpoint}{\radii\pgf@ya-\pgf@y\gap\pgf@y-\pgf@y\advance\pgf@y\pgf@ya\pgf@x0pt}}%
270 \anchor{west}{\pgfpointadd{\gapcenter}{\greaterlinewidth%
271 \[email protected]\pgf@x%
272 \radii%
273 \pgf@x-\pgf@x%
274 \advance\pgf@x\pgf@xa%
275 \pgf@y0pt}}%
276 \anchor{east}{\pgfpointadd{\gapcenter}{\greaterlinewidth%
277 \[email protected]\pgf@x%
278 \radii%
279 \advance\pgf@x\pgf@xa%
280 \pgf@y0pt}}%
281 \anchor{upper east}{\pgfpointadd{\uppercenterpoint}{\linewidthupper\pgf@xa\pgf@y\radii\pgf@y0pt\advance\[email protected]\pgf@xa}}%%% %
282 \anchor{upper west}{\pgfpointadd{\uppercenterpoint}{\linewidthupper\pgf@xa\pgf@y\radii\pgf@x-\pgf@x\pgf@y0pt\advance\[email protected]\pgf@xa}}%
283 \anchor{lower west}{\pgfpointadd{\uppercenterpoint}{\linewidthlower\pgf@xa\pgf@y\radii\pgf@xb-\pgf@x\advance\[email protected]\pgf@xa\gap\pgf@y-\pgf@y\pgf@x\pgf@xb}}%
284 \anchor{lower east}{\pgfpointadd{\uppercenterpoint}{\linewidthlower\pgf@xa\pgf@y\radii\pgf@xb\pgf@x\advance\[email protected]\pgf@xa\gap\pgf@y-\pgf@y\pgf@x\pgf@xb}}%
285 \anchor{north west}{\pgfpointadd{\uppercenterpoint}{\linewidthupper\pgf@ya\pgf@y%
286 \radii\advance\[email protected]\pgf@ya\advance\[email protected]\pgf@ya%
287 \[email protected]\pgf@x\[email protected]\pgf@y}}%
288 \anchor{south west}{\pgfpointadd{\uppercenterpoint}{\linewidthlower\pgf@ya\pgf@y%
289 \radii\advance\[email protected]\pgf@ya\advance\[email protected]\pgf@ya%
290 \[email protected]\pgf@x\[email protected]\pgf@y%
291 \gap\pgf@y-\pgf@y\advance\pgf@y\pgf@ya\pgf@x\pgf@xa}}%
292 \anchor{north east}{\pgfpointadd{\uppercenterpoint}{\linewidthupper\pgf@ya\pgf@y%
293 \radii\advance\[email protected]\pgf@ya\advance\[email protected]\pgf@ya%
294 \[email protected]\pgf@x\[email protected]\pgf@y}}%
295 \anchor{south east}{\pgfpointadd{\uppercenterpoint}{\linewidthlower\pgf@ya\pgf@y%
296 \radii\advance\[email protected]\pgf@ya\advance\[email protected]\pgf@ya%
297 \[email protected]\pgf@x\[email protected]\pgf@y%
298 \gap\pgf@y-\pgf@y\advance\pgf@y\pgf@ya\pgf@x\pgf@xa}}%
299 %%%%%%%%% START OF DRAWING HSPLIT
300 %%%% Upper
301 \beforebackgroundpath{%
302 \edef\defaultpgflinewidth{\the\pgflinewidth}% store default line width
303 \pgfsetstrokecolor{\uppercolor}%
304 \pgfsetfillcolor{\upperfillcolor}%
305 \expandafter\pgfsetlinewidth\expandafter{\pgfkeysvalueof{/tikz/swig hsplit/line width upper}}%
306 \expandafter\pgfsetinnerlinewidth\expandafter{\pgfkeysvalueof{/tikz/swig hsplit/inner line width upper}}%
307 \radii%
308 \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}%
309 \pgfmathaddtolength\pgf@y{-\pgfkeysvalueof{/pgf/outer ysep}}%
310 \pgfutil@tempdima\pgf@x%
311 \pgfutil@tempdimb\pgf@y%
312 \pgfpathmoveto{\uppercenterpoint\advance\pgf@x-\pgfutil@tempdima}%
313 \pgfpatharcaxes{180}{0}{\pgfpoint{\the\pgfutil@tempdima}{0pt}}{\pgfpoint{0pt}{\the\pgfutil@tempdimb}}%
314 \pgfpathclose
315 \pgfusepath{stroke,fill}
316 %%%%%% Lower
317 \pgfsetlinewidth\defaultpgflinewidth% Reset \the\pgflinewidth to default value (in case changed while drawing upper)
318 % \expandafter\pgfsetstrokecolor\expandafter{\pgfkeysvalueof{/tikz/swig hsplit/line color lower}}% old approach
319 \pgfsetstrokecolor{\lowercolor}%
320 \pgfsetfillcolor{\lowerfillcolor}%
321 \expandafter\pgfsetlinewidth\expandafter{\pgfkeysvalueof{/tikz/swig hsplit/line width lower}}% original
322 \expandafter\pgfsetinnerlinewidth\expandafter{\pgfkeysvalueof{/tikz/swig hsplit/inner line width lower}}%
323 \radii%
324 \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}%
325 \pgfmathaddtolength\pgf@y{-\pgfkeysvalueof{/pgf/outer ysep}}%
326 \pgfutil@tempdima\pgf@x%
327 \pgfutil@tempdimb\pgf@y%
328 \pgfpathmoveto{\uppercenterpoint\pgf@xa\pgf@x\pgf@ya\pgf@y\advance\pgf@xa\pgfutil@tempdima%
329 \gap\advance\pgf@ya-\pgf@y%
330 \pgf@x\pgf@xa\pgf@y\pgf@ya%
331 }%
332 \pgfpatharcaxes{180}{360}{\pgfpoint{-\the\pgfutil@tempdima}{0pt}}{\pgfpoint{0pt}{\the\pgfutil@tempdimb}}%
333 \pgfpathclose%
334 \pgfusepath{stroke,fill}%
335 }
336 \anchorborder{%
337 \pgfextract@process\externalpoint{}% %https://tex.stackexchange.com/questions/255492/storing-a-pgfpoint-for-repeated-use
338 %%%%% This stores the current \pgf@x and \pgf@y in the macro \externalpoint
339 \linewidthupper%
340 \pgf@ya\pgf@y%
341 \radii%
342 \advance\[email protected]\pgf@ya% add half-line width to x radius
343 \advance\[email protected]\pgf@ya% add line width to y radius
344 \edef\pgf@marshal{%
345 \noexpand\pgfpointadd{\noexpand\pgfpointborderellipse{\noexpand\externalpoint}%
346 {\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}}{\noexpand\uppercenterpoint}%
347 }%
348 \pgf@marshal%
349 \pgf@xa\pgf@x% store the border point
350 \pgf@ya\pgf@y% store the border point
351 \uppercenterpoint%
352 \pgf@yb\pgf@y% store center for upper ellipse
353 \pgf@xb\pgf@x% store center for upper ellipse
354 \ifdim\pgf@ya<\pgf@yb% if the borderpoint is below center of upper ellipse
355 % if the border point is below bottom of upper ellipse start over
356 % %the lower ellipse start over (since lower ellipse may have different thickness)
357 \linewidthlower%
358 \pgf@ya\pgf@y%
359 \radii%
360 \advance\[email protected]\pgf@ya% add half-line width to x radius
361 \advance\[email protected]\pgf@ya% add half line width to y radius
362 \edef\pgf@marshal{%
363 \noexpand\pgfpointadd{\noexpand\pgfpointborderellipse{\noexpand\externalpoint}%
364 {\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}}{\noexpand\uppercenterpoint}%
365 }%
366 \pgf@marshal%
367 \pgf@xa\pgf@x% store the border point
368 \pgf@ya\pgf@y% store the border point
369 \gap%
370 \advance\pgf@ya-\pgf@y% move y coord of border point down
371 \fi%
372 \pgf@x\pgf@xa%
373 \pgf@y\pgf@ya%
374 }%
375 }
376
377
378 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
379
380 %%% swig vertical split
381 %%% This is a multi-part node consisting of an ellipse split vertically into
382 %%% left and right parts
383 %%% The text boxes adjust to the size of the text contained in them
384 %%% (The split may be off-center in order to keep the ellipse smaller.)
385
386
387 %%%%% START OF V-SPLIT SWIG
388 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
389
390 %%Very useful code allows groups of options to be set as: [... shape=swig vsplit, swig vsplit={ .... }]
391 \pgfkeys{/tikz/swig vsplit/.code={%
392 \pgfkeys{/tikz/swig vsplit/.cd,#1}%
393 }}%
394 \pgfkeys{/tikz/swig vsplit/line color left/.initial = \pgfutil@empty}%
395 \pgfkeys{/tikz/swig vsplit/line color right/.initial = \pgfutil@empty}%
396 \pgfkeys{/tikz/swig vsplit/fill color left/.initial = \pgfutil@empty}%
397 \pgfkeys{/tikz/swig vsplit/fill color right/.initial = \pgfutil@empty}%
398 \pgfkeys{/tikz/swig vsplit/gap/.initial = 0.8em}%
399 \pgfkeys{/tikz/swig vsplit/line width left/.initial = \the\pgflinewidth}%
400 \pgfkeys{/tikz/swig vsplit/line width right/.initial = \the\pgflinewidth}%
401 \pgfkeys{/tikz/swig vsplit/inner line width left/.initial = 0pt}%
402 \pgfkeys{/tikz/swig vsplit/inner line width right/.initial = 0pt}%
403 %\pgfkeys{/tikz/swig vsplit/prop/.initial = 0.5}%
404
405 \newbox\pgfnodepartleftbox %%Associated with anchor "left"; see pgfmanual3.1, page 1035
406 \newbox\pgfnodepartrightbox %%Associated with anchor "right"; see pgfmanual3.1, page 1035
407
408
409 %%%
410 %%%
411 %% Rectangle "box" contents (with gap=0)
412 %% 0.5 inner xsep + lefttextbox + inner xsep + 0.5 linewidthleft + gap + 0.5 linewidthright + righttextbox + 0.5 innerxsep
413 %% origin is at left side of lefttextbox
414 %%%
415 \pgfdeclareshape{swig vsplit}{%
416 \nodeparts{left,right}
417 \savedmacro\leftcolor{%
418 \edef\tikz@temp{\pgfkeysvalueof{/tikz/swig vsplit/line color left}}%
419 \ifx\tikz@temp\pgfutil@empty\relax%
420 \ifx\tikz@strokecolor\pgfutil@empty%if not defined even with draw=
421 \def\leftcolor{.}%
422 \else%
423 \def\leftcolor{\tikz@strokecolor}% if defined with draw=
424 \fi%
425 \else%
426 \def\leftcolor{\expandafter\pgfkeysvalueof{/tikz/swig vsplit/line color left}}%if defined
427 \fi} %%%Important: adding { } around the last def statement would break this
428 \savedmacro\rightcolor{%
429 \edef\tikz@temp{\pgfkeysvalueof{/tikz/swig vsplit/line color right}}%
430 \ifx\tikz@temp\pgfutil@empty\relax%
431 \ifx\tikz@strokecolor\pgfutil@empty%if not defined even with draw=
432 \def\rightcolor{.}%
433 \else%
434 \def\rightcolor{\tikz@strokecolor}% if defined with draw=
435 \fi%
436 \else%
437 \def\rightcolor{\expandafter\pgfkeysvalueof{/tikz/swig vsplit/line color right}}%if defined
438 \fi} %%%Important: adding { } around the last def statement would break this
439 %
440 \savedmacro\leftfillcolor{%
441 \edef\tikz@temp{\pgfkeysvalueof{/tikz/swig vsplit/fill color left}}%
442 \ifx\tikz@temp\pgfutil@empty\relax%
443 \ifx\tikz@fillcolor\pgfutil@empty%if not defined even with draw=
444 \def\leftfillcolor{white}%
445 \else%
446 \def\leftfillcolor{\tikz@fillcolor}% if defined with draw=
447 \fi%
448 \else%
449 \def\leftfillcolor{\expandafter\pgfkeysvalueof{/tikz/swig vsplit/fill color left}}%if defined
450 \fi} %%%Important: adding { } around the last def statement would break this
451 \savedmacro\rightfillcolor{%
452 \edef\tikz@temp{\pgfkeysvalueof{/tikz/swig vsplit/fill color right}}%
453 \ifx\tikz@temp\pgfutil@empty\relax%
454 \ifx\tikz@fillcolor\pgfutil@empty%if not defined even with draw=
455 \def\rightfillcolor{white}%
456 \else%
457 \def\rightfillcolor{\tikz@fillcolor}% if defined with draw=
458 \fi%
459 \else%
460 \def\rightfillcolor{\expandafter\pgfkeysvalueof{/tikz/swig vsplit/fill color right}}%if defined
461 \fi} %%%Important: adding { } around the last def statement would break this
462 %
463 \savedanchor\gap{% This is a coordinate, but \pgf@y is redundant
464 \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/tikz/swig vsplit/gap}}%
465 \pgfmathsetlength\pgf@y{0pt}%
466 }%
467 \savedanchor\linewidthleft{% This is a coordinate, but \pgf@x is redundant
468 \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/tikz/swig vsplit/line width left}}%
469 \pgfmathsetlength\pgf@x{0pt}%
470 }%
471 \savedanchor\linewidthright{% This is a coordinate, but \pgf@x is redundant
472 \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/tikz/swig vsplit/line width right}}%
473 \pgfmathsetlength\pgf@x{0pt}%
474 }%
475 \savedmacro\vsplitangle{%
476 \pgf@xa\wd\pgfnodepartleftbox%
477 \pgf@xb\wd\pgfnodepartrightbox%
478 \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
479 \advance\[email protected]\pgf@x% inner xsep only added left of gap
480 \advance\[email protected]\pgf@x% inner xsep only added right of gap
481 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/tikz/swig vsplit/line width left}}%Added to allow for different widths
482 \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/tikz/swig vsplit/line width right}}%% of lines upper and lower
483 \advance\[email protected]\pgf@ya% Add width of line for left part (strictly, 2x half for each side of left half)
484 \advance\[email protected]\pgf@yb% Add width of line for left part (strictly 2x half for each side of right half)
485 \pgfmathsetmacro{\vsplitangle}{acos((\pgf@xa-\pgf@xb)/(1.414213*(\pgf@xa+\pgf@xb)))}%
486 %\pgfmathsetlength\pgf@x{0pt}%
487 %\pgfmathsetlength\pgf@y{0pt}%
488 }%
489 \savedanchor\radii{%
490 \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
491 %\[email protected]\pgf@x% outer x sep added to both halves
492 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/tikz/swig vsplit/line width left}}%Added to allow for different widths
493 \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/tikz/swig vsplit/line width right}}%% of lines left and right
494 \pgf@xa\wd\pgfnodepartleftbox%
495 \pgf@xb\wd\pgfnodepartrightbox%
496 \advance\[email protected]\pgf@x% add inner x sep to left half;
497 \advance\[email protected]\pgf@ya% Add half width of line for left part
498 \advance\[email protected]\pgf@x% add inner x sep to right half
499 \advance\[email protected]\pgf@yb% Add half width of line for right part
500 \advance\pgf@xb\pgf@xa% add left and right box lengths together
501 \[email protected]\pgf@xb% divide by 2
502 \[email protected]\pgf@xa% compute radius (based on intersect of rectangle box and ellipse at 45 degrees
503 %%%%%%%
504 \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
505 %%%%
506 \pgf@ya\ht\pgfnodepartleftbox%
507 \advance\pgf@ya\dp\pgfnodepartleftbox%
508 \pgf@yb\ht\pgfnodepartrightbox%
509 \advance\pgf@yb\dp\pgfnodepartrightbox%
510 \advance\pgf@ya\pgf@y%
511 \advance\pgf@yb\pgf@y%
512 \ifdim\pgf@ya>\pgf@yb%
513 \[email protected]\pgf@ya% compute 2x radius
514 \else%
515 \[email protected]\pgf@yb% compute 2x radius
516 \fi%
517 \[email protected]\pgf@y % divide by 2
518 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}%
519 \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}%
520 \ifdim\pgf@x<.5\pgf@xa%
521 \[email protected]\pgf@xa%
522 \fi%
523 \ifdim\pgf@y<.5\pgf@ya%
524 \[email protected]\pgf@ya%
525 \fi%
526 \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
527 \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
528 }%
529 \savedanchor\left{%
530 \pgf@x0pt\pgf@y0pt\relax%
531 }%
532 \savedanchor\right{%
533 % %%%%\[email protected]\wd\pgfnodepartrightbox%
534 \pgf@x\wd\pgfnodepartleftbox%
535 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/inner xsep}}%
536 \advance\[email protected]\pgf@xa%
537 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/tikz/swig vsplit/gap}}%%% Added by TSR store gap distance in ya register
538 \advance\pgf@x\pgf@xa% %% Added by TSR for gap
539 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/tikz/swig vsplit/line width left}}%%%
540 \advance\[email protected]\pgf@xa%
541 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/tikz/swig vsplit/line width right}}%%%
542 \advance\[email protected]\pgf@xa%
543 \pgf@y0pt\relax%
544 }%
545 \savedanchor\centerleftgapside{%
546 \pgf@x\wd\pgfnodepartleftbox%
547 %\advance\pgf@x\pgf@xa%
548 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/inner xsep}}%
549 \advance\pgf@x\pgf@xa%
550 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/tikz/swig vsplit/line width left}}%%%
551 \advance\[email protected]\pgf@xa%
552 %%%%% Repeated code fragment to compute max box height
553 \pgf@ya\ht\pgfnodepartleftbox%
554 \advance\pgf@ya-\dp\pgfnodepartleftbox%
555 \pgf@yb\ht\pgfnodepartrightbox%
556 \advance\pgf@yb-\dp\pgfnodepartrightbox%
557 \ifdim\pgf@ya>\pgf@yb%
558 \[email protected]\pgf@ya%
559 \else%
560 \[email protected]\pgf@yb%
561 \fi%
562 %%%%% End repeated code fragment to compute box height
563 }%
564 \savedanchor\globalcenterpoint{%
565 \pgf@x\wd\pgfnodepartleftbox%
566 \[email protected]\pgf@x%
567 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/inner xsep}}%
568 \advance\pgf@x1\pgf@xa% (0.5 x 3)-1 inner xsep since on each side of gap)
569 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/tikz/swig vsplit/gap}}%
570 \advance\[email protected]\pgf@xa%
571 %\advance\pgf@x\pgf@xa%
572 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/tikz/swig vsplit/line width left}}%%%
573 \advance\[email protected]\pgf@xa%
574 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/tikz/swig vsplit/line width right}}%%
575 \advance\[email protected]\pgf@xa%
576 \pgf@xa\wd\pgfnodepartrightbox%
577 \advance\[email protected]\pgf@xa%
578 \pgf@ya\ht\pgfnodepartleftbox%
579 \advance\pgf@ya-\dp\pgfnodepartleftbox%
580 \pgf@yb\ht\pgfnodepartrightbox%
581 \advance\pgf@yb-\dp\pgfnodepartrightbox%
582 \ifdim\pgf@ya>\pgf@yb%
583 \[email protected]\pgf@ya%
584 \else%
585 \[email protected]\pgf@yb%
586 \fi%
587 }%
588 \savedanchor\linewidthatwidestcenter{% coordinate, but x is redundant
589 % Slightly obsessive check to find either left or right line width
590 % Depending on whether left or right contains the vertical radius.
591 \pgf@x\wd\pgfnodepartleftbox%
592 \[email protected]\pgf@x%
593 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/inner xsep}}%
594 \advance\pgf@x\pgf@xa% (0.5 x 3) -1 inner xsep since on each side of gap)
595 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/tikz/swig vsplit/line width left}}%%%
596 \advance\[email protected]\pgf@xa%
597 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/tikz/swig vsplit/line width right}}%% of lines left and right
598 \advance\[email protected]\pgf@xa%
599 \pgf@xa\wd\pgfnodepartrightbox%
600 \advance\[email protected]\pgf@xa% This contains x-coord of left center but this may not be the widest point
601 % if the global center is right of the gap
602 \pgf@xa\wd\pgfnodepartleftbox%
603 \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/inner xsep}}%
604 \advance\pgf@xa\pgf@xb%
605 \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/tikz/swig vsplit/line width left}}%%%
606 \advance\[email protected]\pgf@xb%
607 \ifdim\pgf@x>\pgf@xa%
608 \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/tikz/swig vsplit/line width right}}%
609 \else
610 \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/tikz/swig vsplit/line width left}}%
611 \fi%
612 %
613 \pgf@x0pt%
614 }%
615 \savedanchor\leftcenter{%
616 \pgf@x\wd\pgfnodepartleftbox%
617 \[email protected]\pgf@x%
618 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/inner xsep}}%
619 \advance\pgf@x\pgf@xa% (0.5 x 3)-0.5 inner xsep since on each side of gap)
620 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/tikz/swig vsplit/line width left}}%%%
621 \advance\[email protected]\pgf@xa%
622 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/tikz/swig vsplit/line width right}}%% of lines left and right
623 \advance\[email protected]\pgf@xa%
624 \pgf@xa\wd\pgfnodepartrightbox%
625 \advance\[email protected]\pgf@xa%
626 %%
627 \pgf@ya\ht\pgfnodepartleftbox%
628 \advance\pgf@ya-\dp\pgfnodepartleftbox%
629 \pgf@yb\ht\pgfnodepartrightbox%
630 \advance\pgf@yb-\dp\pgfnodepartrightbox%
631 \ifdim\pgf@ya>\pgf@yb%
632 \[email protected]\pgf@ya%
633 \else%
634 \[email protected]\pgf@yb%
635 \fi%
636 }%
637 \savedanchor\rightcenter{%
638 \pgf@x\wd\pgfnodepartleftbox%
639 \[email protected]\pgf@x%
640 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/inner xsep}}%
641 \advance\pgf@x\pgf@xa% (0.5 x twice inner xsep since on each side of gap)
642 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/tikz/swig vsplit/gap}}% for right center
643 \advance\pgf@x\pgf@xa%
644 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/tikz/swig vsplit/line width left}}%%%
645 \advance\[email protected]\pgf@xa%
646 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/tikz/swig vsplit/line width right}}%% of lines left and right
647 \advance\[email protected]\pgf@xa%
648 \pgf@xa\wd\pgfnodepartrightbox%
649 \advance\[email protected]\pgf@xa%
650 %%
651 \pgf@ya\ht\pgfnodepartleftbox%
652 \advance\pgf@ya-\dp\pgfnodepartleftbox%
653 \pgf@yb\ht\pgfnodepartrightbox%
654 \advance\pgf@yb-\dp\pgfnodepartrightbox%
655 \ifdim\pgf@ya>\pgf@yb%
656 \[email protected]\pgf@ya%
657 \else%
658 \[email protected]\pgf@yb%
659 \fi%
660 }%
661 \savedanchor\basepoint{%
662 \[email protected]\wd\pgfnodepartleftbox%
663 \pgf@y0pt\relax%
664 }%
665 \savedanchor\basepointright{%
666 \pgf@x\wd\pgfnodepartleftbox%
667 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/inner xsep}}%
668 \advance\[email protected]\pgf@xa%
669 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/tikz/swig vsplit/gap}}%%% Added by TSR store gap distance in ya register
670 \advance\pgf@x\pgf@xa% %% Added by TSR for gap
671 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/tikz/swig vsplit/line width left}}%%%
672 \advance\[email protected]\pgf@xa%
673 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/tikz/swig vsplit/line width right}}%%%
674 \advance\[email protected]\pgf@xa%
675 \advance\[email protected]\wd\pgfnodepartrightbox%
676 \pgf@y0pt\relax%
677 }%
678 \savedanchor\midpointleft{%
679 \[email protected]\wd\pgfnodepartleftbox%
680 %%%% Repeated code fragment for max box height
681 \pgf@ya\ht\pgfnodepartleftbox%
682 \advance\pgf@ya-\dp\pgfnodepartleftbox%
683 \pgf@yb\ht\pgfnodepartrightbox%
684 \advance\pgf@yb-\dp\pgfnodepartrightbox%
685 \ifdim\pgf@ya>\pgf@yb%
686 \[email protected]\pgf@ya%
687 \else%
688 \[email protected]\pgf@yb%
689 \fi%
690 }%
691 \savedanchor\midpointright{%
692 \pgf@x\wd\pgfnodepartleftbox%
693 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/inner xsep}}%
694 \advance\[email protected]\pgf@xa%
695 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/tikz/swig vsplit/gap}}%%% Added by TSR store gap distance in ya register
696 \advance\pgf@x\pgf@xa% %% Added by TSR for gap
697 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/tikz/swig vsplit/line width left}}%%%
698 \advance\[email protected]\pgf@xa%
699 \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/tikz/swig vsplit/line width right}}%%%
700 \advance\[email protected]\pgf@xa%
701 \advance\[email protected]\wd\pgfnodepartrightbox%
702 %%%% Repeated code fragment for max box height
703 \pgf@ya\ht\pgfnodepartleftbox%
704 \advance\pgf@ya-\dp\pgfnodepartleftbox%
705 \pgf@yb\ht\pgfnodepartrightbox%
706 \advance\pgf@yb-\dp\pgfnodepartrightbox%
707 \ifdim\pgf@ya>\pgf@yb%
708 \[email protected]\pgf@ya%
709 \else%
710 \[email protected]\pgf@yb%
711 \fi%
712 }%
713 %%%%%%%%%%% ANCHORS
714 %% Note: anchors left center and right center are the center of the left and right sides of the gap
715 %% These are not the same as saved anchors leftcenter and right center which are the centers of the left and right ellipse
716 \anchor{left center}{\linewidthleft\[email protected]\pgf@y\centerleftgapside\advance\pgf@x\pgf@xa}
717 \anchor{right center}{\linewidthright\[email protected]\pgf@y\gap\advance\pgf@xa\pgf@x\centerleftgapside\advance\pgf@x\pgf@xa}
718 \anchor{left ellipse center}{\leftcenter}
719 \anchor{right ellipse center}{\rightcenter}
720 \anchor{left north}{\radii%
721 \pgf@ya\pgf@y%
722 \pgfmathsetlength\pgf@ya{\pgf@ya*(sin(\vsplitangle))}%
723 \linewidthleft\advance\[email protected]\pgf@y%
724 \centerleftgapside\advance\pgf@y\pgf@ya%
725 }%
726 \anchor{left south}{\radii%
727 \pgf@ya\pgf@y%
728 \pgfmathsetlength\pgf@ya{\pgf@ya*(sin(\vsplitangle))}%
729 \linewidthleft\advance\[email protected]\pgf@y%
730 \centerleftgapside\advance\pgf@y-\pgf@ya%
731 }%
732 \anchor{right north}{\pgfpointadd{\centerleftgapside}{%
733 \radii%
734 \pgf@ya\pgf@y%
735 \pgfmathsetlength\pgf@ya{\pgf@ya*(sin(\vsplitangle))}%
736 \linewidthright\advance\[email protected]\pgf@y%
737 \gap\pgf@y\pgf@ya%
738 }}%
739 \anchor{right south}{\pgfpointadd{\centerleftgapside}{%
740 \radii%
741 \pgf@ya\pgf@y%
742 \pgfmathsetlength\pgf@ya{\pgf@ya*(sin(\vsplitangle))}%
743 \linewidthright\advance\[email protected]\pgf@y%
744 \gap\pgf@y-\pgf@ya%
745 }}%
746 \anchor{left}{\left}
747 \anchor{text}{\left} %Added for compatibility (?)
748 \anchor{right}{\right}
749 \anchor{center}{\globalcenterpoint}
750 \anchor{right base}{\basepointright}
751 \anchor{left base}{\basepoint}
752 \anchor{base}{\basepoint} %% Added for compatibility
753 \anchor{right mid}{\midpointright}
754 \anchor{left mid}{\midpointleft}
755 \anchor{mid}{\midpointleft}
756 \anchor{mid east}{\pgfpointadd{\rightcenter}{\radii\pgf@xa\pgf@x\linewidthright\[email protected]\pgf@y\advance\pgf@xa\pgf@x\midpointright\pgf@x\pgf@xa}}%
757 \anchor{mid west}{\pgfpointadd{\leftcenter}{\radii\pgf@xa\pgf@x\linewidthleft\[email protected]\pgf@y\advance\pgf@xa\pgf@x\midpointleft\pgf@x-\pgf@xa}}%
758 \anchor{base east}{\pgfpointadd{\rightcenter\pgf@y0pt}{\radii\pgf@xa\pgf@x\linewidthright\[email protected]\pgf@y\advance\pgf@x\pgf@xa\pgf@y0pt}}%
759 \anchor{base west}{\pgfpointadd{\leftcenter\pgf@y0pt}{\radii\pgf@xa\pgf@x\linewidthleft\[email protected]\pgf@y\advance\pgf@xa\pgf@x\pgf@x-\pgf@xa\pgf@y0pt}}%
760 %\anchor{mid west}{\radii\pgf@xa\pgf@x\centerleftgapside\advance\pgf@x-\pgf@xa}
761 \anchor{base}{\basepoint}
762 \anchor{north}{\pgfpointadd{\globalcenterpoint}{\linewidthatwidestcenter\pgf@ya\pgf@y\radii\advance\[email protected]\pgf@ya\[email protected]}}%
763 \anchor{south}{\pgfpointadd{\globalcenterpoint}{\linewidthatwidestcenter\pgf@ya\pgf@y\radii\pgf@y-\pgf@y\advance\[email protected]\pgf@ya\pgf@x0pt}}%
764 \anchor{east}{\pgfpointadd{\rightcenter}{\radii\pgf@xa\pgf@x\linewidthright\[email protected]\pgf@y\advance\pgf@x\pgf@xa\pgf@y0pt}}%
765 \anchor{west}{\pgfpointadd{\leftcenter}{\radii\pgf@xa-\pgf@x\linewidthleft\[email protected]\pgf@y\advance\pgf@x\pgf@xa\pgf@y0pt}}%
766 \anchor{north west}{\pgfpointadd{\leftcenter}{\linewidthleft\[email protected]\pgf@y%
767 \radii\advance\pgf@x\pgf@xa\advance\pgf@y\pgf@xa%
768 \[email protected]\pgf@x\[email protected]\pgf@y}}%
769 \anchor{south west}{\pgfpointadd{\leftcenter}{\linewidthleft\[email protected]\pgf@y%
770 \radii\advance\pgf@x\pgf@xa\advance\pgf@y\pgf@xa%
771 \[email protected]\pgf@x\[email protected]\pgf@y}}%
772 \anchor{north east}{\pgfpointadd{\rightcenter}{\linewidthright\[email protected]\pgf@y%
773 \radii\advance\pgf@x\pgf@xa\advance\pgf@y\pgf@xa%
774 \[email protected]\pgf@x\[email protected]\pgf@y}}%
775 \anchor{south east}{\pgfpointadd{\rightcenter}{\linewidthright\[email protected]\pgf@y%
776 \radii\advance\pgf@x\pgf@xa\advance\pgf@y\pgf@xa%
777 \[email protected]\pgf@x\[email protected]\pgf@y}}%
778 %%%%%%%%% START OF DRAWING VSPLIT
779 %%%%% Left
780 \beforebackgroundpath{%
781 \edef\defaultpgflinewidth{\the\pgflinewidth}% store default line width
782 \pgfsetstrokecolor{\leftcolor}%
783 \pgfsetfillcolor{\leftfillcolor}%
784 % \expandafter\pgfsetstrokecolor\expandafter{\pgfkeysvalueof{/tikz/swig vsplit/linecolorleft}}%
785 \expandafter\pgfsetlinewidth\expandafter{\pgfkeysvalueof{/tikz/swig vsplit/line width left}}%
786 \expandafter\pgfsetinnerlinewidth\expandafter{\pgfkeysvalueof{/tikz/swig vsplit/inner line width left}}%
787 \radii%
788 \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}%
789 \pgfmathaddtolength\pgf@y{-\pgfkeysvalueof{/pgf/outer ysep}}%
790 \pgfutil@tempdima\pgf@x%
791 \pgfutil@tempdimb\pgf@y%
792 \pgf@ya\pgf@y%
793 \pgfmathsetlength\pgf@ya{\pgf@ya*(sin(\vsplitangle))}%% compute y distance for off-center split
794 \pgfpathmoveto{\centerleftgapside\advance\pgf@y\pgf@ya}% set path to centerpoint + \pgf@ya
795 \pgfpatharcaxes{\vsplitangle}{360-\vsplitangle}{\pgfpoint{\the\pgfutil@tempdima}{0pt}}{\pgfpoint{0pt}{\the\pgfutil@tempdimb}}%
796 \pgfpathclose
797 \pgfusepath{stroke,fill}
798 %%%%%% right
799 \pgfsetlinewidth\defaultpgflinewidth % Reset \the\pgflinewidth to default value (in case changed while drawing left)
800 \pgfsetstrokecolor{\rightcolor}%
801 \pgfsetfillcolor{\rightfillcolor}%
802 \expandafter\pgfsetlinewidth\expandafter{\pgfkeysvalueof{/tikz/swig vsplit/line width right}}%
803 \expandafter\pgfsetinnerlinewidth\expandafter{\pgfkeysvalueof{/tikz/swig vsplit/inner line width right}}%
804 \radii%
805 \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}%
806 \pgfmathaddtolength\pgf@y{-\pgfkeysvalueof{/pgf/outer ysep}}%
807 \pgfutil@tempdima\pgf@x%
808 \pgfutil@tempdimb\pgf@y%
809 \pgf@ya\pgf@y%
810 \pgfmathsetlength\pgf@yb{\pgf@ya*(sin(\vsplitangle))}%% compute y distance for off-center split
811 \pgfpathmoveto{\centerleftgapside\pgf@xa\pgf@x\pgf@ya\pgf@y\advance\pgf@ya\pgf@yb%
812 \gap\advance\pgf@xa\pgf@x%
813 \pgf@x\pgf@xa\pgf@y\pgf@ya%
814 }%
815 \pgfpatharcaxes{\vsplitangle}{-\vsplitangle}{\pgfpoint{\the\pgfutil@tempdima}{0pt}}{\pgfpoint{0pt}{\the\pgfutil@tempdimb}}%
816 \pgfpathclose%
817 \pgfusepath{stroke,fill}%
818 }
819 \anchorborder{%
820 \pgfextract@process\externalpoint{}% %https://tex.stackexchange.com/questions/255492/storing-a-pgfpoint-for-repeated-use
821 %%%%% This stores the current \pgf@x and \pgf@y in the macro \externalpoint
822 \linewidthleft%
823 \pgf@ya\pgf@y%
824 \radii%
825 \advance\[email protected]\pgf@ya% add half-line width to x radius
826 \advance\[email protected]\pgf@ya% add half line width to y radius
827 \edef\pgf@marshal{%
828 \noexpand\pgfpointadd{\noexpand\pgfpointborderellipse{\noexpand\externalpoint}%
829 {\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}}{\noexpand\leftcenter}%
830 }%
831 \pgf@marshal%
832 \pgf@xa\pgf@x% store the border point
833 \pgf@ya\pgf@y% store the border point
834 \centerleftgapside%
835 \pgf@xb\pgf@x% point on gap
836 \ifdim\pgf@xa>\pgf@xb%
837 \linewidthright%
838 \pgf@ya\pgf@y%
839 \radii%
840 \advance\[email protected]\pgf@ya% add half-line width to x radius
841 \advance\[email protected]\pgf@ya% add half line width to y radius
842 \edef\pgf@marshal{%
843 \noexpand\pgfpointadd{\noexpand\pgfpointborderellipse{\noexpand\externalpoint}%
844 {\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}}{\noexpand\rightcenter}%
845 }%
846 \pgf@marshal%
847 \else
848 \pgf@x\pgf@xa%
849 \pgf@y\pgf@ya%
850 \fi%
851 }%
852 }
853
854
855 \endinput