Debian Codegraph @

src/Instrumentation/HUD/HUD_scale.cxx

raw symbols SCIP
1 // HUD_scale.cxx -- HUD Common Scale Base (inherited from Gauge/Tape/Dial)
2 //
3 // Written by Michele America, started September 1997.
4 //
5 // Copyright (C) 1997 Michele F. America [micheleamerica#geocities:com]
6 // Copyright (C) 2006 Melchior FRANZ [mfranz#aon:at]
7 //
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License as
10 // published by the Free Software Foundation; either version 2 of the
11 // License, or (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
22 #include "HUD.hxx"
23 #include "HUD_private.hxx"
24
25 HUD::Scale::Scale( HUD *hud, const SGPropertyNode *n, float x, float y) :
26 Item(hud, n, x, y),
27 _input(n->getNode("input", false)),
28 _major_divs(n->getFloatValue("major-divisions")),
29 _minor_divs(n->getFloatValue("minor-divisions")),
30 _modulo(n->getIntValue("modulo"))
31 {
32 if (n->hasValue("display-span"))
33 _range_shown = n->getFloatValue("display-span");
34 else
35 _range_shown = _input.max() - _input.min();
36
37 _display_factor = get_span() / _range_shown;
38 if (_range_shown < 0)
39 _range_shown = -_range_shown;
40
41 }
42
43