| 1 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2 |
% dratex.4ht 2009-05-21-09:32 % |
| 3 |
% Copyright (C) 1997--2009 Eitan M. Gurari % |
| 4 |
% % |
| 5 |
% This work may be distributed and/or modified under the % |
| 6 |
% conditions of the LaTeX Project Public License, either % |
| 7 |
% version 1.3c of this license or (at your option) any % |
| 8 |
% later version. The latest version of this license is % |
| 9 |
% in % |
| 10 |
% http://www.latex-project.org/lppl.txt % |
| 11 |
% and version 1.3c or later is part of all distributions % |
| 12 |
% of LaTeX version 2005/12/01 or later. % |
| 13 |
% % |
| 14 |
% This work has the LPPL maintenance status "maintained".% |
| 15 |
% % |
| 16 |
% This Current Maintainer of this work % |
| 17 |
% is Eitan M. Gurari. % |
| 18 |
% % |
| 19 |
% If you modify this program your changing its signature % |
| 20 |
% with a directive of the following form will be % |
| 21 |
% appreciated. % |
| 22 |
% \message{signature} % |
| 23 |
% % |
| 24 |
% [email protected] % |
| 25 |
% http://www.cse.ohio-state.edu/~gurari % |
| 26 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 27 |
\immediate\write-1{version 2009-05-21-09:32} |
| 28 |
|
| 29 |
\Define\html:Draw{\ifvmode \noindent\hfil\fi |
| 30 |
\global\:TeXLoc\z@ |
| 31 |
\setbox\:box=\vbox\bgroup |
| 32 |
\begingroup |
| 33 |
\def\EndDraw{% |
| 34 |
\endgroup \:SetDrawWidth |
| 35 |
\egroup {\:X\wd\:box \:Y\ht\:box \advance\:Y by\dp\:box |
| 36 |
\xdef\DrawWidth{\:InCons\:X}% |
| 37 |
\xdef\DrawHeight{\:InCons\:Y}% |
| 38 |
\xdef\MinDrawX{\:InCons\:LBorder}% |
| 39 |
\:X\:UBorder \xdef\MaxDrawy{\:InCons\:X}% |
| 40 |
}% |
| 41 |
% |
| 42 |
\global\let\in:pic\empty |
| 43 |
\box\:box \end:condpic |
| 44 |
\global\let\in:pic\:UnDef |
| 45 |
% |
| 46 |
\after:dra |
| 47 |
}% |
| 48 |
\def\PsCode##1{{\Text(--\ht:special{\PsCodeSpecial##1}--)}}% |
| 49 |
% |
| 50 |
\:DraCatCodes \parindent\z@ \ht:everypar{}% |
| 51 |
\linepenalty10 |
| 52 |
\leftskip\z@ \rightskip\z@ \boxmaxdepth\maxdimen |
| 53 |
\let\FigSize\:FigSize |
| 54 |
\def\Draw{\:wrn1{}}% |
| 55 |
\:CommonIID \:InDraw |
| 56 |
% |
| 57 |
} |
| 58 |
|
| 59 |
\let\old:Draw\:Draw |
| 60 |
\def\:Draw{% |
| 61 |
\ifx \EndPicture\:UnDef |
| 62 |
\expand:after{\ifvmode \vfill\break \fi |
| 63 |
\pic:cond\:GifDraw\html:Draw |
| 64 |
}% |
| 65 |
\else \expandafter\old:Draw \fi } |
| 66 |
\def\:GifDraw{\bgroup\:DraCatCodes \futurelet\:tempa\gif:draw} |
| 67 |
\def\gif:draw{% |
| 68 |
\ifx \:tempa[\g:fdr\g:ifdraw |
| 69 |
\else \g:fdr\gi:fdraw \fi} |
| 70 |
\def\g:ifdraw[#1]{\Picture*[#1]{ \a:@Picture{Draw}}\html:Draw} |
| 71 |
\def\gi:fdraw{\Picture*{ \a:@Picture{Draw}}\html:Draw} |
| 72 |
\def\g:fdr{\egroup\a:Draw\append:def\end:condpic{\b:Draw}\expandafter} |
| 73 |
\NewConfigure{Draw}{2} |
| 74 |
|
| 75 |
\def\DrawIMG#1{\def\Pic:Img{ \ifx \in:pic\:UnDef \at:IMG |
| 76 |
\else \u:map#1\fi}} |
| 77 |
\DrawIMG{} |
| 78 |
\let\u:map\empty |
| 79 |
|
| 80 |
\def\DrawMap{% |
| 81 |
\NewHaddr\:temp |
| 82 |
\xdef\:Map{{<map name="\:temp">}}% |
| 83 |
\edef\u:map{ usemap="\:sharp\:temp" }% |
| 84 |
\NewHaddr\alt:map |
| 85 |
\def\after:dra{\EndLink |
| 86 |
\HPage[\alt:map]{}{\expandafter\map:menu\:Map}\EndHPage{}% |
| 87 |
{\expandafter\HCode\:Map}\HCode{</map>}% |
| 88 |
\let\u:map\empty \let\after:dra\empty }% |
| 89 |
\Link[\RefFile{\alt:map}]{}{}\Draw[textual map]} |
| 90 |
|
| 91 |
\let\after:dra=\empty |
| 92 |
\Odef\GetRectArea[#1]#2#3{{% |
| 93 |
\ifnum \Point:N>0 |
| 94 |
\MarkPoint \area:env \gHAssign\Point:N 0 |
| 95 |
\xdef\:Map{\:Map |
| 96 |
\rect:area{#1}\gt:crd{point:1}\gt:crd{point:2}{#2}{#3}}% |
| 97 |
\fi}} |
| 98 |
\def\rect:area#1#2#3#4#5#6#7{% |
| 99 |
\trns:pt\:X{#2}\:Y{#3}% |
| 100 |
\trns:pt\:Z{#4}\:W{#5}% |
| 101 |
\Ar:a[#1 shape="rect" |
| 102 |
coords="\M:n\:X\:Z,\M:n\:Y\:W,\M:x\:X\:Z,\M:x\:Y\:W" |
| 103 |
\if "#7"\else alt="#7"\fi]{#6}} |
| 104 |
\Odef\GetCircleArea[#1]#2#3{{% |
| 105 |
\ifnum \Point:N>0 |
| 106 |
\MarkPoint \:distance(point:1,point:2)\tmp:dim\Map:x |
| 107 |
\:d\:Cons\tmp:dim\:d \area:env |
| 108 |
\gHAssign\Point:N 0 |
| 109 |
\xdef\:Map{\:Map |
| 110 |
\circle:area{#1}\gt:crd{point:1}{\:InCons\:d}{#2}{#3}}% |
| 111 |
\else\fi}} |
| 112 |
\def\circle:area#1#2#3#4#5#6{% |
| 113 |
\trns:pt\:X{#2}\:Y{#3}% |
| 114 |
\Ar:a[#1 shape="circle" coords="\:X,\:Y,#4" |
| 115 |
\ifx "#6"\else alt="#6"\fi]{#5}} |
| 116 |
\Odef\GetPolyArea[#1]#2#3{{% |
| 117 |
\ifnum \Point:N>0 |
| 118 |
\MarkPoint \area:env \let\:tempb\empty |
| 119 |
\Do(1,\Point:N){\edef\:tempb{\gt:crd{point:\the\DoReg}\:tempb}}% |
| 120 |
\gHAssign\Point:N 0 |
| 121 |
\xdef\:Map{\:Map\poly:area{#1}{\:tempb}{#2}{#3}}% |
| 122 |
\fi}} |
| 123 |
|
| 124 |
\def\ply:pts#1#2{% |
| 125 |
\def\:temp{#1}\ifx \:temp\empty\else |
| 126 |
\trns:pt\:X{#1}\:Y{#2}% |
| 127 |
\edef\:Z{\:Z\ifx \:Z\empty\else,\fi \:X,\:Y}% |
| 128 |
\expandafter\ply:pts |
| 129 |
\fi } |
| 130 |
\def\poly:area#1#2#3#4{% |
| 131 |
\let\:Z\empty \ply:pts#2{}{}% |
| 132 |
\Ar:a[#1 shape="poly" coords="\:Z" |
| 133 |
\ifx "#4"\else alt="#4"\fi]{#3}} |
| 134 |
\def\map:menu#1{\let\rect:area\r:mnu \let\circle:area\c:mnu |
| 135 |
\let\poly:area\p:mnu} |
| 136 |
|
| 137 |
\def\r:mnu#1#2#3#4#5#6#7{[\Link[#1]{#6}{}#7\EndLink] } |
| 138 |
\def\c:mnu#1#2#3#4#5#6{[\Link[#1]{#5}{}#6\EndLink] } |
| 139 |
\def\p:mnu#1#2#3#4{[\Link[#1]{#3}{}#4\EndLink] } |
| 140 |
\gHAssign\Point:N 0 |
| 141 |
\def\MarkPoint{\gHAdvance\Point:N 1 |
| 142 |
\MarkGLoc(point:\Point:N)} |
| 143 |
|
| 144 |
\def\area:env{\def\:X##1.##2\:Y##3.##4,{{##1}{##3}}% |
| 145 |
\let\rect:area\relax |
| 146 |
\let\circle:area\relax |
| 147 |
\let\poly:area\relax } |
| 148 |
|
| 149 |
\def\gt:crd#1{\csname Loc\space#1:\endcsname,} |
| 150 |
\def\trns:pt#1#2#3#4{% |
| 151 |
\ifnum #2<\MinDrawX \HAssign#10 |
| 152 |
\else \HAssign#1 #2 \Advance:#1 -\MinDrawX |
| 153 |
\tmp:dim\Map:x \multiply\tmp:dim #1 |
| 154 |
\HAssign #1\:InCons\tmp:dim |
| 155 |
\fi |
| 156 |
\ifnum #4>\MaxDrawy \HAssign#3\MaxDrawy |
| 157 |
\else \HAssign#3-#4 \Advance:#3 \MaxDrawy |
| 158 |
\fi |
| 159 |
\tmp:dim\Map:y \multiply\tmp:dim #3 \HAssign#3\:InCons\tmp:dim |
| 160 |
} |
| 161 |
\def\MapDensity(#1,#2){% |
| 162 |
\tmp:dim=#1pt \divide\tmp:dim by 72 \edef\Map:x{\the\tmp:dim}% |
| 163 |
\tmp:dim=#2pt \divide\tmp:dim by 72 \edef\Map:y{\the\tmp:dim}} |
| 164 |
\MapDensity(72,72) |
| 165 |
|
| 166 |
|
| 167 |
\Hinput{dratex} |
| 168 |
\endinput |
| 169 |
|