1 // HUD_scale.cxx -- HUD Common Scale Base (inherited from Gauge/Tape/Dial)
3 // Written by Michele America, started September 1997.
5 // Copyright (C) 1997 Michele F. America [micheleamerica#geocities:com]
6 // Copyright (C) 2006 Melchior FRANZ [mfranz#aon:at]
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.
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.
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.
25 //============== Scale class memeber definitions ===============
28 // 1. Scales divide the specified location into half and then
29 // the half opposite the read direction in half again. A bar is
30 // then drawn along the second divider. Scale ticks are drawn
31 // between the middle and quarter section lines (minor division
32 // markers) or just over the middle line.
34 // 2. This class was not intended to be instanciated. See moving_scale
35 // and gauge_instr classes.
36 //==============================================================
37 HUD::Scale::Scale( HUD *hud, const SGPropertyNode *n, float x, float y) :
39 _input(n->getNode("input", false)),
40 _major_divs(n->getFloatValue("major-divisions")),
41 _minor_divs(n->getFloatValue("minor-divisions")),
42 _modulo(n->getIntValue("modulo"))
44 if (n->hasValue("display-span"))
45 _range_shown = n->getFloatValue("display-span");
47 _range_shown = _input.max() - _input.min();
49 _display_factor = get_span() / _range_shown;
51 _range_shown = -_range_shown;
53 // float temp = (_input.max() - _input.min()) / 100; // FIXME huh?
54 // if (_range_shown < temp)
55 // _range_shown = temp;