summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/wargame/source/natoapp6c/core.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/wargame/source/natoapp6c/core.dtx')
-rw-r--r--macros/latex/contrib/wargame/source/natoapp6c/core.dtx226
1 files changed, 226 insertions, 0 deletions
diff --git a/macros/latex/contrib/wargame/source/natoapp6c/core.dtx b/macros/latex/contrib/wargame/source/natoapp6c/core.dtx
new file mode 100644
index 0000000000..8a2caf322e
--- /dev/null
+++ b/macros/latex/contrib/wargame/source/natoapp6c/core.dtx
@@ -0,0 +1,226 @@
+% \iffalse
+% ====================================================================
+% \fi
+%
+% \subsection{The \texttt{wargame.natoapp6c} \TikZ{} library}
+%
+% In this section we define the code for the Tikz library. The
+% library defines a number of \spec{pic} keys we can use to draw
+% various parts of a marker. The markers conform to NATO App~6(c)
+% specification. The implementation here is heavily inspired by the
+% package \textsf{milsymb} \cite{milsymb} available at CTAN.
+%
+% \iffalse
+%<*natoapp6c>
+% \fi
+%
+%
+% \iffalse
+% --------------------------------------------------------------------
+% \fi
+% \subsubsection{Debugging}
+% \begin{Macro}{\natoappdbglvl,\n@to@pp@dbg}
+%
+% Set the debug level, and make debug message.
+%
+% \begin{macrocode}
+\usetikzlibrary{wargame.util}
+\usetikzlibrary{calc}
+\usetikzlibrary{arrows.meta}
+\usetikzlibrary{shapes.symbols}
+\usetikzlibrary{positioning,intersections}
+\newcount\natoappdbglvl\natoappdbglvl=\wargamedbglvl
+\def\n@to@pp@dbg#1#2{%
+ \ifnum#1>\natoappdbglvl\relax\else\message{^^J#2}\fi}
+% \end{macrocode}
+% \end{Macro}
+%
+% \iffalse
+% --------------------------------------------------------------------
+% \fi
+% \subsubsection{Colours}
+%
+% \begin{Macro}{\c@friendly,
+% \c@hostile,
+% \c@neutral,
+% \c@unknown}
+%
+% Define standard colours for marker affiliations.
+%
+% \begin{tabular}{|l|c|}
+% \hline
+% \rowcolor{headbg}
+% {\color{headfg}\textbf{Name}}
+% & {}\\
+% \hline
+% \spec{friendly} & \tikz{\draw[fill=friendly] (0,0) rectangle(1,.2);}\\
+% \spec{hostile} & \tikz{\draw[fill=hostile ] (0,0) rectangle(1,.2);}\\
+% \spec{neutral} & \tikz{\draw[fill=neutral ] (0,0) rectangle(1,.2);}\\
+% \spec{unknown} & \tikz{\draw[fill=unknown ] (0,0) rectangle(1,.2);}\\
+% \hline
+% \end{tabular}
+%
+% \begin{macrocode}
+\definecolor{friendly}{RGB}{128, 224, 255}
+\definecolor{hostile}{RGB}{255, 128, 128}
+\definecolor{neutral}{RGB}{170, 255, 170}
+\definecolor{unknown}{RGB}{255, 255, 128}
+\tikzset{%
+ faction/.code={%
+ \@ifundefined{natoapp@fac}{%
+ }{\tikzset{fill=\natoapp@fac}}}}
+% \end{macrocode}
+% \end{Macro}
+%
+%
+% \iffalse
+% --------------------------------------------------------------------
+% \fi
+% \subsubsection{Some dimensions}
+%
+% We define a number of dimensions which we will use in the
+% following. They provide a rough parameterisation of the node
+% shapes, but shouldn't really be changed. We have them here so that
+% the code uses as few hard coded numbers as possible.
+%
+% The dimensions are
+% \begin{itemize}
+% \item Installation `hat' $x$ coordinate
+% \item Installation `hat' height
+% \item Activity width of boxes
+% \item Height of space bar
+% \item Radius of the symbol
+% \end{itemize}
+%
+% \begin{macrocode}
+\newdimen\n@to@pp@inst@x\n@to@pp@inst@x=0.2cm
+\newdimen\n@to@pp@inst@h\n@to@pp@inst@h=0.15cm
+\newdimen\n@to@pp@act@w\n@to@pp@act@w=0.15cm
+\newdimen\n@to@pp@space@h\n@to@pp@space@h=0.1cm
+\newdimen\n@to@pp@r\n@to@pp@r=0.5cm
+% \end{macrocode}
+%
+% \iffalse
+% --------------------------------------------------------------------
+% \fi
+% \subsubsection{Some utilities}
+%
+% \begin{Macro}{\n@to@pp@isclip}
+% This detects if we're in a node that is being used for clipping
+%
+% \begin{macrocode}
+%\def\n@to@pp@cliptoken{clip}
+%\def\n@to@pp@isclip{FF\fi%
+% % \message{^^Jclip is \meaning\pgf@up@clip}%
+% \ifx\pgf@up@clip\n@to@pp@cliptoken}
+\newif\ifn@to@pp@isclip\n@to@pp@isclipfalse
+% \end{macrocode}
+% \end{Macro}
+%
+%
+% \begin{Macro}{\n@to@pp@saved@fill@color,\n@to@pp@saved@stroke@color}
+%
+% Macros to hold saved colours.
+
+% \begin{macrocode}
+\let\n@to@pp@saved@stroke@color\relax
+\let\n@to@pp@saved@fill@color\relax
+% \end{macrocode}
+% \end{Macro}
+%
+% \begin{Macro}{\n@to@pp@stroke@to@fill,\n@to@pp@restore@fill}
+% Macro to get stroke and fill colours and set the fill colour to
+% the stroke colour, and to restore to the old setting. This is
+% used by the frame shapes below to make sure that filled elements
+% of the frame uses the same colour as the for strokes.
+%
+% \begin{macrocode}
+\newcommand\n@to@pp@stroke@to@fill{%
+ %
+ \expandafter\let\expandafter\n@to@pp@saved@stroke@color%
+ \csname\string\color@pgfstrokecolor\endcsname%
+ %
+ \expandafter\let\expandafter\n@to@pp@saved@fill@color%
+ \csname\string\color@pgffillcolor\endcsname%
+ %
+ \expandafter\pgf@setfillcolor\n@to@pp@saved@stroke@color%
+ %
+ % \message{^^J=== Set fill to stroke color
+ % ^^J Old fill: \meaning\n@to@pp@saved@fill@color
+ % ^^J Old stroke: \meaning\n@to@pp@saved@stroke@color}
+}
+% \end{macrocode}
+%
+%
+%
+% \begin{macrocode}
+\newcommand\n@to@pp@restore@fill{%
+ % \message{^^J=== Restore fill color
+ % ^^J Old fill: \meaning\n@to@pp@saved@fill@color
+ % ^^J Old stroke: \meaning\n@to@pp@saved@stroke@color}
+ %
+ \ifx\n@to@pp@saved@fill@color\relax\else%
+ \expandafter\pgf@setfillcolor\n@to@pp@saved@fill@color%
+ \fi%
+ \global\let\n@to@pp@saved@fill@color\relax
+ \global\let\n@to@pp@saved@stroke@color\relax
+}
+% \end{macrocode}
+%
+% We also make an environment, just to simplify the use
+%
+% \begin{macrocode}
+\newenvironment{n@to@pp@stroketofill}{%
+ \pgfscope%
+ \n@to@pp@stroke@to@fill%
+}{%
+ \n@to@pp@restore@fill%
+ \endpgfscope%
+}
+% \end{macrocode}
+% \end{Macro}
+%
+% \iffalse
+% --------------------------------------------------------------------
+% \fi
+% \subsubsection{Faction names as macros}
+%
+% \begin{macrocode}
+\def\n@to@pp@friendly{friendly}
+\def\n@to@pp@hostile{hostile}
+\def\n@to@pp@neutral{neutral}
+\def\n@to@pp@unknown{unknown}
+% \end{macrocode}
+%
+% \iffalse
+% --------------------------------------------------------------------
+% \fi
+% \subsubsection{Node shapes}
+%
+% Here we define bases for all commands and affiliations. These are
+% defined as node shapes. This means we will render the NATO App6(c)
+% symbols as nodes with embedded nodes of the relevant shape.
+%
+%
+%
+% \input{natoapp6c/frames/base.dtx}
+% \input{natoapp6c/frames/friendly.dtx}
+% \input{natoapp6c/frames/hostile.dtx}
+% \input{natoapp6c/frames/neutral.dtx}
+% \input{natoapp6c/frames/unknown.dtx}
+%
+% \iffalse
+% --------------------------------------------------------------------
+% \fi
+%
+% \input{natoapp6c/echelon.dtx}
+% \input{natoapp6c/text.dtx}
+% \input{natoapp6c/shape.dtx}
+% \input{natoapp6c/util.dtx}
+% \input{natoapp6c/weaponry.dtx}
+% \input{natoapp6c/symbols.dtx}
+% \input{natoapp6c/list.dtx}
+% \iffalse
+% </natoapp6c>
+% --------------------------------------------------------------------
+% \fi