-
Notifications
You must be signed in to change notification settings - Fork 2
/
aviatikz.inst.vsi.sty
170 lines (134 loc) · 5.42 KB
/
aviatikz.inst.vsi.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
%
% aviatikz.inst.vsi.sty
% Copyright (C) 2020-2021 Mario Haustein
%
% This work may be distributed and/or modified under the conditions of the
% LaTeX Project Public License, either version 1.3 of this license or (at your
% option) any later version. The latest version of this license is in the file
%
% http://www.latex-project.org/lppl.txt
%
% This file is part of the "aviatikz bundle" (The Work in LPPL) and all files
% in that bundle must be distributed together.
%
%
% Variometer
%
\pgfmathsetmacro{\avia@inst@vsi@tickout}{\avia@inst@face@rad - 0.2} % Außenradius Skalenstrich
\pgfmathsetmacro{\avia@inst@vsi@majortickin}{\avia@inst@vsi@tickout - 0.4} % Innenradius Skalenstrich
\pgfmathsetmacro{\avia@inst@vsi@minortickin}{\avia@inst@vsi@tickout - 0.3} % Innenradius Teilstrich
% Ziffernblatt 2000fpm, linear
\newcommand{\aviainst@vsi@function@twothousandlin}[1]
{
\pgfmathsetmacro{\angle}{min(max(#1 / 2000, -1), 1) * -170}
}
\newcommand{\aviainst@vsi@face@twothousandlin}
{
\begingroup
% Ziffernblatt
\path [/avia/inst/vsi/face/background] (0, 0) circle (\avia@inst@hole@rad);
% Skalenstriche
\foreach \i in {-2000,-1500,-1000,-500,0,500,1000,1500,2000}
{
\aviainst@vsi@function@twothousandlin{\i}
\pgfmathsetmacro{\angle}{\angle + 180}
\path [/avia/inst/vsi/face/majortick]
(\angle:\avia@inst@vsi@majortickin) -- (\angle:\avia@inst@vsi@tickout);
}
\foreach \i in {-900,-800,...,900}
{
\aviainst@vsi@function@twothousandlin{\i}
\pgfmathsetmacro{\angle}{\angle + 180}
\pgfmathtruncatemacro{\modulo}{Mod(\i, 500)}
\ifnum\modulo>0
\path [/avia/inst/vsi/face/minortick]
(\angle:\avia@inst@vsi@minortickin) -- (\angle:\avia@inst@vsi@tickout);
\fi
}
% Beschriftung
\begin{scope}[/avia/inst/vsi/face/number]
\node at ( 0:2.4) {20};
\node at ( 45:2.4) {15};
\node at ( 90:2.4) {10};
\node at (135:2.4) { 5};
\node at (180:2.4) { 0};
\node at (225:2.4) { 5};
\node at (270:2.4) {10};
\node at (315:2.4) {15};
\end{scope}
% Pfeile
\aviainst@vsi@function@twothousandlin{150}
\pgfmathsetmacro{\anglearrowupfrom}{\angle + 180}
\aviainst@vsi@function@twothousandlin{350}
\pgfmathsetmacro{\anglearrowupto}{\angle + 180}
\aviainst@vsi@function@twothousandlin{-150}
\pgfmathsetmacro{\anglearrowdownfrom}{\angle + 180}
\aviainst@vsi@function@twothousandlin{-350}
\pgfmathsetmacro{\anglearrowdownto}{\angle + 180}
\path [/avia/inst/vsi/face/arrow up]
(\anglearrowupfrom:2.4)
arc [start angle=\anglearrowupfrom,end angle=\anglearrowupto,radius=2.4]
node [midway,below right] {UP};
\path [/avia/inst/vsi/face/arrow down]
(\anglearrowdownfrom:2.4)
arc [start angle=\anglearrowdownfrom,end angle=\anglearrowdownto,radius=2.4]
node [midway,above right] {DN};
% Weitere Textelemente
% TODO: Extra Style
\node [/avia/inst/vsi/face/number] at (0.0, 0.4) [font={\pgfkeys{/avia/inst/font}\fontsize{12}{12}\selectfont},above] {VERTICAL SPEED};
\node [/avia/inst/vsi/face/number] at (0.0, -0.4) [font={\pgfkeys{/avia/inst/font}\fontsize{10}{10}\selectfont},below] {100 FEET PER MIN};
\endgroup
}
\let\aviainst@vsi@function\aviainst@vsi@function@twothousandlin
\let\aviainst@vsi@face\aviainst@vsi@face@twothousandlin
\pgfkeys{/avia/inst/vsi/face/background/.style={fill=black!80}}
\pgfkeys{/avia/inst/vsi/face/majortick/.style={draw=white,line width=3.0pt}}
\pgfkeys{/avia/inst/vsi/face/minortick/.style={draw=white,line width=1.5pt}}
\pgfkeys{/avia/inst/vsi/face/number/.style={text=white,font={\pgfkeys{/avia/inst/font}\fontsize{24}{24}\selectfont}}}
\pgfkeys{/avia/inst/vsi/face/arrow up/.style={draw=white,-latex,thick,text=white,font={\pgfkeys{/avia/inst/font}\fontsize{8}{8}\selectfont}}}
\pgfkeys{/avia/inst/vsi/face/arrow down/.style={draw=white,-latex,thick,text=white,font={\pgfkeys{/avia/inst/font}\fontsize{8}{8}\selectfont}}}
\pgfkeys{/avia/inst/vsi/type/.is choice}
\pgfkeys{/avia/inst/vsi/type/.value required}
\pgfkeys{/avia/inst/vsi/type/twothousandlin/.code={%
\let\aviainst@vsi@face\aviainst@vsi@face@twothousandlin%
\let\aviainst@vsi@function\aviainst@vsi@function@twothousandlin%
}}
\pgfkeys{/avia/inst/vsi/type=twothousandlin}
% Zeiger
\newcommand{\aviainst@vsi@needle}
{
\path [/avia/inst/vsi/needle/border]
(0.1, -0.9) -- (0.1, 2.9) -- (0.0, 3.1) -- (-0.1, 2.9) -- (-0.1, -0.9) -- cycle;
\path [/avia/inst/vsi/needle/border]
(0.0, -0.9) circle (0.18);
\path [/avia/inst/vsi/needle/secondary]
(0.1, 0.4) -- (0.1, -0.9) -- (-0.1, -0.9) -- (-0.1, 0.4) -- cycle;
\path [/avia/inst/vsi/needle/secondary]
(0.0, -0.9) circle (0.18);
\path [/avia/inst/vsi/needle/primary]
(0.1, 0.4) -- (0.1, 2.9) -- (0.0, 3.1) -- (-0.1, 2.9) -- (-0.1, 0.4) -- cycle;
}
\pgfkeys{/avia/inst/vsi/needle/primary/.style=/avia/inst/needle/primary}
\pgfkeys{/avia/inst/vsi/needle/secondary/.style=/avia/inst/needle/secondary}
\pgfkeys{/avia/inst/vsi/needle/border/.style=/avia/inst/needle/border}
% Instrument zeichnen.
\newcommand{\aviainstvsi}[1][]
{
\begingroup
\pgfkeys{/avia/inst/vsi/.cd,#1}
\pgfkeysgetvalue{/avia/inst/vsi/vspeed}{\vspeed}
\aviainst@vsi@function{\vspeed}
\aviainst@frame
\aviainst@vsi@face
\begin{scope}[rotate=90,rotate=\angle,transform shape]
\aviainst@vsi@needle
\end{scope}
% Nabe
\path [/avia/inst/vsi/needle/border]
(0.0, 0.0) circle (0.2);
\path [/avia/inst/vsi/needle/secondary]
(0.0, 0.0) circle (0.2);
\aviainst@border@circle
\endgroup
}
\pgfkeys{/avia/inst/vsi/vspeed/.initial=0}