-
Notifications
You must be signed in to change notification settings - Fork 0
/
tidedata.h
77 lines (68 loc) · 2.44 KB
/
tidedata.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef TIDEDATA_H
#define TIDEDATA_H
#include <qstring.h>
class TidalLevel
{
public:
TidalLevel(const QString &line);
bool isOk() const { return ok; }
double getLat() const { return lat; }
double getLon() const { return lon; }
QString getChart() const { return chart; }
QString getName() const { return name; }
float getMHWS() const { return mhws; }
float getMHWN() const { return mhwn; }
float getMLWN() const { return mlwn; }
float getMLWS() const { return mlws; }
// The current level is calculated externally by TideCalc
// but this is a convenient place to store the result
void setCurrentLevel(float lv) { current_level = lv; }
float getCurrentLevel() const { return current_level; }
private:
bool ok;
QString chart, name;
double lat, lon;
float mhws, mhwn, mlwn, mlws;
float current_level;
};
#define TIDALSTREAM_NUMRATES 13 // 6 before HW, one at HW, 6 after HW
class TidalStream
{
public:
TidalStream(const QString &line);
bool isOk() const { return ok; }
double getLat() const { return lat; }
double getLon() const { return lon; }
QString getChart() const { return chart; }
QString getName() const { return name; }
QString getRef() const { return ref; } // times are referenced to this place
bool refAtHW() const { return refHW; } // when the location is at High Water
bool getStreamMinsFromRef(double minutes, float *bearing, float *springRate, float *neapRate);
bool getStreamMinsFromRefAndMoon(double minsfromref, double fractionFromSpring, float *bearing, float *rate);
float getCurrentBearing() const { return current_bearing; }
float getCurrentRate() const { return current_rate; }
private:
bool ok;
QString chart, name, ref;
bool refHW;
double lat, lon;
float bearing[TIDALSTREAM_NUMRATES];
float springRate[TIDALSTREAM_NUMRATES];
float neapRate[TIDALSTREAM_NUMRATES];
float bearing_coeff[TIDALSTREAM_NUMRATES];
float spring_coeff[TIDALSTREAM_NUMRATES];
float neap_coeff[TIDALSTREAM_NUMRATES];
float xspring[TIDALSTREAM_NUMRATES];
float xneap[TIDALSTREAM_NUMRATES];
float yspring[TIDALSTREAM_NUMRATES];
float yneap[TIDALSTREAM_NUMRATES];
float xspring_coeff[TIDALSTREAM_NUMRATES];
float xneap_coeff[TIDALSTREAM_NUMRATES];
float yspring_coeff[TIDALSTREAM_NUMRATES];
float yneap_coeff[TIDALSTREAM_NUMRATES];
static const float hour[TIDALSTREAM_NUMRATES];
static const float cspline_natural;
float current_bearing;
float current_rate;
};
#endif // TIDEDATA_H