| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% expressg.dtx |
| 4 |
% Author: Peter Wilson (CUA) now at [email protected] until June 2004 |
| 5 |
% (or: pandgwilson at earthlink dot net) |
| 6 |
% Copyright 1996, 2003, 2004 Peter R. Wilson |
| 7 |
% |
| 8 |
% This work may be distributed and/or modified under the |
| 9 |
% conditions of the LaTeX Project Public License, either |
| 10 |
% version 1.3 of this license or (at your option) any |
| 11 |
% later version. |
| 12 |
% The latest version of the license is in |
| 13 |
% http://www.latex-project.org/lppl.txt |
| 14 |
% and version 1.3 or later is part of all distributions of |
| 15 |
% LaTeX version 2003/06/01 or later. |
| 16 |
% |
| 17 |
% This work has the LPPL maintenance status "author-maintained". |
| 18 |
% |
| 19 |
% This work consists of the files listed in the README file. |
| 20 |
% |
| 21 |
% If you do not have the docmfp package (available from CTAN in |
| 22 |
% tex-archive/macros/latex/contrib/supported), comment out the |
| 23 |
% \usepackage{docmfp} line below and uncomment the line following it. |
| 24 |
% |
| 25 |
%<*driver> |
| 26 |
\documentclass{ltxdoc} |
| 27 |
\usepackage{docmfp} |
| 28 |
%%%% \newenvironment{variable}[1]{}{} \newenvironment{routine}[1]{}{} |
| 29 |
\providecommand{\DescribeVariable}[1]{} \providecommand{\DescribeRoutine}[1]{} |
| 30 |
\providecommand{\variablestring}{} \renewcommand{\variablestring}{\space(v)} |
| 31 |
\providecommand{\routinestring}{} \renewcommand{\routinestring}{\space(r)} |
| 32 |
\EnableCrossrefs |
| 33 |
\CodelineIndex |
| 34 |
\setcounter{StandardModuleDepth}{1} |
| 35 |
|
| 36 |
\begin{document} |
| 37 |
\DocInput{expressg.dtx} |
| 38 |
\end{document} |
| 39 |
%</driver> |
| 40 |
% |
| 41 |
% \fi |
| 42 |
% |
| 43 |
% \CheckSum{171} |
| 44 |
% |
| 45 |
% \DoNotIndex{\',\.,\@M,\@@input,\@addtoreset,\@arabic,\@badmath} |
| 46 |
% \DoNotIndex{\@centercr,\@cite} |
| 47 |
% \DoNotIndex{\@dotsep,\@empty,\@float,\@gobble,\@gobbletwo,\@ignoretrue} |
| 48 |
% \DoNotIndex{\@input,\@ixpt,\@m} |
| 49 |
% \DoNotIndex{\@minus,\@mkboth,\@ne,\@nil,\@nomath,\@plus,\@set@topoint} |
| 50 |
% \DoNotIndex{\@tempboxa,\@tempcnta,\@tempdima,\@tempdimb} |
| 51 |
% \DoNotIndex{\@tempswafalse,\@tempswatrue,\@viipt,\@viiipt,\@vipt} |
| 52 |
% \DoNotIndex{\@vpt,\@warning,\@xiipt,\@xipt,\@xivpt,\@xpt,\@xviipt} |
| 53 |
% \DoNotIndex{\@xxpt,\@xxvpt,\\,\ ,\addpenalty,\addtolength,\addvspace} |
| 54 |
% \DoNotIndex{\advance,\Alph,\alph} |
| 55 |
% \DoNotIndex{\arabic,\ast,\begin,\begingroup,\bfseries,\bgroup,\box} |
| 56 |
% \DoNotIndex{\bullet} |
| 57 |
% \DoNotIndex{\cdot,\cite,\CodelineIndex,\cr,\day,\DeclareOption} |
| 58 |
% \DoNotIndex{\def,\DisableCrossrefs,\divide,\DocInput,\documentclass} |
| 59 |
% \DoNotIndex{\DoNotIndex,\egroup,\ifdim,\else,\fi,\em,\endtrivlist} |
| 60 |
% \DoNotIndex{\EnableCrossrefs,\end,\end@dblfloat,\end@float,\endgroup} |
| 61 |
% \DoNotIndex{\endlist,\everycr,\everypar,\ExecuteOptions,\expandafter} |
| 62 |
% \DoNotIndex{\fbox} |
| 63 |
% \DoNotIndex{\filedate,\filename,\fileversion,\fontsize,\framebox,\gdef} |
| 64 |
% \DoNotIndex{\global,\halign,\hangindent,\hbox,\hfil,\hfill,\hrule} |
| 65 |
% \DoNotIndex{\hsize,\hskip,\hspace,\hss,\if@tempswa,\ifcase,\or,\fi,\fi} |
| 66 |
% \DoNotIndex{\ifhmode,\ifvmode,\ifnum,\iftrue,\ifx,\fi,\fi,\fi,\fi,\fi} |
| 67 |
% \DoNotIndex{\input} |
| 68 |
% \DoNotIndex{\jobname,\kern,\leavevmode,\let,\leftmark} |
| 69 |
% \DoNotIndex{\list,\llap,\long,\m@ne,\m@th,\mark,\markboth,\markright} |
| 70 |
% \DoNotIndex{\month,\newcommand,\newcounter,\newenvironment} |
| 71 |
% \DoNotIndex{\NeedsTeXFormat,\newdimen} |
| 72 |
% \DoNotIndex{\newlength,\newpage,\nobreak,\noindent,\null,\number} |
| 73 |
% \DoNotIndex{\numberline,\OldMakeindex,\OnlyDescription,\p@} |
| 74 |
% \DoNotIndex{\pagestyle,\par,\paragraph,\paragraphmark,\parfillskip} |
| 75 |
% \DoNotIndex{\penalty,\PrintChanges,\PrintIndex,\ProcessOptions} |
| 76 |
% \DoNotIndex{\protect,\ProvidesClass,\raggedbottom,\raggedright} |
| 77 |
% \DoNotIndex{\refstepcounter,\relax,\renewcommand,\reset@font} |
| 78 |
% \DoNotIndex{\rightmargin,\rightmark,\rightskip,\rlap,\rmfamily,\roman} |
| 79 |
% \DoNotIndex{\roman,\secdef,\selectfont,\setbox,\setcounter,\setlength} |
| 80 |
% \DoNotIndex{\settowidth,\sfcode,\skip,\sloppy,\slshape,\space} |
| 81 |
% \DoNotIndex{\symbol,\the,\trivlist,\typeout,\tw@,\undefined,\uppercase} |
| 82 |
% \DoNotIndex{\usecounter,\usefont,\usepackage,\vfil,\vfill,\viiipt} |
| 83 |
% \DoNotIndex{\viipt,\vipt,\vskip,\vspace} |
| 84 |
% \DoNotIndex{\wd,\xiipt,\year,\z@} |
| 85 |
% |
| 86 |
% \changes{v1.0}{1996/05/09}{First public release} |
| 87 |
% \changes{v1.1}{1999/10/30}{Improved documentation using docmfp package} |
| 88 |
% \changes{v1.1}{1999/10/30}{Reordered descriptions and code} |
| 89 |
% \changes{v1.1}{1999/10/30}{Deleted Express Book examples} |
| 90 |
% \changes{v1.1}{1999/10/30}{Updated references} |
| 91 |
% \changes{v1.2}{1999/11/15}{Reincluded Express Book examples, plus NIAM and S-M} |
| 92 |
% \changes{v1.3}{2000/05/22}{Added smoothing, drawdrum, and others} |
| 93 |
% \changes{v1.4}{2000/07/10}{Added sharp and smooth lines} |
| 94 |
% \changes{v1.5}{2003/07/31}{Minor bug fixes} |
| 95 |
% \changes{v1.6}{2004/02/29}{More boxes} |
| 96 |
% \changes{v1.61}{2004/03/17}{Minor namespace feature fix} |
| 97 |
% |
| 98 |
% \newcommand{\dtxfilename}{\texttt{expressg.dtx}} |
| 99 |
% ^^A \def\fileversion{v1.0} |
| 100 |
% \def\firstfiledate{1996/05/09} |
| 101 |
% ^^A \def\fileversion{v1.1} |
| 102 |
% ^^A \def\filedate{1999/10/30} |
| 103 |
% ^^A \def\fileversion{v1.2} |
| 104 |
% ^^A \def\filedate{1999/11/15} |
| 105 |
% ^^A \def\fileversion{v1.3} |
| 106 |
% ^^A \def\filedate{2000/05/22} |
| 107 |
% \def\fileversion{v1.4} \def\filedate{2000/07/10} |
| 108 |
% \def\fileversion{v1.5} \def\filedate{2003/07/31} |
| 109 |
% \def\fileversion{v1.6} \def\filedate{2004/02/29} |
| 110 |
% \def\fileversion{v1.61} \def\filedate{2004/03/17} |
| 111 |
% \newcommand*{\Lpack}[1]{\textsf {#1}} ^^A typeset a package |
| 112 |
% \newcommand*{\Lopt}[1]{\textsf {#1}} ^^A typeset an option |
| 113 |
% \newcommand*{\file}[1]{\texttt {#1}} ^^A typeset a file |
| 114 |
% \newcommand*{\Lcount}[1]{\textsl {\small#1}} ^^A typeset a counter |
| 115 |
% \newcommand*{\pstyle}[1]{\textsl {#1}} ^^A typeset a pagestyle |
| 116 |
% \newcommand*{\Lenv}[1]{\texttt {#1}} ^^A typeset an environment |
| 117 |
% \newcommand*{\Express}{\textsc{express}} |
| 118 |
% \newcommand*{\ExpressG}{\textsc{express-g}} |
| 119 |
% \newcommand*{\Mpost}{\textsc{MetaPost}} |
| 120 |
% \newcommand*{\Mfont}{METAFONT} |
| 121 |
% \newcommand*{\fref}[1]{Figure~\ref{#1}} |
| 122 |
% \newcommand*{\pref}[1]{page~\pageref{#1}} |
| 123 |
% \newcommand*{\PS}{PostScript} |
| 124 |
% \newcommand*{\EPS}{Encapsulated \PS} |
| 125 |
% \newcommand*{\pdflatex}{pdf\LaTeX} |
| 126 |
% |
| 127 |
% \title{The \Lpack{Expressg} \Mpost{} package for drawing |
| 128 |
% box-line-annotation diagrams\thanks{This |
| 129 |
% file (\dtxfilename) has version number \fileversion, last revised |
| 130 |
% \filedate.}} |
| 131 |
% |
| 132 |
% \author{% |
| 133 |
% Peter Wilson\\ |
| 134 |
% Catholic University of America \\ |
| 135 |
% Now at \texttt{[email protected]} |
| 136 |
% } |
| 137 |
% \date{(First published \firstfiledate) \\ \filedate} |
| 138 |
% \maketitle |
| 139 |
% \begin{abstract} |
| 140 |
% The \Lpack{expressg} \Mpost{} package provides facilities to assist in |
| 141 |
% drawing diagrams that consist of boxes, lines, and annotations. |
| 142 |
% Particular support is provided for creating \ExpressG{} diagrams |
| 143 |
% \end{abstract} |
| 144 |
% \tableofcontents |
| 145 |
% \listoffigures |
| 146 |
% |
| 147 |
% \StopEventually{} |
| 148 |
% |
| 149 |
% \section{Introduction} |
| 150 |
% |
| 151 |
% \ExpressG{} is an ISO international standard graphical information |
| 152 |
% modeling |
| 153 |
% language~\cite{STEP11,EBOOK}, and is a subset of the \Express{} lexical |
| 154 |
% object-flavoured information modeling language. Like most graphical |
| 155 |
% modeling languages, \ExpressG{} diagrams consist of boxes, lines, and |
| 156 |
% annotations associated with the boxes and the lines. As a colleague |
| 157 |
% of mine once put it, these kinds of graphical languages are BLA |
| 158 |
% (boxes, lines, annotations) with respect to lexical languages. |
| 159 |
% |
| 160 |
% \Mpost~\cite{MPOST} is a powerful lexical language for producing |
| 161 |
% \EPS\footnote{\PS{} is a registered trademark of Adobe |
| 162 |
% Systems Incorporated.} diagrams, and is based on the \Mfont~\cite{MFONT} |
| 163 |
% language for creating fonts. |
| 164 |
% |
| 165 |
% The \Lpack{expressg} package provides extensions to the base |
| 166 |
% \Mpost{} language to facilitate the creation of \ExpressG{} diagrams. |
| 167 |
% The package may also be used as is, or certainly by |
| 168 |
% extension, for the creation of other BLA diagrams. |
| 169 |
% |
| 170 |
% \Mpost{} is typically used to generate pictures for inclusion |
| 171 |
% in \LaTeX{} documents~\cite{LATEX}. By default it uses \TeX{} for |
| 172 |
% typesetting any text; this behaviour can be modified so that \LaTeX{} |
| 173 |
% is used instead. If standard \PS{} fonts (like Times) are |
| 174 |
% used, then \LaTeX{} typesetting may be avoided altogether. Running |
| 175 |
% \Mpost{} and methods of including \Mpost{} diagrams in (pdf)LaTeX |
| 176 |
% documents are described in~\cite{METAFP}. |
| 177 |
% |
| 178 |
% |
| 179 |
% The \Lpack{expressg} package has been some years |
| 180 |
% in the making. For |
| 181 |
% occasional diagrams I got by with using either the simple \LaTeX{} |
| 182 |
% picture commands, |
| 183 |
% or general GUI drawing packages. As time went on and the number |
| 184 |
% and complexity of the diagrams increased it became, to me at least, more |
| 185 |
% important to use a robust and powerful drawing language than fancy |
| 186 |
% GUI packages. This was especially important if a diagram had to be |
| 187 |
% changed at a later date, as the language denoted exactly how the drawing |
| 188 |
% had been produced. With the GUI tools all that you had was the picture |
| 189 |
% and whatever graphics file format the tool used --- there was no |
| 190 |
% user-sensible record |
| 191 |
% of how any result was achieved. Also, generally speaking I find it quicker |
| 192 |
% to use \Mpost{} than a GUI tool as too much time has to be spent using |
| 193 |
% a mouse or a cursor to reposition and rescale the drawing elements. |
| 194 |
% |
| 195 |
% Section~\ref{sec:usc} describes the facilities provided by the package. |
| 196 |
% Several worked |
| 197 |
% example diagrams are presented in Section~\ref{sec:example}, together |
| 198 |
% with information on how to run \Mpost. |
| 199 |
% Commented code for the package macros\footnote{If requested, |
| 200 |
% I may be prepared to consider providing additional macros, but no promises.} |
| 201 |
% is in Section~\ref{sec:mf}. |
| 202 |
% |
| 203 |
% It is assumed that the reader has some understanding of \Mpost, although |
| 204 |
% the example in Section~\ref{sec:example} does provide an |
| 205 |
% \textit{aide-memoire} for most of the \Mpost{} constructs that are likely |
| 206 |
% to be used in creating BLA diagrams. The definitive \Mpost{} |
| 207 |
% manual is~\cite{MPOST} but both~\cite{HOENIG98} and~\cite{GOOSSENS97} |
| 208 |
% give some interesting examples of how to use it; in fact the front cover |
| 209 |
% of Hoenig's book is a \Mpost{} picture. |
| 210 |
% Similarly, some familiarity with |
| 211 |
% BLA diagramming would be of assistance. |
| 212 |
% |
| 213 |
% I suggest that on first reading it may be sensible to skim |
| 214 |
% Section~\ref{sec:usc} first |
| 215 |
% and then peruse the example in Section~\ref{sec:example} more closely. |
| 216 |
% After this |
| 217 |
% go back and re-read Section~\ref{sec:usc} as it then should make |
| 218 |
% more sense. |
| 219 |
% |
| 220 |
% This manual is typeset according to the conventions of the |
| 221 |
% \LaTeX{} \textsc{docstrip} utility which enables the automatic |
| 222 |
% extraction of the \LaTeX{} macro source files~\cite{GOOSSENS94}. |
| 223 |
% |
| 224 |
% |
| 225 |
% |
| 226 |
% \section{The \Lpack{expressg} package} \label{sec:usc} |
| 227 |
% |
| 228 |
% \subsection{Internal variables} |
| 229 |
% |
| 230 |
% The package includes several internal variables that are initialised to |
| 231 |
% commonly appropriate values. |
| 232 |
% This section describes the principal internal variables. |
| 233 |
% Short descriptions |
| 234 |
% of the others, which |
| 235 |
% are likely to be used in diagrams only very occasionally, can be found |
| 236 |
% in Section~\ref{sec:mf}. |
| 237 |
% |
| 238 |
% The values of internal variables in \Mpost{} can only be changed via |
| 239 |
% assignment. For example: |
| 240 |
% \begin{verbatim} |
| 241 |
% internal_variable := expression; |
| 242 |
% \end{verbatim} |
| 243 |
% |
| 244 |
% \DescribeVariable{u} |
| 245 |
% \DescribeVariable{maxx} |
| 246 |
% \DescribeVariable{maxy} |
| 247 |
% |u| is the value of the unit of length for a diagram; it is initialised |
| 248 |
% to 1mm. All lengths, except for line thicknesses, |
| 249 |
% are defined in terms of |u|. |
| 250 |
% |maxx| and |maxy| are the maximum x and y coordinate values |
| 251 |
% for a diagram. These are initialised to the maximum size for a diagram |
| 252 |
% within an ISO standard document (i.e., |maxx:=159.5u| and |maxy:=210u|). |
| 253 |
% |
| 254 |
% The next set of variables control the thickness of lines and the |
| 255 |
% dimensions of line end styles. |
| 256 |
% |
| 257 |
% \DescribeVariable{normalpen} |
| 258 |
% Lines with normal linethickness are drawn with |normalpen|. |
| 259 |
% |
| 260 |
% \DescribeVariable{thickpen} |
| 261 |
% Thick lines are drawn with |thickpen|. |
| 262 |
% |
| 263 |
% \DescribeVariable{thinpenpen} |
| 264 |
% Thin lines are drawn with |thinpen|. |
| 265 |
% |
| 266 |
% \DescribeVariable{dotspen} |
| 267 |
% Dotted lines are drawn with |dotspen|. |
| 268 |
% |
| 269 |
% \DescribeVariable{dotpen} |
| 270 |
% |dotpen| is for drawing the black dot line end style. |
| 271 |
% |
| 272 |
% \DescribeVariable{dotdiam} |
| 273 |
% |dotdiam| is the diameter of an open circle or dot line end style. |
| 274 |
% |
| 275 |
% \DescribeVariable{smoothrad} |
| 276 |
% |smoothrad| is the radius of the circular arc used to round the join between |
| 277 |
% two straight lines. |
| 278 |
% |
| 279 |
% \DescribeVariable{drumlid} |
| 280 |
% |drumlid| is the ratio of the minor to major diameter of the ellipse |
| 281 |
% forming the top of the drum box; the larger the value the more the |
| 282 |
% apparent viewpoint shifts to above the drum. The default value is 0.2. |
| 283 |
% |
| 284 |
% \begin{figure} |
| 285 |
% \setlength{\unitlength}{1mm} |
| 286 |
% \centering |
| 287 |
% \begin{picture}(105,40) |
| 288 |
% \put(0,0){\framebox(105,40){}} |
| 289 |
% \put(5,0){\begin{picture}(60,40) |
| 290 |
% ^^A \put(0,0){\framebox(60,40){}} |
| 291 |
% \thicklines |
| 292 |
% \put(0,20){\line(1,0){10}} |
| 293 |
% \put(10,10){\line(2,1){20}} |
| 294 |
% \put(10,30){\line(2,-1){20}} |
| 295 |
% \put(10,10){\line(0,1){20}} |
| 296 |
% \thinlines |
| 297 |
% \put(10,5){\vector(1,0){20}} \put(10,5){\vector(-1,0){0}} |
| 298 |
% \put(20,3){\makebox(0,0)[t]{length}} |
| 299 |
% \put(35,10){\vector(0,1){20}} \put(35,10){\vector(0,-1){0}} |
| 300 |
% \put(40,20){\makebox(0,0)[l]{base width}} |
| 301 |
% \end{picture}} |
| 302 |
% \put(65,0){\begin{picture}(35,40) |
| 303 |
% ^^A \put(0,0){\framebox(60,40){}} |
| 304 |
% \thicklines |
| 305 |
% \put(5,20){\line(1,0){30}} |
| 306 |
% \put(5,10){\line(2,1){20}} |
| 307 |
% \put(5,30){\line(2,-1){20}} |
| 308 |
% \thinlines |
| 309 |
% \put(5,5){\vector(1,0){20}} \put(5,5){\vector(-1,0){0}} |
| 310 |
% \put(15,3){\makebox(0,0)[t]{length}} |
| 311 |
% \put(0,10){\vector(0,1){20}} \put(0,10){\vector(0,-1){0}} |
| 312 |
% \end{picture}} |
| 313 |
% \end{picture} |
| 314 |
% \caption{Length parameters for arrowhead and fanin line end styles}\label{fig:trifan} |
| 315 |
% \end{figure} |
| 316 |
% |
| 317 |
% |
| 318 |
% \DescribeVariable{gal} |
| 319 |
% \DescribeVariable{gab} |
| 320 |
% An arrowhead is defined by the height of the triangle and the base of |
| 321 |
% the triangle forming the arrowhead, as shown in \fref{fig:trifan}. |
| 322 |
% |gal| and |gab| are the length |
| 323 |
% and base width of arrows for arrowed line end styles. |
| 324 |
% |
| 325 |
% \DescribeVariable{gfl} |
| 326 |
% \DescribeVariable{gfb} |
| 327 |
% Like an arrowhead, a fanin is defined by the height and the base of |
| 328 |
% the triangular fan shape, as shown in \fref{fig:trifan}. |
| 329 |
% |gfl| and |gfb| are the length and base |
| 330 |
% width of fans for fanin line end styles. They are initialised to the |
| 331 |
% default values. |
| 332 |
% |
| 333 |
% The next set of variables control certain geometric aspects of |
| 334 |
% the various \ExpressG{} boxes. |
| 335 |
% |
| 336 |
% \DescribeVariable{onelineh} |
| 337 |
% |onelineh| is the minimum height of a box that encloses a single |
| 338 |
% line of text. This is initialised to |5u|. |
| 339 |
% |
| 340 |
% \begin{figure} |
| 341 |
% \setlength{\unitlength}{1mm} |
| 342 |
% \centering |
| 343 |
% \begin{picture}(65,40) |
| 344 |
% \put(0,0){\framebox(65,40){}} |
| 345 |
% \put(5,0){\begin{picture}(60,40) |
| 346 |
% ^^A \put(0,0){\framebox(60,40){}} |
| 347 |
% \thicklines |
| 348 |
% \put(0,10){\framebox(40,15){}} |
| 349 |
% \put(30,10){\line(0,1){15}} |
| 350 |
% \thinlines |
| 351 |
% \put(0,5){\vector(1,0){40}} \put(0,5){\vector(-1,0){0}} |
| 352 |
% \put(20,3){\makebox(0,0)[t]{length}} |
| 353 |
% \put(45,10){\vector(0,1){15}} \put(45,10){\vector(0,-1){0}} |
| 354 |
% \put(47,17.5){\makebox(0,0)[l]{height}} |
| 355 |
% \put(40,30){\vector(-1,0){10}} \put(40,30){\vector(1,0){0}} |
| 356 |
% \put(35,32){\makebox(0,0)[b]{inset}} |
| 357 |
% \end{picture}} |
| 358 |
% \end{picture} |
| 359 |
% \caption{Parameters for (inset) boxes}\label{fig:bool} |
| 360 |
% \end{figure} |
| 361 |
% |
| 362 |
% \DescribeVariable{sdtbl} |
| 363 |
% \DescribeVariable{sdtbh} |
| 364 |
% \DescribeVariable{sdtbs} |
| 365 |
% The length (|sdtbl|), height (|sdtbh|) and line inset (|sdtbs|) for |
| 366 |
% simple data type boxes (e.g., a BOOLEAN data type box), as illustrated |
| 367 |
% in \fref{fig:bool}. These are |
| 368 |
% initialised as |22u|, |onelineh| and |2u| respectively. |
| 369 |
% |
| 370 |
% \DescribeVariable{sdtebl} |
| 371 |
% \DescribeVariable{sdtebh} |
| 372 |
% \DescribeVariable{sdtebs} |
| 373 |
% The length (|sdtebl|), height (|sdtebh|) and line inset (|sdtebs|) |
| 374 |
% for a simple data type EXPRESSION box. The value of |sdtebl| is |28u|, |
| 375 |
% and the other values are the same as for the other simple data type boxes. |
| 376 |
% |
| 377 |
% \DescribeVariable{sdtbgel} |
| 378 |
% \DescribeVariable{sdtbgeh} |
| 379 |
% \DescribeVariable{sdtbges} |
| 380 |
% The length (|sdtbgel|), height (|sdtbgeh|) and inset for GENERICENT |
| 381 |
% data type boxes. The value of |sdtbgel| is |38u|, |
| 382 |
% and the other values are the same as for the other simple data type boxes. |
| 383 |
% |
| 384 |
% \DescribeVariable{pconl} |
| 385 |
% \DescribeVariable{pconh} |
| 386 |
% The length (|pconl|) of an average numeric (proxy) page connector |
| 387 |
% (e.g., for |(9,9 (9,9))|) |
| 388 |
% and the height (|pconh|) |
| 389 |
% of an average page connector, which is initialised for one line of text. |
| 390 |
% |
| 391 |
% \DescribeVariable{enth} |
| 392 |
% \DescribeVariable{typeh} |
| 393 |
% \DescribeVariable{schemah} |
| 394 |
% The heights of an average entity (|enth|), |
| 395 |
% type --- including enumeration and select --- (|typeh|), |
| 396 |
% and schema (|schemah|) boxes. These are all initialised to cater for |
| 397 |
% one line of text. |
| 398 |
% |
| 399 |
% \DescribeVariable{ish} |
| 400 |
% \DescribeVariable{isrh} |
| 401 |
% |ish| is the height of an interschema reference box with one line of text. |
| 402 |
% |isrh| is the height of an interschema reference box with a rename, where |
| 403 |
% there is one line of text each for the original and renamed |
| 404 |
% names. |
| 405 |
% |
| 406 |
% \DescribeVariable{eventh} |
| 407 |
% \DescribeVariable{eventslope} |
| 408 |
% The height (|eventh|) of a one-lined event box, and the slope (|eventslope|) |
| 409 |
% of the sides of an |
| 410 |
% event box (e.g., 0.25 or 1/4). |
| 411 |
% |
| 412 |
% The next set of variables control the amount of space surrounding text |
| 413 |
% on \ExpressG{} diagrams. |
| 414 |
% |
| 415 |
% \DescribeVariable{nextra} |
| 416 |
% |nextra| is the margin around names when put into entity, schema, |
| 417 |
% interschema reference, |
| 418 |
% page connector, and event boxes. |
| 419 |
% |
| 420 |
% \DescribeVariable{niextra} |
| 421 |
% |niextra| is the margin around names when put into type boxes. |
| 422 |
% |
| 423 |
% \DescribeVariable{ndextra} |
| 424 |
% |ndextra| is the margin around names when used on attribute lines. |
| 425 |
% |
| 426 |
% \subsection{Routines} |
| 427 |
% |
| 428 |
% The principal aspects of an \ExpressG{} diagram are lines and line ends of |
| 429 |
% various styles, and boxes of several different kinds. Many routines |
| 430 |
% are provided for positioning and drawing these on a diagram. |
| 431 |
% |
| 432 |
% The following sections describe most of the routines. Short descriptions |
| 433 |
% of the others, which |
| 434 |
% are effectively only used as internal support routines, can be found |
| 435 |
% in Section~\ref{sec:mf}. |
| 436 |
% |
| 437 |
% A note on naming conventions used in describing the routines: |
| 438 |
% \begin{itemize} |
| 439 |
% \item As usual with \Mpost, a name starting with |z| is a point, and |
| 440 |
% names staring with |x| or |y| are x- and y-coordinates respectively. |
| 441 |
% \item The letters |i| through |n| denote (point, coordinate) suffixes. |
| 442 |
% Suffixes are usually a number, such as |37|, but may also have |
| 443 |
% alphanumeric characters after the number (e.g., |37C2D|). |
| 444 |
% \end{itemize} |
| 445 |
% |
| 446 |
% |
| 447 |
% \subsubsection{Utility routines} |
| 448 |
% |
| 449 |
% Several utility routines are provided defining some shortcuts and |
| 450 |
% to ease some of the calculations |
| 451 |
% that may be required when producing a diagram. |
| 452 |
% |
| 453 |
% \DescribeRoutine{VH} |
| 454 |
% |VH(j, k)| calculates the intersection point, |zjvh|, between the vertical |
| 455 |
% line through the point |zj| and the horizontal line through the point |zk|, |
| 456 |
% as shown in \fref{fig:vhvh}. |
| 457 |
% |
| 458 |
% |
| 459 |
% \DescribeRoutine{VhV} |
| 460 |
% |VhV(j, k)| calculates the point |zjvhv| on the vertical line through |
| 461 |
% the point |zj| and the point |zkvhv| on the vertical line through the |
| 462 |
% point |zk|, such that the line |zjvhv--zkvhv| is horizontal and centered |
| 463 |
% vertically between the two given points, |
| 464 |
% as shown in \fref{fig:vhvh}. |
| 465 |
% |
| 466 |
% \begin{figure} |
| 467 |
% \setlength{\unitlength}{1mm} |
| 468 |
% \centering |
| 469 |
% \begin{picture}(130,50) |
| 470 |
% \put(0,0){\framebox(120,50){}} |
| 471 |
% \put(5,5){\begin{picture}(30,40) |
| 472 |
% ^^A \put(0,0){\framebox(30,40){}} |
| 473 |
% \put(5,35){\circle*{2}} |
| 474 |
% \put(3,37){\makebox(0,0)[br]{\texttt{zj}}} |
| 475 |
% \put(25,5){\circle*{2}} |
| 476 |
% \put(27,3){\makebox(0,0)[tl]{\texttt{zk}}} |
| 477 |
% \put(5,5){\circle{2}} |
| 478 |
% \put(3,3){\makebox(0,0)[tr]{\texttt{zjvh}}} |
| 479 |
% \put(5,0){\line(0,1){40}} |
| 480 |
% \put(0,5){\line(1,0){30}} |
| 481 |
% \end{picture}} |
| 482 |
% \put(45,5){\begin{picture}(30,40) |
| 483 |
% ^^A \put(0,0){\framebox(30,40){}} |
| 484 |
% \put(5,35){\circle*{2}} |
| 485 |
% \put(3,37){\makebox(0,0)[br]{\texttt{zj}}} |
| 486 |
% \put(25,5){\circle*{2}} |
| 487 |
% \put(27,3){\makebox(0,0)[tl]{\texttt{zk}}} |
| 488 |
% \put(5,20){\circle{2}} |
| 489 |
% \put(3,18){\makebox(0,0)[tr]{\texttt{zjvhv}}} |
| 490 |
% \put(25,20){\circle{2}} |
| 491 |
% \put(27,22){\makebox(0,0)[bl]{\texttt{zkvhv}}} |
| 492 |
% \put(5,40){\line(0,-1){25}} |
| 493 |
% \put(0,20){\line(1,0){30}} |
| 494 |
% \put(25,0){\line(0,1){25}} |
| 495 |
% \end{picture}} |
| 496 |
% \put(85,5){\begin{picture}(30,40) |
| 497 |
% ^^A \put(0,0){\framebox(30,40){}} |
| 498 |
% \put(5,35){\circle*{2}} |
| 499 |
% \put(3,37){\makebox(0,0)[br]{\texttt{zj}}} |
| 500 |
% \put(25,5){\circle*{2}} |
| 501 |
% \put(27,3){\makebox(0,0)[tl]{\texttt{zk}}} |
| 502 |
% \put(15,35){\circle{2}} |
| 503 |
% \put(17,37){\makebox(0,0)[bl]{\texttt{zjhvh}}} |
| 504 |
% \put(15,5){\circle{2}} |
| 505 |
% \put(13,3){\makebox(0,0)[tr]{\texttt{zkhvh}}} |
| 506 |
% \put(15,0){\line(0,1){40}} |
| 507 |
% \put(0,35){\line(1,0){20}} |
| 508 |
% \put(30,5){\line(-1,0){20}} |
| 509 |
% \end{picture}} |
| 510 |
% \end{picture} |
| 511 |
% \caption[Results of the \texttt{VH}, \texttt{VhV} and \texttt{HvH} |
| 512 |
% routines]% |
| 513 |
% {Results of the \texttt{VH} (left), \texttt{VhV} (middle) |
| 514 |
% and \texttt{HvH} (right) routines}\label{fig:vhvh} |
| 515 |
% \end{figure} |
| 516 |
% |
| 517 |
% \DescribeRoutine{HvH} |
| 518 |
% |HvH(j, k)| calculates the point |zjhvh| on the horizontal line through |
| 519 |
% the point |zj| and the point |zkhvh| on the horizontal line through the |
| 520 |
% point |zk|, such that the line |zjhvh--zkhvh| is vertical and centered |
| 521 |
% horizontally between the two given points, |
| 522 |
% as shown in \fref{fig:vhvh}. |
| 523 |
% |
| 524 |
% \DescribeRoutine{VyV} |
| 525 |
% |VyV(j, i, k)| is a generalisation of the |VhV| routine. It calculates |
| 526 |
% the point |zjvyv| which is on the vertical line through |zj| and the |
| 527 |
% horizontal line through |yi|, and the point |zkvyv| which is on the |
| 528 |
% vertical line through |zk| and the horizontal line through |yi|. An example |
| 529 |
% result is shown in \fref{fig:vyxh}. |
| 530 |
% |
| 531 |
% \begin{figure} |
| 532 |
% \setlength{\unitlength}{1mm} |
| 533 |
% \centering |
| 534 |
% \begin{picture}(90,50) |
| 535 |
% \put(0,0){\framebox(90,50){}} |
| 536 |
% \put(10,5){\begin{picture}(30,40) |
| 537 |
% \put(5,35){\circle*{2}} |
| 538 |
% \put(3,37){\makebox(0,0)[br]{\texttt{zj}}} |
| 539 |
% \put(25,5){\circle{2}} |
| 540 |
% \put(27,3){\makebox(0,0)[tl]{\texttt{zkvyv}}} |
| 541 |
% \put(5,5){\circle{2}} |
| 542 |
% \put(3,3){\makebox(0,0)[tr]{\texttt{zjvyv}}} |
| 543 |
% \put(25,20){\circle*{2}} |
| 544 |
% \put(27,22){\makebox(0,0)[bl]{\texttt{zk}}} |
| 545 |
% \put(5,40){\line(0,-1){40}} ^^A V through zj |
| 546 |
% \put(0,5){\line(1,0){30}} ^^A H through yi |
| 547 |
% \put(32,5){\makebox(0,0)[bl]{\texttt{yi}}} |
| 548 |
% \put(25,0){\line(0,1){25}} ^^A V through zk |
| 549 |
% \end{picture}} |
| 550 |
% \put(50,5){\begin{picture}(30,40) |
| 551 |
% \put(5,35){\circle*{2}} |
| 552 |
% \put(3,37){\makebox(0,0)[br]{\texttt{zj}}} |
| 553 |
% \put(25,5){\circle{2}} |
| 554 |
% \put(27,3){\makebox(0,0)[tl]{\texttt{zkhxh}}} |
| 555 |
% \put(25,35){\circle{2}} |
| 556 |
% \put(27,33){\makebox(0,0)[tl]{\texttt{zjhxh}}} |
| 557 |
% \put(15,5){\circle*{2}} |
| 558 |
% \put(13,3){\makebox(0,0)[tr]{\texttt{zk}}} |
| 559 |
% \put(25,0){\line(0,1){40}} ^^A V through xi |
| 560 |
% \put(25,42){\makebox(0,0)[b]{\texttt{xi}}} |
| 561 |
% \put(0,35){\line(1,0){30}} ^^A H through zj |
| 562 |
% \put(30,5){\line(-1,0){20}} ^^A H through zk |
| 563 |
% \end{picture}} |
| 564 |
% \end{picture} |
| 565 |
% \caption[Results of the \texttt{VyV} and \texttt{HxH} |
| 566 |
% routines]% |
| 567 |
% {Results of the \texttt{VyV} (left) and \texttt{HxH} (right) |
| 568 |
% routines}\label{fig:vyxh} |
| 569 |
% \end{figure} |
| 570 |
% |
| 571 |
% \DescribeRoutine{HxH} |
| 572 |
% |HxH(j, i, k)| is a generalisation of the |HvH| routine. It calculates |
| 573 |
% the point |zjhxh| which is on the horizontal line through |zj| and the |
| 574 |
% vertical line through |xi|, and the point |zkhxh| which is on the |
| 575 |
% horizontal line through |zk| and the vertical line through |xi|. An example |
| 576 |
% result is shown in \fref{fig:vyxh}. |
| 577 |
% |
| 578 |
% \DescribeRoutine{namespace} |
| 579 |
% |namespace(|\meta{name}|)(|\meta{margin}|)| calculates the length of |
| 580 |
% the text string \meta{name} plus the \meta{margin} length. You may |
| 581 |
% use it like: \\ |
| 582 |
% |c = 3/2namespace(btex name etex)(4u)| |
| 583 |
% |
| 584 |
% |
| 585 |
% \DescribeRoutine{dashes} |
| 586 |
% |dashes| is shorthand for a dashed linestyle. Use it like: |draw ... dashes;|. |
| 587 |
% |
| 588 |
% \DescribeRoutine{dots} |
| 589 |
% |dots| is shorthand for a dotted linestyle. Use it like: |draw ... dots;|. |
| 590 |
% |
| 591 |
% \DescribeRoutine{drawgrid} |
| 592 |
% |drawgrid| draws a 16 by 21cm, 1cm spaced grid composed of thin dashed lines. |
| 593 |
% Labels are typeset giving the distance of the lines from the bottom left |
| 594 |
% corner of the grid in millimetres. |
| 595 |
% |
| 596 |
% \subsubsection{Path routines} |
| 597 |
% |
| 598 |
% The package provides some general path making routines. |
| 599 |
% |
| 600 |
% \DescribeRoutine{sharply} |
| 601 |
% |sharply(zi, zj, ... zn)| will generate a piecewise linear |
| 602 |
% path consisting of the |
| 603 |
% straight lines from point |zi| to point |zj| \ldots to point |zn|. |
| 604 |
% It may be used like: \\ |
| 605 |
% |draw sharply(z1, z2, z3, z4);| \\ |
| 606 |
% to draw a line through the given points. |
| 607 |
% |
| 608 |
% \DescribeRoutine{smoothly} |
| 609 |
% Like the |sharply| routine, |smoothly(zi, zj, ... zn)| will generate a |
| 610 |
% piecewise linear path consisting of the |
| 611 |
% straight lines from point |zi| to point |zj| \ldots to point |zn|, except |
| 612 |
% that the corners of the path at the interior points are rounded with an |
| 613 |
% arc of radius |smoothrad|. |
| 614 |
% It may be used like: \\ |
| 615 |
% |draw smoothly(z1, z2, z3, z4) dashes;| \\ |
| 616 |
% to draw a dashed line with rounded corners at the given points. Or if |
| 617 |
% a dotted line is needed: |
| 618 |
% \begin{verbatim} |
| 619 |
% pickup dotspen; |
| 620 |
% draw smoothly(z1, z2, z3, z4) dots; |
| 621 |
% pickup normalpen; |
| 622 |
% \end{verbatim} |
| 623 |
% |
| 624 |
% \DescribeRoutine{~} |
| 625 |
% Like the |&| operator, the binary |~| operator concatenates two paths |
| 626 |
% replacing the sharp join with a circular arc of radius |smoothrad|. |
| 627 |
% |
| 628 |
% \subsubsection{Line drawing routines} |
| 629 |
% |
| 630 |
% Routines are provided for drawing a variety of lines with differing line |
| 631 |
% ending styles. Line styles include dotted, dashed, and continuous, and line |
| 632 |
% thicknesses may be normal or thick. Line end styles include open circles, |
| 633 |
% black dots, open and closed (black) arrowheads, and a fanin style. |
| 634 |
% |
| 635 |
% The final uppercase characters of a line drawing routine indicate the kind |
| 636 |
% of line end style that will be used. |
| 637 |
% The character |O| (uppercase O, not zero) is for an \textbf{O}pen circle, |
| 638 |
% |D| is for a black \textbf{D}ot, |
| 639 |
% |OA| is for an \textbf{O}pen \textbf{A}rrowhead, |
| 640 |
% |CA| is for a \textbf{C}losed (black) \textbf{A}rrowhead, |
| 641 |
% and |F| is for a \textbf{F}anin. |
| 642 |
% |
| 643 |
% The line ending drawing routines are described first. |
| 644 |
% \DescribeRoutine{drawO} |
| 645 |
% |drawO(i, j)| draws an open circle, diameter |dotdiam|, at the |zj| end |
| 646 |
% of the vector from |zi| to |zj|. |
| 647 |
% |
| 648 |
% \DescribeRoutine{drawD} |
| 649 |
% |drawD(i, j)| draws a black dot, diameter |dotdiam|, at the |zj| end |
| 650 |
% of the vector from |zi| to |zj|. |
| 651 |
% |
| 652 |
% \DescribeRoutine{drawOA} |
| 653 |
% |drawOA(i, j)| draws an open arrowhead, length |gal| and base width |
| 654 |
% |gab|, at the |zj| end |
| 655 |
% of the vector from |zi| to |zj|. |
| 656 |
% |
| 657 |
% \DescribeRoutine{drawCA} |
| 658 |
% |drawCA(i, j)| draws a closed (black) arrowhead, length |gal| and base width |
| 659 |
% |gab|, at the |zj| end |
| 660 |
% of the vector from |zi| to |zj|. |
| 661 |
% |
| 662 |
% \DescribeRoutine{drawF} |
| 663 |
% |drawF(i, j)| draws a fanin, length |gfl| and base width |gfb|, |
| 664 |
% at the |zj| end |
| 665 |
% of the vector from |zi| to |zj|. |
| 666 |
% |
| 667 |
% The line drawing routines are essentially prepackaged versions of |
| 668 |
% different combinations of the path and line ending routines. |
| 669 |
% |
| 670 |
% \DescribeRoutine{drawdots} |
| 671 |
% |drawdots(i, j)| draws the dotted line |zi--zj|. |
| 672 |
% |
| 673 |
% \DescribeRoutine{drawdotsthree} |
| 674 |
% |drawdotsthree(i, j, k)| draws the dotted piecewise linear line |zi--zj--zk|. |
| 675 |
% |
| 676 |
% \DescribeRoutine{drawdotsfour} |
| 677 |
% |drawdotsfour(i, j, k, l)| draws the dotted piecewise linear line |zi--zj--zk--zl|. |
| 678 |
% |
| 679 |
% \DescribeRoutine{drawdotsO} |
| 680 |
% |drawdotsO(i, j)| draws the dotted line |zi--zj|, |
| 681 |
% ending in an open circle, diameter |dotdiam|, at |zj|. |
| 682 |
% |
| 683 |
% \DescribeRoutine{drawdotsthreeO} |
| 684 |
% |drawdotsthreeO(i, j, k)| draws the dotted piecewise linear line |zi--zj--zk|. |
| 685 |
% ending in an open circle, diameter |dotdiam|, at |zk|. |
| 686 |
% |
| 687 |
% \DescribeRoutine{drawdotsfourO} |
| 688 |
% |drawdotsfourO(i, j, k, l)| draws the dotted piecewise linear line |zi--zj--zk--zl|, |
| 689 |
% ending in an open circle, diameter |dotdiam|, at |zl|. |
| 690 |
% |
| 691 |
% \DescribeRoutine{drawdotsOO} |
| 692 |
% |drawdotsOO(i, j)| draws the dotted line |zi--zj|, |
| 693 |
% ending in open circles, diameter |dotdiam|, at |zi| and |zj|. |
| 694 |
% |
| 695 |
% \DescribeRoutine{drawdash} |
| 696 |
% |drawdash(i, j)| draws the dashed line |zi--zj|. |
| 697 |
% |
| 698 |
% \DescribeRoutine{drawdashthree} |
| 699 |
% |drawdashthree(i, j, k)| draws the dashed piecewise linear line |zi--zj--zk|. |
| 700 |
% |
| 701 |
% \DescribeRoutine{drawdashfour} |
| 702 |
% |drawdashfour(i, j, k, l)| draws the dashed piecewise linear line |zi--zj--zk--zl|. |
| 703 |
% |
| 704 |
% \DescribeRoutine{drawdashO} |
| 705 |
% |drawdashO(i, j)| draws the dashed line |zi--zj|, |
| 706 |
% ending in an open circle, diameter |dotdiam|, at |zj|. |
| 707 |
% |
| 708 |
% \DescribeRoutine{drawdashthreeO} |
| 709 |
% |drawdashthreeO(i, j, k)| draws the dashed piecewise linear line |zi--zj--zk|. |
| 710 |
% ending in an open circle, diameter |dotdiam|, at |zk|. |
| 711 |
% |
| 712 |
% \DescribeRoutine{drawdashfourO} |
| 713 |
% |drawdashfourO(i, j, k, l)| draws the dashed piecewise linear line |zi--zj--zk--zl|. |
| 714 |
% ending in an open circle, diameter |dotdiam|, at |zl|. |
| 715 |
% |
| 716 |
% \DescribeRoutine{drawdashOO} |
| 717 |
% |drawdashOO(i, j)| draws the dashed line |zi--zj--zk--zl|. |
| 718 |
% ending in open circles, diameter |dotdiam|, at |zi| and |zj|. |
| 719 |
% |
| 720 |
% \DescribeRoutine{drawnormal} |
| 721 |
% |drawnormal(i, j)| draws the normal thickness line |zi--zj|. |
| 722 |
% |
| 723 |
% \DescribeRoutine{drawnormalthree} |
| 724 |
% |drawnormalthree(i, j, k)| draws the normal thickness piecewise linear |
| 725 |
% line |zi--zj--zk|. |
| 726 |
% |
| 727 |
% \DescribeRoutine{drawnormalfour} |
| 728 |
% |drawnormalfour(i, j, k, l)| draws the normal thickness piecewise linear |
| 729 |
% line |zi--zj--zk--zl|. |
| 730 |
% |
| 731 |
% \DescribeRoutine{drawnormalO} |
| 732 |
% |drawnormalO(i, j)| draws the normal thickness line |zi--zj|, |
| 733 |
% ending in an open circle, diameter |dotdiam|, at |zj|. |
| 734 |
% |
| 735 |
% \DescribeRoutine{drawnormalthreeO} |
| 736 |
% |drawnormalthreeO(i, j, k)| draws the normal thickness piecewise linear |
| 737 |
% line |zi--zj--zk|, |
| 738 |
% ending in an open circle, diameter |dotdiam|, at |zk|. |
| 739 |
% |
| 740 |
% \DescribeRoutine{drawnormalfourO} |
| 741 |
% |drawnormalfourO(i, j, k, l)| draws the normal thickness piecewise linear |
| 742 |
% line |zi--zj--zk--zl|, |
| 743 |
% ending in an open circle, diameter |dotdiam|, at |zl|. |
| 744 |
% |
| 745 |
% \DescribeRoutine{drawnormalOO} |
| 746 |
% |drawnormalOO(i, j)| draws the normal thickness line |zi--zj|, |
| 747 |
% ending in open circles, diameter |dotdiam|, at |zi| and |zj|. |
| 748 |
% |
| 749 |
% \DescribeRoutine{drawnormalD} |
| 750 |
% |drawnormalD(i, j)| draws the normal thickness line |zi--zj|, |
| 751 |
% ending in a black dot, diameter |dotdiam|, at |zj|. |
| 752 |
% |
| 753 |
% \DescribeRoutine{drawnormalthreeD} |
| 754 |
% |drawnormalthreeD(i, j, k)| draws the normal thickness piecewise linear |
| 755 |
% line |zi--zj--zk|, |
| 756 |
% ending in a black dot, diameter |dotdiam|, at |zk|. |
| 757 |
% |
| 758 |
% \DescribeRoutine{drawnormalfourD} |
| 759 |
% |drawnormalfourD(i, j, k, l)| draws the normal thickness piecewise linear |
| 760 |
% line |zi--zj--zk--zl|, |
| 761 |
% ending in a black dot, diameter |dotdiam|, at |zl|. |
| 762 |
% |
| 763 |
% \DescribeRoutine{drawnormalDD} |
| 764 |
% |drawnormalDD(i, j)| draws the normal thickness line |zi--zj|, |
| 765 |
% ending in black dots, diameter |dotdiam|, at |zi| and |zj|. |
| 766 |
% |
| 767 |
% \DescribeRoutine{drawnormalCA} |
| 768 |
% |drawnormalCA(i, j)| draws the normal thickness line |zi--zj|, |
| 769 |
% ending in a closed (black) arrowhead, length |gal| and base width |gab|, |
| 770 |
% at |zj|. |
| 771 |
% |
| 772 |
% \DescribeRoutine{drawnormalthreeCA} |
| 773 |
% |drawnormalthreeCA(i, j, k)| draws the normal thickness piecewise linear |
| 774 |
% line |zi--zj--zk| |
| 775 |
% ending in a closed (black) arrowhead, length |gal| and base width |gab|, |
| 776 |
% at |zk|. |
| 777 |
% |
| 778 |
% \DescribeRoutine{drawnormalfourCA} |
| 779 |
% |drawnormalfourCA(i, j, k, l)| draws the normal thickness piecewise linear |
| 780 |
% line |zi--zj--zk--zl| |
| 781 |
% ending in a closed (black) arrowhead, length |gal| and base width |gab|, |
| 782 |
% at |zl|. |
| 783 |
% |
| 784 |
% \DescribeRoutine{drawnormalOA} |
| 785 |
% |drawnormalOA(i, j)| draws the normal thickness line |zi--zj|, |
| 786 |
% ending in an open arrowhead, length |gal| and base width |gab|, |
| 787 |
% at |zj|. |
| 788 |
% |
| 789 |
% \DescribeRoutine{drawnormalF} |
| 790 |
% |drawnormalF(i, j)| draws the normal thickness line |zi--zj|, |
| 791 |
% ending in a fanin, length |gfl| and base width |gfb|, |
| 792 |
% at |zj|. |
| 793 |
% |
| 794 |
% \DescribeRoutine{drawnormalFO} |
| 795 |
% |drawnormalFO(i, j)| draws the normal thickness line |zi--zj|, |
| 796 |
% ending in a fanin, length |gfl| and base width |gfb|, |
| 797 |
% at |zi| and an open circle, diameter |dotdiam|, at |zj|. |
| 798 |
% |
| 799 |
% \DescribeRoutine{drawthick} |
| 800 |
% |drawthick(i, j)| draws the thick line |zi--zj|. |
| 801 |
% |
| 802 |
% \DescribeRoutine{drawthickO} |
| 803 |
% |drawthickO(i, j)| draws the thick line |zi--zj|, |
| 804 |
% ending in an open circle, diameter |dotdiam|, at |zj|. |
| 805 |
% |
| 806 |
% \DescribeRoutine{drawthickOO} |
| 807 |
% |drawthickOO(i, j)| draws the thick line |zi--zj|, |
| 808 |
% ending in open circles, diameter |dotdiam|, at |zi| and |zj|. |
| 809 |
% |
| 810 |
% \DescribeRoutine{smooth} |
| 811 |
% |smooth(i, j, k)| replaces the sharp corner on the line |zi--zj--zk| |
| 812 |
% with an arc radius |smoothrad|. |
| 813 |
% |
| 814 |
% \DescribeRoutine{smoothtwo} |
| 815 |
% |smoothtwo(i, j, k, l)| replaces the sharp corners on the line |zi--zj--zk--zl| |
| 816 |
% with arcs radius |smoothrad|. |
| 817 |
% |
| 818 |
% \DescribeRoutine{smoothdash} |
| 819 |
% |smoothdash(i, j, k)| replaces the sharp corner on the dashed line |zi--zj--zk| |
| 820 |
% with an arc radius |smoothrad|. |
| 821 |
% |
| 822 |
% \DescribeRoutine{smoothdots} |
| 823 |
% |smoothdots(i, j, k)| replaces the sharp corner on the dotted line |zi--zj--zk| |
| 824 |
% with an arc radius |smoothrad|. |
| 825 |
% |
| 826 |
% |
| 827 |
% |
| 828 |
% \subsubsection{Box drawing routines} |
| 829 |
% |
| 830 |
% Routines are provided for drawing the different kinds of \ExpressG{} |
| 831 |
% boxes. |
| 832 |
% |
| 833 |
% The first argument to the box drawing routines is the suffix of the |
| 834 |
% point that will be the left-hand bottom corner point of the box. The |
| 835 |
% last argument, except where noted below, is the text that is to be placed |
| 836 |
% at the center of the box. Intermediate arguments, if any, are the length |
| 837 |
% and height of the box. |
| 838 |
% |
| 839 |
% Every box routine calculates the four corner points of the box and the |
| 840 |
% midpoints of each side of the box. For example, if the suffix is |j|, |
| 841 |
% then as illustrated in figure~\ref{fig:boxpoints}, the corner points |
| 842 |
% will be called |zjbl|, |zjbr|, |zjtr| and |zjtl| and the midpoints |
| 843 |
% will be called |zjbm|, |zjmr|, |zjtm| and |zjml|. The center point for |
| 844 |
% postioning the text is |zjc| and the center of the text is placed at |
| 845 |
% this point. |
| 846 |
% |
| 847 |
% The text center point is not necessarily the geometric center of the box. |
| 848 |
% The geometric center is not calculated but lies at the intersection of |
| 849 |
% the lines |zjml--zjmr| and |zjbm--zjtm|. |
| 850 |
% |
| 851 |
% \begin{figure} |
| 852 |
% \centering |
| 853 |
% \setlength{\unitlength}{1mm} |
| 854 |
% \begin{picture}(50,40) |
| 855 |
% \put(0,0){\framebox(50,40){}} |
| 856 |
% \put(10,10){\begin{picture}(30,20) |
| 857 |
% \put(0,0){\framebox(30,20){}} |
| 858 |
% \multiput(0,0)(15,0){3}{\circle*{2}} |
| 859 |
% \multiput(0,10)(15,0){3}{\circle*{2}} |
| 860 |
% \multiput(0,20)(15,0){3}{\circle*{2}} |
| 861 |
% \put(-2,-2){\makebox(0,0)[tr]{\texttt{zjbl}}} |
| 862 |
% \put(15,-2){\makebox(0,0)[t]{\texttt{zjbm}}} |
| 863 |
% \put(32,-2){\makebox(0,0)[tl]{\texttt{zjbr}}} |
| 864 |
% \put(-2,10){\makebox(0,0)[r]{\texttt{zjml}}} |
| 865 |
% \put(13,10){\makebox(0,0)[r]{\texttt{zjc}}} |
| 866 |
% \put(32,10){\makebox(0,0)[l]{\texttt{zjmr}}} |
| 867 |
% \put(-2,22){\makebox(0,0)[br]{\texttt{zjtl}}} |
| 868 |
% \put(15,22){\makebox(0,0)[b]{\texttt{zjtm}}} |
| 869 |
% \put(32,22){\makebox(0,0)[bl]{\texttt{zjtr}}} |
| 870 |
% \end{picture}} |
| 871 |
% \end{picture} |
| 872 |
% \setlength{\unitlength}{1pt} |
| 873 |
% \caption[Calculated points on rectangular boxes]% |
| 874 |
% {Calculated points on rectangular boxes |
| 875 |
% (suffix is \texttt{j} and located at \texttt{zjbl=zj})} |
| 876 |
% \label{fig:boxpoints} |
| 877 |
% \end{figure} |
| 878 |
% |
| 879 |
% \DescribeRoutine{drawSCHEMA} |
| 880 |
% A SCHEMA box is rectangular with a normal perimeter and the box is divided |
| 881 |
% into top and bottom halves by a horizontal line. |
| 882 |
% |
| 883 |
% |drawSCHEMA(j, len, ht)(btex schema\_a etex)| draws a SCHEMA double rectangular |
| 884 |
% box of length |len| and height |ht| with its left-hand bottom corner |
| 885 |
% at |zj|. The string |schema_a| is placed at the text center of the box, |
| 886 |
% which is central within the upper half. |
| 887 |
% |
| 888 |
% \DescribeRoutine{drawBINARY} |
| 889 |
% A simple data type box is rectangular with a solid boundary and a solid |
| 890 |
% interior vertical line near the right hand edge. |
| 891 |
% |
| 892 |
% |drawBINARY(j)| draws a simple data type rectangular |
| 893 |
% box of length |sdtbl| and height |sdtbh| with its left-hand bottom corner |
| 894 |
% at |zj|. The string |BINARY| is placed at the text center of the box, |
| 895 |
% which is central within the main part of the box. |
| 896 |
% |
| 897 |
% \DescribeRoutine{drawBOOLEAN} |
| 898 |
% |drawBOOLEAN(j)| draws a simple data type rectangular |
| 899 |
% box of length |sdtbl| and height |sdtbh| with its left-hand bottom corner |
| 900 |
% at |zj|. The string |BOOLEAN| is placed at the text center of the box, |
| 901 |
% which is central within the main part of the box. |
| 902 |
% |
| 903 |
% \DescribeRoutine{drawCOMPLEX} |
| 904 |
% |drawCOMPLEX(j)| draws a simple data type rectangular |
| 905 |
% box of length |sdtbl| and height |sdtbh| with its left-hand bottom corner |
| 906 |
% at |zj|. The string |COMPLEX| is placed at the text center of the box, |
| 907 |
% which is central within the main part of the box. |
| 908 |
% |
| 909 |
% \DescribeRoutine{drawEXPRESSION} |
| 910 |
% |drawEXPRESSION(j)| draws a simple data type rectangular |
| 911 |
% box of length |sdtbel| and height |sdtbeh| with its left-hand bottom corner |
| 912 |
% at |zj|. The string |EXPRESSION| is placed at the text center of the box, |
| 913 |
% which is central within the main part of the box. |
| 914 |
% |
| 915 |
% \DescribeRoutine{drawGENERIC} |
| 916 |
% |drawGENERIC(j)| draws a simple data type rectangular |
| 917 |
% box of length |sdtbl| and height |sdtbh| with its left-hand bottom corner |
| 918 |
% at |zj|. The string |GENERIC| is placed at the text center of the box, |
| 919 |
% which is central within the main part of the box. |
| 920 |
% |
| 921 |
% \DescribeRoutine{drawINTEGER} |
| 922 |
% |drawINTEGER(j)| draws a simple data type rectangular |
| 923 |
% box of length |sdtbl| and height |sdtbh| with its left-hand bottom corner |
| 924 |
% at |zj|. The string |INTEGER| is placed at the text center of the box, |
| 925 |
% which is central within the main part of the box. |
| 926 |
% |
| 927 |
% \DescribeRoutine{drawLOGICAL} |
| 928 |
% |drawLOGICAL(j)| draws a simple data type rectangular |
| 929 |
% box of length |sdtbl| and height |sdtbh| with its left-hand bottom corner |
| 930 |
% at |zj|. The string |LOGICAL| is placed at the text center of the box, |
| 931 |
% which is central within the main part of the box. |
| 932 |
% |
| 933 |
% \DescribeRoutine{drawNUMBER} |
| 934 |
% |drawNUMBER(j)| draws a simple data type rectangular |
| 935 |
% box of length |sdtbl| and height |sdtbh| with its left-hand bottom corner |
| 936 |
% at |zj|. The string |NUMBER| is placed at the text center of the box, |
| 937 |
% which is central within the main part of the box. |
| 938 |
% |
| 939 |
% \DescribeRoutine{drawREAL} |
| 940 |
% |drawREAL(j)| draws a simple data type rectangular |
| 941 |
% box of length |sdtbl| and height |sdtbh| with its left-hand bottom corner |
| 942 |
% at |zj|. The string |REAL| is placed at the text center of the box, |
| 943 |
% which is central within the main part of the box. |
| 944 |
% |
| 945 |
% \DescribeRoutine{drawSTRING} |
| 946 |
% |drawSTRING(j)| draws a simple data type rectangular |
| 947 |
% box of length |sdtbl| and height |sdtbh| with its left-hand bottom corner |
| 948 |
% at |zj|. The string |STRING| is placed at the text center of the box, |
| 949 |
% which is central within the main part of the box. |
| 950 |
% |
| 951 |
% \DescribeRoutine{drawENUM} |
| 952 |
% An ENUMERATION box is a rectangular box with a dashed perimeter and an |
| 953 |
% interior dashed vertical line near the right hand edge. |
| 954 |
% |
| 955 |
% |drawENUM(j, len, ht)(btex an\_enum etex)| draws a rectangular dashed ENUMERATION type |
| 956 |
% box of length |len| and height |ht| with its left-hand bottom corner |
| 957 |
% at |zj|. The string |an_enum| is placed at the text center of the box, |
| 958 |
% which is central within the main part of the box. |
| 959 |
% |
| 960 |
% \DescribeRoutine{drawSELECT} |
| 961 |
% A SELECT box is rectangular with a dashed boundary and an interior |
| 962 |
% dashed vertical |
| 963 |
% line near the left hand edge. |
| 964 |
% |
| 965 |
% |drawSELECT(j, len, ht)(btex a\_select etex)| draws a rectangular dashed SELECT type |
| 966 |
% box of length |len| and height |ht| with its left-hand bottom corner |
| 967 |
% at |zj|. The string |a_select| is placed at the text center of the box, |
| 968 |
% which is central within the main part of the box. |
| 969 |
% |
| 970 |
% \DescribeRoutine{drawTYPE} |
| 971 |
% A TYPE box is rectangular with a dashed boundary. |
| 972 |
% |
| 973 |
% |drawTYPE(j, len, ht)(btex a\_type etex)| draws a rectangular dashed TYPE type |
| 974 |
% box of length |len| and height |ht| with its left-hand bottom corner |
| 975 |
% at |zj|. The string |a_type| is placed at the text center of the box, |
| 976 |
% which is central within the main part of the box. |
| 977 |
% |
| 978 |
% \DescribeRoutine{drawENT} |
| 979 |
% An ENTITY box is a rectangular box with a solid boundary. |
| 980 |
% |
| 981 |
% |drawENT(j, len, ht)(btex an\_entity etex)| draws a rectangular ENTITY type |
| 982 |
% box of length |len| and height |ht| with its left-hand bottom corner |
| 983 |
% at |zj|. The string |an_entity| is placed at the text center of the box, |
| 984 |
% which is also the geometric center of the box. |
| 985 |
% |
| 986 |
% \DescribeRoutine{drawPREF} |
| 987 |
% A page reference box is a rectangle with rounded ends and a solid boundary. |
| 988 |
% |
| 989 |
% |drawPREF(j, len, ht)(btex page ref etex)| draws an oval page |
| 990 |
% reference |
| 991 |
% box of length |len| and height |ht| with its left-hand bottom corner |
| 992 |
% at |zj|. The string |page ref| is placed at the text center of the box, |
| 993 |
% which is also the geometric center of the box. |
| 994 |
% |
| 995 |
% \DescribeRoutine{drawISU} |
| 996 |
% An interschema box is a rectangle surrounding a page reference like box. |
| 997 |
% The rectangular box may have either a solid or a dashed boundary. |
| 998 |
% |
| 999 |
% |drawISU(j, len, ht)(btex sch.ent etex)| draws a three-part rectangular |
| 1000 |
% interschema USE |
| 1001 |
% box of length |len| and height |ht| with its left-hand bottom corner |
| 1002 |
% at |zj|. The string |sch.ent| is placed at the text center of the box, |
| 1003 |
% which is also the geometric center of the box. |
| 1004 |
% |
| 1005 |
% \DescribeRoutine{drawISUR} |
| 1006 |
% |drawISUR(j, len, ht)(btex sch.ent etex)(btex newname etex)| draws a three-part rectangular |
| 1007 |
% interschema USE and RENAME |
| 1008 |
% box of length |len| and height |ht| with its left-hand bottom corner |
| 1009 |
% at |zj|. The string |sch.ent| is placed at the text center of the box, |
| 1010 |
% which is also the geometric center of the box. The string |newname| is |
| 1011 |
% placed at the geometric center of the bottom third of the box (this is |
| 1012 |
% the point |zjrnm|). |
| 1013 |
% |
| 1014 |
% \DescribeRoutine{drawISR} |
| 1015 |
% |drawISR(j, len, ht)(btex sch.ent etex)| draws a three-part rectangular |
| 1016 |
% dashed interschema REFERENCE |
| 1017 |
% box of length |len| and height |ht| with its left-hand bottom corner |
| 1018 |
% at |zj|. The string |sch.ent| is placed at the text center of the box, |
| 1019 |
% which is also the geometric center of the box. |
| 1020 |
% |
| 1021 |
% \DescribeRoutine{drawISRR} |
| 1022 |
% |drawISRR(j, len, ht)(btex sch.ent etex)(btex newname etex)| draws a three-part rectangular |
| 1023 |
% dashed interschema REFERENCE and RENAME |
| 1024 |
% box of length |len| and height |ht| with its left-hand bottom corner |
| 1025 |
% at |zj|. The string |sch.ent| is placed at the text center of the box, |
| 1026 |
% which is also the geometric center of the box. The string |newname| is |
| 1027 |
% placed at the geometric center of the bottom third of the box (this is |
| 1028 |
% the point |zjrnm|). |
| 1029 |
% |
| 1030 |
% \DescribeRoutine{drawLEVENT} |
| 1031 |
% An EVENT box is a rhomboid with a solid boundary. |
| 1032 |
% |
| 1033 |
% |drawLEVENT(j, len, ht)(btex local\_event etex)| draws a rhomboidal |
| 1034 |
% Local EVENT |
| 1035 |
% box of length |len|, height |ht| and slope |eventslope| with its left-hand bottom corner |
| 1036 |
% at |zj|. The string |local_event| is placed at the text center of the box, |
| 1037 |
% which is also the geometric center of the box. Like the rectangular boxes, |
| 1038 |
% the calculated bottom and top middle points are vertically below and above |
| 1039 |
% the geometric center, but this means that they are \emph{not} midway |
| 1040 |
% beteen the bottom and top corner points. This is illustrated in |
| 1041 |
% \fref{fig:eventpoints}. |
| 1042 |
% |
| 1043 |
% \begin{figure} |
| 1044 |
% \centering |
| 1045 |
% \setlength{\unitlength}{1mm} |
| 1046 |
% \begin{picture}(55,40) |
| 1047 |
% \put(0,0){\framebox(55,40){}} |
| 1048 |
% \put(10,10){\begin{picture}(40,20) |
| 1049 |
% ^^A \put(0,0){\framebox(30,20){}} |
| 1050 |
% \put(0,0){\line(1,0){30}} |
| 1051 |
% \put(5,20){\line(1,0){30}} |
| 1052 |
% \put(0,0){\line(1,4){5}} |
| 1053 |
% \put(30,0){\line(1,4){5}} |
| 1054 |
% \multiput(0,0)(30,0){2}{\circle*{2}} |
| 1055 |
% \multiput(2.5,10)(30,0){2}{\circle*{2}} |
| 1056 |
% \multiput(5,20)(30,0){2}{\circle*{2}} |
| 1057 |
% \multiput(17.5,0)(0,10){3}{\circle*{2}} |
| 1058 |
% \put(-2,-2){\makebox(0,0)[tr]{\texttt{zjbl}}} |
| 1059 |
% \put(17.5,-2){\makebox(0,0)[t]{\texttt{zjbm}}} |
| 1060 |
% \put(32,-2){\makebox(0,0)[tl]{\texttt{zjbr}}} |
| 1061 |
% \put(0.5,10){\makebox(0,0)[r]{\texttt{zjml}}} |
| 1062 |
% \put(15.5,10){\makebox(0,0)[r]{\texttt{zjc}}} |
| 1063 |
% \put(34.5,10){\makebox(0,0)[l]{\texttt{zjmr}}} |
| 1064 |
% \put(3,22){\makebox(0,0)[br]{\texttt{zjtl}}} |
| 1065 |
% \put(17.5,22){\makebox(0,0)[b]{\texttt{zjtm}}} |
| 1066 |
% \put(37,22){\makebox(0,0)[bl]{\texttt{zjtr}}} |
| 1067 |
% \end{picture}} |
| 1068 |
% \end{picture} |
| 1069 |
% \setlength{\unitlength}{1pt} |
| 1070 |
% \caption[Calculated points on rhomboidal boxes]% |
| 1071 |
% {Calculated points on rhomboidal boxes |
| 1072 |
% (suffix is \texttt{j} and located at \texttt{zjbl=zj})} |
| 1073 |
% \label{fig:eventpoints} |
| 1074 |
% \end{figure} |
| 1075 |
% |
| 1076 |
% \DescribeRoutine{drawGEVENT} |
| 1077 |
% |drawGEVENT(j, len, ht)(btex global\_event etex)| draws a thick rhomboidal |
| 1078 |
% Global EVENT |
| 1079 |
% box of length |len|, height |ht| and slope |eventslope| with its left-hand bottom corner |
| 1080 |
% at |zj|. The string |global_event| is placed at the text center of the box, |
| 1081 |
% which is also the geometric center of the box. |
| 1082 |
% |
| 1083 |
% |
| 1084 |
% \DescribeRoutine{drawcirclebox} |
| 1085 |
% A circle box is a circle with a solid boundary. |
| 1086 |
% |
| 1087 |
% |drawcirclebox(j, diam)(btex ABC etex)| draws a circle diameter |diam| |
| 1088 |
% and center at |zj|. The string |ABC| is placed at the center of the circle. |
| 1089 |
% In this case the four midside points, |zjbm|, |zjmr|, |zjtm| and |zjml|, |
| 1090 |
% are at on the circle at the extreme bottom, right, top and left (i.e., at |
| 1091 |
% the S, E, N and W compass points). The |
| 1092 |
% corner points, |zjbl|, |zjbr|, |zjtr| and |zjtl|, are also on the |
| 1093 |
% circumference midway between the midpoints (i.e., at the SW, SE, NE and NW |
| 1094 |
% compass points). |
| 1095 |
% |
| 1096 |
% \DescribeRoutine{drawdashcircle} |
| 1097 |
% |drawdashcircle(j, diam)| draws a dashed circle. The location |
| 1098 |
% and size parameters are the same as for |drawcirclebox|, as are the |
| 1099 |
% calculated points. |
| 1100 |
% |
| 1101 |
% \subsection{Extra BLA variables and routines} |
| 1102 |
% |
| 1103 |
% In addition to the facilities described above for \ExpressG{} |
| 1104 |
% diagrams, extra line styles and boxes are provided for other |
| 1105 |
% kinds of diagrams. |
| 1106 |
% |
| 1107 |
% Additional line end styles are coded by: |
| 1108 |
% |A| for an \textbf{A}rrowhead, |
| 1109 |
% |OD| for an \textbf{O}pen \textbf{D}iamond, |
| 1110 |
% |CD| for a \textbf{C}losed \textbf{D}iamond. |
| 1111 |
% |
| 1112 |
% \DescribeVariable{gdl} |
| 1113 |
% \DescribeVariable{gdb} |
| 1114 |
% The variables |gdl| and |gdb| hold the the length and base width of |
| 1115 |
% diamond line end styles (see \fref{fig:diales}), |
| 1116 |
% analagous to the corresponding variables |
| 1117 |
% for arrow heads and fanin. By default, |gdl| is twice the default |
| 1118 |
% arrowhead length and |gdb| is three quarters of the default |
| 1119 |
% arrowhead base width. |
| 1120 |
% |
| 1121 |
% \begin{figure} |
| 1122 |
% \setlength{\unitlength}{1mm} |
| 1123 |
% \centering |
| 1124 |
% \begin{picture}(90,40) |
| 1125 |
% \put(0,0){\framebox(90,40){}} |
| 1126 |
% \put(5,0){\begin{picture}(85,40) |
| 1127 |
% ^^A \put(0,0){\framebox(85,40){}} |
| 1128 |
% \thicklines |
| 1129 |
% \put(0,20){\line(1,0){10}} |
| 1130 |
% ^^A \put(10,10){\line(2,1){20}} |
| 1131 |
% ^^A \put(10,30){\line(2,-1){20}} |
| 1132 |
% ^^A \put(10,10){\line(0,1){20}} |
| 1133 |
% \put(10,20){\line(2,1){20}} |
| 1134 |
% \put(10,20){\line(2,-1){20}} |
| 1135 |
% \put(50,20){\line(-2,1){20}} |
| 1136 |
% \put(50,20){\line(-2,-1){20}} |
| 1137 |
% \thinlines |
| 1138 |
% ^^A \put(10,5){\vector(1,0){20}} \put(10,5){\vector(-1,0){0}} |
| 1139 |
% ^^A \put(20,3){\makebox(0,0)[t]{length}} |
| 1140 |
% ^^A \put(35,10){\vector(0,1){20}} \put(35,10){\vector(0,-1){0}} |
| 1141 |
% ^^A \put(40,20){\makebox(0,0)[l]{base width}} |
| 1142 |
% \put(10,5){\vector(1,0){40}} \put(10,5){\vector(-1,0){0}} |
| 1143 |
% \put(30,3){\makebox(0,0)[t]{length}} |
| 1144 |
% \put(55,10){\vector(0,1){20}} \put(55,10){\vector(0,-1){0}} |
| 1145 |
% \put(60,20){\makebox(0,0)[l]{base width}} |
| 1146 |
% \end{picture}} |
| 1147 |
% \end{picture} |
| 1148 |
% \caption{Length parameters for diamond line end styles}\label{fig:diales} |
| 1149 |
% \end{figure} |
| 1150 |
% |
| 1151 |
% \DescribeRoutine{drawA} |
| 1152 |
% |drawA(i, j)| draws a simple arrowhead, length |gal| and base width |
| 1153 |
% |gab|, at the |zj| end |
| 1154 |
% of the vector from |zi| to |zj|. |
| 1155 |
% |
| 1156 |
% |
| 1157 |
% \DescribeRoutine{drawDCA} |
| 1158 |
% |drawDCA(i, j)| draws a double closed arrowhead, each of length |gal| |
| 1159 |
% and base width |
| 1160 |
% |gab|, at the |zj| end |
| 1161 |
% of the vector from |zi| to |zj|. |
| 1162 |
% |
| 1163 |
% |
| 1164 |
% \DescribeRoutine{drawOD} |
| 1165 |
% |drawOD(i, j)| draws an open diamond, length |gdl| and base width |
| 1166 |
% |gdb|, at the |zj| end |
| 1167 |
% of the vector from |zi| to |zj|. |
| 1168 |
% |
| 1169 |
% \DescribeRoutine{drawCD} |
| 1170 |
% |drawCD(i, j)| draws a closed (black) diamond, length |gdl| and base width |
| 1171 |
% |gdb|, at the |zj| end |
| 1172 |
% of the vector from |zi| to |zj|. |
| 1173 |
% |
| 1174 |
% |
| 1175 |
% \DescribeRoutine{drawdashA} |
| 1176 |
% |drawdashA(i, j)| draws the dashed line |zi--zj|, |
| 1177 |
% ending in an arrowhead, length |gal| and base width |gab|, |
| 1178 |
% at |zj|. |
| 1179 |
% |
| 1180 |
% \DescribeRoutine{drawdashOA} |
| 1181 |
% |drawdashOA(i, j)| draws the dashed line |zi--zj|, |
| 1182 |
% ending in an open arrowhead, length |gal| and base width |gab|, |
| 1183 |
% at |zj|. |
| 1184 |
% |
| 1185 |
% \DescribeRoutine{drawnormalOD} |
| 1186 |
% |drawnormalOD(i, j)| draws the normal thickness line |zi--zj|, |
| 1187 |
% ending in an open diamond, length |gdl| and base width |gdb|, |
| 1188 |
% at |zj|. |
| 1189 |
% |
| 1190 |
% \DescribeRoutine{drawnormalCD} |
| 1191 |
% |drawnormalCD(i, j)| draws the normal thickness line |zi--zj|, |
| 1192 |
% ending in a closed (black) diamond, length |gdl| and base width |gdb|, |
| 1193 |
% at |zj|. |
| 1194 |
% |
| 1195 |
% \DescribeRoutine{drawcircleA} |
| 1196 |
% |drawcircleA(j, diam)| draws a circle diameter |diam| centered at |zj|. |
| 1197 |
% A counterclockwise pointing arrow is placed at the top of the circle. |
| 1198 |
% The midside and `corner' points are the same as calculated by |
| 1199 |
% the |drawcirclebox| routine. |
| 1200 |
% |
| 1201 |
% \DescribeRoutine{drawDot} |
| 1202 |
% |drawDot(j, diam)| draws a black dot, diameter |diam| centered at |zj|. |
| 1203 |
% There are no calculated points. |
| 1204 |
% |
| 1205 |
% \DescribeRoutine{drawCircledDot} |
| 1206 |
% |drawCircledDot(j, diam)| draws a black dot with a circle outside |
| 1207 |
% it, overall diameter |diam|, centered at |zj|. |
| 1208 |
% There are no calculated points. This could be used for a UML |
| 1209 |
% `bullseye'. The white ring should obscure anything |
| 1210 |
% drawn earlier that lies underneath it (by definition the black dot covers |
| 1211 |
% up anything underneath itself). For example: |
| 1212 |
% \begin{verbatim} |
| 1213 |
% draw z1--z2; % line from z1 to z2 |
| 1214 |
% drawCircledDot(2, len); % obscures last len of above line |
| 1215 |
% draw z3--z2; % not obscured |
| 1216 |
% \end{verbatim} |
| 1217 |
% |
| 1218 |
% Commands of the form |draw...box| have a text argument |
| 1219 |
% which is printed at the center of the box. If an empty box is |
| 1220 |
% required the text argument should be an empty string (|""|). For |
| 1221 |
% example |draw...box(...)("")|. |
| 1222 |
% |
| 1223 |
% \DescribeRoutine{drawcardbox} |
| 1224 |
% |drawcardbox(j, len, ht, fold)(btex note etex)| draws a rectangular |
| 1225 |
% box, length |len| and height |ht|, with its bottom left corner at |zj|. |
| 1226 |
% The top right corner of the box is folded down, with the side length |
| 1227 |
% of the fold given by |fold|. The string |note| is placed at the |
| 1228 |
% center of the box. If no text is required, then use an empty string (i.e., |
| 1229 |
% |""|), as in \\ |
| 1230 |
% |\drawcardbox(23, el, eh, 1/8eh)("")| |
| 1231 |
% |
| 1232 |
% \DescribeRoutine{drawdiamondbox} |
| 1233 |
% |drawdiamondbox(j, len, ht)(btex str etex)| draws a diamond shaped |
| 1234 |
% box, length |len| and height |ht|, with its center at |zj|. The usual |
| 1235 |
% corner, center and midpoints are also calculated except that the points |
| 1236 |
% |z$tm| etc., are at the corners of the diamond and the points |z$tl| etc., |
| 1237 |
% are at the middle of each line, as shown in \fref{fig:diamondpoints}. |
| 1238 |
% The text |str| is placed at the center of the box. |
| 1239 |
% |
| 1240 |
% \begin{figure} |
| 1241 |
% \centering |
| 1242 |
% \setlength{\unitlength}{1mm} |
| 1243 |
% \begin{picture}(50,40) |
| 1244 |
% \put(0,0){\framebox(50,40){}} |
| 1245 |
% \put(10,10){\begin{picture}(30,20) |
| 1246 |
% ^^A \put(0,0){\framebox(30,20){}} |
| 1247 |
% \put(0,10){\line(3,2){15}} |
| 1248 |
% \put(0,10){\line(3,-2){15}} |
| 1249 |
% \put(30,10){\line(-3,2){15}} |
| 1250 |
% \put(30,10){\line(-3,-2){15}} |
| 1251 |
% \multiput(0,10)(15,0){3}{\circle*{2}} |
| 1252 |
% \multiput(15,0)(0,20){2}{\circle*{2}} |
| 1253 |
% \multiput(7.5,5)(0,10){2}{\circle*{2}} |
| 1254 |
% \multiput(22.5,5)(0,10){2}{\circle*{2}} |
| 1255 |
% \put(13,10){\makebox(0,0)[r]{\texttt{zjc}}} |
| 1256 |
% \put(15,-2){\makebox(0,0)[t]{\texttt{zjbm}}} |
| 1257 |
% \put(-2,10){\makebox(0,0)[r]{\texttt{zjml}}} |
| 1258 |
% \put(32,10){\makebox(0,0)[l]{\texttt{zjmr}}} |
| 1259 |
% \put(15,22){\makebox(0,0)[b]{\texttt{zjtm}}} |
| 1260 |
% |
| 1261 |
% \put(5.5,3){\makebox(0,0)[tr]{\texttt{zjbl}}} |
| 1262 |
% \put(24.5,3){\makebox(0,0)[tl]{\texttt{zjbr}}} |
| 1263 |
% \put(5.5,17){\makebox(0,0)[br]{\texttt{zjtl}}} |
| 1264 |
% \put(24.5,17){\makebox(0,0)[bl]{\texttt{zjtr}}} |
| 1265 |
% \end{picture}} |
| 1266 |
% \end{picture} |
| 1267 |
% \setlength{\unitlength}{1pt} |
| 1268 |
% \caption[Calculated points on diamond boxes]% |
| 1269 |
% {Calculated points on diamond boxes |
| 1270 |
% (suffix is \texttt{j} and located at \texttt{zjc=zj})} |
| 1271 |
% \label{fig:diamondpoints} |
| 1272 |
% \end{figure} |
| 1273 |
% |
| 1274 |
% |
| 1275 |
% \DescribeRoutine{drawtwodiamondbox} |
| 1276 |
% |drawtwodiamondbox(j, len, ht, inset)(btex str etex)| draws a diamond shaped |
| 1277 |
% box, length |len| and height |ht|, with its center at |zj|. |
| 1278 |
% The text |str| is placed at the center of the box. |
| 1279 |
% A second diamond is drawn inside the first. The parameter |inset| is |
| 1280 |
% the space between adjacent outer and inner lines. |
| 1281 |
% No calculated points are available for the inner diamond. |
| 1282 |
% |
| 1283 |
% \DescribeRoutine{drawdoublerectangle} |
| 1284 |
% |drawdoublerectangle(j, len, ht, tf)| draws a rectangular box, length |len| |
| 1285 |
% and height |ht|, located with its bottom left corner at |zj|. The box |
| 1286 |
% is divided horizontally |
| 1287 |
% into a top and bottom portion, with the height of the top portion being |
| 1288 |
% the fraction |tf| of the total height of the box. The center points of |
| 1289 |
% the two portions are calculated as |zjct| and |zjcb| for the top and |
| 1290 |
% bottom respectively. |
| 1291 |
% The ends of the dividing line are at |zjtfl| and |zjtfr|. |
| 1292 |
% |
| 1293 |
% \DescribeRoutine{drawtriplerectangle} |
| 1294 |
% |drawtriplerectangle(j, len, ht, tf, bf)| draws a rectangular box, length |len| |
| 1295 |
% and height |ht|, located with its bottom left corner at |zj|. The box |
| 1296 |
% is divided horizontally |
| 1297 |
% into a top, middle and bottom portion. |
| 1298 |
% The height of the top portion is the fraction |tf| of the total height |
| 1299 |
% of the box. |
| 1300 |
% The height of the bottom portion is the fraction |bf| of the total height |
| 1301 |
% of the box. |
| 1302 |
% The center points of |
| 1303 |
% the three portions are calculated as |zjct|, |zjcm| and |zjcb| for the |
| 1304 |
% top, middle and bottom respectively. |
| 1305 |
% The ends of the dividing lines are at |zjtfl| and |zjtfr| for the upper |
| 1306 |
% line, and at |zjbfl| and |zjbfr| for the lower line. |
| 1307 |
% |
| 1308 |
% \DescribeRoutine{hiderectangle} |
| 1309 |
% |hiderectangle(j, len, ht)| draws an invisible rectangular box, length |len| |
| 1310 |
% and height |ht|, located with its bottom left corner at |zj|. The box |
| 1311 |
% covers up anything underneath it. Note that unlike all the other boxes |
| 1312 |
% the only point handle to the box is the bottom left corner --- the |
| 1313 |
% |zjbl|, |zjtr|, etc., points are not available and hence cannot |
| 1314 |
% be used for positioning or alignment purposes. |
| 1315 |
% |
| 1316 |
% \DescribeRoutine{drawdashboxover} |
| 1317 |
% |drawdashboxover(j, len, ht)| draws a dashed rectangular box, length |len| |
| 1318 |
% and height |ht|, located with its bottom left corner at |zj|. The box |
| 1319 |
% covers up anything underneath it. |
| 1320 |
% |
| 1321 |
% \DescribeRoutine{drawindexbox} |
| 1322 |
% |drawindexbox(j, len, ht, lenp, htp)(btex str etex)| |
| 1323 |
% draws a rectangular box, length |len| |
| 1324 |
% and height |ht|, located with its bottom left corner at |zj|. Another |
| 1325 |
% rectangular box, length |lenp| and height |htp|, is drawn with its |
| 1326 |
% bottom left corner at the top left corner of the first box (like an index |
| 1327 |
% card). The main box points are |zjbl| etc., but the secondary box |
| 1328 |
% points are |zjP.bl|, |zjP.bm| etc. The text |str| is placed at the center |
| 1329 |
% (|zjP.c|) of the secondary box. |
| 1330 |
% |
| 1331 |
% \DescribeRoutine{drawroundedbox} |
| 1332 |
% |drawroundedbox(j, len, ht, rad)(btex str etex)| |
| 1333 |
% draws a rectangular box, length |len| |
| 1334 |
% and height |ht|, located with its bottom left corner at |zj|. The corners |
| 1335 |
% of the box are rounded using radius |rad|. If |2rad| is greater |
| 1336 |
% than |len| or |ht|, then |2rad| is reduced to the lesser of |len| and |
| 1337 |
% |ht|, thereby producing at least one pair of semicircular sides. |
| 1338 |
% The text |str| is placed at the center of the box. |
| 1339 |
% |
| 1340 |
% \DescribeRoutine{drawovalbox} |
| 1341 |
% |drawovalbox(j, len, ht)(btex str etex)| |
| 1342 |
% draws an elliptical box, |
| 1343 |
% horizontal diameter |len| |
| 1344 |
% and vertical diameter |ht|, located with its center at |zj|. Like the |
| 1345 |
% diamond box, |zjtm|, |zjmr|, etc., are at the extremes of the ellipse |
| 1346 |
% and the points |zjtr|, |zjbr|, etc., are on the ellipse approximately |
| 1347 |
% halfway between the extremum points, similar to the positions shown |
| 1348 |
% in \fref{fig:diamondpoints}. The text |str| is placed at the center |
| 1349 |
% of the box. |
| 1350 |
% |
| 1351 |
% \DescribeRoutine{drawoutputbox} |
| 1352 |
% |drawoutputbox(j, len, ht)(btex str etex)| |
| 1353 |
% draws a box, |
| 1354 |
% length |len| and height |ht|, located with its bottom left corner at |zj|. |
| 1355 |
% The bottom of the box is a wavy line and the other three sides |
| 1356 |
% are straight. The text |str| is placed at the center of the box. |
| 1357 |
% This kind of box is often used as a flowchart symbol for output; |
| 1358 |
% it is meant to be a represention of printed paper which has been |
| 1359 |
% torn from a long continuous roll. |
| 1360 |
% |
| 1361 |
% |
| 1362 |
% \DescribeRoutine{drawdashellipse} |
| 1363 |
% |drawdashellipse(j, len, ht)| |
| 1364 |
% draws a dashed ellipse. The location and dimensional parameters |
| 1365 |
% correspond to those for |drawovalbox|, as do the calculated points. |
| 1366 |
% |
| 1367 |
% \DescribeRoutine{drawdrum} |
| 1368 |
% |drawdrum(j, len, ht)(btex str etex)| |
| 1369 |
% draws a `drum' box. This is constructed as a rectangular box of width |
| 1370 |
% width |len| and height |ht|, with its bottom left hand corner at |zj|. |
| 1371 |
% The horizontal line at the bottom of the |
| 1372 |
% rectangle is replaced by a half-ellipse with a major diameter of |len| |
| 1373 |
% and the minor diameter given by |drumlid*len|. The horizontal line |
| 1374 |
% at the top is replaced by a full ellipse with the same dimensions. |
| 1375 |
% |
| 1376 |
%\begin{figure} |
| 1377 |
%\centering |
| 1378 |
%\setlength{\unitlength}{0.6mm} |
| 1379 |
% |
| 1380 |
%\begin{picture}(100,100) |
| 1381 |
% \put(0,0){\framebox(120,120){}} |
| 1382 |
% \put(20,20){\begin{picture}(80,80) |
| 1383 |
% \put(0,10){\line(0,1){60}} |
| 1384 |
% \put(80,10){\line(0,1){60}} |
| 1385 |
% \qbezier(0,10)(0,0)(40,0) |
| 1386 |
% \qbezier(40,0)(80,0)(80,10) |
| 1387 |
% |
| 1388 |
% \qbezier(0,70)(0,80)(40,80) |
| 1389 |
% \qbezier(40,80)(80,80)(80,70) |
| 1390 |
% \qbezier(0,70)(0,60)(40,60) |
| 1391 |
% \qbezier(40,60)(80,60)(80,70) |
| 1392 |
% |
| 1393 |
% \multiput(0,10)(0,30){3}{\circle*{2}} |
| 1394 |
% \put(-2,10){\makebox(0,0)[r]{\texttt{zjbl}}} |
| 1395 |
% \put(-2,40){\makebox(0,0)[r]{\texttt{zjml}}} |
| 1396 |
% \put(-2,70){\makebox(0,0)[r]{\texttt{zjtl}}} |
| 1397 |
% \multiput(80,10)(0,30){3}{\circle*{2}} |
| 1398 |
% \put(82,10){\makebox(0,0)[l]{\texttt{zjbr}}} |
| 1399 |
% \put(82,40){\makebox(0,0)[l]{\texttt{zjmr}}} |
| 1400 |
% \put(82,70){\makebox(0,0)[l]{\texttt{zjtr}}} |
| 1401 |
% \put(40,0){\circle*{2}} |
| 1402 |
% \put(40,-2){\makebox(0,0)[t]{\texttt{zjbm}}} |
| 1403 |
% \put(40,80){\circle*{2}} |
| 1404 |
% \put(40,82){\makebox(0,0)[b]{\texttt{zjtm}}} |
| 1405 |
% \put(40,35){\circle*{2}} |
| 1406 |
% \put(40,37){\makebox(0,0)[b]{\texttt{zjc}}} |
| 1407 |
% |
| 1408 |
% \put(20,1){\circle*{2}} |
| 1409 |
% \put(20,-1){\makebox(0,0)[t]{\texttt{zjbml}}} |
| 1410 |
% \put(60,1){\circle*{2}} |
| 1411 |
% \put(60,-1){\makebox(0,0)[t]{\texttt{zjbmr}}} |
| 1412 |
% \put(20,79){\circle*{2}} |
| 1413 |
% \put(20,81){\makebox(0,0)[b]{\texttt{zjtml}}} |
| 1414 |
% \put(60,79){\circle*{2}} |
| 1415 |
% \put(60,81){\makebox(0,0)[b]{\texttt{zjtmr}}} |
| 1416 |
% |
| 1417 |
% \end{picture}} |
| 1418 |
%\end{picture} |
| 1419 |
%\setlength{\unitlength}{1pt} |
| 1420 |
%\caption[Calculated points on a drum]{Calculated points on a drum |
| 1421 |
% (suffix is \texttt{j} and located at \texttt{zjbl=zj})} |
| 1422 |
% \label{fig:drum} |
| 1423 |
%\end{figure} |
| 1424 |
% |
| 1425 |
% As shown in Figure~\ref{fig:drum}, |
| 1426 |
% the calculated points on the vertical sides of the drum are the same |
| 1427 |
% as for a rectangular box. There are three calculated points on the base |
| 1428 |
% of the drum, called |zjbml|, |zjbm| and |zjbmr|. Similarly there are |
| 1429 |
% three points on the top of the drum called |zjtml|, |zjtm| and |zjtmr|. |
| 1430 |
% The center point, |zjc| is halfway between the sides and halfway between |
| 1431 |
% the two lower ellipse halves. The text |str| is placed at this center point. |
| 1432 |
% |
| 1433 |
% \DescribeRoutine{drawstickman} |
| 1434 |
% |drawstickman(j, len, ht)| |
| 1435 |
% draws a genderless full frontal (or rear) stick figure enclosed in |
| 1436 |
% an invisible box, |
| 1437 |
% length |len| and height |ht|, located with its bottom left corner at |zj|. |
| 1438 |
% This can be used, for example to represent an actor in a UML Use Case |
| 1439 |
% diagram. Setting the height to be twice the length produces a reasonable |
| 1440 |
% result, for instance: |
| 1441 |
% \verb?drawstickman(3, wd, 2wd);? |
| 1442 |
% |
| 1443 |
% |
| 1444 |
% \section{An example} \label{sec:example} |
| 1445 |
% |
| 1446 |
% The example attempts to bring out the main methods that can be used |
| 1447 |
% in defining \ExpressG{} diagrams. The code for eleven diagrams is provided, none |
| 1448 |
% of which necessarily has anything to do with a real example of \ExpressG{} |
| 1449 |
% modeling, but rather is meant to be illustrative of diagramming techniques. |
| 1450 |
% |
| 1451 |
% This section is best studied with a copy of the printed diagrams to |
| 1452 |
% hand. Section~\ref{sec:run} on \pref{sec:run} explains briefly how |
| 1453 |
% to run the example and obtain the diagrams. |
| 1454 |
% |
| 1455 |
% The default extension for a \Mpost{} file is \file{.mp}. |
| 1456 |
% \begin{macrocode} |
| 1457 |
%<*eg> |
| 1458 |
%%% EXPEG.MP Example MetaPost EXPRESS-G diagrams |
| 1459 |
|
| 1460 |
% \end{macrocode} |
| 1461 |
% |
| 1462 |
% Assuming that the diagrams are to be eventually embedded in, or processed |
| 1463 |
% through, a \LaTeX{} document then any \TeX{} macros must come at the |
| 1464 |
% start of the file between a |verbatimtex| \ldots |etex| pair. When dealing |
| 1465 |
% with text, \Mpost{} does not handle more than a single line. The macro |
| 1466 |
% below is to enable two lines of text to be handled by \Mpost. |
| 1467 |
% |
| 1468 |
% \begin{macrocode} |
| 1469 |
|
| 1470 |
% use btex \twolines{first}{second} etex for two-line labels |
| 1471 |
verbatimtex \def\twolines#1#2{\vbox{\hbox{#1} \hbox{#2}}} etex |
| 1472 |
|
| 1473 |
% \end{macrocode} |
| 1474 |
% |
| 1475 |
% The \Lpack{expressg} package file has to be input to make the routines |
| 1476 |
% available. |
| 1477 |
% \begin{macrocode} |
| 1478 |
input expressg |
| 1479 |
|
| 1480 |
% \end{macrocode} |
| 1481 |
% |
| 1482 |
% \subsection{Diagram 1: Some boxes and lines} |
| 1483 |
% |
| 1484 |
% Many diagrams can be defined in one file. Each diagram starts with |
| 1485 |
% |beginfig(N)|, where N is a unique integer, and ends with |endfig;|. |
| 1486 |
% \EPS{} for each diagram is written to a file called |
| 1487 |
% \file{mproot.N}, where \file{mproot} is the root name of the input file. |
| 1488 |
% In our |
| 1489 |
% case the output files will be \file{expeg.1} through \file{expeg.11}. |
| 1490 |
% \begin{macrocode} |
| 1491 |
beginfig(1) |
| 1492 |
|
| 1493 |
% \end{macrocode} |
| 1494 |
% |
| 1495 |
% The first diagram consists of some of the \Lpack{expressg} box and line styles. |
| 1496 |
% The main point is to illustrate how \Mpost{} allows the boxes to be aligned. |
| 1497 |
% Start off by defining a point |z1| at the origin. By default, a variable name |
| 1498 |
% starting with the letter |z| is assumed to be a point. Similarly, variables |
| 1499 |
% starting with |x| and |y| are assumed to be x- and y-coordinates. If |zk| |
| 1500 |
% is defined with a value then automatically |xk| is the value of the x |
| 1501 |
% coordinate of |
| 1502 |
% the point |zk| and |yk| is the value of the |
| 1503 |
% y coordinate. Conversely, if |xj| and |yj| are defined, |zj| is automatically |
| 1504 |
% defined. |
| 1505 |
% |
| 1506 |
% Note that the |=| sign denotes an equation, not an assignment. The power |
| 1507 |
% of \Mpost{} comes from its ability to solve linear equations. |
| 1508 |
% |
| 1509 |
% Having defined the point |z1|, draw an EXPRESSION box with its bottom |
| 1510 |
% left hand corner at |z1|. |
| 1511 |
% \begin{macrocode} |
| 1512 |
z1=(0,0); |
| 1513 |
drawEXPRESSION(1); |
| 1514 |
|
| 1515 |
% \end{macrocode} |
| 1516 |
% |
| 1517 |
% Remember that when a box is drawn, its corner and mid points are |
| 1518 |
% calculated. These can be used in defining other points. In particular |
| 1519 |
% there is the point |z1tr| which is the top right hand corner |
| 1520 |
% of the EXPRESSION box. Also, if another box is drawn at point |z2| then |
| 1521 |
% it will have its bottom left hand corner at |z2bl|. |
| 1522 |
% |
| 1523 |
% The point |z2bl| is defined by a linear equation with respect to |
| 1524 |
% the point |z2|. As \Mpost{} can solve linear equations, given the |
| 1525 |
% point |z2bl| it can solve for the point |z2|. |
| 1526 |
% |
| 1527 |
% The next box has its bottom left hand corner at the top right hand |
| 1528 |
% corner of the EXPRESSION box, by specifying that the |
| 1529 |
% point |z2bl| and |z1tr| are the same location and then drawing a box located |
| 1530 |
% at |z2|. The third (BOOLEAN) box is also stacked in the same way with |
| 1531 |
% respect to the second (INTEGER) box. |
| 1532 |
% |
| 1533 |
% \begin{macrocode} |
| 1534 |
z2bl=z1tr; |
| 1535 |
drawINTEGER(2); |
| 1536 |
|
| 1537 |
z3bl=z2tr; |
| 1538 |
drawBOOLEAN(3); |
| 1539 |
|
| 1540 |
% \end{macrocode} |
| 1541 |
% |
| 1542 |
% Next a piece of circled text is drawn. Using the same method as before, |
| 1543 |
% the bottom of the circle is made to be coincident with the middle of the top |
| 1544 |
% of the BOOLEAN box. The |namespace| routine is used to specify the circle |
| 1545 |
% diameter. Note that an argument to a routine can itself be a routine. |
| 1546 |
% \begin{macrocode} |
| 1547 |
z4bm=z3tm; |
| 1548 |
drawcirclebox(4, namespace(btex ABS etex)(nextra))(btex ABS etex); |
| 1549 |
|
| 1550 |
% \end{macrocode} |
| 1551 |
% |
| 1552 |
% \Mpost{} is a typed language, and new variables can be declared of a |
| 1553 |
% particular type. A |numeric| variable holds a number (or a length). |
| 1554 |
% The diameter of the circle just drawn is going to be used as a length |
| 1555 |
% in later parts of this diagram, so it is sensible to store its value |
| 1556 |
% in a new variable called |diam|. We then use it in drawing another |
| 1557 |
% circle directly on top of the first one. |
| 1558 |
% \begin{macrocode} |
| 1559 |
numeric diam; |
| 1560 |
diam = namespace(btex ABS etex)(nextra); |
| 1561 |
|
| 1562 |
z5bm=z4tm; |
| 1563 |
drawcirclebox(5, diam)(btex SAB etex); |
| 1564 |
|
| 1565 |
% \end{macrocode} |
| 1566 |
% |
| 1567 |
% The next element in the diagram is an ENTITY box. |
| 1568 |
% We use the default height for the entity box and the default page connector |
| 1569 |
% length as its length (no reason, but it saves inventing another variable |
| 1570 |
% or value). |
| 1571 |
% |
| 1572 |
% The ENTITY box is positioned with respect to the SAB circle, but in a |
| 1573 |
% slightly more complicated way than earlier positions. We want the left hand |
| 1574 |
% side of the box to align with the right hand side of the circle. Also, |
| 1575 |
% the middle of the box should align with the top of the circle. |
| 1576 |
% |
| 1577 |
% The ENTITY box will be located at point |z6|. The easiest way is to |
| 1578 |
% specify |z6| is |z6ml=(x5mr, y5tm)|, but to demonstrate more of \Mpost's |
| 1579 |
% equation solving abilities a more complicated approach is taken to the |
| 1580 |
% specification of the x coordinate. The horizontal distance between the |
| 1581 |
% points |z5ml| and |z5tl| on the circle is the same as the distance |
| 1582 |
% between the points |z5tr| and |z5mr|. We can express this as |
| 1583 |
% |x5ml-x5tl = x5tr-x5mr|. As we want |x6ml|, which is the same as |x6bl|, |
| 1584 |
% to be the same as |x5mr| we |
| 1585 |
% can substitute into this equation, as done in the code below. Note that |
| 1586 |
% \Mpost{} can solve for the unknown |x6bl| even though it is on |
| 1587 |
% the right hand side |
| 1588 |
% of the equation because the other three values are known. |
| 1589 |
% |
| 1590 |
% The y coordinate of the point |z6mr| is specified as |
| 1591 |
% equal to the y coordinate of the top of the circle. Because of the linear |
| 1592 |
% relations involving all the points on a box, it is sufficient to provide |
| 1593 |
% one x coordinate and one y coordinate to fix all the points on the box. |
| 1594 |
% \begin{macrocode} |
| 1595 |
x5ml-x5tl = x5tr-x6bl; |
| 1596 |
y6mr=y5tm; |
| 1597 |
drawENT(6, pconl, enth)(btex an\_ent etex); |
| 1598 |
|
| 1599 |
% \end{macrocode} |
| 1600 |
% |
| 1601 |
% The geometric center of the next box, an LEVENT, is vertically above |
| 1602 |
% the geometric center of the ENTITY box, and the bottom of LEVENT is slightly |
| 1603 |
% (one lenth unit) above the top of the ENTITY box. This is accomplished here |
| 1604 |
% by specifying |z7bm| in terms of expressions involving the coordinates |
| 1605 |
% of the point |z6tm|. |
| 1606 |
% \begin{macrocode} |
| 1607 |
z7bm=(x6tm,y6tm+u); |
| 1608 |
drawLEVENT(7, pconl, eventh)(btex levent etex); |
| 1609 |
|
| 1610 |
% \end{macrocode} |
| 1611 |
% |
| 1612 |
% At point |z8| a GEVENT box is drawn. It's bottom left hand corner is |
| 1613 |
% vertically above the top left hand corner of the LEVENT box. If you look |
| 1614 |
% at the resulting diagram, you will see that GEVENT is shifted right with |
| 1615 |
% respect to LEVENT. For vertical alignment of EVENT boxes it is best to |
| 1616 |
% use the middle rather than corner points. |
| 1617 |
% \begin{macrocode} |
| 1618 |
z8=(x7tl, y7tr+u); |
| 1619 |
drawGEVENT(8, pconl, eventh)(btex gevent etex); |
| 1620 |
|
| 1621 |
% \end{macrocode} |
| 1622 |
% |
| 1623 |
% \DescribeRoutine{mediation} |
| 1624 |
% For the last of the aligned boxes another aspect of \Mpost{} is used. |
| 1625 |
% \Mpost{} provides a \emph{mediation} facility whose syntax is |frac[a,b]|. |
| 1626 |
% The result of a mediation is a value that is |frac| between the value |a| |
| 1627 |
% and the value |b|. For example, the result of |0.25[10,30]| is 15. Similarly, |
| 1628 |
% the result of |1/3[zj,zk]| is the point one third of the way between point |
| 1629 |
% |zj| and point |zk|. |
| 1630 |
% |
| 1631 |
% The SCHEMA box is positioned with its bottom right hand corner at one |
| 1632 |
% eighth of the way along, and at the top of, the BOOLEAN box. |
| 1633 |
% \begin{macrocode} |
| 1634 |
z9br=1/8[z3tl,z3tr]; |
| 1635 |
drawSCHEMA(9, pconl, schemah)(btex a\_schema etex); |
| 1636 |
|
| 1637 |
% \end{macrocode} |
| 1638 |
% |
| 1639 |
% The second half of the diagram illustrates various line and end |
| 1640 |
% styles. These are all horizontal, the same length and are aligned |
| 1641 |
% vertically, so |
| 1642 |
% define the x coordinate |xmid| of the left hand end of the lines, and |
| 1643 |
% the length |len| of the lines. |
| 1644 |
% \begin{macrocode} |
| 1645 |
numeric xmid, len; |
| 1646 |
xmid = x8tr + diam; |
| 1647 |
len = 2diam; |
| 1648 |
|
| 1649 |
% \end{macrocode} |
| 1650 |
% |
| 1651 |
% \DescribeRoutine{shifted} |
| 1652 |
% The next line of code exhibits another \Mpost{} function. A point can |
| 1653 |
% be specified as being some other point that is \emph{shifted} by given |
| 1654 |
% amounts in the x and y directions. More precisely, the shift is specified |
| 1655 |
% by a pair of values, written as |(a,b)|. The first line is aligned |
| 1656 |
% vertically with the center of the first box and its start point is |z11|. |
| 1657 |
% The end point, |z111|, is specified as being the start point shifted |
| 1658 |
% horizontally by the length of the line. |
| 1659 |
% \begin{macrocode} |
| 1660 |
z11=(xmid, y1ml); z111=z11 shifted (len, 0); |
| 1661 |
drawdashO(11, 111); |
| 1662 |
|
| 1663 |
% \end{macrocode} |
| 1664 |
% |
| 1665 |
% Because we will be using the same horizontal shift for all the lines, |
| 1666 |
% define a \emph{pair}, called |moveright|, that is the required shift. |
| 1667 |
% The next two lines are also aligned vertically with the centers of the |
| 1668 |
% second and third boxes. |
| 1669 |
% \begin{macrocode} |
| 1670 |
pair moveright; |
| 1671 |
moveright = (len, 0); |
| 1672 |
|
| 1673 |
z12=(xmid, y2ml); z121=z12 shifted moveright; |
| 1674 |
drawnormalO(12, 121); |
| 1675 |
|
| 1676 |
z13=(xmid, y3ml); z131=z13 shifted moveright; |
| 1677 |
drawthickO(13, 131); |
| 1678 |
|
| 1679 |
% \end{macrocode} |
| 1680 |
% |
| 1681 |
% The remaining lines will have the same vertical spacing as the first three, |
| 1682 |
% so define another pair, |moveup|, that we can use for vertical shift. |
| 1683 |
% \begin{macrocode} |
| 1684 |
pair moveup; |
| 1685 |
moveup = (0, y13-y12); |
| 1686 |
|
| 1687 |
z14=z13 shifted moveup; z141=z14 shifted moveright; |
| 1688 |
drawnormalD(14, 141); |
| 1689 |
|
| 1690 |
z15=z14 shifted moveup; z151=z15 shifted moveright; |
| 1691 |
drawnormalCA(15, 151); |
| 1692 |
|
| 1693 |
z16=z15 shifted moveup; z161=z16 shifted moveright; |
| 1694 |
drawnormalOA(16, 161); |
| 1695 |
|
| 1696 |
z17=z16 shifted moveup; z171=z17 shifted moveright; |
| 1697 |
drawnormalF(17, 171); |
| 1698 |
|
| 1699 |
% \end{macrocode} |
| 1700 |
% |
| 1701 |
% The upper part of the diagram illustrates some of the additional |
| 1702 |
% line styles and boxes provided that are not part of the |
| 1703 |
% \ExpressG{} language. |
| 1704 |
% \changes{v1.1}{1999/10/30}{Extended upper half of diagram 1 for new box |
| 1705 |
% types} |
| 1706 |
% |
| 1707 |
% The upper half is seperated from the bottom half by a dashed line, just |
| 1708 |
% to make the distinction. The line is set above the highest box so far, |
| 1709 |
% which is located at |z8|, and extends across the width of the diagram. |
| 1710 |
% \begin{macrocode} |
| 1711 |
z300=(0,y8tm+diam); z301=(x111,y300); |
| 1712 |
draw z300--z301 dashes; |
| 1713 |
|
| 1714 |
% \end{macrocode} |
| 1715 |
% Define |mup| to be a distance, which we will use for vertical seperation. |
| 1716 |
% \begin{macrocode} |
| 1717 |
numeric mup; mup := onelineh; |
| 1718 |
|
| 1719 |
% \end{macrocode} |
| 1720 |
% |
| 1721 |
% As previously, we'll start with the boxes which will be placed in |
| 1722 |
% a column at the left side of the diagram. The first box, high enough |
| 1723 |
% for one line of enclosed text, has its top right hand corner folded |
| 1724 |
% down by one quarter the box height. Text is placed at the center |
| 1725 |
% of the box, but if this is not required then it can be given as an |
| 1726 |
% empty string (i.e., |""|). |
| 1727 |
% \begin{macrocode} |
| 1728 |
z302=(0,y300+mup); |
| 1729 |
drawcardbox(302, pconl, onelineh, 1/4onelineh)(""); |
| 1730 |
|
| 1731 |
% \end{macrocode} |
| 1732 |
% |
| 1733 |
% The next box is a diamond shape. Unlike the rectangular and rhomboidal |
| 1734 |
% boxes, these are positioned |
| 1735 |
% via the center of the box instead of the bottom left hand corner. |
| 1736 |
% \begin{macrocode} |
| 1737 |
z303bm=(x302tm, y302tm+mup); |
| 1738 |
drawdiamondbox(303, pconl, 2onelineh)(btex jewel etex); |
| 1739 |
|
| 1740 |
% \end{macrocode} |
| 1741 |
% |
| 1742 |
% Now there is a double box with the top portion being 3/4 of the box |
| 1743 |
% height. Text is put into the top half of the box using \Mpost's |
| 1744 |
% labeling routine (see \pref{page:label}). |
| 1745 |
% \begin{macrocode} |
| 1746 |
z304=(0, y303tm+mup); |
| 1747 |
drawdoublerectangle(304, pconl, 2onelineh, 3/4); |
| 1748 |
label(btex top etex, z304ct); |
| 1749 |
|
| 1750 |
% \end{macrocode} |
| 1751 |
% |
| 1752 |
% Next comes a triple box with the bottom portion being one fifth of |
| 1753 |
% the height, and the top portion being two fifths of the height. |
| 1754 |
% Text is placed in the top and middle portions, but not into the bottom. |
| 1755 |
% \begin{macrocode} |
| 1756 |
z305=(0, y304tm+mup); |
| 1757 |
drawtriplerectangle(305, pconl, 3onelineh, 2/5, 0.2); |
| 1758 |
label(btex top etex, z305ct); |
| 1759 |
label("middle", z305cm); |
| 1760 |
|
| 1761 |
% \end{macrocode} |
| 1762 |
% |
| 1763 |
% Some languages include a box that looks a little like an index card, and |
| 1764 |
% this is shown next. |
| 1765 |
% A small box is also drawn inside the main part of the index box, |
| 1766 |
% just to illustrate |
| 1767 |
% that drawings may be placed inside boxes. |
| 1768 |
% \begin{macrocode} |
| 1769 |
z306=(0,y305tm+mup); |
| 1770 |
drawindexbox(306, 2pconl, 3onelineh, 3/4pconl, onelineh)(btex pack etex); |
| 1771 |
z307=1/8[z306bl,z306tr]; |
| 1772 |
drawENT(307, 1/4pconl, onelineh)(btex E etex); |
| 1773 |
|
| 1774 |
% \end{macrocode} |
| 1775 |
% |
| 1776 |
% Another box shown here is a dotted box that covers up anything that |
| 1777 |
% is underneath it. To demonstrate, a folded corner box is drawn first, |
| 1778 |
% and then the |
| 1779 |
% dashed box is drawn second. They have to be done in this order. |
| 1780 |
% (The reason for the notation |y306P.tl| is explained under diagram 2 |
| 1781 |
% on \pref{page:dotsuffix}). |
| 1782 |
% \begin{macrocode} |
| 1783 |
z308=(0, y306P.tl+mup); |
| 1784 |
z309ml=z308c; |
| 1785 |
drawcardbox(308, pconl, 2onelineh, 1/4onelineh)(btex covered etex); |
| 1786 |
drawdashboxover(309, pconl, onelineh); |
| 1787 |
|
| 1788 |
% \end{macrocode} |
| 1789 |
% |
| 1790 |
% An oval box comes next. The perimeter is an ellipse. |
| 1791 |
% \begin{macrocode} |
| 1792 |
z310bm=(x306bm,y309tm+mup); |
| 1793 |
drawovalbox(310, 2pconl, 2onelineh)(""); |
| 1794 |
|
| 1795 |
% \end{macrocode} |
| 1796 |
% |
| 1797 |
% Now we have two rounded boxes. In the first one the corner radius is |
| 1798 |
% small and the corners are neatly rounded. The radius is large in the |
| 1799 |
% second case, and it is automatically reduced to give semicircular ends. |
| 1800 |
% Further, the center portion of the second of these boxes is `deleted' |
| 1801 |
% by putting a |hiderectangle| over it. |
| 1802 |
% \begin{macrocode} |
| 1803 |
z311ml=(x310mr+mup, y310ml); |
| 1804 |
drawroundedbox(311, 2pconl, 2onelineh, 1/2onelineh)("rounded"); |
| 1805 |
|
| 1806 |
z312ml=(x311mr+mup, y311mr); |
| 1807 |
drawroundedbox(312, 2pconl, 2onelineh, 3/2onelineh)(btex large radius etex); |
| 1808 |
|
| 1809 |
z314=(x312bm-1/4pconl, y312bm-1/2mup); |
| 1810 |
hiderectangle(314, 1/2pconl, (3/2onelineh + mup)); |
| 1811 |
|
| 1812 |
% \end{macrocode} |
| 1813 |
% |
| 1814 |
% The last of the simple enclosed shapes are a dashed ellipse and a dashed circle, |
| 1815 |
% which are aligned below the partially obscured rounded box. |
| 1816 |
% \begin{macrocode} |
| 1817 |
z315tm=(x312bm, y312bm-mup); |
| 1818 |
drawdashellipse(315, 2pconl, 2onelineh); |
| 1819 |
|
| 1820 |
z316tm=(x315bm, y315bm-mup); |
| 1821 |
drawdashcircle(316, diam); |
| 1822 |
|
| 1823 |
% \end{macrocode} |
| 1824 |
% |
| 1825 |
% A drum box is now presented. This is centered with respect to the |
| 1826 |
% rounded box and aligned with the bottom of the triple box. It is the |
| 1827 |
% same nominal size as the triple box. |
| 1828 |
% \begin{macrocode} |
| 1829 |
z317bc=(x311bm,y304br); |
| 1830 |
drawdrum(317, pconl, 3onelineh)(btex drum etex); |
| 1831 |
% \end{macrocode} |
| 1832 |
% To be a little different, I'll add a `handle' to the top of the drum. The |
| 1833 |
% top of the handle will be above the drum at the point |z317A|, and the |
| 1834 |
% attachement points are at the |tml| and |tmr| points on the drum. The |
| 1835 |
% normally sharp join in the middle of the handle is smoothed off. |
| 1836 |
% \begin{macrocode} |
| 1837 |
z317A=(x317tc, y317tc+2onelineh); |
| 1838 |
drawnormalthree(317tml, 317A, 317tmr); |
| 1839 |
smooth(317tml, 317A, 317tmr); |
| 1840 |
|
| 1841 |
% \end{macrocode} |
| 1842 |
% |
| 1843 |
% Below the drum box is a stick figure. It is centered with respect to the |
| 1844 |
% drum box and based on the bottom row. |
| 1845 |
% \changes{v1.6}{2004/02/29}{Added stickman to example drawing} |
| 1846 |
% \begin{macrocode} |
| 1847 |
z320bm = (x317bm, y302); |
| 1848 |
drawstickman(320, onelineh, 2onelineh); |
| 1849 |
|
| 1850 |
% \end{macrocode} |
| 1851 |
% |
| 1852 |
% Above the drum box there is an output box, vertically aligned with the |
| 1853 |
% stick figure, labelled `output'. |
| 1854 |
% \changes{v1.6}{2004/02/29}{Added output box to example drawing} |
| 1855 |
% \begin{macrocode} |
| 1856 |
z325bm = (x320bm, y306); |
| 1857 |
drawoutputbox(325, pconl, 2onelineh)(btex output etex); |
| 1858 |
|
| 1859 |
% \end{macrocode} |
| 1860 |
% |
| 1861 |
% Above the output box there is a simple circled dot. |
| 1862 |
% \changes{v1.6}{2004/02/29}{Added circled dot to example drawing} |
| 1863 |
% \begin{macrocode} |
| 1864 |
z330 = (x320bm, y309ml); |
| 1865 |
drawCircledDot(330, 3/2onelineh); |
| 1866 |
|
| 1867 |
% \end{macrocode} |
| 1868 |
% |
| 1869 |
% As in the bottom half, line styles are drawn on the right side of |
| 1870 |
% of the diagram. First, though, there is an arrowed circle symbol. |
| 1871 |
% This is vertically aligned with the centers of the lines. |
| 1872 |
% \begin{macrocode} |
| 1873 |
z401bm=(1/2[x11,x111], y301+mup); |
| 1874 |
drawcircleA(401, diam); |
| 1875 |
|
| 1876 |
% \end{macrocode} |
| 1877 |
% |
| 1878 |
% Finish off with assorted linestyles. |
| 1879 |
% \begin{macrocode} |
| 1880 |
z402=(xmid, y401tm+mup); z502=(x111, y402); |
| 1881 |
drawdashA(402, 502); |
| 1882 |
|
| 1883 |
z403=(xmid, y402+mup); z503=(x111, y403); |
| 1884 |
drawdashOA(403, 503); |
| 1885 |
|
| 1886 |
z404=(xmid, y403+mup); z504=(x111, y404); |
| 1887 |
drawnormalOD(404, 504); |
| 1888 |
|
| 1889 |
z405=(xmid, y404+mup); z505=(x111, y405); |
| 1890 |
drawnormalCD(405, 505); |
| 1891 |
|
| 1892 |
z406=(xmid, y405+mup); z506=(x111, y406); |
| 1893 |
drawnormalDCA(406, 506); |
| 1894 |
|
| 1895 |
% \end{macrocode} |
| 1896 |
% |
| 1897 |
% Lines can be drawn at any angle, and the non-circular line end styles |
| 1898 |
% remain aligned. |
| 1899 |
% |
| 1900 |
% A set of lines and endstyles are drawn rotating about the common |
| 1901 |
% start point of the lines. |
| 1902 |
% \DescribeRoutine{rotatedaround} |
| 1903 |
% |pt1 rotatatedaround(pt2, ang)| is \Mpost{} code that rotates |
| 1904 |
% the point |pt1| around the point |pt2| counterclockwise through the angle |
| 1905 |
% |ang| in degrees. |
| 1906 |
% |
| 1907 |
% \begin{macrocode} |
| 1908 |
numeric ang; ang = 180/7; |
| 1909 |
z600=(xmid, y406+2mup); |
| 1910 |
z699=(x600+len, y600); |
| 1911 |
z601=z699 rotatedaround(z600, ang); |
| 1912 |
z602=z699 rotatedaround(z600, 2ang); |
| 1913 |
z603=z699 rotatedaround(z600, 3ang); |
| 1914 |
z604=z699 rotatedaround(z600, 4ang); |
| 1915 |
z605=z699 rotatedaround(z600, 5ang); |
| 1916 |
z606=z699 rotatedaround(z600, 6ang); |
| 1917 |
z607=z699 rotatedaround(z600, 7ang); |
| 1918 |
drawnormalCA(600,601); |
| 1919 |
drawnormalOA(600,602); |
| 1920 |
drawnormalF(600,603); |
| 1921 |
drawdashA(600,604); |
| 1922 |
drawnormalOD(600,605); |
| 1923 |
drawnormalCD(600,606); |
| 1924 |
|
| 1925 |
% \end{macrocode} |
| 1926 |
% |
| 1927 |
% This is the end of the first diagram. |
| 1928 |
% \begin{macrocode} |
| 1929 |
endfig; % end figure 1 |
| 1930 |
|
| 1931 |
% \end{macrocode} |
| 1932 |
% |
| 1933 |
% \subsection{Diagrams 2--5: EXPRESS-G like models} |
| 1934 |
% |
| 1935 |
% The diagrams in this section are all drawn using the \ExpressG{} |
| 1936 |
% specific routines. Nevertheless, they do illustrate general BLA techniques. |
| 1937 |
% |
| 1938 |
% \subsubsection{Diagram 2: Schema level diagram} |
| 1939 |
% |
| 1940 |
% In contrast to the first diagram, this one is much more like an |
| 1941 |
% \ExpressG{} diagram. It illustrates a diagram consisting of SCHEMA |
| 1942 |
% boxes and interconnections. |
| 1943 |
% |
| 1944 |
% \begin{macrocode} |
| 1945 |
beginfig(2) % schema level model |
| 1946 |
|
| 1947 |
% \end{macrocode} |
| 1948 |
% |
| 1949 |
% First define some lengths to assist in laying out the diagram, which is |
| 1950 |
% going to consists of three rows of boxes with varying numbers of boxes |
| 1951 |
% in each row; the bottom row has two, the middle has four, and the top row |
| 1952 |
% has one. We also want to align the boxes vertically in a `nice' manner. |
| 1953 |
% |
| 1954 |
% \begin{macrocode} |
| 1955 |
numeric lb, hb; % length & height of boxes |
| 1956 |
lb=20u; hb=schemah; |
| 1957 |
numeric upshift; % vertical distance between rows |
| 1958 |
upshift = 20u; |
| 1959 |
numeric sideshift; % horizontal distance between boxes |
| 1960 |
sideshift = 10u; |
| 1961 |
|
| 1962 |
% \end{macrocode} |
| 1963 |
% |
| 1964 |
% The bottom row has two boxes and the second four. The two bottom boxes |
| 1965 |
% will be aligned vertically under the two middle boxes in the middle row. |
| 1966 |
% Allowance must be made for a `missing' box at the start of the bottom |
| 1967 |
% row. The second box on the bottom row is spaced from the first one. |
| 1968 |
% \begin{macrocode} |
| 1969 |
%%% bottom row |
| 1970 |
|
| 1971 |
z9=(lb+sideshift,0); |
| 1972 |
drawSCHEMA(9, lb, hb)("nine"); |
| 1973 |
|
| 1974 |
z11=(x9br+sideshift,y9); |
| 1975 |
drawSCHEMA(11, lb, hb)("eleven"); |
| 1976 |
|
| 1977 |
% \end{macrocode} |
| 1978 |
% |
| 1979 |
% The bottom of the boxes on the second row are all at a fixed distance |
| 1980 |
% above the top of the boxes on the first row. We only need to specify the |
| 1981 |
% y coordinate of the bottom of one box in the row, and use that for the |
| 1982 |
% remainder, |
| 1983 |
% \begin{macrocode} |
| 1984 |
%%% middle row |
| 1985 |
|
| 1986 |
z1=(0,y9tl+upshift); |
| 1987 |
drawSCHEMA(1, lb, hb)("one"); |
| 1988 |
|
| 1989 |
z3=(x1br+sideshift, y1); |
| 1990 |
drawSCHEMA(3, lb, hb)("three"); |
| 1991 |
|
| 1992 |
z5=(x3br+sideshift, y1); |
| 1993 |
drawSCHEMA(5, lb, hb)("five"); |
| 1994 |
|
| 1995 |
z7=(x5br+sideshift, y1); |
| 1996 |
drawSCHEMA(7, lb, hb)("seven"); |
| 1997 |
|
| 1998 |
% \end{macrocode} |
| 1999 |
% |
| 2000 |
% The single box on the top row will be position centrally above the |
| 2001 |
% two middle boxes of the middle row. Mediation is used to calculate |
| 2002 |
% the x coordinate that is halfway between the right side of the left |
| 2003 |
% box and the left side of the right box. |
| 2004 |
% \begin{macrocode} |
| 2005 |
%%% top row |
| 2006 |
|
| 2007 |
x50 = 1/2[x3br,x5bl]; |
| 2008 |
z31bm=(x50,y1tl+upshift); |
| 2009 |
drawSCHEMA(31, lb, hb)("thirtyone"); |
| 2010 |
|
| 2011 |
% \end{macrocode} |
| 2012 |
% |
| 2013 |
% This completes the boxes. The diagram is finished off by drawing |
| 2014 |
% connections between the boxes. The first set of connections are just |
| 2015 |
% straight lines between known points on boxes. |
| 2016 |
% \begin{macrocode} |
| 2017 |
%%% connectors |
| 2018 |
|
| 2019 |
drawdashOO(9tm, 3bm); % three/nine |
| 2020 |
drawdashO(5bm, 11tm); % five/eleven |
| 2021 |
drawdashO(3ml, 1mr); % three/one |
| 2022 |
drawdashO(3mr, 5ml); % three/five |
| 2023 |
drawdashOO(9mr, 11ml); % nine/eleven |
| 2024 |
|
| 2025 |
% \end{macrocode} |
| 2026 |
% |
| 2027 |
% The next connection is more complex. It goes from schema thirtyone |
| 2028 |
% to schema nine on a three-legged route. It goes horizontally left from |
| 2029 |
% thirtynine, then vertically down, and finally horizontally right to nine. It |
| 2030 |
% also passes to the left of schema one. |
| 2031 |
% |
| 2032 |
% The route is constructed by specifying a point |z90| to the left of |
| 2033 |
% schema nine, and the point |z31A| on the left hand of schema thirtynine. |
| 2034 |
% The |VH| routine is then called to generate the corner point on the |
| 2035 |
% (rotated) L shaped path between |z90| and |z31A|. The connection is then |
| 2036 |
% drawn using these four points. |
| 2037 |
% \begin{macrocode} |
| 2038 |
%%% thirtyone/nine |
| 2039 |
z90=((x1bl-sideshift), y9ml); |
| 2040 |
z31A=3/4[z31bl,z31tl]; |
| 2041 |
VH(90, 31A); |
| 2042 |
drawdashO(90vh, 31A); |
| 2043 |
drawdashthreeO(90vh, 90, 9ml); |
| 2044 |
% \end{macrocode} |
| 2045 |
% |
| 2046 |
% \DescribeRoutine{pickup} |
| 2047 |
% To demonstrate another aspect of \Mpost, a dot is drawn at the location |
| 2048 |
% of |z90|. If the drawing pen is thick enough, just drawing one point is |
| 2049 |
% sufficient to make a noticeable dot. The code |pickup thickpen;| drops |
| 2050 |
% the current pen and picks up |
| 2051 |
% the thickpen for drawing. The code |pickup normalpen;| picks up the |
| 2052 |
% normal pen, which is the one that is normally used. |
| 2053 |
% |
| 2054 |
% \DescribeRoutine{label} |
| 2055 |
% \DescribeRoutine{dotlabel} |
| 2056 |
% The last line of code here is |label.lft("z90", z90);| which puts the |
| 2057 |
% text `z90' at the left of point |z90|.\label{page:label} |
| 2058 |
% The label routine has two arguments, |
| 2059 |
% the first the text and the second the point at or near which the text is |
| 2060 |
% to be placed. The simplest form of the routine is |label("text", zk)| which |
| 2061 |
% centers the text over the point |zk|. A |
| 2062 |
% suffix can be used after the |label| (e.g., |.lft| in the code below) to |
| 2063 |
% modify the placement. |.lft| positions the text at the left of the point. |
| 2064 |
% The other modifiers are: |.rt|, |.top|, |.bot|, |.ulft|, |.urt|, |.llft| and |
| 2065 |
% |.lrt|. There is also a |dotlabel.suffix("text", zk)| routine which draws |
| 2066 |
% the point as well. For complicated diagrams it can be useful to label |
| 2067 |
% some points during development, and then comment them out for the final |
| 2068 |
% picture. |
| 2069 |
% \begin{macrocode} |
| 2070 |
pickup thickpen; |
| 2071 |
draw z90; |
| 2072 |
pickup normalpen; |
| 2073 |
label.lft("z90", z90); |
| 2074 |
|
| 2075 |
% \end{macrocode} |
| 2076 |
% |
| 2077 |
% The next two connectors, between schemas one and eleven and between |
| 2078 |
% thirtyone and eleven are of a similar U shape. There is, though, one tricky |
| 2079 |
% point to remember. Up till now, all point arguments to the \Lpack{expressg} |
| 2080 |
% routines have been of the form |3| or |4bm|; |
| 2081 |
% that is, either a number or a number |
| 2082 |
% followed by letter(s). For example, |VH(3,4bm)| will calculate |
| 2083 |
% the point |z3vh|. However, if a routine adds more letters to an argument |
| 2084 |
% that already has letters, such as |VH(4bm,3)|, the calculated point is |
| 2085 |
% \emph{not} |z4bmvh| as might be expected, but instead |
| 2086 |
% is |z4bm.vh|.\label{page:dotsuffix} |
| 2087 |
% This has tripped me up on several occasions. |
| 2088 |
% \begin{macrocode} |
| 2089 |
%%% one/eleven |
| 2090 |
z1A=1/3[z1bl,z1br]; |
| 2091 |
z11A=(x11bm, (y11bm-sideshift)); |
| 2092 |
VH(1A, 11A); |
| 2093 |
drawdashthree(1A, 1A.vh, 11A); % note it is 1A.vh and not 1Avh |
| 2094 |
drawdashO(11A, 11bm); |
| 2095 |
dotlabel.rt("z11A", z11A); |
| 2096 |
dotlabel.lft("z1A.vh", z1A.vh); % note it is z1A.vh and not z1Avh |
| 2097 |
|
| 2098 |
% \end{macrocode} |
| 2099 |
% |
| 2100 |
% The connector between thirtyone and eleven is the same general shape |
| 2101 |
% as the thirtyone to nine connector. This time, I'll use the |HxH| routine |
| 2102 |
% to calculate the turning points |
| 2103 |
% \begin{macrocode} |
| 2104 |
%%% thirtyone/eleven |
| 2105 |
z31B=3/4[z31br,z31tr]; |
| 2106 |
x31BC=x7br+sideshift; |
| 2107 |
HxH(31B, 31BC, 11mr); |
| 2108 |
drawdashfourO(31B, 31B.hxh, 11mr.hxh, 11mr); |
| 2109 |
|
| 2110 |
% \end{macrocode} |
| 2111 |
% |
| 2112 |
% The next two connectors, between thirtyone and seven, and between |
| 2113 |
% thirtyone and one, are simple L shapes, which are easier to produce than the |
| 2114 |
% U shaped ones. |
| 2115 |
% \begin{macrocode} |
| 2116 |
%%% thirtyone/seven |
| 2117 |
z31D=1/4[z31br,z31tr]; |
| 2118 |
VH(7tm, 31D); |
| 2119 |
drawnormalthreeO(31D, 7tm.vh, 7tm); |
| 2120 |
|
| 2121 |
%%% thirtyone/one |
| 2122 |
z31C=1/4[z31bl,z31tl]; |
| 2123 |
VH(1tm, 31C); |
| 2124 |
drawdashO(1tm.vh, 31C); |
| 2125 |
drawdashO(1tm.vh, 1tm); |
| 2126 |
|
| 2127 |
% \end{macrocode} |
| 2128 |
% |
| 2129 |
% The last two connectors are also simple, each consisting of vertical then |
| 2130 |
% horizontal then vertical lines and the turning points can be calculated |
| 2131 |
% by the |VhV| routine.. |
| 2132 |
% \begin{macrocode} |
| 2133 |
%%% thirtyone/three |
| 2134 |
z31E=1/4[z31bl,z31br]; |
| 2135 |
VhV(31E, 3tm); |
| 2136 |
drawnormalfourO(31E, 31E.vhv, 3tm.vhv, 3tm); |
| 2137 |
|
| 2138 |
%%% thirtyone/five |
| 2139 |
z31F=3/4[z31bl,z31br]; |
| 2140 |
VhV(31F, 5tm); |
| 2141 |
drawnormalfourO(31F, 31F.vhv, 5tm.vhv, 5tm); |
| 2142 |
|
| 2143 |
% \end{macrocode} |
| 2144 |
% |
| 2145 |
% The last element in the diagram is a vertical closed arrowheaded line |
| 2146 |
% with a label alongside. The arrowhead is on the top line of the connector |
| 2147 |
% between thirtyone and eleven. Note the point mediation expression expression |
| 2148 |
% in the |label| routine call. |
| 2149 |
% \begin{macrocode} |
| 2150 |
%%% labeled arrow |
| 2151 |
z3111=1/4[z31B,z31B.hxh]; |
| 2152 |
numeric arrowsize; |
| 2153 |
arrowsize := schemah; |
| 2154 |
z3112=(x3111, y3111+arrowsize); |
| 2155 |
drawnormalCA(3112, 3111); |
| 2156 |
label.rt(btex an\_import etex, 1/2[z3111, z3112]); |
| 2157 |
|
| 2158 |
% \end{macrocode} |
| 2159 |
% |
| 2160 |
% The end of this diagram. |
| 2161 |
% \begin{macrocode} |
| 2162 |
endfig; % end fig 2 |
| 2163 |
|
| 2164 |
% \end{macrocode} |
| 2165 |
% |
| 2166 |
% |
| 2167 |
% \subsubsection{Diagram 3: Tree structure} |
| 2168 |
% |
| 2169 |
% This diagram is the first of three that are related in style. It is |
| 2170 |
% useful at this point to define some variables, and values for some of |
| 2171 |
% these as they will probably be used in all three diagrams. |
| 2172 |
% |
| 2173 |
% Values are assigned (e.g., |var := val;|) so that they can be changed |
| 2174 |
% later if necessary (e.g., |var := newval;|). If values were equated like |
| 2175 |
% |var = val;| then they cannot be changed afterwards\footnote{Except |
| 2176 |
% by assignment.} as |var = newval;| |
| 2177 |
% will then have specified two incompatible equations for |var| and \Mpost will |
| 2178 |
% report a problem. |
| 2179 |
% \begin{macrocode} |
| 2180 |
|
| 2181 |
%%%% some commonly used variables & values |
| 2182 |
|
| 2183 |
numeric pl, ph; % length & height of numeric page connectors |
| 2184 |
pl:=pconl; ph:=pconh; % for eg., 9,9 (9,9) |
| 2185 |
numeric plnamed; % length of named page connector |
| 2186 |
numeric irh; % height of interschema boxes |
| 2187 |
irh:=ish; % normally one line of text |
| 2188 |
numeric sdtl, sdth; % length & height of SDT (e.g. INTEGER) boxes |
| 2189 |
sdtl:=sdtbl; sdth:=sdtbh; |
| 2190 |
numeric edtl, edth; % length & height of enum boxes (inset is sdtbs) |
| 2191 |
edth:=sdtbh; % normally one text line |
| 2192 |
numeric el, eh; % length & height of entity boxes |
| 2193 |
eh:=enth; % normally one text line |
| 2194 |
numeric upshift; % vertical space between rows of boxes |
| 2195 |
numeric nextup; % vertical space between bases of rows of boxes |
| 2196 |
% \end{macrocode} |
| 2197 |
% |
| 2198 |
% Now another bit of \Mpost. There is another type of variable called |
| 2199 |
% a |picture| variable. This can hold something as trivial as a dot or |
| 2200 |
% a text string, up to a complete diagram. References to an Index |
| 2201 |
% type is a common element in some of the diagrams. It is useful to |
| 2202 |
% create a shorthand for these by using picture variables. |
| 2203 |
% \begin{macrocode} |
| 2204 |
picture sindex, pindex; |
| 2205 |
sindex := btex eleven.Index etex; % interschema reference text |
| 2206 |
pindex := btex 9,9 Index etex; % page reference text |
| 2207 |
numeric slindex, plindex; |
| 2208 |
slindex := namespace(sindex)(nextra); % length of Index interschema |
| 2209 |
plindex := namespace(pindex)(nextra); % length of Index page reference |
| 2210 |
% \end{macrocode} |
| 2211 |
% |
| 2212 |
% Yet more new \Mpost. Array variables are supported. These are declared |
| 2213 |
% by giving the variable name immediately followed by a pair of square |
| 2214 |
% brackets. An element of an array can be simply accessed by suffixing the |
| 2215 |
% variable name with the integer number denoting the desired position. |
| 2216 |
% Actually we have been using array variables all along, as |z3| or |x7| |
| 2217 |
% are elements of the arrays |z[]| and |x[]| respectively. We define |
| 2218 |
% two arrays, one to be used for specifying horizontal spaces (lengths) |
| 2219 |
% and the other for vertical (y) coordinates. |
| 2220 |
% \begin{macrocode} |
| 2221 |
numeric hspace[]; % horizontal spaces |
| 2222 |
numeric lyc[]; % Y coords of box bases |
| 2223 |
|
| 2224 |
%%%%%%%%%%% end commonly used variables & values |
| 2225 |
|
| 2226 |
% \end{macrocode} |
| 2227 |
% |
| 2228 |
% Diagram 3 consists of type boxes. We will make these all the same length |
| 2229 |
% and height. |
| 2230 |
% \begin{macrocode} |
| 2231 |
beginfig(3) % example fig 3 |
| 2232 |
%%%drawgrid; |
| 2233 |
|
| 2234 |
% \end{macrocode} |
| 2235 |
% |
| 2236 |
% The space required for the longest name is |edtl|. |
| 2237 |
% \begin{macrocode} |
| 2238 |
edtl := namespace(btex standard\_data\_name etex)(niextra); |
| 2239 |
% \end{macrocode} |
| 2240 |
% |
| 2241 |
% There are several rows in the diagram. Specify the vertical space |
| 2242 |
% between the rows, and the space between the bottoms of the boxes (the |
| 2243 |
% height of a box is the normal height, |sdth|, for a type box). Also |
| 2244 |
% specify the y coordinates for each row, counting from the bottom. |
| 2245 |
% \begin{macrocode} |
| 2246 |
upshift=2sdth; |
| 2247 |
nextup=sdth+upshift; |
| 2248 |
%%% the y coords of box bases |
| 2249 |
lyc1:=0; |
| 2250 |
lyc2:=lyc1+nextup; |
| 2251 |
lyc3:=lyc2+nextup; |
| 2252 |
lyc4:=lyc3+nextup; |
| 2253 |
lyc5:=lyc4+nextup; |
| 2254 |
lyc6:=lyc5+nextup; |
| 2255 |
lyc7:=lyc6+nextup; |
| 2256 |
lyc8:=lyc7+nextup; |
| 2257 |
% \end{macrocode} |
| 2258 |
% Specify two horizontal spaces. |
| 2259 |
% \begin{macrocode} |
| 2260 |
hspace1 := 1/3edtl; % space between data enums |
| 2261 |
hspace2 := 2/3edtl; % initial space at start of second row |
| 2262 |
|
| 2263 |
% \end{macrocode} |
| 2264 |
% Draw the 3 boxes in the first row and the 3 in the second; these are |
| 2265 |
% staggered with respect to each other and overlap as otherwise there |
| 2266 |
% there is not enough space to get them all onto one page. |
| 2267 |
% I'll use a numbering scheme for |
| 2268 |
% points so that |zCR| is a point in the Cth column and the Rth row. |
| 2269 |
% \begin{macrocode} |
| 2270 |
%%% bottom two rows (1 & 2) |
| 2271 |
|
| 2272 |
z11=(0,lyc1); |
| 2273 |
drawENUM(11, edtl, edth)(btex coordinates etex); |
| 2274 |
|
| 2275 |
z22=(hspace2, lyc2); |
| 2276 |
drawENUM(22, edtl, edth)(btex solution\_data etex); |
| 2277 |
|
| 2278 |
z31=(x11br+hspace1, lyc1); |
| 2279 |
drawENUM(31, edtl, edth)(btex pressure\_loads etex); |
| 2280 |
|
| 2281 |
z42=(x22br+hspace1, lyc2); |
| 2282 |
drawENUM(42, edtl, edth)(btex nondimensional etex); |
| 2283 |
|
| 2284 |
z51=(x31br+hspace1, lyc1); |
| 2285 |
drawENUM(51, edtl, edth)(btex temperature etex); |
| 2286 |
|
| 2287 |
z62=(x42br+hspace1, lyc2); |
| 2288 |
drawENUM(62, edtl, edth)(btex force\_loads etex); |
| 2289 |
|
| 2290 |
% \end{macrocode} |
| 2291 |
% |
| 2292 |
% The third `row' consists of a horizontal line stretching from the middle |
| 2293 |
% of the leftmost box to the middle of the rightmost box. There are |
| 2294 |
% connections from this line to the top middle of each of the boxes. We can |
| 2295 |
% use the |VyV| routine for the end points of the line. |
| 2296 |
% \begin{macrocode} |
| 2297 |
%%% third row (horizontal line between 2 & 4 row) |
| 2298 |
|
| 2299 |
z13=(x11tm,lyc3); |
| 2300 |
VyV(11tm, 13, 62tm); |
| 2301 |
drawnormal(11tm.vyv, 62tm.vyv); |
| 2302 |
% \end{macrocode} |
| 2303 |
% |
| 2304 |
% Calculate the points on this line vertically above the midpoints of |
| 2305 |
% the boxes and draw the connections. |
| 2306 |
% \begin{macrocode} |
| 2307 |
z23=(x22tm,lyc3); z33=(x31tm,lyc3); z43=(x42tm,lyc3); z53=(x51tm,lyc3); |
| 2308 |
drawnormalO(11tm.vyv,11tm); |
| 2309 |
drawnormalO(23,22tm); |
| 2310 |
drawnormalO(33,31tm); |
| 2311 |
drawnormalO(43,42tm); |
| 2312 |
drawnormalO(53,51tm); |
| 2313 |
drawnormalO(62tm.vyv,62tm); |
| 2314 |
|
| 2315 |
% \end{macrocode} |
| 2316 |
% |
| 2317 |
% The fourth row consists of three boxes. There is a vertical line |
| 2318 |
% from the bottom |
| 2319 |
% of the leftmost box to the horizontal line drawn in row 4. The three |
| 2320 |
% boxes are aligned horizontally with respect to this line. |
| 2321 |
% \begin{macrocode} |
| 2322 |
%%% fourth row |
| 2323 |
|
| 2324 |
z3224=1/3[z13,z62tm.vyv]; |
| 2325 |
z3554=2/3[z13,z62tm.vyv]; |
| 2326 |
|
| 2327 |
%%% standard_data_name |
| 2328 |
z24bm=(x3224,lyc4); |
| 2329 |
drawSELECT(24, edtl, edth)(btex standard\_data\_name etex); |
| 2330 |
drawnormal(24bm,3224); |
| 2331 |
|
| 2332 |
%%% adhoc_data_name |
| 2333 |
z54bm=(x3554,lyc4); |
| 2334 |
drawTYPE(54, edtl, edth)(btex adhoc\_data\_name etex); |
| 2335 |
|
| 2336 |
%%% STRING |
| 2337 |
z64br=(x62br,lyc4); |
| 2338 |
drawSTRING(64); |
| 2339 |
|
| 2340 |
% \end{macrocode} |
| 2341 |
% |
| 2342 |
% The fifth `row' consists of two vertical connectors to the tops of |
| 2343 |
% the SELECT and TYPE boxes, with a horizontal line connecting the tops |
| 2344 |
% of the connectors. |
| 2345 |
% \begin{macrocode} |
| 2346 |
%%% fifth row |
| 2347 |
|
| 2348 |
z35=(1/2[x24tm,x54tm], lyc5); |
| 2349 |
VyV(24tm, 35, 54tm); |
| 2350 |
drawnormalthreeO(35, 24tm.vyv, 24tm); |
| 2351 |
drawnormalthreeO(35, 54tm.vyv, 54tm); |
| 2352 |
|
| 2353 |
% \end{macrocode} |
| 2354 |
% |
| 2355 |
% The top row consists of a SELECT box vertically aligned above the center |
| 2356 |
% of the horizontal line from the 5th row, together with a line joining |
| 2357 |
% these two, and also a page reference box |
| 2358 |
% off towards the right hand side |
| 2359 |
% \begin{macrocode} |
| 2360 |
%%% sixth row |
| 2361 |
|
| 2362 |
z36bm=(x35,lyc6); |
| 2363 |
drawSELECT(36,edtl, edth)(btex data\_name etex); |
| 2364 |
drawnormal(36bm,35); |
| 2365 |
|
| 2366 |
%%% data_name |
| 2367 |
z66=(x62,lyc6); |
| 2368 |
drawPREF(66, sdtl, ph)(btex 3,1 (4) etex); |
| 2369 |
|
| 2370 |
% \end{macrocode} |
| 2371 |
% |
| 2372 |
% The remaining elements on the diagram are: |
| 2373 |
% a connector on the 4th row from adhoc\_data\_name to STRING; |
| 2374 |
% and a connector on the 6th row from the page reference to data\_name. |
| 2375 |
% \begin{macrocode} |
| 2376 |
%%%% rest of the connectors |
| 2377 |
|
| 2378 |
%%% adhoc/STRING (54, 64) |
| 2379 |
drawnormalO(54mr,64ml); |
| 2380 |
|
| 2381 |
%%% PREF/data_name (36, 66) |
| 2382 |
drawdashO(66ml,36mr); |
| 2383 |
|
| 2384 |
% \end{macrocode} |
| 2385 |
% |
| 2386 |
% The end of this diagram |
| 2387 |
% \begin{macrocode} |
| 2388 |
endfig; % end fig 3 |
| 2389 |
|
| 2390 |
% \end{macrocode} |
| 2391 |
% |
| 2392 |
% \subsubsection{Diagram 4: Supertypes and subtypes} |
| 2393 |
% |
| 2394 |
% This diagram consists of a supertype entity and its four subtypes. The |
| 2395 |
% entities have various attributes. |
| 2396 |
% |
| 2397 |
% \begin{macrocode} |
| 2398 |
|
| 2399 |
beginfig(4) % example 4 |
| 2400 |
%%%drawgrid; |
| 2401 |
|
| 2402 |
% \end{macrocode} |
| 2403 |
% |
| 2404 |
% Define some useful lengths. |
| 2405 |
% \begin{macrocode} |
| 2406 |
%%% length of named page reference boxes |
| 2407 |
plnamed := namespace(btex 9,9 data\_name etex)(nextra); |
| 2408 |
|
| 2409 |
%%% length of entity boxes |
| 2410 |
el := namespace(btex (ABS) Data\_t etex)(nextra); |
| 2411 |
|
| 2412 |
upshift := 2sdth; % vertical space between boxes |
| 2413 |
nextup := sdth+upshift; % vertical space between bases of boxes |
| 2414 |
hspace1 := 1/2el; % space between entity boxes |
| 2415 |
|
| 2416 |
%%% the y coords of box bases |
| 2417 |
lyc1:=0; |
| 2418 |
lyc2:=lyc1+nextup; |
| 2419 |
lyc3:=lyc2+nextup; |
| 2420 |
lyc4:=lyc3+nextup; |
| 2421 |
lyc5:=lyc4+nextup; |
| 2422 |
lyc6:=lyc5+nextup; |
| 2423 |
lyc7:=lyc6+nextup; |
| 2424 |
lyc8:=lyc7+nextup; |
| 2425 |
|
| 2426 |
% \end{macrocode} |
| 2427 |
% |
| 2428 |
% We'll start with the second row which consists of 4 entity (subtype) |
| 2429 |
% boxes. The numbering scheme for point suffixes is |zCR|, where |C| |
| 2430 |
% is the column number and |R| is the row number. |
| 2431 |
% \begin{macrocode} |
| 2432 |
%%%% 2nd row |
| 2433 |
|
| 2434 |
%%% IntArray |
| 2435 |
z12=(0,lyc2); |
| 2436 |
drawENT(12, el, eh)(btex IntArray etex); |
| 2437 |
|
| 2438 |
%%% RealArray |
| 2439 |
z22=(x12br+hspace1, lyc2); |
| 2440 |
drawENT(22, el, eh)(btex RealArray etex); |
| 2441 |
|
| 2442 |
%%% CharArray |
| 2443 |
z42=(x22br+hspace1, lyc2); |
| 2444 |
drawENT(42, el, eh)(btex CharArray etex); |
| 2445 |
|
| 2446 |
%%% BitArray |
| 2447 |
z52=(x42br+hspace1, lyc2); |
| 2448 |
drawENT(52, el, eh)(btex BitArray etex); |
| 2449 |
|
| 2450 |
% \end{macrocode} |
| 2451 |
% |
| 2452 |
% The first row is four simple data type boxes, aligned underneath the |
| 2453 |
% entity boxes. |
| 2454 |
% \begin{macrocode} |
| 2455 |
%%%% 1st row |
| 2456 |
|
| 2457 |
z11bm=(x12bm,lyc1); |
| 2458 |
drawINTEGER(11); |
| 2459 |
|
| 2460 |
z21bm=(x22bm,lyc1); |
| 2461 |
drawREAL(21); |
| 2462 |
|
| 2463 |
z41bm=(x42bm,lyc1); |
| 2464 |
drawSTRING(41); |
| 2465 |
|
| 2466 |
z51bm=(x52bm,lyc1); |
| 2467 |
drawBINARY(51); |
| 2468 |
|
| 2469 |
% \end{macrocode} |
| 2470 |
% |
| 2471 |
% The third `row' is the thick lines connecting the subtype boxes. |
| 2472 |
% \begin{macrocode} |
| 2473 |
%%% 3rd row |
| 2474 |
|
| 2475 |
y13= y23= y43= y53=lyc3; |
| 2476 |
x13=x12tm; x23=x22tm; x43=x42tm; x53=x52tm; |
| 2477 |
drawthick(13,53); % horizontal line |
| 2478 |
%%% vertical connectors |
| 2479 |
drawthickO(13,12tm); drawthickO(23,22tm); |
| 2480 |
drawthickO(43, 42tm); drawthickO(53, 52tm); |
| 2481 |
|
| 2482 |
z33=1/2[z13,z53]; % midpoint of horizontal line |
| 2483 |
|
| 2484 |
% \end{macrocode} |
| 2485 |
% |
| 2486 |
% The 4th row is an abstract supertype entity box, which is made 3 times |
| 2487 |
% taller than the default entity box height. The entity box is centered |
| 2488 |
% with respect to the row of subtype boxes and is connected to the |
| 2489 |
% subtype boxes connector. The digit 1 is placed near the connection point. |
| 2490 |
% There is also a page reference |
| 2491 |
% and an INTEGER box at the left and right (as attributes of the supertype). |
| 2492 |
% \begin{macrocode} |
| 2493 |
%%% 4th row |
| 2494 |
|
| 2495 |
%%% Data_t |
| 2496 |
z34bm=(x33,lyc4); |
| 2497 |
drawENT(34, el, 3eh)(btex \twolines{(ABS)}{Data\_t} etex); |
| 2498 |
drawthick(34bm,33); |
| 2499 |
label.urt("1", z33); % label the connection point |
| 2500 |
|
| 2501 |
%%% Index |
| 2502 |
z14=(0,lyc4); |
| 2503 |
drawPREF(14, plindex, ph)(pindex); |
| 2504 |
|
| 2505 |
%%% INTEGER |
| 2506 |
z54br=(x51br,lyc4); |
| 2507 |
drawINTEGER(54); |
| 2508 |
|
| 2509 |
% \end{macrocode} |
| 2510 |
% |
| 2511 |
% The 5th row has page reference boxes at the left and right |
| 2512 |
% (as attributes of the supertype). |
| 2513 |
% \begin{macrocode} |
| 2514 |
%%% 5th row |
| 2515 |
|
| 2516 |
lyc5:=y34tm-ph; % change the initial y coord value |
| 2517 |
|
| 2518 |
%%% Index |
| 2519 |
z15=(0,lyc5); |
| 2520 |
drawPREF(15, plindex, ph)(pindex); |
| 2521 |
|
| 2522 |
%%% DataType |
| 2523 |
z55=(x54,lyc5); |
| 2524 |
drawPREF(55, plnamed, ph)(btex 3,1 data\_name etex); |
| 2525 |
|
| 2526 |
% \end{macrocode} |
| 2527 |
% |
| 2528 |
% The 6th, and last, row, just consists of a page reference centered |
| 2529 |
% above the supertype box. |
| 2530 |
% \begin{macrocode} |
| 2531 |
%%% 6th row |
| 2532 |
|
| 2533 |
%%% PREF to Data_t |
| 2534 |
lyc6:=lyc5+nextup; |
| 2535 |
z36bm=(x34tm,lyc6); |
| 2536 |
drawPREF(36, pl, ph)(btex 7,5 (6) etex); |
| 2537 |
|
| 2538 |
% \end{macrocode} |
| 2539 |
% |
| 2540 |
% The rest of the diagram consists of the labelled attribute lines. |
| 2541 |
% \begin{macrocode} |
| 2542 |
%%%% attributes |
| 2543 |
|
| 2544 |
%%% Sizes Data_t/Index (34, 14) |
| 2545 |
z3414=(x34,y14mr); |
| 2546 |
drawnormal(3414,14mr); |
| 2547 |
label.ulft(btex Sizes A[1:Limit] etex, z3414); |
| 2548 |
|
| 2549 |
%%% num Data_t/INTEGER (34, 54) |
| 2550 |
z3454=(x34mr,y54ml); |
| 2551 |
drawnormalO(3454,54ml); |
| 2552 |
label.urt(btex (DER) num etex, z3454); |
| 2553 |
|
| 2554 |
%%% Limit Data_t/Index (34, 15) |
| 2555 |
z3415=(x34,y15mr); |
| 2556 |
drawnormal(3415,15mr); |
| 2557 |
label.ulft(btex Limit etex, z3415); |
| 2558 |
|
| 2559 |
%%% Kind Data_t/data_name (34, 55) |
| 2560 |
z3455=(x34mr, y55ml); |
| 2561 |
drawnormal(3455, 55ml); |
| 2562 |
label.urt(btex Kind etex, z3455); |
| 2563 |
|
| 2564 |
%%% PREF into Data_t (36, 34) |
| 2565 |
drawdashO(36bm, 34tm); |
| 2566 |
|
| 2567 |
%%% Data IntArray/INTEGER (12, 11) |
| 2568 |
drawnormalO(12bm, 11tm); |
| 2569 |
label.lrt(btex Data A[1:num] etex, z12bm); |
| 2570 |
|
| 2571 |
%%% Data RealArray/REAL (22, 21) |
| 2572 |
drawnormalO(22bm, 21tm); |
| 2573 |
label.lrt(btex Data A[1:num] etex, z22bm); |
| 2574 |
|
| 2575 |
%%% Data CharArray/STRING (42, 41) |
| 2576 |
drawnormalO(42bm, 41tm); |
| 2577 |
label.lrt(btex Data A[1:num] etex, z42bm); |
| 2578 |
|
| 2579 |
%%% Data BitArray/BINARY (52, 51) |
| 2580 |
drawnormalO(52bm, 51tm); |
| 2581 |
label.lrt(btex Data A[1:num] etex, z52bm); |
| 2582 |
|
| 2583 |
% \end{macrocode} |
| 2584 |
% |
| 2585 |
% The end of this diagram. |
| 2586 |
% \begin{macrocode} |
| 2587 |
endfig; % end fig 4 |
| 2588 |
|
| 2589 |
% \end{macrocode} |
| 2590 |
% |
| 2591 |
% \subsubsection{Diagram 5: Portion of larger model} |
| 2592 |
% |
| 2593 |
% This diagram is more complex than the previous ones. It is, nevertheless, |
| 2594 |
% presented with virtually no commentary. It consists of three entity boxes |
| 2595 |
% and various page reference and interschema boxes to support the |
| 2596 |
% entities' attributes. |
| 2597 |
% |
| 2598 |
% \begin{macrocode} |
| 2599 |
beginfig(5) % example 5 |
| 2600 |
%%drawgrid; |
| 2601 |
|
| 2602 |
% \end{macrocode} |
| 2603 |
% |
| 2604 |
% As usual, specify commonly used variables and values. |
| 2605 |
% \begin{macrocode} |
| 2606 |
plnamed := namespace(btex 7,4 Unstructured\_Donor etex)(nextra); |
| 2607 |
|
| 2608 |
numeric irls, irll; % length of short and long ISR boxes |
| 2609 |
irls = namespace(btex eleven.MeshLocation etex)(nextra); |
| 2610 |
irll = namespace(btex eleven.MeshConnectivityType etex)(nextra); |
| 2611 |
|
| 2612 |
upshift := irh; |
| 2613 |
nextup := irh+upshift; |
| 2614 |
|
| 2615 |
numeric maxrx; % max x coordinate value of LH of right column boxes |
| 2616 |
maxrx := maxx-irrl; |
| 2617 |
numeric xmid; % x coord of figure center |
| 2618 |
xmid := 1/2[irls, maxx-irll]; |
| 2619 |
|
| 2620 |
el := namespace(btex MeshConnectivity1\_1 etex)(nextra); |
| 2621 |
eh := irh; |
| 2622 |
|
| 2623 |
%%% y coords |
| 2624 |
lyc1 := 0; |
| 2625 |
lyc2 := lyc1+nextup; |
| 2626 |
lyc3 := lyc2+nextup; |
| 2627 |
lyc4 := lyc3+nextup+irh; |
| 2628 |
lyc5 := lyc4+nextup; |
| 2629 |
lyc6 := lyc5+nextup; |
| 2630 |
lyc7 := lyc6+nextup; |
| 2631 |
lyc8 := lyc7+nextup; |
| 2632 |
lyc9 := lyc8+nextup; |
| 2633 |
|
| 2634 |
% \end{macrocode} |
| 2635 |
% |
| 2636 |
% Rows one and two have one centered box each. |
| 2637 |
% \begin{macrocode} |
| 2638 |
%%% Zcol/row |
| 2639 |
%%% row 1 |
| 2640 |
|
| 2641 |
%%% PREF for Overlapping |
| 2642 |
z21bm=(xmid,lyc1); |
| 2643 |
drawPREF(21, pl, ph)(btex 5,3 (8) etex) |
| 2644 |
|
| 2645 |
%%% row 2 |
| 2646 |
|
| 2647 |
%%% OverlappingArea |
| 2648 |
z22bm=(x21bm,lyc2); |
| 2649 |
drawENT(22, el, eh)(btex OverlappingArea etex); |
| 2650 |
|
| 2651 |
% \end{macrocode} |
| 2652 |
% |
| 2653 |
% Row three has three boxes, and the middle one is centered. |
| 2654 |
% \begin{macrocode} |
| 2655 |
%%% row 3 |
| 2656 |
|
| 2657 |
%%% IndexArray |
| 2658 |
z13=(pl,lyc3); |
| 2659 |
drawISR(13, irls, irh)(btex eleven.IndexArray etex); |
| 2660 |
|
| 2661 |
%%% Index |
| 2662 |
z23bm=(x22bm,lyc3); |
| 2663 |
drawISR(23, slindex, irh)(sindex); |
| 2664 |
|
| 2665 |
%%% MeshLocation |
| 2666 |
z33br=(maxx,lyc3); |
| 2667 |
drawISR(33, irls, irh)(btex eleven.MeshLocation etex); |
| 2668 |
|
| 2669 |
% \end{macrocode} |
| 2670 |
% |
| 2671 |
% Row four has three boxes, and the middle one is centered. |
| 2672 |
% \begin{macrocode} |
| 2673 |
%%% row 4 |
| 2674 |
|
| 2675 |
%%% MeshConnectivity |
| 2676 |
z24bm=(x23bm,lyc4); |
| 2677 |
drawENT(24, el, eh)(btex MeshConnectivity etex); |
| 2678 |
|
| 2679 |
%%% PREF for MeshConnectivity |
| 2680 |
z14ml=(pl,y24ml); |
| 2681 |
drawPREF(14, pl, ph)(btex 5,2 (8) etex); |
| 2682 |
|
| 2683 |
%%% Structured_Donor |
| 2684 |
z34br=(maxx,lyc4); |
| 2685 |
drawPREF(34, plnamed, ph)(btex 7,5 Structured\_Donor etex); |
| 2686 |
|
| 2687 |
% \end{macrocode} |
| 2688 |
% |
| 2689 |
% Rows five and six have one box each, at the right hand side. |
| 2690 |
% \begin{macrocode} |
| 2691 |
%%% row 5 |
| 2692 |
|
| 2693 |
%%% Unstructured_donor |
| 2694 |
z35br=(maxx,lyc5); |
| 2695 |
drawPREF(35, plnamed, ph)(btex 7,4 Unstructured\_Donor etex); |
| 2696 |
|
| 2697 |
%%% row 6 |
| 2698 |
|
| 2699 |
%%% MeshConnType |
| 2700 |
z36br=(maxx,lyc6); |
| 2701 |
drawISR(36, irll, irh)(btex eleven.MeshConnectivityType etex); |
| 2702 |
|
| 2703 |
% \end{macrocode} |
| 2704 |
% |
| 2705 |
% Row seven has three boxes, and the middle one is centered. |
| 2706 |
% \begin{macrocode} |
| 2707 |
%%% row 7 |
| 2708 |
|
| 2709 |
%%% IndexRange |
| 2710 |
z17=(0,lyc7); |
| 2711 |
drawISR(17, irls, irh)(btex eleven.IndexRange etex); |
| 2712 |
|
| 2713 |
%%% INTEGER |
| 2714 |
x27bm=x24bm; y27ml=y17mr; |
| 2715 |
drawINTEGER(27); |
| 2716 |
|
| 2717 |
%%% Zone |
| 2718 |
z37br=(maxx,lyc7); |
| 2719 |
drawISR(37, irls, irh)(btex seven.Zone etex); |
| 2720 |
|
| 2721 |
% \end{macrocode} |
| 2722 |
% |
| 2723 |
% Rows eight and nine have one centered box each. |
| 2724 |
% \begin{macrocode} |
| 2725 |
%%% row 8 |
| 2726 |
|
| 2727 |
%%% 1to1 |
| 2728 |
z28bm=(x24bm,lyc8); |
| 2729 |
drawENT(28, el, eh)(btex MeshConnectivity1\_1 etex); |
| 2730 |
|
| 2731 |
%%% row 9 |
| 2732 |
|
| 2733 |
%%% PREF to 1to1 |
| 2734 |
z29bm=(x28bm,lyc9); |
| 2735 |
drawPREF(29, pl, ph)(btex 5,1 (8) etex); |
| 2736 |
|
| 2737 |
% \end{macrocode} |
| 2738 |
% |
| 2739 |
% All the boxes have been drawn. The remainder is adding and labelling |
| 2740 |
% attribute lines. First page references to subtype entities. |
| 2741 |
% \begin{macrocode} |
| 2742 |
%%%% attributes, etc |
| 2743 |
|
| 2744 |
drawthickO(21tm,22bm); % PREF to Overlap (21, 22) |
| 2745 |
drawthickO(14mr,24ml); % PREF to MeshConn (14, 24) |
| 2746 |
drawthickO(29bm,28tm); % PREF to 1to1 (29, 28) |
| 2747 |
|
| 2748 |
% \end{macrocode} |
| 2749 |
% |
| 2750 |
% The attributes of entity OverlappingArea (|z22|) |
| 2751 |
% \begin{macrocode} |
| 2752 |
%%% PointListSize (22, 23) |
| 2753 |
drawdashO(22tm,23bm); |
| 2754 |
label.llft(btex PointListSize etex, z23bm); |
| 2755 |
|
| 2756 |
%%% PointRange (22, 17) |
| 2757 |
z22A=1/4[z22bl,z22tl]; z17A=(1/2[0,x13], y17); |
| 2758 |
VH(17A,22A); |
| 2759 |
drawdashthreeO(22A, 17A.vh, 17A); |
| 2760 |
label.ulft(btex PointRange etex, z22A); |
| 2761 |
|
| 2762 |
%%% PointList (22, 13) |
| 2763 |
z22B=3/4[z22bl,z22tl]; |
| 2764 |
VH(13bm,22B); |
| 2765 |
drawdashthreeO(22B, 13bm.vh, 13bm); |
| 2766 |
label.ulft(btex PointList etex, z22B); |
| 2767 |
|
| 2768 |
%%% MeshLocation (22, 33) |
| 2769 |
z22C=1/4[z22br,z22tr]; |
| 2770 |
z33B=2/3[z33bl,z33br]; |
| 2771 |
VH(33B,22C); |
| 2772 |
drawnormalthreeO(22C, 33B.vh, 33B); |
| 2773 |
label.urt(btex (DER) Location etex, z22C); |
| 2774 |
|
| 2775 |
%%% Meshloc (22, 33) |
| 2776 |
z22D=3/4[z22br,z22tr]; |
| 2777 |
z33A=1/3[z33bl,z33br]; |
| 2778 |
VH(33A,22D); |
| 2779 |
drawdashthreeO(22D, 33A.vh, 33A); |
| 2780 |
label.urt(btex Meshloc etex, z22D); |
| 2781 |
|
| 2782 |
% \end{macrocode} |
| 2783 |
% |
| 2784 |
% The attributes of entity MeshConnectivity (|z24|). |
| 2785 |
% \begin{macrocode} |
| 2786 |
%%% PointListSize (24, 23) |
| 2787 |
drawnormalO(24bm, 23tm); |
| 2788 |
label.ulft(btex PointListSize etex, z23tm); |
| 2789 |
|
| 2790 |
%%% StructuredDonor (24, 34) |
| 2791 |
z24A=(x24br,y34ml); |
| 2792 |
draw z24A--z34ml dashes; |
| 2793 |
label.lrt(btex StructuredDonor etex, z24A); |
| 2794 |
|
| 2795 |
%%% UnstructuredDonor (24, 35) |
| 2796 |
z24B=3/4[z24br,z24tr]; |
| 2797 |
HvH(24B,35ml); |
| 2798 |
drawdashfourO(24B, 24B.hvh, 35ml.hvh, 35ml); |
| 2799 |
label.urt(btex UnstructuredDonor etex, z24B.hvh); |
| 2800 |
|
| 2801 |
%%% Meshloc (24, 33) |
| 2802 |
z24C=4/6[z24bl,z24br]; |
| 2803 |
z33C=(x33A,y33tm); |
| 2804 |
y2433C=1/3[y33C,y24C]; |
| 2805 |
VyV(24C, 2433C, 33C); |
| 2806 |
drawdashfourO(24C, 24C.vyv, 33C.vyv, 33C); |
| 2807 |
label.lrt(btex Meshloc etex, z24C.vyv); |
| 2808 |
|
| 2809 |
%%% Location (24, 33) |
| 2810 |
z24D=5/6[z24bl,z24br]; |
| 2811 |
z33D=(x33B,y33tm); |
| 2812 |
y2433D=2/3[y33D,y24D]; |
| 2813 |
VyV(24D, 2433D, 33D); |
| 2814 |
drawnormalfourO(24D, 24D.vyv, 33D.vyv, 33D); |
| 2815 |
label.lrt(btex (DER) Location etex, z24D.vyv); |
| 2816 |
|
| 2817 |
%%% ConnectivityType (24, 36) |
| 2818 |
z24H=(x24D,y24tr); |
| 2819 |
z36H=z36bm; |
| 2820 |
y2436H=1/2[y35tr,y36br]; |
| 2821 |
VyV(24H, 2436H, 36H); |
| 2822 |
drawnormalfourO(24H, 24H.vyv, 36H.vyv, 36H); |
| 2823 |
label.urt(btex (DER) ConnectivityType etex, z24H.vyv); |
| 2824 |
|
| 2825 |
%%% Meshcon (24, 36) |
| 2826 |
z24G=(x24C,y24tr); |
| 2827 |
z36G=z36ml; |
| 2828 |
VH(24G,36G); |
| 2829 |
drawdashthreeO(24G, 24G.vh, 36G); |
| 2830 |
label.urt(btex Meshcon etex, z24G.vh); |
| 2831 |
|
| 2832 |
%%% K (24, 27) |
| 2833 |
drawnormalO(24tm, 27bm); |
| 2834 |
label.ulft(btex K etex, z24tm); |
| 2835 |
|
| 2836 |
%%% PointRange (24, 17) |
| 2837 |
z24E=1/4[z24tl,z24tr]; |
| 2838 |
x17br-x17E = x17A-x17bl; |
| 2839 |
y17E = y17A; |
| 2840 |
VhV(24E,17E); |
| 2841 |
drawdashfourO(24E, 24E.vhv, 17E.vhv, 17E); |
| 2842 |
label.ulft(btex PointRange etex, z24E); |
| 2843 |
|
| 2844 |
%%% PointList (24, 13) |
| 2845 |
z24F=1/4[z24bl,z24br]; |
| 2846 |
z13F=1/2[z13tl,z13tr]; |
| 2847 |
VhV(24F,13F); |
| 2848 |
drawnormalfourO(24F, 24F.vhv, 13F.vhv, 13F); |
| 2849 |
label.llft(btex PointList etex, z24F); |
| 2850 |
|
| 2851 |
% \end{macrocode} |
| 2852 |
% |
| 2853 |
% The attributes of entity MeshConnectivity1\_1 (|z28|) |
| 2854 |
% \begin{macrocode} |
| 2855 |
%%% N (28, 27) |
| 2856 |
z27A=1/5[z27tl,z27tr]; |
| 2857 |
z28A=(x27A,y28bl); |
| 2858 |
drawnormalO(28A,27A); |
| 2859 |
label.llft(btex N etex, z28A); |
| 2860 |
|
| 2861 |
%%% trans (28, 27) |
| 2862 |
z27B=1/2[z27tl,z27tr]; |
| 2863 |
z28B=(x27B,y28bl); |
| 2864 |
drawdashO(28B,27B); |
| 2865 |
label.lrt(btex \twolines{trans}{A[1:N]} etex, z28B); |
| 2866 |
|
| 2867 |
%%% Transform (28, 27) |
| 2868 |
z27C=1/2[z27br,z27tr]; |
| 2869 |
z28C=(1/2[x27C,x28br], y28br); |
| 2870 |
VH(28C,27C); |
| 2871 |
drawnormalthreeO(28C,28C.vh,27C); |
| 2872 |
label.lrt(btex (DER) Transform A[1:N] etex , z28C); |
| 2873 |
|
| 2874 |
%%% DonorZone (28, 37) |
| 2875 |
z28D=1/2[z28br,z28tr]; |
| 2876 |
z37D=z37tm; |
| 2877 |
VH(37D,28D); |
| 2878 |
drawdashthreeO(28D,37D.vh,37D); |
| 2879 |
label.urt(btex DonorZone etex, z28D); |
| 2880 |
|
| 2881 |
%%% DonorPointRange (28, 17) |
| 2882 |
z28G=3/4[z28bl,z28tl]; |
| 2883 |
z17G=(x17A,y17tl); |
| 2884 |
VH(17G,28G); |
| 2885 |
drawnormalthreeO(28G,17G.vh,17G); |
| 2886 |
label.ulft(btex DonorPointRange etex, z28G); |
| 2887 |
|
| 2888 |
%%% PointRange (28, 17) |
| 2889 |
z28H=1/4[z28bl,z28tl]; |
| 2890 |
z17H=(x17E,y17G); |
| 2891 |
VH(17H,28H); |
| 2892 |
drawnormalthreeO(28H,17H.vh,17H); |
| 2893 |
label.ulft(btex PointRange etex, z28H); |
| 2894 |
|
| 2895 |
% \end{macrocode} |
| 2896 |
% |
| 2897 |
% The end of this diagram. |
| 2898 |
% \begin{macrocode} |
| 2899 |
endfig; % end fig 5 |
| 2900 |
|
| 2901 |
% \end{macrocode} |
| 2902 |
% |
| 2903 |
% \subsection{Diagrams 6--11: Car model} |
| 2904 |
% |
| 2905 |
% The diagrams in this section are all taken from~\cite[Chapter~2]{EBOOK}. |
| 2906 |
% A simple information/data model of a car, car model, and car manufacturer |
| 2907 |
% is presented in a variety of BLA languages, among which is, |
| 2908 |
% of course, \ExpressG. In words, the model is: |
| 2909 |
% \begin{quote} \itshape |
| 2910 |
% A car is made by a manufacturer. Each manufacturer has a unique name. |
| 2911 |
% A manufacturer constructs cars in several models and a car is of a |
| 2912 |
% particular model. A manufacturer gives a serial number to each car |
| 2913 |
% he produces and this is unique across all cars produced by that |
| 2914 |
% manufacturer. Each model also has a name, and this is unique across |
| 2915 |
% all models. A car has a year of production. |
| 2916 |
% \end{quote} |
| 2917 |
% This model is a small portion of a conceptual model developed as a common |
| 2918 |
% specification for comparing modeling languages~\cite{TR9007}. |
| 2919 |
% |
| 2920 |
% The purpose of these diagrams is to |
| 2921 |
% illustrate how the \Lpack{expressg} package supports a range of graphical |
| 2922 |
% languages. |
| 2923 |
% |
| 2924 |
% |
| 2925 |
% \subsubsection{Diagram 6: \ExpressG} |
| 2926 |
% |
| 2927 |
% Having already seen several examples of \ExpressG{} diagrams, this one |
| 2928 |
% is presented with no further comments. |
| 2929 |
% \begin{macrocode} |
| 2930 |
|
| 2931 |
beginfig(6) % example 6 EXPRESS-G |
| 2932 |
%%%drawgrid; |
| 2933 |
|
| 2934 |
upshift := 3/2onelineh; |
| 2935 |
nextup := onelineh+upshift; |
| 2936 |
|
| 2937 |
el := namespace(btex manufacturer etex)(nextra); |
| 2938 |
eh := onelineh; |
| 2939 |
|
| 2940 |
hspace1 := 1/2el; |
| 2941 |
|
| 2942 |
%%% y coords |
| 2943 |
lyc1 := 0; |
| 2944 |
lyc2 := lyc1+nextup; |
| 2945 |
lyc3 := lyc2+nextup; |
| 2946 |
lyc4 := lyc3+nextup; |
| 2947 |
lyc5 := lyc4+nextup; |
| 2948 |
|
| 2949 |
%%% Zcol/row |
| 2950 |
|
| 2951 |
%%% rows 4 and 5 |
| 2952 |
z14=(0,lyc4); |
| 2953 |
drawENT(14, el, eh)(btex manufacturer etex); |
| 2954 |
|
| 2955 |
z25=(x14br+hspace1, lyc5); |
| 2956 |
drawSTRING(25); |
| 2957 |
|
| 2958 |
z34=(x25br+hspace1, lyc4); |
| 2959 |
drawENT(34, el, eh)(btex car\_model etex); |
| 2960 |
|
| 2961 |
%%% row 3 |
| 2962 |
|
| 2963 |
z33bm=(x34bm, lyc3); |
| 2964 |
drawENT(33, el, eh)(btex car etex); |
| 2965 |
|
| 2966 |
%%% row 2 |
| 2967 |
|
| 2968 |
z22=(x25, lyc2); |
| 2969 |
drawINTEGER(22); |
| 2970 |
|
| 2971 |
%%% row 1 |
| 2972 |
|
| 2973 |
z21=(x22, lyc1); |
| 2974 |
drawSTRING(21); |
| 2975 |
|
| 2976 |
%%% attributes |
| 2977 |
|
| 2978 |
%%% manufacturer name (14, 25) |
| 2979 |
VH(14tm, 25ml); |
| 2980 |
drawnormalthreeO(14tm, 14tm.vh, 25ml); |
| 2981 |
label.urt(btex *name etex, z14tm.vh); |
| 2982 |
|
| 2983 |
%%% model name (34, 25) |
| 2984 |
VH(34tm, 25mr); |
| 2985 |
drawnormalthreeO(34tm, 34tm.vh, 25mr); |
| 2986 |
label.ulft(btex *name etex, z34tm.vh); |
| 2987 |
|
| 2988 |
%%% made_by (34, 14) |
| 2989 |
drawnormalO(34ml, 14mr); |
| 2990 |
label.ulft(btex made\_by etex, z34ml); |
| 2991 |
|
| 2992 |
%%% model_type (33, 34) |
| 2993 |
drawnormalO(33tm, 34bm); |
| 2994 |
label.urt(btex model\_type etex, z33tm); |
| 2995 |
|
| 2996 |
%%% DER made_by (33, 14) |
| 2997 |
VH(14bm, 33ml); |
| 2998 |
drawnormalthreeO(33ml, 14bm.vh, 14bm); |
| 2999 |
label.ulft(btex (DER) *made\_by etex, z33ml); |
| 3000 |
|
| 3001 |
%%% year (33, 22) |
| 3002 |
z33A=1/3[z33bl, z33br]; |
| 3003 |
VH(33A, 22mr); |
| 3004 |
drawnormalthreeO(33A, 33A.vh, 22mr); |
| 3005 |
label.ulft(btex year etex, z33A.vh); |
| 3006 |
|
| 3007 |
%%% serial_no |
| 3008 |
z33B=2/3[z33bl, z33br]; |
| 3009 |
VH(33B, 21mr); |
| 3010 |
drawnormalthreeO(33B, 33B.vh, 21mr); |
| 3011 |
label.ulft(btex *serial\_no etex, z33B.vh); |
| 3012 |
|
| 3013 |
% \end{macrocode} |
| 3014 |
% |
| 3015 |
% The end of this diagram |
| 3016 |
% \begin{macrocode} |
| 3017 |
endfig; % end fig 6 |
| 3018 |
|
| 3019 |
% \end{macrocode} |
| 3020 |
% |
| 3021 |
% |
| 3022 |
% \subsubsection{Diagram 7: Shlaer-Mellor} |
| 3023 |
% |
| 3024 |
% The Shlaer-Mellor graphical language~\cite{SHLAER88} is fairly simple, |
| 3025 |
% consisting basically of rectangles and arrowheaded lines. However, unlike |
| 3026 |
% \ExpressG{} each box usually has several lines of text. These are placed |
| 3027 |
% individually at the desired positions within each box. |
| 3028 |
% |
| 3029 |
% Notice below that |
| 3030 |
% I have used |drawENT| with an empty string to draw the rectangular boxes; |
| 3031 |
% the routines for \ExpressG{} diagrams can, if suitable, be used in any |
| 3032 |
% sort of diagram. |
| 3033 |
% |
| 3034 |
% \begin{macrocode} |
| 3035 |
|
| 3036 |
beginfig(7) % example 7 |
| 3037 |
%%%drawgrid; |
| 3038 |
|
| 3039 |
el := namespace(btex MANUFACTURER etex)(niextra); |
| 3040 |
eh := onelineh; |
| 3041 |
|
| 3042 |
hspace1 := namespace(btex made by maker of etex)(4ndextra); |
| 3043 |
|
| 3044 |
hspace2 := 6onelineh; % height of CAR |
| 3045 |
hspace3 := 5onelineh; % space between rows |
| 3046 |
hspace4 := 3onelineh; % height of MANUFACTURER |
| 3047 |
|
| 3048 |
%%% y coords |
| 3049 |
lyc1 := 0; |
| 3050 |
lyc2 := lyc1+hspace2+hspace3; |
| 3051 |
|
| 3052 |
%%% Zcol/row |
| 3053 |
|
| 3054 |
%%% row 2 |
| 3055 |
|
| 3056 |
z12=(0, lyc2); |
| 3057 |
drawENT(12, el, hspace4)(""); |
| 3058 |
x121=x12+sdtbs; |
| 3059 |
label.rt(btex MANUFACTURER etex, (x121, 2/3[y12bl, y12tl])); |
| 3060 |
label.rt(btex * manuf-name etex, (x121, 1/3[y12bl, y12tl])); |
| 3061 |
|
| 3062 |
z22=(x12br+hspace1, lyc2); |
| 3063 |
drawENT(22, el, hspace4)(""); |
| 3064 |
x221=x22+sdtbs; |
| 3065 |
label.rt(btex CAR-MODEL etex, (x221, 2/3[y12bl, y12tl])); |
| 3066 |
label.rt(btex * model-name etex, (x221, 1/3[y12bl, y12tl])); |
| 3067 |
|
| 3068 |
%%% row 1 |
| 3069 |
|
| 3070 |
z21=(x22, lyc1); |
| 3071 |
drawENT(21, el, hspace2)(""); |
| 3072 |
x211=x21+sdtbs; |
| 3073 |
label.rt(btex CAR etex, (x211, 5/6[y21bl, y21tl])); |
| 3074 |
label.rt(btex o year etex, (x211, 4/6[y21bl, y21tl])); |
| 3075 |
label.rt(btex o model (R) etex, (x211, 3/6[y21bl, y21tl])); |
| 3076 |
label.rt(btex * serial-no etex, (x211, 2/6[y21bl, y21tl])); |
| 3077 |
label.rt(btex * maker (R) etex, (x211, 1/6[y21bl, y21tl])); |
| 3078 |
|
| 3079 |
%%%%% relationship lines |
| 3080 |
|
| 3081 |
% \end{macrocode} |
| 3082 |
% In this diagram the labels on the relationship lines tend to bump |
| 3083 |
% into the line ending symbol. \Mpost{} ignores initial and final spaces |
| 3084 |
% within |btex...etex|. The paired braces below, each enclosing one space, |
| 3085 |
% supply non-discarded spaces. (These could also have been written as |
| 3086 |
% |\space|). |
| 3087 |
% \begin{macrocode} |
| 3088 |
%%% MANUFACTURER / CAR-MODEL (12, 22) |
| 3089 |
drawnormalDCA(12mr, 22ml); |
| 3090 |
drawnormalCA(22ml, 12mr); |
| 3091 |
label.urt(btex { }{ }made by etex, z12mr); |
| 3092 |
label.llft(btex maker of{ }{ } etex, z22ml); |
| 3093 |
|
| 3094 |
%%% MANUFACTURER / CAR (12, 21) |
| 3095 |
VH(12bm, 21ml); |
| 3096 |
drawnormalCA(12bm.vh, 12bm); |
| 3097 |
drawnormalDCA(12bm.vh, 21ml); |
| 3098 |
label.llft(btex { }{ }made by etex, z12bm); |
| 3099 |
label.ulft(btex maker of{ }{ } etex, z21ml); |
| 3100 |
|
| 3101 |
%%% CAR-MODEL / CAR (22, 21) |
| 3102 |
drawnormalDCA(22bm, 21tm); |
| 3103 |
drawnormalCA(21tm, 22bm); |
| 3104 |
label.lrt(btex { }one of etex, z22bm); |
| 3105 |
label.ulft(btex type of{ } etex, z21tm); |
| 3106 |
|
| 3107 |
% \end{macrocode} |
| 3108 |
% |
| 3109 |
% The end of this diagram |
| 3110 |
% \begin{macrocode} |
| 3111 |
endfig; % end fig 7 |
| 3112 |
|
| 3113 |
% \end{macrocode} |
| 3114 |
% |
| 3115 |
% |
| 3116 |
% \subsubsection{Diagram 8: IDEF1X} |
| 3117 |
% |
| 3118 |
% IDEF1X is a popular language in America for representing the structure |
| 3119 |
% of relational databases, and was developed under the auspices of the |
| 3120 |
% US Air Force~\cite{IDEF1X}. |
| 3121 |
% |
| 3122 |
% The general layout of the diagram mimics the previous one. All the boxes |
| 3123 |
% are divided horizontally into an upper and lower part. |
| 3124 |
% The |drawdoublerectangle| is used for the rectangular boxes, but the dividing |
| 3125 |
% line in the rounded box has to be added by hand, as it were. |
| 3126 |
% |
| 3127 |
% \begin{macrocode} |
| 3128 |
|
| 3129 |
beginfig(8) % example 8 IDEF1X |
| 3130 |
%%%drawgrid; |
| 3131 |
|
| 3132 |
el := namespace(btex MANUFACTURER etex)(niextra); |
| 3133 |
eh := onelineh; |
| 3134 |
|
| 3135 |
hspace1 := namespace(btex made by maker of etex)(4ndextra); |
| 3136 |
|
| 3137 |
hspace2 := 5onelineh; % height of CAR |
| 3138 |
hspace3 := 5onelineh; % space between rows |
| 3139 |
hspace4 := 3onelineh; % height of MANUFACTURER |
| 3140 |
|
| 3141 |
%%% y coords |
| 3142 |
lyc1 := 0; |
| 3143 |
lyc2 := lyc1+hspace2+hspace3; |
| 3144 |
|
| 3145 |
%%% Zcol/row |
| 3146 |
|
| 3147 |
%%% row 2 |
| 3148 |
|
| 3149 |
z12=(0, lyc2); |
| 3150 |
drawdoublerectangle(12, el, hspace4, 1/2); |
| 3151 |
label.urt(btex Manufacturer etex, z12tl); |
| 3152 |
x121=x12+sdtbs; |
| 3153 |
label.rt(btex manuf-name etex, (x121, 3/4[y12bl, y12tl])); |
| 3154 |
|
| 3155 |
z22=(x12br+hspace1, lyc2); |
| 3156 |
drawdoublerectangle(22, el, hspace4, 1/2); |
| 3157 |
label.urt(btex Car-model etex, z22tl); |
| 3158 |
x221=x22+sdtbs; |
| 3159 |
label.rt(btex Model-name etex, (x221, 3/4[y12bl, y12tl])); |
| 3160 |
label.rt(btex Manuf-name (FK) etex, (x221, 1/4[y12bl, y12tl])); |
| 3161 |
|
| 3162 |
%%% row 1 |
| 3163 |
|
| 3164 |
z21=(x22, lyc1); |
| 3165 |
drawroundedbox(21, el, hspace2, 2sdtbs)(""); |
| 3166 |
label.urt(btex Car etex, z21tl); |
| 3167 |
draw z21ml--z21mr; |
| 3168 |
x211=x21+sdtbs; |
| 3169 |
label.rt(btex Serial-no etex, (x211, 5/6[y21bl, y21tl])); |
| 3170 |
label.rt(btex Manuf-name (FK) etex, (x211, 4/6[y21bl, y21tl])); |
| 3171 |
label.rt(btex Model-name (FK) etex, (x211, 2/6[y21bl, y21tl])); |
| 3172 |
label.rt(btex Year etex, (x211, 1/6[y21bl, y21tl])); |
| 3173 |
|
| 3174 |
%%%%% relationship lines |
| 3175 |
|
| 3176 |
%%% MANUFACTURER / CAR-MODEL (12, 22) |
| 3177 |
drawnormalD(12mr, 22ml); |
| 3178 |
label.top(btex of etex, 1/2[z12mr, z22ml]); |
| 3179 |
|
| 3180 |
%%% MANUFACTURER / CAR (12, 21) |
| 3181 |
VH(12bm, 21ml); |
| 3182 |
drawnormalthreeD(12bm, 12bm.vh, 21ml); |
| 3183 |
label.top(btex makes etex, 1/2[z12bm.vh, z21ml]); |
| 3184 |
label.ulft(btex P{ } etex, z21ml); |
| 3185 |
|
| 3186 |
%%% CAR-MODEL / CAR (22, 21) |
| 3187 |
drawnormalD(22bm, 21tm); |
| 3188 |
label.lft(btex of etex, 1/2[z21tm,z22bm]); |
| 3189 |
label.urt(btex { }P etex, z21tm); |
| 3190 |
|
| 3191 |
% \end{macrocode} |
| 3192 |
% |
| 3193 |
% The end of this diagram |
| 3194 |
% \begin{macrocode} |
| 3195 |
endfig; % end fig 8 |
| 3196 |
|
| 3197 |
% \end{macrocode} |
| 3198 |
% |
| 3199 |
% |
| 3200 |
% \subsubsection{Diagram 9: OMT} |
| 3201 |
% |
| 3202 |
% OMT~\cite{RUMBAUGH91} was the precursor to the currently popular UML |
| 3203 |
% structure modeling language. |
| 3204 |
% If you are curious as to why I believe that lexical languages are in |
| 3205 |
% general better than BLA languages, the chapter on developing a compiler |
| 3206 |
% for OMT highlights, probably unintentionally, some of the disadvantages |
| 3207 |
% of BLAs. |
| 3208 |
% |
| 3209 |
% The general look of the OMT diagram is almost identical |
| 3210 |
% to the IDEF1X diagram. |
| 3211 |
% |
| 3212 |
% \begin{macrocode} |
| 3213 |
|
| 3214 |
beginfig(9) % example 9 OMT |
| 3215 |
%%%drawgrid; |
| 3216 |
|
| 3217 |
el := namespace(btex {\bf MANUFACTURER} etex)(niextra); |
| 3218 |
eh := onelineh; |
| 3219 |
|
| 3220 |
hspace1 := namespace(btex made by maker of etex)(4ndextra); |
| 3221 |
|
| 3222 |
hspace2 := 4onelineh; % height of CAR |
| 3223 |
hspace3 := 4onelineh; % space between rows |
| 3224 |
hspace4 := 3onelineh; % height of MANUFACTURER |
| 3225 |
|
| 3226 |
%%% y coords |
| 3227 |
lyc1 := 0; |
| 3228 |
lyc2 := lyc1+hspace2+hspace3; |
| 3229 |
|
| 3230 |
%%% Zcol/row |
| 3231 |
|
| 3232 |
%%% row 2 |
| 3233 |
|
| 3234 |
z12=(0, lyc2); |
| 3235 |
drawdoublerectangle(12, el, hspace4, 1/2); |
| 3236 |
x121=x12+sdtbs; |
| 3237 |
label.rt(btex {\bf Manufacturer} etex, (x121, 3/4[y12bl, y12tl])); |
| 3238 |
label.rt(btex name : String etex, (x121, 1/4[y12bl, y12tl])); |
| 3239 |
|
| 3240 |
z22=(x12br+hspace1, lyc2); |
| 3241 |
drawdoublerectangle(22, el, hspace4, 1/2); |
| 3242 |
x221=x22+sdtbs; |
| 3243 |
label.rt(btex {\bf Car Model} etex, (x221, 3/4[y22bl, y22tl])); |
| 3244 |
label.rt(btex name: String etex, (x221, 1/4[y22bl, y22tl])); |
| 3245 |
|
| 3246 |
%%% row 1 |
| 3247 |
|
| 3248 |
z21=(x22, lyc1); |
| 3249 |
drawdoublerectangle(21, el, hspace2, 1/3); |
| 3250 |
x211=x21+sdtbs; |
| 3251 |
label.rt(btex {\bf Car} etex, (x211, 5/6[y21bl, y21tl])); |
| 3252 |
label.rt(btex serial-no : String etex, (x211, 4/9[y21bl, y21tl])); |
| 3253 |
label.rt(btex year : Integer etex, (x211, 2/9[y21bl, y21tl])); |
| 3254 |
|
| 3255 |
%%%%% relationship lines |
| 3256 |
|
| 3257 |
%%% MANUFACTURER / CAR-MODEL (12, 22) |
| 3258 |
drawnormalD(12mr, 22ml); |
| 3259 |
label.top(btex {\it makes} etex, 1/2[z12mr, z22ml]); |
| 3260 |
label.ulft(btex 1+{ } etex, z22ml); |
| 3261 |
|
| 3262 |
%%% MANUFACTURER / CAR (12, 21) |
| 3263 |
VH(12bm, 21ml); |
| 3264 |
drawnormalthreeD(12bm, 12bm.vh, 21ml); |
| 3265 |
label.top(btex {\it makes} etex, 1/2[z12bm.vh, z21ml]); |
| 3266 |
label.ulft(btex 1+{ } etex, z21ml); |
| 3267 |
|
| 3268 |
%%% CAR-MODEL / CAR (22, 21) |
| 3269 |
drawnormalD(22bm, 21tm); |
| 3270 |
label.lft(btex {\it produced as} etex, 1/2[z21tm,z22bm]); |
| 3271 |
|
| 3272 |
% \end{macrocode} |
| 3273 |
% |
| 3274 |
% The end of this diagram |
| 3275 |
% \begin{macrocode} |
| 3276 |
endfig; % end fig 9 |
| 3277 |
|
| 3278 |
% \end{macrocode} |
| 3279 |
% |
| 3280 |
% |
| 3281 |
% \subsubsection{Diagram 10: E-R} |
| 3282 |
% |
| 3283 |
% There are several flavours of Entity-Relationship modeling icons. |
| 3284 |
% I have used a style from~\cite{ELMASRI89}. |
| 3285 |
% |
| 3286 |
% This example introduces some new icons and \Mpost{} modeling. |
| 3287 |
% |
| 3288 |
% \begin{macrocode} |
| 3289 |
|
| 3290 |
beginfig(10) % example 10 E-R |
| 3291 |
%%%drawgrid; |
| 3292 |
|
| 3293 |
numeric diam; diam := 2onelineh; |
| 3294 |
|
| 3295 |
upshift := diam; % circle diameter |
| 3296 |
nextup := diam+upshift; |
| 3297 |
|
| 3298 |
el := namespace(btex MANUFACTURER etex)(niextra); |
| 3299 |
eh := onelineh; |
| 3300 |
|
| 3301 |
numeric dl, dh; % length and height of diamond boxes |
| 3302 |
dl := 1/2el; dh := 2eh; |
| 3303 |
|
| 3304 |
numeric marg; marg := 4u; % double the seperation between parallel lines |
| 3305 |
|
| 3306 |
hspace1 := 1/2el; |
| 3307 |
|
| 3308 |
%%% y coords |
| 3309 |
lyc1 := 0; |
| 3310 |
lyc2 := lyc1+nextup; |
| 3311 |
lyc3 := lyc2+nextup; |
| 3312 |
lyc4 := lyc3+nextup; |
| 3313 |
lyc5 := lyc4+nextup; |
| 3314 |
|
| 3315 |
% \end{macrocode} |
| 3316 |
% |
| 3317 |
% The diagram has 5 rows. Start with the 4th as it is the widest row. |
| 3318 |
% \begin{macrocode} |
| 3319 |
%%% Zcol/row |
| 3320 |
%%% row 4 |
| 3321 |
|
| 3322 |
z14=(0,lyc4); |
| 3323 |
drawENT(14, el, eh)(btex manufacturer etex); |
| 3324 |
|
| 3325 |
z34ml=(x14br+hspace1, y14mr); |
| 3326 |
drawdiamondbox(34, dl, dh)(btex has etex); |
| 3327 |
|
| 3328 |
z54ml=(x34mr+hspace1, y34mr); |
| 3329 |
drawENT(54, el, eh)(btex car\_model etex); |
| 3330 |
|
| 3331 |
%%% row 5 |
| 3332 |
|
| 3333 |
z15bm=(x14bm, lyc5); |
| 3334 |
drawcirclebox(15, diam)(btex Name etex); |
| 3335 |
|
| 3336 |
z55bm=(x54bm, lyc5); |
| 3337 |
drawcirclebox(55, diam)(btex Name etex); |
| 3338 |
|
| 3339 |
% \end{macrocode} |
| 3340 |
% |
| 3341 |
% The third row consists of an ordinary diamond box at the right and |
| 3342 |
% a doubly enclosed diamond on the left. The |drawtwodiamondbox| routine |
| 3343 |
% is used for the latter. Note that values of |marg| are |
| 3344 |
% used to make the oustside of the double diamond larger than the single |
| 3345 |
% diamonds. |
| 3346 |
% \begin{macrocode} |
| 3347 |
%%% row 3 |
| 3348 |
|
| 3349 |
z53bm=(x54bm, lyc3); |
| 3350 |
drawdiamondbox(53, dl, dh)(btex of etex); |
| 3351 |
|
| 3352 |
z13c=(x14bm, y53c); |
| 3353 |
drawtwodiamondbox(13, dl+marg, dh+marg, 2/5marg)(btex Makes etex); |
| 3354 |
|
| 3355 |
% \end{macrocode} |
| 3356 |
% |
| 3357 |
% The second row just consists of a doubly enclosed rectangular box. |
| 3358 |
% There is no explicit routine for drawing this, so two |drawENT| routines |
| 3359 |
% are used for drawing smaller and larger superimposed boxes (one with |
| 3360 |
% an empty text argument). |
| 3361 |
% \begin{macrocode} |
| 3362 |
%%% row 2 |
| 3363 |
|
| 3364 |
z32bm=(x34bm, lyc2); |
| 3365 |
drawENT(32, el, eh)(btex car etex); |
| 3366 |
z31c=z32c; |
| 3367 |
drawENT(31, el+marg, eh+marg)(""); |
| 3368 |
|
| 3369 |
%%% row 1 |
| 3370 |
|
| 3371 |
z21bm=(x32bl, lyc1); |
| 3372 |
drawcirclebox(21, 5/4diam)(btex \twolines{Serial}{No} etex); |
| 3373 |
|
| 3374 |
z41bm=(x32br, lyc1); |
| 3375 |
drawcirclebox(41, diam)(btex Year etex); |
| 3376 |
|
| 3377 |
%%%%%% lines |
| 3378 |
|
| 3379 |
%%% Name / manufacturer (15, 14) |
| 3380 |
drawnormal(15bm, 14tm); |
| 3381 |
|
| 3382 |
%%% Name / model (55, 54) |
| 3383 |
drawnormal(55bm, 54tm); |
| 3384 |
|
| 3385 |
%%% Mnf / has (14, 34) |
| 3386 |
drawnormal(14mr, 34ml); |
| 3387 |
label.top(btex 1 etex, 1/2[z14mr,z34ml]); |
| 3388 |
|
| 3389 |
%%% has/ model (34, 54) |
| 3390 |
drawnormal(34mr, 54ml); |
| 3391 |
label.top(btex N etex, 1/2[z34mr,z54ml]); |
| 3392 |
|
| 3393 |
%%% Mnf / makes (14, 13) |
| 3394 |
drawnormal(14bm, 13tm); |
| 3395 |
label.rt(btex 1 etex, 1/2[z14bm,z13tm]); |
| 3396 |
|
| 3397 |
%%% model / of (54, 53) |
| 3398 |
drawnormal(54bm, 53tm); |
| 3399 |
label.rt(btex 1 etex, 1/2[z54bm,z53tm]); |
| 3400 |
|
| 3401 |
% \end{macrocode} |
| 3402 |
% In the diagrams so far, except trivially in the first, |
| 3403 |
% the lines have all been vertical and/or |
| 3404 |
% horizontal. Now we meet lines in arbitrary directions, and parallel |
| 3405 |
% to boot. |
| 3406 |
% |
| 3407 |
% A pair of parallel lines joins the bottom of the doubly enclosed diamond |
| 3408 |
% to the left side of the doubly enclosed rectangle. Drawing one of these is |
| 3409 |
% simple --- just draw a straight line between the bottom middle of the |
| 3410 |
% diamond to the middle left of the rectangle. |
| 3411 |
% \begin{macrocode} |
| 3412 |
%%% makes / car (13, 31) |
| 3413 |
drawnormal(13bm, 31ml); |
| 3414 |
% \end{macrocode} |
| 3415 |
% |
| 3416 |
% The point |z31A| is |1/2marg| above the point |z31ml|. This is one end |
| 3417 |
% of the parallel line. |
| 3418 |
% \begin{macrocode} |
| 3419 |
z31A=(x31ml, y31ml+1/2marg); |
| 3420 |
% \end{macrocode} |
| 3421 |
% |
| 3422 |
% The \Mpost{} equation |z1-z2 = frac*(z3-z4)| means that |
| 3423 |
% (a) the line |z1--z2| is parallel to the line |z3--z4|, and (b) |
| 3424 |
% the length of the line |z1--z2| is |frac| of the length of |z3--z4|. |
| 3425 |
% We next specify that the line |z13U--z31A| is parallel to, and the same |
| 3426 |
% length as, the line |z13bm--z31ml|; |
| 3427 |
% \begin{macrocode} |
| 3428 |
z13U-z31A = z13bm-z31ml; |
| 3429 |
% \end{macrocode} |
| 3430 |
% |
| 3431 |
% The final part of the calculation is to determine the point |z13A| so |
| 3432 |
% that the line |z31A--z13A| is parallel to our first line and starts |
| 3433 |
% and ends at the outer perimeters of the boxes (and we already |
| 3434 |
% know what |z31A| is). |
| 3435 |
% |
| 3436 |
% \DescribeVariable{whatever} |
| 3437 |
% Remember mediation? A point, |z1234| is on the line |z1--z2| if \\ |
| 3438 |
% |z1234=frac1[z1,z2| holds. \\ |
| 3439 |
% Similarly a point |z1234| is on the line |z3--z4| if \\ |
| 3440 |
% |z1234=frac2[z3,z4]| holds. |
| 3441 |
% |
| 3442 |
% These two equations are linear and provided enough variables are known |
| 3443 |
% it is easy, even if tedious and error |
| 3444 |
% prone, to solve |
| 3445 |
% for all the unknowns using simple mathematics. Fortunately \Mpost{} has an |
| 3446 |
% idiom for this kind of calculation using the built-in variable |
| 3447 |
% called |whatever|. Each time |whatever| is used it is internally given |
| 3448 |
% a new name which saves a lot of name inventions on the part of the user. |
| 3449 |
% The following line of code results in \Mpost{} calculating the intersection |
| 3450 |
% point, which I call |z13A|, between the two lines |z13U,z31A|, which is |
| 3451 |
% our parallel lines whose points are known, and the line |z13bm--z13mr| |
| 3452 |
% which is the lower right line of the outer diamond whose points are known. |
| 3453 |
% \begin{macrocode} |
| 3454 |
z13A = whatever[z13U,z31A] = whatever[z13bm,z13mr]; |
| 3455 |
% \end{macrocode} |
| 3456 |
% |
| 3457 |
% Finally, draw the second parallel line in the desired position and length. |
| 3458 |
% \begin{macrocode} |
| 3459 |
draw z13A--z31A; |
| 3460 |
label.urt(btex N etex, 1/2[z13A,z31A]); |
| 3461 |
|
| 3462 |
% \end{macrocode} |
| 3463 |
% |
| 3464 |
% Another pair of parallel lines connects the doubly bounded rectangle |
| 3465 |
% and the singly bounded diamond, and we use a similar calculation as above. |
| 3466 |
% \begin{macrocode} |
| 3467 |
%%% of / car (53, 31) |
| 3468 |
drawnormal(53bm, 31mr); |
| 3469 |
z31B=(x31mr, y31mr+1/2marg); |
| 3470 |
z53U - z31B = z53bm - z31mr; |
| 3471 |
z53B = whatever[z53U,z31B] = whatever[z53bm,z53ml]; |
| 3472 |
draw z53B--z31B; |
| 3473 |
label.ulft(btex N etex, 1/2[z53B,z31B]); |
| 3474 |
|
| 3475 |
% \end{macrocode} |
| 3476 |
% |
| 3477 |
% That's the end of the tricky bits for this diagram. |
| 3478 |
% \begin{macrocode} |
| 3479 |
%%% car / serial no (31, 21) |
| 3480 |
z31C=(x21tm, y31bl); |
| 3481 |
drawnormal(31C, 21tm); |
| 3482 |
|
| 3483 |
%%% car / year (31, 41) |
| 3484 |
z31D=(x41tm, y31br); |
| 3485 |
drawnormal(31D, 41tm); |
| 3486 |
|
| 3487 |
% \end{macrocode} |
| 3488 |
% |
| 3489 |
% The end of this diagram |
| 3490 |
% \begin{macrocode} |
| 3491 |
endfig; % end fig 10 |
| 3492 |
|
| 3493 |
% \end{macrocode} |
| 3494 |
% |
| 3495 |
% |
| 3496 |
% \subsubsection{Diagram 11: NIAM} |
| 3497 |
% |
| 3498 |
% Like IDEF1X, NIAM~\cite{NIJSSEN89} is a language for relational database |
| 3499 |
% structures. In Europe it tends to be preferred to IDEF1X. |
| 3500 |
% |
| 3501 |
% Although the layout and icons of the NIAM illustration differ from |
| 3502 |
% the prior |
| 3503 |
% diagrams, no new techniques are used. The most obvious of the differences |
| 3504 |
% are the use of oval and circular boxes in place of the rectangular boxes, |
| 3505 |
% and the use of pairs of rectangular boxes in the middle of the relationship |
| 3506 |
% lines. |
| 3507 |
% \begin{macrocode} |
| 3508 |
|
| 3509 |
beginfig(11) % example 11 NIAM |
| 3510 |
%%%drawgrid; |
| 3511 |
|
| 3512 |
numeric diam; diam := 2onelineh; % circle diameter |
| 3513 |
|
| 3514 |
upshift := diam; |
| 3515 |
nextup := diam+upshift; |
| 3516 |
|
| 3517 |
numeric hel, vel; % length of horizontal and vertical box pairs |
| 3518 |
eh := onelineh; |
| 3519 |
hel = namespace(btex made by etex)(nextra); |
| 3520 |
vel = namespace(btex of prod etex)(nextra); |
| 3521 |
|
| 3522 |
numeric del, deh; % horizontal & vertical diameters of oval boxes |
| 3523 |
del := namespace(btex MANUFACTURER etex)(niextra); |
| 3524 |
deh := 2eh; |
| 3525 |
|
| 3526 |
numeric marg; marg := 2u; % margin for doubly enclosed oval boxes |
| 3527 |
numeric lmarg; lmarg := marg; % gap for short lines |
| 3528 |
|
| 3529 |
numeric dashel, dasheh; % diameters of dashed ellipses |
| 3530 |
dashel := del+2marg; |
| 3531 |
dasheh := deh+2marg; |
| 3532 |
|
| 3533 |
hspace1 := diam; |
| 3534 |
|
| 3535 |
%%% y coords |
| 3536 |
lyc1 := 0; |
| 3537 |
lyc2 := lyc1+nextup; |
| 3538 |
lyc3 := lyc2+nextup; |
| 3539 |
|
| 3540 |
%%% Zcol/row |
| 3541 |
|
| 3542 |
%%% row 3 |
| 3543 |
|
| 3544 |
x13ml=0; y13bm=lyc3; |
| 3545 |
drawovalbox(13, del, deh)(btex manufacturer etex); |
| 3546 |
z14=z13c; |
| 3547 |
drawdashellipse(14, dashel, dasheh); |
| 3548 |
|
| 3549 |
z23ml=(x14mr+hspace1, y14mr); |
| 3550 |
drawENT(23, hel, eh)(btex of etex); |
| 3551 |
|
| 3552 |
z33bl=z23br; |
| 3553 |
drawENT(33, hel, eh)(btex made by etex); |
| 3554 |
|
| 3555 |
z44ml=(x33mr+hspace1, y33mr); |
| 3556 |
drawdashellipse(44, dashel, dasheh); |
| 3557 |
z43=z44c; |
| 3558 |
drawovalbox(43, del, deh)(btex car model etex); |
| 3559 |
|
| 3560 |
z53ml=(x44mr+hspace1, y44mr); |
| 3561 |
drawdashcircle(53, diam); |
| 3562 |
label(btex year etex, z53c); |
| 3563 |
|
| 3564 |
%%% row 2 |
| 3565 |
|
| 3566 |
z22c=(x23bm,lyc2); |
| 3567 |
drawcirclebox(22, namespace(btex U etex)(2nextra))(btex U etex); |
| 3568 |
|
| 3569 |
x42tm=x43bm; y42ml=lyc2; |
| 3570 |
drawdoublerectangle(42, vel, 2eh, 1/2); |
| 3571 |
label(btex of etex, z42ct); |
| 3572 |
label(btex is of etex, z42cb); |
| 3573 |
|
| 3574 |
%%z52c=(x53x,lyc2); |
| 3575 |
x52tm=x53bm; y52ml=lyc2; |
| 3576 |
drawdoublerectangle(52, vel, 2eh, 1/2); |
| 3577 |
label(btex of prod etex, z52ct); |
| 3578 |
label(btex prod in etex, z52cb); |
| 3579 |
|
| 3580 |
%%% row 1 |
| 3581 |
|
| 3582 |
z11ml=(x13ml,lyc1); |
| 3583 |
drawdashellipse(11, del, deh); |
| 3584 |
label(btex serial no etex, z11c); |
| 3585 |
|
| 3586 |
z21ml=(x23ml,lyc1); |
| 3587 |
drawENT(21, hel, eh)(btex of etex); |
| 3588 |
|
| 3589 |
z31bl=z21br; |
| 3590 |
drawENT(31, hel, eh)(btex has etex); |
| 3591 |
|
| 3592 |
z41c=(x43c,lyc1); |
| 3593 |
drawcirclebox(41, diam)(btex car etex); |
| 3594 |
|
| 3595 |
%%%%%% lines |
| 3596 |
|
| 3597 |
%%% manufacturer / of (14, 23) |
| 3598 |
drawnormal(14mr, 23ml); |
| 3599 |
|
| 3600 |
%%% made by / car model (33, 44) |
| 3601 |
drawnormal(33mr, 44ml); |
| 3602 |
draw (x33tl, y33tl+lmarg)--(x33tr, y33tl+lmarg); |
| 3603 |
draw (x33mr, y33mr+lmarg)--(x33mr+eh, y33mr+lmarg); |
| 3604 |
|
| 3605 |
%%% serial no / of (11, 21) |
| 3606 |
drawnormal(11mr, 21ml); |
| 3607 |
|
| 3608 |
%%% of / of (23, 22, 21) |
| 3609 |
drawnormal(23bm, 22tm); drawnormal(22bm, 21tm); |
| 3610 |
label.rt(btex id etex, z22mr); |
| 3611 |
|
| 3612 |
%%% has / car (31, 41) |
| 3613 |
drawnormal(31mr, 41ml); |
| 3614 |
draw (x31tl, y31tl+lmarg)--(x31tr, y31tl+lmarg); |
| 3615 |
draw (x31mr, y31mr+lmarg)--(x33mr+eh, y31mr+lmarg); |
| 3616 |
|
| 3617 |
%%% model / of (44, 42) |
| 3618 |
drawnormal(43bm, 42tm); |
| 3619 |
|
| 3620 |
%%% is of / car (42, 41) |
| 3621 |
drawnormal(42bm, 41tm); |
| 3622 |
draw (x42tfr+lmarg, y42tfr)--(x42tfr+lmarg, y42br); |
| 3623 |
draw (x42bm+lmarg, y42bm)--(x42bm+lmarg, y42bm-eh); |
| 3624 |
|
| 3625 |
%%% year / of prod (53, 52) |
| 3626 |
drawnormal(53bm, 52tm); |
| 3627 |
|
| 3628 |
%%% prod in / car (52, 41) |
| 3629 |
VH(52bm,41mr); |
| 3630 |
drawnormalthree(52bm, 52bm.vh, 41mr); |
| 3631 |
draw (x52tfr+lmarg, y52tfr)--(x52tfr+lmarg, y52br); |
| 3632 |
draw (x52bm+lmarg, y52bm)--(x52bm+lmarg, y52bm-eh); |
| 3633 |
|
| 3634 |
% \end{macrocode} |
| 3635 |
% |
| 3636 |
% The end of this diagram |
| 3637 |
% \begin{macrocode} |
| 3638 |
endfig; % end fig 11 |
| 3639 |
|
| 3640 |
% \end{macrocode} |
| 3641 |
% |
| 3642 |
% Note that the centers of the boxes on the bottom row are all at |y=0|, |
| 3643 |
% and hence the bottom halves have negative y values. This does not matter |
| 3644 |
% as \Mpost{} determines the actual space required for a diagram and does |
| 3645 |
% not base it on the origin of the coordinate system. |
| 3646 |
% |
| 3647 |
% |
| 3648 |
% The end of the \Mpost{} examples file. |
| 3649 |
% \begin{macrocode} |
| 3650 |
end |
| 3651 |
|
| 3652 |
% \end{macrocode} |
| 3653 |
% The end of the example. |
| 3654 |
% \begin{macrocode} |
| 3655 |
%</eg> |
| 3656 |
% \end{macrocode} |
| 3657 |
% |
| 3658 |
% \subsection{Comments} |
| 3659 |
% |
| 3660 |
% Everyone is likely to have a different style of diagramming. You have |
| 3661 |
% seen how I do it but that might not be what suits you. Nevertheless, |
| 3662 |
% the following comments may be of assistance. |
| 3663 |
% |
| 3664 |
% In my own work I tend to draw a lot of diagrams, using different |
| 3665 |
% \file{.mp} files, that have similar sets of `commonly used variables |
| 3666 |
% \& values'. Rather than repeating the list in each file, I create a |
| 3667 |
% \Mpost{} file, called say \file{mycommons.mp}, that includes these |
| 3668 |
% and then |input mycommons| after the |input expressg| near the start |
| 3669 |
% of each diagram file. |
| 3670 |
% |
| 3671 |
% I find it a help to sketch out the diagrams using pencil and paper |
| 3672 |
% before coding them up. I have to admit, though, that the final results |
| 3673 |
% often look very different from my initial ideas of the layout. |
| 3674 |
% |
| 3675 |
% You might have noticed that I start the coding at different places |
| 3676 |
% in the diagrams. Basically I try and plan on getting the boxes aligned |
| 3677 |
% roughly in rows and/or columns. I then typically start with the longest |
| 3678 |
% column, or more often with the widest row, and then fill in the rest |
| 3679 |
% from there. |
| 3680 |
% |
| 3681 |
% \subsection{Running the \Mpost{} example file} \label{sec:run} |
| 3682 |
% |
| 3683 |
% The \file{expeg.mp} file has to be processed by \Mpost{} to obtain |
| 3684 |
% \EPS{} (\file{eps}) files for viewing or printing. |
| 3685 |
% Depending on your installation the command to run \Mpost{} may be |
| 3686 |
% either: \\ |
| 3687 |
% |mpost expeg| or \\ |
| 3688 |
% |mp expeg| \\ |
| 3689 |
% or perhaps something similar. This will produce eleven files, \file{expeg.1} |
| 3690 |
% to \file{expeg.11}, each of which is an \file{eps} file for the corresponding |
| 3691 |
% |beginfig(N)| in \file{expeg.mp}. \Mpost{} defaults to using \TeX{} for |
| 3692 |
% processing labels which outputs them using Computer Modern |
| 3693 |
% fonts. Unfortunately \PS{} applications do not understand these so it |
| 3694 |
% is necessary to get the fonts inserted. This is most simply done by |
| 3695 |
% \LaTeX ing a document that includes the \Mpost{} output. A suitable |
| 3696 |
% file is provided below and is configured to be processed by either |
| 3697 |
% \LaTeX{} or \pdflatex. Run \LaTeX{} and then dvips (or what you normally |
| 3698 |
% use to generate printable output) and you will get all eleven diagrams. |
| 3699 |
% |
| 3700 |
% |
| 3701 |
% \begin{macrocode} |
| 3702 |
%<*egt> |
| 3703 |
% \end{macrocode} |
| 3704 |
% |
| 3705 |
% \begin{macrocode} |
| 3706 |
%%% expeg.tex display expressg.dtx MetaPost examples |
| 3707 |
|
| 3708 |
\documentclass[11pt]{article} |
| 3709 |
\newif\ifpdf |
| 3710 |
\ifx\pdfoutput\undefined |
| 3711 |
\pdffalse |
| 3712 |
\else |
| 3713 |
\pdftrue |
| 3714 |
\fi |
| 3715 |
|
| 3716 |
\ifpdf |
| 3717 |
\pdfoutput=1 |
| 3718 |
\usepackage[pdftex,final]{graphicx} |
| 3719 |
\DeclareGraphicsRule{*}{mps}{*}{} |
| 3720 |
\else |
| 3721 |
\usepackage[final]{graphicx} |
| 3722 |
\fi |
| 3723 |
|
| 3724 |
%%%% page sizes for ISO document on A4 paper |
| 3725 |
\setlength{\headheight}{11pt} |
| 3726 |
\setlength{\headsep}{10mm} |
| 3727 |
\setlength{\topskip}{11pt} |
| 3728 |
\setlength{\footskip}{11mm} |
| 3729 |
\setlength{\textwidth}{160mm} |
| 3730 |
\setlength{\textheight}{221.5mm} |
| 3731 |
\setlength{\columnsep}{10mm} |
| 3732 |
\setlength{\topmargin}{0mm} |
| 3733 |
\setlength{\oddsidemargin}{0mm} |
| 3734 |
\setlength{\evensidemargin}{0mm} |
| 3735 |
\setlength{\marginparwidth}{0pt} |
| 3736 |
\setlength{\marginparsep}{0pt} |
| 3737 |
\setlength{\marginparpush}{0pt} |
| 3738 |
\setlength{\footnotesep}{12pt} |
| 3739 |
%%%% for US letterpaper need to change some margins |
| 3740 |
\setlength{\topmargin}{-9.4mm} |
| 3741 |
\setlength{\oddsidemargin}{1.55mm} |
| 3742 |
\setlength{\evensidemargin}{1.55mm} |
| 3743 |
|
| 3744 |
\begin{document} |
| 3745 |
|
| 3746 |
\begin{figure} |
| 3747 |
\centering |
| 3748 |
\includegraphics{expeg.1} |
| 3749 |
\caption{Some boxes and line styles} |
| 3750 |
\end{figure} |
| 3751 |
|
| 3752 |
\begin{figure} |
| 3753 |
\centering |
| 3754 |
\includegraphics{expeg.2} |
| 3755 |
\caption{Example schema level diagram} |
| 3756 |
\end{figure} |
| 3757 |
|
| 3758 |
\begin{figure} |
| 3759 |
\centering |
| 3760 |
\includegraphics{expeg.3} |
| 3761 |
\caption{Example diagram of a tree structure} |
| 3762 |
\end{figure} |
| 3763 |
|
| 3764 |
\begin{figure} |
| 3765 |
\centering |
| 3766 |
\includegraphics{expeg.4} |
| 3767 |
\caption{Supertypes and subtypes} |
| 3768 |
\end{figure} |
| 3769 |
|
| 3770 |
\begin{figure} |
| 3771 |
\centering |
| 3772 |
\includegraphics{expeg.5} |
| 3773 |
\caption{A portion of a large model} |
| 3774 |
\end{figure} |
| 3775 |
|
| 3776 |
\begin{figure} |
| 3777 |
\centering |
| 3778 |
\includegraphics{expeg.6} |
| 3779 |
\caption{Car model using EXPRESS-G} |
| 3780 |
\end{figure} |
| 3781 |
|
| 3782 |
\begin{figure} |
| 3783 |
\centering |
| 3784 |
\includegraphics{expeg.7} |
| 3785 |
\caption{Car model using Shlaer-Mellor} |
| 3786 |
\end{figure} |
| 3787 |
|
| 3788 |
\begin{figure} |
| 3789 |
\centering |
| 3790 |
\includegraphics{expeg.8} |
| 3791 |
\caption{Car model using IDEF1X} |
| 3792 |
\end{figure} |
| 3793 |
|
| 3794 |
\begin{figure} |
| 3795 |
\centering |
| 3796 |
\includegraphics{expeg.9} |
| 3797 |
\caption{Car model using OMT} |
| 3798 |
\end{figure} |
| 3799 |
|
| 3800 |
\begin{figure} |
| 3801 |
\centering |
| 3802 |
\includegraphics{expeg.10} |
| 3803 |
\caption{Car model using E-R} |
| 3804 |
\end{figure} |
| 3805 |
|
| 3806 |
\begin{figure} |
| 3807 |
\centering |
| 3808 |
\includegraphics{expeg.11} |
| 3809 |
\caption{Car model using NIAM} |
| 3810 |
\end{figure} |
| 3811 |
|
| 3812 |
\end{document} |
| 3813 |
|
| 3814 |
% \end{macrocode} |
| 3815 |
% |
| 3816 |
% The end of the \LaTeX{} file. |
| 3817 |
% \begin{macrocode} |
| 3818 |
%</egt> |
| 3819 |
% \end{macrocode} |
| 3820 |
% |
| 3821 |
% \subsubsection{Using \pdflatex} |
| 3822 |
% |
| 3823 |
% \pdflatex{} generates a \file{.pdf} file directly from \LaTeX{} source |
| 3824 |
% instead of a \file{.dvi} file. Unfortunately \pdflatex{} does not understand |
| 3825 |
% \EPS{} in general, but it \emph{does} understand the restricted form |
| 3826 |
% of \EPS{} generated by \Mpost. By default \pdflatex{} will recognise |
| 3827 |
% files with an \file{.mps} extension as coming from \Mpost, but \Mpost{} |
| 3828 |
% generates files with a numeric extension. |
| 3829 |
% If you like to use both \Mpost{} and \pdflatex, then it can |
| 3830 |
% get tedious changing all the numeric extensions to \file{.mps}. The |
| 3831 |
% following two scripts can help with this. The first is a shell |
| 3832 |
% script\footnote{You may well have to modify this to run on your |
| 3833 |
% operating system.} which calls a Perl script. |
| 3834 |
% |
| 3835 |
% The shell script is called \file{n2mps.sh}. To get suitable versions |
| 3836 |
% of the example \Mpost{} output files for use with \pdflatex, just do: \\ |
| 3837 |
% |n2mps.sh expeg| \\ |
| 3838 |
% after having run \Mpost{} on \file{expeg.mp}. |
| 3839 |
% |
| 3840 |
% \begin{macrocode} |
| 3841 |
%<*shell> |
| 3842 |
#! /bin/sh |
| 3843 |
|
| 3844 |
##################################################################### |
| 3845 |
# Shell script n2mps.sh |
| 3846 |
# Call as: n2mps.sh basename |
| 3847 |
# List each file basename.* in the directory and run the Perl script |
| 3848 |
# to copy each basename.N to basenameN.mps, where N is an integer |
| 3849 |
# |
| 3850 |
# Copyright 2000, Mauro S. Costa and Peter R. Wilson |
| 3851 |
##################################################################### |
| 3852 |
|
| 3853 |
basename=${1:?"A file basename is required."} |
| 3854 |
extname=N.mps |
| 3855 |
echo Files $basename.N, where N is a number, will be copied to $basename$extname |
| 3856 |
for file in `ls $basename.*` |
| 3857 |
do |
| 3858 |
n2mpsprl.prl $file |
| 3859 |
done |
| 3860 |
|
| 3861 |
####################### end shell script ########################### |
| 3862 |
|
| 3863 |
%</shell> |
| 3864 |
% \end{macrocode} |
| 3865 |
% The Perl script, which is called by the \file{n2mps} script: |
| 3866 |
% \begin{macrocode} |
| 3867 |
%<*perl> |
| 3868 |
|
| 3869 |
#!/usr/local/bin/perl -w |
| 3870 |
|
| 3871 |
################################################################### |
| 3872 |
# Perl script: n2mpsprl.prl |
| 3873 |
# Call as: n2mpsprl.prl filename |
| 3874 |
# If filename is of the form basename.N, where N is an integer, |
| 3875 |
# copies file basename.N to file basenameN.mps |
| 3876 |
# |
| 3877 |
# Copyright 2000, Mauro S. Costa and Peter R. Wilson |
| 3878 |
################################################################## |
| 3879 |
|
| 3880 |
# Test for correct number of input parameters |
| 3881 |
die "Invalid command line arguments.\nTry $0 <src> \n" if($#ARGV > 1); |
| 3882 |
die "Invalid command line arguments.\nTry $0 <src> \n" if($#ARGV < 0); |
| 3883 |
|
| 3884 |
# Assign input file name to variable |
| 3885 |
$input_file = $ARGV[0]; |
| 3886 |
|
| 3887 |
## test if ends with a number, exit if not |
| 3888 |
if ($input_file =~ /\w\.\d/) { ; } else { exit; } |
| 3889 |
|
| 3890 |
# Remove the "dot" from the string variable |
| 3891 |
# holding the input file name |
| 3892 |
$input_file =~ s/\.// ; |
| 3893 |
|
| 3894 |
# Create a list variable composed of the string variable holding |
| 3895 |
# the concatenated input file name and the extension ".mps" |
| 3896 |
@name_list = ($input_file,'.mps') ; |
| 3897 |
|
| 3898 |
# Join the string variables in the name_list variable into |
| 3899 |
# a single string variable |
| 3900 |
$output_file = join("",@name_list) ; |
| 3901 |
|
| 3902 |
# create a list variable composed to the parameters needed |
| 3903 |
# for the system copy command excution |
| 3904 |
@exec_list = ('cp', $ARGV[0], $output_file) ; |
| 3905 |
|
| 3906 |
# Execute the system copy ("cp") command |
| 3907 |
system(@exec_list) ; |
| 3908 |
|
| 3909 |
############################ end perl script ########################## |
| 3910 |
|
| 3911 |
%</perl> |
| 3912 |
% \end{macrocode} |
| 3913 |
% |
| 3914 |
% As an alternative when using \pdflatex{} and the \Lpack{graphicx} package, |
| 3915 |
% putting \\ |
| 3916 |
% |\DeclareGraphicsRule{*}{mps}{*}{}| \\ |
| 3917 |
% will cause included graphics files with unknown extensions |
| 3918 |
% (e.g., as generated by \Mpost) to be treated as \file{.mps} files. |
| 3919 |
% \begin{verbatim} |
| 3920 |
% \documentclass... |
| 3921 |
% \usepackage{ifpdf}% you should have this |
| 3922 |
% \ifpdf |
| 3923 |
% \pdfoutput=1 |
| 3924 |
% \usepackage[pdftex,final]{graphicx} |
| 3925 |
% \DeclareGraphicsRule{*}{mps}{*}{} |
| 3926 |
% \else |
| 3927 |
% \usepackage[final]{graphicx} |
| 3928 |
% \fi |
| 3929 |
% ... |
| 3930 |
% \includegraphics{mpfig.23} |
| 3931 |
% ... |
| 3932 |
% \end{verbatim} |
| 3933 |
% |
| 3934 |
% |
| 3935 |
% \subsection{Using \LaTeX{} instead of \TeX} |
| 3936 |
% |
| 3937 |
% As already noted, \Mpost{} defaults to using \TeX{} for typesetting |
| 3938 |
% labels. If you would prefer it to use \LaTeX{} instead, then two things |
| 3939 |
% have to be done. |
| 3940 |
% \begin{enumerate} |
| 3941 |
% \item \Mpost{} looks at the value of an environment variable called |TEX| |
| 3942 |
% to see what typesetting system it should use. If the variable is |
| 3943 |
% not set, then it uses \TeX. To get it to use \LaTeX{} the environment |
| 3944 |
% variable has to be set to |latex|. For example, on the system I use |
| 3945 |
% this is done by: |
| 3946 |
% \begin{verbatim} |
| 3947 |
% TEX=latex |
| 3948 |
% export TEX |
| 3949 |
% \end{verbatim} |
| 3950 |
% |
| 3951 |
% \item \LaTeX{} |\documentclass| and |\begin{document}| commands must |
| 3952 |
% be put into the |verbatimtex|\ldots|etex| group at the start of |
| 3953 |
% the diagramming file. For the example, this might look like |
| 3954 |
% \begin{verbatim} |
| 3955 |
% verbatimtex |
| 3956 |
% \documentclass{article} |
| 3957 |
% % \usepackage{...} % for any packages |
| 3958 |
% \def\twolines#1#2{\vbox{\hbox{#1} \hbox{#2}}} |
| 3959 |
% \begin{document} |
| 3960 |
% etex |
| 3961 |
% \end{verbatim} |
| 3962 |
% |
| 3963 |
% \end{enumerate} |
| 3964 |
% |
| 3965 |
% \textbf{NOTE:} Both the above are required for \LaTeX. On the other hand, |
| 3966 |
% if |TEX| is either undefined or has a value other than |tex|, |
| 3967 |
% then there must |
| 3968 |
% be no \LaTeX{} code anywhere in the \file{.mp} file. |
| 3969 |
% |
| 3970 |
% If you need to generate individual self-contained \file{ps} files |
| 3971 |
% for inclusion in non-\LaTeX{} documents where the font used for labels |
| 3972 |
% is a member of the Computer Modern family, |
| 3973 |
% then you need to use LaTeX{} and dvips on \file{*.tex} files that consist |
| 3974 |
% of only a single diagram and no other text at all. At least on my setup |
| 3975 |
% I have found it best to run dvips as normal but with output to a file |
| 3976 |
% instead of a printer. Then use whatever tools are available to you to |
| 3977 |
% convert the \file{.ps} file to an \file{.eps} one (or at least set the |
| 3978 |
% correct bounding box values). The primary source on generating and |
| 3979 |
% using \EPS{} in the \LaTeX{} world is~\cite{RECKDAHL97}, |
| 3980 |
% and~\cite{GOOSSENS97} also has useful information. |
| 3981 |
% |
| 3982 |
% \subsection{Using \PS{} fonts} |
| 3983 |
% |
| 3984 |
% \Mpost{} can be made to use \PS{} fonts and, providing the labels |
| 3985 |
% don't require any special (\TeX) processing, then use of \LaTeX{} may |
| 3986 |
% be avoided altogether. In order to do this, certain requirements have |
| 3987 |
% to be put on the content on the \file{.mp} file. |
| 3988 |
% |
| 3989 |
% \begin{itemize} |
| 3990 |
% \item \DescribeVariable{prologues} The |
| 3991 |
% diagram file must begin with the line \\ |
| 3992 |
% |prologues:=2;| \\ |
| 3993 |
% which will add a prologue for \PS{} font to the output file. |
| 3994 |
% |
| 3995 |
% \item \DescribeVariable{defaultfont} The |
| 3996 |
% |defaultfont| must be changed. What it has to be changed |
| 3997 |
% to depends on the font you want to use. For example, to use the |
| 3998 |
% Times Roman font, put: \\ |
| 3999 |
% |defaultfont:="ptmr8r";| \\ |
| 4000 |
% just after the |prologues| line. |
| 4001 |
% |
| 4002 |
% For this incantation to work, the file \file{ptmr8r.tfm} must exist |
| 4003 |
% in a location where \Mpost{} looks for \file{.tfm} files (on the system |
| 4004 |
% I use it is in directory \texttt{../texmf/fonts/tfm/adobe/times}). Also, |
| 4005 |
% the file \file{psfonts.map} must include a line like \\ |
| 4006 |
% |ptmr8r Times-Roman ...| \\ |
| 4007 |
% Again, on my system \file{psfonts.map} is in directory |
| 4008 |
% \texttt{../texmf/dvips/misc}. |
| 4009 |
% |
| 4010 |
% I don't know whether or not this works if you don't have a \LaTeX{} |
| 4011 |
% distribution --- it probably doesn't. But it's unlikely that you don't |
| 4012 |
% have one if you |
| 4013 |
% intend to use \Mpost. |
| 4014 |
% |
| 4015 |
% \end{itemize} |
| 4016 |
% |
| 4017 |
% As a final note on changing fonts, the \Mpost{} |defaultfont| and |
| 4018 |
% |defaultscale| values only apply to quoted text |
| 4019 |
% (e.g., \texttt{"quoted text"}) and not to `btexed' text |
| 4020 |
% (e.g., \texttt{btex btexed text etex}). Conversely, \TeX{} or \LaTeX{} |
| 4021 |
% commands only apply to btexed text and not to quoted text. For more |
| 4022 |
% details on this, see~\cite{METAFP}. |
| 4023 |
% |
| 4024 |
% |
| 4025 |
% |
| 4026 |
% |
| 4027 |
% \section{The \Mpost{} code} \label{sec:mf} |
| 4028 |
% |
| 4029 |
% |
| 4030 |
% We start by announcing what it is for. |
| 4031 |
% |
| 4032 |
% \begin{macrocode} |
| 4033 |
%<*up> |
| 4034 |
%%% EXPRESSG.MP MetaPost macros for EXPRESS-G and other BLA diagrams |
| 4035 |
%%% version 1.5, 31 July 2003 |
| 4036 |
%%% version 1.6, 29 February 2004 |
| 4037 |
%%% version 1.61, 17 March 2004 |
| 4038 |
|
| 4039 |
show "expressg.mp version 1.61, 2004/03/17"; |
| 4040 |
|
| 4041 |
% \end{macrocode} |
| 4042 |
% |
| 4043 |
% \subsection{Variables} |
| 4044 |
% |
| 4045 |
% \begin{variable}{u} |
| 4046 |
% The unit of length. |
| 4047 |
% \begin{macrocode} |
| 4048 |
newinternal u; numeric u; |
| 4049 |
u := 1mm; |
| 4050 |
|
| 4051 |
% \end{macrocode} |
| 4052 |
% \end{variable} |
| 4053 |
% |
| 4054 |
% \begin{variable}{maxx} |
| 4055 |
% \begin{variable}{maxy} |
| 4056 |
% The maximum x and y coordinates for a diagram. |
| 4057 |
% \begin{macrocode} |
| 4058 |
newinternal maxx, maxy; |
| 4059 |
numeric maxx, maxy; |
| 4060 |
maxx := 159.5u; % smidgeon under 160mm for ISO |
| 4061 |
maxy := 210u; % 210mm for ISO |
| 4062 |
|
| 4063 |
% \end{macrocode} |
| 4064 |
% \end{variable} |
| 4065 |
% \end{variable} |
| 4066 |
% |
| 4067 |
% \begin{variable}{defaultdotdiam} |
| 4068 |
% \begin{variable}{dotdiam} |
| 4069 |
% The default and actual diameter of circle and dot line end styles. |
| 4070 |
% \begin{macrocode} |
| 4071 |
newinternal defaultdotdiam, dotdiam; |
| 4072 |
numeric defaultdotdiam, dotdiam; |
| 4073 |
defaultdotdiam := 2u; |
| 4074 |
dotdiam := defaultdotdiam; |
| 4075 |
|
| 4076 |
% \end{macrocode} |
| 4077 |
% \end{variable} |
| 4078 |
% \end{variable} |
| 4079 |
% |
| 4080 |
% \begin{variable}{normalpensize} |
| 4081 |
% \begin{variable}{normalpensize} |
| 4082 |
% \begin{variable}{normalpensize} |
| 4083 |
% The diameters of the pens for drawing normal, thick and thin lines. (The |
| 4084 |
% size of the default \Mpost{} pen is 0.5bp). |
| 4085 |
% \begin{macrocode} |
| 4086 |
newinternal normalpensize, thickpensize, thinpensize; |
| 4087 |
numeric normalpensize, thickpensize, thinpensize; |
| 4088 |
normalpensize := 0.5bp; |
| 4089 |
thickpensize := 1.5bp; |
| 4090 |
thinpensize := 0.25bp; |
| 4091 |
% \end{macrocode} |
| 4092 |
% \end{variable} |
| 4093 |
% \end{variable} |
| 4094 |
% \end{variable} |
| 4095 |
% |
| 4096 |
% \begin{variable}{dotsscale} |
| 4097 |
% |dotsscale| is the amount the |...pensize| has to be increased so that a |
| 4098 |
% dotted line looks as thick as a continuous or dashed line. |
| 4099 |
% \begin{macrocode} |
| 4100 |
newinternal dotsscale; numeric dotsscale; |
| 4101 |
dotsscale := 2; |
| 4102 |
|
| 4103 |
% \end{macrocode} |
| 4104 |
% \end{variable} |
| 4105 |
% |
| 4106 |
% \begin{variable}{normalpen} |
| 4107 |
% \begin{variable}{thickpen} |
| 4108 |
% \begin{variable}{thinpen} |
| 4109 |
% \begin{variable}{dotspen} |
| 4110 |
% \begin{variable}{dotpen} |
| 4111 |
% The pens for drawing lines, plus |dotpen| for drawing a dot line end style. |
| 4112 |
% \begin{macrocode} |
| 4113 |
newinternal normalpen, thickpen, thinpen, dotspen, dotpen; |
| 4114 |
pen normalpen, thickpen, thinpen, dotspen, dotpen; |
| 4115 |
normalpen := pencircle scaled normalpensize; % i.e. defaultpen; |
| 4116 |
thickpen := pencircle scaled thickpensize; |
| 4117 |
thinpen := pencircle scaled thinpensize; |
| 4118 |
dotspen := pencircle scaled (dotsscale*normalpensize); |
| 4119 |
dotpen := pencircle scaled dotdiam; |
| 4120 |
|
| 4121 |
% \end{macrocode} |
| 4122 |
% \end{variable} |
| 4123 |
% \end{variable} |
| 4124 |
% \end{variable} |
| 4125 |
% \end{variable} |
| 4126 |
% \end{variable} |
| 4127 |
% |
| 4128 |
% \begin{variable}{defaultsmoothrad} |
| 4129 |
% \begin{variable}{smoothrad} |
| 4130 |
% The default and initial values for the radius of the arc used for joining |
| 4131 |
% two lines. |
| 4132 |
% \changes{v1.3}{2000/05/22}{Added defaultsmoothrad and smoothrad variables} |
| 4133 |
% \begin{macrocode} |
| 4134 |
newinternal defaultsmoothrad; |
| 4135 |
numeric smoothrad, defaultsmoothrad; |
| 4136 |
smoothrad := defaultsmoothrad := 2u; |
| 4137 |
|
| 4138 |
% \end{macrocode} |
| 4139 |
% \end{variable} |
| 4140 |
% \end{variable} |
| 4141 |
% |
| 4142 |
% \begin{variable}{defaultdrumlid} |
| 4143 |
% \begin{variable}{drumlid} |
| 4144 |
% The default and initial values for the ratio of the minor to major |
| 4145 |
% diameter of ellipses for the top and bottom of drums. |
| 4146 |
% \changes{v1.3}{2000/05/22}{Added defaultdrumlid and drumlid variables} |
| 4147 |
% \begin{macrocode} |
| 4148 |
newinternal defaultdrumlid; |
| 4149 |
numeric drumlid, defaultdrumlid; |
| 4150 |
drumlid := defaultdrumlid := 0.2; |
| 4151 |
|
| 4152 |
% \end{macrocode} |
| 4153 |
% \end{variable} |
| 4154 |
% \end{variable} |
| 4155 |
% |
| 4156 |
% \begin{variable}{defaultgal} |
| 4157 |
% \begin{variable}{defaultgab} |
| 4158 |
% \begin{variable}{defaultgfl} |
| 4159 |
% \begin{variable}{defaultgfb} |
| 4160 |
% The default values for the length and base width width of arrowheads and fanins. |
| 4161 |
% |
| 4162 |
% \begin{macrocode} |
| 4163 |
%%% default length and base width for arrowheads and fanin |
| 4164 |
newinternal defaultgal, defaultgab, defaultgfl, defaultgfb; |
| 4165 |
numeric defaultgal, defaultgab, defaultgfl, defaultgfb; |
| 4166 |
defaultgal := defaultgfl := defaultdotdiam; |
| 4167 |
defaultgab := defaultgfb := defaultgal; |
| 4168 |
|
| 4169 |
% \end{macrocode} |
| 4170 |
% \end{variable} |
| 4171 |
% \end{variable} |
| 4172 |
% \end{variable} |
| 4173 |
% \end{variable} |
| 4174 |
% |
| 4175 |
% \begin{variable}{gal} |
| 4176 |
% \begin{variable}{gab} |
| 4177 |
% \begin{variable}{gfl} |
| 4178 |
% \begin{variable}{gfb} |
| 4179 |
% Values of length and base width of arrowheads and fanins. |
| 4180 |
% \begin{macrocode} |
| 4181 |
%%% length and base width of arrowheads and fanins |
| 4182 |
newinternal gal, gab, gfl, gfb; |
| 4183 |
numeric gal, gab, gfl, gfb; |
| 4184 |
gal := defaultgal; |
| 4185 |
gab := defaultgab; |
| 4186 |
gfl := defaultgfl; |
| 4187 |
gfb := defaultgfb; |
| 4188 |
|
| 4189 |
% \end{macrocode} |
| 4190 |
% \end{variable} |
| 4191 |
% \end{variable} |
| 4192 |
% \end{variable} |
| 4193 |
% \end{variable} |
| 4194 |
% |
| 4195 |
% \begin{variable}{onelineh} |
| 4196 |
% The minimum height of a box that encloses a single line of text. |
| 4197 |
% |
| 4198 |
% \begin{macrocode} |
| 4199 |
newinternal onelineh; |
| 4200 |
numeric onelineh; |
| 4201 |
onelineh := 5u; |
| 4202 |
|
| 4203 |
% \end{macrocode} |
| 4204 |
% \end{variable} |
| 4205 |
% |
| 4206 |
% \begin{variable}{sdtbl} |
| 4207 |
% \begin{variable}{sdtbh} |
| 4208 |
% \begin{variable}{sdtbs} |
| 4209 |
% The length, height and inset for a simple data type box. The length is |
| 4210 |
% sufficient for the name `BOOLEAN' and the height for one line of text. |
| 4211 |
% \begin{macrocode} |
| 4212 |
%%% length, height & inset for simple data type boxes |
| 4213 |
newinternal sdtbl, sdtbh, sdtbs; |
| 4214 |
numeric sdtbl, sdtbh, sdtbs; |
| 4215 |
sdtbl := 22u; |
| 4216 |
sdtbh := onelineh; |
| 4217 |
sdtbs := 2u; |
| 4218 |
|
| 4219 |
% \end{macrocode} |
| 4220 |
% \end{variable} |
| 4221 |
% \end{variable} |
| 4222 |
% \end{variable} |
| 4223 |
% |
| 4224 |
% \begin{variable}{sdtbel} |
| 4225 |
% \begin{variable}{sdtbeh} |
| 4226 |
% \begin{variable}{sdtbes} |
| 4227 |
% The length, height and inset for a simple EXPRESSION data type box. |
| 4228 |
% The length is |
| 4229 |
% sufficient for the name `EXPRESSION' and the height for one line of text. |
| 4230 |
% \begin{macrocode} |
| 4231 |
%%% length, height & inset for EXPRESSION data type boxes |
| 4232 |
newinternal sdtbel, sdtbeh, sdtbes; |
| 4233 |
numeric sdtbel, sdtbeh, sdtbes; |
| 4234 |
sdtbel := 28u; |
| 4235 |
sdtbeh := sdtbh; sdtbes := sdtbs; |
| 4236 |
|
| 4237 |
% \end{macrocode} |
| 4238 |
% \end{variable} |
| 4239 |
% \end{variable} |
| 4240 |
% \end{variable} |
| 4241 |
% |
| 4242 |
% \begin{variable}{sdtbgel} |
| 4243 |
% \begin{variable}{sdtbgeh} |
| 4244 |
% \begin{variable}{sdtbges} |
| 4245 |
% The length, height and inset for a simple GENERICENT data type box. |
| 4246 |
% The length is |
| 4247 |
% sufficient for the name `GENERIC\_ENTITY' and the height for one line of text. |
| 4248 |
% \changes{v1.5}{2003/07/31}{Added sdtbgel, sdtbgeh and sdtbges box lengths} |
| 4249 |
% \begin{macrocode} |
| 4250 |
%%% length, height & inset for GENERICENT data type boxes |
| 4251 |
newinternal sdtbgel, sdtbgeh, sdtbges; |
| 4252 |
numeric sdtbgel, sdtbgeh, sdtbges; |
| 4253 |
sdtbgel := 38u; |
| 4254 |
sdtbgeh := sdtbh; sdtbges := sdtbs; |
| 4255 |
|
| 4256 |
% \end{macrocode} |
| 4257 |
% \end{variable} |
| 4258 |
% \end{variable} |
| 4259 |
% \end{variable} |
| 4260 |
% |
| 4261 |
% \begin{variable}{pconl} |
| 4262 |
% The average length of a numeric page connector (e.g., for |9,9 (9,9)|). |
| 4263 |
% \begin{macrocode} |
| 4264 |
%%% average length of numeric page connector |
| 4265 |
newinternal pconl; |
| 4266 |
numeric pconl; % length of page connector (for e.g., 9,9 (9,9) ) |
| 4267 |
pconl:=15u; |
| 4268 |
% \end{macrocode} |
| 4269 |
% \end{variable} |
| 4270 |
% |
| 4271 |
% \begin{variable}{pconh} |
| 4272 |
% Height of average page connector (one line of text). |
| 4273 |
% \begin{macrocode} |
| 4274 |
%%% height of page connectors (one line) |
| 4275 |
newinternal pconh; |
| 4276 |
numeric pconh; |
| 4277 |
pconh := onelineh; |
| 4278 |
|
| 4279 |
% \end{macrocode} |
| 4280 |
% \end{variable} |
| 4281 |
% |
| 4282 |
% \begin{variable}{enth} |
| 4283 |
% \begin{variable}{typeh} |
| 4284 |
% The height of a one line ENT(ITY) box (|enth|) and the height of a |
| 4285 |
% one line ENUM(ERATION), SELECT or TYPE box. |
| 4286 |
% |
| 4287 |
% \begin{macrocode} |
| 4288 |
%%% heights of entity, enum, select, type boxes (One text line) |
| 4289 |
newinternal enth, typeh; |
| 4290 |
numeric enth, typeh; |
| 4291 |
enth := onelineh; |
| 4292 |
typeh := onelineh; |
| 4293 |
|
| 4294 |
% \end{macrocode} |
| 4295 |
% \end{variable} |
| 4296 |
% \end{variable} |
| 4297 |
% |
| 4298 |
% \begin{variable}{ish} |
| 4299 |
% \begin{variable}{isrh} |
| 4300 |
% The height of a normal one line interschema box (|ish|) and an |
| 4301 |
% interschema box with one line each for the name and rename (|isrh|). |
| 4302 |
% \begin{macrocode} |
| 4303 |
%%% height of interschema boxes (one text line, no rename), and (name + rename) |
| 4304 |
newinternal ish, isrh; |
| 4305 |
numeric ish, isrh; |
| 4306 |
ish := 2onelineh; |
| 4307 |
isrh := 3onelineh; |
| 4308 |
|
| 4309 |
% \end{macrocode} |
| 4310 |
% \end{variable} |
| 4311 |
% \end{variable} |
| 4312 |
% |
| 4313 |
% \begin{variable}{schemah} |
| 4314 |
% Height of a one line SCHEMA box. |
| 4315 |
% \begin{macrocode} |
| 4316 |
%%% height of schema boxes (one text line) |
| 4317 |
newinternal schemah; |
| 4318 |
numeric schemah; |
| 4319 |
schemah := 2onelineh; |
| 4320 |
|
| 4321 |
% \end{macrocode} |
| 4322 |
% \end{variable} |
| 4323 |
% |
| 4324 |
% \begin{variable}{eventh} |
| 4325 |
% \begin{variable}{eventslope} |
| 4326 |
% The height (|eventh|) of a one line (G/L)EVENT box and the slope of the |
| 4327 |
% sides of a (G/L)EVENT box. |
| 4328 |
% \begin{macrocode} |
| 4329 |
%%% height and slope of event boxes |
| 4330 |
newinternal eventh, eventslope; |
| 4331 |
numeric eventh, eventslope; |
| 4332 |
eventh := onelineh; |
| 4333 |
eventslope := 0.25; |
| 4334 |
|
| 4335 |
% \end{macrocode} |
| 4336 |
% \end{variable} |
| 4337 |
% \end{variable} |
| 4338 |
% |
| 4339 |
% \begin{variable}{nextra} |
| 4340 |
% \begin{variable}{niextra} |
| 4341 |
% Margins for namespaces in normal (|nextra|) and inset (|niextra|) boxes. |
| 4342 |
% Inset boxes are the ENUM, SELECT and TYPE boxes. |
| 4343 |
% \begin{macrocode} |
| 4344 |
%%% extra namespaces for boxed names |
| 4345 |
newinternal nextra, niextra; |
| 4346 |
numeric nextra, niextra; |
| 4347 |
nextra := 2u; |
| 4348 |
niextra := nextra+sdtbs; |
| 4349 |
|
| 4350 |
% \end{macrocode} |
| 4351 |
% \end{variable} |
| 4352 |
% \end{variable} |
| 4353 |
% |
| 4354 |
% \begin{variable}{ndextra} |
| 4355 |
% Margin for namespace on a relationship line. |
| 4356 |
% \begin{macrocode} |
| 4357 |
%%% extra namespace for attribute names |
| 4358 |
newinternal ndextra; |
| 4359 |
numeric ndextra; |
| 4360 |
ndextra := nextra+dotdiam; |
| 4361 |
|
| 4362 |
% \end{macrocode} |
| 4363 |
% \end{variable} |
| 4364 |
% |
| 4365 |
% \subsection{Utility routines} |
| 4366 |
% |
| 4367 |
% \begin{routine}{VH} |
| 4368 |
% \changes{v1.1}{1999/10/30}{Added VH routine} |
| 4369 |
% Calculates the intersection point |z$vh| between the vertical line through |
| 4370 |
% |z$| and the horizontal line through |z$$| (see \fref{fig:vhvh}). |
| 4371 |
% \begin{macrocode} |
| 4372 |
%%% calculates mid-point on a path like |_ (vertical, horizontal) |
| 4373 |
%%% final points are: z$, z$vh, z$$, where z$vh=(x$,y$$) |
| 4374 |
def VH(suffix $, $$) = |
| 4375 |
z$vh=(x$,y$$); |
| 4376 |
enddef; |
| 4377 |
|
| 4378 |
% \end{macrocode} |
| 4379 |
% \end{routine} |
| 4380 |
% |
| 4381 |
% \begin{routine}{VhV} |
| 4382 |
% \changes{v1.1}{1999/10/30}{Added VhV routine} |
| 4383 |
% Calculates the point |z$vhv| on the vertical line through |z$| and the |
| 4384 |
% point |z$$vhv| on the vertical line through |z$$|, such that the line |
| 4385 |
% |z$vhv--z$$vhv| is horizontal and centered vertically between the given |
| 4386 |
% points (see \fref{fig:vhvh}). |
| 4387 |
% \begin{macrocode} |
| 4388 |
%%% Calculates mid-points on a path like |_ |
| 4389 |
%%% | (vertical, horizontal, vertical) |
| 4390 |
%%% final points are: z$, z$vhv, z$$vhv, z$$ |
| 4391 |
def VhV(suffix $, $$) = |
| 4392 |
y$$vhv=1/2[y$,y$$]; x$$vhv=x$$; |
| 4393 |
z$vhv=(x$,y$$vhv); |
| 4394 |
enddef; |
| 4395 |
|
| 4396 |
% \end{macrocode} |
| 4397 |
% \end{routine} |
| 4398 |
% |
| 4399 |
% \begin{routine}{HvH} |
| 4400 |
% \changes{v1.1}{1999/10/30}{Added HvH routine} |
| 4401 |
% Calculates the point |z$hvh| on the horizontal line through |z$| and the |
| 4402 |
% point |z$$hvh| on the horizontal line through |z$$|, such that the line |
| 4403 |
% |z$hvh--z$$hvh| is vertical and centered horizontally between the given |
| 4404 |
% points (see \fref{fig:vhvh}). |
| 4405 |
% \begin{macrocode} |
| 4406 |
%%% Calculates mid-points on a path like -|_ (horizontal, vertical, horizontal) |
| 4407 |
%%% final points are: z$, z$hvh, z$$hvh, z$$ |
| 4408 |
def HvH(suffix $, $$) = |
| 4409 |
x$hvh=1/2[x$,x$$]; y$hvh=y$; |
| 4410 |
z$$hvh=(x$hvh,y$$); |
| 4411 |
enddef; |
| 4412 |
|
| 4413 |
% \end{macrocode} |
| 4414 |
% \end{routine} |
| 4415 |
% |
| 4416 |
% \begin{routine}{VyV} |
| 4417 |
% \changes{v1.1}{1999/10/30}{Added VyV routine} |
| 4418 |
% A generalisation of |VhV|. |
| 4419 |
% Calculates the point |z$vyv| on the vertical line through |z$| and the |
| 4420 |
% horizontal line through |y@|, and the point |z$$vyv| on the vertical |
| 4421 |
% line through |z$$| and the horizontal line through |y@| (see \fref{fig:vyxh}). |
| 4422 |
% \begin{macrocode} |
| 4423 |
%%% Calculates turning points on a U shaped path (vertical, horizontal, vertical) |
| 4424 |
%%% final points are: z$, z$vyv, z$$vyv, z$$ |
| 4425 |
def VyV(suffix $, @, $$) = |
| 4426 |
z$$vyv=(x$$,y@); |
| 4427 |
z$vyv =(x$, y@); |
| 4428 |
enddef; |
| 4429 |
|
| 4430 |
% \end{macrocode} |
| 4431 |
% \end{routine} |
| 4432 |
% |
| 4433 |
% \begin{routine}{HxH} |
| 4434 |
% \changes{v1.1}{1999/10/30}{Added HxH routine} |
| 4435 |
% A generalisation of |HvH|. |
| 4436 |
% Calculates the point |z$hxh| on the horizontal line through |z$| and the |
| 4437 |
% vertical line through |x@|, and the |
| 4438 |
% point |z$$hgh| on the horizontal line through |z$$| and the vertical |
| 4439 |
% line through |x@| (see \fref{fig:vyxh}). |
| 4440 |
% \begin{macrocode} |
| 4441 |
%%% Calculates corner points rotated U shaped path (horizontal, vertical, horizontal) |
| 4442 |
%%% final points are: z$, z$hxh, z$$hxh, z$$ |
| 4443 |
def HxH(suffix $, @, $$) = |
| 4444 |
z$$hxh=(x@,y$$); |
| 4445 |
z$hxh =(x@,y$); |
| 4446 |
enddef; |
| 4447 |
|
| 4448 |
% \end{macrocode} |
| 4449 |
% \end{routine} |
| 4450 |
% |
| 4451 |
% \begin{routine}{namespace} |
| 4452 |
% |namespace(|\meta{name}|)(|\meta{margin}|)| calculates the length of |
| 4453 |
% the text string \meta{name} plus the \meta{margin} length. The |
| 4454 |
% body is enclosed in parentheses\footnote{Requested by Stephan Hennig, |
| 4455 |
% \texttt{ctt} thread \textit{[MP, expressg, latexmp] namespace and textext}, |
| 4456 |
% 16 March 2004} |
| 4457 |
% so you can do \verb?c=2namespace...? |
| 4458 |
% \changes{v1.61}{2004/03/17}{Added parentheses to namespace macro} |
| 4459 |
% \begin{macrocode} |
| 4460 |
%%% calculates length taken up by typesetting str, plus margin |
| 4461 |
def namespace(text str)(expr margin) = |
| 4462 |
(xpart lrcorner(str) - xpart llcorner(str) + margin) |
| 4463 |
enddef; |
| 4464 |
|
| 4465 |
% \end{macrocode} |
| 4466 |
% \end{routine} |
| 4467 |
% |
| 4468 |
% \begin{routine}{dashes} |
| 4469 |
% Shorthand for a dashed line style. Use as: |draw ... dashes;|. |
| 4470 |
% \begin{macrocode} |
| 4471 |
def dashes = |
| 4472 |
dashed evenly |
| 4473 |
enddef; |
| 4474 |
|
| 4475 |
% \end{macrocode} |
| 4476 |
% \end{routine} |
| 4477 |
% |
| 4478 |
% \begin{routine}{dots} |
| 4479 |
% Shorthand for a dotted line style. Use as: |draw ... dots;|. |
| 4480 |
% \begin{macrocode} |
| 4481 |
def dots = |
| 4482 |
dashed withdots |
| 4483 |
enddef; |
| 4484 |
|
| 4485 |
% \end{macrocode} |
| 4486 |
% \end{routine} |
| 4487 |
% |
| 4488 |
% \begin{routine}{dashedgrid} |
| 4489 |
% |dashedgrid(|\meta{nx}, \meta{ny}, \meta{dist}|)| draws a thin dashed grid |
| 4490 |
% with \meta{nx} and \meta{ny} divisions in the $x$ and $y$ directions, |
| 4491 |
% with \meta{dist} between the grid lines. The grid lines are numbered. |
| 4492 |
% \begin{macrocode} |
| 4493 |
% draw a general dashed grid |
| 4494 |
def dashedgrid(expr nx, ny, dist) = |
| 4495 |
save zg_, zg__, oldpen; |
| 4496 |
pair zg_[], zg__[]; |
| 4497 |
pen oldpen; oldpen = currentpen; |
| 4498 |
pickup thinpen; |
| 4499 |
for i = 0 upto nx: |
| 4500 |
zg_[i] = (i*dist, 0); zg_[i+1000] = (i*dist, ny*dist); |
| 4501 |
draw zg_[i]--zg_[i+1000] dashes; |
| 4502 |
label.bot(decimal(i), zg_[i]); |
| 4503 |
endfor |
| 4504 |
for i = 0 upto ny: |
| 4505 |
zg__[i] = (0, i*dist); zg__[i+1000] = (nx*dist, i*dist); |
| 4506 |
draw zg__[i]--zg__[i+1000] dashes; |
| 4507 |
label.lft(decimal(i), zg__[i]); |
| 4508 |
endfor |
| 4509 |
pickup oldpen; |
| 4510 |
enddef; |
| 4511 |
|
| 4512 |
% \end{macrocode} |
| 4513 |
% \end{routine} |
| 4514 |
% |
| 4515 |
% \begin{routine}{drawgrid} |
| 4516 |
% |drawgrid| draws a thin dashed grid filling the permitted space for an |
| 4517 |
% ISO Standard diagram. The units are in mm and the lines are at 10mm intervals |
| 4518 |
% with labeling in terms of mm. |
| 4519 |
% \begin{macrocode} |
| 4520 |
%%% draw a 1cm spaced grid of 16(x) by 21(y) cms. (units are mm) |
| 4521 |
def drawgrid = |
| 4522 |
dashedgrid(16, 21, 10mm); |
| 4523 |
enddef; |
| 4524 |
|
| 4525 |
% \end{macrocode} |
| 4526 |
% \end{routine} |
| 4527 |
% |
| 4528 |
% The box drawing routines take as an argument the suffix (|$|) of the |
| 4529 |
% left-hand bottom corner point of the box, and normally the length and |
| 4530 |
% height of the box. |
| 4531 |
% The coordinates of the box corners |
| 4532 |
% are calculated (|z$bl|, |z$br|, |z$tr| and |z$tl|). The midpoints of |
| 4533 |
% the sides of the box (|z$bm|, |z$mr|, |z$tm|, |z$ml|) are calculated |
| 4534 |
% as well. The text `center' of the box is |z$c|, while the geometric |
| 4535 |
% center of the box will be at the intersection point of the lines |
| 4536 |
% |z$bm--z$tm| and |z$ml--z$mr|. See \fref{fig:boxpoints} for an |
| 4537 |
% illustration. |
| 4538 |
% |
| 4539 |
% \begin{routine}{rectpoints} |
| 4540 |
% \changes{v1.1}{1999/10/30}{Added rectpoints routine} |
| 4541 |
% The routine |rectpoints($, l, h)| calculates |
| 4542 |
% the corner and midpoints of a rectangular box with bottom left |
| 4543 |
% at |z$|, length |l| and height |h|. Note that it does \emph{not} |
| 4544 |
% calculate the center point (see \fref{fig:boxpoints}). |
| 4545 |
% \begin{macrocode} |
| 4546 |
%%% calculates corner and midpoints of a rectangle, |
| 4547 |
%%% bottom left at $, length l, height h |
| 4548 |
def rectpoints(suffix $)(expr l, h) = |
| 4549 |
z$bl = z$; |
| 4550 |
z$tr = (x$+l, y$+h); |
| 4551 |
z$br = (x$tr, y$bl); |
| 4552 |
z$tl = (x$bl, y$tr); |
| 4553 |
z$ml = 1/2[z$bl, z$tl]; |
| 4554 |
z$mr = 1/2[z$br, z$tr]; |
| 4555 |
z$bm = 1/2[z$bl, z$br]; |
| 4556 |
z$tm = 1/2[z$tl, z$tr]; |
| 4557 |
enddef; |
| 4558 |
|
| 4559 |
% \end{macrocode} |
| 4560 |
% \end{routine} |
| 4561 |
% |
| 4562 |
% \begin{routine}{rhompoints} |
| 4563 |
% \changes{v1.1}{1999/10/30}{Added rhompoints routine} |
| 4564 |
% The routine |rhompoints($, l, h, s)| calculates the corner and midpoints |
| 4565 |
% of a rhomboid length |l|, height |h|, sideslope |s|, and positioned |
| 4566 |
% with its bottom left hand corner at |z$|. The center point is \emph{not} |
| 4567 |
% calculated (see \fref{fig:eventpoints}). |
| 4568 |
% \begin{macrocode} |
| 4569 |
%%% calculate corner, midpoints and center point of a rhomboid. |
| 4570 |
def rhompoints(suffix $)(expr l, h, s) = |
| 4571 |
save eshift; |
| 4572 |
numeric eshift; eshift = s*h; |
| 4573 |
z$bl = z$; |
| 4574 |
z$tr = (x$+l+eshift, y$+h); |
| 4575 |
z$br = (x$bl+l, y$bl); |
| 4576 |
z$tl = (x$bl+eshift, y$tr); |
| 4577 |
z$ml = 1/2[z$bl, z$tl]; |
| 4578 |
z$mr = 1/2[z$br, z$tr]; |
| 4579 |
z$bm = (1/2[x$ml,x$mr], y$bl); |
| 4580 |
z$tm = (x$bm, y$tr); |
| 4581 |
enddef; |
| 4582 |
|
| 4583 |
% \end{macrocode} |
| 4584 |
% \end{routine} |
| 4585 |
% |
| 4586 |
% \begin{routine}{circpoints} |
| 4587 |
% \changes{v1.1}{1999/10/30}{Added circpoints routine} |
| 4588 |
% The routine |circpoints($, d)| calculates the `corner' and `midpoints' |
| 4589 |
% on the circumference of a circle, center |z$| and diameter |d|. |
| 4590 |
% \begin{macrocode} |
| 4591 |
%%% calculate circumferential points on a circle |
| 4592 |
def circpoints(suffix $)(expr diam) = |
| 4593 |
save rad, sinrad, cosrad; |
| 4594 |
numeric rad, sinrad, cosrad; |
| 4595 |
rad = diam/2; |
| 4596 |
sinrad = rad*(sind 45); |
| 4597 |
cosrad = rad*(cosd 45); |
| 4598 |
z$c=z$; |
| 4599 |
z$ml=(x$c-rad, y$c); |
| 4600 |
z$mr=(x$c+rad, y$c); |
| 4601 |
z$bm=(x$c, y$c-rad); |
| 4602 |
z$tm=(x$c, y$c+rad); |
| 4603 |
z$tr=(x$c+cosrad, y$c+sinrad); |
| 4604 |
z$bl=(x$c-cosrad, y$c-sinrad); |
| 4605 |
z$br=(x$tr, y$bl); |
| 4606 |
z$tl=(x$bl, y$tr); |
| 4607 |
enddef; |
| 4608 |
|
| 4609 |
% \end{macrocode} |
| 4610 |
% \end{routine} |
| 4611 |
% |
| 4612 |
% \subsection{Path routines} |
| 4613 |
% \changes{v1.4}{2000/07/10}{Added path routines} |
| 4614 |
% |
| 4615 |
% \begin{routine}{~} |
| 4616 |
% The binary operator |~| is a reimplementation of the METAFONT plain base |
| 4617 |
% |softjoin| path connector (METAFONTbook, page 266); |
| 4618 |
% it connects paths via a small circular arc |
| 4619 |
% radius |smoothrad|. |
| 4620 |
% \begin{macrocode} |
| 4621 |
%%% circular arc join between two paths |
| 4622 |
tertiarydef p ~ q = |
| 4623 |
begingroup |
| 4624 |
c_ := fullcircle scaled 2smoothrad shifted point 0 of q; |
| 4625 |
a_ := ypart(c_ intersectiontimes p); |
| 4626 |
b_ := ypart(c_ intersectiontimes q); |
| 4627 |
if a_ < 0: point 0 of p{direction 0 of p} else: subpath(0,a_) of p fi |
| 4628 |
... if b_ < 0: {direction infinity of q}point infinity of q |
| 4629 |
else: subpath(b_,infinity) of q fi |
| 4630 |
endgroup |
| 4631 |
enddef; |
| 4632 |
|
| 4633 |
% \end{macrocode} |
| 4634 |
% \end{routine} |
| 4635 |
% |
| 4636 |
% \begin{routine}{sharply} |
| 4637 |
% |sharply(zi, zj, ...zn)| creates a piecewise linear path through the |
| 4638 |
% given points. (The code is based on the |flex| routine, |
| 4639 |
% page 267 of the METAFONTbook). |
| 4640 |
% \begin{macrocode} |
| 4641 |
%%% piecewise linear path between the given points |
| 4642 |
def sharply(text t) = % t is a list of pairs |
| 4643 |
hide(n_:=0; for z=t: z_[incr n_]:=z; endfor) |
| 4644 |
z_1 for k=2 upto n_: --z_[k] endfor |
| 4645 |
enddef; |
| 4646 |
|
| 4647 |
% \end{macrocode} |
| 4648 |
% \end{routine} |
| 4649 |
% |
| 4650 |
% \begin{routine}{smoothly} |
| 4651 |
% |smoothly(zi, zj, ...zn)| creates a piecewise linear path through the |
| 4652 |
% given points, with the sharp corners replaced by circular arcs of radius |
| 4653 |
% |smoothrad|. |
| 4654 |
% page 267 of the METAFONTbook). |
| 4655 |
% \begin{macrocode} |
| 4656 |
%%% piecewise linear path between the given points with smooth corners |
| 4657 |
def smoothly(text t) = % t is a list of pairs |
| 4658 |
hide(n_:=0; for z=t: z_[incr n_]:=z; endfor) |
| 4659 |
(z_1 for k=2 upto n_-1: --z_[k]) ~ (z_[k] endfor --z_[n_]) |
| 4660 |
enddef; |
| 4661 |
|
| 4662 |
% \end{macrocode} |
| 4663 |
% \end{routine} |
| 4664 |
% |
| 4665 |
% \subsection{Line end drawing routines} |
| 4666 |
% |
| 4667 |
% \changes{v1.4}{2000/07/10}{Added individual line end drawing routines} |
| 4668 |
% \begin{routine}{drawO} |
| 4669 |
% Draw an open circle, diameter |dotdiam| at the end of the vector |
| 4670 |
% |z$| to |z$$|. Any underlying graphic/text will be hidden. |
| 4671 |
% All the line end drawing routines have similar code. |
| 4672 |
% \begin{macrocode} |
| 4673 |
%%% Draw an open circle at end of vector from $ to $$ |
| 4674 |
def drawO(suffix $, $$) = |
| 4675 |
% \end{macrocode} |
| 4676 |
% Keep everything inside a group and specify the local variables. |
| 4677 |
% \begin{macrocode} |
| 4678 |
begingroup |
| 4679 |
save v_, c_, l, p; |
| 4680 |
% \end{macrocode} |
| 4681 |
% Specify the types of the local variables. |
| 4682 |
% \begin{macrocode} |
| 4683 |
pair v_, c_; |
| 4684 |
numeric l; |
| 4685 |
path p; |
| 4686 |
% \end{macrocode} |
| 4687 |
% |v_| is the difference between the start and end points of the line. |
| 4688 |
% That is, it is the vector from the end point to the start point. |
| 4689 |
% \begin{macrocode} |
| 4690 |
v_ := z$-z$$; |
| 4691 |
% \end{macrocode} |
| 4692 |
% \DescribeRoutine{++} |
| 4693 |
% \DescribeRoutine{xpart} |
| 4694 |
% \DescribeRoutine{ypart} |
| 4695 |
% Using \Mpost's Pythagorean addition operator |++|, where |a++b| means |
| 4696 |
% $\sqrt{a^{2}+b^{2}}$, we can calculate the length |l| of the line from |
| 4697 |
% the x and y dimension (|xpart| and |ypart|) of the vector |v_|. |
| 4698 |
% \begin{macrocode} |
| 4699 |
l := (xpart v_)++(ypart v_); % length of the line |
| 4700 |
% \end{macrocode} |
| 4701 |
% Using mediation involving the ratio of the circle radius to the length |
| 4702 |
% of the line, calculate |c_|, the required position of the center of |
| 4703 |
% the circle at the end of the line. |
| 4704 |
% \begin{macrocode} |
| 4705 |
c_ := (dotdiam/(2l))[z$$,z$]; |
| 4706 |
% \end{macrocode} |
| 4707 |
% |p| is the path for drawing the circle. |
| 4708 |
% \begin{macrocode} |
| 4709 |
p := fullcircle scaled dotdiam shifted c_; |
| 4710 |
% \end{macrocode} |
| 4711 |
% Erase anything underneath the circle. |
| 4712 |
% \begin{macrocode} |
| 4713 |
unfill p; |
| 4714 |
% \end{macrocode} |
| 4715 |
% Now we can draw the circle (twice to make sure it shows). |
| 4716 |
% \begin{macrocode} |
| 4717 |
draw p; draw p; |
| 4718 |
% \end{macrocode} |
| 4719 |
% Finish the local group and end. |
| 4720 |
% \begin{macrocode} |
| 4721 |
endgroup |
| 4722 |
enddef; |
| 4723 |
|
| 4724 |
% \end{macrocode} |
| 4725 |
% \end{routine} |
| 4726 |
% |
| 4727 |
% \begin{routine}{drawD} |
| 4728 |
% Draw a closed circle, diameter |dotdiam| at the end of the vector |
| 4729 |
% |z$| to |z$$|. Any underlying graphic/text will be hidden. |
| 4730 |
% \begin{macrocode} |
| 4731 |
%%% Draw a closed circle at end of vector from $ to $$ |
| 4732 |
def drawD(suffix $, $$) = |
| 4733 |
begingroup |
| 4734 |
save v_, c_, l, p; |
| 4735 |
pair v_, c_; |
| 4736 |
numeric l; |
| 4737 |
path p; |
| 4738 |
v_ := z$-z$$; |
| 4739 |
l := (xpart v_)++(ypart v_); % length of the line |
| 4740 |
c_ := (dotdiam/(2l))[z$$,z$]; |
| 4741 |
p := fullcircle scaled dotdiam shifted c_; |
| 4742 |
fill p; |
| 4743 |
endgroup |
| 4744 |
enddef; |
| 4745 |
|
| 4746 |
% \end{macrocode} |
| 4747 |
% \end{routine} |
| 4748 |
% |
| 4749 |
% \begin{routine}{drawOA} |
| 4750 |
% Draw an open arrowhead, length |gal| and base width |gab|, |
| 4751 |
% at the end of the vector from |z$| to |z$$|. |
| 4752 |
% The same general code pattern is used for non-circular |
| 4753 |
% line end styles, and is described here. It is not too different |
| 4754 |
% from drawing circular ends, except that the orientation of the line |
| 4755 |
% has to be taken into account. |
| 4756 |
% \begin{macrocode} |
| 4757 |
%%% draw an open arrowhead at end of vector from $ to $$ |
| 4758 |
def drawOA(suffix $, $$) = |
| 4759 |
begingroup |
| 4760 |
save v_, c_, v_u, c_t, c_b, l, hb, p; |
| 4761 |
pair v_, c_, v_u, c_t, c_b; |
| 4762 |
numeric l, hb; |
| 4763 |
path p; |
| 4764 |
hb := gab/2; |
| 4765 |
v_ := z$-z$$; |
| 4766 |
l := (xpart v_)++(ypart v_); % length of the line |
| 4767 |
c_ := (gal/(l))[z$$,z$]; % base of arrowhead |
| 4768 |
% \end{macrocode} |
| 4769 |
% Calculate the unit vector in the direction of the line. |
| 4770 |
% \begin{macrocode} |
| 4771 |
v_u := unitvector v_; |
| 4772 |
% \end{macrocode} |
| 4773 |
% Calculate one of the corner points on the base of the triangle by |
| 4774 |
% shifting the midbase point in the direction of the normal to the |
| 4775 |
% line by half the base width. |
| 4776 |
% \begin{macrocode} |
| 4777 |
c_t := c_ shifted (-hb*(ypart v_u), hb*(xpart v_u)); |
| 4778 |
% \end{macrocode} |
| 4779 |
% Specify that the other corner point is symmetrically opposite the first. |
| 4780 |
% \begin{macrocode} |
| 4781 |
c_b - c_ = c_ - c_t; |
| 4782 |
% \end{macrocode} |
| 4783 |
% Draw the triangular arrowhead. |
| 4784 |
% \begin{macrocode} |
| 4785 |
p = c_b--z$$--c_t--cycle; |
| 4786 |
unfill p; |
| 4787 |
draw p; draw p; |
| 4788 |
endgroup |
| 4789 |
enddef; |
| 4790 |
|
| 4791 |
% \end{macrocode} |
| 4792 |
% \end{routine} |
| 4793 |
% |
| 4794 |
% \begin{routine}{drawCA} |
| 4795 |
% Draw a closed (black) arrowhead, length |gal| and base width |gab|, |
| 4796 |
% at the end of the vector from |z$| to |z$$|. |
| 4797 |
% \begin{macrocode} |
| 4798 |
%%% draw a closed arrowhead at end of vector from $ to $$ |
| 4799 |
def drawCA(suffix $, $$) = |
| 4800 |
begingroup |
| 4801 |
save v_, c_, v_u, c_t, c_b, l, hb, p; |
| 4802 |
pair v_, c_, v_u, c_t, c_b; |
| 4803 |
numeric l, hb; |
| 4804 |
path p; |
| 4805 |
hb := gab/2; |
| 4806 |
v_ := z$-z$$; |
| 4807 |
l := (xpart v_)++(ypart v_); % length of the line |
| 4808 |
c_ := (gal/(l))[z$$,z$]; % base of arrowhead |
| 4809 |
v_u := unitvector v_; |
| 4810 |
c_t := c_ shifted (-hb*(ypart v_u), hb*(xpart v_u)); |
| 4811 |
c_b - c_ = c_ - c_t; |
| 4812 |
p = c_b--z$$--c_t--cycle; |
| 4813 |
filldraw p; |
| 4814 |
endgroup |
| 4815 |
enddef; |
| 4816 |
|
| 4817 |
% \end{macrocode} |
| 4818 |
% \end{routine} |
| 4819 |
% |
| 4820 |
% \begin{routine}{drawA} |
| 4821 |
% Draw a simple arrowhead, length |gal| and base width |gab|, |
| 4822 |
% at the end of the vector from |z$| to |z$$|. |
| 4823 |
% \begin{macrocode} |
| 4824 |
%%% draw a simple arrowhead at end of vector from $ to $$ |
| 4825 |
def drawA(suffix $, $$) = |
| 4826 |
begingroup |
| 4827 |
save v_, c_, v_u, c_t, c_b, l, hb, p; |
| 4828 |
pair v_, c_, v_u, c_t, c_b; |
| 4829 |
numeric l, hb; |
| 4830 |
path p; |
| 4831 |
hb := gab/2; |
| 4832 |
v_ := z$-z$$; |
| 4833 |
l := (xpart v_)++(ypart v_); % length of the line |
| 4834 |
c_ := (gal/(l))[z$$,z$]; % base of arrowhead |
| 4835 |
v_u := unitvector v_; |
| 4836 |
c_t := c_ shifted (-hb*(ypart v_u), hb*(xpart v_u)); |
| 4837 |
c_b - c_ = c_ - c_t; |
| 4838 |
p = c_b--z$$--c_t; |
| 4839 |
draw p; |
| 4840 |
endgroup |
| 4841 |
enddef; |
| 4842 |
|
| 4843 |
% \end{macrocode} |
| 4844 |
% \end{routine} |
| 4845 |
% |
| 4846 |
% \begin{routine}{drawF} |
| 4847 |
% Draw a fanin, length |gfl| and base width |gfb|, |
| 4848 |
% at the end of the vector from |z$| to |z$$|. |
| 4849 |
% \begin{macrocode} |
| 4850 |
%%% draws a fanin at the end of the vector from $ to $$ |
| 4851 |
def drawF(suffix $, $$) = |
| 4852 |
begingroup |
| 4853 |
save v_, c_, v_u, c_t, c_b, l, hb, p; |
| 4854 |
pair v_, c_, v_u, c_t, c_b; |
| 4855 |
numeric l, hb; |
| 4856 |
path p; |
| 4857 |
hb := gfb/2; |
| 4858 |
v_ := z$-z$$; |
| 4859 |
l := (xpart v_)++(ypart v_); % length of the line |
| 4860 |
c_ := (gfl/(l))[z$$,z$]; % apex of fan |
| 4861 |
v_u := unitvector v_; |
| 4862 |
c_t := z$$ shifted (-hb*(ypart v_u), hb*(xpart v_u)); |
| 4863 |
c_b - z$$ = z$$ - c_t; |
| 4864 |
p = c_b--c_--c_t; |
| 4865 |
draw p; |
| 4866 |
endgroup |
| 4867 |
enddef; |
| 4868 |
|
| 4869 |
% \end{macrocode} |
| 4870 |
% \end{routine} |
| 4871 |
% |
| 4872 |
% |
| 4873 |
% \subsection{Line drawing routines} |
| 4874 |
% \changes{v1.4}{2000/07/10}{Stripped in-line line end code from line drawing routines} |
| 4875 |
% |
| 4876 |
% \begin{routine}{drawdots} |
| 4877 |
% Draw a dotted line between the two points |z$| and |z$$|. |
| 4878 |
% \begin{macrocode} |
| 4879 |
%%% Draw a dotted line from $ to $$ |
| 4880 |
def drawdots(suffix $, $$) = |
| 4881 |
pickup dotspen; |
| 4882 |
draw z$--z$$ dots; |
| 4883 |
pickup normalpen; |
| 4884 |
enddef; |
| 4885 |
|
| 4886 |
% \end{macrocode} |
| 4887 |
% \end{routine} |
| 4888 |
% |
| 4889 |
% \begin{routine}{drawdotsthree} |
| 4890 |
% Draw a straight dotted line between the three points |z$|, |z@| and |z$$|. |
| 4891 |
% \begin{macrocode} |
| 4892 |
%%% Draws the dotted line $--@--$$ |
| 4893 |
def drawdotsthree(suffix $, @, $$) = |
| 4894 |
pickup dotspen; |
| 4895 |
draw z$--z@--z$$ dots; |
| 4896 |
pickup normalpen; |
| 4897 |
enddef; |
| 4898 |
|
| 4899 |
% \end{macrocode} |
| 4900 |
% \end{routine} |
| 4901 |
% |
| 4902 |
% \begin{routine}{drawdotsfour} |
| 4903 |
% Draw a straight dotted line between the four points |z$|, |z@|, |z@@| and |z$$|. |
| 4904 |
% \begin{macrocode} |
| 4905 |
%%% Draw the dotted line $--@--@@--$$ |
| 4906 |
def drawdotsfour(suffix $, @, @@, $$) = |
| 4907 |
pickup dotspen; |
| 4908 |
draw z$--z@--z@@--z$$ dots; |
| 4909 |
pickup normalpen; |
| 4910 |
enddef; |
| 4911 |
|
| 4912 |
% \end{macrocode} |
| 4913 |
% \end{routine} |
| 4914 |
% |
| 4915 |
% \begin{routine}{drawdotsO} |
| 4916 |
% Draw a dotted line between the two points |z$| and |z$$|, |
| 4917 |
% ending in an open circle, diameter |dotdiam|, at |z$$|. |
| 4918 |
% \begin{macrocode} |
| 4919 |
%%% Draw a dotted line from $ to $$ with open circle at $$ |
| 4920 |
def drawdotsO(suffix $, $$) = |
| 4921 |
pickup dotspen; |
| 4922 |
draw z$--z$$ dots; |
| 4923 |
pickup normalpen; |
| 4924 |
drawO($, $$); |
| 4925 |
enddef; |
| 4926 |
|
| 4927 |
% \end{macrocode} |
| 4928 |
% \end{routine} |
| 4929 |
% |
| 4930 |
% \begin{routine}{drawdotsthreeO} |
| 4931 |
% Draw a straight dotted line between the three points |z$|, |z@| and |z$$|, |
| 4932 |
% ending in an open circle, diameter |dotdiam|, at |z$$|. |
| 4933 |
% \begin{macrocode} |
| 4934 |
%%% Draws the dotted line $--@--$$ |
| 4935 |
def drawdotsthreeO(suffix $, @, $$) = |
| 4936 |
pickup dotspen; |
| 4937 |
draw z$--z@--z$$ dots; |
| 4938 |
pickup normalpen; |
| 4939 |
drawO(@, $$); |
| 4940 |
enddef; |
| 4941 |
|
| 4942 |
% \end{macrocode} |
| 4943 |
% \end{routine} |
| 4944 |
% |
| 4945 |
% \begin{routine}{drawdotsfourO} |
| 4946 |
% Draw a straight dotted line between the four points |z$|, |z@|, |z@@| and |z$$|, |
| 4947 |
% ending in an open circle, diameter |dotdiam|, at |z$$|. |
| 4948 |
% \begin{macrocode} |
| 4949 |
%%% Draw the dotted line $--@--@@--$$ |
| 4950 |
def drawdotsfourO(suffix $, @, @@, $$) = |
| 4951 |
pickup dotspen; |
| 4952 |
draw z$--z@--z@@--z$$ dots; |
| 4953 |
pickup normalpen; |
| 4954 |
drawO(@@, $$); |
| 4955 |
enddef; |
| 4956 |
|
| 4957 |
% \end{macrocode} |
| 4958 |
% \end{routine} |
| 4959 |
% |
| 4960 |
% \begin{routine}{drawdotsOO} |
| 4961 |
% Draw a dotted line between the two points |z$| and |z$$|, |
| 4962 |
% ending in open circles, diameter |dotdiam|, at |z$| and |z$$|. |
| 4963 |
% \begin{macrocode} |
| 4964 |
%%% Draw the dotted line from $ to $$, ending in circles diameter dotdiam at $ and $$ |
| 4965 |
def drawdotsOO(suffix $, $$) = |
| 4966 |
pickup dotspen; |
| 4967 |
draw z$--z$$ dots; |
| 4968 |
pickup normalpen; |
| 4969 |
drawO($, $$); drawO($$, $); |
| 4970 |
enddef; |
| 4971 |
|
| 4972 |
% \end{macrocode} |
| 4973 |
% \end{routine} |
| 4974 |
% |
| 4975 |
% \begin{routine}{drawdash} |
| 4976 |
% Draw a dashed line between the two points |z$| and |z$$|. |
| 4977 |
% \begin{macrocode} |
| 4978 |
%%% draws a dashed line from $ to $$ |
| 4979 |
def drawdash(suffix $, $$) = |
| 4980 |
draw z$--z$$ dashes; |
| 4981 |
enddef; |
| 4982 |
|
| 4983 |
% \end{macrocode} |
| 4984 |
% \end{routine} |
| 4985 |
% |
| 4986 |
% \begin{routine}{drawdashthree} |
| 4987 |
% Draw a straight dashed line between the three points |z$|, |z@| and |z$$|. |
| 4988 |
% \begin{macrocode} |
| 4989 |
%%% draws the dashed line $--@--$$ |
| 4990 |
def drawdashthree(suffix $, @, $$) = |
| 4991 |
draw z$--z@--z$$ dashes; |
| 4992 |
enddef; |
| 4993 |
|
| 4994 |
% \end{macrocode} |
| 4995 |
% \end{routine} |
| 4996 |
% |
| 4997 |
% \begin{routine}{drawdashfour} |
| 4998 |
% Draw a straight dashed line between the four points |z$|, |z@|, |z@@| and |z$$|. |
| 4999 |
% \begin{macrocode} |
| 5000 |
%%% draws the dashed line $--@--@@--$$ |
| 5001 |
def drawdashfour(suffix $, @, @@, $$) = |
| 5002 |
draw z$--z@--z@@--z$$ dashes; |
| 5003 |
enddef; |
| 5004 |
|
| 5005 |
% \end{macrocode} |
| 5006 |
% \end{routine} |
| 5007 |
% |
| 5008 |
% \begin{routine}{drawdashO} |
| 5009 |
% Draw a dashed line between the two points |z$| and |z$$|, |
| 5010 |
% ending in an open circle, diameter |dotdiam|, at |z$$|. |
| 5011 |
% \begin{macrocode} |
| 5012 |
%%% draws a dashed line from $ to $$, ending in a circle diameter dotdiam at $$ |
| 5013 |
def drawdashO(suffix $, $$) = |
| 5014 |
draw z$--z$$ dashes; |
| 5015 |
drawO($, $$); |
| 5016 |
enddef; |
| 5017 |
|
| 5018 |
% \end{macrocode} |
| 5019 |
% \end{routine} |
| 5020 |
% |
| 5021 |
% \begin{routine}{drawdashthreeO} |
| 5022 |
% Draw a straight dashed line between the three points |z$|, |z@| and |z$$|, |
| 5023 |
% ending in an open circle, diameter |dotdiam|, at |z$$|. |
| 5024 |
% \begin{macrocode} |
| 5025 |
%%% draws the dashed line $--@--$$ with circle at $$ |
| 5026 |
def drawdashthreeO(suffix $, @, $$) = |
| 5027 |
draw z$--z@--z$$ dashes; |
| 5028 |
drawO(@, $$); |
| 5029 |
enddef; |
| 5030 |
|
| 5031 |
% \end{macrocode} |
| 5032 |
% \end{routine} |
| 5033 |
% |
| 5034 |
% \begin{routine}{drawdashfourO} |
| 5035 |
% Draw a straight dashed line between the four points |z$|, |z@|, |z@@| and |z$$|, |
| 5036 |
% ending in an open circle, diameter |dotdiam|, at |z$$|. |
| 5037 |
% \begin{macrocode} |
| 5038 |
%%% draws the dashed line $--@--@@--$$ with circle at $$ |
| 5039 |
def drawdashfourO(suffix $, @, @@, $$) = |
| 5040 |
draw z$--z@--z@@--z$$ dashes; |
| 5041 |
drawO(@@, $$); |
| 5042 |
enddef; |
| 5043 |
|
| 5044 |
% \end{macrocode} |
| 5045 |
% \end{routine} |
| 5046 |
% |
| 5047 |
% \begin{routine}{drawdashOO} |
| 5048 |
% Draw a dashed line between the two points |z$| and |z$$|, |
| 5049 |
% ending in open circles, diameter |dotdiam|, at |z$| and |z$$|. |
| 5050 |
% \begin{macrocode} |
| 5051 |
% drawdashOO($, $$) |
| 5052 |
%%% draws a dashed line from $ to $$, ending in circles diameter dotdiam at $ and $$ |
| 5053 |
def drawdashOO(suffix $, $$) = |
| 5054 |
draw z$--z$$ dashes; |
| 5055 |
drawO($, $$); drawO($$, $); |
| 5056 |
enddef; |
| 5057 |
|
| 5058 |
% \end{macrocode} |
| 5059 |
% \end{routine} |
| 5060 |
% |
| 5061 |
% \begin{routine}{drawnormal} |
| 5062 |
% Draw a normal thickness line between the two points |z$| and |z$$|. |
| 5063 |
% \begin{macrocode} |
| 5064 |
%%% draws a normal line from $ to $$. |
| 5065 |
def drawnormal(suffix $, $$) = |
| 5066 |
draw z$--z$$; |
| 5067 |
enddef; |
| 5068 |
|
| 5069 |
% \end{macrocode} |
| 5070 |
% \end{routine} |
| 5071 |
% |
| 5072 |
% \begin{routine}{drawnormalthree} |
| 5073 |
% Draw a straight normal thickness line between the three points |z$|, |z@| and |z$$|. |
| 5074 |
% \begin{macrocode} |
| 5075 |
% drawnormalthree($, @, $$) |
| 5076 |
%%% draws the normal line $--@--$$ |
| 5077 |
def drawnormalthree(suffix $, @, $$) = |
| 5078 |
draw z$--z@--z$$; |
| 5079 |
enddef; |
| 5080 |
|
| 5081 |
% \end{macrocode} |
| 5082 |
% \end{routine} |
| 5083 |
% |
| 5084 |
% \begin{routine}{drawnormalfour} |
| 5085 |
% Draw a straight normal thickness line between the four points |z$|, |z@|, |z@@| and |z$$|. |
| 5086 |
% \begin{macrocode} |
| 5087 |
%%% draws the normal line $--@--@@--$$ |
| 5088 |
def drawnormalfour(suffix $, @, @@, $$) = |
| 5089 |
draw z$--z@--z@@--z$$; |
| 5090 |
enddef; |
| 5091 |
|
| 5092 |
% \end{macrocode} |
| 5093 |
% \end{routine} |
| 5094 |
% |
| 5095 |
% \begin{routine}{drawnormalO} |
| 5096 |
% Draw a straight normal thickness line between the two points |z$| and |z$$|, |
| 5097 |
% ending in an open circle, diameter |dotdiam|, at |z$$|. |
| 5098 |
% \begin{macrocode} |
| 5099 |
% drawnormalO($, $$) |
| 5100 |
%%% draws a normal line from $ to $$, ending in a circle diameter dotdiam at $$ |
| 5101 |
def drawnormalO(suffix $, $$) = |
| 5102 |
draw z$--z$$; |
| 5103 |
drawO($, $$); |
| 5104 |
enddef; |
| 5105 |
|
| 5106 |
% \end{macrocode} |
| 5107 |
% \end{routine} |
| 5108 |
% |
| 5109 |
% \begin{routine}{drawnormalthreeO} |
| 5110 |
% Draw a straight normal thickness line between the three points |z$|, |z@| and |z$$|, |
| 5111 |
% ending in an open circle, diameter |dotdiam|, at |z$$|. |
| 5112 |
% \begin{macrocode} |
| 5113 |
%%% draws the normal line $--@--$$, ending in a circle at $$ |
| 5114 |
def drawnormalthreeO(suffix $, @, $$) = |
| 5115 |
draw z$--z@--z$$; |
| 5116 |
drawO(@, $$); |
| 5117 |
enddef; |
| 5118 |
|
| 5119 |
% \end{macrocode} |
| 5120 |
% \end{routine} |
| 5121 |
% |
| 5122 |
% \begin{routine}{drawnormalfourO} |
| 5123 |
% Draw a straight normal thickness line between the four points |z$|, |z@|, |z@@| and |z$$|, |
| 5124 |
% ending in an open circle, diameter |dotdiam|, at |z$$|. |
| 5125 |
% \begin{macrocode} |
| 5126 |
%%% draws the line $--@--@@--$$, ending in a circle at $$ |
| 5127 |
def drawnormalfourO(suffix $, @, @@, $$) = |
| 5128 |
draw z$--z@--z@@--z$$; |
| 5129 |
drawO(@@, $$); |
| 5130 |
enddef; |
| 5131 |
|
| 5132 |
|
| 5133 |
% \end{macrocode} |
| 5134 |
% \end{routine} |
| 5135 |
% |
| 5136 |
% \begin{routine}{drawnormalOO} |
| 5137 |
% Draw a straight normal thickness line between the two points |z$| and |z$$|, |
| 5138 |
% ending in open circles, diameter |dotdiam|, at |z$| and |z$$|. |
| 5139 |
% \begin{macrocode} |
| 5140 |
% drawnormalOO($, $$) |
| 5141 |
%%% draws a normal line from $ to $$, ending in circles diameter dotdiam at $ and $$ |
| 5142 |
def drawnormalOO(suffix $, $$) = |
| 5143 |
draw z$--z$$; |
| 5144 |
drawO($, $$); drawO($$, $); |
| 5145 |
enddef; |
| 5146 |
|
| 5147 |
% \end{macrocode} |
| 5148 |
% \end{routine} |
| 5149 |
% |
| 5150 |
% \begin{routine}{drawnormalD} |
| 5151 |
% Draw a straight normal thickness line between the two points |z$| and |z$$|, |
| 5152 |
% ending in a black dot, diameter |dotdiam|, at |z$$|. |
| 5153 |
% \begin{macrocode} |
| 5154 |
%%% draws a normal line from $ to $$, ending in a dot diameter dotdiam at $$ |
| 5155 |
def drawnormalD(suffix $, $$) = |
| 5156 |
draw z$--z$$; |
| 5157 |
drawD($, $$); |
| 5158 |
enddef; |
| 5159 |
|
| 5160 |
% \end{macrocode} |
| 5161 |
% \end{routine} |
| 5162 |
% |
| 5163 |
% \begin{routine}{drawnormalthreeD} |
| 5164 |
% Draw a straight normal thickness line between the three points |z$|, |z@| and |z$$|, |
| 5165 |
% ending in a black dot, diameter |dotdiam|, at |z$$|. |
| 5166 |
% \begin{macrocode} |
| 5167 |
%%% draws the normal line $--@--$$, ending in a dot at $$ |
| 5168 |
def drawnormalthreeD(suffix $, @, $$) = |
| 5169 |
draw z$--z@--z$$; |
| 5170 |
drawD(@, $$); |
| 5171 |
enddef; |
| 5172 |
|
| 5173 |
% \end{macrocode} |
| 5174 |
% \end{routine} |
| 5175 |
% |
| 5176 |
% \begin{routine}{drawnormalfourD} |
| 5177 |
% Draw a straight normal thickness line between the four points |z$|, |z@|, |z@@| and |z$$|, |
| 5178 |
% ending in a black dot, diameter |dotdiam|, at |z$$|. |
| 5179 |
% \begin{macrocode} |
| 5180 |
%%% draws the normal line $--@--@@--$$, ending in a dot at $$ |
| 5181 |
def drawnormalfourD(suffix $, @, @@, $$) = |
| 5182 |
draw z$--z@--z@@--z$$; |
| 5183 |
drawD(@@, $$); |
| 5184 |
enddef; |
| 5185 |
|
| 5186 |
|
| 5187 |
% \end{macrocode} |
| 5188 |
% \end{routine} |
| 5189 |
% |
| 5190 |
% \begin{routine}{drawnormalDD} |
| 5191 |
% Draw a straight normal thickness line between the two points |z$| and |z$$|, |
| 5192 |
% ending in black dots, diameter |dotdiam|, at |z$| and |z$$|. |
| 5193 |
% \begin{macrocode} |
| 5194 |
%%% draws a normal line from $ to $$, ending in dots diameter dotdiam at $ and $$ |
| 5195 |
def drawnormalDD(suffix $, $$) = |
| 5196 |
draw z$--z$$; |
| 5197 |
drawD($, $$); drawD($$, $); |
| 5198 |
enddef; |
| 5199 |
|
| 5200 |
% \end{macrocode} |
| 5201 |
% \end{routine} |
| 5202 |
% |
| 5203 |
% \begin{routine}{drawnormalOA} |
| 5204 |
% Draw a straight normal thickness line between the two points |z$| and |z$$|, |
| 5205 |
% ending with an open arrowhead, length |gal| and base width |gab|, |
| 5206 |
% at |z$$|. |
| 5207 |
% \begin{macrocode} |
| 5208 |
%%% draws a normal line from $ to $$, ending with an open arrowhead at $$ |
| 5209 |
def drawnormalOA(suffix $, $$) = |
| 5210 |
draw z$--z$$; |
| 5211 |
drawOA($, $$); |
| 5212 |
enddef; |
| 5213 |
|
| 5214 |
% \end{macrocode} |
| 5215 |
% \end{routine} |
| 5216 |
% |
| 5217 |
% \begin{routine}{drawnormalCA} |
| 5218 |
% Draw a straight normal thickness line between the two points |z$| and |z$$|, |
| 5219 |
% ending with a closed (black) arrowhead, length |gal| and base width |gab|, |
| 5220 |
% at |z$$|. |
| 5221 |
% \begin{macrocode} |
| 5222 |
%%% draws a normal line from $ to $$, ending with a closed arrowhead at $$ |
| 5223 |
def drawnormalCA(suffix $, $$) = |
| 5224 |
draw z$--z$$; |
| 5225 |
drawCA($, $$); |
| 5226 |
enddef; |
| 5227 |
|
| 5228 |
% \end{macrocode} |
| 5229 |
% \end{routine} |
| 5230 |
% |
| 5231 |
% \begin{routine}{drawnormalthreeCA} |
| 5232 |
% Draw a straight normal thickness line between the three points |z$|, |z@| and |z$$|, |
| 5233 |
% ending in a closed arrowhead at |z$$|. |
| 5234 |
% \begin{macrocode} |
| 5235 |
%%% draws the normal line $--@--$$, ending in a black arrowhead at $$ |
| 5236 |
def drawnormalthreeCA(suffix $, @, $$) = |
| 5237 |
draw z$--z@--z$$; |
| 5238 |
drawCA(@, $$); |
| 5239 |
enddef; |
| 5240 |
|
| 5241 |
% \end{macrocode} |
| 5242 |
% \end{routine} |
| 5243 |
% |
| 5244 |
% \begin{routine}{drawnormalfourCA} |
| 5245 |
% Draw a straight normal thickness line between the four points |z$|, |z@|, |z@@| and |z$$|, |
| 5246 |
% ending in a closed arrowhead at |z$$|. |
| 5247 |
% \begin{macrocode} |
| 5248 |
%%% draws the normal line $--@--@@--$$, ending in a black arrowhead at $$ |
| 5249 |
def drawnormalfourCA(suffix $, @, @@, $$) = |
| 5250 |
draw z$--z@--z@@--z$$; |
| 5251 |
drawCA(@@, $$); |
| 5252 |
enddef; |
| 5253 |
|
| 5254 |
% \end{macrocode} |
| 5255 |
% \end{routine} |
| 5256 |
% |
| 5257 |
% \begin{routine}{drawnormalF} |
| 5258 |
% Draw a straight normal thickness line between the two points |z$| and |z$$|, |
| 5259 |
% ending with a fanin, length |gfl| and base width |gfb|, |
| 5260 |
% at |z$$|. |
| 5261 |
% \begin{macrocode} |
| 5262 |
%%% draws a normal line from $ to $$, ending with a fanin at $$ |
| 5263 |
def drawnormalF(suffix $, $$) = |
| 5264 |
draw z$--z$$; |
| 5265 |
drawF($, $$); |
| 5266 |
enddef; |
| 5267 |
|
| 5268 |
% \end{macrocode} |
| 5269 |
% \end{routine} |
| 5270 |
% |
| 5271 |
% \begin{routine}{drawnormalFO} |
| 5272 |
% Draw a straight normal thickness line between the two points |z$| and |z$$|, |
| 5273 |
% ending with a fanin, length |gfl| and base width |gfb|, |
| 5274 |
% at |z$| and an open circle, diameter |dotdiam|, at |z$$|. |
| 5275 |
% \begin{macrocode} |
| 5276 |
%%% draws a normal line from $ to $$, with a fanin at $ and an open circle at $$ |
| 5277 |
def drawnormalFO(suffix $, $$) = |
| 5278 |
draw z$--z$$; |
| 5279 |
drawO($, $$); drawF($$, $); |
| 5280 |
enddef; |
| 5281 |
|
| 5282 |
% \end{macrocode} |
| 5283 |
% \end{routine} |
| 5284 |
% |
| 5285 |
% \begin{routine}{drawthick} |
| 5286 |
% Draw a straight thick line between the two points |z$| and |z$$| |
| 5287 |
% \begin{macrocode} |
| 5288 |
%%% draws a thick line from $ to $$. |
| 5289 |
def drawthick(suffix $, $$) = |
| 5290 |
pickup thickpen; |
| 5291 |
draw z$--z$$; |
| 5292 |
pickup normalpen; |
| 5293 |
enddef; |
| 5294 |
|
| 5295 |
% \end{macrocode} |
| 5296 |
% \end{routine} |
| 5297 |
% |
| 5298 |
% \begin{routine}{drawthickO} |
| 5299 |
% Draw a straight thick line between the two points |z$| and |z$$|, |
| 5300 |
% ending with an open circle, diameter |dotdiam|, at |z$$|. |
| 5301 |
% \begin{macrocode} |
| 5302 |
%%% draws a thick line from $ to $$, ending in a circle diameter dotdiam at $$ |
| 5303 |
def drawthickO(suffix $, $$) = |
| 5304 |
pickup thickpen; |
| 5305 |
draw z$--z$$; |
| 5306 |
drawO($, $$); |
| 5307 |
pickup normalpen; |
| 5308 |
enddef; |
| 5309 |
|
| 5310 |
% \end{macrocode} |
| 5311 |
% \end{routine} |
| 5312 |
% |
| 5313 |
% \begin{routine}{drawthickOO} |
| 5314 |
% Draw a straight thick line between the two points |z$| and |z$$|, |
| 5315 |
% ending with open circles, diameter |dotdiam|, at |z$| and |z$$|. |
| 5316 |
% \changes{v1.5}{2003/07/31}{Added thickpen to drawthickOO} |
| 5317 |
% \begin{macrocode} |
| 5318 |
%%% draws a thick line from $ to $$, ending in circles diameter dotdiam at $ and $$ |
| 5319 |
def drawthickOO(suffix $, $$) = |
| 5320 |
pickup thickpen; |
| 5321 |
draw z$--z$$; |
| 5322 |
drawO($, $$); drawO($$, $); |
| 5323 |
pickup normalpen; |
| 5324 |
enddef; |
| 5325 |
|
| 5326 |
% \end{macrocode} |
| 5327 |
% \end{routine} |
| 5328 |
% |
| 5329 |
% \begin{routine}{smooth} |
| 5330 |
% Rounds the join at |z@| between the two straight lines |z$--z@--z$$|. |
| 5331 |
% The radius of the circular arc is |smoothrad|. The code employs the |
| 5332 |
% same technique as used for putting dots, etc., at the end of a line. |
| 5333 |
% However, in this case we `undraw' the sharp corner before drawing the |
| 5334 |
% arc. |
| 5335 |
% \changes{v1.3}{2000/05/22}{Added smooth routine} |
| 5336 |
% \begin{macrocode} |
| 5337 |
%%% replaces the sharp corner on $--@--$$ with a circular arc radius smoothrad |
| 5338 |
def smooth(suffix $, @, $$) = |
| 5339 |
begingroup |
| 5340 |
save v_, c_, l, p; |
| 5341 |
pair v_, v_', c_, c_'; |
| 5342 |
path p; |
| 5343 |
v_ := z@-z$; |
| 5344 |
l := (xpart v_)++(ypart v_); % length of $--@ |
| 5345 |
c_ := (smoothrad/l)[z@,z$]; % start of arc on $--@ |
| 5346 |
v_' := z$$-z@; |
| 5347 |
l := (xpart v_')++(ypart v_'); % length of @--$$ |
| 5348 |
c_' := (smoothrad/l)[z@,z$$]; % end of arc on @--$$ |
| 5349 |
undraw c_--z@--c_'; % blank original join |
| 5350 |
draw c_{v_}..{v_'}c_'; % draw the arc |
| 5351 |
endgroup |
| 5352 |
enddef; |
| 5353 |
|
| 5354 |
% \end{macrocode} |
| 5355 |
% \end{routine} |
| 5356 |
% |
| 5357 |
% \begin{routine}{smoothtwo} |
| 5358 |
% Rounds the joins at |z@| and |z@@| between the three straight lines |
| 5359 |
% |z$--z@--z@@--z$$|. |
| 5360 |
% The radius of the circular arc is |smoothrad|. |
| 5361 |
% \changes{v1.3}{2000/05/22}{Added smoothtwo routine} |
| 5362 |
% \begin{macrocode} |
| 5363 |
%%% replaces the sharp corners on $--@--@@--$$ with a circular arc radius smoothrad |
| 5364 |
def smoothtwo(suffix $, @, @@, $$) = |
| 5365 |
smooth($, @, @@); smooth(@, @@, $$); |
| 5366 |
enddef; |
| 5367 |
|
| 5368 |
% \end{macrocode} |
| 5369 |
% \end{routine} |
| 5370 |
% |
| 5371 |
% \begin{routine}{smoothdash} |
| 5372 |
% Rounds the join at |z@| between the two dashed straight lines |z$--z@--z$$|. |
| 5373 |
% The radius of the circular arc is |smoothrad|. |
| 5374 |
% \changes{v1.3}{2000/05/22}{Added smoothdash routine} |
| 5375 |
% \begin{macrocode} |
| 5376 |
%%% replaces the sharp corner on the dashed lines $--@--$$ |
| 5377 |
%%% with a circular arc radius smoothrad |
| 5378 |
def smoothdash(suffix $, @, $$) = |
| 5379 |
begingroup |
| 5380 |
save v_, c_, l, p; |
| 5381 |
pair v_, v_', c_, c_'; |
| 5382 |
path p; |
| 5383 |
v_ := z@-z$; |
| 5384 |
l := (xpart v_)++(ypart v_); % length of $--@ |
| 5385 |
c_ := (smoothrad/l)[z@,z$]; % start of arc on $--@ |
| 5386 |
v_' := z$$-z@; |
| 5387 |
l := (xpart v_')++(ypart v_'); % length of @--$$ |
| 5388 |
c_' := (smoothrad/l)[z@,z$$]; % end of arc on @--$$ |
| 5389 |
undraw c_--z@--c_'; % blank original join |
| 5390 |
draw c_{v_}..{v_'}c_' dashes; % draw the dashed arc |
| 5391 |
endgroup |
| 5392 |
enddef; |
| 5393 |
|
| 5394 |
% \end{macrocode} |
| 5395 |
% \end{routine} |
| 5396 |
% |
| 5397 |
% \begin{routine}{smoothdots} |
| 5398 |
% Rounds the join at |z@| between the two dotted straight lines |z$--z@--z$$|. |
| 5399 |
% The radius of the circular arc is |smoothrad|. |
| 5400 |
% \changes{v1.3}{2000/05/22}{Added smoothdots routine} |
| 5401 |
% \begin{macrocode} |
| 5402 |
%%% replaces the sharp corner on the dotted line $--@--$$ |
| 5403 |
%%% with a circular arc radius smoothrad |
| 5404 |
def smoothdots(suffix $, @, $$) = |
| 5405 |
begingroup |
| 5406 |
save oldpen; |
| 5407 |
pen oldpen; oldpen := currentpen; |
| 5408 |
save v_, c_, l, p; |
| 5409 |
pair v_, v_', c_, c_'; |
| 5410 |
path p; |
| 5411 |
v_ := z@-z$; |
| 5412 |
l := (xpart v_)++(ypart v_); % length of $--@ |
| 5413 |
c_ := (smoothrad/l)[z@,z$]; % start of arc on $--@ |
| 5414 |
v_' := z$$-z@; |
| 5415 |
l := (xpart v_')++(ypart v_'); % length of @--$$ |
| 5416 |
c_' := (smoothrad/l)[z@,z$$]; % end of arc on @--$$ |
| 5417 |
undraw c_--z@--c_'; % blank original join |
| 5418 |
pickup dotspen; |
| 5419 |
draw c_{v_}..{v_'}c_' dots; % draw the dotted arc |
| 5420 |
pickup oldpen; |
| 5421 |
endgroup |
| 5422 |
enddef; |
| 5423 |
|
| 5424 |
% \end{macrocode} |
| 5425 |
% \end{routine} |
| 5426 |
% |
| 5427 |
% |
| 5428 |
% \subsection{Box drawing routines} |
| 5429 |
% |
| 5430 |
% The box drawing routines take as an argument the suffix (|$|) of the |
| 5431 |
% left-hand bottom corner point of the box, and normally the length and |
| 5432 |
% height of the box. There is normally also a text argument that gets |
| 5433 |
% typeset at the `center' of the box. The coordinates of the box corners |
| 5434 |
% are calculated (|z$bl|, |z$br|, |z$tr| and |z$tl|). The midpoints of |
| 5435 |
% the sides of the box (|z$bm|, |z$mr|, |z$tm|, |z$ml|) are calculated |
| 5436 |
% as well. The text `center' of the box is |z$c|, while the geometric |
| 5437 |
% center of the box will be at the intersection point of the lines |
| 5438 |
% |z$bm--z$tm| and |z$ml--z$mr|. See \fref{fig:boxpoints} for an |
| 5439 |
% illustration. |
| 5440 |
% |
| 5441 |
% |
| 5442 |
% \begin{routine}{drawSCHEMA} |
| 5443 |
% |drawSCHEMA(|\meta{suffix}, \meta{l}, \meta{h}|)(|\meta{name}|)| draws |
| 5444 |
% a SCHEMA box. |
| 5445 |
% \begin{macrocode} |
| 5446 |
%%% draws a schema box, bottom left at $, length l, height h |
| 5447 |
def drawSCHEMA(suffix $)(expr l, h)(text str) = |
| 5448 |
rectpoints($, l, h); |
| 5449 |
x$c = 1/2[x$ml, x$mr]; |
| 5450 |
y$c = 1/2[y$ml, y$tl]; |
| 5451 |
draw z$bl--z$br--z$tr--z$tl--cycle; % outer box |
| 5452 |
draw z$ml--z$mr; % dividing line |
| 5453 |
label(str, z$c); |
| 5454 |
enddef; |
| 5455 |
|
| 5456 |
% \end{macrocode} |
| 5457 |
% \end{routine} |
| 5458 |
% |
| 5459 |
% \begin{routine}{drawSDT} |
| 5460 |
% |drawSDT(|\meta{suffix}|)(|\meta{name}|)| draws |
| 5461 |
% a simple data type box of length |sdtbl| and height |sdtbh|. |
| 5462 |
% \begin{macrocode} |
| 5463 |
% drawSDT($)(name) |
| 5464 |
% draw a simple data type box, bottom left at $ |
| 5465 |
def drawSDT(suffix $)(text str) = |
| 5466 |
rectpoints($, sdtbl, sdtbh); |
| 5467 |
z$ti = (x$tr-sdtbs, y$tr); |
| 5468 |
z$bi = (x$ti, y$br); |
| 5469 |
z$c = 1/2[z$bl,z$ti]; |
| 5470 |
draw z$bl--z$br--z$tr--z$tl--cycle; |
| 5471 |
draw z$bi--z$ti; |
| 5472 |
label(str, z$c); |
| 5473 |
enddef; |
| 5474 |
|
| 5475 |
% \end{macrocode} |
| 5476 |
% \end{routine} |
| 5477 |
% |
| 5478 |
% \begin{routine}{drawASDT} |
| 5479 |
% |drawASDT(|\meta{suffix}, \meta{l}, \meta{h}|)(|\meta{name}|)| draws |
| 5480 |
% a simple data type box. |
| 5481 |
% \begin{macrocode} |
| 5482 |
% drawASDT($, l, h)(name) |
| 5483 |
% draw a simple data type box, bottom left at $, length l, height h |
| 5484 |
def drawASDT(suffix $)(expr l, h)(text str) = |
| 5485 |
rectpoints($, l, h); |
| 5486 |
z$ti = (x$tr-sdtbs, y$tr); |
| 5487 |
z$bi = (x$ti, y$br); |
| 5488 |
z$c = 1/2[z$bl,z$ti]; |
| 5489 |
draw z$bl--z$br--z$tr--z$tl--cycle; |
| 5490 |
draw z$bi--z$ti; |
| 5491 |
label(str, z$c); |
| 5492 |
enddef; |
| 5493 |
|
| 5494 |
% \end{macrocode} |
| 5495 |
% \end{routine} |
| 5496 |
% |
| 5497 |
% The |drawNAME(|\meta{suffix}|)| routines draw a simple data type |
| 5498 |
% box of the given name using the applicable lengths and heights. |
| 5499 |
% \begin{routine}{drawBINARY} |
| 5500 |
% \begin{routine}{drawBOOLEAN} |
| 5501 |
% \begin{routine}{drawCOMPLEX} |
| 5502 |
% \begin{routine}{drawEXPRESSION} |
| 5503 |
% \begin{macrocode} |
| 5504 |
def drawBINARY(suffix $) = drawASDT($)(sdtbl, sdtbh)("BINARY"); |
| 5505 |
enddef; |
| 5506 |
def drawBOOLEAN(suffix $) = drawASDT($)(sdtbl, sdtbh)("BOOLEAN"); |
| 5507 |
enddef; |
| 5508 |
def drawCOMPLEX(suffix $) = drawASDT($)(sdtbl, sdtbh)("COMPLEX"); |
| 5509 |
enddef; |
| 5510 |
def drawEXPRESSION(suffix $) = drawASDT($)(sdtbel, sdtbeh)("EXPRESSION"); |
| 5511 |
enddef; |
| 5512 |
% \end{macrocode} |
| 5513 |
% \end{routine} |
| 5514 |
% \end{routine} |
| 5515 |
% \end{routine} |
| 5516 |
% \end{routine} |
| 5517 |
% |
| 5518 |
% \begin{routine}{drawGENERIC} |
| 5519 |
% \begin{routine}{drawINTEGER} |
| 5520 |
% \begin{routine}{drawLOGICAL} |
| 5521 |
% \begin{routine}{drawNUMBER} |
| 5522 |
% \begin{macrocode} |
| 5523 |
def drawGENERIC(suffix $) = drawASDT($)(sdtbl, sdtbh)("GENERIC"); |
| 5524 |
enddef; |
| 5525 |
def drawINTEGER(suffix $) = drawASDT($)(sdtbl, sdtbh)("INTEGER"); |
| 5526 |
enddef; |
| 5527 |
def drawLOGICAL(suffix $) = drawASDT($)(sdtbl, sdtbh)("LOGICAL"); |
| 5528 |
enddef; |
| 5529 |
def drawNUMBER(suffix $) = drawASDT($)(sdtbl, sdtbh)("NUMBER"); |
| 5530 |
enddef; |
| 5531 |
% \end{macrocode} |
| 5532 |
% \end{routine} |
| 5533 |
% \end{routine} |
| 5534 |
% \end{routine} |
| 5535 |
% \end{routine} |
| 5536 |
% |
| 5537 |
% \begin{routine}{drawREAL} |
| 5538 |
% \begin{routine}{drawSTRING} |
| 5539 |
% \begin{macrocode} |
| 5540 |
def drawREAL(suffix $) = drawASDT($)(sdtbl, sdtbh)("REAL"); |
| 5541 |
enddef; |
| 5542 |
def drawSTRING(suffix $) = drawASDT($)(sdtbl, sdtbh)("STRING"); |
| 5543 |
enddef; |
| 5544 |
|
| 5545 |
% \end{macrocode} |
| 5546 |
% \end{routine} |
| 5547 |
% \end{routine} |
| 5548 |
% |
| 5549 |
% \begin{routine}{drawENUM} |
| 5550 |
% |drawENUM(|\meta{suffix}, \meta{l}, \meta{h}|)(|\meta{name}|)| draws |
| 5551 |
% an ENUMERATION type box. |
| 5552 |
% \begin{macrocode} |
| 5553 |
% drawENUM($, l, h)(name) |
| 5554 |
%%% draw an enumeration type box, bottom left at $, length l, height h |
| 5555 |
def drawENUM(suffix $)(expr l, h)(text str) = |
| 5556 |
rectpoints($, l, h); |
| 5557 |
z$ti = (x$tr-sdtbs, y$tr); |
| 5558 |
z$bi = (x$ti, y$br); |
| 5559 |
z$c = 1/2[z$bl,z$ti]; |
| 5560 |
draw z$bl--z$br--z$tr--z$tl--cycle dashes; |
| 5561 |
draw z$bi--z$ti dashes; |
| 5562 |
label(str, z$c); |
| 5563 |
enddef; |
| 5564 |
|
| 5565 |
% \end{macrocode} |
| 5566 |
% \end{routine} |
| 5567 |
% |
| 5568 |
% \begin{routine}{drawSELECT} |
| 5569 |
% |drawSELECT(|\meta{suffix}, \meta{l}, \meta{h}|)(|\meta{name}|)| draws |
| 5570 |
% a SELECT type box. |
| 5571 |
% \begin{macrocode} |
| 5572 |
% drawSELECT($, l, h)(name) |
| 5573 |
%%% draw a select type box, bottom left at $, length l, height h |
| 5574 |
def drawSELECT(suffix $)(expr l, h)(text str) = |
| 5575 |
rectpoints($, l, h); |
| 5576 |
z$ti = (x$tl+sdtbs, y$tl); |
| 5577 |
z$bi = (x$ti, y$bl); |
| 5578 |
z$c = 1/2[z$br,z$ti]; |
| 5579 |
draw z$bl--z$br--z$tr--z$tl--cycle dashes; |
| 5580 |
draw z$bi--z$ti dashes; |
| 5581 |
label(str, z$c); |
| 5582 |
enddef; |
| 5583 |
|
| 5584 |
% \end{macrocode} |
| 5585 |
% \end{routine} |
| 5586 |
% |
| 5587 |
% \begin{routine}{drawTYPE} |
| 5588 |
% |drawTYPE(|\meta{suffix}, \meta{l}, \meta{h}|)(|\meta{name}|)| draws |
| 5589 |
% a user-defined TYPE type box. |
| 5590 |
% \begin{macrocode} |
| 5591 |
% drawTYPE($, l, h)(name) |
| 5592 |
%%% draw a simple user defined TYPE box, bottom left at $, length l, height h |
| 5593 |
def drawTYPE(suffix $)(expr l, h)(text str) = |
| 5594 |
rectpoints($, l, h); |
| 5595 |
z$c = 1/2[z$bl,z$tr]; |
| 5596 |
draw z$bl--z$br--z$tr--z$tl--cycle dashes; |
| 5597 |
label(str, z$c); |
| 5598 |
enddef; |
| 5599 |
|
| 5600 |
% \end{macrocode} |
| 5601 |
% \end{routine} |
| 5602 |
% |
| 5603 |
% \begin{routine}{drawENT} |
| 5604 |
% |drawENT(|\meta{suffix}, \meta{l}, \meta{h}|)(|\meta{name}|)| draws |
| 5605 |
% an ENTITY box. |
| 5606 |
% \begin{macrocode} |
| 5607 |
% drawENT($, l, h)(name) |
| 5608 |
%%% draw an entity box, bottom left at $, length l, height h |
| 5609 |
def drawENT(suffix $)(expr l, h)(text str) = |
| 5610 |
rectpoints($, l, h); |
| 5611 |
z$c = 1/2[z$bl,z$tr]; |
| 5612 |
draw z$bl--z$br--z$tr--z$tl--cycle; |
| 5613 |
label(str, z$c); |
| 5614 |
enddef; |
| 5615 |
|
| 5616 |
% \end{macrocode} |
| 5617 |
% \end{routine} |
| 5618 |
% |
| 5619 |
% \begin{routine}{drawOB} |
| 5620 |
% |drawOB(|\meta{suffix}, \meta{l}, \meta{h}|)| draws |
| 5621 |
% a rectangular box with rounded corners (an \ExpressG{} oval box). |
| 5622 |
% \begin{macrocode} |
| 5623 |
% drawOB($, l, h) |
| 5624 |
% draw an oval box, bottom left at $, length l, height h |
| 5625 |
def drawOB(suffix $)(expr l, h) = |
| 5626 |
save rad; |
| 5627 |
numeric rad; rad := h/2; |
| 5628 |
rectpoints($, l, h); |
| 5629 |
z$cl = 1/2[z$bl, z$tl]; |
| 5630 |
z$cr = 1/2[z$br, z$tr]; |
| 5631 |
z$bli = (x$bl+rad, y$bl); |
| 5632 |
z$tli = (x$bli, y$tl); |
| 5633 |
z$bri = (x$br-rad, y$br); |
| 5634 |
z$tri = (x$bri, y$tr); |
| 5635 |
z$c = 1/2[z$bl,z$tr]; |
| 5636 |
draw z$bli--z$bri..z$cr..z$tri--z$tli..z$cl..cycle; |
| 5637 |
enddef; |
| 5638 |
|
| 5639 |
% \end{macrocode} |
| 5640 |
% \end{routine} |
| 5641 |
% |
| 5642 |
% \begin{routine}{drawPREF} |
| 5643 |
% |drawPREF(|\meta{suffix}, \meta{l}, \meta{h}|)(|\meta{name}|)| draws |
| 5644 |
% a page reference oval box. |
| 5645 |
% \begin{macrocode} |
| 5646 |
% drawPREF($, l, h)(name) |
| 5647 |
%%% draw a page reference box oval, bottom left at $, length l, height h |
| 5648 |
def drawPREF(suffix $)(expr l, h)(text str) = |
| 5649 |
drawOB($, l, h); |
| 5650 |
label(str, z$c); |
| 5651 |
enddef; |
| 5652 |
|
| 5653 |
% \end{macrocode} |
| 5654 |
% \end{routine} |
| 5655 |
% |
| 5656 |
% |
| 5657 |
% \begin{routine}{drawISU} |
| 5658 |
% |drawISU(|\meta{suffix}, \meta{l}, \meta{h}|)(|\meta{name}|)| draws |
| 5659 |
% an interschema USE box. |
| 5660 |
% \begin{macrocode} |
| 5661 |
% drawISU($, l, h)(name) |
| 5662 |
%%% draw an interschema USE box, bottom left at $, length l, height h |
| 5663 |
def drawISU(suffix $)(expr l, h)(text str) = |
| 5664 |
save quarter; |
| 5665 |
numeric quarter; quarter := h/4; |
| 5666 |
rectpoints($, l, h); |
| 5667 |
z$o = (x$, y$+quarter); |
| 5668 |
drawOB($o, l, 2quarter); |
| 5669 |
z$c = 1/2[z$bl,z$tr]; |
| 5670 |
label(str, z$c); |
| 5671 |
draw z$bl--z$br--z$tr--z$tl--cycle; |
| 5672 |
enddef; |
| 5673 |
|
| 5674 |
% \end{macrocode} |
| 5675 |
% \end{routine} |
| 5676 |
% |
| 5677 |
% \begin{routine}{drawISUR} |
| 5678 |
% |drawISUR(|\meta{suffix}, \meta{l}, \meta{h}|)(|\meta{name}|)(|\meta{rename}|)| draws |
| 5679 |
% an interschema USE RENAME box. |
| 5680 |
% \changes{v1.5}{2003/07/31}{Changed rnm to rname in drawISUR} |
| 5681 |
% \begin{macrocode} |
| 5682 |
% drawISUR($, l, h)(name)(rename) |
| 5683 |
%%% draw an interschema USE RENAME box, bottom left at $, length l, height h |
| 5684 |
def drawISUR(suffix $)(expr l, h)(text str, rname) = |
| 5685 |
save third; |
| 5686 |
numeric third; third := h/3; |
| 5687 |
rectpoints($, l, h); |
| 5688 |
z$o = (x$, y$+third); |
| 5689 |
drawOB($o, l, third); |
| 5690 |
z$c = 1/2[z$bl, z$tr]; |
| 5691 |
label(str, z$c); |
| 5692 |
z$rnm = 1/2[z$bl,(x$br,y$br+third)]; |
| 5693 |
draw z$bl--z$br--z$tr--z$tl--cycle; |
| 5694 |
label(rname, z$rnm); |
| 5695 |
enddef; |
| 5696 |
|
| 5697 |
% \end{macrocode} |
| 5698 |
% \end{routine} |
| 5699 |
% |
| 5700 |
% \begin{routine}{drawISR} |
| 5701 |
% |drawISR(|\meta{suffix}, \meta{l}, \meta{h}|)(|\meta{name}|)| draws |
| 5702 |
% an interschema RERERENCE box. |
| 5703 |
% \begin{macrocode} |
| 5704 |
% drawISR($, l, h)(name) |
| 5705 |
%%% draw an interschema REFERENCE box, bottom left at $, length l, height h |
| 5706 |
def drawISR(suffix $)(expr l, h)(text str) = |
| 5707 |
save quarter; |
| 5708 |
numeric quarter; quarter := h/4; |
| 5709 |
rectpoints($, l, h); |
| 5710 |
z$o = (x$, y$+quarter); |
| 5711 |
drawOB($o, l, 2quarter); |
| 5712 |
z$c = 1/2[z$bl,z$tr]; |
| 5713 |
label(str, z$c); |
| 5714 |
draw z$bl--z$br--z$tr--z$tl--cycle dashes; |
| 5715 |
enddef; |
| 5716 |
|
| 5717 |
% \end{macrocode} |
| 5718 |
% \end{routine} |
| 5719 |
% |
| 5720 |
% \begin{routine}{drawISRR} |
| 5721 |
% |drawISRR(|\meta{suffix}, \meta{l}, \meta{h}|)(|\meta{name}|)(|\meta{rename}|)| draws |
| 5722 |
% an interschema REFERENCE RENAME box. |
| 5723 |
% \changes{v1.5}{2003/07/31}{Changed rnm to rname in drawISSR} |
| 5724 |
% \begin{macrocode} |
| 5725 |
% drawISRR($, l, h)(name)(rename) |
| 5726 |
%%% draw an interschema REFERENCE RENAME box, bottom left at $, length l, height h |
| 5727 |
def drawISRR(suffix $)(expr l, h)(text str, rname) = |
| 5728 |
save third; |
| 5729 |
numeric third; third := h/3; |
| 5730 |
rectpoints($, l, h); |
| 5731 |
z$o = (x$, y$+third); |
| 5732 |
drawOB($o, l, third); |
| 5733 |
z$c = 1/2[z$bl,z$tr]; |
| 5734 |
label(str, z$c); |
| 5735 |
z$rnm = 1/2[z$bl,(x$br,y$br+third)]; |
| 5736 |
draw z$bl--z$br--z$tr--z$tl--cycle dashes; |
| 5737 |
label(rname, z$rnm); |
| 5738 |
enddef; |
| 5739 |
|
| 5740 |
% \end{macrocode} |
| 5741 |
% \end{routine} |
| 5742 |
% |
| 5743 |
% |
| 5744 |
% \begin{routine}{drawLEVENT} |
| 5745 |
% |drawLEVENT(|\meta{suffix}, \meta{l}, \meta{h}|)(|\meta{name}|)| draws |
| 5746 |
% a Local EVENT box, with side slope |eventslope|. |
| 5747 |
% \begin{macrocode} |
| 5748 |
% drawLEVENT($, l, h)(name) |
| 5749 |
%%% draw a Local EVENT box, bottom left at $, length l, height h |
| 5750 |
def drawLEVENT(suffix $)(expr l, h)(text str) = |
| 5751 |
rhompoints($, l, h, eventslope); |
| 5752 |
z$c = 1/2[z$ml,z$mr]; |
| 5753 |
draw z$bl--z$br--z$tr--z$tl--cycle; |
| 5754 |
label(str, z$c); |
| 5755 |
enddef; |
| 5756 |
|
| 5757 |
% \end{macrocode} |
| 5758 |
% \end{routine} |
| 5759 |
% |
| 5760 |
% \begin{routine}{drawGEVENT} |
| 5761 |
% |drawGEVENT(|\meta{suffix}, \meta{l}, \meta{h}|)(|\meta{name}|)| draws |
| 5762 |
% a Global EVENT box, with side slope |eventslope|. |
| 5763 |
% \begin{macrocode} |
| 5764 |
% drawGEVENT($, l, h)(name) |
| 5765 |
%%% draw a Global EVENT box, bottom left at $, length l, height h |
| 5766 |
def drawGEVENT(suffix $)(expr l, h)(text str) = |
| 5767 |
rhompoints($, l, h, eventslope); |
| 5768 |
z$c = 1/2[z$ml,z$mr]; |
| 5769 |
pickup thickpen; |
| 5770 |
draw z$bl--z$br--z$tr--z$tl--cycle; |
| 5771 |
pickup normalpen; |
| 5772 |
label(str, z$c); |
| 5773 |
enddef; |
| 5774 |
|
| 5775 |
% \end{macrocode} |
| 5776 |
% \end{routine} |
| 5777 |
% |
| 5778 |
% |
| 5779 |
% |
| 5780 |
% \begin{routine}{drawcirclebox} |
| 5781 |
% |drawcirclebox(|\meta{suffix}, \meta{diam}|)(|\meta{name}|)| draws |
| 5782 |
% a circle, center |zsuffix| and diameter \meta{diam}, around \meta{name}. |
| 5783 |
% \begin{macrocode} |
| 5784 |
% drawcirclebox($, diam)(name) |
| 5785 |
%%% draw a circled name, diameter diam centered at $ |
| 5786 |
def drawcirclebox(suffix $)(expr diam)(text str) = |
| 5787 |
circpoints($, diam); |
| 5788 |
draw z$bl..z$bm..z$br..z$mr..z$tr..z$tm..z$tl..z$ml..cycle; |
| 5789 |
label(str, z$c); |
| 5790 |
enddef; |
| 5791 |
|
| 5792 |
% \end{macrocode} |
| 5793 |
% \end{routine} |
| 5794 |
% |
| 5795 |
% \subsection{Extra BLA variables and routines} |
| 5796 |
% |
| 5797 |
% Some extra facilities are provided for assistance in drawing |
| 5798 |
% non-\ExpressG{} BLA diagrams, such as flow charts, IDEF diagrams |
| 5799 |
% or UML structure diagrams. |
| 5800 |
% |
| 5801 |
% \begin{variable}{gdl} |
| 5802 |
% \begin{variable}{gdb} |
| 5803 |
% |gdl| is the length of a diamond line end style and |gdb| is the base |
| 5804 |
% width. |
| 5805 |
% \begin{macrocode} |
| 5806 |
%%% length and base width of diamond line end styles |
| 5807 |
newinternal gdl, gdb; |
| 5808 |
numeric gdl, gdb; |
| 5809 |
gdl := 2defaultgal; |
| 5810 |
gdb := 0.75defaultgab; |
| 5811 |
|
| 5812 |
% \end{macrocode} |
| 5813 |
% \end{variable} |
| 5814 |
% \end{variable} |
| 5815 |
% |
| 5816 |
% \begin{routine}{ellipsepoints} |
| 5817 |
% \changes{v1.2}{1999/11/15}{Added ellipsepoints routine} |
| 5818 |
% Calculates the points on an ellipse, center at |z$| with horizontal |
| 5819 |
% diameter |l| and vertical diameter |h|. It does \emph{not} calculate |
| 5820 |
% the center point. |
| 5821 |
% \begin{macrocode} |
| 5822 |
def ellipsepoints(suffix $)(expr l, h) = |
| 5823 |
save epp, move; |
| 5824 |
path epp; |
| 5825 |
pair move; |
| 5826 |
z$ml=(x$-l/2, y$); z$mr=(x$ml+l,y$); |
| 5827 |
z$tm=(x$, y$+h/2); z$bm=(x$, y$tm-h); |
| 5828 |
move = 1/2[z$ml,z$mr]; |
| 5829 |
epp = fullcircle scaled h xscaled (l/h) shifted move; |
| 5830 |
z$tr = point 1.2 of epp; |
| 5831 |
z$tl = point 2.8 of epp; |
| 5832 |
z$bl = point 5.2 of epp; |
| 5833 |
z$br = point 6.8 of epp; |
| 5834 |
enddef; |
| 5835 |
|
| 5836 |
% \end{macrocode} |
| 5837 |
% \end{routine} |
| 5838 |
% |
| 5839 |
% \begin{routine}{drawDCA} |
| 5840 |
% Draw double closed arrowheads, each length |gal| and base |
| 5841 |
% width |gab|, at end of vector from |z$| to |z$$|. |
| 5842 |
% \changes{v1.4}{2000/07/10}{Added drawDCA} |
| 5843 |
% \begin{macrocode} |
| 5844 |
%%% draws double closed arrowheads at end of vector from $ to $$ |
| 5845 |
def drawDCA(suffix $, $$) = |
| 5846 |
begingroup |
| 5847 |
save v_, c_, v_u, c_t, c_b, l, hb, p; |
| 5848 |
pair v_, c_, v_u, c_t, c_b; |
| 5849 |
path p[]; |
| 5850 |
numeric l, hb; |
| 5851 |
hb := gab/2; |
| 5852 |
v_ := z$-z$$; |
| 5853 |
l := (xpart v_)++(ypart v_); % length of the line |
| 5854 |
c_ := (gal/(l))[z$$,z$]; % base of arrowhead |
| 5855 |
v_u := unitvector v_; |
| 5856 |
c_t := c_ shifted (-hb*(ypart v_u), hb*(xpart v_u)); |
| 5857 |
c_b - c_ = c_ - c_t; |
| 5858 |
p1 := c_b--z$$--c_t--cycle; |
| 5859 |
filldraw p1; |
| 5860 |
p2 := p1 shifted ((xpart c_ - x$$), (ypart c_ - y$$)); |
| 5861 |
filldraw p2; |
| 5862 |
endgroup |
| 5863 |
enddef; |
| 5864 |
|
| 5865 |
% \end{macrocode} |
| 5866 |
% \end{routine} |
| 5867 |
% |
| 5868 |
% \begin{routine}{drawOD} |
| 5869 |
% Draw an open diamond, length |gdl| and base width |gdb|, |
| 5870 |
% at end of vector from |z$| to |z$$|. |
| 5871 |
% \begin{macrocode} |
| 5872 |
%%% draws an open diamond at end of vector from $ to $$ |
| 5873 |
def drawOD(suffix $, $$) = |
| 5874 |
begingroup |
| 5875 |
save v_, c_, c__, v_u, c_t, c_b, l, hb, p; |
| 5876 |
pair v_, c_, c__, v_u, c_t, c_b; |
| 5877 |
numeric l, hb; |
| 5878 |
path p; |
| 5879 |
hb := gdb/2; |
| 5880 |
v_ := z$-z$$; |
| 5881 |
l := (xpart v_)++(ypart v_); % length of the line |
| 5882 |
c_ := (gdl/(2l))[z$$,z$]; % base of diamond |
| 5883 |
c__ := (gdl/(l))[z$$,z$]; % interior tip of diamond |
| 5884 |
v_u := unitvector v_; |
| 5885 |
c_t := c_ shifted (-hb*(ypart v_u), hb*(xpart v_u)); |
| 5886 |
c_b - c_ = c_ - c_t; |
| 5887 |
p = c_b--z$$--c_t--c__--cycle; |
| 5888 |
unfill p; |
| 5889 |
draw p; draw p; |
| 5890 |
endgroup |
| 5891 |
enddef; |
| 5892 |
|
| 5893 |
% \end{macrocode} |
| 5894 |
% \end{routine} |
| 5895 |
% |
| 5896 |
% \begin{routine}{drawCD} |
| 5897 |
% Draw a closed diamond, length |gdl| and base width |gdb|, |
| 5898 |
% at end of vector from |z$| to |z$$|. |
| 5899 |
% \begin{macrocode} |
| 5900 |
%%% draws a closed diamond at end of vector from $ to $$ |
| 5901 |
def drawCD(suffix $, $$) = |
| 5902 |
begingroup |
| 5903 |
save v_, c_, c__, v_u, c_t, c_b, l, hb, p; |
| 5904 |
pair v_, c_, c__, v_u, c_t, c_b; |
| 5905 |
numeric l, hb; |
| 5906 |
path p; |
| 5907 |
hb := gdb/2; |
| 5908 |
v_ := z$-z$$; |
| 5909 |
l := (xpart v_)++(ypart v_); % length of the line |
| 5910 |
c_ := (gdl/(2l))[z$$,z$]; % base of diamond |
| 5911 |
c__ := (gdl/(l))[z$$,z$]; % interior tip of diamond |
| 5912 |
v_u := unitvector v_; |
| 5913 |
c_t := c_ shifted (-hb*(ypart v_u), hb*(xpart v_u)); |
| 5914 |
c_b - c_ = c_ - c_t; |
| 5915 |
p = c_b--z$$--c_t--c__--cycle; |
| 5916 |
filldraw p; |
| 5917 |
endgroup |
| 5918 |
enddef; |
| 5919 |
|
| 5920 |
% \end{macrocode} |
| 5921 |
% \end{routine} |
| 5922 |
% |
| 5923 |
% |
| 5924 |
% \begin{routine}{drawdashA} |
| 5925 |
% Draw a straight dashed line between the two points |z$| and |z$$|, |
| 5926 |
% ending with an arrowhead, length |gal| and base width |gab|, |
| 5927 |
% at |z$$|. |
| 5928 |
% \begin{macrocode} |
| 5929 |
%%% draws a dashed line from $ to $$, ending with an arrowhead at $$ |
| 5930 |
def drawdashA(suffix $, $$) = |
| 5931 |
draw z$--z$$ dashes; |
| 5932 |
drawA($, $$); |
| 5933 |
enddef; |
| 5934 |
|
| 5935 |
% \end{macrocode} |
| 5936 |
% \end{routine} |
| 5937 |
% |
| 5938 |
% \begin{routine}{drawdashOA} |
| 5939 |
% Draw a straight dashed line between the two points |z$| and |z$$|, |
| 5940 |
% ending with an open arrowhead, length |gal| and base width |gab|, |
| 5941 |
% at |z$$|. |
| 5942 |
% \begin{macrocode} |
| 5943 |
%%% draws a dashed line from $ to $$, ending with an open arrowhead at $$ |
| 5944 |
def drawdashOA(suffix $, $$) = |
| 5945 |
draw z$--z$$ dashes; |
| 5946 |
drawOA($, $$); |
| 5947 |
enddef; |
| 5948 |
|
| 5949 |
% \end{macrocode} |
| 5950 |
% \end{routine} |
| 5951 |
% |
| 5952 |
% \begin{routine}{drawnormalDCA} |
| 5953 |
% Draw a straight normal line between the two points |z$| and |z$$|, |
| 5954 |
% ending with double closed arrowheads, each length |gal| and base |
| 5955 |
% width |gab|, at |z$$|. |
| 5956 |
% \changes{v1.2}{1999/11/15}{Added drawnormalDCA} |
| 5957 |
% \begin{macrocode} |
| 5958 |
%%% draws a normal line from $ to $$, ending with double closed arrowheads at $$ |
| 5959 |
def drawnormalDCA(suffix $, $$) = |
| 5960 |
draw z$--z$$; |
| 5961 |
drawDCA($, $$); |
| 5962 |
enddef; |
| 5963 |
|
| 5964 |
% \end{macrocode} |
| 5965 |
% \end{routine} |
| 5966 |
% |
| 5967 |
% \begin{routine}{drawnormalOD} |
| 5968 |
% Draw a straight normal thickness line between the two points |z$| and |z$$|, |
| 5969 |
% ending with an open diamond, length |gdl| and base width |gdb|, |
| 5970 |
% at |z$$|. |
| 5971 |
% \begin{macrocode} |
| 5972 |
%%% draws a normal line from $ to $$, ending with an open diamond at $$ |
| 5973 |
def drawnormalOD(suffix $, $$) = |
| 5974 |
draw z$--z$$; |
| 5975 |
drawOD($, $$); |
| 5976 |
enddef; |
| 5977 |
|
| 5978 |
% \end{macrocode} |
| 5979 |
% \end{routine} |
| 5980 |
% |
| 5981 |
% \begin{routine}{drawnormalCD} |
| 5982 |
% Draw a straight normal thickness line between the two points |z$| and |z$$|, |
| 5983 |
% ending with a closed diamond, length |gdl| and base width |gdb|, |
| 5984 |
% at |z$$|. |
| 5985 |
% \begin{macrocode} |
| 5986 |
%%% draws a normal line from $ to $$, ending with a closed diamond at $$ |
| 5987 |
def drawnormalCD(suffix $, $$) = |
| 5988 |
draw z$--z$$; |
| 5989 |
drawCD($, $$); |
| 5990 |
enddef; |
| 5991 |
|
| 5992 |
% \end{macrocode} |
| 5993 |
% \end{routine} |
| 5994 |
% |
| 5995 |
% \begin{routine}{drawdashcircle} |
| 5996 |
% \changes{v1.2}{1999/11/15}{Added drawdashcircle} |
| 5997 |
% Draw a normal thickness dashed open circle, center |z$|, diameter |diam|. |
| 5998 |
% \begin{macrocode} |
| 5999 |
%%% draws an open dashed circle, center z$, diameter diam |
| 6000 |
def drawdashcircle(suffix $)(expr diam) = |
| 6001 |
circpoints($, diam); |
| 6002 |
draw z$bl..z$bm..z$br..z$mr..z$tr..z$tm..z$tl..z$ml..cycle dashes; |
| 6003 |
enddef; |
| 6004 |
|
| 6005 |
% \end{macrocode} |
| 6006 |
% \end{routine} |
| 6007 |
% |
| 6008 |
% \begin{routine}{drawcircleA} |
| 6009 |
% \changes{v1.1}{1999/10/30}{Added drawcircleA routine} |
| 6010 |
% Draw a normal thickness open circle, center |z$|, diameter |diam|, and with |
| 6011 |
% a counterclockwise pointing arrow at the topmost point. The arrow has |
| 6012 |
% length |gal| and base width |gab|. |
| 6013 |
% \begin{macrocode} |
| 6014 |
%%% draws an open circle, center z$, diameter diam, with an arrow at the top |
| 6015 |
def drawcircleA(suffix $)(expr diam) = |
| 6016 |
circpoints($, diam); |
| 6017 |
begingroup |
| 6018 |
save c_, c_t, c_b, hb; |
| 6019 |
pair c_, c_t, c_b; |
| 6020 |
numeric hb; |
| 6021 |
hb := gab/2; |
| 6022 |
c_ := z$tm shifted (gal*right); % base of arrowhead |
| 6023 |
c_t := c_ shifted (hb*up); |
| 6024 |
c_b := c_ shifted (hb*down); |
| 6025 |
draw z$bl..z$bm..z$br..z$mr..z$tr..z$tm..z$tl..z$ml..cycle; |
| 6026 |
draw c_t--z$tm--c_b; |
| 6027 |
endgroup |
| 6028 |
enddef; |
| 6029 |
|
| 6030 |
% \end{macrocode} |
| 6031 |
% \end{routine} |
| 6032 |
% |
| 6033 |
% \begin{routine}{drawDot} |
| 6034 |
% Draw a black dot, center |z$|, diameter |diam|. |
| 6035 |
% \changes{v1.6}{2004/02/29}{Added drawDot} |
| 6036 |
% \begin{macrocode} |
| 6037 |
%%% draws black dot, center z$, diameter diam |
| 6038 |
def drawDot(suffix $)(expr diam) = |
| 6039 |
begingroup |
| 6040 |
save p; |
| 6041 |
path p; |
| 6042 |
p := fullcircle scaled diam shifted z$; |
| 6043 |
filldraw p; |
| 6044 |
endgroup |
| 6045 |
enddef; |
| 6046 |
|
| 6047 |
% \nd{macrocode} |
| 6048 |
% \end{routine} |
| 6049 |
% |
| 6050 |
% \begin{routine}{drawCircledDot} |
| 6051 |
% Draw a black dot, center |z$|, surrounded by a circle, overall |
| 6052 |
% diameter |diam|. |
| 6053 |
% \changes{v1.6}{2004/02/29}{Added drawCircledDot} |
| 6054 |
% \begin{macrocode} |
| 6055 |
%%% draws black dot surrounded by a circle, center z$, diameter diam |
| 6056 |
def drawCircledDot(suffix $)(expr diam) = |
| 6057 |
begingroup |
| 6058 |
save l_, p; |
| 6059 |
numeric l_; |
| 6060 |
path p[]; |
| 6061 |
l_ := 5/7diam; |
| 6062 |
p1 := fullcircle scaled diam shifted z$; |
| 6063 |
unfill p1; |
| 6064 |
draw p1; |
| 6065 |
p2 := fullcircle scaled l_ shifted z$; |
| 6066 |
filldraw p2; |
| 6067 |
endgroup |
| 6068 |
enddef; |
| 6069 |
|
| 6070 |
% \nd{macrocode} |
| 6071 |
% \end{routine} |
| 6072 |
% |
| 6073 |
% |
| 6074 |
% \begin{routine}{drawcardbox} |
| 6075 |
% \changes{v1.1}{1999/10/30}{Added drawcardbox routine} |
| 6076 |
% Draw a rectangular box that has its top righthand corner folded down. |
| 6077 |
% |m| is the height/length of the fold. |
| 6078 |
% \begin{macrocode} |
| 6079 |
def drawcardbox(suffix $)(expr l, h, m)(text str) = |
| 6080 |
rectpoints($, l, h); |
| 6081 |
begingroup |
| 6082 |
save c; |
| 6083 |
pair c[]; |
| 6084 |
c1 = (x$tr-m, y$tr); |
| 6085 |
c3 = (x$tr, y$tr-m); |
| 6086 |
c2 = (xpart c1, ypart c3); |
| 6087 |
draw z$bl--z$br--c3--c1--z$tl--cycle; |
| 6088 |
draw c1--c2--c3; |
| 6089 |
endgroup; |
| 6090 |
z$c = 1/2[z$ml,z$mr]; |
| 6091 |
label(str, z$c); |
| 6092 |
enddef; |
| 6093 |
|
| 6094 |
% \end{macrocode} |
| 6095 |
% \end{routine} |
| 6096 |
% |
| 6097 |
% \begin{routine}{drawdiamondbox} |
| 6098 |
% Draw a diamond shaped box. Like circles, the box is located at its |
| 6099 |
% center point and |
| 6100 |
% not at the bottom left corner (see \fref{fig:diamondpoints}). |
| 6101 |
% |
| 6102 |
% \begin{macrocode} |
| 6103 |
def drawdiamondbox(suffix $)(expr l, h)(text str) = |
| 6104 |
z$ml=(x$-l/2, y$); z$tm=(x$, y$+h/2); |
| 6105 |
z$mr=(x$ml+l, y$); z$bm=(x$, y$tm-h); |
| 6106 |
z$bl=1/2[z$ml,z$bm]; |
| 6107 |
z$br=1/2[z$bm,z$mr]; |
| 6108 |
z$tr=1/2[z$mr,z$tm]; |
| 6109 |
z$tl=1/2[z$tm,z$ml]; |
| 6110 |
z$c=z$; |
| 6111 |
draw z$ml--z$bm--z$mr--z$tm--cycle; |
| 6112 |
label(str, z$c); |
| 6113 |
enddef; |
| 6114 |
|
| 6115 |
% \end{macrocode} |
| 6116 |
% \end{routine} |
| 6117 |
% |
| 6118 |
% \begin{routine}{drawtwodiamondbox} |
| 6119 |
% \changes{v1.2}{1999/11/15}{Added drawtwodiamondbox routine} |
| 6120 |
% Draw a diamond shaped box with a smaller diamond inside. |
| 6121 |
% |
| 6122 |
% \begin{macrocode} |
| 6123 |
def drawtwodiamondbox(suffix $)(expr l, h, mrg)(text str) = |
| 6124 |
z$ml=(x$-l/2, y$); z$tm=(x$, y$+h/2); |
| 6125 |
z$mr=(x$ml+l, y$); z$bm=(x$, y$tm-h); |
| 6126 |
z$bl=1/2[z$ml,z$bm]; |
| 6127 |
z$br=1/2[z$bm,z$mr]; |
| 6128 |
z$tr=1/2[z$mr,z$tm]; |
| 6129 |
z$tl=1/2[z$tm,z$ml]; |
| 6130 |
z$c=z$; |
| 6131 |
begingroup |
| 6132 |
save v_, p, tl, sf; |
| 6133 |
pair v_; |
| 6134 |
numeric tl, sf; |
| 6135 |
path p[]; |
| 6136 |
p1 = z$ml--z$bm--z$mr--z$tm--cycle; |
| 6137 |
draw p1; |
| 6138 |
v_ := z$c-z$tr; |
| 6139 |
tl := (xpart v_)++(ypart v_); |
| 6140 |
sf = 1.0 - mrg/tl; |
| 6141 |
p2 = p1 shifted -z$c scaled sf shifted z$c; |
| 6142 |
draw p2; |
| 6143 |
endgroup; |
| 6144 |
label(str, z$c); |
| 6145 |
|
| 6146 |
enddef; |
| 6147 |
|
| 6148 |
% \end{macrocode} |
| 6149 |
% \end{routine} |
| 6150 |
% |
| 6151 |
% \begin{routine}{drawdoublerectangle} |
| 6152 |
% Draw a double box where |tf| is the fraction of the height of the |
| 6153 |
% top portion. The ends of the dividing line are |z$tfl| and |z$tfr|. |
| 6154 |
% The text centers are |z$ct| and |z$cb| for the top and bottom portions. |
| 6155 |
% \begin{macrocode} |
| 6156 |
def drawdoublerectangle(suffix $)(expr l, h, tf) = |
| 6157 |
rectpoints($, l, h); |
| 6158 |
z$tfl=tf[z$tl,z$bl]; z$tfr=tf[z$tr,z$br]; |
| 6159 |
z$cb=1/2[z$bl,z$tfr]; |
| 6160 |
z$ct=1/2[z$tfl,z$tr]; |
| 6161 |
draw z$bl--z$br--z$tr--z$tl--cycle; |
| 6162 |
draw z$tfl--z$tfr; |
| 6163 |
enddef; |
| 6164 |
|
| 6165 |
% \end{macrocode} |
| 6166 |
% \end{routine} |
| 6167 |
% |
| 6168 |
% |
| 6169 |
% |
| 6170 |
% \begin{routine}{drawtriplerectangle} |
| 6171 |
% \changes{v1.1}{1999/10/30}{Added drawtriplerectangle routine} |
| 6172 |
% Draws a triple box, where |tf| is the fraction of the height for the |
| 6173 |
% top portion and |bf| is the fraction of the height for the bottom |
| 6174 |
% portion. Text centers for the three portions are |z$ct|, |z$cm| and |z$cb| |
| 6175 |
% for the top, middle and bottom portions. The points at the ends of the |
| 6176 |
% dividing lines are |z$tfl| and |z$tfr| for the top portion |
| 6177 |
% and |z$bfl| and |z$bfr| for the bottom. |
| 6178 |
% |
| 6179 |
% \begin{macrocode} |
| 6180 |
def drawtriplerectangle(suffix $)(expr l, h, tf, bf) = |
| 6181 |
rectpoints($, l, h); |
| 6182 |
z$tfl=tf[z$tl,z$bl]; z$tfr=tf[z$tr,z$br]; |
| 6183 |
z$bfl=bf[z$bl,z$tl]; z$bfr=bf[z$br,z$tr]; |
| 6184 |
z$cb=1/2[z$bl,z$bfr]; |
| 6185 |
z$cm=1/2[z$bfl,z$tfr]; |
| 6186 |
z$ct=1/2[z$tfl,z$tr]; |
| 6187 |
draw z$bl--z$br--z$tr--z$tl--cycle; |
| 6188 |
draw z$bfl--z$bfr; |
| 6189 |
draw z$tfl--z$tfr; |
| 6190 |
enddef; |
| 6191 |
|
| 6192 |
% \end{macrocode} |
| 6193 |
% \end{routine} |
| 6194 |
% |
| 6195 |
% \begin{routine}{hiderectangle} |
| 6196 |
% Draws an invisible rectangular box of the usual dimensions that |
| 6197 |
% covers up anything underneath it. |
| 6198 |
% \begin{macrocode} |
| 6199 |
def hiderectangle(suffix $)(expr l, h) = |
| 6200 |
begingroup |
| 6201 |
save c; |
| 6202 |
pair c[]; |
| 6203 |
c1=(x$,y$); |
| 6204 |
c2=c1+(l,0); |
| 6205 |
c3=c1+(l,h); |
| 6206 |
c4=c1+(0,h); |
| 6207 |
unfilldraw c1--c2--c3--c4--cycle; |
| 6208 |
endgroup |
| 6209 |
enddef; |
| 6210 |
|
| 6211 |
% \end{macrocode} |
| 6212 |
% \end{routine} |
| 6213 |
% |
| 6214 |
% \begin{routine}{drawdashboxover} |
| 6215 |
% Draws a dashed box that covers up anything underneath it. |
| 6216 |
% \begin{macrocode} |
| 6217 |
def drawdashboxover(suffix $)(expr l, h) = |
| 6218 |
rectpoints($, l, h); |
| 6219 |
hiderectangle($, l, h); |
| 6220 |
z$c = 1/2[z$bl,z$tr]; |
| 6221 |
draw z$bl--z$br--z$tr--z$tl--cycle dashes; |
| 6222 |
enddef; |
| 6223 |
|
| 6224 |
% \end{macrocode} |
| 6225 |
% \end{routine} |
| 6226 |
% |
| 6227 |
% \begin{routine}{drawindexbox} |
| 6228 |
% Draws an index box. The main box is |l| by |h| and the small box |
| 6229 |
% at the top left is |lp| by |hp|. The main box points are the usual |
| 6230 |
% |z$bl| etc, but the top box points are |z$P.bl| etc. The |str| |
| 6231 |
% is put at the center (|z$P.c|) of the small box. |
| 6232 |
% \begin{macrocode} |
| 6233 |
def drawindexbox(suffix $)(expr l, h, lp, hp)(text str) = |
| 6234 |
rectpoints($, l, h); |
| 6235 |
z$c = 1/2[z$bl,z$tr]; |
| 6236 |
z$P = z$tl; |
| 6237 |
rectpoints($P, lp, hp); |
| 6238 |
z$P.c = 1/2[z$P.bl, z$P.tr]; |
| 6239 |
draw z$bl--z$br--z$tr--z$tl--cycle; |
| 6240 |
draw z$P.bl--z$P.br--z$P.tr--z$P.tl--cycle; |
| 6241 |
label(str, z$P.c); |
| 6242 |
enddef; |
| 6243 |
|
| 6244 |
% \end{macrocode} |
| 6245 |
% \end{routine} |
| 6246 |
% |
| 6247 |
% \begin{routine}{drawroundedbox} |
| 6248 |
% Draws a rectangular box with rounded corners (like the \LaTeX{} |\oval|). |
| 6249 |
% The box is |l| by |h| and located by the bottom left corner. The |
| 6250 |
% corners are rounded with a radius of |r|. If the radius is too large for |
| 6251 |
% the box it is reduced so that at least two opposite sides are semi-circular. |
| 6252 |
% The |str| is put at the center (|z$c|) of the box. |
| 6253 |
% \begin{macrocode} |
| 6254 |
def drawroundedbox(suffix $)(expr l, h, r)(text str) = |
| 6255 |
rectpoints($, l, h); |
| 6256 |
begingroup |
| 6257 |
save rad; |
| 6258 |
numeric rad; rad := r; |
| 6259 |
if rad > l/2: |
| 6260 |
rad := l/2; |
| 6261 |
fi |
| 6262 |
if rad > h/2: |
| 6263 |
rad := h/2; |
| 6264 |
fi |
| 6265 |
draw (x$br-rad, y$br){right}..{up}(x$br, y$br+rad)-- |
| 6266 |
(x$tr, y$tr-rad){up}..{left}(x$tr-rad, y$tr)-- |
| 6267 |
(x$tl+rad, y$tl){left}..{down}(x$tl, y$tl-rad)-- |
| 6268 |
(x$bl, y$bl+rad){down}..{right}(x$bl+rad, y$bl)--cycle; |
| 6269 |
endgroup; |
| 6270 |
z$c = 1/2[z$bl,z$tr]; |
| 6271 |
label(str, z$c); |
| 6272 |
enddef; |
| 6273 |
|
| 6274 |
% \end{macrocode} |
| 6275 |
% \end{routine} |
| 6276 |
% |
| 6277 |
% \begin{routine}{drawovalbox} |
| 6278 |
% \changes{v1.1}{1999/10/30}{Added drawovalbox routine} |
| 6279 |
% Draws an elliptical box with horizontal diameter |l| and vertical diameter |
| 6280 |
% |h|. The box is located by the center point. |
| 6281 |
% \begin{macrocode} |
| 6282 |
def drawovalbox(suffix $)(expr l, h)(text str) = |
| 6283 |
ellipsepoints($, l, h); |
| 6284 |
z$c = 1/2[z$ml,z$mr]; |
| 6285 |
begingroup |
| 6286 |
save p; |
| 6287 |
path p; |
| 6288 |
p = fullcircle scaled h xscaled (l/h) shifted z$c; |
| 6289 |
draw p; |
| 6290 |
endgroup; |
| 6291 |
label(str, z$c); |
| 6292 |
enddef; |
| 6293 |
|
| 6294 |
% \end{macrocode} |
| 6295 |
% \end{routine} |
| 6296 |
% |
| 6297 |
% \begin{routine}{drawdashellipse} |
| 6298 |
% \changes{v1.2}{1999/11/15}{Added drawdashellipse routine} |
| 6299 |
% Draws a dashed elliptical box with horizontal diameter |l| and vertical diameter |
| 6300 |
% |h|. The ellipse is located by the center point. |
| 6301 |
% \begin{macrocode} |
| 6302 |
def drawdashellipse(suffix $)(expr l, h) = |
| 6303 |
ellipsepoints($, l, h); |
| 6304 |
z$c = 1/2[z$ml,z$mr]; |
| 6305 |
begingroup |
| 6306 |
save p; |
| 6307 |
path p; |
| 6308 |
p = fullcircle scaled h xscaled (l/h) shifted z$c; |
| 6309 |
draw p dashes; |
| 6310 |
endgroup |
| 6311 |
enddef; |
| 6312 |
|
| 6313 |
% \end{macrocode} |
| 6314 |
% \end{routine} |
| 6315 |
% |
| 6316 |
% \begin{routine}{drawdrum} |
| 6317 |
% \changes{v1.3}{2000/05/22}{Added drawdrum routine} |
| 6318 |
% Draws a drum box with length |l| and height |h|. The top and bottom |
| 6319 |
% ellipse minor/major diamter ratio id |drumlid|. The text is put at the |
| 6320 |
% (curved) center of the drum. |
| 6321 |
% \begin{macrocode} |
| 6322 |
def drawdrum(suffix $)(expr l, h)(text str) = |
| 6323 |
save vdia; numeric vdia; |
| 6324 |
vdia := drumlid*l; % ellipse vertical diameter |
| 6325 |
save pf, ph; path pf, ph; % full & half ellipse paths |
| 6326 |
|
| 6327 |
% points on the basic rectangle |
| 6328 |
z$bl = z$; |
| 6329 |
z$tr = (x$+l, y$+h); |
| 6330 |
z$br = (x$tr, y$); |
| 6331 |
z$tl = (x$, y$tr); |
| 6332 |
z$ml = 1/2[z$bl,z$tl]; |
| 6333 |
z$mr = 1/2[z$br,z$tr]; |
| 6334 |
z$tc = 1/2[z$tl,z$tr]; % center of top rectangle line |
| 6335 |
z$bc = 1/2[z$bl,z$br]; |
| 6336 |
% draw box sides |
| 6337 |
draw z$tl--z$bl; draw z$tr--z$br; |
| 6338 |
|
| 6339 |
% points on top ellipse |
| 6340 |
z$T''' = z$tc; % ellipse center |
| 6341 |
ellipsepoints($T''', l, vdia); |
| 6342 |
z$tm = z$T'''.tm; |
| 6343 |
z$tml = z$T'''.tl; |
| 6344 |
z$tmr = z$T'''.tr; |
| 6345 |
|
| 6346 |
% points on bottom ellipse |
| 6347 |
z$B''' = z$bc; |
| 6348 |
ellipsepoints($B''', l, vdia); |
| 6349 |
z$bm = z$B'''.bm; |
| 6350 |
z$bml = z$B'''.bl; |
| 6351 |
z$bmr = z$B'''.br; |
| 6352 |
|
| 6353 |
% box center point |
| 6354 |
z$c = 1/2[z$T'''.bm, z$B'''.bm]; |
| 6355 |
|
| 6356 |
% draw top ellipse |
| 6357 |
pf = fullcircle scaled vdia xscaled (l/vdia) shifted z$T'''; |
| 6358 |
draw pf; |
| 6359 |
% draw bottom half ellipse |
| 6360 |
ph = (halfcircle rotated 180) scaled vdia xscaled (l/vdia) shifted z$B'''; |
| 6361 |
draw ph; |
| 6362 |
label(str, z$c); |
| 6363 |
enddef; |
| 6364 |
|
| 6365 |
% \end{macrocode} |
| 6366 |
% \end{routine} |
| 6367 |
% |
| 6368 |
% \begin{routine}{drawoutputbox} |
| 6369 |
% Draws an output box. The box is |l| by |h| and the |str| |
| 6370 |
% is put at the center. The bottom of the box is a wavy line. |
| 6371 |
% |
| 6372 |
% This code was supplied by Guy Worthington (see \texttt{comp.text.tex} |
| 6373 |
% newsgroup thread \textit{Trial, ignore}, January 2004, and in |
| 6374 |
% particuar Guy's message of 2004/01/27). |
| 6375 |
% \changes{v1.6}{2004/02/29}{Added drawoutputbox} |
| 6376 |
% \begin{macrocode} |
| 6377 |
def drawoutputbox(suffix $)(expr l, h)(text str) = |
| 6378 |
rectpoints($, l, h); |
| 6379 |
begingroup |
| 6380 |
save c; |
| 6381 |
pair c[]; |
| 6382 |
c1 = (x$br, y$br+1/8h); % right side of box is shorter |
| 6383 |
c2 = (x$bm, y$bm+1/16h); |
| 6384 |
% draw the tear |
| 6385 |
draw z$bl..c2{dir 45}..c1{dir -15}--z$tr--z$tl--cycle; |
| 6386 |
endgroup; |
| 6387 |
z$c = (x$bm, 1/2(y$bm+y$tm)); |
| 6388 |
label(str, z$c); |
| 6389 |
enddef; |
| 6390 |
|
| 6391 |
% \end{macrocode} |
| 6392 |
% \end{routine} |
| 6393 |
% |
| 6394 |
% |
| 6395 |
% \begin{routine}{drawstickman} |
| 6396 |
% Draws a full frontal genderless stick figure, inside a rectangle |
| 6397 |
% |l| by |h|. |
| 6398 |
% \changes{v1.6}{2004/02/29}{Added drawstickman} |
| 6399 |
% \begin{macrocode} |
| 6400 |
\def drawstickman(suffix $)(expr l, h) = |
| 6401 |
rectpoints($,l,h); |
| 6402 |
begingroup |
| 6403 |
save c; |
| 6404 |
pair c[]; |
| 6405 |
c1 = 8/24[z$bm,z$tm]; |
| 6406 |
c2 = 15/24[z$bm,z$tm]; |
| 6407 |
c3 = 18/24[z$bm,z$tm]; |
| 6408 |
c4 = 1/2[c3,z$tm]; |
| 6409 |
c6 = (x$bl, ypart(c2)); |
| 6410 |
c7 = (x$br, ypart(c2)); |
| 6411 |
draw z$bl--c1--z$br; % legs |
| 6412 |
draw c1--c3; % body |
| 6413 |
draw c6--c7; % arms |
| 6414 |
draw c3{right}..z$tm{left}..cycle; % head |
| 6415 |
endgroup; |
| 6416 |
enddef; |
| 6417 |
|
| 6418 |
% \end{macrocode} |
| 6419 |
% \end{routine} |
| 6420 |
% |
| 6421 |
% |
| 6422 |
% |
| 6423 |
% |
| 6424 |
% The end of the package |
| 6425 |
% |
| 6426 |
% \begin{macrocode} |
| 6427 |
%</up> |
| 6428 |
% \end{macrocode} |
| 6429 |
% |
| 6430 |
% |
| 6431 |
% \bibliographystyle{alpha} |
| 6432 |
% \begin{thebibliography}{RBP+91} |
| 6433 |
% |
| 6434 |
% \bibitem[EN89]{ELMASRI89} |
| 6435 |
% R.~Elmasri and S.~B.~Navathe. |
| 6436 |
% \newblock \emph{Fundamentals of Database Systems}. |
| 6437 |
% \newblock Benjamin Cummings Publishing Co. Inc., 1989. |
| 6438 |
% |
| 6439 |
% \bibitem[GMS94]{GOOSSENS94} |
| 6440 |
% Michel Goossens, Frank Mittelbach, and Alexander Samarin. |
| 6441 |
% \newblock \emph{The LaTeX Companion}. |
| 6442 |
% \newblock Addison-Wesley Publishing Company, 1994. |
| 6443 |
% |
| 6444 |
% \bibitem[GRM97]{GOOSSENS97} |
| 6445 |
% Michel Goossens, Sebastian Rahtz, and Frank Mittelbach. |
| 6446 |
% \newblock \emph{The LaTeX Graphics Companion}. |
| 6447 |
% \newblock Addison-Wesley Publishing Company, 1997. |
| 6448 |
% |
| 6449 |
% \bibitem[Hob92]{MPOST} |
| 6450 |
% John D.~Hobby. |
| 6451 |
% \newblock \emph{A user's manual for MetaPost}. |
| 6452 |
% \newblock Computing Science Technical Report no. 162, |
| 6453 |
% AT\&T Bell Laboratories, Murray Hill, NJ, April 1992. |
| 6454 |
% (Available from CTAN with the MetaPost distribution |
| 6455 |
% in \texttt{.../graphics/metapost}). |
| 6456 |
% |
| 6457 |
% \bibitem[Hoe98]{HOENIG98} |
| 6458 |
% Alan Hoenig. |
| 6459 |
% \newblock \emph{TeX Unbound}. |
| 6460 |
% \newblock Oxford University Press, 1998. |
| 6461 |
% |
| 6462 |
% \bibitem[IDE85]{IDEF1X} |
| 6463 |
% AFWAL/MLTC, Wright-Patterson AFB, OH. |
| 6464 |
% \newblock \emph{Integrated Informatiuon Support Systems (IISS), Vol.~V: |
| 6465 |
% Common Data Model Subsystem, Part 4: Information Modeling Manual |
| 6466 |
% --- IDEF1X}. |
| 6467 |
% \newblock Report Number: AFWAL--TR--86--4006, Volume~V, 1985. |
| 6468 |
% |
| 6469 |
% \bibitem[ISO87]{TR9007} |
| 6470 |
% ISO TR9007. |
| 6471 |
% \newblock \emph{Information processing systems --- |
| 6472 |
% Concepts and terminology for the conceptual schema and |
| 6473 |
% the information base}, 1987. |
| 6474 |
% |
| 6475 |
% \bibitem[ISO94]{STEP11} |
| 6476 |
% ISO 10303-11:1994. |
| 6477 |
% \newblock \emph{Industrial automation systems and integration --- |
| 6478 |
% Product data representation and exchange --- |
| 6479 |
% Part~11: Description methods: The EXPRESS language reference manual}, |
| 6480 |
% 1994. |
| 6481 |
% |
| 6482 |
% \bibitem[Knu86]{MFONT} |
| 6483 |
% Donald E~Knuth. |
| 6484 |
% \newblock \emph{The METAFONTbook}. |
| 6485 |
% \newblock Addison-Wesley Publishing Company, 1986. |
| 6486 |
% |
| 6487 |
% \bibitem[Lam94]{LATEX} |
| 6488 |
% Leslie Lamport. |
| 6489 |
% \newblock \emph{\LaTeX: A Document Preperation System}. |
| 6490 |
% \newblock Second edition. Addison-Wesley Publishing Company, 1994. |
| 6491 |
% |
| 6492 |
% \bibitem[NH89]{NIJSSEN89} |
| 6493 |
% G.~M.~Nijssen and T.~A.~Halpin. |
| 6494 |
% \newblock \emph{Conceptual Schema and Relational Database Design}. |
| 6495 |
% \newblock Prentice Hall, 1989. |
| 6496 |
% |
| 6497 |
% \bibitem[Rec97]{RECKDAHL97} |
| 6498 |
% Keith Reckdahl. |
| 6499 |
% \newblock \emph{Using EPS Graphics in LaTeX2e Documents}. |
| 6500 |
% \newblock February 1997. |
| 6501 |
% (Available from CTAN as \texttt{../info/epslatex.ps}). |
| 6502 |
% |
| 6503 |
% |
| 6504 |
% \bibitem[RBP+91]{RUMBAUGH91} |
| 6505 |
% J.~Rumbaugh, M.~Blaha, W.~Premerlani, F.~Eddy and W.~Lorensen. |
| 6506 |
% \newblock \emph{Object-Oriented Modeling and Design } |
| 6507 |
% \newblock Prentice Hall, 1991. |
| 6508 |
% |
| 6509 |
% \bibitem[SW94]{EBOOK} |
| 6510 |
% Douglas A.~Schenck and Peter R.~Wilson. |
| 6511 |
% \newblock \emph{Information Modeling the EXPRESS Way}. |
| 6512 |
% \newblock Oxford University Press, 1994. |
| 6513 |
% (ISBN 0-19-508714-3) |
| 6514 |
% |
| 6515 |
% \bibitem[SM88]{SHLAER88} |
| 6516 |
% S.~Shlaer and S.~J.~Mellor. |
| 6517 |
% \newblock \emph{Object-Oriented System Analysis}. |
| 6518 |
% \newblock Yourdon Press, 1988. |
| 6519 |
% |
| 6520 |
% \bibitem[Wil99]{METAFP} |
| 6521 |
% Peter Wilson. |
| 6522 |
% \newblock \emph{Some Experiences in Running METAFONT and MetaPost}. |
| 6523 |
% \newblock November, 1999. |
| 6524 |
% (Available from CTAN as \texttt{../info/metafp.ps}). |
| 6525 |
% |
| 6526 |
% \end{thebibliography} |
| 6527 |
% |
| 6528 |
% \textbf{Note:} See \texttt{http://www.tug.org} for information on accessing |
| 6529 |
% CTAN --- the Comprehensive \TeX{} Archive Network. |
| 6530 |
% |
| 6531 |
% |
| 6532 |
% \Finale |
| 6533 |
% \PrintIndex |
| 6534 |
% |
| 6535 |
\endinput |
| 6536 |
|
| 6537 |
%% \CharacterTable |
| 6538 |
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z |
| 6539 |
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z |
| 6540 |
%% Digits \0\1\2\3\4\5\6\7\8\9 |
| 6541 |
%% Exclamation \! Double quote \" Hash (number) \# |
| 6542 |
%% Dollar \$ Percent \% Ampersand \& |
| 6543 |
%% Acute accent \' Left paren \( Right paren \) |
| 6544 |
%% Asterisk \* Plus \+ Comma \, |
| 6545 |
%% Minus \- Point \. Solidus \/ |
| 6546 |
%% Colon \: Semicolon \; Less than \< |
| 6547 |
%% Equals \= Greater than \> Question mark \? |
| 6548 |
%% Commercial at \@ Left bracket \[ Backslash \\ |
| 6549 |
%% Right bracket \] Circumflex \^ Underscore \_ |
| 6550 |
%% Grave accent \` Left brace \{ Vertical bar \| |
| 6551 |
%% Right brace \} Tilde \~} |
| 6552 |
|
| 6553 |
|