1 /******************************************************************************
2  *
3  * Project:  OpenCPN
4  *
5  ***************************************************************************
6  *   Copyright (C) 2013 by David S. Register                               *
7  *                                                                         *
8  *   This program is free software; you can redistribute it and/or modify  *
9  *   it under the terms of the GNU General Public License as published by  *
10  *   the Free Software Foundation; either version 2 of the License, or     *
11  *   (at your option) any later version.                                   *
12  *                                                                         *
13  *   This program is distributed in the hope that it will be useful,       *
14  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
15  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
16  *   GNU General Public License for more details.                          *
17  *                                                                         *
18  *   You should have received a copy of the GNU General Public License     *
19  *   along with this program; if not, write to the                         *
20  *   Free Software Foundation, Inc.,                                       *
21  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,  USA.         *
22  ***************************************************************************
23  */
24 
25 #ifndef __IDX_ENTRY_H__
26 #define __IDX_ENTRY_H__
27 
28 #include <wx/dynarray.h>
29 
30 #define MAXNAMELEN 90
31 
32 class TCDataSource;
33 class Station_Data;
34 
35 typedef enum {
36     SOURCE_TYPE_UNKNOWN,
37     SOURCE_TYPE_ASCII_HARMONIC,
38     SOURCE_TYPE_BINARY_HARMONIC,
39 } source_data_t;
40 
41 class IDX_entry
42 {
43 public:
44     IDX_entry();
45     ~IDX_entry();
46 
47     source_data_t       source_data_type;
48     TCDataSource        *pDataSource;
49     char                source_ident[MAXNAMELEN];       // actually, the file name
50 
51     int       IDX_rec_num;                   // Keeps track of multiple entries w/same name
52     char      IDX_type;                      // Entry "TCtcIUu" identifier
53     char      IDX_zone[40];                  // Alpha region/country/state ID
54     char      IDX_station_name[MAXNAMELEN];  // Name of station
55     double    IDX_lon;                       // Longitude (+East)
56     double    IDX_lat;                       // Latitude (+North)
57     int       IDX_ht_time_off;               // High tide offset in minutes
58     float     IDX_ht_mpy;                    // High tide multiplier (nom 1.0)
59     float     IDX_ht_off;                    // High tide level offset (feet?)
60     int       IDX_lt_time_off;               // Low tide offset in minutes
61     float     IDX_lt_mpy;                    // Low tide multiplier (nom 1.0)
62     float     IDX_lt_off;                    // Low tide level offset (feet?)
63     int       IDX_sta_num;                   // Subordinate station number, **UNUSED**
64     int       IDX_flood_dir;                 // Added DSR opencpn
65     int       IDX_ebb_dir;
66     int       IDX_Useable;
67     int       Valid15;
68     float     Value15;
69     float     Dir15;
70     bool      Ret15;
71     char     *IDX_tzname;                    // Timezone name
72     int       IDX_ref_file_num;              // # of reference file where reference station is
73     char      IDX_reference_name[MAXNAMELEN];// Name of reference station
74     int       IDX_ref_dbIndex;               // tcd index of reference station
75     double    max_amplitude;
76     int       have_offsets;
77     int       station_tz_offset;             // Offset in seconds to convert from harmonic data (epochs) to
78                                              // the station time zone.  Depends on Master Station reference only.
79                                              // For ASCII data, typically 0
80                                              // For Binary data, probably -(IDX_time_zone * 60)-(tiderec->zone_offset * 3600)
81     int       IDX_time_zone;                 // Station location minutes offset from UTC
82 
83 
84     Station_Data   *pref_sta_data;           // Pointer to the Reference Station Data
85 
86     int         num_nodes;                   // These are copies of relevant data pointers
87     int         num_csts;                    // allocated during invariant harmonic loading
88     int         num_epochs;                  // and owned by the DataSource
89     double      *m_cst_speeds;
90     double      **m_cst_nodes;
91     double      **m_cst_epochs;
92     double      *m_work_buffer;
93     int         first_year;
94     time_t      epoch;
95     int         epoch_year;
96 
97     // Cached values
98     time_t      recent_highlow_calc_time;
99     float       recent_high_level;
100     time_t      recent_high_time;
101     float       recent_low_level;
102     time_t      recent_low_time;
103 
104 };
105 
106 WX_DECLARE_OBJARRAY(IDX_entry, ArrayOfIDXEntry);
107 
108 #endif
109