| 1 |
%% |
| 2 |
%% Package: spectralsequences v1.3.3 2023-01-28 |
| 3 |
%% Author: Hood Chatham |
| 4 |
%% Email: [email protected] |
| 5 |
%% Date: 2023-01-28 |
| 6 |
%% License: Latex Project Public License |
| 7 |
%% |
| 8 |
%% File: sseqdrawing.code.tex |
| 9 |
%% |
| 10 |
%% Defines the macros that draw the features of the spectral sequence (at least, those that aren't drawn by tikz). |
| 11 |
%% Everything here has to be super optimized, because like 90% of the execution time is in these functions. |
| 12 |
%% In particular, tikz is a horrible performance hole that must be avoided at all costs. For example, the code |
| 13 |
%% the code to produce the axis ticks used to use the tikz \node command, and in the file example_KF3n.tex drawing |
| 14 |
%% the axes ticks was taking about 1/3 of the compile time (a little under 1s out of a 3.2) |
| 15 |
%% |
| 16 |
|
| 17 |
% Only for integer valued coordinates... |
| 18 |
\def\sseq@qpointxy#1#2{\pgfqpointxy{\numexpr#1+\sseq@xoffset\relax}{\numexpr#2+\sseq@yoffset\relax}} |
| 19 |
|
| 20 |
\def\sseq@transform@xymirror{ |
| 21 |
\pgfsetxvec{\pgfqpoint{1cm}{0cm}} |
| 22 |
\pgfsetyvec{\pgfqpoint{0cm}{1cm}} |
| 23 |
\pgftransformcm{0}{1}{1}{0}{\pgfpointxy{\sseq@xoffset*\sseq@xscale }{\sseq@yoffset*\sseq@yscale}} % Reflect x and y axes, |
| 24 |
\pgftransformshift{\pgfpointxy{-\sseq@xoffset*\sseq@yscale}{-\sseq@yoffset*\sseq@xscale}} % but we need to conjugate by a shift of (xoffset,yoffset) |
| 25 |
\pgfsetyvec{\pgfqpoint{0cm}{\sseq@xscale cm}} |
| 26 |
\pgfsetxvec{\pgfqpoint{\sseq@yscale cm}{0cm}} |
| 27 |
} |
| 28 |
|
| 29 |
|
| 30 |
\def\sseq@setlayoutparameter#1#2{\@xp\let\csname sseq@#1\@xp\endcsname\csname sseq@#1@#2\endcsname} |
| 31 |
\def\sseq@setlayoutparameters{ |
| 32 |
\sseq@setlayoutparameter{yaxisorigin}{x\sseq@xaxistype} |
| 33 |
\sseq@setlayoutparameter{drawyaxis}{x\sseq@xaxistype} |
| 34 |
\sseq@setlayoutparameter{yaxisstartoffset}{x\sseq@xaxistype} |
| 35 |
\sseq@setlayoutparameter{yaxisendoffset}{x\sseq@xaxistype} |
| 36 |
\sseq@setlayoutparameter{bottomgridpadding}{x\sseq@xaxistype} |
| 37 |
\sseq@setlayoutparameter{topgridpadding}{x\sseq@xaxistype} |
| 38 |
\sseq@setlayoutparameter{bottomclippadding}{x\sseq@xaxistype} |
| 39 |
\sseq@setlayoutparameter{topclippadding}{x\sseq@xaxistype} |
| 40 |
\sseq@setlayoutparameter{xlabelposition}{x\sseq@xaxistype} |
| 41 |
\sseq@setlayoutparameter{totalverticalmargin}{x\sseq@xaxistype} |
| 42 |
% |
| 43 |
\sseq@setlayoutparameter{xaxisorigin}{y\sseq@yaxistype} |
| 44 |
\sseq@setlayoutparameter{drawxaxis}{y\sseq@yaxistype} |
| 45 |
\sseq@setlayoutparameter{xaxisstartoffset}{y\sseq@yaxistype} |
| 46 |
\sseq@setlayoutparameter{xaxisendoffset}{y\sseq@yaxistype} |
| 47 |
\sseq@setlayoutparameter{leftgridpadding}{y\sseq@yaxistype} |
| 48 |
\sseq@setlayoutparameter{rightgridpadding}{y\sseq@yaxistype} |
| 49 |
\sseq@setlayoutparameter{leftclippadding}{y\sseq@yaxistype} |
| 50 |
\sseq@setlayoutparameter{rightclippadding}{y\sseq@yaxistype} |
| 51 |
\sseq@setlayoutparameter{ylabelposition}{y\sseq@yaxistype} |
| 52 |
\sseq@setlayoutparameter{totalhorizontalmargin}{y\sseq@yaxistype} |
| 53 |
} |
| 54 |
|
| 55 |
% The appropriate one of these is chosen by the "axis type" keys in sseqkeys. |
| 56 |
|
| 57 |
% Used to calculate available area in range check |
| 58 |
\def\sseq@totalhorizontalmargin@yborder{(\sseq@xaxis@tail + \sseq@yaxisgap + \sseq@xaxis@end@extend + \sseq@clip@padding@right)} |
| 59 |
\def\sseq@totalhorizontalmargin@yframe{(\sseq@ylabelgap + \sseq@maxylabelwidth + \sseq@yaxisgap * 2)} |
| 60 |
\def\sseq@totalhorizontalmargin@ycenter{(\sseq@xaxis@start@extend + \sseq@clip@padding@left + \sseq@xaxis@end@extend + \sseq@clip@padding@right)} |
| 61 |
\def\sseq@totalhorizontalmargin@ynone{(\sseq@xaxis@start@extend + \sseq@clip@padding@left + \sseq@xaxis@end@extend + \sseq@clip@padding@right)} |
| 62 |
|
| 63 |
\def\sseq@totalverticalmargin@xborder{(\sseq@yaxis@tail + \sseq@xaxisgap + \sseq@yaxis@end@extend + \sseq@clip@padding@top)} |
| 64 |
\def\sseq@totalverticalmargin@xframe{(\sseq@xlabelgap + \sseq@xlabelheight + \sseq@xaxisgap * 2)} |
| 65 |
\def\sseq@totalverticalmargin@xcenter{(\sseq@yaxis@start@extend + \sseq@clip@padding@bottom + \sseq@yaxis@end@extend + \sseq@clip@padding@top)} |
| 66 |
\def\sseq@totalverticalmargin@xnone{(\sseq@yaxis@start@extend + \sseq@clip@padding@bottom + \sseq@yaxis@end@extend + \sseq@clip@padding@top)} |
| 67 |
|
| 68 |
% Used to determine axis and ticks placement |
| 69 |
\def\sseq@xaxisorigin@yborder{\sseq@xmin} |
| 70 |
\def\sseq@xaxisorigin@yframe{\sseq@xmin} |
| 71 |
\def\sseq@xaxisorigin@ycenter{\sseq@xaxisorigin@center@} |
| 72 |
\def\sseq@yaxisorigin@xborder{\sseq@ymin} |
| 73 |
\def\sseq@yaxisorigin@xframe{\sseq@ymin} |
| 74 |
\def\sseq@yaxisorigin@xcenter{\sseq@yaxisorigin@center@} |
| 75 |
|
| 76 |
% Used to determine clipping and grid boundaries |
| 77 |
\def\sseq@leftgridpadding@yborder{\dimexpr\sseq@yaxisgap-\sseq@yclip@axisgap\relax} |
| 78 |
\def\sseq@rightgridpadding@yborder{\sseq@xaxis@end@extend} |
| 79 |
\def\sseq@leftgridpadding@ycenter{\sseq@xaxis@start@extend} |
| 80 |
\def\sseq@rightgridpadding@ycenter{\sseq@xaxis@end@extend} |
| 81 |
\def\sseq@leftgridpadding@yframe{\dimexpr\sseq@yaxisgap-\sseq@yclip@axisgap\relax} |
| 82 |
\def\sseq@rightgridpadding@yframe{5cm} % Just make it big enough to push off the end of the clip |
| 83 |
\def\sseq@leftgridpadding@ynone{\sseq@yaxisgap} |
| 84 |
\def\sseq@rightgridpadding@ynone{\sseq@yaxisgap} |
| 85 |
|
| 86 |
|
| 87 |
\def\sseq@bottomgridpadding@xborder{\dimexpr\sseq@xaxisgap-\sseq@xclip@axisgap\relax} |
| 88 |
\def\sseq@topgridpadding@xborder{\sseq@yaxis@end@extend} |
| 89 |
\def\sseq@bottomgridpadding@xcenter{\sseq@yaxis@start@extend} |
| 90 |
\def\sseq@topgridpadding@xcenter{\sseq@yaxis@end@extend} |
| 91 |
\def\sseq@bottomgridpadding@xframe{\dimexpr\sseq@xaxisgap-\sseq@xclip@axisgap\relax} |
| 92 |
\def\sseq@topgridpadding@xframe{5cm} |
| 93 |
\def\sseq@bottomgridpadding@xnone{\sseq@xaxisgap} |
| 94 |
\def\sseq@topgridpadding@xnone{\sseq@xaxisgap} |
| 95 |
|
| 96 |
\def\sseq@leftclippadding@yborder{\dimexpr-\sseq@yaxisgap+\sseq@yclip@axisgap\relax} |
| 97 |
\def\sseq@rightclippadding@yborder{\dimexpr\sseq@xaxis@end@extend+\sseq@clip@padding@right\relax} |
| 98 |
\def\sseq@leftclippadding@ycenter{\dimexpr-\sseq@xaxis@start@extend-\sseq@clip@padding@left\relax} |
| 99 |
\def\sseq@rightclippadding@ycenter{\dimexpr\sseq@xaxis@end@extend+\sseq@clip@padding@right\relax} |
| 100 |
\def\sseq@leftclippadding@yframe{\dimexpr-\sseq@yaxisgap+\sseq@yclip@axisgap\relax} |
| 101 |
\def\sseq@rightclippadding@yframe{\dimexpr\sseq@yaxisgap-\sseq@yclip@axisgap\relax} |
| 102 |
\def\sseq@leftclippadding@ynone{\dimexpr-\sseq@yaxisgap-\sseq@clip@padding@left\relax} |
| 103 |
\def\sseq@rightclippadding@ynone{\dimexpr\sseq@yaxisgap+\sseq@clip@padding@right\relax} |
| 104 |
|
| 105 |
\def\sseq@bottomclippadding@xborder{\dimexpr-\sseq@xaxisgap+\sseq@xclip@axisgap\relax} |
| 106 |
\def\sseq@topclippadding@xborder{\dimexpr\sseq@yaxis@end@extend+\sseq@clip@padding@top\relax} |
| 107 |
\def\sseq@bottomclippadding@xcenter{\dimexpr-\sseq@yaxis@start@extend-\sseq@clip@padding@bottom\relax} |
| 108 |
\def\sseq@topclippadding@xcenter{\dimexpr\sseq@yaxis@end@extend+\sseq@clip@padding@top\relax} |
| 109 |
\def\sseq@bottomclippadding@xframe{\dimexpr-\sseq@xaxisgap+\sseq@xclip@axisgap\relax} |
| 110 |
\def\sseq@topclippadding@xframe{\dimexpr\sseq@xaxisgap-\sseq@xclip@axisgap\relax} |
| 111 |
\def\sseq@bottomclippadding@xnone{\dimexpr-\sseq@xaxisgap-\sseq@clip@padding@bottom\relax} |
| 112 |
\def\sseq@topclippadding@xnone{\dimexpr\sseq@xaxisgap+\sseq@clip@padding@top\relax} |
| 113 |
|
| 114 |
% Used to figure out how much further beyond (min -- max) to draw axes |
| 115 |
\def\sseq@xaxisstartoffset@yborder{\dimexpr\sseq@xaxis@tail+\sseq@yaxisgap\relax} |
| 116 |
\def\sseq@xaxisendoffset@yborder{\sseq@xaxis@end@extend} |
| 117 |
\def\sseq@xaxisstartoffset@ycenter{\sseq@xaxis@start@extend} |
| 118 |
\def\sseq@xaxisendoffset@ycenter{\sseq@xaxis@end@extend} |
| 119 |
\def\sseq@xaxisstartoffset@yframe{\sseq@yaxisgap} |
| 120 |
\def\sseq@xaxisendoffset@yframe{\sseq@yaxisgap} |
| 121 |
|
| 122 |
\def\sseq@yaxisstartoffset@xborder{\dimexpr\sseq@yaxis@tail+\sseq@xaxisgap\relax} |
| 123 |
\def\sseq@yaxisendoffset@xborder{\sseq@yaxis@end@extend} |
| 124 |
\def\sseq@yaxisstartoffset@xcenter{\sseq@yaxis@start@extend} |
| 125 |
\def\sseq@yaxisendoffset@xcenter{\sseq@yaxis@end@extend} |
| 126 |
\def\sseq@yaxisstartoffset@xframe{\sseq@xaxisgap} |
| 127 |
\def\sseq@yaxisendoffset@xframe{\sseq@xaxisgap} |
| 128 |
|
| 129 |
\def\sseq@xlabelposition@xborder{(0,-\sseq@xaxisstartoffset)} |
| 130 |
\def\sseq@xlabelposition@xcenter{(-\sseq@yaxisgap,-\sseq@xaxisstartoffset-5pt)} |
| 131 |
\def\sseq@xlabelposition@xframe{(0,-\sseq@xaxisgap-\sseq@xlabelgap-10pt)} |
| 132 |
\def\sseq@xlabelposition@xnone{(0,0)} |
| 133 |
|
| 134 |
\def\sseq@ylabelposition@yborder{(0,\sseq@yaxisstartoffset)} |
| 135 |
\def\sseq@ylabelposition@ycenter{(-\sseq@xaxisgap,\sseq@yaxisstartoffset+5pt)} |
| 136 |
\def\sseq@ylabelposition@yframe{(0,\sseq@yaxisgap+\sseq@ylabelgap+10pt)} |
| 137 |
\def\sseq@ylabelposition@ynone{(0,0)} |
| 138 |
%%% |
| 139 |
%%% Draw axes and clip |
| 140 |
%%% |
| 141 |
\def\sseq@handlexaxis{ |
| 142 |
\bgroup |
| 143 |
\sseq@drawxaxis |
| 144 |
\ifsseq@drawxaxisticks |
| 145 |
\sseq@drawxticks |
| 146 |
\fi |
| 147 |
\egroup |
| 148 |
} |
| 149 |
\def\sseq@handleyaxis{ |
| 150 |
\bgroup |
| 151 |
\sseq@drawyaxis |
| 152 |
\ifsseq@drawyaxisticks |
| 153 |
\sseq@drawyticks |
| 154 |
\fi |
| 155 |
\egroup |
| 156 |
} |
| 157 |
|
| 158 |
% Draws an x axis. Use with \sseq@transform@xymirror to draw y axis. |
| 159 |
% #1 -- horizontal start offset |
| 160 |
% #2 -- horizontal end offset |
| 161 |
% #3 -- vertical offset |
| 162 |
% #4 -- start value |
| 163 |
% #5 -- end value |
| 164 |
% #6 -- vertical value |
| 165 |
\def\sseq@drawaxis@generic#1#2#3#4#5#6{ |
| 166 |
\bgroup |
| 167 |
\pgftransformshift{\pgfqpoint{#2}{#3}} |
| 168 |
\pgfpathmoveto{\sseq@qpointxy{#5}{#6}} |
| 169 |
\egroup |
| 170 |
% |
| 171 |
\bgroup |
| 172 |
\pgftransformshift{\pgfqpoint{#1}{#3}} |
| 173 |
\pgfpathlineto{\sseq@qpointxy{#4}{#6}} |
| 174 |
\egroup |
| 175 |
} |
| 176 |
|
| 177 |
\def\sseq@drawxaxis@ynone{ |
| 178 |
\sseq@drawxaxisticksfalse |
| 179 |
} |
| 180 |
\def\sseq@drawyaxis@xnone{ |
| 181 |
\sseq@drawyaxisticksfalse |
| 182 |
} |
| 183 |
|
| 184 |
\def\sseq@drawxaxis@yborder{ |
| 185 |
\sseq@drawaxis@generic{-\sseq@xaxisstartoffset}{\sseq@xaxisendoffset}{-\sseq@xaxisgap}{\sseq@xmin}{\sseq@xmax}{\sseq@yaxisorigin} |
| 186 |
\pgfusepath{stroke} |
| 187 |
} |
| 188 |
\let\sseq@drawxaxis@ycenter\sseq@drawxaxis@yborder |
| 189 |
|
| 190 |
\def\sseq@drawxaxis@yframe{ |
| 191 |
\sseq@drawaxis@generic{-\sseq@xaxisstartoffset}{\sseq@xaxisendoffset}{-\sseq@xaxisgap}{\sseq@xmin}{\sseq@xmax}{\sseq@ymin} |
| 192 |
\sseq@drawaxis@generic{-\sseq@xaxisstartoffset}{\sseq@xaxisendoffset}{ \sseq@xaxisgap}{\sseq@xmin}{\sseq@xmax}{\sseq@ymax} |
| 193 |
\pgfusepath{stroke} |
| 194 |
} |
| 195 |
\def\sseq@drawyaxis@xborder{ |
| 196 |
\bgroup |
| 197 |
\sseq@transform@xymirror |
| 198 |
\sseq@drawaxis@generic{-\sseq@yaxisstartoffset}{\sseq@yaxisendoffset}{-\sseq@yaxisgap}{\sseq@ymin}{\sseq@ymax}{\sseq@xaxisorigin} |
| 199 |
\pgfusepath{stroke}% |
| 200 |
\egroup |
| 201 |
} |
| 202 |
\let\sseq@drawyaxis@xcenter\sseq@drawyaxis@xborder |
| 203 |
\def\sseq@drawyaxis@xframe{ |
| 204 |
\bgroup |
| 205 |
\sseq@transform@xymirror |
| 206 |
\sseq@drawaxis@generic{-\sseq@yaxisstartoffset}{\sseq@yaxisendoffset}{-\sseq@yaxisgap}{\sseq@ymin}{\sseq@ymax}{\sseq@xmin} |
| 207 |
\sseq@drawaxis@generic{-\sseq@yaxisstartoffset}{\sseq@yaxisendoffset}{ \sseq@yaxisgap}{\sseq@ymin}{\sseq@ymax}{\sseq@xmax} |
| 208 |
\pgfusepath{stroke}% |
| 209 |
\egroup |
| 210 |
} |
| 211 |
|
| 212 |
\ExplSyntaxOn |
| 213 |
\def\sseq@intdivceiling#1#2{% |
| 214 |
\ifnum#1>\z@ % \int_div_truncate:nn rounds towards 0. We want \int_div_ceiling |
| 215 |
\int_div_truncate:nn{#1+#2-1}{#2} % if positive, use ceil(p/q)=floor((p+q-1)/q) for p,q integers |
| 216 |
\else |
| 217 |
\int_div_truncate:nn{#1}{#2} % if we are negative, towards 0 is ceiling |
| 218 |
\fi |
| 219 |
} |
| 220 |
\def\sseq@intdivfloor#1#2{% |
| 221 |
\ifnum#1<\z@ % \int_div_truncate:nn rounds towards 0. We want \int_div_floor |
| 222 |
\int_div_truncate:nn{#1-#2+1}{#2} % if we are negative, use floor(p/q) = ceil(p-q+1/q) for p,q integers |
| 223 |
\else |
| 224 |
\int_div_truncate:nn{#1}{#2} % if positive, towards 0 is floor |
| 225 |
\fi |
| 226 |
} |
| 227 |
\ExplSyntaxOff |
| 228 |
|
| 229 |
% #1 -- xmin |
| 230 |
% #2 -- xmax |
| 231 |
% #3 -- step |
| 232 |
% #4 -- offset |
| 233 |
% #5 -- ymin |
| 234 |
% #6 -- xaxisgap |
| 235 |
% #7 -- code |
| 236 |
\def\sseq@tickloop@generic#1#2#3#4#5#6#7{ |
| 237 |
\sseq@tempcount=\numexpr % min |
| 238 |
\sseq@intdivceiling{#1}{#3} * #3 |
| 239 |
- |
| 240 |
\sseq@intdivceiling{#4}{#3} * #3 + #4 |
| 241 |
\relax |
| 242 |
\ifnum\sseq@tempcount<#1\relax |
| 243 |
\advance\sseq@tempcount#3\relax |
| 244 |
\fi |
| 245 |
\sseq@tempcountb=\numexpr#2+1\relax % max |
| 246 |
\loop |
| 247 |
\bgroup |
| 248 |
\pgftransformshift{\sseq@qpointxy{\sseq@tempcount}{#5}}% |
| 249 |
\pgftransformshift{\pgfqpoint{0pt}{#6}} |
| 250 |
#7 |
| 251 |
\egroup |
| 252 |
\advance\sseq@tempcount#3\relax |
| 253 |
\ifnum\sseq@tempcount<\sseq@tempcountb\repeat |
| 254 |
} |
| 255 |
|
| 256 |
|
| 257 |
\def\sseq@drawxticks{% |
| 258 |
\sseq@tickloop@generic{\sseq@xmin}{\sseq@xmax}{\sseq@xtickstep}{\sseq@xtickstepoffset}{\sseq@yaxisorigin}{-\sseq@xaxisgap}{ |
| 259 |
\pgftransformshift{\pgfqpoint{0pt}{-\sseq@xlabelgap}} |
| 260 |
\pgftransformresetnontranslations |
| 261 |
%\@xp\tikzset\@xp{\sseq@xtickstyle} |
| 262 |
%\pgftext{\tikz@options\tikz@textfont\hbox{$\sseq@xtickfn{\the\sseq@tempx}$}}% |
| 263 |
\@xp\node\@xp[\sseq@xtickstyle]{\hbox{$\sseq@xtickfn{\the\sseq@tempcount}$}}; |
| 264 |
} |
| 265 |
\ifnum\sseq@xmajortickstep>\z@ |
| 266 |
\sseq@tickloop@generic{\sseq@xmin}{\sseq@xmax}{\sseq@xmajortickstep}{\sseq@xtickstepoffset}{\sseq@yaxisorigin}{-\sseq@xaxisgap}{ |
| 267 |
\pgfpathmoveto{\pgfpointorigin} |
| 268 |
\pgfpathlineto{\pgfpoint{0}{-0.4*\sseq@xaxisgap}} |
| 269 |
} |
| 270 |
\fi |
| 271 |
\ifnum\sseq@xminortickstep>\z@ |
| 272 |
\sseq@tickloop@generic{\sseq@xmin}{\sseq@xmax}{\sseq@xminortickstep}{\sseq@xtickstepoffset}{\sseq@yaxisorigin}{-\sseq@xaxisgap}{ |
| 273 |
\pgfpathmoveto{\pgfpointorigin} |
| 274 |
\pgfpathlineto{\pgfpoint{0}{-0.2*\sseq@xaxisgap}} |
| 275 |
} |
| 276 |
\fi |
| 277 |
\pgfusepath{stroke} |
| 278 |
} |
| 279 |
\def\sseq@drawyticks{% |
| 280 |
\sseq@transform@xymirror |
| 281 |
\sseq@tickloop@generic{\sseq@ymin}{\sseq@ymax}{\sseq@ytickstep}{\sseq@ytickstepoffset}{\sseq@xaxisorigin}{-\sseq@yaxisgap}{ |
| 282 |
\pgftransformshift{\pgfqpoint{0pt}{-\sseq@ylabelgap}} |
| 283 |
\pgftransformresetnontranslations |
| 284 |
%\@xp\tikzset\@xp{\sseq@ytickstyle} |
| 285 |
%\pgftext{\tikz@options\tikz@textfont\hbox{$\sseq@ytickfn{\the\sseq@tempx}$}}% |
| 286 |
\@xp\node\@xp[\sseq@ytickstyle]{\hbox{$\sseq@ytickfn{\the\sseq@tempcount}$}}; |
| 287 |
} |
| 288 |
\ifnum\sseq@ymajortickstep>\z@ |
| 289 |
\sseq@tickloop@generic{\sseq@ymin}{\sseq@ymax}{\sseq@ymajortickstep}{\sseq@ytickstepoffset}{\sseq@xaxisorigin}{-\sseq@yaxisgap}{ |
| 290 |
\pgfpathmoveto{\pgfpointorigin} |
| 291 |
\pgfpathlineto{\pgfpoint{0}{-0.4*\sseq@yaxisgap}} |
| 292 |
} |
| 293 |
\fi |
| 294 |
\ifnum\sseq@yminortickstep>\z@ |
| 295 |
\sseq@tickloop@generic{\sseq@ymin}{\sseq@ymax}{\sseq@yminortickstep}{\sseq@ytickstepoffset}{\sseq@xaxisorigin}{-\sseq@yaxisgap}{ |
| 296 |
\pgfpathmoveto{\pgfpointorigin} |
| 297 |
\pgfpathlineto{\pgfpoint{0}{-0.2*\sseq@yaxisgap}} |
| 298 |
} |
| 299 |
\fi |
| 300 |
\pgfusepath{stroke} |
| 301 |
} |
| 302 |
|
| 303 |
|
| 304 |
\def\sseq@setupclip{ |
| 305 |
%\clip(\[email protected],\[email protected]) rectangle (\sseq@xmax+0.5,\sseq@ymax+0.5);% |
| 306 |
\ifsseq@clip |
| 307 |
\ifx\sseq@customclip\pgfutil@empty |
| 308 |
\bgroup |
| 309 |
\def\xmin{\pgftransformshift{\pgfqpoint{\sseq@leftclippadding}{0pt}}} |
| 310 |
\def\ymin{\pgftransformshift{\pgfqpoint{0pt}{\sseq@bottomclippadding}}} |
| 311 |
\def\xmax{\pgftransformshift{\pgfqpoint{\sseq@rightclippadding}{0pt}}} |
| 312 |
\def\ymax{\pgftransformshift{\pgfqpoint{0pt}{\sseq@topclippadding}}} |
| 313 |
\bgroup |
| 314 |
\xmin\ymin |
| 315 |
\pgfpathmoveto{\pgfqpointxy{\numexpr\sseq@xmin+\sseq@xoffset\relax}{\numexpr\sseq@ymin+\sseq@yoffset\relax}} |
| 316 |
\egroup |
| 317 |
\bgroup |
| 318 |
\xmin\ymax |
| 319 |
\pgfpathlineto{\pgfqpointxy{\numexpr\sseq@xmin+\sseq@xoffset\relax}{\numexpr\sseq@ymax+\sseq@yoffset\relax}} |
| 320 |
\egroup |
| 321 |
\bgroup |
| 322 |
\xmax\ymax |
| 323 |
\pgfpathlineto{\pgfqpointxy{\numexpr\sseq@xmax+\sseq@xoffset\relax}{\numexpr\sseq@ymax+\sseq@yoffset\relax}} |
| 324 |
\egroup |
| 325 |
\bgroup |
| 326 |
\xmax\ymin |
| 327 |
\pgfpathlineto{\pgfqpointxy{\numexpr\sseq@xmax+\sseq@xoffset\relax}{\numexpr\sseq@ymin+\sseq@yoffset\relax}} |
| 328 |
\egroup |
| 329 |
\egroup |
| 330 |
\pgfpathclose |
| 331 |
\pgfgetpath\sseq@theclippath % This stores the clipping so I can apply it later |
| 332 |
\pgfusepath{discard}% This has to be after the egroup or else the clipping gets screwed up |
| 333 |
% |
| 334 |
\bgroup |
| 335 |
\pgfpathmoveto{\pgfqpointxy{\numexpr\sseq@xmin+\sseq@xoffset\relax}{\numexpr\sseq@ymin+\sseq@yoffset\relax}} |
| 336 |
\pgfpathlineto{\pgfqpointxy{\numexpr\sseq@xmin+\sseq@xoffset\relax}{\numexpr\sseq@ymax+\sseq@yoffset\relax}} |
| 337 |
\pgfpathlineto{\pgfqpointxy{\numexpr\sseq@xmax+\sseq@xoffset\relax}{\numexpr\sseq@ymax+\sseq@yoffset\relax}} |
| 338 |
\pgfpathlineto{\pgfqpointxy{\numexpr\sseq@xmax+\sseq@xoffset\relax}{\numexpr\sseq@ymin+\sseq@yoffset\relax}} |
| 339 |
\pgfpathclose |
| 340 |
\egroup |
| 341 |
\pgfgetpath\sseq@therangepath % Only for deciding whether to draw "tricky edges" |
| 342 |
\pgfusepath{discard} |
| 343 |
\else |
| 344 |
\def\sseq@temp{\path[name path=temp]} |
| 345 |
\@xptwo\sseq@temp\@xp\@gobble\sseq@customclip |
| 346 |
\pgfgetpath\sseq@theclippath |
| 347 |
\let\sseq@theclippath\tikz@intersect@path@name@temp |
| 348 |
\fi |
| 349 |
\else |
| 350 |
\let\sseq@theclippath\relax |
| 351 |
\fi |
| 352 |
} |
| 353 |
\def\sseq@useclip{\ifx\sseq@theclippath\relax\else\pgfsetpath\sseq@theclippath\pgfusepath{clip}\fi} |
| 354 |
|
| 355 |
|
| 356 |
% sets \pgf@xa and \pgf@ya equal to the coordinates of (1,1), sets \pgf@xb and \pgf@xb equal to (x grid step, y grid step) |
| 357 |
\def\sseq@grid@setstepandgridstep{ |
| 358 |
\pgf@process{\pgfqpointxy{1}{1}} |
| 359 |
\pgf@xa=\pgf@x |
| 360 |
\pgf@ya=\pgf@y |
| 361 |
\pgf@process{\pgfqpointxy{\sseq@xgridstep}{\sseq@ygridstep}} |
| 362 |
\pgf@xb=\pgf@x |
| 363 |
\pgf@yb=\pgf@y |
| 364 |
} |
| 365 |
|
| 366 |
% #1 -- macro to store result in |
| 367 |
% #2 -- "x" or "y" as appropriate |
| 368 |
% #3 -- length (with units) |
| 369 |
% #4 -- fraction of gridstep |
| 370 |
% If #2 is x, then it either sets #1 to #3/(x scale) or xgridstep*#4, whichever is smaller |
| 371 |
% The output is intended for use with \pgfpointxy. |
| 372 |
\def\sseq@grid@atmostgridstep#1#2#3#4{ |
| 373 |
\ifdim#3<\dimexpr\csname pgf@#2b\endcsname*#4\relax |
| 374 |
\pgfmathparse{#3/\csname pgf@#2a\endcsname} |
| 375 |
\let#1\pgfmathresult |
| 376 |
\else |
| 377 |
\edef#1{\csname sseq@#2gridstep\endcsname*#4} |
| 378 |
\fi |
| 379 |
} |
| 380 |
|
| 381 |
% This grid was a huge pain in the ass to get right... |
| 382 |
\def\sseq@grid@chess{ |
| 383 |
\bgroup |
| 384 |
\pgfscope |
| 385 |
% Because of complicated aliasing issues that arise when misusing the \pgfgrid command in this way, |
| 386 |
% it's more convenient to add a clip than to actually stop things in the right place. |
| 387 |
\clip (\[email protected],\[email protected]) |
| 388 |
rectangle (\sseq@xmax+0.49,\sseq@ymax+0.49); |
| 389 |
% \clip (\sseq@xmin,\sseq@ymin) ++ (-0.49, -0.49) |
| 390 |
% rectangle ([shift={(0.5cm*\sseq@yscale,0.5*\sseq@xscale)}] |
| 391 |
% \sseq@xmax,\sseq@ymax); |
| 392 |
% |
| 393 |
\sseq@useclip |
| 394 |
\pgfsetcolor{\sseq@gridcolor} |
| 395 |
\pgfsetstrokeopacity{0.3} % We don't set low opacity for the other grids, but this one is visible even if it is very faint. |
| 396 |
\sseq@grid@setstepandgridstep |
| 397 |
% |
| 398 |
% Use ifdim with cm to compare real scalars b/c tex is dumb. |
| 399 |
% okay, now we need to be careful in order to avoid overflows. The hack we are using requires that the xvec and the yvec are equal |
| 400 |
% because we can't apply these via lowlevelsynccm. However, xvec and yvec are the things that prevent overflows. |
| 401 |
% What we need to do is set them both equal to the smaller value. Now the scale factor determines the size of the squares, |
| 402 |
% so we mix in the grid steps. We also need to scale the larger scaled coordinate by the ratio of the two scales. |
| 403 |
\ifdim\sseq@xscale cm<\sseq@yscale cm\relax |
| 404 |
% x is smaller so set both x and y vecs to \sseq@xscale cm. |
| 405 |
\pgfsetxvec{\pgfpoint{\sseq@xscale cm}{0cm}} |
| 406 |
\pgfsetyvec{\pgfpoint{0cm}{\sseq@xscale cm}} |
| 407 |
\def\sseq@xadjustscale{\sseq@xgridstep} |
| 408 |
\def\sseq@yadjustscale{\sseq@yscale/\sseq@xscale*\sseq@ygridstep} |
| 409 |
\def\sseq@stepscale{\sseq@xscale} |
| 410 |
\else |
| 411 |
\pgfsetxvec{\pgfpoint{\sseq@yscale cm}{0cm}} |
| 412 |
\pgfsetyvec{\pgfpoint{0cm}{\sseq@yscale cm}} |
| 413 |
\def\sseq@xadjustscale{(\sseq@xscale/\sseq@yscale*\sseq@xgridstep)} |
| 414 |
\def\sseq@yadjustscale{\sseq@ygridstep} |
| 415 |
\def\sseq@stepscale{\sseq@yscale} |
| 416 |
\fi |
| 417 |
\pgftransformxscale{\sseq@xadjustscale} |
| 418 |
\pgftransformyscale{\sseq@yadjustscale} |
| 419 |
% Now we have to put in some ridiculously complicated shift in order to get the bottom corner in the right place. |
| 420 |
% I found this formula mostly by trial and error. |
| 421 |
% The basic idea that we should be making something divisible by twice the grid step (which is the actual period of our grid) |
| 422 |
% is reasonable enough, but what the heck are these other two terms for? I don't know either, thank god it works. |
| 423 |
\pgftransformshift{\pgfpointxy{ |
| 424 |
floor((\sseq@xgridstep-1)/2)/\sseq@xgridstep |
| 425 |
+ \ifodd\sseq@xgridstep\space 0 \else 0.5/\sseq@xgridstep\fi |
| 426 |
+ mod(1+\sseq@xmin/\sseq@xgridstep,2*\sseq@xgridstep) |
| 427 |
}{ |
| 428 |
floor((\sseq@ygridstep-1)/2)/\sseq@ygridstep |
| 429 |
+ \ifodd\sseq@ygridstep\space 0\else 0.5/\sseq@ygridstep\fi |
| 430 |
+ mod(1+\sseq@ymin/\sseq@ygridstep,2*\sseq@ygridstep) |
| 431 |
} |
| 432 |
} |
| 433 |
% We use lowlevelsynccm to make the scale adjust the line width. Normally scaling doesn't affect line width, text size, etc, which is sensible. |
| 434 |
% When you apply \pgflowlevelsynccm, pgf loses track of the coordinate matrix and it gets indiscriminately applied to everything. |
| 435 |
% This is good for us, because we're doing this absurd thing where we make a checkerboard by drawing a really really fat line. |
| 436 |
\pgflowlevelsynccm |
| 437 |
\pgfsetlinewidth{1cm*\sseq@stepscale} |
| 438 |
\pgfsetdash{{1cm*\sseq@stepscale}{1cm*\sseq@stepscale}}{1cm*\sseq@stepscale} |
| 439 |
% |
| 440 |
% Naturally some trial and error occurred here too. |
| 441 |
% Note the huge multiples of \sseq@xgridstep I added in -- they probably aren't necessary, but I don't understand what's going on so whatever. They make sure that the pattern always extends past the edge of the clipping region. Otherwise the gird occasionally stops short for some reason. |
| 442 |
% The basic idea is that things need to be divisible by twice the grid step. The part I added in the shift above |
| 443 |
% was the remainder when you divide \sseq@xmin by twice the grid step, now we need to add in the multiple of twice the grid step. |
| 444 |
% The -0.5 is ensuring that the checkerboard boundaries lie at half-integer coordinates (I think). |
| 445 |
\pgfpathgrid[stepx= 2cm*\sseq@stepscale,stepy=2cm*\sseq@stepscale] |
| 446 |
{ \pgfpointxy |
| 447 |
{ -0.5 + \sseq@intdivfloor{\numexpr\sseq@xmin - \sseq@xgridstep\relax}{2*\sseq@xgridstep}*2*\sseq@xgridstep + \sseq@xoffset -50*\sseq@xgridstep |
| 448 |
} |
| 449 |
{ -0.5 + \sseq@intdivfloor{\numexpr\sseq@ymin - \sseq@ygridstep\relax}{2*\sseq@ygridstep}*2*\sseq@ygridstep + \sseq@yoffset -50*\sseq@ygridstep |
| 450 |
} |
| 451 |
}{ \pgfpointxy |
| 452 |
{ \sseq@xmax + \sseq@xoffset + 50*\sseq@xgridstep } |
| 453 |
{ \sseq@ymax + \sseq@yoffset + 50*\sseq@ygridstep } |
| 454 |
} |
| 455 |
\pgfusepath{stroke} |
| 456 |
\endpgfscope |
| 457 |
\egroup |
| 458 |
} |
| 459 |
|
| 460 |
\def\sseq@grid@crossword{ |
| 461 |
\bgroup |
| 462 |
\pgfscope |
| 463 |
\sseq@useclip |
| 464 |
\pgfsetcolor{\sseq@gridcolor} |
| 465 |
\pgfsetlinewidth{\the\sseq@gridstrokethickness} |
| 466 |
\sseq@grid@setstepandgridstep |
| 467 |
% |
| 468 |
% We don't want the grid to end with an extra line, so extend it by one half the step distance or |
| 469 |
% \sseq@---gridpadding, whichever is shorter. |
| 470 |
\sseq@grid@atmostgridstep\sseq@xminpadding{x}{\sseq@leftgridpadding}{1/2} |
| 471 |
\sseq@grid@atmostgridstep\sseq@xmaxpadding{x}{\sseq@rightgridpadding}{1/2} |
| 472 |
\sseq@grid@atmostgridstep\sseq@yminpadding{y}{\sseq@bottomgridpadding}{1/2} |
| 473 |
\sseq@grid@atmostgridstep\sseq@ymaxpadding{y}{\sseq@topgridpadding}{1/2} |
| 474 |
% |
| 475 |
\pgftransformshift{\pgfpointxy{-\sseq@xgridstep/2}{-\sseq@ygridstep/2}} |
| 476 |
\pgfpathgrid[stepx=\pgf@xb,stepy=\pgf@yb] |
| 477 |
{ \pgfpointxy |
| 478 |
{ \sseq@xmin - \sseq@xminpadding + 0.01 + \sseq@xoffset + \sseq@xgridstep/2 } |
| 479 |
{ \sseq@ymin - \sseq@yminpadding + 0.01 + \sseq@yoffset + \sseq@ygridstep/2 } } |
| 480 |
{ \pgfpointxy |
| 481 |
{ \sseq@xmax + \sseq@xmaxpadding - 0.01 + \sseq@xoffset + \sseq@xgridstep/2 } |
| 482 |
{ \sseq@ymax + \sseq@ymaxpadding - 0.01 + \sseq@yoffset + \sseq@ygridstep/2 } } |
| 483 |
\pgfusepath{stroke} |
| 484 |
\endpgfscope |
| 485 |
\egroup |
| 486 |
} |
| 487 |
\def\sseq@grid@go{ |
| 488 |
\bgroup |
| 489 |
\pgfscope |
| 490 |
\sseq@useclip |
| 491 |
\pgfsetcolor{\sseq@gridcolor} |
| 492 |
\pgfsetlinewidth{\the\sseq@gridstrokethickness} |
| 493 |
\sseq@grid@setstepandgridstep |
| 494 |
% |
| 495 |
% We don't want the grid to end with an extra line, so extend it by one step distance or |
| 496 |
% \sseq@---gridpadding, whichever is shorter. |
| 497 |
\sseq@grid@atmostgridstep\sseq@xminpadding{x}{\sseq@leftgridpadding}{1} |
| 498 |
\sseq@grid@atmostgridstep\sseq@xmaxpadding{x}{\sseq@rightgridpadding}{1} |
| 499 |
\sseq@grid@atmostgridstep\sseq@yminpadding{y}{\sseq@bottomgridpadding}{1} |
| 500 |
\sseq@grid@atmostgridstep\sseq@ymaxpadding{y}{\sseq@topgridpadding}{1} |
| 501 |
% |
| 502 |
\pgfpathgrid[stepx=\pgf@xb,stepy=\pgf@yb] |
| 503 |
{ \pgfpointxy |
| 504 |
{ \sseq@xmin - \sseq@xminpadding + 0.01 + \sseq@xoffset } |
| 505 |
{ \sseq@ymin - \sseq@yminpadding + 0.01 + \sseq@yoffset } } |
| 506 |
{ \pgfpointxy |
| 507 |
{ \sseq@xmax + \sseq@xmaxpadding - 0.01 + \sseq@xoffset } |
| 508 |
{ \sseq@ymax + \sseq@ymaxpadding - 0.01 + \sseq@yoffset } |
| 509 |
} |
| 510 |
\pgfusepath{stroke} |
| 511 |
\endpgfscope |
| 512 |
\egroup |
| 513 |
} |
| 514 |
\def\sseq@grid@none{} |
| 515 |
\def\sseq@grid@dots{ |
| 516 |
\bgroup |
| 517 |
\pgfscope |
| 518 |
\pgfgettransform\sseq@savetransform |
| 519 |
\pgfgettransformentries{\sseq@a}{\sseq@b}{\sseq@c}{\sseq@d}{\sseq@u}{\sseq@v} |
| 520 |
\pgfsettransform\sseq@savetransform |
| 521 |
\sseq@useclip |
| 522 |
\pgftransformshift{\pgfqpoint{-1.5cm}{-0.5cm}} |
| 523 |
\pgfsetdash{{1pt}{\sseq@a*1cm-1pt}}{0.5cm+.5pt} |
| 524 |
\pgfsetlinewidth{1pt} |
| 525 |
\sseq@tempy=\sseq@ymin\relax |
| 526 |
\advance\sseq@tempy\m@ne |
| 527 |
\loop |
| 528 |
\advance\sseq@tempy\@ne |
| 529 |
\pgfpathmoveto{\pgfpointxy{\sseq@xmin + 0.5/\sseq@a}{\the\sseq@tempy}} |
| 530 |
\pgfpathlineto{\pgfpointxy{\sseq@xmax + 1.01 }{\the\sseq@tempy}} |
| 531 |
\ifnum\sseq@tempy<\sseq@ymax\repeat |
| 532 |
%\pgfpathgrid[stepx=1cm,stepy=1cm]{\pgfpoint{-0.5cm}{-0.5cm}}{\pgfpoint{\xmax cm-0.5cm}{\ymax cm-0.5cm}} |
| 533 |
\pgfusepath{stroke} |
| 534 |
\endpgfscope |
| 535 |
\egroup |
| 536 |
} |
| 537 |
%%% |
| 538 |
%%% Draw Classes |
| 539 |
%%% |
| 540 |
%%% Class offsets |
| 541 |
\SseqNewClassPattern{standard}{ |
| 542 |
(0,0); |
| 543 |
(-0.13,0)(0.13,0); |
| 544 |
(-0.2,0)(0,0)(0.2,0); |
| 545 |
(-0.13,-0.13)(0.13,-0.13)(-0.13,0.13)(0.13,0.13); |
| 546 |
(-0.16,-0.16)(0.16,-0.16)(-0.16,0.16)(0.16,0.16)(0,0); |
| 547 |
(-0.13,-0.2)(-0.13,0)(-0.13,0.2)(0.13,-0.2)(0.13,0)(0.13,0.2); |
| 548 |
} |
| 549 |
|
| 550 |
\sseqnewclasspattern{linear}{ |
| 551 |
(0,0); |
| 552 |
(-0.13,0)(0.13,0); |
| 553 |
(-0.2,0)(0,0)(0.2,0); |
| 554 |
(-0.3,0)(-0.1,0)(0.1,0)(0.3,0); |
| 555 |
(-0.4,0)(-0.2,0)(0,0)(0.2,0)(0.4,0); |
| 556 |
(-0.5,0)(-0.3,0)(-0.1,0)(0.1,0)(0.3,0)(0.5,0); |
| 557 |
} |
| 558 |
\def\sseq@offset#1#2{ |
| 559 |
\sseq@eval{\@nx\pgftransformshift{ |
| 560 |
\@nx\pgfqpointxy |
| 561 |
{ \csname sseq@\sseq@classpattern xoffset#1/#2\endcsname } |
| 562 |
{ \csname sseq@\sseq@classpattern yoffset#1/#2\endcsname } |
| 563 |
}} |
| 564 |
} |
| 565 |
|
| 566 |
\def\sseq@tooltip@wrapper#1#2{% |
| 567 |
\edef\temp{\detokenize\@xpthree{#2}}% |
| 568 |
\edef\temp{\@xp\sseqtooltip@replaceslashes\@xp{\temp}}% |
| 569 |
\sseq@eval{\@nx\pdftooltip{\unexpanded{#1}}{\temp}}% |
| 570 |
} |
| 571 |
\bgroup\lccode`\!=`\\\lowercase{\egroup |
| 572 |
\def\sseqtooltip@replaceslashes#1{\sseqtooltip@replaceslashes@#1!\sseq@nil} |
| 573 |
\def\sseqtooltip@replaceslashes@#1!#2{% |
| 574 |
#1% |
| 575 |
\ifx\sseq@nil#2\@xp\@gobble\else |
| 576 |
\@nx\@nx\@nx\textbackslash |
| 577 |
\@xp\sseqtooltip@replaceslashes@ |
| 578 |
\fi#2% |
| 579 |
} |
| 580 |
} |
| 581 |
|
| 582 |
|
| 583 |
% #1 -- "class." |
| 584 |
% (#2,#3,#4) -- the class name x,y,n |
| 585 |
% #5 -- generation |
| 586 |
\def\sseq@class@getparts#1(#2,#3,#4)[#5].{ |
| 587 |
\sseq@seterrorannotation@drawing{#1}{#2}{#3}{#4}{#5} |
| 588 |
\def\sseq@thisnodename{sseq{#2,#3,#4}} |
| 589 |
\def\sseq@thispos{(#2,#3)} |
| 590 |
\edef\sseq@thisposnodeindex{\sseq@obj{class.(#2,#3,#4).n}} |
| 591 |
\edef\sseq@thispostotalnodes{\sseq@obj{partcoord.(#2,#3).numnodes}} |
| 592 |
\def\sseq@thisclassnum{#5} |
| 593 |
\sseq@tempx=#2\relax |
| 594 |
\sseq@tempy=#3\relax |
| 595 |
} |
| 596 |
|
| 597 |
|
| 598 |
% #1 -- the name of the class object given as (x,y,n)[gen] |
| 599 |
% Mandatory fields: |
| 600 |
% partcoord.(x,y).numnodes |
| 601 |
% (x,y,n).num -- number of generations of this class |
| 602 |
% (x,y,n).n -- node n of numnodes (needed to allow node position to differ from creation order). |
| 603 |
% class.page -- the death page of the class |
| 604 |
% Optional fields: |
| 605 |
% class.options -- Options for this class. |
| 606 |
% class.nodetext -- The internal text of the node |
| 607 |
% class.nodetext.options -- options (color, font) to change the nodetext |
| 608 |
% class.labelnodes -- a list of external labels |
| 609 |
% class.name & class.showname -- If there is a name, use it as a label in some way |
| 610 |
% class.tooltip -- Make a tooltip. Fails if the user didn't load package with tooltip option |
| 611 |
% class.needstikz -- Use tikz to draw this node |
| 612 |
% Someday I should document this horrible mess of code here |
| 613 |
\newif\ifsseq@permanentcycle |
| 614 |
\newcount\sseq@totalclassesdrawn |
| 615 |
\AtEndDocument{\message{Total classes: \the\sseq@totalclassesdrawn}} |
| 616 |
\def\sseq@class@drawnode#1{% |
| 617 |
\global\advance\sseq@totalclassesdrawn\@ne |
| 618 |
\begingroup |
| 619 |
\sseq@class@getparts#1. |
| 620 |
% defines: |
| 621 |
% \sseq@thisnodename -- name we should give the pdfnode |
| 622 |
% \sseq@thispos -- (x,y) |
| 623 |
% \sseq@thispostotalnodes -- total number of nodes at (x,y) |
| 624 |
% \sseq@thisposnodeindex -- index of this node |
| 625 |
\sseq@needstikzfalse |
| 626 |
% Apply first pass styles? TODO: What is this for again? |
| 627 |
\sseq@options@firstpassmode |
| 628 |
\sseq@thesseqstyle |
| 629 |
\sseq@theclassstyle |
| 630 |
\ifnum\sseq@obj{#1.page}=\sseq@infinitycount |
| 631 |
\sseq@thepermanentcyclestyle |
| 632 |
\else |
| 633 |
\sseq@thetransientcyclestyle |
| 634 |
\ifsseq@thispage |
| 635 |
\sseq@thethispagecyclestyle |
| 636 |
\fi |
| 637 |
\fi |
| 638 |
\the\sseq@scope@toks |
| 639 |
\sseq@obj{#1.needstikz} |
| 640 |
% |
| 641 |
\sseq@outofrangetrue\relax % Mysterious that we need this \relax here... |
| 642 |
% If we are in range, we'll draw the node, if not we just mark the coordinate. |
| 643 |
\ifnum\sseq@tempx<\sseq@xmaxpp\relax\ifnum\sseq@tempx>\sseq@xminmm\relax\ifnum\sseq@tempy<\sseq@ymaxpp\relax\ifnum\sseq@tempy>\sseq@yminmm\relax |
| 644 |
\sseq@outofrangefalse |
| 645 |
\pgfscope |
| 646 |
% Finish options setup |
| 647 |
\let\tikz@options\pgfutil@empty |
| 648 |
\let\tikz@alias=\pgfutil@empty |
| 649 |
\def\pgfkeysdefaultpath{/sseqpages/class/}% |
| 650 |
\sseq@options@secondpassmode |
| 651 |
\sseq@thesseqstyle |
| 652 |
\sseq@theclassstyle |
| 653 |
\ifnum\sseq@obj{#1.page}=\sseq@infinitycount |
| 654 |
\sseq@permanentcycletrue % This is to communicate with family style code... |
| 655 |
\sseq@thepermanentcyclestyle |
| 656 |
\else |
| 657 |
\sseq@permanentcyclefalse |
| 658 |
\sseq@thetransientcyclestyle |
| 659 |
\ifsseq@thispage |
| 660 |
\sseq@thethispagecyclestyle |
| 661 |
\fi |
| 662 |
\fi |
| 663 |
\def\sseq@collections@featuretype{class} |
| 664 |
\the\sseq@scope@toks |
| 665 |
\sseq@obj{#1.options} |
| 666 |
% Set up node position coordinate transform |
| 667 |
\pgftransformshift{\pgfqpointxy{\numexpr\sseq@tempx +\sseq@xoffset-\sseq@x\relax}{\numexpr\sseq@tempy + \sseq@yoffset-\sseq@y\relax}} |
| 668 |
\iftikz@fullytransformed\pgfgettransform{\savetransform}\fi |
| 669 |
\pgftransformresetnontranslations |
| 670 |
\sseq@globalrotatetransform |
| 671 |
% Now the origin is at (x,y). Set up class placement offset. |
| 672 |
\sseq@classplacementtransform |
| 673 |
\sseq@obj@ifdef{#1.offset}{\sseq@obj{#1.offset}}{% |
| 674 |
\sseq@offset{\sseq@thisposnodeindex}{\sseq@thispostotalnodes}% |
| 675 |
}% |
| 676 |
\iftikz@fullytransformed\pgfsettransform{\savetransform}\else\pgftransformresetnontranslations\ifsseq@rotatelabels\sseq@globalrotatetransform\fi\fi |
| 677 |
% |
| 678 |
\tikz@options |
| 679 |
% the value of \sseq@class@showname comes from styles. If there was a local option with showname, it's stored in #1.showname. |
| 680 |
% local value takes priority. |
| 681 |
\let\sseq@classlabelnodes\pgfutil@empty |
| 682 |
\edef\sseq@classnodetextoptions{\sseq@obj@ifdef{#1.nodetext.options}{\@xptwo\@nx\sseq@obj{#1.nodetext.options}}{}} |
| 683 |
\edef\sseq@classnodetext{\sseq@obj@ifdef{#1.nodetext}{\@xptwo\@nx\sseq@obj{#1.nodetext}}{}} |
| 684 |
\sseq@obj@ifdef{#1.showname}{\sseq@lettoobj\sseq@class@showname{#1.showname}}{} |
| 685 |
\ifcsname sseq@class@showname\endcsname |
| 686 |
\sseq@obj@ifdef{#1.name}{ |
| 687 |
\sseq@eval{\@nx\sseq@handleclassquotes@inner{\sseq@obj{#1.name}}{\sseq@class@showname}} |
| 688 |
}{} |
| 689 |
\fi |
| 690 |
% Okay now we're ready to make the node |
| 691 |
\ifsseq@needstikz |
| 692 |
% The options code above put mode information into \tikz@mode which gets wiped by tikz |
| 693 |
\let\sseq@mode\tikz@mode |
| 694 |
\sseq@eval{% |
| 695 |
\@nx\node[% |
| 696 |
every text node part/.code/.expand once={\sseq@globalrotatetransform\sseq@classnodetextoptions{}},% |
| 697 |
/utils/exec={\let\@nx\tikz@mode\@nx\sseq@mode}] % Set mode based on outer options |
| 698 |
(\sseq@thisnodename) {\unexpanded\@xp{\sseq@classnodetext}};% |
| 699 |
}% |
| 700 |
\else |
| 701 |
\tikz@node@textfont |
| 702 |
\sseq@setnodetext{\sseq@classnodetext}{\sseq@classnodetextoptions}% |
| 703 |
\let\tikz@fig@name\sseq@thisnodename |
| 704 |
\pgfmultipartnode{\tikz@shape}{\tikz@anchor}{\tikz@fig@name}{\sseq@drawnode}% |
| 705 |
\tikz@alias % makes extra names for this shape |
| 706 |
\fi |
| 707 |
\sseq@obj{#1.labelnodes}% |
| 708 |
\sseq@classlabelnodes % classlabelnodes comes from show name (I guess it can't put them into #1.labelnodes? TODO: why?) |
| 709 |
\sseq@obj@ifdef{#1.tooltip}{\sseq@dotooltip{#1}}{}% |
| 710 |
\endpgfscope |
| 711 |
\fi\fi\fi\fi |
| 712 |
% If the node is out of range, to save time we don't draw anything. However, structlines etc may depend on the out of range node, |
| 713 |
% so we mark the coordinate. |
| 714 |
\ifsseq@outofrange |
| 715 |
\sseq@eval{\@nx\pgftransformshift{\@nx\pgfqpointxy{\numexpr\sseq@tempx+\sseq@xoffset-\sseq@x\relax}{\numexpr\sseq@tempy+\sseq@yoffset-\sseq@y\relax}}}% |
| 716 |
\pgftransformresetnontranslations |
| 717 |
\sseq@globalrotatetransform |
| 718 |
\sseq@classplacementtransform |
| 719 |
\sseq@offset{\sseq@thisposnodeindex}{\sseq@thispostotalnodes}% |
| 720 |
\pgfcoordinate{\sseq@thisnodename}{\pgfpointorigin}% |
| 721 |
\fi |
| 722 |
\endgroup |
| 723 |
} |
| 724 |
|
| 725 |
\def\sseq@dotooltip#1{% |
| 726 |
\pgfpointanchor{\sseq@thisnodename}{west}% |
| 727 |
\pgf@xa=\pgf@x |
| 728 |
\pgfpointanchor{\sseq@thisnodename}{south}% |
| 729 |
\pgf@ya=\pgf@y |
| 730 |
% |
| 731 |
\pgf@process{\pgfpointdiff{\pgfpointtransformed{\pgfpointanchor{\sseq@thisnodename}{west}}}{\pgfpointtransformed{\pgfpointanchor{\sseq@thisnodename}{east}}}}% |
| 732 |
\pgf@xb=\pgf@x |
| 733 |
\pgf@process{\pgfpointdiff{\pgfpointtransformed{\pgfpointanchor{\sseq@thisnodename}{south}}}{\pgfpointtransformed{\pgfpointanchor{\sseq@thisnodename}{north}}}}% |
| 734 |
\pgf@yb=\pgf@y |
| 735 |
% |
| 736 |
\setbox\tikz@tempbox=\hbox{% |
| 737 |
\pgfinterruptpicture |
| 738 |
\sseqtooltip{\rule{\pgf@xb}{0pt}\rule{0pt}{\pgf@yb}}{\sseq@obj{#1.tooltip}}% |
| 739 |
\endpgfinterruptpicture |
| 740 |
} |
| 741 |
{% |
| 742 |
\pgftransformshift{\pgfqpoint{\pgf@xa}{\pgf@ya}}% |
| 743 |
\pgfapproximatenonlineartransformation% |
| 744 |
\pgfqboxsynced{\tikz@tempbox}% |
| 745 |
}% |
| 746 |
} |
| 747 |
|
| 748 |
% #1 -- label text |
| 749 |
% #2 -- options |
| 750 |
% Make the node textbox. |
| 751 |
\def\sseq@setnodetext#1#2{% |
| 752 |
\sseq@ifempty{#1}{% more often than not, the node is empty... |
| 753 |
\setbox\pgfnodeparttextbox=\hbox{}% |
| 754 |
}{% |
| 755 |
\setbox\pgfnodeparttextbox=\hbox{% |
| 756 |
\pgfscope% |
| 757 |
#2 |
| 758 |
\tikzset{every text node part/.try}% |
| 759 |
\ifx\tikz@textopacity\pgfutil@empty% |
| 760 |
\else% |
| 761 |
\pgfsetfillopacity{\tikz@textopacity}% |
| 762 |
\pgfsetstrokeopacity{\tikz@textopacity}% |
| 763 |
\fi% |
| 764 |
\pgfinterruptpicture |
| 765 |
\ifx\tikz@text@width\pgfutil@empty% |
| 766 |
\tikz@textfont% |
| 767 |
\else% |
| 768 |
\begingroup% |
| 769 |
\pgfmathsetlength{\pgf@x}{\tikz@text@width}% |
| 770 |
\pgfutil@minipage[t]{\pgf@x}\leavevmode\hbox{}% |
| 771 |
\tikz@textfont% |
| 772 |
\tikz@text@action% |
| 773 |
\fi% |
| 774 |
\ifx\tikz@textcolor\pgfutil@empty% |
| 775 |
\else% |
| 776 |
\pgfutil@colorlet{.}{\tikz@textcolor}% |
| 777 |
\fi% |
| 778 |
\pgfsetcolor{.}% |
| 779 |
\tikz@atbegin@node% |
| 780 |
#1% |
| 781 |
\tikz@atend@node% |
| 782 |
\ifx\tikz@text@width\pgfutil@empty% |
| 783 |
\else% |
| 784 |
\pgfutil@endminipage% |
| 785 |
\endgroup% |
| 786 |
\fi% |
| 787 |
\endpgfinterruptpicture |
| 788 |
\endpgfscope% |
| 789 |
}% |
| 790 |
\ifx\tikz@text@width\pgfutil@empty% |
| 791 |
\else% |
| 792 |
\pgfmathsetlength{\pgf@x}{\tikz@text@width}% |
| 793 |
\wd\pgfnodeparttextbox=\pgf@x% |
| 794 |
\fi% |
| 795 |
\ifx\tikz@text@height\pgfutil@empty% |
| 796 |
\else% |
| 797 |
\pgfmathsetlength{\pgf@x}{\tikz@text@height}% |
| 798 |
\ht\pgfnodeparttextbox=\pgf@x% |
| 799 |
\fi% |
| 800 |
\ifx\tikz@text@depth\pgfutil@empty% |
| 801 |
\else% |
| 802 |
\pgfmathsetlength{\pgf@x}{\tikz@text@depth}% |
| 803 |
\dp\pgfnodeparttextbox=\pgf@x% |
| 804 |
\fi% |
| 805 |
} |
| 806 |
} |
| 807 |
|
| 808 |
% A small part of the tikz main loop that has been paired down as much as possible for efficiency. |
| 809 |
\def\sseq@drawnode{% |
| 810 |
\pgfutil@tempdima=\pgflinewidth% |
| 811 |
{% |
| 812 |
\tikz@mode% |
| 813 |
\iftikz@mode@draw% |
| 814 |
\iftikz@mode@double% |
| 815 |
% Change line width |
| 816 |
\begingroup% |
| 817 |
\pgfsys@beginscope% |
| 818 |
\tikz@double@setup% |
| 819 |
\fi% |
| 820 |
\fi% |
| 821 |
% |
| 822 |
% Step 10: Do stroke/fill as needed |
| 823 |
% |
| 824 |
\sseq@eval{\noexpand\pgfusepath{% |
| 825 |
\iftikz@mode@fill fill,\fi% |
| 826 |
\iftikz@mode@draw draw,\fi% |
| 827 |
}}% |
| 828 |
% |
| 829 |
% Step 11: Double stroke, if necessary |
| 830 |
% |
| 831 |
\iftikz@mode@draw% |
| 832 |
\iftikz@mode@double% |
| 833 |
\pgfsys@endscope% |
| 834 |
\endgroup% |
| 835 |
\fi% |
| 836 |
\fi |
| 837 |
}% |
| 838 |
\global\pgflinewidth=\pgfutil@tempdima% |
| 839 |
} |
| 840 |
|
| 841 |
%%% Labels |
| 842 |
|
| 843 |
% #1 -- label text |
| 844 |
% #2 -- options |
| 845 |
\def\sseq@drawlabel#1#2{% |
| 846 |
\bgroup\pgfscope |
| 847 |
\def\tikz@mode{}% |
| 848 |
\let\sseq@tikz@transform@save\tikz@transform |
| 849 |
\pgfkeyssetvalue{/pgf/inner xsep}{2pt}% |
| 850 |
\pgfkeyssetvalue{/pgf/inner ysep}{2pt}% |
| 851 |
\def\tikz@shape{rectangle} |
| 852 |
\let\tikz@transform\empty % The next line was set up to fix the classlabelstyle glitch (what does this mean?) |
| 853 |
\sseq@options@secondpassmode |
| 854 |
\sseq@thesseqstyle\sseq@thelabelstyle\sseq@theclasslabelstyle#2 |
| 855 |
\tikz@options |
| 856 |
\pgftransformreset |
| 857 |
\pgftransformshift{\tikz@node@at}% |
| 858 |
\tikz@lib@pos@call |
| 859 |
\tikz@transform |
| 860 |
\tikz@mode |
| 861 |
\let\tikz@transform\sseq@tikz@transform@save |
| 862 |
\sseq@setnodetext{\sseq@labeltextfn{#1}}{}% |
| 863 |
\pgfmultipartnode{\tikz@shape}{\tikz@anchor}{label}{\sseq@drawnode}% |
| 864 |
\ifsseq@pin |
| 865 |
\def\sseq@pinoptions{}% |
| 866 |
\let\tikz@options\empty |
| 867 |
\let\tikz@mode\empty |
| 868 |
\sseq@thepinstyle |
| 869 |
#2 |
| 870 |
\sseq@pinoptions |
| 871 |
\tikz@options |
| 872 |
\tikz@mode |
| 873 |
\sseq@drawedge@findsourcetarget{\tikz@fig@name}{}{label}{}% |
| 874 |
\pgfpathmoveto{\sseq@sourcecoord}% |
| 875 |
\pgfpathlineto{\sseq@targetcoord}% |
| 876 |
\sseq@eval{\noexpand\pgfusepath{% |
| 877 |
draw, |
| 878 |
\iftikz@mode@fill fill,\fi |
| 879 |
\iftikz@mode@draw draw,\fi |
| 880 |
}}% |
| 881 |
\fi |
| 882 |
\endpgfscope\egroup |
| 883 |
} |
| 884 |
|
| 885 |
|
| 886 |
%%% |
| 887 |
%%% Drawing edges |
| 888 |
%%% |
| 889 |
\def\sseq@ifinrange(#1){\sseq@ifinrange@#1,\sseq@nil} |
| 890 |
\def\sseq@ifinrange@#1,#2,#3\sseq@nil{% |
| 891 |
\sseq@tempx=#1\relax\sseq@tempy=#2\relax |
| 892 |
\sseq@outofrangetrue |
| 893 |
\ifnum\sseq@tempx<\sseq@xmaxpp\relax\ifnum\sseq@tempx>\sseq@xminmm\relax\ifnum\sseq@tempy<\sseq@ymaxpp\relax\ifnum\sseq@tempy>\sseq@yminmm\relax |
| 894 |
\sseq@outofrangefalse |
| 895 |
\fi\fi\fi\fi |
| 896 |
\ifsseq@outofrange |
| 897 |
\@xp\pgfutil@secondoftwo |
| 898 |
\else |
| 899 |
\@xp\pgfutil@firstoftwo |
| 900 |
\fi |
| 901 |
} |
| 902 |
|
| 903 |
% #1 -- source node |
| 904 |
% #2 -- source anchor |
| 905 |
% #3 -- target node |
| 906 |
% #4 -- target anchor |
| 907 |
% Calculate actual start and end of the edge (node borders), return the results stored in \sseq@sourcecoord, \sseq@targetcoord |
| 908 |
\def\sseq@drawedge@findsourcetarget#1#2#3#4{ |
| 909 |
\edef\sseq@edgesourceanchor{#2} |
| 910 |
\edef\sseq@edgetargetanchor{#4} |
| 911 |
\let\tempaf\pgfutil@empty |
| 912 |
\ifx\sseq@edgesourceanchor\pgfutil@empty % Check that the source doesn't have a specified anchor |
| 913 |
\def\tempa{\pgfpointanchor{#1}{center}}% if so, start by taking the center of that coordinate |
| 914 |
\else |
| 915 |
\edef\tempa{\@nx\pgfpointanchor{#1}{\sseq@edgesourceanchor}} % If it has an anchor, use that |
| 916 |
\let\tempaf\tempa |
| 917 |
\fi |
| 918 |
\ifx\sseq@edgetargetanchor\pgfutil@empty % check that the target doesn't have a specified anchor |
| 919 |
\def\tempb{\pgfpointshapeborder{#3}{\tempa}}% if so, our end point is the point on the boundary of node b that is in the direction of our initial start coordinate |
| 920 |
\else |
| 921 |
\edef\tempb{\@nx\pgfpointanchor{#3}{\sseq@edgetargetanchor}}% If it has a specified anchor, use that |
| 922 |
\fi |
| 923 |
\let\tempbf\tempb |
| 924 |
\ifx\tempaf\pgfutil@empty% |
| 925 |
\def\tempaf{\pgfpointshapeborder{#1}{\tempb}}% |
| 926 |
\fi |
| 927 |
\let\sseq@sourcecoord\tempaf |
| 928 |
\let\sseq@targetcoord\tempbf |
| 929 |
} |
| 930 |
|
| 931 |
\def\sseq@fullcoord@to@partialcoord(#1){\sseq@fullcoord@to@partialcoord@#1,\@nil} |
| 932 |
\def\sseq@fullcoord@to@partialcoord@#1,#2,#3\@nil{{#1cm}{#2cm}} |
| 933 |
% #1 -- source (full) |
| 934 |
% #2 -- target (full) |
| 935 |
% #3 -- which type of edge ("differential", "structline", or "extension") |
| 936 |
% #4 -- options |
| 937 |
\def\sseq@drawedge(#1)(#2)#3#4{% |
| 938 |
\begingroup\pgfscope |
| 939 |
% If either class is part of a family we aren't drawing, don't draw the edge either. |
| 940 |
\expandafter\ifx\csname pgf@sh@pi@sseq{#1}\endcsname\pgfpictureid\else |
| 941 |
\@xp\sseq@break |
| 942 |
\fi |
| 943 |
\expandafter\ifx\csname pgf@sh@pi@sseq{#2}\endcsname\pgfpictureid\else |
| 944 |
\@xp\sseq@break |
| 945 |
\fi |
| 946 |
\def\sseq@edgetype{#3} |
| 947 |
\let\sseq@collections@featuretype\sseq@edgetype |
| 948 |
\let\sseq@edgesourceanchor\pgfutil@empty |
| 949 |
\let\sseq@edgetargetanchor\pgfutil@empty |
| 950 |
% |
| 951 |
\sseq@needstikzfalse |
| 952 |
\def\pgfkeysdefaultpath{/sseqpages/#3/}% |
| 953 |
\sseq@options@bothpassmode |
| 954 |
\sseq@thesseqstyle |
| 955 |
\sseq@theedgestyle\csname sseq@the#3style\endcsname |
| 956 |
\ifsseq@thispage |
| 957 |
\csname sseq@thethispage#3style\endcsname |
| 958 |
\fi |
| 959 |
\the\sseq@scope@toks |
| 960 |
#4% |
| 961 |
\csname sseq@collections@#3@hook\endcsname |
| 962 |
\pgftransformshift{\pgfqpointxy{-\the\sseq@x}{-\the\sseq@y}}% |
| 963 |
\ifsseq@needstikz |
| 964 |
\pgfnodealias{tempa}{sseq{#1}} |
| 965 |
\pgfnodealias{tempb}{sseq{#2}} |
| 966 |
\def\sseq@sourcecoord{\pgfpointanchor{sseq{#1}}{center}} |
| 967 |
\def\sseq@targetcoord{\pgfpointanchor{sseq{#2}}{center}} |
| 968 |
\else |
| 969 |
% puts results into \sseq@sourcecoord and \sseq@targetcoord |
| 970 |
\sseq@drawedge@findsourcetarget{sseq{#1}}{\sseq@edgesourceanchor}{sseq{#2}}{\sseq@edgetargetanchor} |
| 971 |
\pgfcoordinate{tempa}{\sseq@sourcecoord}% |
| 972 |
\pgfcoordinate{tempb}{\sseq@targetcoord}% |
| 973 |
\fi |
| 974 |
|
| 975 |
% |
| 976 |
\tikz@options |
| 977 |
\tikz@mode |
| 978 |
\def\temparrowstartspec{}% |
| 979 |
\def\temparrowendspec{}% |
| 980 |
\pgftransformreset |
| 981 |
\sseq@outofrangefalse |
| 982 |
\sseq@ifinrange(#1){}{ |
| 983 |
\edef\temparrowstartspec{\@nx\pgfsetarrowsstart{\csname sseq@runoffarrow@start@#3@spec\endcsname}} |
| 984 |
\sseq@outofrangetrue |
| 985 |
}% |
| 986 |
\sseq@ifinrange(#2){}{ |
| 987 |
\edef\temparrowendspec{\@nx\pgfsetarrowsend{\csname sseq@runoffarrow@end@#3@spec\endcsname}} |
| 988 |
\sseq@outofrangetrue |
| 989 |
} |
| 990 |
\ifsseq@outofrange |
| 991 |
\sseq@handleoffpageedge{#1}{#2}% |
| 992 |
\fi |
| 993 |
\ifsseq@drawedge |
| 994 |
% TODO: should some sort of transformation manipulation be here? Maybe allow user to specify preference? |
| 995 |
% Don't draw dots on very short segments |
| 996 |
\pgfpointdiff{\sseq@targetcoord}{\sseq@sourcecoord} |
| 997 |
\pgfmathveclen{\pgf@x}{\pgf@y}% |
| 998 |
\@xp\pgfmathint\@xp{\pgfmathresult}% |
| 999 |
\ifnum\pgfmathresult<10\relax%%17? % TODO: Fix this predicate |
| 1000 |
\tikzset{every text node part/.append code={\pgfsetcolor{white}}}% I wonder why this is here... |
| 1001 |
\ifx\temparrowstartspec\pgfutil@empty |
| 1002 |
\else |
| 1003 |
\def\temparrowstartspec{\pgfsetarrowsstart{}}% |
| 1004 |
\fi |
| 1005 |
\ifx\temparrowendspec\pgfutil@empty |
| 1006 |
\else |
| 1007 |
\def\temparrowendspec{\pgfsetarrowsend{}}% |
| 1008 |
\fi |
| 1009 |
\fi |
| 1010 |
\ifsseq@needstikz |
| 1011 |
\draw[/sseqpages,% |
| 1012 |
/utils/exec={% |
| 1013 |
\sseq@thesseqstyle\sseq@theedgestyle |
| 1014 |
\csname sseq@the#3style\endcsname |
| 1015 |
\ifsseq@thispage |
| 1016 |
\csname sseq@thethispage#3style\endcsname |
| 1017 |
\fi |
| 1018 |
\the\sseq@scope@toks |
| 1019 |
\temparrowstartspec\temparrowendspec #4% |
| 1020 |
}% |
| 1021 |
] (tempa) to (tempb);% |
| 1022 |
\else |
| 1023 |
\temparrowstartspec |
| 1024 |
\temparrowendspec |
| 1025 |
\pgfpathmoveto{\pgfpointanchor{tempa}{center}}% |
| 1026 |
\pgfpathlineto{\pgfpointanchor{tempb}{center}}% |
| 1027 |
\sseq@eval{\noexpand\pgfusepath{% |
| 1028 |
\iftikz@mode@fill fill,\fi |
| 1029 |
\iftikz@mode@draw draw,\fi |
| 1030 |
}}% |
| 1031 |
\fi |
| 1032 |
\fi |
| 1033 |
\sseq@breakpoint |
| 1034 |
\endpgfscope\endgroup |
| 1035 |
} |
| 1036 |
|
| 1037 |
% TODO: this macro is super expensive. Make it faster |
| 1038 |
\def\sseq@handleoffpageedge#1#2{ |
| 1039 |
\pgfpathmoveto{\sseq@sourcecoord}% |
| 1040 |
\pgfpathlineto{\sseq@targetcoord}% |
| 1041 |
\pgfgetpath\thispath |
| 1042 |
\pgfusepath{discard}% |
| 1043 |
\pgfintersectionsortbysecondpath |
| 1044 |
\pgfintersectionofpaths{\pgfsetpath\sseq@theclippath}{\pgfsetpath\thispath}% |
| 1045 |
\ifcase\pgfintersectionsolutions\relax |
| 1046 |
% No intersections, but one or both endpoints may be out of range but still in clipping region due to scaling. Add ellipses as appropriate. |
| 1047 |
\sseq@ifinrange(#1){% If the first endpoint is in range, the second must be out of range b/c sseq@outofrange is true. |
| 1048 |
%\edef\temparrowendspec{\@nx\pgfsetarrowsend{\csname sseq@runoffarrow@end@#3@spec\endcsname}} |
| 1049 |
}{% |
| 1050 |
\sseq@ifinrange(#2){}{\sseq@drawedge@handletrickyedge}% uh-oh, both ends are out of range |
| 1051 |
}% |
| 1052 |
\or |
| 1053 |
\sseq@ifinrange(#1){% If the startpoint is in range, the intersection must be the end. |
| 1054 |
\def\sseq@targetcoord{\pgfpointintersectionsolution{1}} |
| 1055 |
\pgfcoordinate{tempb}{\sseq@targetcoord} |
| 1056 |
}{% |
| 1057 |
\sseq@ifinrange(#2){% If the startpoint is out of range and the endpoint is in range, the intersection must be the start |
| 1058 |
\def\sseq@sourcecoord{\pgfpointintersectionsolution{1}}% |
| 1059 |
\pgfcoordinate{tempa}{\sseq@sourcecoord}% |
| 1060 |
}{\sseq@drawedge@handletrickyedge}% Uh-oh, both ends are out of range. |
| 1061 |
} |
| 1062 |
\or% an orphan |
| 1063 |
\ifsseq@draworphanedges |
| 1064 |
\sseq@drawedge@handleorphan |
| 1065 |
\else |
| 1066 |
\sseq@drawedgefalse % Don't draw "orphaned edges" |
| 1067 |
\fi |
| 1068 |
\else |
| 1069 |
\sseq@error{clip-not-convex}% |
| 1070 |
\sseq@breakfifi |
| 1071 |
\fi |
| 1072 |
} |
| 1073 |
|
| 1074 |
\def\sseq@drawedge@handletrickyedge{% |
| 1075 |
\ifsseq@draworphanedges |
| 1076 |
\pgfintersectionsortbysecondpath |
| 1077 |
\pgfintersectionofpaths{\pgfsetpath\sseq@therangepath}{\pgfsetpath\thispath}% |
| 1078 |
\ifnum\pgfintersectionsolutions=\z@ |
| 1079 |
\sseq@drawedgefalse % don't draw orphan edges that never intersect actual range |
| 1080 |
\else% Now we have to make a line through tempa and tempb long enough so that it intersects the original clip area twice. |
| 1081 |
\pgfmathanglebetweenpoints{\pgfpointanchor{tempa}{center}}{\pgfpointanchor{tempb}{center}}% |
| 1082 |
\edef\tempangle{\pgfmathresult} |
| 1083 |
\pgfpathmoveto{\pgfpointadd{\pgfpointanchor{tempa}{center}}{\pgfpointpolar{\tempangle}{100cm}}}% a really long line |
| 1084 |
\pgfpathlineto{\pgfpointadd{\pgfpointanchor{tempa}{center}}{\pgfpointpolar{\tempangle}{-100cm}}}% |
| 1085 |
\pgfgetpath\thispath |
| 1086 |
\pgfusepath{discard} |
| 1087 |
\pgfintersectionofpaths{\pgfsetpath\sseq@theclippath}{\pgfsetpath\thispath} |
| 1088 |
\sseq@drawedge@handleorphan |
| 1089 |
\fi |
| 1090 |
\else |
| 1091 |
\sseq@drawedgefalse |
| 1092 |
\fi |
| 1093 |
} |
| 1094 |
|
| 1095 |
|
| 1096 |
\def\sseq@drawedge@handleorphan{% |
| 1097 |
\def\sseq@sourcecoord{\pgfpointintersectionsolution{2}}% |
| 1098 |
\def\sseq@targetcoord{\pgfpointintersectionsolution{1}}% |
| 1099 |
\edef\temparrowstartspec{\@nx\pgfsetarrowsstart{\csname sseq@runoffarrow@start@\sseq@edgetype @spec\endcsname}}% |
| 1100 |
\edef\temparrowendspec{\@nx\pgfsetarrowsend{\csname sseq@runoffarrow@end@\sseq@edgetype @spec\endcsname}}% |
| 1101 |
\pgfcoordinate{tempa}{\sseq@sourcecoord}% |
| 1102 |
\pgfcoordinate{tempb}{\sseq@targetcoord}% |
| 1103 |
} |
| 1104 |
|
| 1105 |
|
| 1106 |
% #1 -- uid |
| 1107 |
% #2 -- first coordinate |
| 1108 |
% #3 -- second coordinate |
| 1109 |
\def\sseq@circleclass@draw#1#2#3{ |
| 1110 |
\begingroup |
| 1111 |
% If either class is part of a family we aren't drawing, don't draw the fit either. |
| 1112 |
\expandafter\ifx\csname pgf@sh@pi@sseq{#2}\endcsname\pgfpictureid\else |
| 1113 |
\@xp\sseq@break |
| 1114 |
\fi |
| 1115 |
\expandafter\ifx\csname pgf@sh@pi@sseq{#3}\endcsname\pgfpictureid\else |
| 1116 |
\@xp\sseq@break |
| 1117 |
\fi |
| 1118 |
\pgfmathanglebetweenpoints{\pgfpointanchor{sseq{#2}}{center}}{\pgfpointanchor{sseq{#3}}{center}} |
| 1119 |
\let\tempangle\pgfmathresult |
| 1120 |
\let\tikz@lib@fit@scan@handle\sseq@fit@tikz@lib@fit@scan@handle % install fit modifications. |
| 1121 |
\let\tikz@calc@anchor\sseq@fit@tikz@calc@anchor |
| 1122 |
\sseq@tempiftrue |
| 1123 |
\sseq@options@secondpassmode |
| 1124 |
\node[ |
| 1125 |
rotate fit=\tempangle, |
| 1126 |
/utils/exec={\sseq@thesseqstyle\sseq@thecircleclassstyle\the\sseq@scope@toks\sseq@savedoptioncode |
| 1127 |
\sseq@obj{#1.options} |
| 1128 |
\sseq@obj{#1.fitnodes} |
| 1129 |
\@xp\pgfkeysalso\@xp{\romannumeral0\sseq@obj{#1.tikzprimoptions}} |
| 1130 |
} |
| 1131 |
] {}; |
| 1132 |
\sseq@breakpoint |
| 1133 |
\endgroup |
| 1134 |
} |
| 1135 |
% Modifies tikz commands \tikz@lib@fit@scan@handle from \pgf\frontendlayer\tikz\libraries\tikzlibraryfit.code.tex line 81 and |
| 1136 |
% \tikz@calc@anchor from \pgf\frontendlayer\tikz\tikz.code.tex line 5164 |
| 1137 |
% make it so that fit silently ignores nodes that are not defined. |
| 1138 |
% This is copied with modification from \pgf\frontendlayer\tikz\libraries\tikzlibraryfit.code.tex line 81 |
| 1139 |
\def\sseq@fit@tikz@lib@fit@scan@handle#1{% |
| 1140 |
\ifsseq@tempif % this has been set in the following macro to be true if there is a node with the given name. If it's not true, ignore this. |
| 1141 |
\iftikz@shapeborder% |
| 1142 |
% Ok, fit all four external anchors, if they exist |
| 1143 |
\tikz@lib@fit@adjust{\pgfpointanchor{\tikz@shapeborder@name}{west}}% |
| 1144 |
\tikz@lib@fit@adjust{\pgfpointanchor{\tikz@shapeborder@name}{east}}% |
| 1145 |
\tikz@lib@fit@adjust{\pgfpointanchor{\tikz@shapeborder@name}{north}}% |
| 1146 |
\tikz@lib@fit@adjust{\pgfpointanchor{\tikz@shapeborder@name}{south}}% |
| 1147 |
\else% |
| 1148 |
\tikz@lib@fit@adjust{#1}% |
| 1149 |
\fi% |
| 1150 |
\fi |
| 1151 |
\sseq@tempiftrue |
| 1152 |
\tikz@lib@fit@scan% |
| 1153 |
} |
| 1154 |
|
| 1155 |
%\def\tikz@calc@anchor#1.#2\tikz@stop{% |
| 1156 |
% \ifcsname pgf@sh@ns@\tikz@pp@name {#1}\endcsname |
| 1157 |
% \pgfpointanchor {\tikz@pp@name {#1}}{#2}% |
| 1158 |
% \else |
| 1159 |
% \pgfpointanchor {#1}{#2}% |
| 1160 |
% \fi |
| 1161 |
%} |
| 1162 |
%l.8 \show\tikz@calc@anchor |
| 1163 |
|
| 1164 |
% This is copied with modification from \pgf\frontendlayer\tikz\tikz.code.tex line 5164 |
| 1165 |
\def\sseq@fit@tikz@calc@anchor#1.#2\tikz@stop{% |
| 1166 |
\ifcsname pgf@sh@ns@\tikz@pp@name {#1}\endcsname |
| 1167 |
\pgfpointanchor {\tikz@pp@name {#1}}{#2}% |
| 1168 |
\else |
| 1169 |
\ifcsname pgf@sh@ns@#1\endcsname |
| 1170 |
\pgfpointanchor {#1}{#2}% |
| 1171 |
\else |
| 1172 |
\sseq@tempiffalse |
| 1173 |
\fi |
| 1174 |
\fi |
| 1175 |
} |
| 1176 |
%\def\sseq@fit@tikz@calc@anchor#1.#2\tikz@stop{% |
| 1177 |
% \pgfutil@ifundefined{pgf@sh@ns@#1}{\sseq@tempiffalse}{%If the node doesn't exist, don't throw an error but record that we should skip it |
| 1178 |
% \pgfpointanchor{\tikz@pp@name{#1}}{#2}% |
| 1179 |
% }%s |
| 1180 |
%} |
| 1181 |
|
| 1182 |
|
| 1183 |
|
| 1184 |
%% |
| 1185 |
%% Patch tikz coords |
| 1186 |
%% |
| 1187 |
|
| 1188 |
\def\sseq@patchtikzcoords{ |
| 1189 |
\let\sseq@tikz@scan@one@point@noshift\sseq@tikz@scan@one@point@noshift@active |
| 1190 |
\tikzoption{shift}{\sseq@tikzshift{##1}} |
| 1191 |
\let\tikz@@@parse@regular\sseq@tikz@@@parse@regular |
| 1192 |
\let\tikz@to@curve@path\sseq@tikz@to@curve@path |
| 1193 |
\let\tikz@@@to@compute@relative\sseq@tikz@@@to@compute@relative |
| 1194 |
|
| 1195 |
\let\tikz@grid\sseq@tikz@grid |
| 1196 |
\let\tikz@scan@handle@options\sseq@tikz@scan@handle@options |
| 1197 |
\let\tikz@@@parse@polar\sseq@tikz@@@parse@polar |
| 1198 |
\let\tikz@scan@relative\sseq@tikz@scan@relative |
| 1199 |
} |
| 1200 |
\newif\ifsseq@draw@addoffset % control whether to offset coordinates by (\sseq@xoffset,\sseq@yoffset). |
| 1201 |
\sseq@draw@addoffsettrue |
| 1202 |
|
| 1203 |
% Some of the stuff in tikzlibrarycalc will probably be broken, hopefully not too much |
| 1204 |
\let\sseq@tikz@scan@one@point@noshift\tikz@scan@one@point |
| 1205 |
\let\sseq@tikz@@@parse@regular@save\tikz@@@parse@regular |
| 1206 |
|
| 1207 |
\def\sseq@tikz@scan@relative#1+{% |
| 1208 |
\global\sseq@draw@addoffsetfalse |
| 1209 |
%\global\let\tikz@@@parse@regular\sseq@tikz@@@parse@regular@save |
| 1210 |
\pgfutil@ifnextchar+{% |
| 1211 |
\tikz@scan@plusplus{\global\sseq@draw@addoffsettrue#1}% |
| 1212 |
}{% |
| 1213 |
\tikz@scan@oneplus{\global\sseq@draw@addoffsettrue#1}% |
| 1214 |
}% |
| 1215 |
} |
| 1216 |
|
| 1217 |
\def\sseq@tikz@scan@one@point@noshift@active#1{% |
| 1218 |
\global\sseq@draw@addoffsetfalse |
| 1219 |
\def\sseq@scanonepoint@cmd{\global\sseq@draw@addoffsettrue#1} |
| 1220 |
\tikz@scan@one@point\sseq@scanonepoint@cmd% |
| 1221 |
} |
| 1222 |
|
| 1223 |
% Probably there are more places that shouldn't have shifts inserted. |
| 1224 |
\def\sseq@tikzshift#1{\tikz@addtransform{\sseq@tikz@scan@one@point@noshift\pgftransformshift#1\relax}} |
| 1225 |
|
| 1226 |
|
| 1227 |
\def\sseq@tikz@to@curve@path{% |
| 1228 |
[every curve to] |
| 1229 |
\pgfextra{ |
| 1230 |
%\sseq@draw@addoffsetfalse |
| 1231 |
\let\tikz@@@parse@regular\sseq@tikz@@@parse@regular@save % I added this to prevent repeated offsets from screwing us up |
| 1232 |
\let\sseq@tikz@scan@one@point@noshift\tikz@scan@one@point |
| 1233 |
\iftikz@to@relative\tikz@to@compute@relative\else\tikz@to@compute\fi |
| 1234 |
} |
| 1235 |
\tikz@computed@path |
| 1236 |
\tikztonodes% |
| 1237 |
} |
| 1238 |
|
| 1239 |
\let\sseq@tikz@@@to@compute@relative\tikz@@@to@compute@relative |
| 1240 |
|
| 1241 |
|
| 1242 |
\patchcmd\sseq@tikz@@@to@compute@relative{% |
| 1243 |
\let\tikz@second@point=\tikz@toto |
| 1244 |
}{% |
| 1245 |
\pgf@process{\pgfpointadd{\tikz@toto}{\pgfqpointxy{\sseq@xoffset}{\sseq@yoffset}}}% |
| 1246 |
\edef\tikz@toto{\@nx\pgfpoint{\the\pgf@x}{\the\pgf@y}}% |
| 1247 |
\let\tikz@second@point=\tikz@toto |
| 1248 |
}{}{\error} |
| 1249 |
|
| 1250 |
|
| 1251 |
|
| 1252 |
|
| 1253 |
% \tikz@parse@splitxyz: we should set up an error to make this unreachable? |
| 1254 |
\let\sseq@tikz@grid\tikz@grid % line 3158 |
| 1255 |
\let\sseq@tikz@scan@handle@options\tikz@scan@handle@options % 4959 |
| 1256 |
\let\sseq@tikz@@@parse@polar\tikz@@@parse@polar % 5063 |
| 1257 |
|
| 1258 |
\def\sseq@tikz@@@parse@regular#1#2#3){% |
| 1259 |
\pgfutil@in@,{#3}% |
| 1260 |
\ifpgfutil@in@% |
| 1261 |
\tikz@parse@splitxyz{#1}{#2}#3,% Perhaps put an error here? We probably don't handle 3d coords correctly. |
| 1262 |
\else% |
| 1263 |
\tikz@checkunit{#2}% |
| 1264 |
\iftikz@isdimension% |
| 1265 |
\def\temp@xcoord{(#2)/1cm}% |
| 1266 |
\else |
| 1267 |
\def\temp@xcoord{#2}% |
| 1268 |
\fi |
| 1269 |
\tikz@checkunit{#3}% |
| 1270 |
\iftikz@isdimension |
| 1271 |
\def\temp@ycoord{(#3)/1cm}% |
| 1272 |
\else |
| 1273 |
\def\temp@ycoord{#3}% |
| 1274 |
\fi |
| 1275 |
\ifsseq@draw@addoffset |
| 1276 |
\edef\temp@xcoord{\unexpanded\@xp{\temp@xcoord}+\unexpanded\@xp{\sseq@xoffset}}% |
| 1277 |
\edef\temp@ycoord{\unexpanded\@xp{\temp@ycoord}+\unexpanded\@xp{\sseq@yoffset}}% |
| 1278 |
\fi |
| 1279 |
\edef\@next{\unexpanded{#1}{\@nx\pgfpointxy{\unexpanded\@xp{\temp@xcoord}}{\unexpanded\@xp{\temp@ycoord}}}}% |
| 1280 |
\fi% |
| 1281 |
\@next% |
| 1282 |
} |
| 1283 |
|
| 1284 |
|
| 1285 |
|
| 1286 |
|
| 1287 |
%% New shapes and arrows |
| 1288 |
%% These use lots of keys with spaces so it's convenient to turn off ExplSyntax. |
| 1289 |
|
| 1290 |
% Stolen from: https://tex.stackexchange.com/a/24621 |
| 1291 |
\pgfqkeys{/pgf}{ |
| 1292 |
ellipse ratio/.code={\pgfkeyssetvalue{/pgf/ellipse ratio}{#1}}, |
| 1293 |
ellipse ratio/.initial=1 |
| 1294 |
} |
| 1295 |
\pgfdeclareshape{newellipse} |
| 1296 |
{ |
| 1297 |
\inheritsavedanchors[from=ellipse] |
| 1298 |
\inheritanchorborder[from=ellipse] |
| 1299 |
\savedanchor\radius{% |
| 1300 |
% |
| 1301 |
% Caculate ``height radius'' |
| 1302 |
% |
| 1303 |
\pgf@y=.5\ht\pgfnodeparttextbox% |
| 1304 |
\advance\pgf@y by.5\dp\pgfnodeparttextbox% |
| 1305 |
\pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/inner ysep}}% |
| 1306 |
\advance\pgf@y by\pgf@yb% |
| 1307 |
% |
| 1308 |
% Caculate ``width radius'' |
| 1309 |
% |
| 1310 |
\pgf@x=.5\wd\pgfnodeparttextbox% |
| 1311 |
\pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/inner xsep}}% |
| 1312 |
\advance\pgf@x by\pgf@xb% |
| 1313 |
% |
| 1314 |
% Adjust |
| 1315 |
% |
| 1316 |
\pgfkeysgetvalue{/pgf/ellipse ratio}{\ratioscale} |
| 1317 |
\pgfmathsetmacro\widthfactor{sqrt(\ratioscale^2+1)/\ratioscale} |
| 1318 |
\pgfmathsetmacro\heightfactor{sqrt(\ratioscale^2+1)} |
| 1319 |
\pgf@x=\widthfactor\pgf@x% |
| 1320 |
\pgf@y=\heightfactor\pgf@y% |
| 1321 |
% |
| 1322 |
% Adjust height, if necessary |
| 1323 |
% |
| 1324 |
\pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/minimum height}}% |
| 1325 |
\ifdim\pgf@y<.5\pgf@yc% |
| 1326 |
\pgf@y=.5\pgf@yc% |
| 1327 |
\fi% |
| 1328 |
% |
| 1329 |
% Adjust width, if necessary |
| 1330 |
% |
| 1331 |
\pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/minimum width}}% |
| 1332 |
\ifdim\pgf@x<.5\pgf@xc% |
| 1333 |
\pgf@x=.5\pgf@xc% |
| 1334 |
\fi% |
| 1335 |
% |
| 1336 |
% Add outer sep |
| 1337 |
% |
| 1338 |
\pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}% |
| 1339 |
\pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}% |
| 1340 |
\advance\pgf@x by\pgf@xb% |
| 1341 |
\advance\pgf@y by\pgf@yb% |
| 1342 |
} |
| 1343 |
|
| 1344 |
\inheritanchor[from=ellipse]{center} |
| 1345 |
\inheritanchor[from=ellipse]{mid} |
| 1346 |
\inheritanchor[from=ellipse]{base} |
| 1347 |
\inheritanchor[from=ellipse]{north} |
| 1348 |
\inheritanchor[from=ellipse]{south} |
| 1349 |
\inheritanchor[from=ellipse]{west} |
| 1350 |
\inheritanchor[from=ellipse]{mid west} |
| 1351 |
\inheritanchor[from=ellipse]{base west} |
| 1352 |
\inheritanchor[from=ellipse]{north west} |
| 1353 |
\inheritanchor[from=ellipse]{south west} |
| 1354 |
\inheritanchor[from=ellipse]{east} |
| 1355 |
\inheritanchor[from=ellipse]{mid east} |
| 1356 |
\inheritanchor[from=ellipse]{base east} |
| 1357 |
\inheritanchor[from=ellipse]{north east} |
| 1358 |
\inheritanchor[from=ellipse]{south east} |
| 1359 |
|
| 1360 |
\inheritbackgroundpath[from=ellipse] |
| 1361 |
} |
| 1362 |
|
| 1363 |
%% |
| 1364 |
%% |
| 1365 |
%% n concentric circles |
| 1366 |
%% |
| 1367 |
|
| 1368 |
\tikzset{circlen/.code={\def\circlen@n{#1}\pgfkeysalso{shape=circlen@shape}}} |
| 1369 |
\pgfdeclareshape{circlen@shape} |
| 1370 |
{ |
| 1371 |
\savedanchor\centerpoint{% |
| 1372 |
\pgf@x=.5\wd\pgfnodeparttextbox% |
| 1373 |
\pgf@y=.5\ht\pgfnodeparttextbox% |
| 1374 |
\advance\pgf@y by-.5\dp\pgfnodeparttextbox% |
| 1375 |
} |
| 1376 |
|
| 1377 |
\saveddimen\radius{% |
| 1378 |
% |
| 1379 |
% Caculate ``height radius'' |
| 1380 |
% |
| 1381 |
\pgf@ya=.5\ht\pgfnodeparttextbox% |
| 1382 |
\advance\pgf@ya by.5\dp\pgfnodeparttextbox% |
| 1383 |
\pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/inner ysep}}% |
| 1384 |
\advance\pgf@ya by\pgf@yb% |
| 1385 |
% |
| 1386 |
% Caculate ``width radius'' |
| 1387 |
% |
| 1388 |
\pgf@xa=.5\wd\pgfnodeparttextbox% |
| 1389 |
\pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/inner xsep}}% |
| 1390 |
\advance\pgf@xa by\pgf@xb% |
| 1391 |
% |
| 1392 |
% Calculate length of radius vector: |
| 1393 |
% |
| 1394 |
\pgf@process{\pgfpointnormalised{\pgfqpoint{\pgf@xa}{\pgf@ya}}}% |
| 1395 |
\ifdim\pgf@x>\pgf@y% |
| 1396 |
\c@pgf@counta=\pgf@x% |
| 1397 |
\ifnum\c@pgf@counta=\z@% |
| 1398 |
\else% |
| 1399 |
\divide\c@pgf@counta by 255\relax% |
| 1400 |
\pgf@xa=16\pgf@xa\relax% |
| 1401 |
\divide\pgf@xa by\c@pgf@counta% |
| 1402 |
\pgf@xa=16\pgf@xa\relax% |
| 1403 |
\fi% |
| 1404 |
\else% |
| 1405 |
\c@pgf@counta=\pgf@y% |
| 1406 |
\ifnum\c@pgf@counta=\z@% |
| 1407 |
\else% |
| 1408 |
\divide\c@pgf@counta by 255\relax% |
| 1409 |
\pgf@ya=16\pgf@ya\relax% |
| 1410 |
\divide\pgf@ya by\c@pgf@counta% |
| 1411 |
\pgf@xa=16\pgf@ya\relax% |
| 1412 |
\fi% |
| 1413 |
\fi% |
| 1414 |
\pgf@x=\pgf@xa% |
| 1415 |
% |
| 1416 |
% If necessary, adjust radius so that the size requirements are |
| 1417 |
% met: |
| 1418 |
% |
| 1419 |
\pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/minimum width}}% |
| 1420 |
\pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/minimum height}}% |
| 1421 |
\ifdim\pgf@x<.5\pgf@xb% |
| 1422 |
\pgf@x=.5\pgf@xb% |
| 1423 |
\fi% |
| 1424 |
\ifdim\pgf@x<.5\pgf@yb% |
| 1425 |
\pgf@x=.5\pgf@yb% |
| 1426 |
\fi% |
| 1427 |
% |
| 1428 |
% Now, add larger of outer sepearations. |
| 1429 |
% |
| 1430 |
\pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}% |
| 1431 |
\pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}% |
| 1432 |
\ifdim\pgf@xb<\pgf@yb% |
| 1433 |
\advance\pgf@x by\pgf@yb% |
| 1434 |
\else% |
| 1435 |
\advance\pgf@x by\pgf@xb% |
| 1436 |
\fi% |
| 1437 |
\pgf@xb=2pt |
| 1438 |
\multiply\pgf@xb\circlen@n |
| 1439 |
\advance\pgf@x\pgf@xb |
| 1440 |
\advance\pgf@x-2pt\relax |
| 1441 |
} |
| 1442 |
|
| 1443 |
% |
| 1444 |
% Anchors |
| 1445 |
% |
| 1446 |
\anchor{center}{\centerpoint} |
| 1447 |
\anchor{mid}{\centerpoint\pgfmathsetlength\pgf@y{.5ex}} |
| 1448 |
\anchor{base}{\centerpoint\pgf@y=0pt} |
| 1449 |
\anchor{north}{\centerpoint\advance\pgf@y by\radius} |
| 1450 |
\anchor{south}{\centerpoint\advance\pgf@y by-\radius} |
| 1451 |
\anchor{west}{\centerpoint\advance\pgf@x by-\radius} |
| 1452 |
\anchor{east}{\centerpoint\advance\pgf@x by\radius} |
| 1453 |
\anchor{mid west}{\centerpoint\advance\pgf@x by-\radius\pgfmathsetlength\pgf@y{.5ex}} |
| 1454 |
\anchor{mid east}{\centerpoint\advance\pgf@x by\radius\pgfmathsetlength\pgf@y{.5ex}} |
| 1455 |
\anchor{base west}{\centerpoint\advance\pgf@x by-\radius\pgf@y=0pt} |
| 1456 |
\anchor{base east}{\centerpoint\advance\pgf@x by\radius\pgf@y=0pt} |
| 1457 |
\anchor{north west}{ |
| 1458 |
\centerpoint |
| 1459 |
\pgf@xa=\radius |
| 1460 |
\advance\pgf@x by-0.707107\pgf@xa |
| 1461 |
\advance\pgf@y by0.707107\pgf@xa |
| 1462 |
} |
| 1463 |
\anchor{south west}{ |
| 1464 |
\centerpoint |
| 1465 |
\pgf@xa=\radius |
| 1466 |
\advance\pgf@x by-0.707107\pgf@xa |
| 1467 |
\advance\pgf@y by-0.707107\pgf@xa |
| 1468 |
} |
| 1469 |
\anchor{north east}{ |
| 1470 |
\centerpoint |
| 1471 |
\pgf@xa=\radius |
| 1472 |
\advance\pgf@x by0.707107\pgf@xa |
| 1473 |
\advance\pgf@y by0.707107\pgf@xa |
| 1474 |
} |
| 1475 |
\anchor{south east}{ |
| 1476 |
\centerpoint |
| 1477 |
\pgf@xa=\radius |
| 1478 |
\advance\pgf@x by0.707107\pgf@xa |
| 1479 |
\advance\pgf@y by-0.707107\pgf@xa |
| 1480 |
} |
| 1481 |
\anchorborder{ |
| 1482 |
\pgf@xa=\pgf@x% |
| 1483 |
\pgf@ya=\pgf@y% |
| 1484 |
\edef\pgf@marshal{% |
| 1485 |
\noexpand\pgfpointborderellipse |
| 1486 |
{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}} |
| 1487 |
{\noexpand\pgfqpoint{\radius}{\radius}}% |
| 1488 |
}% |
| 1489 |
\pgf@marshal% |
| 1490 |
\pgf@xa=\pgf@x% |
| 1491 |
\pgf@ya=\pgf@y% |
| 1492 |
\centerpoint% |
| 1493 |
\advance\pgf@x by\pgf@xa% |
| 1494 |
\advance\pgf@y by\pgf@ya% |
| 1495 |
} |
| 1496 |
|
| 1497 |
% |
| 1498 |
% Background path |
| 1499 |
% |
| 1500 |
\behindbackgroundpath{ |
| 1501 |
\pgfutil@tempdima=\radius% |
| 1502 |
\pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}% |
| 1503 |
\pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}% |
| 1504 |
\ifdim\pgf@xb<\pgf@yb% |
| 1505 |
\advance\pgfutil@tempdima by-\pgf@yb% |
| 1506 |
\else% |
| 1507 |
\advance\pgfutil@tempdima by-\pgf@xb% |
| 1508 |
\fi% |
| 1509 |
\sseq@tempcount=\@ne |
| 1510 |
\loop |
| 1511 |
\pgfpathcircle{\centerpoint}{\pgfutil@tempdima}% |
| 1512 |
\advance\pgfutil@tempdima-2pt\relax |
| 1513 |
\advance\sseq@tempcount\@ne |
| 1514 |
\ifnum\sseq@tempcount<\circlen@n \repeat |
| 1515 |
\tikz@mode |
| 1516 |
\sseq@eval{\noexpand\pgfusepath{ |
| 1517 |
\iftikz@mode@draw draw,\fi |
| 1518 |
}} |
| 1519 |
} |
| 1520 |
\backgroundpath{% |
| 1521 |
\pgfutil@tempdima=\radius% |
| 1522 |
\pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}% |
| 1523 |
\pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}% |
| 1524 |
\ifdim\pgf@xb<\pgf@yb% |
| 1525 |
\advance\pgfutil@tempdima by-\pgf@yb% |
| 1526 |
\else% |
| 1527 |
\advance\pgfutil@tempdima by-\pgf@xb% |
| 1528 |
\fi% |
| 1529 |
\advance\pgfutil@tempdima2pt\relax |
| 1530 |
\pgfutil@tempdimb=-2pt\relax |
| 1531 |
\multiply\pgfutil@tempdimb\circlen@n |
| 1532 |
\advance\pgfutil@tempdima\pgfutil@tempdimb\relax |
| 1533 |
\pgfpathcircle{\centerpoint}{\pgfutil@tempdima} |
| 1534 |
} |
| 1535 |
} |
| 1536 |
|
| 1537 |
|
| 1538 |
|
| 1539 |
% For out of bounds edges: |
| 1540 |
|
| 1541 |
\pgfdeclarearrow{ |
| 1542 |
name = ..., |
| 1543 |
parameters = { \the\pgfarrowlength\the\pgflinewidth}, |
| 1544 |
setup code = { |
| 1545 |
% The different end values: |
| 1546 |
\pgfarrowssetlineend{-\pgfarrowlength} |
| 1547 |
\pgfarrowssetbackend{-0.6\pgfarrowlength} |
| 1548 |
% The hull |
| 1549 |
\pgfarrowshullpoint{-\pgfarrowlength}{0pt} |
| 1550 |
\pgfarrowshullpoint{\pgfarrowlength}{0pt} |
| 1551 |
% Saves: Only the length: |
| 1552 |
\pgfarrowssavethe\pgfarrowlength |
| 1553 |
\pgfarrowssavethe\pgflinewidth |
| 1554 |
}, |
| 1555 |
drawing code = { |
| 1556 |
\pgfpathcircle{\pgfpoint{-0.7\pgfarrowlength}{0pt}}{1.5\pgflinewidth} |
| 1557 |
\pgfpathcircle{\pgfpoint{-0.4\pgfarrowlength}{0pt}}{1.5\pgflinewidth} |
| 1558 |
\pgfpathcircle{\pgfpoint{-0.1\pgfarrowlength}{0pt}}{1.5\pgflinewidth} |
| 1559 |
\pgfpathclose |
| 1560 |
\pgfusepathqfill |
| 1561 |
}, |
| 1562 |
defaults = { length = 0.3cm } |
| 1563 |
} |
| 1564 |
|