34 const wxPoint& pos,
const wxSize& size,
long style)
35 : wxListCtrl(parent, id, pos, size, style) {
39OCPNListCtrl::~OCPNListCtrl() {
40 g_AisTargetList_column_spec.Clear();
41 for (
int i = 0; i < tlSOG + 1; i++) {
45 sitem.Printf(
"%d;", item.m_width);
46 g_AisTargetList_column_spec += sitem;
49#ifdef wxHAS_LISTCTRL_COLUMN_ORDER
50 int i_columns = GetColumnCount();
51 wxArrayInt a_order(i_columns);
52 a_order = GetColumnsOrder();
53 g_AisTargetList_column_order.Clear();
54 for (
int i = 0; i < i_columns; i++) {
56 sitem.Printf(
"%d;", a_order[i]);
57 g_AisTargetList_column_order += sitem;
62wxString OCPNListCtrl::OnGetItemText(
long item,
long column)
const {
65 if (m_parent->m_pListCtrlAISTargets) {
66 auto pAISTarget = m_parent->GetpTarget(item);
67 if (pAISTarget) ret = GetTargetColumnData(pAISTarget.get(), column);
73int OCPNListCtrl::OnGetItemColumnImage(
long item,
long column)
const {
77wxString OCPNListCtrl::GetTargetColumnData(
AisTargetData* pAISTarget,
84 if ((pAISTarget->Class == AIS_ATON) ||
85 (pAISTarget->Class == AIS_BASE) || (pAISTarget->Class == AIS_METEO))
87 else if (pAISTarget->b_show_track && !pAISTarget->b_NoTrack)
94 if ((!pAISTarget->b_nameValid && (pAISTarget->Class == AIS_BASE)) ||
95 (pAISTarget->Class == AIS_SART))
98 wxString uret = trimAISField(pAISTarget->ShipName);
99 if (uret ==
"Unknown")
100 ret = wxGetTranslation(uret);
104 if (strlen(pAISTarget->ShipNameExtension))
105 ret.Append(wxString(pAISTarget->ShipNameExtension, wxConvUTF8));
110 ret = trimAISField(pAISTarget->CallSign);
114 if (pAISTarget->Class != AIS_GPSG_BUDDY)
115 ret.Printf(
"%09d", abs(pAISTarget->MMSI));
121 if (pAISTarget->b_SarAircraftPosnReport) {
122 int airtype = (pAISTarget->MMSI % 1000) / 100;
123 ret = airtype == 5 ? _(
"SAR Helicopter") : _(
"SAR Aircraft");
125 ret = wxGetTranslation(pAISTarget->Get_class_string(
true));
129 if ((pAISTarget->Class == AIS_BASE) ||
130 (pAISTarget->Class == AIS_SART) ||
131 (pAISTarget->Class == AIS_METEO) ||
132 pAISTarget->b_SarAircraftPosnReport)
135 ret = wxGetTranslation(pAISTarget->Get_vessel_type_string(
false));
139 if (pAISTarget->Class == AIS_SART) {
140 if (pAISTarget->NavStatus == RESERVED_14)
142 else if (pAISTarget->NavStatus == UNDEFINED)
145 if ((pAISTarget->NavStatus <= 20) && (pAISTarget->NavStatus >= 0))
146 ret = wxGetTranslation(ais_get_status(pAISTarget->NavStatus));
151 if ((pAISTarget->Class == AIS_ATON) ||
152 (pAISTarget->Class == AIS_BASE) ||
153 (pAISTarget->Class == AIS_CLASS_B) ||
154 (pAISTarget->Class == AIS_METEO) ||
155 pAISTarget->b_SarAircraftPosnReport)
161 if (pAISTarget->b_positionOnceValid &&
bGPSValid &&
162 (pAISTarget->Brg >= 0.) && (fabs(pAISTarget->Lat) < 85.)) {
163 int brg = (int)wxRound(pAISTarget->Brg);
164 if (pAISTarget->Brg > 359.5) brg = 0;
166 ret.Printf(
"%03d", brg);
173 if ((pAISTarget->COG >= 360.0) || (pAISTarget->Class == AIS_ATON) ||
174 (pAISTarget->Class == AIS_BASE) || (pAISTarget->Class == AIS_METEO))
177 int crs = wxRound(pAISTarget->COG);
181 ret.Printf(
" %03d", crs);
187 if (((pAISTarget->SOG > 100.) &&
188 !pAISTarget->b_SarAircraftPosnReport) ||
189 (pAISTarget->Class == AIS_ATON) ||
190 (pAISTarget->Class == AIS_BASE) || (pAISTarget->Class == AIS_METEO))
193 ret.Printf(
"%5.1f", toUsrSpeed(pAISTarget->SOG));
197 if ((!pAISTarget->bCPA_Valid) || (pAISTarget->Class == AIS_ATON) ||
198 (pAISTarget->Class == AIS_BASE) || (pAISTarget->Class == AIS_METEO))
205 if ((!pAISTarget->bCPA_Valid) || (pAISTarget->Class == AIS_ATON) ||
206 (pAISTarget->Class == AIS_BASE) || (pAISTarget->Class == AIS_METEO))
209 ret.Printf(
"%5.0f", pAISTarget->TCPA);
213 if (pAISTarget->b_positionOnceValid &&
bGPSValid &&
214 (pAISTarget->Range_NM >= 0.))
221 ret = wxGetTranslation(pAISTarget->GetCountryCode(
true));
Global state for AIS decoder.
Dialog for displaying a list of AIS targets.
double toUsrDistance(double nm_distance, int unit)
Convert a distance from nautical miles (NMi) to user display units.
Navigation Utility Functions without GUI dependencies.
AIS info display component.
bool bGPSValid
Indicate whether the Global Navigation Satellite System (GNSS) has a valid position.
Position, course, speed, etc.