OpenCPN Partial API docs
Loading...
Searching...
No Matches
wind_history.h
Go to the documentation of this file.
1/**************************************************************************
2 * Copyright (C) 2010 by Thomas Rauch *
3 * Copyright (C) 2010 by David S. Register *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, see <https://www.gnu.org/licenses/>. *
17 **************************************************************************/
18
25#ifndef WIND_HisTORY_H_
26#define WIND_HisTORY_H_
27
28#include <wx/wxprec.h>
29
30#ifndef WX_PRECOMP
31#include <wx/wx.h>
32#endif
33
34#include "dial.h"
35#include "instrument.h"
36
37// Warn: div by 0 if count == 1
38#define WIND_RECORD_COUNT 2000
39
41public:
42 DashboardInstrument_WindDirHistory(wxWindow* parent, wxWindowID id,
43 wxString title,
44 InstrumentProperties* Properties);
45 ~DashboardInstrument_WindDirHistory() override = default;
46 void SetData(DASH_CAP, double, wxString) override;
47 wxSize GetSize(int orient, wxSize hint) override;
48
49private:
50 int m_soloInPane;
51 int m_SpdRecCnt, m_DirRecCnt, m_SpdStartVal, m_DirStartVal;
52 int m_isNULL;
53 int m_WindDirShift;
54
55protected:
56 double alpha;
57 double m_ArrayWindDirHistory[WIND_RECORD_COUNT];
58 double m_ArrayWindSpdHistory[WIND_RECORD_COUNT];
59 double m_ExpSmoothArrayWindSpd[WIND_RECORD_COUNT];
60 double m_ExpSmoothArrayWindDir[WIND_RECORD_COUNT];
61 wxDateTime::Tm m_ArrayRecTime[WIND_RECORD_COUNT];
62
63 double m_MaxWindDir;
64 double m_MinWindDir;
65 double m_WindDirRange;
66 double m_MaxWindSpd; //...in array
67 double m_TotalMaxWindSpd; // since O is started
68 double m_WindDir;
69 double m_WindSpd;
70 double m_MaxWindSpdScale;
71 double m_ratioW;
72 double m_oldDirVal;
73 bool m_IsRunning;
74 int m_SampleCount;
75 wxString m_WindSpeedUnit;
76 int m_SetNewData; // No need for data every second
77 int speedw, degw, degh;
78
79 wxRect m_WindowRect;
80 wxRect m_DrawAreaRect; // the coordinates of the real darwing area
81 int m_DrawingWidth, m_TopLineHeight, m_DrawingHeight;
82 int m_width, m_height;
83 int m_LeftLegend, m_RightLegend;
84 int m_currSec, m_lastSec, m_SpdCntperSec, m_DirCntperSec;
85 double m_cntSpd, m_cntDir, m_avgSpd, m_avgDir;
86
87 void Draw(wxGCDC* dc) override;
88 void DrawBackground(wxGCDC* dc);
89 void DrawForeground(wxGCDC* dc);
90 void SetMinMaxWindScale();
91 void DrawWindDirScale(wxGCDC* dc);
92 void DrawWindSpeedScale(wxGCDC* dc);
93 void ResetData();
94 wxString GetWindDirStr(wxString WindDir);
95};
96
97#endif // WIND_HisTORY_H_
Dashboard dial instrument.
Dashboard instrument base class.
DASH_CAP
Definition instrument.h:77