OpenCPN Partial API docs
Loading...
Searching...
No Matches
wind_history.h
1/******************************************************************************
2 * $Id: wind_history.h, v1.0 2010/08/30 tom-r Exp $
3 *
4 * Project: OpenCPN
5 * Purpose: Dashboard Plugin
6 * Author: Thomas Rauch
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 __WIND_HISTORY_H__
29#define __WIND_HISTORY_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 WIND_RECORD_COUNT 2000
46
47#include "instrument.h"
48#include "dial.h"
49
51public:
52 DashboardInstrument_WindDirHistory(wxWindow* parent, wxWindowID id,
53 wxString title,
54 InstrumentProperties* Properties);
56 void SetData(DASH_CAP, double, wxString);
57 wxSize GetSize(int orient, wxSize hint);
58
59private:
60 int m_soloInPane;
61 int m_SpdRecCnt, m_DirRecCnt, m_SpdStartVal, m_DirStartVal;
62 int m_isNULL;
63 int m_WindDirShift;
64
65protected:
66 double alpha;
67 double m_ArrayWindDirHistory[WIND_RECORD_COUNT];
68 double m_ArrayWindSpdHistory[WIND_RECORD_COUNT];
69 double m_ExpSmoothArrayWindSpd[WIND_RECORD_COUNT];
70 double m_ExpSmoothArrayWindDir[WIND_RECORD_COUNT];
71 wxDateTime::Tm m_ArrayRecTime[WIND_RECORD_COUNT];
72
73 double m_MaxWindDir;
74 double m_MinWindDir;
75 double m_WindDirRange;
76 double m_MaxWindSpd; //...in array
77 double m_TotalMaxWindSpd; // since O is started
78 double m_WindDir;
79 double m_WindSpd;
80 double m_MaxWindSpdScale;
81 double m_ratioW;
82 double m_oldDirVal;
83 bool m_IsRunning;
84 int m_SampleCount;
85 wxString m_WindSpeedUnit;
86 int m_SetNewData; // No need for data every second
87 int speedw, degw, degh;
88
89 wxRect m_WindowRect;
90 wxRect m_DrawAreaRect; // the coordinates of the real darwing area
91 int m_DrawingWidth, m_TopLineHeight, m_DrawingHeight;
92 int m_width, m_height;
93 int m_LeftLegend, m_RightLegend;
94 int m_currSec, m_lastSec, m_SpdCntperSec, m_DirCntperSec;
95 double m_cntSpd, m_cntDir, m_avgSpd, m_avgDir;
96
97 void Draw(wxGCDC* dc);
98 void DrawBackground(wxGCDC* dc);
99 void DrawForeground(wxGCDC* dc);
100 void SetMinMaxWindScale();
101 void DrawWindDirScale(wxGCDC* dc);
102 void DrawWindSpeedScale(wxGCDC* dc);
103 void ResetData();
104 wxString GetWindDirStr(wxString WindDir);
105};
106
107#endif // __WIND_HISTORY_H__