diff options
Diffstat (limited to 'macros/latex/contrib/wargame/source/util/core.dtx')
-rw-r--r-- | macros/latex/contrib/wargame/source/util/core.dtx | 99 |
1 files changed, 68 insertions, 31 deletions
diff --git a/macros/latex/contrib/wargame/source/util/core.dtx b/macros/latex/contrib/wargame/source/util/core.dtx index a3c656a2b3..506cb19ece 100644 --- a/macros/latex/contrib/wargame/source/util/core.dtx +++ b/macros/latex/contrib/wargame/source/util/core.dtx @@ -766,7 +766,7 @@ \chit@dbg{2}{chits to make images of `#2'}% \foreach[count=\ti from 0] \t/\x in #2{% \ifx\t\empty\else% Ignore empty rows - \message{^^JSubcategory: `\x' (default `#1')} + \chit@dbg{5}{^^JSubcategory: `\x' (default `#1')} \ifx\t\x\def\x{#1}\fi% Take sub-category or default \foreach \u/\m in \t{% \ifx\u\empty\else% Ignore empty cells @@ -812,7 +812,7 @@ \let\natoapp@report\do@natoapp@report% \foreach[count=\ti from 0] \t/\x in #2{% \ifx\t\empty\else% Ignore empty rows - \message{^^JSubcategory: `\x' (default `#1')} + \chit@dbg{5}{^^JSubcategory: `\x' (default `#1')} \ifx\t\x\def\x{#1}\fi% Take sub-category or default \foreach \u/\m in \t{% \ifx\u\empty\else% Ignore empty cells @@ -981,15 +981,37 @@ \pt@to@cm{#2}\edef\y{\pgfmathresult}} % \end{macrocode} % \begin{macrocode} +\def\mk@get@anchor#1#2{% + \pgfpointanchor{#1}{#2}% + \pgfgetlastxy\tmp@x\tmp@y% + \pt@to@cm{\tmp@x}\edef\tmp@x{\pgfmathresult} + \pt@to@cm{\tmp@y}\edef\tmp@y{\pgfmathresult} +} +\def\mk@get@global@anchor#1#2{% + \pgfpointanchor{#1}{#2}% + \pgfgetlastxy\tmp@x\tmp@y% + \pgfpointtransformed{\pgfpoint{\tmp@x}{\tmp@y}} + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pt@to@cm{\the\pgf@xa}\edef\tmp@x{\pgfmathresult} + \pt@to@cm{\the\pgf@ya}\edef\tmp@y{\pgfmathresult} +} \def\get@bb#1{% - \pgfpointanchor{#1}{south west}% - \pgfgetlastxy\tmp@llx\tmp@lly% - \pgfpointanchor{#1}{north east}% - \pgfgetlastxy\tmp@urx\tmp@ury% - \pt@to@cm{\tmp@llx}\edef\llx{\pgfmathresult} - \pt@to@cm{\tmp@lly}\edef\lly{\pgfmathresult} - \pt@to@cm{\tmp@urx}\edef\urx{\pgfmathresult} - \pt@to@cm{\tmp@ury}\edef\ury{\pgfmathresult}} + % \pgfpointanchor{#1}{south west}% + % \pgfgetlastxy\tmp@llx\tmp@lly% + % \pgfpointanchor{#1}{north east}% + % \pgfgetlastxy\tmp@urx\tmp@ury% + % \pt@to@cm{\tmp@llx}\edef\llx{\pgfmathresult} + % \pt@to@cm{\tmp@lly}\edef\lly{\pgfmathresult} + % \pt@to@cm{\tmp@urx}\edef\urx{\pgfmathresult} + % \pt@to@cm{\tmp@ury}\edef\ury{\pgfmathresult} + \mk@get@anchor{#1}{south west} + \edef\llx{\tmp@x} + \edef\lly{\tmp@y} + \mk@get@anchor{#1}{north east} + \edef\urx{\tmp@x} + \edef\ury{\tmp@y} +} % \end{macrocode} % \begin{macrocode} \def\mk@transform{% @@ -1011,26 +1033,35 @@ \mk@w{ \mk@i "upper right": [\urx,\ury],} \begingroup % \pgftransforminvert - \pgfpointanchor{#1}{south west}% - \pgfgetlastxy\tmp@llx\tmp@lly% - \pgfpointtransformed{\pgfpoint{\tmp@llx}{\tmp@lly}} - \pgf@xa=\pgf@x - \pgf@ya=\pgf@y - % - \pgfpointanchor{#1}{north east}% - \pgfgetlastxy\tmp@urx\tmp@ury% - \pgfgetlastxy\tmp@llx\tmp@lly% - \pgfpointtransformed{\pgfpoint{\tmp@urx}{\tmp@ury}} - \pgf@xb=\pgf@x - \pgf@yb=\pgf@y - \pt@to@cm{\the\pgf@xa}\edef\llx{\pgfmathresult} - \pt@to@cm{\the\pgf@ya}\edef\lly{\pgfmathresult} - \pt@to@cm{\the\pgf@xb}\edef\urx{\pgfmathresult} - \pt@to@cm{\the\pgf@yb}\edef\ury{\pgfmathresult}x - \mk@w{ \mk@i "global lower left": [\llx,\lly],} - \mk@w{ \mk@i "global upper right": [\urx,\ury]} + % \pgfpointanchor{#1}{south west}% + % \pgfgetlastxy\tmp@llx\tmp@lly% + % \pgfpointtransformed{\pgfpoint{\tmp@llx}{\tmp@lly}} + % \pgf@xa=\pgf@x + % \pgf@ya=\pgf@y + % % + % \pgfpointanchor{#1}{north east}% + % \pgfgetlastxy\tmp@urx\tmp@ury% + % \pgfgetlastxy\tmp@llx\tmp@lly% + % \pgfpointtransformed{\pgfpoint{\tmp@urx}{\tmp@ury}} + % \pgf@xb=\pgf@x + % \pgf@yb=\pgf@y + % \pt@to@cm{\the\pgf@xa}\edef\llx{\pgfmathresult} + % \pt@to@cm{\the\pgf@ya}\edef\lly{\pgfmathresult} + % \pt@to@cm{\the\pgf@xb}\edef\urx{\pgfmathresult} + % \pt@to@cm{\the\pgf@yb}\edef\ury{\pgfmathresult}x + \mk@get@global@anchor{#1}{south west} + \mk@w{ \mk@i "global lower left": [\tmp@x,\tmp@y],} + \mk@get@global@anchor{#1}{north east} + \mk@w{ \mk@i "global upper right": [\tmp@x,\tmp@y]} \endgroup } +\def\mk@pos#1(#2){% + \hex@dbg{10}{^^JMarking `#2' with `#1' - start} + \coordinate[transform shape] (tmp) at (#2) {}; + \mk@get@anchor{tmp}{center} + \hex@dbg{3}{^^JMarking `#2' with `#1' - `\tmp@x',\tmp@y'} + \tikzset{zone point={#1}{\tmp@x}{\tmp@y}} +} % \end{macrocode} % % For the key \texttt{zone path} to work, we need to be able to record @@ -1079,6 +1110,7 @@ \newcount\mk@point \mk@point=0 \let\oomk@i\mk@i% + \let\markpos\mk@pos% % \end{macrocode} % % @@ -1103,7 +1135,6 @@ \edef\mk@i{\mk@i\space} %% Everything is made into centimeters \mk@w{ \mk@i "units": "cm",} - \message{^^Jlabel: \meaning\mk@label} \@ifundefined{mk@label}{}{\mk@w{ \mk@i "labels": "\mk@label",}} %% Write out coordinate options as "coords" object \mk@w{ \mk@i"coords": \@lbchar}% @@ -1180,8 +1211,6 @@ % point - f.ex. in a node - and outputs that % \begin{macrocode} zone point/.code n args={3}{ - \advance\mk@point1 - \global\mk@point=\mk@point \pgf@xa=##2 cm \pgf@ya=##3 cm \pgfpointtransformed{\pgfpoint{\pgf@xa}{\pgf@ya}} @@ -1190,10 +1219,18 @@ \pgf@ya=\pgf@y \pt@to@cm{\the\pgf@xa}\edef\px{\pgfmathresult} \pt@to@cm{\the\pgf@ya}\edef\py{\pgfmathresult} + \advance\mk@point1 + \global\mk@point=\mk@point \mk@w{ \mk@i "point\the\mk@point": \@lbchar "name": "##1", "type": "point", "coords": [\px,\py] \@rbchar, } %\message{^^JZone point \the\mk@point\space ##1: ##2,##3 -> \px,\py} }, + zone global point/.code n args={3}{ + \advance\mk@point1 + \global\mk@point=\mk@point + \mk@w{ \mk@i "point\the\mk@point": \@lbchar "name": "##1", "type": "point", "coords": [\px,\py] + \@rbchar, } + }, % \end{macrocode} % % The \texttt{zone path} style is a bit more simple, but only because |