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 HUD::Scale::Scale( HUD *hud, const SGPropertyNode *n, float x, float 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"))
32 if (n->hasValue("display-span"))
33 _range_shown = n->getFloatValue("display-span");
35 _range_shown = _input.max() - _input.min();
37 _display_factor = get_span() / _range_shown;
39 _range_shown = -_range_shown;