OpenCPN Partial API docs
Loading...
Searching...
No Matches
altitude.h
1/******************************************************************************
2 * $Id: altitude.h, v0.1 $
3 *
4 * Project: OpenCPN
5 * Purpose: Dashboard Plugin, display altitude trace
6 * Author: derived from Jean-Eudes Onfray's depth.h by Andreas Merz
7 *
8 ***************************************************************************
9 * Copyright (C) 2010 by David S. Register *
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 * This program is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * GNU General Public License for more details. *
20 * *
21 * You should have received a copy of the GNU General Public License *
22 * along with this program; if not, write to the *
23 * Free Software Foundation, Inc., *
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
25 ***************************************************************************
26 */
27
28#ifndef __ALTITUDE_H__
29#define __ALTITUDE_H__
30
31// For compilers that support precompilation, includes "wx/wx.h".
32#include <wx/wxprec.h>
33
34#ifdef __BORLANDC__
35#pragma hdrstop
36#endif
37
38// for all others, include the necessary headers (this file is usually all you
39// need because it includes almost all "standard" wxWidgets headers)
40#ifndef WX_PRECOMP
41#include <wx/wx.h>
42#endif
43
44// Warn: div by 0 if count == 1
45#define ALTITUDE_RECORD_COUNT 30
46
47#include "instrument.h"
48
50public:
51 DashboardInstrument_Altitude(wxWindow* parent, wxWindowID id, wxString title,
52 InstrumentProperties* Properties);
53
55
56 wxSize GetSize(int orient, wxSize hint);
57 void SetData(DASH_CAP, double, wxString);
58
59private:
60protected:
61 const int c_GridLines = 4;
62 double m_ArrayAltitude[ALTITUDE_RECORD_COUNT]; // FIFO
63 double m_MinAltitude;
64 double m_MaxAltitude;
65 double m_Range = c_GridLines; // will change in 1 2 5 steps
66 double m_Altitude; // the actual measurement value
67 double m_meanAltitude = 0.0; // moving average
68 double m_sum2Altitude = 0.0; // squared sum moving average
69 int m_Attenuation = 1; // 1 2 5
70 int m_Decade = 1; // 1 10 100 1000 ..
71 wxString m_AltitudeUnit;
72 wxString m_Temp;
73
74 void Draw(wxGCDC* dc);
75 void DrawBackground(wxGCDC* dc);
76 void DrawForeground(wxGCDC* dc);
77
78 // plot scaling utilities
79 void setAttenuation(int steps);
80 int getAttenuation();
81};
82
83#endif // __ALTITUDE_H__