OpenCPN Partial API docs
Loading...
Searching...
No Matches
clock.h
1
/******************************************************************************
2
* $Id: clock.h, v1.0 2011/05/15 nohal Exp $
3
*
4
* Project: OpenCPN
5
* Purpose: Dashboard Plugin
6
* Author: Pavel Kalian
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 __CLOCK_H__
29
#define __CLOCK_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
#include "instrument.h"
45
extern
int
g_iUTCOffset;
// get offset from dashboard_pi.cpp
46
54
class
DashboardInstrument_Clock
:
public
DashboardInstrument_Single
{
55
public
:
56
DashboardInstrument_Clock
(wxWindow *parent, wxWindowID
id
, wxString title,
57
InstrumentProperties
*Properties,
58
DASH_CAP cap_flag = OCPN_DBP_STC_CLK,
59
wxString format = _T(
"%02i:%02i:%02i UTC"
));
60
61
~DashboardInstrument_Clock
(
void
) {}
62
63
void
SetData(DASH_CAP,
double
, wxString);
64
virtual
void
SetUtcTime(wxDateTime value);
65
wxString GetDisplayTime(wxDateTime UTCtime);
66
bool
getUTC() {
return
bUTC; }
67
void
setUTC(
bool
flag) { bUTC = flag; }
68
InstrumentProperties
*m_Properties;
69
70
private
:
71
bool
bUTC;
72
};
73
82
class
DashboardInstrument_Moon
:
public
DashboardInstrument_Clock
{
83
public
:
84
DashboardInstrument_Moon
(wxWindow *parent, wxWindowID
id
, wxString title,
85
InstrumentProperties
*Properties);
86
~DashboardInstrument_Moon
() {}
87
88
wxSize GetSize(
int
orient, wxSize hint);
89
void
SetData(DASH_CAP,
double
, wxString);
90
void
Draw(wxGCDC *dc);
91
void
SetUtcTime(wxDateTime value);
92
93
private
:
94
int
moon_phase(
int
y,
int
m,
int
d);
95
int
m_phase;
96
int
m_radius;
97
wxString m_hemisphere;
98
};
99
103
class
DashboardInstrument_Sun
:
public
DashboardInstrument_Clock
{
104
public
:
105
DashboardInstrument_Sun
(wxWindow *parent, wxWindowID
id
, wxString title,
106
InstrumentProperties
*Properties,
107
wxString format = _T(
"%02i:%02i:%02i UTC"
));
108
109
~DashboardInstrument_Sun
() {}
110
111
wxSize GetSize(
int
orient, wxSize hint);
112
void
Draw(wxGCDC *dc);
113
void
SetData(DASH_CAP st,
double
data, wxString
unit
);
114
void
SetUtcTime(wxDateTime value);
115
116
private
:
117
wxString m_sunrise;
118
wxString m_sunset;
119
double
m_lat;
120
double
m_lon;
121
wxDateTime m_dt;
122
123
void
calculateSun(
double
latit,
double
longit, wxDateTime &sunrise,
124
wxDateTime &sunset);
125
};
126
130
class
DashboardInstrument_CPUClock
:
public
DashboardInstrument_Clock
{
131
public
:
132
DashboardInstrument_CPUClock
(wxWindow *parent, wxWindowID
id
, wxString title,
133
InstrumentProperties
*Properties,
134
wxString format = _T(
"%02i:%02i:%02i UTC"
));
135
136
~DashboardInstrument_CPUClock
() {}
137
138
void
SetData(DASH_CAP,
double
, wxString);
139
140
void
SetUtcTime(wxDateTime value);
141
};
142
#endif
// __CLOCK_H__
DashboardInstrument_CPUClock
A dashboard instrument that displays the current computer time.
Definition
clock.h:130
DashboardInstrument_Clock
A dashboard instrument that displays the GNSS clock time, if available.
Definition
clock.h:54
DashboardInstrument_Moon
A dashboard instrument that displays current moon phase information.
Definition
clock.h:82
DashboardInstrument_Single
Definition
instrument.h:247
DashboardInstrument_Sun
A dashboard instrument that displays sunrise and sunset times.
Definition
clock.h:103
InstrumentProperties
Definition
instrument.h:129
unit
Definition
TCDataFactory.h:41
plugins
dashboard_pi
src
clock.h
Generated on Sat Mar 1 2025 02:28:51 for OpenCPN Partial API docs by
1.9.8