30#include <wx/dcmemory.h>
32#include <wx/glcanvas.h>
33#include <wx/notebook.h>
37#include "model/ais_decoder.h"
39#include "model/idents.h"
40#include "model/multiplexer.h"
42#include "model/own_ship.h"
44#include "model/route.h"
45#include "model/track.h"
52#include "glChartCanvas.h"
56#include "OCPN_AUIManager.h"
57#include "ocpn_frame.h"
58#include "OCPNPlatform.h"
62#include "pluginmanager.h"
63#include "routemanagerdialog.h"
64#include "routeman_gui.h"
66#include "SoundFactory.h"
68#include "SystemCmdSound.h"
70#include "waypointman_gui.h"
71#include "shapefile_basemap.h"
78#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
79extern wxLocale* plocale_def_lang;
88extern bool g_bShowChartBar;
92extern RouteList* pRouteList;
93extern std::vector<Track*> g_TrackList;
95extern s52plib* ps52plib;
96extern wxString ChartListFileName;
98extern ColorScheme global_color_scheme;
99extern wxArrayString g_locale_catalog_array;
100extern int g_GUIScaleFactor;
101extern int g_ChartScaleFactor;
105extern int g_chart_zoom_modifier_raster;
106extern int g_chart_zoom_modifier_vector;
108extern bool g_bopengl;
110extern ChartGroupArray* g_pGroupArray;
114extern unsigned int g_canvasConfig;
116extern wxString g_CmdSoundString;
118unsigned int gs_plib_flags;
121extern bool g_bquiting;
122extern bool g_disable_main_toolbar;
123extern bool g_btenhertz;
124extern bool g_CanvasHideNotificationIcon;
126WX_DEFINE_ARRAY_PTR(
ChartCanvas*, arrayofCanvasPtr);
127extern arrayofCanvasPtr g_canvasArray;
129void NotifySetupOptionsPlugin(
const PlugInData* pic);
144 wxItemKind kind, wxString shortHelp, wxString longHelp,
145 wxObject* clientData,
int position,
int tool_sel,
148 return s_ppim->AddToolbarTool(label, bitmap, bmpRollover, kind, shortHelp,
149 longHelp, clientData, position, tool_sel,
156 if (s_ppim) s_ppim->RemoveToolbarTool(tool_id);
160 if (s_ppim) s_ppim->SetToolbarToolViz(item, viz);
164 if (s_ppim) s_ppim->SetToolbarItemState(item, toggle);
168 if (s_ppim) s_ppim->SetToolbarItemBitmaps(item, bitmap, bmpRollover);
172 wxString SVGfileRollover, wxString SVGfileToggled,
173 wxItemKind kind, wxString shortHelp, wxString longHelp,
174 wxObject* clientData,
int position,
int tool_sel,
177 return s_ppim->AddToolbarTool(label, SVGfile, SVGfileRollover,
178 SVGfileToggled, kind, shortHelp, longHelp,
179 clientData, position, tool_sel, pplugin);
185 wxString SVGfileRollover,
186 wxString SVGfileToggled) {
188 s_ppim->SetToolbarItemBitmaps(item, SVGfile, SVGfileRollover,
196 return s_ppim->AddCanvasContextMenuItem(pitem, pplugin, name);
202 if (s_ppim) s_ppim->SetCanvasContextMenuItemViz(item, viz, name);
206 if (s_ppim) s_ppim->SetCanvasContextMenuItemGrey(item, grey, name);
210 if (s_ppim) s_ppim->RemoveCanvasContextMenuItem(item, name);
228int AddCanvasContextMenuItemExt(wxMenuItem* pitem,
opencpn_plugin* pplugin,
229 const std::string object_type) {
237 return reinterpret_cast<wxFileConfig*
>(
244 wxWindow* pret = NULL;
246 MyFrame* pFrame = s_ppim->GetParentFrame();
247 pret = (wxWindow*)pFrame->GetPrimaryCanvas();
253 if (win) win->Refresh(
true);
313 return FontMgr::Get().
GetFont(TextElement, default_size);
316wxFont* GetOCPNScaledFont_PlugIn(wxString TextElement,
int default_size) {
321 return g_Platform->GetToolbarScaleFactor(GUIScaleFactor);
325 return g_Platform->GetToolbarScaleFactor(g_GUIScaleFactor);
329 return g_Platform->GetChartScaleFactorExp(g_ChartScaleFactor);
337 return FontMgr::Get().
AddAuxKey(TextElement);
342 return g_StyleManager->GetCurrentStyle()->name;
348 unsigned int height) {
349 wxBitmap bmp = LoadSVG(filename, width, height);
357 SVGDocumentPixelSize(filename, w, h);
358 if (w == 0 || h == 0) {
365 return LoadSVG(filename, w, h);
376 return g_Platform->GetSharedDataDirPtr();
380 if (!g_pAIS)
return NULL;
382 ArrayOfPlugIn_AIS_Targets* pret =
new ArrayOfPlugIn_AIS_Targets;
385 for (
const auto& it : g_pAIS->GetTargetList()) {
394 td.n_alarm_state = AIS_ALARM_SET;
404 SendMessageToAllPlugins(message_id, message_body);
412 Nevent.SetID(message_id);
413 Nevent.SetJSONText(message_body);
414 gFrame->GetEventHandler()->AddPendingEvent(Nevent);
420 gFrame->JumpToPosition(gFrame->GetFocusCanvas(), lat, lon,
scale);
425#if wxUSE_XLOCALE || !wxCHECK_VERSION(3, 0, 0)
427 if (plocale_def_lang) {
429 g_locale_catalog_array.Add(catalog);
431 return plocale_def_lang->AddCatalog(catalog);
441 std::string full_sentence = buf.ToStdString();
443 if ((full_sentence[0] ==
'$') || (full_sentence[0] ==
'!')) {
444 std::string identifier;
446 identifier = full_sentence.substr(1, 5);
450 auto address = std::make_shared<NavAddr0183>(
"virtual");
452 std::make_shared<const Nmea0183Msg>(identifier, full_sentence, address);
453 auto msg_all = std::make_shared<const Nmea0183Msg>(*msg,
"ALL");
455 auto& msgbus = NavMsgBus::GetInstance();
457 msgbus.Notify(std::move(msg));
458 msgbus.Notify(std::move(msg_all));
464 wxXmlDocument doc = ChartData->GetXMLDescription(dbIndex, b_getGeom);
470 bool b_ProgressDialog) {
472 ArrayOfCDI ChartDirArray;
473 for (
unsigned int i = 0; i < dir_array.GetCount(); i++) {
474 wxString dirname = dir_array[i];
476 cdi.fullpath = dirname;
477 cdi.magic_number = _T(
"");
478 ChartDirArray.Add(cdi);
480 bool b_ret = gFrame->UpdateChartDatabaseInplace(ChartDirArray, b_force_update,
482 ChartData->GetDBFileName());
483 gFrame->ChartsRefresh();
488 return ChartData->GetChartDirArrayString();
493 wxFileName fn(full_path);
494 wxString fdir = fn.GetPath();
498 bret = ChartData->AddSingleChart(full_path);
502 pConfig->UpdateChartDirs(ChartData->GetChartDirArray());
503 ChartData->SaveBinary(ChartListFileName);
506 ArrayOfCDI XnewChartDirArray;
507 pConfig->LoadChartDirArray(XnewChartDirArray);
510 ChartData->
LoadBinary(ChartListFileName, XnewChartDirArray);
513 if (g_pGroupArray) ChartData->ApplyGroupArray(g_pGroupArray);
515 if (g_options && g_options->IsShown())
516 g_options->UpdateDisplayedChartDirList(ChartData->GetChartDirArray());
518 if (b_RefreshCanvas || !gFrame->GetPrimaryCanvas()->GetQuiltMode()) {
519 gFrame->ChartsRefresh();
529 bret = ChartData->RemoveSingleChart(full_path);
532 pConfig->UpdateChartDirs(ChartData->GetChartDirArray());
533 ChartData->SaveBinary(ChartListFileName);
536 ArrayOfCDI XnewChartDirArray;
537 pConfig->LoadChartDirArray(XnewChartDirArray);
540 ChartData->
LoadBinary(ChartListFileName, XnewChartDirArray);
543 if (g_pGroupArray) ChartData->ApplyGroupArray(g_pGroupArray);
545 if (g_options && g_options->IsShown())
546 g_options->UpdateDisplayedChartDirList(ChartData->GetChartDirArray());
548 gFrame->ChartsRefresh();
558 if (!g_pOptions)
return NULL;
563 parentid = g_pOptions->m_pageDisplay;
566 parentid = g_pOptions->m_pageConnections;
569 parentid = g_pOptions->m_pageCharts;
572 parentid = g_pOptions->m_pageShips;
575 parentid = g_pOptions->m_pageUI;
578 parentid = g_pOptions->m_pagePlugins;
582 _T(
"Error in PluginManager::AddOptionsPage: Unknown parent"));
587 return g_pOptions->AddPage(parentid, title);
591 if (!g_pOptions)
return false;
592 return g_pOptions->DeletePluginPage(page);
596 wxString* accumulator) {
597 if (!pos)
return false;
600 AisError nerr = AIS_GENERIC_ERROR;
601 if (g_pAIS) nerr = g_pAIS->DecodeSingleVDO(str, &gpd, accumulator);
602 if (nerr == AIS_NoError) {
623 if (g_bShowChartBar) {
625 if (cc && cc->GetPiano()) {
626 val = cc->GetPiano()->GetHeight();
632bool GetRoutepointGPX(
RoutePoint* pRoutePoint,
char* buffer,
633 unsigned int buffer_length) {
637 pgpx->AddGPXWaypoint(pRoutePoint);
638 wxString gpxfilename = wxFileName::CreateTempFileName(wxT(
"gpx"));
639 pgpx->SaveFile(gpxfilename);
642 wxFFile gpxfile(gpxfilename);
644 if (gpxfile.ReadAll(&s)) {
645 if (s.Length() < buffer_length) {
646 strncpy(buffer, (
const char*)s.mb_str(wxConvUTF8), buffer_length - 1);
652 ::wxRemoveFile(gpxfilename);
658 if (g_pRouteMan->IsAnyRouteActive())
659 return GetRoutepointGPX(g_pRouteMan->GetpActivePoint(), buffer,
666 double dist,
double* dlat,
668 PositionBearingDistanceMercator(lat, lon, brg, dist, dlat, dlon);
672 double lon1,
double* brg,
double* dist) {
673 DistanceBearingMercator(lat0, lon0, lat1, lon1, brg, dist);
678 return DistGreatCircle(slat, slon, dlat, dlon);
681void toTM_Plugin(
float lat,
float lon,
float lat0,
float lon0,
double* x,
683 toTM(lat, lon, lat0, lon0, x, y);
686void fromTM_Plugin(
double x,
double y,
double lat0,
double lon0,
double* lat,
688 fromTM(x, y, lat0, lon0, lat, lon);
691void toSM_Plugin(
double lat,
double lon,
double lat0,
double lon0,
double* x,
693 toSM(lat, lon, lat0, lon0, x, y);
696void fromSM_Plugin(
double x,
double y,
double lat0,
double lon0,
double* lat,
698 fromSM(x, y, lat0, lon0, lat, lon);
702 double* x,
double* y) {
703 toSM_ECC(lat, lon, lat0, lon0, x, y);
707 double* lat,
double* lon) {
708 fromSM_ECC(x, y, lat0, lon0, lat, lon);
712 return toUsrDistance(nm_distance,
unit);
716 return fromUsrDistance(usr_distance,
unit);
720 return toUsrSpeed(kts_speed,
unit);
724 return toUsrWindSpeed(kts_speed,
unit);
728 return fromUsrSpeed(usr_speed,
unit);
732 return fromUsrWindSpeed(usr_wspeed,
unit);
736 return toUsrTemp(cel_temp,
unit);
740 return fromUsrTemp(usr_temp,
unit);
744 return getUsrDistanceUnit(
unit);
750 return getUsrWindSpeedUnit(
unit);
759 return toUsrDepth(m_depth,
unit);
763 return fromUsrDepth(usr_depth,
unit);
777 static bool loaded =
false;
779 gshhsCrossesLandInit();
782 return gshhsCrossesLand(lat1, lon1, lat2, lon2);
798 const wxString& icon_ident,
799 const wxString& wp_name,
800 const wxString& GUID) {
801 wxDateTime now = wxDateTime::Now();
812PlugIn_Waypoint::~PlugIn_Waypoint() {}
815PlugIn_Route::PlugIn_Route(
void) {
pWaypointList =
new Plugin_WaypointList; }
817PlugIn_Route::~PlugIn_Route(
void) {
825PlugIn_Track::PlugIn_Track(
void) {
pWaypointList =
new Plugin_WaypointList; }
827PlugIn_Track::~PlugIn_Track(
void) {
837 wxString description) {
838 wxImage image = pimage->ConvertToImage();
839 WayPointmanGui(*pWayPointMan).ProcessIcon(image, key, description);
848 wxPlugin_HyperlinkListNode* linknode = src->
m_HyperlinkList->GetFirst();
854 h->Link = link->
Link;
855 h->LType = link->
Type;
859 linknode = linknode->GetNext();
869 bool b_unique =
true;
870 wxRoutePointListNode* prpnode = pWayPointMan->GetWaypointList()->GetFirst();
878 prpnode = prpnode->GetNext();
881 if (!b_unique)
return false;
889 cloneHyperlinkList(pWP, pwaypoint);
899 pWP->
m_btemp = (b_permanent ==
false);
901 pSelect->AddSelectableRoutePoint(pwaypoint->
m_lat, pwaypoint->
m_lon, pWP);
904 NavObj_dB::GetInstance().InsertRoutePoint(pWP);
907 if (pRouteManagerDialog && pRouteManagerDialog->IsShown())
908 pRouteManagerDialog->UpdateWptListCtrl();
915 bool b_found =
false;
916 RoutePoint* prp = pWayPointMan->FindRoutePointByGUID(GUID);
918 if (prp) b_found =
true;
921 pWayPointMan->DestroyWaypoint(prp);
922 if (pRouteManagerDialog && pRouteManagerDialog->IsShown())
923 pRouteManagerDialog->UpdateWptListCtrl();
931 bool b_found =
false;
934 if (prp) b_found =
true;
937 double lat_save = prp->m_lat;
938 double lon_save = prp->m_lon;
940 prp->m_lat = pwaypoint->
m_lat;
941 prp->m_lon = pwaypoint->
m_lon;
954 wxPlugin_HyperlinkListNode* linknode =
961 h->Link = link->
Link;
962 h->LType = link->
Type;
966 linknode = linknode->GetNext();
971 if (prp) prp->ReLoadIcon();
973 auto canvas = gFrame->GetPrimaryCanvas();
974 SelectCtx ctx(canvas->m_bShowNavobjects, canvas->GetCanvasTrueScale(),
975 canvas->GetScaleValue());
977 pSelect->FindSelection(ctx, lat_save, lon_save, SELTYPE_ROUTEPOINT);
979 pFind->m_slat = pwaypoint->
m_lat;
980 pFind->m_slon = pwaypoint->
m_lon;
985 NavObj_dB::GetInstance().UpdateRoutePoint(prp);
988 if (pRouteManagerDialog && pRouteManagerDialog->IsShown())
989 pRouteManagerDialog->UpdateWptListCtrl();
998 dst->
m_lat = src->m_lat;
999 dst->
m_lon = src->m_lon;
1022 h->
Link = link->Link;
1023 h->
Type = link->LType;
1027 linknode = linknode->GetNext();
1034 RoutePoint* prp = pWayPointMan->FindRoutePointByGUID(GUID);
1036 if (!prp)
return false;
1038 PlugInFromRoutePoint(pwaypoint, prp);
1044 wxArrayString result;
1045 const RoutePointList* list = pWayPointMan->GetWaypointList();
1047 wxRoutePointListNode* prpnode = list->GetFirst();
1052 prpnode = prpnode->GetNext();
1059 wxArrayString result;
1060 RouteList* list = pRouteList;
1062 wxRouteListNode* prpnode = list->GetFirst();
1064 Route* proute = prpnode->GetData();
1065 result.Add(proute->
m_GUID);
1067 prpnode = prpnode->GetNext();
1074 wxArrayString result;
1075 for (
Track* ptrack : g_TrackList) {
1076 result.Add(ptrack->m_GUID);
1083 wxArrayString result;
1084 const RoutePointList* list = pWayPointMan->GetWaypointList();
1086 wxRoutePointListNode* prpnode = list->GetFirst();
1101 prpnode = prpnode->GetNext();
1108 wxArrayString result;
1109 RouteList* list = pRouteList;
1111 wxRouteListNode* prpnode = list->GetFirst();
1113 Route* proute = prpnode->GetData();
1116 result.Add(proute->
m_GUID);
1126 prpnode = prpnode->GetNext();
1133 wxArrayString result;
1134 for (
Track* ptrack : g_TrackList) {
1137 result.Add(ptrack->m_GUID);
1140 if (!ptrack->m_bIsInLayer) result.Add(ptrack->m_GUID);
1143 if (ptrack->m_bIsInLayer) result.Add(ptrack->m_GUID);
1152 wxArrayString result;
1154 for (
int i = 0; i < pWayPointMan->GetNumIcons(); i++) {
1155 wxString* ps = pWayPointMan->GetIconKey(i);
1167 wxDateTime plannedDeparture;
1169 wxPlugin_WaypointListNode* pwpnode = proute->
pWaypointList->GetFirst();
1171 pwp = pwpnode->GetData();
1177 cloneHyperlinkList(pWP, pwp);
1182 route->AddPoint(pWP);
1184 pSelect->AddSelectableRoutePoint(pWP->m_lat, pWP->m_lon, pWP);
1187 pSelect->AddSelectableRouteSegment(pWP_src->m_lat, pWP_src->m_lon,
1188 pWP->m_lat, pWP->m_lon, pWP_src, pWP,
1195 pwpnode = pwpnode->GetNext();
1203 if (!proute->
m_GUID.IsEmpty()) {
1206 route->
m_btemp = (b_permanent ==
false);
1208 pRouteList->Append(route);
1212 NavObj_dB::GetInstance().InsertRoute(route);
1214 if (pRouteManagerDialog && pRouteManagerDialog->IsShown())
1215 pRouteManagerDialog->UpdateRouteListCtrl();
1221 bool b_found =
false;
1224 Route* pRoute = g_pRouteMan->FindRouteByGUID(GUID);
1233 bool b_found =
false;
1236 Route* pRoute = g_pRouteMan->FindRouteByGUID(proute->
m_GUID);
1237 if (pRoute) b_found =
true;
1240 bool b_permanent = (pRoute->
m_btemp ==
false);
1255 wxPlugin_WaypointListNode* pwpnode = ptrack->
pWaypointList->GetFirst();
1257 pwp = pwpnode->GetData();
1262 track->AddPoint(pWP);
1265 pSelect->AddSelectableTrackSegment(pWP_src->m_lat, pWP_src->m_lon,
1266 pWP->m_lat, pWP->m_lon, pWP_src, pWP,
1271 pwpnode = pwpnode->GetNext();
1277 track->m_GUID = ptrack->
m_GUID;
1278 track->m_btemp = (b_permanent ==
false);
1280 g_TrackList.push_back(track);
1281 if (b_permanent) NavObj_dB::GetInstance().InsertTrack(track);
1284 if (pRouteManagerDialog && pRouteManagerDialog->IsShown())
1285 pRouteManagerDialog->UpdateTrkListCtrl();
1291 bool b_found =
false;
1294 Track* pTrack = g_pRouteMan->FindTrackByGUID(GUID);
1296 NavObj_dB::GetInstance().DeleteTrack(pTrack);
1301 if (pRouteManagerDialog && pRouteManagerDialog->IsShown())
1302 pRouteManagerDialog->UpdateTrkListCtrl();
1308 bool b_found =
false;
1311 Track* pTrack = g_pRouteMan->FindTrackByGUID(ptrack->
m_GUID);
1312 if (pTrack) b_found =
true;
1315 bool b_permanent = (pTrack->m_btemp ==
false);
1316 NavObj_dB::GetInstance().DeleteTrack(pTrack);
1330 return glChartCanvas::HasNormalizedViewPort(ocpn_vp);
1356 glChartCanvas::NormalizedViewPort(ocpn_vp, lat, lon);
1375 pret->
MMSI = ptarget->MMSI;
1376 pret->
Class = ptarget->Class;
1378 pret->
SOG = ptarget->SOG;
1379 pret->
COG = ptarget->COG;
1380 pret->
HDG = ptarget->HDG;
1381 pret->
Lon = ptarget->Lon;
1382 pret->
Lat = ptarget->Lat;
1383 pret->
ROTAIS = ptarget->ROTAIS;
1384 pret->
ShipType = ptarget->ShipType;
1385 pret->
IMO = ptarget->IMO;
1387 pret->
Range_NM = ptarget->Range_NM;
1388 pret->
Brg = ptarget->Brg;
1392 pret->
TCPA = ptarget->TCPA;
1393 pret->
CPA = ptarget->CPA;
1397 memcpy(pret->CallSign, ptarget->CallSign,
sizeof(ptarget->CallSign) - 1);
1398 memcpy(pret->ShipName, ptarget->ShipName,
sizeof(ptarget->ShipName) - 1);
1417 gFrame->GetPrimaryCanvas()->DoRotateCanvas(rotation);
1423 gFrame->GetPrimaryCanvas()->DoTiltCanvas(tilt);
1427 gFrame->GetPrimaryCanvas()->SetVPProjection(projection);
1430OcpnSound* g_PluginSound = SoundFactory();
1431static void onPlugInPlaySoundExFinished(
void* ptr) {}
1435 bool ok = g_PluginSound->Load(sound_file, deviceIndex);
1437 wxLogWarning(
"Cannot load sound file: %s", sound_file);
1440 auto cmd_sound =
dynamic_cast<SystemCmdSound*
>(g_PluginSound);
1441 if (cmd_sound) cmd_sound->SetCmd(g_CmdSoundString.mb_str(wxConvUTF8));
1443 g_PluginSound->SetFinishedCallback(onPlugInPlaySoundExFinished, NULL);
1444 ok = g_PluginSound->Play();
1446 wxLogWarning(
"Cannot play sound file: %s", sound_file);
1452 return gFrame->GetPrimaryCanvas()->CheckEdgePan(x, y, dragging, margin,
1458 return style->GetIcon(name);
1462 gFrame->GetPrimaryCanvas()->pPlugIn_Cursor = pCursor;
1467 g_options->AddChartDir(path);
1473 g_options->pScanCheckBox->SetValue(
true);
1474 g_options->pUpdateCheckBox->SetValue(
true);
1480 g_options->pUpdateCheckBox->SetValue(
true);
1487 wxString Title, wxString initDir) {
1488 return g_Platform->DoDirSelectorDialog(parent, file_spec, Title, initDir);
1492 wxString Title, wxString initDir,
1493 wxString suggestedName, wxString wildcard) {
1494 return g_Platform->DoFileSelectorDialog(parent, file_spec, Title, initDir,
1495 suggestedName, wildcard);
1518 if (gFrame->GetPrimaryCanvas())
1519 vp.
ref_scale = gFrame->GetPrimaryCanvas()->GetVP().ref_scale;
1530 ViewPort ocpn_vp = CreateCompatibleViewportEx(vp);
1535 AISDraw(dc, ocpn_vp, NULL);
1539 return FontMgr::Get().
SetFontColor(TextElement, color);
1549 wxFontStyle style, wxFontWeight weight,
1550 bool underline,
const wxString& facename,
1551 wxFontEncoding encoding) {
1553 underline, facename, encoding);
1556int PluginGetMinAvailableGshhgQuality() {
1557 return gFrame->GetPrimaryCanvas()->GetMinAvailableGshhgQuality();
1559int PluginGetMaxAvailableGshhgQuality() {
1560 return gFrame->GetPrimaryCanvas()->GetMaxAvailableGshhgQuality();
1565 g_bPluginHandleAutopilotRoute = enable;
1568bool LaunchDefaultBrowser_Plugin(wxString url) {
1569 if (g_Platform) g_Platform->platformLaunchDefaultBrowser(url);
1579 if (cc && cc->GetSelectedRoutePoint()) {
1580 return cc->GetSelectedRoutePoint()->
m_GUID;
1582 return wxEmptyString;
1587 if (cc && cc->GetSelectedRoute()) {
1588 return cc->GetSelectedRoute()->
m_GUID;
1590 return wxEmptyString;
1595 if (cc && cc->GetSelectedTrack()) {
1596 return cc->GetSelectedTrack()->m_GUID;
1598 return wxEmptyString;
1608 std::unique_ptr<PlugIn_Route> r;
1609 Route* route = g_pRouteMan->FindRouteByGUID(GUID);
1610 if (route ==
nullptr)
return r;
1620 src_wp = node->GetData();
1623 PlugInFromRoutePoint(dst_wp, src_wp);
1627 node = node->GetNext();
1638 std::unique_ptr<PlugIn_Track> t;
1640 Track* pTrack = g_pRouteMan->FindTrackByGUID(GUID);
1641 if (!pTrack)
return t;
1643 std::unique_ptr<PlugIn_Track> tk =
1648 dst_track->
m_EndString = pTrack->m_TrackEndString;
1649 dst_track->
m_GUID = pTrack->m_GUID;
1651 for (
int i = 0; i < pTrack->GetnPoints(); i++) {
1656 dst_wp->
m_lat = ptp->m_lat;
1657 dst_wp->
m_lon = ptp->m_lon;
1670 return g_overlayCanvas;
1676 auto oCanvas =
dynamic_cast<ChartCanvas*
>(canvas);
1677 if (oCanvas) gFrame->JumpToPosition(oCanvas, lat, lon,
scale);
1685 ChartCanvas* l_canvas = gFrame->GetCanvasUnderMouse();
1687 for (
unsigned int i = 0; i < g_canvasArray.GetCount(); ++i) {
1688 if (l_canvas == g_canvasArray[i])
return i;
1706 if (g_canvasConfig == 0)
1707 return gFrame->GetPrimaryCanvas();
1709 if ((canvasIndex >= 0) && g_canvasArray[canvasIndex]) {
1710 return g_canvasArray[canvasIndex];
1718 if (g_canvasConfig == 0)
1719 return gFrame->GetPrimaryCanvas()->CheckEdgePan(x, y, dragging, margin,
1722 if ((canvasIndex >= 0) && g_canvasArray[canvasIndex]) {
1723 return g_canvasArray[canvasIndex]->CheckEdgePan(x, y, dragging, margin,
1732 if (g_canvasConfig == 0)
1733 gFrame->GetPrimaryCanvas()->pPlugIn_Cursor = pCursor;
1735 if ((canvasIndex >= 0) && g_canvasArray[canvasIndex]) {
1736 g_canvasArray[canvasIndex]->pPlugIn_Cursor = pCursor;
1742 if (g_canvasConfig == 1)
return 2;
1751 return g_MainToolbar->GetToolbarRect();
1753 return wxRect(0, 0, 1, 1);
1762 g_pRouteMan->ZeroCurrentXTEToActivePoint();
1783 pivp.
lat_min = tvp.GetBBox().GetMinLat();
1784 pivp.
lat_max = tvp.GetBBox().GetMaxLat();
1785 pivp.
lon_min = tvp.GetBBox().GetMinLon();
1786 pivp.
lon_max = tvp.GetBBox().GetMaxLon();
1788 pivp.
bValid = tvp.IsValid();
1793ListOfPI_S57Obj* PlugInManager::GetLightsObjRuleListVisibleAtLatLon(
1795 ListOfPI_S57Obj* list = NULL;
1809 list = picbx->GetLightsObjRuleListVisibleAtLatLon(zlat, zlon, &pi_vp);
1820#include <wx/listimpl.cpp>
1821WX_DEFINE_LIST(Plugin_WaypointExList)
1824PlugIn_Waypoint_Ex::PlugIn_Waypoint_Ex() {
InitDefaults(); }
1826PlugIn_Waypoint_Ex::PlugIn_Waypoint_Ex(
1827 double lat,
double lon,
const wxString& icon_ident,
const wxString& wp_name,
1828 const wxString& GUID,
const double ScaMin,
const bool bNameVisible,
1829 const int nRangeRings,
const double RangeDistance,
1830 const wxColor RangeColor) {
1862 if (!prp)
return false;
1864 if (prp->
m_bIsInRoute && !prp->IsShared())
return false;
1875 wxRouteListNode* node = pRouteList->GetFirst();
1877 Route* proute = node->GetData();
1881 if (prp == pWP) nCount++;
1882 pnode = pnode->GetNext();
1885 node = node->GetNext();
1891PlugIn_Waypoint_Ex::~PlugIn_Waypoint_Ex() {}
1893WX_DEFINE_LIST(Plugin_WaypointExV2List)
1895PlugIn_Waypoint_ExV2::PlugIn_Waypoint_ExV2() {
InitDefaults(); }
1897PlugIn_Waypoint_ExV2::PlugIn_Waypoint_ExV2(
1898 double lat,
double lon,
const wxString& icon_ident,
const wxString& wp_name,
1899 const wxString& GUID,
const double ScaMin,
const double ScaMax,
1900 const bool bNameVisible,
const int nRangeRings,
const double RangeDistance,
1901 const int RangeDistanceUnits,
const wxColor RangeColor,
1902 const double WaypointArrivalRadius,
const bool ShowWaypointRangeRings,
1903 const double PlannedSpeed,
const wxString TideStation) {
1949PlugIn_Waypoint_ExV2::~PlugIn_Waypoint_ExV2() {}
1953 if (!prp)
return false;
1954 if (prp->
m_bIsInRoute && !prp->IsShared())
return false;
1964 wxRouteListNode* node = pRouteList->GetFirst();
1966 Route* proute = node->GetData();
1970 if (prp == pWP) nCount++;
1971 pnode = pnode->GetNext();
1974 node = node->GetNext();
1980PlugIn_Route_ExV2::PlugIn_Route_ExV2() {
1992 wxDateTime now = wxDateTime::Now();
1993 m_GUID = wxString::Format(
"RT%d%d%d%d", (
int)now.GetMillisecond(),
1994 (
int)now.GetSecond(), (
int)now.GetMinute(),
1995 (
int)now.GetHour());
1999PlugIn_Route_ExV2::~PlugIn_Route_ExV2() {
2009 dst->
m_lat = src->m_lat;
2010 dst->
m_lon = src->m_lon;
2011 dst->
IconName = src->GetIconName();
2014 dst->
IconDescription = pWayPointMan->GetIconDescription(src->GetIconName());
2033 h->
Link = link->Link;
2034 h->
Type = link->LType;
2038 linknode = linknode->GetNext();
2052 dst->
scamin = src->GetScaMin();
2056 dst->
scamax = src->GetScaMax();
2065 RoutePoint* prp = pWayPointMan->FindRoutePointByGUID(GUID);
2067 if (!prp)
return false;
2069 PlugInExV2FromRoutePoint(pwaypoint, prp);
2074static void cloneHyperlinkListExV2(
RoutePoint* dst,
2080 wxPlugin_HyperlinkListNode* linknode = src->
m_HyperlinkList->GetFirst();
2086 h->Link = link->
Link;
2087 h->LType = link->
Type;
2091 linknode = linknode->GetNext();
2102 cloneHyperlinkListExV2(pWP, src);
2112 pWP->
m_btemp = (b_permanent ==
false);
2121 pWP->SetScaMin(src->
scamin);
2128 pWP->SetScaMax(src->
scamax);
2130 if (src->
m_ETD.IsValid())
2133 pWP->
SetETD(wxEmptyString);
2143 bool b_unique =
true;
2144 wxRoutePointListNode* prpnode = pWayPointMan->GetWaypointList()->GetFirst();
2152 prpnode = prpnode->GetNext();
2155 if (!b_unique)
return false;
2157 RoutePoint* pWP = CreateNewPoint(pwaypointex, b_permanent);
2159 pWP->SetShowWaypointRangeRings(pwaypointex->
nrange_rings > 0);
2161 pSelect->AddSelectableRoutePoint(pWP->m_lat, pWP->m_lon, pWP);
2164 NavObj_dB::GetInstance().InsertRoutePoint(pWP);
2167 if (pRouteManagerDialog && pRouteManagerDialog->IsShown())
2168 pRouteManagerDialog->UpdateWptListCtrl();
2175 bool b_found =
false;
2178 if (prp) b_found =
true;
2181 double lat_save = prp->m_lat;
2182 double lon_save = prp->m_lon;
2184 prp->m_lat = pwaypoint->
m_lat;
2185 prp->m_lon = pwaypoint->
m_lon;
2186 prp->SetIconName(pwaypoint->
IconName);
2198 wxPlugin_HyperlinkListNode* linknode =
2205 h->Link = link->
Link;
2206 h->LType = link->
Type;
2210 linknode = linknode->GetNext();
2216 prp->SetWaypointRangeRingsNumber(pwaypoint->
nrange_rings);
2221 prp->SetScaMin(pwaypoint->
scamin);
2225 prp->SetShowWaypointRangeRings(pwaypoint->
nrange_rings > 0);
2227 if (prp) prp->ReLoadIcon();
2229 auto canvas = gFrame->GetPrimaryCanvas();
2230 SelectCtx ctx(canvas->m_bShowNavobjects, canvas->GetCanvasTrueScale(),
2231 canvas->GetScaleValue());
2233 pSelect->FindSelection(ctx, lat_save, lon_save, SELTYPE_ROUTEPOINT);
2235 pFind->m_slat = pwaypoint->
m_lat;
2236 pFind->m_slon = pwaypoint->
m_lon;
2241 NavObj_dB::GetInstance().UpdateRoutePoint(prp);
2244 if (pRouteManagerDialog && pRouteManagerDialog->IsShown())
2245 pRouteManagerDialog->UpdateWptListCtrl();
2248 if (pwaypoint->
m_ETD.IsValid())
2251 prp->
SetETD(wxEmptyString);
2254 prp->SetScaMax(pwaypoint->
scamax);
2261 const wxString& GUID) {
2273 wxDateTime plannedDeparture;
2275 wxPlugin_WaypointExV2ListNode* pwpnode = proute->
pWaypointList->GetFirst();
2277 pwaypointex = pwpnode->GetData();
2279 pWP = pWayPointMan->FindRoutePointByGUID(pwaypointex->
m_GUID);
2281 pWP = CreateNewPoint(pwaypointex, b_permanent);
2285 route->AddPoint(pWP);
2287 pSelect->AddSelectableRoutePoint(pWP->m_lat, pWP->m_lon, pWP);
2290 pSelect->AddSelectableRouteSegment(pWP_src->m_lat, pWP_src->m_lon,
2291 pWP->m_lat, pWP->m_lon, pWP_src, pWP,
2298 pwpnode = pwpnode->GetNext();
2306 if (!proute->
m_GUID.IsEmpty()) {
2309 route->
m_btemp = (b_permanent ==
false);
2313 pRouteList->Append(route);
2317 NavObj_dB::GetInstance().InsertRoute(route);
2320 if (pRouteManagerDialog && pRouteManagerDialog->IsShown())
2321 pRouteManagerDialog->UpdateRouteListCtrl();
2327 bool b_found =
false;
2330 Route* pRoute = g_pRouteMan->FindRouteByGUID(proute->
m_GUID);
2331 if (pRoute) b_found =
true;
2334 bool b_permanent = !pRoute->
m_btemp;
2344 std::unique_ptr<PlugIn_Route_ExV2> r;
2345 Route* route = g_pRouteMan->FindRouteByGUID(GUID);
2346 if (route ==
nullptr)
return r;
2355 src_wp = node->GetData();
2358 PlugInExV2FromRoutePoint(dst_wp, src_wp);
2362 node = node->GetNext();
2368 dst_route->
m_isActive = g_pRouteMan->GetpActiveRoute() == route;
2376PlugIn_Route_Ex::PlugIn_Route_Ex(
void) {
2380PlugIn_Route_Ex::~PlugIn_Route_Ex(
void) {
2392 dst->
m_lat = src->m_lat;
2393 dst->
m_lon = src->m_lon;
2394 dst->
IconName = src->GetIconName();
2397 dst->
IconDescription = pWayPointMan->GetIconDescription(src->GetIconName());
2416 h->
Link = link->Link;
2417 h->
Type = link->LType;
2421 linknode = linknode->GetNext();
2433 dst->
scamin = src->GetScaMin();
2438static void cloneHyperlinkListEx(
RoutePoint* dst,
2444 wxPlugin_HyperlinkListNode* linknode = src->
m_HyperlinkList->GetFirst();
2450 h->Link = link->
Link;
2451 h->LType = link->
Type;
2455 linknode = linknode->GetNext();
2466 cloneHyperlinkListEx(pWP, src);
2476 pWP->
m_btemp = (b_permanent ==
false);
2483 pWP->SetScaMin(src->
scamin);
2492 RoutePoint* prp = pWayPointMan->FindRoutePointByGUID(GUID);
2494 if (!prp)
return false;
2496 PlugInExFromRoutePoint(pwaypoint, prp);
2506 bool b_unique =
true;
2507 wxRoutePointListNode* prpnode = pWayPointMan->GetWaypointList()->GetFirst();
2515 prpnode = prpnode->GetNext();
2518 if (!b_unique)
return false;
2520 RoutePoint* pWP = CreateNewPoint(pwaypointex, b_permanent);
2522 pWP->SetShowWaypointRangeRings(pwaypointex->
nrange_rings > 0);
2524 pSelect->AddSelectableRoutePoint(pWP->m_lat, pWP->m_lon, pWP);
2527 NavObj_dB::GetInstance().InsertRoutePoint(pWP);
2529 if (pRouteManagerDialog && pRouteManagerDialog->IsShown())
2530 pRouteManagerDialog->UpdateWptListCtrl();
2537 bool b_found =
false;
2540 if (prp) b_found =
true;
2543 double lat_save = prp->m_lat;
2544 double lon_save = prp->m_lon;
2546 prp->m_lat = pwaypoint->
m_lat;
2547 prp->m_lon = pwaypoint->
m_lon;
2548 prp->SetIconName(pwaypoint->
IconName);
2560 wxPlugin_HyperlinkListNode* linknode =
2567 h->Link = link->
Link;
2568 h->LType = link->
Type;
2572 linknode = linknode->GetNext();
2578 prp->SetWaypointRangeRingsNumber(pwaypoint->
nrange_rings);
2581 prp->SetScaMin(pwaypoint->
scamin);
2585 prp->SetShowWaypointRangeRings(pwaypoint->
nrange_rings > 0);
2587 if (prp) prp->ReLoadIcon();
2589 auto canvas = gFrame->GetPrimaryCanvas();
2590 SelectCtx ctx(canvas->m_bShowNavobjects, canvas->GetCanvasTrueScale(),
2591 canvas->GetScaleValue());
2593 pSelect->FindSelection(ctx, lat_save, lon_save, SELTYPE_ROUTEPOINT);
2595 pFind->m_slat = pwaypoint->
m_lat;
2596 pFind->m_slon = pwaypoint->
m_lon;
2601 NavObj_dB::GetInstance().UpdateRoutePoint(prp);
2604 if (pRouteManagerDialog && pRouteManagerDialog->IsShown())
2605 pRouteManagerDialog->UpdateWptListCtrl();
2617 wxDateTime plannedDeparture;
2619 wxPlugin_WaypointExListNode* pwpnode = proute->
pWaypointList->GetFirst();
2621 pwaypointex = pwpnode->GetData();
2623 pWP = pWayPointMan->FindRoutePointByGUID(pwaypointex->
m_GUID);
2625 pWP = CreateNewPoint(pwaypointex, b_permanent);
2629 route->AddPoint(pWP);
2631 pSelect->AddSelectableRoutePoint(pWP->m_lat, pWP->m_lon, pWP);
2634 pSelect->AddSelectableRouteSegment(pWP_src->m_lat, pWP_src->m_lon,
2635 pWP->m_lat, pWP->m_lon, pWP_src, pWP,
2642 pwpnode = pwpnode->GetNext();
2650 if (!proute->
m_GUID.IsEmpty()) {
2653 route->
m_btemp = (b_permanent ==
false);
2657 pRouteList->Append(route);
2661 NavObj_dB::GetInstance().InsertRoute(route);
2664 if (pRouteManagerDialog && pRouteManagerDialog->IsShown())
2665 pRouteManagerDialog->UpdateRouteListCtrl();
2671 bool b_found =
false;
2674 Route* pRoute = g_pRouteMan->FindRouteByGUID(proute->
m_GUID);
2675 if (pRoute) b_found =
true;
2678 bool b_permanent = !pRoute->
m_btemp;
2693 std::unique_ptr<PlugIn_Route_Ex> r;
2694 Route* route = g_pRouteMan->FindRouteByGUID(GUID);
2695 if (route ==
nullptr)
return r;
2705 src_wp = node->GetData();
2708 PlugInExFromRoutePoint(dst_wp, src_wp);
2712 node = node->GetNext();
2718 dst_route->
m_isActive = g_pRouteMan->GetpActiveRoute() == route;
2727 RoutePoint* rp = g_pRouteMan->GetpActivePoint();
2729 return wxEmptyString;
2736 Route* rt = g_pRouteMan->GetpActiveRoute();
2738 return wxEmptyString;
2748 MyApp& app = wxGetApp();
2749 return (app.m_comm_bridge.GetPriorityMaps());
2753 MyApp& app = wxGetApp();
2754 app.m_comm_bridge.UpdateAndApplyMaps(map);
2758 std::vector<std::string> result;
2760 MyApp& app = wxGetApp();
2763 app.m_comm_bridge.GetPriorityContainer(
"position").active_source;
2764 result.push_back(
id);
2765 id = app.m_comm_bridge.GetPriorityContainer(
"velocity").active_source;
2766 result.push_back(
id);
2767 id = app.m_comm_bridge.GetPriorityContainer(
"heading").active_source;
2768 result.push_back(
id);
2769 id = app.m_comm_bridge.GetPriorityContainer(
"variation").active_source;
2770 result.push_back(
id);
2771 id = app.m_comm_bridge.GetPriorityContainer(
"satellites").active_source;
2772 result.push_back(
id);
2779#if defined(__WXOSX__) || defined(__WXGTK3__)
2781 if (gFrame) rv = gFrame->GetContentScaleFactor();
2786 double scaler = 1.0;
2788 if (gFrame) scaler = (double)(gFrame->ToDIP(100)) / 100.;
2805 bool state = gFrame->IsFullScreen();
2806 if (set_full_screen_on && !state)
2807 gFrame->ToggleFullScreen();
2808 else if (!set_full_screen_on && state)
2809 gFrame->ToggleFullScreen();
2812extern bool g_useMUI;
2814 bool current_mui_state = g_useMUI;
2817 if (enable && !current_mui_state) {
2819 for (
unsigned int i = 0; i < g_canvasArray.GetCount(); i++) {
2821 if (cc) cc->CreateMUIBar();
2823 }
else if (!enable && current_mui_state) {
2825 for (
unsigned int i = 0; i < g_canvasArray.GetCount(); i++) {
2827 if (cc) cc->DestroyMuiBar();
2836 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
2837 if (cc) cc->SetShowGPSCompassWindow(enable);
2843 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
2845 return cc->GetShowGPSCompassWindow();
2852extern bool g_bShowStatusBar;
2854 g_bShowStatusBar = enable;
2855 gFrame->ConfigureStatusBar();
2861 bool current_chartbar_state = g_bShowChartBar;
2862 for (
unsigned int i = 0; i < g_canvasArray.GetCount(); i++) {
2864 if (current_chartbar_state && !enable) {
2865 gFrame->ToggleChartBar(cc);
2866 g_bShowChartBar = current_chartbar_state;
2867 }
else if (!current_chartbar_state && enable) {
2868 gFrame->ToggleChartBar(cc);
2869 g_bShowChartBar = current_chartbar_state;
2872 g_bShowChartBar = enable;
2877extern bool g_bShowMenuBar;
2880 if (g_bShowMenuBar) {
2881 g_bShowMenuBar =
false;
2882 if (gFrame->m_pMenuBar) {
2883 gFrame->SetMenuBar(NULL);
2884 gFrame->m_pMenuBar->Destroy();
2885 gFrame->m_pMenuBar = NULL;
2889 g_bShowMenuBar =
true;
2890 gFrame->BuildMenuBar();
2897 if (ps52plib) ps52plib->m_chartSymbols.UpdateTableColor(table, name, color);
2901 wxColor ret = wxColor(*wxRED);
2903 int i_table = ps52plib->m_chartSymbols.FindColorTable(map_name.c_str());
2904 ret = ps52plib->m_chartSymbols.GetwxColor(name.c_str(), i_table);
2911 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
2912 if (cc) cc->SetShowGrid(enable);
2918 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
2919 if (cc) cc->SetShowOutlines(enable);
2925 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
2926 if (cc) cc->SetShowDepthUnits(enable);
2932 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
2933 if (cc) cc->SetShowAIS(enable);
2939 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
2940 if (cc) cc->ShowTides(enable);
2946 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
2947 if (cc) cc->ShowCurrents(enable);
2953 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
2954 if (cc) cc->SetShowENCText(enable);
2960 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
2961 if (cc) cc->SetShowENCDepth(enable);
2967 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
2968 if (cc) cc->SetShowENCBuoyLabels(enable);
2974 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
2975 if (cc) cc->SetShowENCLights(enable);
2981 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
2982 if (cc) cc->SetShowENCLightDesc(enable);
2987 int valSet = STANDARD;
2990 valSet = DISPLAYBASE;
2999 valSet = MARINERS_STANDARD;
3006 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
3007 if (cc) cc->SetENCDisplayCategory(valSet);
3011 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
3013 return ((
PI_DisCat)cc->GetENCDisplayCategory());
3015 return PI_DisCat::PI_STANDARD;
3019 int newMode = NORTH_UP_MODE;
3021 newMode = COURSE_UP_MODE;
3023 newMode = HEAD_UP_MODE;
3026 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
3027 if (cc) cc->SetUpMode(newMode);
3032 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
3033 if (cc)
return ((
PI_NavMode)cc->GetUpMode());
3035 return PI_NavMode::PI_NORTH_UP_MODE;
3040 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
3041 if (cc)
return (cc->GetShowGrid());
3048 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
3049 if (cc)
return (cc->GetShowOutlines());
3056 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
3057 if (cc)
return (cc->GetShowDepthUnits());
3064 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
3065 if (cc)
return (cc->GetShowAIS());
3072 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
3073 if (cc)
return (cc->GetbShowTide());
3080 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
3081 if (cc)
return (cc->GetbShowCurrent());
3088 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
3089 if (cc)
return (cc->GetShowENCText());
3096 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
3097 if (cc)
return (cc->GetShowENCDepth());
3104 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
3105 if (cc)
return (cc->GetShowENCBuoyLabels());
3112 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
3113 if (cc)
return (cc->GetShowENCLights());
3118bool GetShowENCLightDesc(
int CanvasIndex) {
3120 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
3121 if (cc)
return (cc->GetbShowCurrent());
3132 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
3133 if (cc) cc->ToggleLookahead();
3139 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
3140 if (cc)
return (cc->GetLookahead());
3145extern bool g_bTrackActive;
3147 if (!g_bTrackActive && enable)
3149 else if (g_bTrackActive && !enable)
3155 gFrame->SetAndApplyColorScheme((ColorScheme)cs);
3162 if (win) win->Refresh(eraseBackground);
3166 if (g_canvasConfig == 1) {
3171 gFrame->CreateCanvasLayout();
3172 gFrame->DoChartUpdate();
3177 gFrame->CreateCanvasLayout();
3178 gFrame->DoChartUpdate();
3189 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
3196 g_disable_main_toolbar = !enable;
3197 if (g_MainToolbar) g_MainToolbar->RefreshToolbar();
3201 if (gFrame) gFrame->ScheduleSettingsDialog();
3206 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
3208 bool bfollow = cc->GetbFollow();
3209 cc->ResetOwnshipOffset();
3213 cc->JumpToPosition(gLat, gLon, cc->
GetVPScale());
3220 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
3222 if (cc->GetbFollow() != enable_follow) cc->TogglebFollow();
3229 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
3230 if (cc)
return cc->GetbFollow();
3237 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
3238 if (cc) cc->SetShowFocusBar(enable);
3243 ChartCanvas* cc = g_canvasArray.Item(CanvasIndex);
3244 if (cc)
return (cc->GetShowFocusBar());
3258 pConfig->LoadMyConfigRaw(
false);
3261 pConfig->LoadCanvasConfigs(
false);
3262 auto& config_array = ConfigMgr::Get().GetCanvasConfigArray();
3263 for (
auto pcc : config_array) {
3264 if (pcc && pcc->canvas) {
3265 pcc->canvas->ApplyCanvasConfig(pcc);
3266 pcc->canvas->Refresh();
3276 g_CanvasHideNotificationIcon = !enable;
ChartCanvas - Main chart display and interaction component.
float GetVPScale()
Return the ViewPort scale factor, in physical pixels per meter.
void ZoomCanvasSimple(double factor)
Perform an immediate zoom operation without smooth transitions.
Manages the chart database and provides access to chart data.
bool LoadBinary(const wxString &filename, ArrayOfCDI &dir_array_check)
Load the chart database from a binary file.
Wrapper class for plugin-based charts.
wxFont * FindOrCreateFont(int point_size, wxFontFamily family, wxFontStyle style, wxFontWeight weight, bool underline=false, const wxString &facename=wxEmptyString, wxFontEncoding encoding=wxFONTENCODING_DEFAULT)
Creates or finds a matching font in the font cache.
wxColour GetFontColor(const wxString &TextElement) const
Gets the text color for a UI element.
bool AddAuxKey(wxString key)
Adds new plugin-defined font configuration key.
bool SetFontColor(const wxString &TextElement, const wxColour color) const
Sets the text color for a UI element.
wxFont * GetFont(const wxString &TextElement, int requested_font_size=0)
Gets a font object for a UI element.
static wxString GetUUID(void)
Return a unique RFC4122 version 4 compliant GUID string.
Extended OpenGL-optimized chart base class with additional querying capabilities.
virtual ListOfPI_S57Obj * GetLightsObjRuleListVisibleAtLatLon(float lat, float lon, PlugIn_ViewPort *VPoint)
Gets list of visible light objects at specified position.
Basic data for a loaded plugin, trivially copyable.
AIS target information accessible to plugins.
double HDG
Heading in degrees true.
int ROTAIS
Rate of turn as indicated in AIS message.
unsigned char ShipType
Ship type as per ITU-R M.1371.
double Lat
Latitude in decimal degrees.
int MMSI
Maritime Mobile Service Identity number.
bool bCPA_Valid
True if CPA calculation is valid.
double Brg
Bearing to target in degrees true.
double Lon
Longitude in decimal degrees.
double CPA
Closest Point of Approach in nautical miles.
int Class
AIS class (Class A: 0, Class B: 1)
double SOG
Speed over ground in knots.
double Range_NM
Range to target in nautical miles.
int NavStatus
Navigational status (0-15 as per ITU-R M.1371)
int IMO
IMO ship identification number.
double TCPA
Time to Closest Point of Approach in minutes.
double COG
Course over ground in degrees.
plugin_ais_alarm_type alarm_state
Current alarm state for this target.
Extended position fix information.
int nSats
Number of satellites used in the fix.
double Var
Magnetic variation in degrees, typically from RMC message.
double Cog
Course over ground in degrees.
double Lat
Latitude in decimal degrees.
double Hdm
Heading magnetic in degrees.
time_t FixTime
UTC time of fix.
double Lon
Longitude in decimal degrees.
double Sog
Speed over ground in knots.
double Hdt
Heading true in degrees.
Enhanced route class for working with PlugIn_Waypoint_ExV2 waypoints.
bool m_isVisible
True if route should be displayed.
Plugin_WaypointExV2List * pWaypointList
List of waypoints making up this route in order.
wxString m_StartString
Description of route start point.
wxString m_Description
Optional route description/notes.
wxString m_NameString
User-visible name of the route.
bool m_isActive
True if this is the active route.
wxString m_GUID
Globally unique identifier.
wxString m_EndString
Description of route end point.
Extended route class for managing complex route features.
wxString m_Description
Optional route description/notes.
wxString m_EndString
Description of route end point.
Plugin_WaypointExList * pWaypointList
List of waypoints making up this route in order.
wxString m_NameString
User-visible name of the route.
bool m_isVisible
True if route should be displayed.
wxString m_GUID
Globally unique identifier.
bool m_isActive
True if this is the active route.
wxString m_StartString
Description of route start point.
Plugin route class for managing ordered waypoint collections.
wxString m_GUID
Globally unique identifier.
wxString m_EndString
Name/description of ending point.
wxString m_NameString
Route name.
Plugin_WaypointList * pWaypointList
List of waypoints making up this route in order.
wxString m_StartString
Name/description of starting point.
Plugin track class for managing recorded track data.
Plugin_WaypointList * pWaypointList
List of waypoints making up this track in chronological order.
wxString m_GUID
Globally unique identifier.
wxString m_EndString
Description of track end point/time.
wxString m_StartString
Description of track start point/time.
wxString m_NameString
Display name of the track.
Contains view parameters and status information for a chart display viewport.
double view_scale_ppm
Display scale in pixels per meter.
wxRect rv_rect
Rectangle defining the rendered view area.
int pix_width
Viewport width in pixels.
double lon_max
Maximum longitude of the viewport.
double clon
Center longitude of the viewport in decimal degrees.
double lat_max
Maximum latitude of the viewport.
int pix_height
Viewport height in pixels.
double clat
Center latitude of the viewport in decimal degrees.
double skew
Display skew angle in radians.
double rotation
Display rotation angle in radians.
bool bValid
True if this viewport is valid and can be used for rendering.
double lon_min
Minimum longitude of the viewport.
double lat_min
Minimum latitude of the viewport.
int m_projection_type
Chart projection type (PROJECTION_MERCATOR, etc.)
bool b_quilt
True if the viewport is in quilt mode (showing multiple charts)
float chart_scale
Conventional chart displayed scale (e.g., 1:50000)
wxDateTime m_ETD
Estimated departure time in UTC, or wxInvalidDateTime if not set.
wxString m_MarkDescription
Optional description text.
int GetRouteMembershipCount()
Gets number of routes containing this waypoint.
wxString m_GUID
Globally unique identifier.
wxString m_TideStation
Tide Station Identifier.
void InitDefaults()
Initializes waypoint properties to default values.
wxDateTime m_CreateTime
Creation timestamp in UTC.
bool m_bShowWaypointRangeRings
True to show range rings on chart.
wxString IconDescription
User-friendly description of icon.
double m_lat
Latitude in decimal degrees.
wxColour RangeRingColor
Color to draw range rings.
bool IsActive
Active state (e.g. destination)
Plugin_HyperlinkList * m_HyperlinkList
List of hyperlinks associated with this waypoint.
double scamin
Minimum display scale (1:X) for waypoint visibility.
double scamax
Maximum display scale (1:X) for waypoint visibility.
bool b_useScamin
True to enable scale-dependent visibility.
wxString IconName
Name of icon to use for waypoint symbol.
bool IsNameVisible
True to show waypoint name on chart.
double m_PlannedSpeed
Planned speed for next leg (knots)
double RangeRingSpace
Distance between range rings in preferred units.
double m_lon
Longitude in decimal degrees.
double m_WaypointArrivalRadius
Arrival radius in nautical miles.
int RangeRingSpaceUnits
Units for range ring spacing - 0:nm, 1:km.
wxString m_MarkName
Display name of waypoint.
bool IsVisible
Visibility state on chart.
int nrange_rings
Number of range rings to display around waypoint.
bool GetFSStatus()
Gets "free-standing" status of waypoint.
Extended waypoint class with additional navigation features.
bool GetFSStatus()
Gets "free-standing" status of waypoint.
wxDateTime m_CreateTime
Creation timestamp in UTC.
wxColour RangeRingColor
Color to draw range rings.
int nrange_rings
Number of range rings to display around waypoint.
wxString IconDescription
User-friendly description of icon.
bool b_useScamin
True to enable scale-dependent visibility.
double RangeRingSpace
Distance between range rings in preferred units.
Plugin_HyperlinkList * m_HyperlinkList
List of hyperlinks associated with this waypoint.
wxString m_MarkName
Display name of waypoint.
wxString m_GUID
Globally unique identifier.
double m_lon
Longitude in decimal degrees.
wxString IconName
Name of icon to use for waypoint symbol.
void InitDefaults()
Initializes waypoint properties to default values.
double scamin
Minimum display scale (1:X) for waypoint visibility.
bool IsNameVisible
True to show waypoint name on chart.
double m_lat
Latitude in decimal degrees.
wxString m_MarkDescription
Optional description text.
int GetRouteMembershipCount()
Gets number of routes containing this waypoint.
bool IsActive
Active state (e.g. destination)
bool IsVisible
Visibility state on chart.
Plugin waypoint class providing core waypoint/mark functionality.
double m_lon
Longitude in decimal degrees.
wxString m_IconName
Icon identifier.
wxString m_MarkDescription
Optional description.
wxString m_GUID
Globally unique identifier.
bool m_IsVisible
Visibility state.
PlugIn_Waypoint()
Default constructor - creates waypoint at 0,0.
wxDateTime m_CreateTime
Creation timestamp in UTC.
wxString m_MarkName
Display name.
double m_lat
Latitude in decimal degrees.
Plugin_HyperlinkList * m_HyperlinkList
List of associated hyperlinks.
Class representing a hyperlink associated with a waypoint or route.
wxString Link
The actual URL or file path.
wxString DescrText
User-visible description of the link.
wxString Type
Link type identifier (e.g., "Website", "Chart", "Image")
Represents a waypoint or mark within the navigation system.
HyperlinkList * m_HyperlinkList
List of hyperlinks associated with this waypoint.
wxColour m_wxcWaypointRangeRingsColour
Color for the range rings display.
wxString m_MarkDescription
Description text for the waypoint.
int m_iWaypointRangeRingsNumber
Number of range rings to display around the waypoint.
void SetCreateTime(wxDateTime dt)
Sets the create time of this RoutePoint in UTC.
wxString m_GUID
Globally Unique Identifier for the waypoint.
bool m_bIsolatedMark
Flag indicating if the waypoint is a standalone mark.
bool m_bIsActive
Flag indicating if this waypoint is active for navigation.
wxDateTime GetManualETD()
Retrieves the manually set Estimated Time of Departure for this waypoint, in UTC.
bool m_bIsInRoute
Flag indicating if this waypoint is part of a route.
bool m_bShowName
Flag indicating if the waypoint name should be shown.
double GetPlannedSpeed()
Return the planned speed associated with this waypoint.
bool m_bIsInLayer
Flag indicating if the waypoint belongs to a layer.
bool m_btemp
Flag indicating if this is a temporary waypoint.
int m_iWaypointRangeRingsStepUnits
Units for the range rings step (0=nm, 1=km).
wxDateTime GetCreateTime(void)
Returns the Create Time of this RoutePoint in UTC.
float m_fWaypointRangeRingsStep
Distance between consecutive range rings.
wxString m_TideStation
Associated tide station identifier.
void SetETD(const wxDateTime &etd)
Sets the Estimated Time of Departure for this waypoint, in UTC.
Represents a navigational route in the navigation system.
wxString m_RouteStartString
Name or description of the route's starting point.
wxString m_RouteDescription
Additional descriptive information about the route.
RoutePointList * pRoutePointList
Ordered list of waypoints (RoutePoints) that make up this route.
wxString m_RouteEndString
Name or description of the route's ending point.
bool m_btemp
Flag indicating if this is a temporary route.
wxString m_RouteNameString
User-assigned name for the route.
wxString m_GUID
Globally unique identifier for this route.
wxDateTime m_PlannedDeparture
Planned departure time for the route, in UTC.
bool m_bIsInLayer
Flag indicating whether this route belongs to a layer.
bool DeleteRoute(Route *pRoute)
Manages a set of ShapeBaseChart objects at different resolutions.
Represents a single point in a track.
wxDateTime GetCreateTime(void)
Retrieves the creation timestamp of a track point as a wxDateTime object.
void SetCreateTime(wxDateTime dt)
Sets the creation timestamp for a track point.
Represents a track, which is a series of connected track points.
ViewPort - Core geographic projection and coordinate transformation engine.
double view_scale_ppm
Requested view scale in physical pixels per meter (ppm), before applying projections.
double ref_scale
The nominal scale of the "reference chart" for this view.
int pix_height
Height of the viewport in physical pixels.
void SetBoxes(void)
Computes the bounding box coordinates for the current viewport.
double rotation
Rotation angle of the viewport in radians.
int pix_width
Width of the viewport in physical pixels.
wxPoint2DDouble GetDoublePixFromLL(double lat, double lon)
Convert latitude and longitude on the ViewPort to physical pixel coordinates with double precision.
double skew
Angular distortion (shear transform) applied to the viewport in radians.
void GetLLFromPix(const wxPoint &p, double *lat, double *lon)
Convert physical pixel coordinates on the ViewPort to latitude and longitude.
double clon
Center longitude of the viewport in degrees.
double clat
Center latitude of the viewport in degrees.
wxPoint GetPixFromLL(double lat, double lon)
Convert latitude and longitude on the ViewPort to physical pixel coordinates.
double chart_scale
Chart scale denominator (e.g., 50000 for a 1:50000 scale).
Device context class that can use either wxDC or OpenGL for drawing.
Base class for OpenCPN plugins.
Raw messages layer, supports sending and recieving navmsg messages.
wxFont * GetOCPNScaledFont(wxString item, int default_size)
Retrieves a font from FontMgr, optionally scaled for physical readability.
wxFont GetOCPNGUIScaledFont(wxString item)
Retrieves a font optimized for touch and high-resolution interfaces.
General purpose GUI support.
Class NotificationManager.
PlugIn Object Definition/API.
@ OBJECTS_ALL
Return all objects including those in layers.
@ OBJECTS_ONLY_LAYERS
Return only objects that are in layers.
@ OBJECTS_NO_LAYERS
Exclude objects that are in layers.
plugin_ais_alarm_type
Enumeration of AIS alarm states.
enum _PI_DisCat PI_DisCat
Display categories for S52 chart features.
PI_ColorScheme
Enumeration of color schemes.
@ PI_COURSE_UP_MODE
Course Up Mode - Current course over ground at the top.
@ PI_HEAD_UP_MODE
Head Up Mode - Current vessel heading at the top.
@ PI_OTHER
Other - additional features for detailed navigation.
@ PI_DISPLAYBASE
Display Base - features that must always be shown.
@ PI_STANDARD
Standard - default features for safe navigation.
@ PI_MARINERS_STANDARD
Mariner specified standard features.
enum _PI_NavMode PI_NavMode
Navigation mode options for chart display orientation.
enum _OBJECT_LAYER_REQ OBJECT_LAYER_REQ
Filter options for object queries.
OptionsParentPI
Enum defining parent pages in OpenCPN options dialog where plugins can add panels.
@ PI_OPTIONS_PARENT_DISPLAY
Display settings section.
@ PI_OPTIONS_PARENT_UI
User Interface section.
@ PI_OPTIONS_PARENT_SHIPS
Ships section.
@ PI_OPTIONS_PARENT_CHARTS
Charts section.
@ PI_OPTIONS_PARENT_PLUGINS
Plugins section.
@ PI_OPTIONS_PARENT_CONNECTIONS
Connections section.
void EnableNotificationCanvasIcon(bool enable)
Plugin Notification Framework GUI support.
void SetCanvasContextMenuItemGrey(int item, bool grey)
Sets menu item enabled/disabled state.
bool UpdateSingleWaypoint(PlugIn_Waypoint *pwaypoint)
Updates a single waypoint.
bool PlugInHasNormalizedViewPort(PlugIn_ViewPort *vp)
Checks if viewport has been normalized.
void PluginCenterOwnship(int CanvasIndex)
Center the chart view on the own ship position for a specific canvas.
void SetCanvasRotation(double rotation)
Sets chart display rotation angle.
wxString GetSelectedWaypointGUID_Plugin()
Gets GUID of currently selected waypoint.
int GetChartbarHeight(void)
Gets height of chart bar in pixels.
void RemovePlugInTool(int tool_id)
Removes a tool from OpenCPN's toolbar.
void SetCanvasProjection(int projection)
Sets chart projection type.
wxString * GetpSharedDataLocation(void)
Gets shared application data location.
double toUsrTemp_Plugin(double cel_temp, int unit)
Converts Celsius to user's preferred temperature unit.
wxWindow * PluginGetFocusCanvas()
Gets the currently focused chart canvas.
int AddChartToDBInPlace(wxString &full_path, bool b_RefreshCanvas)
Adds a chart to the database without full rebuild.
void fromSM_Plugin(double x, double y, double lat0, double lon0, double *lat, double *lon)
Converts Simple Mercator coordinates to geographic.
wxWindow * GetOCPNCanvasWindow()
Gets OpenCPN's main canvas window.
bool GetEnableLatLonGrid(int CanvasIndex)
Gets latitude/longitude grid visibility state.
bool UpdatePlugInRouteEx(PlugIn_Route_Ex *proute)
Updates an existing extended route.
void SetCanvasContextMenuItemViz(int item, bool viz)
Temporarily changes context menu item visibility.
int PlatformDirSelectorDialog(wxWindow *parent, wxString *file_spec, wxString Title, wxString initDir)
Shows platform-optimized directory selector dialog.
bool GetTouchMode()
Gets touch interface mode state.
int GetCanvasCount()
Gets total number of chart canvases.
bool GetSingleWaypointExV2(wxString GUID, PlugIn_Waypoint_ExV2 *pwaypoint)
Gets extended waypoint data by GUID.
ArrayOfPlugIn_AIS_Targets * GetAISTargetArray(void)
Gets array of AIS targets.
wxString getUsrWindSpeedUnit_Plugin(int unit)
Gets display string for user's preferred wind speed unit.
void SetCanvasMenuItemViz(int item, bool viz, const char *name)
Temporarily changes context menu item visibility.
void PlugInMultMatrixViewport(PlugIn_ViewPort *vp, float lat, float lon)
Applies viewport transformation matrix.
wxFont * OCPNGetFont(wxString TextElement, int default_size)
Gets a font for UI elements.
bool GetEnableMainToolbar()
Check if the main toolbar is enabled.
bool GetEnableENCTextDisplay(int CanvasIndex)
Gets ENC text label visibility.
bool UpdateSingleWaypointEx(PlugIn_Waypoint_Ex *pwaypoint)
Updates an existing extended waypoint.
wxArrayString GetTrackGUIDArray(void)
Gets array of track GUIDs.
wxString getUsrDistanceUnit_Plugin(int unit)
Gets display string for user's preferred distance unit.
bool DeletePlugInTrack(wxString &GUID)
Deletes a track.
bool DeletePlugInRoute(wxString &GUID)
Deletes a route.
void EnableSplitScreenLayout(bool enable)
Enable or disable the split-screen layout.
double toUsrWindSpeed_Plugin(double kts_speed, int unit)
Converts knots to user's preferred wind speed unit.
bool GetEnableLightsDisplay(int CanvasIndex)
Gets light icon visibility.
wxFont GetOCPNGUIScaledFont_PlugIn(wxString item)
Gets a uniquely scaled font copy for responsive UI elements.
wxBitmap GetBitmapFromSVGFile(wxString filename, unsigned int width, unsigned int height)
Creates bitmap from SVG file.
wxFont * FindOrCreateFont_PlugIn(int point_size, wxFontFamily family, wxFontStyle style, wxFontWeight weight, bool underline, const wxString &facename, wxFontEncoding encoding)
Creates or finds a font in the font cache.
int GetGlobalWatchdogTimoutSeconds()
Comm Global Watchdog Query
wxColour GetFontColour_PlugIn(wxString TextElement)
Gets color configured for a UI text element.
void EnableChartBar(bool enable, int CanvasIndex)
Controls visibility of chart info bar.
void PositionBearingDistanceMercator_Plugin(double lat, double lon, double brg, double dist, double *dlat, double *dlon)
Calculates destination point given start point, bearing and distance.
double toUsrDistance_Plugin(double nm_distance, int unit)
Converts nautical miles to user's preferred distance unit.
void SetENCDisplayCategory(PI_DisCat cat, int CanvasIndex)
Sets ENC (Electronic Navigation Chart) feature display category.
void toSM_Plugin(double lat, double lon, double lat0, double lon0, double *x, double *y)
Converts geographic coordinates to Simple Mercator projection.
PI_DisCat GetENCDisplayCategory(int CanvasIndex)
Gets current ENC display category.
void EnableTouchMode(bool enable)
Enables/disables touch interface mode.
void EnableCurrentStationsDisplay(bool enable, int CanvasIndex)
Controls current station icon display.
void EnableChartOutlines(bool enable, int CanvasIndex)
Controls chart outline display.
void EnableMUIBar(bool enable, int CanvasIndex)
Controls visibility of MUI (Mobile/Touch User Interface) bar.
double OCPN_GetDisplayContentScaleFactor()
Gets content scaling factor for current display.
double DistGreatCircle_Plugin(double slat, double slon, double dlat, double dlon)
Calculates great circle distance between two points.
bool AddSingleWaypointExV2(PlugIn_Waypoint_ExV2 *pwaypointex, bool b_permanent)
Adds a waypoint with extended V2 properties.
void EnableLookaheadMode(bool enable, int CanvasIndex)
Enables/disables look-ahead mode for a canvas.
bool PluginGetFollowMode(int CanvasIndex)
Get the current follow mode status for a specific canvas.
wxArrayString GetRouteGUIDArray(void)
Gets array of route GUIDs.
wxScrolledWindow * AddOptionsPage(OptionsParentPI parent, wxString title)
Adds a new preferences page to OpenCPN options dialog.
void EnableLightsDisplay(bool enable, int CanvasIndex)
Controls light icon display.
void PlugInHandleAutopilotRoute(bool enable)
Controls autopilot route handling.
wxString getUsrDepthUnit_Plugin(int unit)
Gets display string for user's preferred depth unit.
void RemoveCanvasMenuItem(int item, const char *name)
Removes a context menu item completely.
void JumpToPosition(double lat, double lon, double scale)
Centers chart display on specified position at given scale.
int InsertPlugInToolSVG(wxString label, wxString SVGfile, wxString SVGfileRollover, wxString SVGfileToggled, wxItemKind kind, wxString shortHelp, wxString longHelp, wxObject *clientData, int position, int tool_sel, opencpn_plugin *pplugin)
Adds a tool using SVG graphics.
bool GetEnableCurrentStationsDisplay(int CanvasIndex)
Gets current station icon visibility.
wxDialog * GetActiveOptionsDialog()
Gets pointer to active options dialog.
wxString getUsrSpeedUnit_Plugin(int unit)
Gets display string for user's preferred speed unit.
std::unique_ptr< PlugIn_Waypoint > GetWaypoint_Plugin(const wxString &GUID)
Gets waypoint details by GUID.
bool GetEnableLookaheadMode(int CanvasIndex)
Gets look-ahead mode state for a canvas.
void EnableTideStationsDisplay(bool enable, int CanvasIndex)
Controls tide station icon display.
bool GetEnableChartBar(int CanvasIndex)
Gets chart bar visibility state.
wxBitmap GetIcon_PlugIn(const wxString &name)
Gets icon bitmap by name.
wxArrayString GetIconNameArray(void)
Gets array of available waypoint icons.
bool PlugIn_GSHHS_CrossesLand(double lat1, double lon1, double lat2, double lon2)
Checks if a great circle route crosses land.
void SetNavigationMode(PI_NavMode mode, int CanvasIndex)
Sets the navigation mode for a specific chart canvas.
bool GetEnableStatusBar()
Gets status bar visibility state.
bool GetEnableDepthUnitDisplay(int CanvasIndex)
Gets depth unit display state.
int InsertPlugInTool(wxString label, wxBitmap *bitmap, wxBitmap *bmpRollover, wxItemKind kind, wxString shortHelp, wxString longHelp, wxObject *clientData, int position, int tool_sel, opencpn_plugin *pplugin)
Adds a tool to OpenCPN's toolbar.
void EnableENCDepthSoundingsDisplay(bool enable, int CanvasIndex)
Controls ENC depth sounding display.
void PlugInAISDrawGL(wxGLCanvas *glcanvas, const PlugIn_ViewPort &vp)
Renders AIS targets on a secondary OpenGL canvas.
double GetCanvasTilt()
Gets current canvas tilt angle.
void AddChartDirectory(wxString &path)
Adds a chart directory to OpenCPN's chart database.
double fromDMM_PlugIn(wxString sdms)
Parse a formatted coordinate string to get decimal degrees.
double toUsrDepth_Plugin(double m_depth, int unit)
Converts meters to user's preferred depth unit.
bool GetActiveRoutepointGPX(char *buffer, unsigned int buffer_length)
Gets GPX representation of active route waypoint.
std::unique_ptr< PlugIn_Waypoint_ExV2 > GetWaypointExV2_Plugin(const wxString &GUID)
Gets complete waypoint details by GUID.
double PlugInGetDisplaySizeMM()
Gets physical display size in millimeters.
bool UpdatePlugInRoute(PlugIn_Route *proute)
Updates an existing route.
void SetToolbarToolBitmaps(int item, wxBitmap *bitmap, wxBitmap *bmpRollover)
Updates toolbar tool bitmaps.
void EnableBuoyLightLabelsDisplay(bool enable, int CanvasIndex)
Controls buoy/light name label display.
wxString GetActiveWaypointGUID(void)
Gets GUID of currently active waypoint.
void ConfigFlushAndReload()
Flush configuration changes to disk and reload settings.
void EnableAisTargetDisplay(bool enable, int CanvasIndex)
Controls AIS target display.
int PlatformFileSelectorDialog(wxWindow *parent, wxString *file_spec, wxString Title, wxString initDir, wxString suggestedName, wxString wildcard)
Shows platform-optimized file selector dialog.
bool CheckMUIEdgePan_PlugIn(int x, int y, bool dragging, int margin, int delta, int canvasIndex)
Checks if chart should pan when cursor near edge.
std::unique_ptr< PlugIn_Route_ExV2 > GetRouteExV2_Plugin(const wxString &GUID)
Gets route details with V2 waypoints by GUID.
double fromUsrDepth_Plugin(double usr_depth, int unit)
Converts from user's preferred depth unit to meters.
bool AddPlugInRoute(PlugIn_Route *proute, bool b_permanent)
Adds a new route.
wxString GetNewGUID(void)
Generates a new globally unique identifier (GUID).
double fromDMM_Plugin(wxString sdms)
Converts degrees/decimal minutes string to decimal degrees.
void EnableENCTextDisplay(bool enable, int CanvasIndex)
Controls ENC text label display.
int GetCanvasIndexUnderMouse(void)
Gets index of chart canvas under mouse cursor.
void EnableTenHertzUpdate(bool enable)
Enable or disable 10 Hz update rate.
wxRect GetMasterToolbarRect()
Gets bounding rectangle of master toolbar.
void toTM_Plugin(float lat, float lon, float lat0, float lon0, double *x, double *y)
Converts geographic coordinates to Transverse Mercator projection.
void CanvasJumpToPosition(wxWindow *canvas, double lat, double lon, double scale)
Centers specified canvas on given position at given scale.
bool GetGlobalColor(wxString colorName, wxColour *pcolour)
Gets a global color value.
double fromUsrSpeed_Plugin(double usr_speed, int unit)
Converts from user's preferred speed unit to knots.
void GetDoubleCanvasPixLL(PlugIn_ViewPort *vp, wxPoint2DDouble *pp, double lat, double lon)
Converts lat/lon to canvas pixels with double precision.
std::unique_ptr< PlugIn_Track > GetTrack_Plugin(const wxString &GUID)
Gets track details by GUID.
bool PlugInPlaySoundEx(wxString &sound_file, int deviceIndex)
Start playing a sound file asynchronously.
void EnableCompassGPSIcon(bool enable, int CanvasIndex)
Controls visibility of compass/GPS status icon.
wxString GetActiveRouteGUID(void)
Gets GUID of currently active route.
void EnableDepthUnitDisplay(bool enable, int CanvasIndex)
Controls depth unit display.
bool GetEnableTideStationsDisplay(int CanvasIndex)
Gets tide station icon visibility.
bool PlugInSetFontColor(const wxString TextElement, const wxColour color)
Sets text color for a UI element.
wxWindow * GetCanvasUnderMouse(void)
Gets canvas window under mouse cursor.
std::unique_ptr< PlugIn_Waypoint_Ex > GetWaypointEx_Plugin(const wxString &GUID)
Gets extended waypoint by GUID.
bool GetTrackingMode()
Get the current tracking mode status.
bool GetEnableChartOutlines(int CanvasIndex)
Gets chart outline visibility state.
void GetCanvasPixLL(PlugIn_ViewPort *vp, wxPoint *pp, double lat, double lon)
Converts lat/lon to canvas physical pixel coordinates.
wxColor GetGlobalColorD(std::string map_name, std::string name)
Gets a color from the global color scheme.
bool GetEnableCompassGPSIcon(int CanvasIndex)
Gets compass icon visibility state.
void SetMUICursor_PlugIn(wxCursor *pCursor, int canvasIndex)
Sets mouse cursor for specific canvas.
void EnableMenu(bool enable)
Shows/hides the main menu bar.
void DimeWindow(wxWindow *win)
Applies system color scheme to window.
bool GetEnableAisTargetDisplay(int CanvasIndex)
Gets AIS target display state.
bool AddPlugInRouteExV2(PlugIn_Route_ExV2 *proute, bool b_permanent)
Adds a new route with V2 waypoints.
std::vector< std::string > GetPriorityMaps()
Comm Priority query support methods
double GetOCPNGUIToolScaleFactor_PlugIn()
Gets current global GUI scaling factor.
void SetToolbarToolBitmapsSVG(int item, wxString SVGfile, wxString SVGfileRollover, wxString SVGfileToggled)
Updates SVG graphics for toolbar tool.
wxString getUsrTempUnit_Plugin(int unit)
Gets display string for user's preferred temperature unit.
bool AddSingleWaypointEx(PlugIn_Waypoint_Ex *pwaypointex, bool b_permanent)
Adds a waypoint with extended properties.
wxArrayString GetWaypointGUIDArray(void)
Gets array of all waypoint/marks GUIDs.
int AddCanvasContextMenuItem(wxMenuItem *pitem, opencpn_plugin *pplugin)
Adds item to chart canvas context menu.
wxString GetActiveStyleName()
Gets name of currently active style sheet.
wxArrayString GetChartDBDirArrayString()
Gets chart database directory list.
void SetCursor_PlugIn(wxCursor *pCursor)
Sets mouse cursor.
bool GetEnableTenHertzUpdate()
Check if 10 Hz update rate is enabled.
wxString GetLocaleCanonicalName()
Gets system locale canonical name.
wxWindow * PluginGetOverlayRenderCanvas()
Gets the canvas currently designated for overlay rendering.
bool AddPersistentFontKey(wxString TextElement)
Registers a new font configuration element.
bool AddPlugInTrack(PlugIn_Track *ptrack, bool b_permanent)
Adds a new track.
bool UpdateChartDBInplace(wxArrayString dir_array, bool b_force_update, bool b_ProgressDialog)
Updates chart database in place.
void UpdateAndApplyPriorityMaps(std::vector< std::string > map)
Sets and applies new priority mapping scheme.
void RequestWindowRefresh(wxWindow *win, bool eraseBackground)
Requests window refresh.
void EnableLatLonGrid(bool enable, int CanvasIndex)
Controls latitude/longitude grid display.
void SetAppColorScheme(PI_ColorScheme cs)
Set the application color scheme.
bool DeleteSingleWaypoint(wxString &GUID)
Deletes a single waypoint.
void RemoveCanvasContextMenuItem(int item)
Removes a context menu item completely.
bool DecodeSingleVDOMessage(const wxString &str, PlugIn_Position_Fix_Ex *pos, wxString *accumulator)
Decodes a single VDO (Own Ship AIS) message.
bool AddCustomWaypointIcon(wxBitmap *pimage, wxString key, wxString description)
Adds a custom waypoint icon.
bool CheckEdgePan_PlugIn(int x, int y, bool dragging, int margin, int delta)
Checks if chart should pan when cursor near edge.
double toUsrSpeed_Plugin(double kts_speed, int unit)
Converts knots to user's preferred speed unit.
std::unique_ptr< PlugIn_Route_Ex > GetRouteEx_Plugin(const wxString &GUID)
Gets extended route by GUID.
bool UpdatePlugInRouteExV2(PlugIn_Route_ExV2 *proute)
Updates existing route with V2 waypoints.
std::vector< std::string > GetActivePriorityIdentifiers()
Gets list of active priority identifiers.
bool GetEnableENCDepthSoundingsDisplay(int CanvasIndex)
Gets ENC depth sounding visibility.
void SetToolbarItemState(int item, bool toggle)
Sets toolbar item toggle state.
bool DeleteOptionsPage(wxScrolledWindow *page)
Remove a previously added options page.
void EnableLightDescriptionsDisplay(bool enable, int CanvasIndex)
Controls light description text display.
float GetOCPNChartScaleFactor_Plugin()
Gets chart rendering scale factor.
PI_NavMode GetNavigationMode(int CanvasIndex)
Gets current navigation mode for a canvas.
int AddCanvasMenuItem(wxMenuItem *pitem, opencpn_plugin *pplugin, const char *name)
Adds item to canvas context menu.
int RemoveChartFromDBInPlace(wxString &full_path)
Removes a chart from database without full rebuild.
void PlugInNormalizeViewport(PlugIn_ViewPort *vp, float lat, float lon)
Normalizes viewport parameters.
PI_ColorScheme GetAppColorScheme()
Get the current application color scheme.
void ExitOCPN()
Exits OpenCPN application.
wxWindow * GetCanvasByIndex(int canvasIndex)
Gets chart canvas window by index.
void fromTM_Plugin(double x, double y, double lat0, double lon0, double *lat, double *lon)
Converts Transverse Mercator coordinates to geographic.
double OCPN_GetWinDIPScaleFactor()
Gets Windows-specific DPI scaling factor.
void PushNMEABuffer(wxString buf)
Pushes NMEA sentence to the system.
void SetEnableMainToolbar(bool enable)
Show or hide the main toolbar.
void SetFullScreen(bool set_full_screen_on)
Sets full screen mode.
bool GetEnableMenu()
Gets menu bar visibility state.
void SetCanvasMenuItemGrey(int item, bool grey, const char *name)
Sets menu item enabled/disabled state.
bool GetEnableBuoyLightLabelsDisplay(int CanvasIndex)
Gets buoy/light label visibility.
double fromUsrWindSpeed_Plugin(double usr_wspeed, int unit)
Converts from user's preferred wind speed unit to knots.
bool GetEnableCanvasFocusBar(int CanvasIndex)
Gets focus indicator visibility state.
wxXmlDocument GetChartDatabaseEntryXML(int dbIndex, bool b_getGeom)
Gets chart database entry as XML.
wxAuiManager * GetFrameAuiManager(void)
Gets main frame AUI manager.
void SendPluginMessage(wxString message_id, wxString message_body)
Sends message to other plugins.
bool AddPlugInRouteEx(PlugIn_Route_Ex *proute, bool b_permanent)
Adds a route with extended features.
void fromSM_ECC_Plugin(double x, double y, double lat0, double lon0, double *lat, double *lon)
Converts Elliptical Simple Mercator coordinates to geographic.
void EnableStatusBar(bool enable)
Shows/hides the status bar.
void RequestRefresh(wxWindow *win)
Requests window refresh.
bool UpdateSingleWaypointExV2(PlugIn_Waypoint_ExV2 *pwaypoint)
Updates an existing extended V2 waypoint.
void PluginZoomCanvas(int CanvasIndex, double factor)
Zoom a specific chart canvas by the given factor.
int GetLatLonFormat()
Gets currently selected latitude/longitude display format.
bool AddSingleWaypoint(PlugIn_Waypoint *pwaypoint, bool b_permanent)
Adds a single waypoint.
bool IsTouchInterface_PlugIn(void)
Checks if touch interface mode is enabled.
bool GetSingleWaypoint(wxString GUID, PlugIn_Waypoint *pwaypoint)
Gets waypoint data by GUID.
void SetToolbarToolViz(int item, bool viz)
Temporarily changes toolbar tool visibility.
double fromUsrTemp_Plugin(double usr_temp, int unit)
Converts from user's preferred temperature unit to Celsius.
void SetCanvasTilt(double tilt)
Gets current canvas tilt angle.
std::unique_ptr< PlugIn_Route > GetRoute_Plugin(const wxString &GUID)
Gets route details by GUID.
bool GetEnableMUIBar(int CanvasIndex)
Gets MUI bar visibility state.
bool AddLocaleCatalog(wxString catalog)
Adds a locale catalog for translations.
bool GetFullScreen()
Gets full screen state.
void SetTrackingMode(bool enable)
Enable or disable tracking mode.
wxString g_locale
Global locale setting for OpenCPN UI.
void PluginSetFollowMode(int CanvasIndex, bool enable_follow)
Set follow mode for a specific canvas.
void ShowGlobalSettingsDialog()
Display the global settings dialog.
void toSM_ECC_Plugin(double lat, double lon, double lat0, double lon0, double *x, double *y)
Converts geographic coordinates to Elliptical Simple Mercator projection.
bool UpdatePlugInTrack(PlugIn_Track *ptrack)
Updates an existing track.
double fromUsrDistance_Plugin(double usr_distance, int unit)
Converts from user's preferred distance unit to nautical miles.
wxString GetSelectedTrackGUID_Plugin()
Gets GUID of currently selected track.
wxFileConfig * GetOCPNConfigObject(void)
Gets OpenCPN's configuration object.
void DistanceBearingMercator_Plugin(double lat0, double lon0, double lat1, double lon1, double *brg, double *dist)
Calculates bearing and distance between two points.
void SetGlobalColor(std::string table, std::string name, wxColor color)
Sets a color in the global color scheme.
void ZeroXTE()
Resets cross track error to zero.
void PlugInPlaySound(wxString &sound_file)
Plays a sound file asynchronously.
void GetCanvasLLPix(PlugIn_ViewPort *vp, wxPoint p, double *plat, double *plon)
Converts canvas physical pixel coordinates to lat/lon.
void EnableCanvasFocusBar(bool enable, int CanvasIndex)
Controls visibility of canvas focus indicator.
wxString GetSelectedRouteGUID_Plugin()
Gets GUID of currently selected route.
double g_display_size_mm
The width of the physical screen in millimeters.
void ForceChartDBUpdate()
Forces an update of the chart database.
bool GetSingleWaypointEx(wxString GUID, PlugIn_Waypoint_Ex *pwaypoint)
Gets extended waypoint data by GUID.
bool ShuttingDown(void)
Checks if OpenCPN is in shutdown process.
void ForceChartDBRebuild()
Forces complete rebuild of chart database.
Tools to send data to plugins.
A generic position and navigation data structure.
double kCog
Course over ground in degrees.
double kHdt
True heading in degrees.
double kLat
Latitude in decimal degrees.
double kSog
Speed over ground in knots.
double kLon
Longitude in decimal degrees.