1 /***************************************************************************
2  *
3  * Project:  OpenCPN
4  *
5  ***************************************************************************
6  *   Copyright (C) 2010 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 __AIS_TARGET_DATA_H__
26 #define __AIS_TARGET_DATA_H__
27 
28 #include <wx/string.h>
29 #include <wx/datetime.h>
30 
31 #include "ais.h"
32 
33 #define SHIP_NAME_LEN  21
34 #define CALL_SIGN_LEN  8
35 #define EURO_VIN_LEN   9
36 
37 void make_hash_ERI(int key, const wxString & description);
38 void clear_hash_ERI( void );
39 
40 
41 
42 class AIS_Target_Data
43 {
44 public:
45 
46     AIS_Target_Data();
47     ~AIS_Target_Data();
48 
49     wxString BuildQueryResult(void);
50     wxString GetRolloverString(void);
51     wxString Get_vessel_type_string(bool b_short = false);
52     wxString Get_class_string(bool b_short = false);
53     wxString GetFullName( void );
54     wxString GetCountryCode(bool b_CntryLongStr);
55     void Toggle_AIS_CPA(void);
56     void ToggleShowTrack(void);
57     void CloneFrom( AIS_Target_Data* q );
58 
59 
60     int                       MID;
61     int                       MMSI;
62     ais_transponder_class     Class;
63     int                       NavStatus;
64     int                       SyncState;
65     int                       SlotTO;
66     double                    SOG;
67     double                    COG;
68     double                    HDG;
69     double                    Lon;
70     double                    Lat;
71     int                       ROTAIS;
72     int                       ROTIND;
73     char                      CallSign[CALL_SIGN_LEN];                // includes terminator
74     char                      ShipName[SHIP_NAME_LEN];
75     char                      ShipNameExtension[15];
76     unsigned char             ShipType;
77     int                       IMO;
78 
79     int                       DimA;
80     int                       DimB;
81     int                       DimC;
82     int                       DimD;
83 
84     double                    Euro_Length;            // Extensions for European Inland AIS
85     double                    Euro_Beam;
86     double                    Euro_Draft;
87     char                      Euro_VIN[EURO_VIN_LEN];	      // includes terminator
88     int                       UN_shiptype;
89     bool                      b_isEuroInland;
90     bool                      b_hasInlandDac;  // intermediate storage for EU Inland. SignalK
91     bool                      b_blue_paddle;
92     int                       blue_paddle;
93 
94     int                       ETA_Mo;
95     int                       ETA_Day;
96     int                       ETA_Hr;
97     int                       ETA_Min;
98 
99     double                    Draft;
100 
101     char                      Destination[21];
102 
103     time_t                    PositionReportTicks;
104     time_t                    StaticReportTicks;
105 
106     int                       RecentPeriod;
107     bool                      b_active;
108     bool                      b_lost;
109     bool                      b_removed;
110     ais_alert_type            n_alert_state;
111     bool                      b_suppress_audio;
112     bool                      b_positionDoubtful;
113     bool                      b_positionOnceValid;
114     bool                      b_nameValid;
115 
116     //                     MMSI Properties
117     bool                      b_NoTrack;
118     bool                      b_OwnShip;
119     bool                      b_PersistTrack;
120 
121     int                       m_utc_hour;
122     int                       m_utc_min;
123     int                       m_utc_sec;
124     wxString                  m_date_string;
125 
126     wxDateTime                m_ack_time;
127     bool                      b_in_ack_timeout;
128 
129     double                    Range_NM;
130     double                    Brg;
131 
132     wxString                  MSG_14_text;
133 
134     //      Per target collision parameters
135     bool                      bCPA_Valid;
136     double                    TCPA;                     // Minutes
137     double                    CPA;                      // Nautical Miles
138 
139     bool                      b_show_AIS_CPA;           //TR 2012.06.28: Show AIS-CPA
140 
141     bool                      b_show_track;
142 
143     AISTargetTrackList        *m_ptrack;
144 
145     AIS_Area_Notice_Hash     area_notices;
146     bool                     b_SarAircraftPosnReport;
147     int                      altitude;                  // Metres, from special position report(9)
148     bool                     b_nameFromCache;
149     float                    importance;
150     short                    last_scale[AIS_TARGETDATA_MAX_CANVAS]; // where AIS_TARGETDATA_MAX_CANVAS is the max number of chartcanvas
151 
152 };
153 
154 #endif
155