OpenCPN Partial API docs
Loading...
Searching...
No Matches
ocpn_plugin.h
Go to the documentation of this file.
1/**************************************************************************
2 * Copyright (C) 2010 - 2024 by David S. Register *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 **************************************************************************/
19
25#ifndef _PLUGIN_H_
26#define _PLUGIN_H_
27
28#ifndef DECL_EXP
29#if defined(__WXMSW__) || defined(__CYGWIN__)
30#define DECL_EXP __declspec(dllexport)
31#elif defined __GNUC__ && __GNUC__ >= 4
32#define DECL_EXP __attribute__((visibility("default")))
33#elif defined __WXOSX__
34#define DECL_EXP __attribute__((visibility("default")))
35#else
36#define DECL_EXP
37#endif
38#endif
39
40#if defined(__WXMSW__) && defined(MAKING_PLUGIN)
41#define DECL_IMP __declspec(dllimport)
42#else
43#define DECL_IMP
44#endif
45
46#include <cstdint>
47#include <memory>
48#include <string>
49#include <vector>
50#include <unordered_map>
51
52#include <wx/arrstr.h>
53#include <wx/aui/framemanager.h>
54#include <wx/bitmap.h>
55#include <wx/colour.h>
56#include <wx/cursor.h>
57#include <wx/dcmemory.h>
58#include <wx/dialog.h>
59#include <wx/event.h>
60#include <wx/fileconf.h>
61#include <wx/gdicmn.h>
62#include <wx/menuitem.h>
63#include <wx/notebook.h>
64#include <wx/region.h>
65#include <wx/scrolwin.h>
66#include <wx/xml/xml.h>
67
68// This is the most modern API Version number
69// It is expected that the API will remain downward compatible, meaning that
70// PlugIns conforming to API Version less than the most modern will also
71// be correctly supported.
72#define API_VERSION_MAJOR 1
73#define API_VERSION_MINOR 21
74
75// Using the correct #include <wx/glcanvas.h> causes compilation errors
76// on windows, probably errors in bundled and partly modified GL headers.
77// For now, use this as work around.
78class wxGLContext;
79class wxGLCanvas;
80
81//---------------------------------------------------------------------------------------------------------
82//
83// Bitfield PlugIn Capabilities flag definition
84//
85//---------------------------------------------------------------------------------------------------------
89#define WANTS_OVERLAY_CALLBACK 0x00000001
93#define WANTS_CURSOR_LATLON 0x00000002
103#define WANTS_TOOLBAR_CALLBACK 0x00000004
109#define INSTALLS_TOOLBAR_TOOL 0x00000008
112#define WANTS_CONFIG 0x00000010
115#define INSTALLS_TOOLBOX_PAGE 0x00000020
118#define INSTALLS_CONTEXTMENU_ITEMS 0x00000040
121#define WANTS_NMEA_SENTENCES 0x00000080
125#define WANTS_NMEA_EVENTS 0x00000100
128#define WANTS_AIS_SENTENCES 0x00000200
131#define USES_AUI_MANAGER 0x00000400
134#define WANTS_PREFERENCES 0x00000800
137#define INSTALLS_PLUGIN_CHART 0x00001000
140#define WANTS_ONPAINT_VIEWPORT 0x00002000
143#define WANTS_PLUGIN_MESSAGING 0x00004000
144#define WANTS_OPENGL_OVERLAY_CALLBACK 0x00008000
145#define WANTS_DYNAMIC_OPENGL_OVERLAY_CALLBACK 0x00010000
148#define WANTS_LATE_INIT 0x00020000
151#define INSTALLS_PLUGIN_CHART_GL 0x00040000
154#define WANTS_MOUSE_EVENTS 0x00080000
157#define WANTS_VECTOR_CHART_OBJECT_INFO 0x00100000
160#define WANTS_KEYBOARD_EVENTS 0x00200000
163#define WANTS_PRESHUTDOWN_HOOK 0x00400000
164
186#define OVERLAY_LEGACY 0
187
196#define OVERLAY_OVER_SHIPS 64
197
206#define OVERLAY_OVER_EMBOSS 96
207
217#define OVERLAY_OVER_UI 128
218
222#define OVERLAY_CHARTS 256
223
224//----------------------------------------------------------------------------------------------------------
225// Some PlugIn API interface object class definitions
226//----------------------------------------------------------------------------------------------------------
246
251public:
252 double clat;
253 double clon;
255 double skew;
256 double rotation;
257
259
262 wxRect rv_rect;
263 bool b_quilt;
266
267 double lat_min;
268 double lat_max;
269 double lon_min;
270 double lon_max;
271
272 bool
274};
275
280public:
281 double Lat;
282 double Lon;
283 double Cog;
284 double Sog;
285 double Var;
286 time_t FixTime;
287 int nSats;
288};
300public:
307 double Lat;
308
315 double Lon;
316
320 double Cog;
321
326 double Sog;
327
329 double Var;
330
335 double Hdm;
336
342 double Hdt;
343
349 time_t FixTime;
350
357 int nSats;
358};
359
364public:
365 double Xte;
367 double Btw;
368 double Dtw;
369 wxString wp_name;
370 bool arrival;
372};
373
382
387public:
388 int MMSI;
389 int Class;
391 double SOG;
392 double COG;
393 double HDG;
394 double Lon;
395 double Lat;
396 int ROTAIS;
397 char CallSign[8];
398 char ShipName[21];
399 unsigned char ShipType;
400 int IMO;
401
402 double Range_NM;
403 double Brg;
404
405 // Per target collision parameters
407 double TCPA;
408 double CPA;
409
411};
412
427
437
447
470
474typedef struct _ExtentPI {
475 double SLAT;
476 double WLON;
477 double NLAT;
478 double ELON;
480
481// PlugInChartBase::Init() init_flags constants
484#define PI_FULL_INIT 0
487#define PI_HEADER_ONLY 1
489#define PI_THUMB_ONLY 2
490
504class DECL_EXP PlugInChartBase : public wxObject {
505public:
506 // These methods Must be overriden in any derived class
508 virtual ~PlugInChartBase();
509
530 virtual wxString GetFileSearchMask(void);
531
556 virtual int Init(const wxString &full_path, int init_flags);
557
577 virtual void SetColorScheme(int cs, bool bApplyImmediate);
578
599 virtual double GetNormalScaleMin(double canvas_scale_factor,
600 bool b_allow_overzoom);
618 virtual double GetNormalScaleMax(double canvas_scale_factor,
619 int canvas_width);
634 virtual double GetNearestPreferredScalePPM(double target_scale_ppm);
635
653 virtual bool GetChartExtent(ExtentPI *pext);
654
681 virtual wxBitmap &RenderRegionView(const PlugIn_ViewPort &VPoint,
682 const wxRegion &Region);
683
698 virtual bool AdjustVP(PlugIn_ViewPort &vp_last, PlugIn_ViewPort &vp_proposed);
699
715 virtual void GetValidCanvasRegion(const PlugIn_ViewPort &VPoint,
716 wxRegion *pValidRegion);
717
735 virtual int GetCOVREntries() { return 0; }
736
752 virtual int GetCOVRTablePoints(int iTable) { return 0; }
753
767 virtual int GetCOVRTablenPoints(int iTable) { return 0; }
768
789 virtual float *GetCOVRTableHead(int iTable) { return (float *)NULL; }
790
813 virtual wxBitmap *GetThumbnail(int tnx, int tny, int cs);
814
815 // Accessors, need not be overridden in derived class if the member
816 // variables are maintained
817
831 virtual wxString GetFullPath() const { return m_FullPath; }
832
854 virtual ChartTypeEnumPI GetChartType() { return m_ChartType; }
855
869 virtual ChartFamilyEnumPI GetChartFamily() { return m_ChartFamily; }
870
890 virtual OcpnProjTypePI GetChartProjection() { return m_projection; }
891
904 virtual wxString GetName() { return m_Name; }
905
916 virtual wxString GetDescription() { return m_Description; }
917
929 virtual wxString GetID() { return m_ID; }
930
944 virtual wxString GetSE() { return m_SE; }
945
961 virtual wxString GetDepthUnits() { return m_DepthUnits; }
962
979 virtual wxString GetSoundingsDatum() { return m_SoundingsDatum; }
980
996 virtual wxString GetDatumString() { return m_datum_str; }
997
1011 virtual wxString GetExtraInfo() { return m_ExtraInfo; }
1012
1025 virtual wxString GetPubDate() { return m_PubYear; }
1026
1040 virtual double GetChartErrorFactor() { return m_Chart_Error_Factor; }
1041
1057 virtual ChartDepthUnitTypePI GetDepthUnitId() { return m_depth_unit_id; }
1058
1073 virtual bool IsReadyToRender() { return m_bReadyToRender; }
1074
1087 virtual int GetNativeScale() { return m_Chart_Scale; };
1088
1101 virtual double GetChartSkew() { return m_Chart_Skew; }
1102
1115 virtual wxDateTime GetEditionDate(void) { return m_EdDate; }
1116
1117 // Methods pertaining to CHART_FAMILY_RASTER type PlugIn charts only
1118
1137 virtual void ComputeSourceRectangle(const PlugIn_ViewPort &vp,
1138 wxRect *pSourceRect);
1139
1154 virtual double GetRasterScaleFactor();
1155
1176 virtual bool GetChartBits(wxRect &source, unsigned char *pPix, int sub_samp);
1177
1189 virtual int GetSize_X();
1190
1202 virtual int GetSize_Y();
1203
1218 virtual void latlong_to_chartpix(double lat, double lon, double &pixx,
1219 double &pixy);
1220
1235 virtual void chartpix_to_latlong(double pixx, double pixy, double *plat,
1236 double *plon);
1237
1238protected:
1239 ChartTypeEnumPI m_ChartType;
1240 ChartFamilyEnumPI m_ChartFamily;
1241
1242 wxString m_FullPath;
1243 OcpnProjTypePI m_projection;
1244 int m_Chart_Scale;
1245 double m_Chart_Skew;
1246
1247 wxDateTime m_EdDate;
1248 bool m_bReadyToRender;
1249
1250 wxString m_Name;
1251 wxString m_Description;
1252 wxString m_ID;
1253 wxString m_SE;
1254 wxString m_SoundingsDatum;
1255 wxString m_datum_str;
1256 wxString m_PubYear;
1257 wxString m_DepthUnits;
1258 wxString m_ExtraInfo;
1259
1260 ChartDepthUnitTypePI m_depth_unit_id;
1261
1262 double m_Chart_Error_Factor;
1263};
1264
1265// Declare an array of PlugIn_AIS_Targets
1266WX_DEFINE_ARRAY_PTR(PlugIn_AIS_Target *, ArrayOfPlugIn_AIS_Targets);
1267
1282class DECL_EXP opencpn_plugin {
1283public:
1284 opencpn_plugin(void *pmgr) {}
1285 virtual ~opencpn_plugin();
1286
1287 // Public API to the PlugIn class
1288
1289 // This group of methods is required, and will be called by the opencpn
1290 // host opencpn PlugIns must implement this group
1291
1306 virtual int Init(void);
1307
1317 virtual bool DeInit(void);
1318
1331 virtual int GetAPIVersionMajor();
1332
1345 virtual int GetAPIVersionMinor();
1346
1358 virtual int GetPlugInVersionMajor();
1359
1371 virtual int GetPlugInVersionMinor();
1372
1385 virtual wxBitmap *GetPlugInBitmap();
1386
1387 // These three methods should produce valid, meaningful strings always
1388 // ---EVEN IF--- the PlugIn has not (yet) been initialized.
1389 // They are used by the PlugInManager GUI
1390
1402 virtual wxString GetCommonName();
1403
1415 virtual wxString GetShortDescription();
1416
1430 virtual wxString GetLongDescription();
1431
1432 // This group is optional.
1433 // PlugIns may override any of these methods as required
1434
1446 virtual void SetDefaults(void);
1447
1461 virtual int GetToolbarToolCount(void);
1462
1475 virtual int GetToolboxPanelCount(void);
1476
1491 virtual void SetupToolboxPanel(int page_sel, wxNotebook *pnotebook);
1492
1508 virtual void OnCloseToolboxPanel(int page_sel, int ok_apply_cancel);
1509
1523 virtual void ShowPreferencesDialog(wxWindow *parent);
1524
1550 virtual bool RenderOverlay(wxMemoryDC *pmdc, PlugIn_ViewPort *vp);
1551
1565 virtual void SetCursorLatLon(double lat, double lon);
1584 virtual void SetCurrentViewPort(PlugIn_ViewPort &vp);
1585
1611 virtual void SetPositionFix(PlugIn_Position_Fix &pfix);
1626 virtual void SetNMEASentence(wxString &sentence);
1643 virtual void SetAISSentence(wxString &sentence);
1644
1654 virtual void ProcessParentResize(int x, int y);
1655
1670 virtual void SetColorScheme(PI_ColorScheme cs);
1671
1680 virtual void OnToolbarToolCallback(int id);
1681
1690 virtual void OnContextMenuItemCallback(int id);
1691
1699 virtual void UpdateAuiStatus(void);
1700
1712 virtual wxArrayString GetDynamicChartClassNameArray(void);
1713};
1714
1715// the types of the class factories used to create PlugIn instances
1716typedef opencpn_plugin *create_t(void *);
1717typedef void destroy_t(opencpn_plugin *);
1718
1719#ifdef __clang__
1720#pragma clang diagnostic push
1721#pragma clang diagnostic ignored "-Woverloaded-virtual"
1722#endif
1723
1724class DECL_EXP opencpn_plugin_16 : public opencpn_plugin {
1725public:
1726 opencpn_plugin_16(void *pmgr);
1727 virtual ~opencpn_plugin_16();
1728
1730
1768 virtual bool RenderOverlay(wxDC &dc, PlugIn_ViewPort *vp);
1769
1784 virtual void SetPluginMessage(wxString &message_id, wxString &message_body);
1785};
1786
1787class DECL_EXP opencpn_plugin_17 : public opencpn_plugin {
1788public:
1789 opencpn_plugin_17(void *pmgr);
1790 virtual ~opencpn_plugin_17();
1791
1793
1794 virtual bool RenderOverlay(wxDC &dc, PlugIn_ViewPort *vp);
1795 virtual bool RenderGLOverlay(wxGLContext *pcontext, PlugIn_ViewPort *vp);
1796
1797 virtual void SetPluginMessage(wxString &message_id, wxString &message_body);
1798};
1799
1800class DECL_EXP opencpn_plugin_18 : public opencpn_plugin {
1801public:
1802 opencpn_plugin_18(void *pmgr);
1803 virtual ~opencpn_plugin_18();
1804
1806
1807 virtual bool RenderOverlay(wxDC &dc, PlugIn_ViewPort *vp);
1845 virtual bool RenderGLOverlay(wxGLContext *pcontext, PlugIn_ViewPort *vp);
1846 virtual void SetPluginMessage(wxString &message_id, wxString &message_body);
1847
1868 virtual void SetPositionFixEx(PlugIn_Position_Fix_Ex &pfix);
1869};
1870
1871#ifdef __clang__
1872#pragma clang diagnostic pop
1873#endif
1874
1875class DECL_EXP opencpn_plugin_19 : public opencpn_plugin_18 {
1876public:
1877 opencpn_plugin_19(void *pmgr);
1878 virtual ~opencpn_plugin_19();
1879
1887 virtual void OnSetupOptions(void);
1888};
1889
1890class DECL_EXP opencpn_plugin_110 : public opencpn_plugin_19 {
1891public:
1892 opencpn_plugin_110(void *pmgr);
1893 virtual ~opencpn_plugin_110();
1894
1895 virtual void LateInit(void); // If WANTS_LATE_INIT is returned by Init()
1896};
1897
1899public:
1900 opencpn_plugin_111(void *pmgr);
1901 virtual ~opencpn_plugin_111();
1902};
1903
1905public:
1906 opencpn_plugin_112(void *pmgr);
1907 virtual ~opencpn_plugin_112();
1908
1918 virtual bool MouseEventHook(wxMouseEvent &event);
1919
1934 virtual void SendVectorChartObjectInfo(wxString &chart, wxString &feature,
1935 wxString &objname, double lat,
1936 double lon, double scale,
1937 int nativescale);
1938};
1939
1941public:
1942 opencpn_plugin_113(void *pmgr);
1943 virtual ~opencpn_plugin_113();
1944
1954 virtual bool KeyboardEventHook(wxKeyEvent &event);
1955
1963 virtual void OnToolbarToolDownCallback(int id);
1964
1972 virtual void OnToolbarToolUpCallback(int id);
1973};
1974
1976public:
1977 opencpn_plugin_114(void *pmgr);
1978 virtual ~opencpn_plugin_114();
1979};
1980
1982public:
1983 opencpn_plugin_115(void *pmgr);
1984 virtual ~opencpn_plugin_115();
1985};
1986
1988public:
1989 opencpn_plugin_116(void *pmgr);
1990 virtual ~opencpn_plugin_116();
2023 virtual bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext,
2024 PlugIn_ViewPort *vp, int canvasIndex);
2025
2058 virtual bool RenderOverlayMultiCanvas(wxDC &dc, PlugIn_ViewPort *vp,
2059 int canvasIndex);
2068 virtual void PrepareContextMenu(int canvasIndex);
2069};
2070
2072public:
2073 opencpn_plugin_117(void *pmgr);
2080 virtual int GetPlugInVersionPatch();
2081
2083 virtual int GetPlugInVersionPost();
2084
2086 virtual const char *GetPlugInVersionPre();
2087
2089 virtual const char *GetPlugInVersionBuild();
2090
2091 /*Provide active leg data to plugins*/
2092 virtual void SetActiveLegInfo(Plugin_Active_Leg_Info &leg_info);
2093};
2094
2096public:
2097 opencpn_plugin_118(void *pmgr);
2098
2101
2159#ifdef _MSC_VER
2160 virtual bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext,
2161 PlugIn_ViewPort *vp, int canvasIndex,
2162 int priority = -1);
2163#else
2164 virtual bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext,
2165 PlugIn_ViewPort *vp, int canvasIndex,
2166 int priority);
2167
2168 bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext, PlugIn_ViewPort *vp,
2169 int canvas_ix) override {
2170 return RenderGLOverlayMultiCanvas(pcontext, vp, canvas_ix, -1);
2171 }
2172#endif
2173
2229#ifdef _MSC_VER
2230 virtual bool RenderOverlayMultiCanvas(wxDC &dc, PlugIn_ViewPort *vp,
2231 int canvasIndex, int priority = -1);
2232#else
2233 virtual bool RenderOverlayMultiCanvas(wxDC &dc, PlugIn_ViewPort *vp,
2234 int canvas_ix, int priority);
2236 int canvas_ix) override {
2237 return RenderOverlayMultiCanvas(dc, vp, canvas_ix, -1);
2238 }
2239#endif
2240};
2241
2243public:
2244 opencpn_plugin_119(void *pmgr);
2245
2263 virtual void PreShutdownHook();
2264};
2265
2267public:
2268 opencpn_plugin_120(void *pmgr);
2269
2270 virtual void OnContextMenuItemCallbackExt(int id, std::string obj_ident,
2271 std::string obj_type, double lat,
2272 double lon);
2273};
2274
2276public:
2277 opencpn_plugin_121(void *pmgr);
2278 virtual void UpdateFollowState(int canvas_index, bool state);
2279};
2280
2281//------------------------------------------------------------------
2282// Route and Waypoint PlugIn support
2283//
2284//------------------------------------------------------------------
2285
2297class DECL_EXP Plugin_Hyperlink {
2298public:
2299 wxString DescrText;
2300 wxString Link;
2301 wxString Type;
2302};
2303
2304WX_DECLARE_LIST(Plugin_Hyperlink, Plugin_HyperlinkList);
2305
2320class DECL_EXP PlugIn_Waypoint {
2321public:
2326
2336 PlugIn_Waypoint(double lat, double lon, const wxString &icon_ident,
2337 const wxString &wp_name, const wxString &GUID = _T(""));
2339
2340 double m_lat;
2341 double m_lon;
2342 wxString m_GUID;
2343 wxString m_MarkName;
2345 wxDateTime m_CreateTime;
2347 wxString m_IconName;
2348
2349 Plugin_HyperlinkList *m_HyperlinkList;
2350};
2351
2352WX_DECLARE_LIST(PlugIn_Waypoint, Plugin_WaypointList);
2353
2360class DECL_EXP PlugIn_Route {
2361public:
2362 PlugIn_Route(void);
2363 ~PlugIn_Route(void);
2364
2365 wxString m_NameString;
2366 wxString m_StartString;
2367 wxString m_EndString;
2368 wxString m_GUID;
2369
2374 Plugin_WaypointList *pWaypointList;
2375};
2376
2390class DECL_EXP PlugIn_Track {
2391public:
2392 PlugIn_Track(void);
2393 ~PlugIn_Track(void);
2394
2395 wxString m_NameString;
2396 wxString m_StartString;
2397 wxString m_EndString;
2398 wxString m_GUID;
2399
2406 Plugin_WaypointList *pWaypointList;
2407};
2408
2409//----------------------------------------------------------------------------------------------------------
2410// The PlugIn CallBack API Definition
2411//
2412// The API back up to the PlugIn Manager
2413// PlugIns may call these static functions as necessary for system services
2414//
2415//----------------------------------------------------------------------------------------------------------
2416
2437extern "C" DECL_EXP int InsertPlugInTool(wxString label, wxBitmap *bitmap,
2438 wxBitmap *bmpRollover, wxItemKind kind,
2439 wxString shortHelp, wxString longHelp,
2440 wxObject *clientData, int position,
2441 int tool_sel, opencpn_plugin *pplugin);
2449extern "C" DECL_EXP void RemovePlugInTool(int tool_id);
2450
2459extern "C" DECL_EXP void SetToolbarToolViz(int item, bool viz);
2460
2469extern "C" DECL_EXP void SetToolbarItemState(int item, bool toggle);
2470
2480extern "C" DECL_EXP void SetToolbarToolBitmaps(int item, wxBitmap *bitmap,
2481 wxBitmap *bmpRollover);
2500extern "C" DECL_EXP int InsertPlugInToolSVG(
2501 wxString label, wxString SVGfile, wxString SVGfileRollover,
2502 wxString SVGfileToggled, wxItemKind kind, wxString shortHelp,
2503 wxString longHelp, wxObject *clientData, int position, int tool_sel,
2504 opencpn_plugin *pplugin);
2505
2516extern "C" DECL_EXP void SetToolbarToolBitmapsSVG(int item, wxString SVGfile,
2517 wxString SVGfileRollover,
2518 wxString SVGfileToggled);
2528extern "C" DECL_EXP int AddCanvasContextMenuItem(wxMenuItem *pitem,
2529 opencpn_plugin *pplugin);
2537extern "C" DECL_EXP void RemoveCanvasContextMenuItem(int item);
2538
2547extern "C" DECL_EXP void SetCanvasContextMenuItemViz(int item, bool viz);
2548
2557extern "C" DECL_EXP void SetCanvasContextMenuItemGrey(int item, bool grey);
2558
2568extern "C" DECL_EXP wxFileConfig *GetOCPNConfigObject(void);
2569
2577extern "C" DECL_EXP void RequestRefresh(wxWindow *);
2578
2594extern "C" DECL_EXP bool GetGlobalColor(wxString colorName, wxColour *pcolour);
2595
2607extern "C" DECL_EXP void GetCanvasPixLL(PlugIn_ViewPort *vp, wxPoint *pp,
2608 double lat, double lon);
2620extern "C" DECL_EXP void GetCanvasLLPix(PlugIn_ViewPort *vp, wxPoint p,
2621 double *plat, double *plon);
2629extern "C" DECL_EXP wxWindow *GetOCPNCanvasWindow();
2630
2669extern "C" DECL_EXP wxFont *OCPNGetFont(wxString TextElement,
2670 int default_size = 0);
2671
2684extern "C" DECL_EXP wxString *GetpSharedDataLocation();
2685
2694extern "C" DECL_EXP ArrayOfPlugIn_AIS_Targets *GetAISTargetArray(void);
2695
2705extern "C" DECL_EXP wxAuiManager *GetFrameAuiManager(void);
2706
2715extern "C" DECL_EXP bool AddLocaleCatalog(wxString catalog);
2716
2724extern "C" DECL_EXP void PushNMEABuffer(wxString str);
2725
2735extern DECL_EXP wxXmlDocument GetChartDatabaseEntryXML(int dbIndex,
2736 bool b_getGeom);
2747extern DECL_EXP bool UpdateChartDBInplace(wxArrayString dir_array,
2748 bool b_force_update,
2749 bool b_ProgressDialog);
2757extern DECL_EXP wxArrayString GetChartDBDirArrayString();
2758
2767extern "C" DECL_EXP void SendPluginMessage(wxString message_id,
2768 wxString message_body);
2776extern "C" DECL_EXP void DimeWindow(wxWindow *);
2777
2785extern "C" DECL_EXP void JumpToPosition(double lat, double lon, double scale);
2786
2787/* API 1.9 adds some common cartographic functions to avoid unnecessary code
2788 * duplication */
2789/* Study the original OpenCPN source (georef.c) for functional definitions */
2790
2815extern "C" DECL_EXP void PositionBearingDistanceMercator_Plugin(
2816 double lat, double lon, double brg, double dist, double *dlat,
2817 double *dlon);
2840extern "C" DECL_EXP void DistanceBearingMercator_Plugin(
2841 double lat0, double lon0, double lat1, double lon1, double *brg,
2842 double *dist);
2843
2853extern "C" DECL_EXP double DistGreatCircle_Plugin(double slat, double slon,
2854 double dlat, double dlon);
2865extern "C" DECL_EXP void toTM_Plugin(float lat, float lon, float lat0,
2866 float lon0, double *x, double *y);
2867
2878extern "C" DECL_EXP void fromTM_Plugin(double x, double y, double lat0,
2879 double lon0, double *lat, double *lon);
2880
2891extern "C" DECL_EXP void toSM_Plugin(double lat, double lon, double lat0,
2892 double lon0, double *x, double *y);
2893
2904extern "C" DECL_EXP void fromSM_Plugin(double x, double y, double lat0,
2905 double lon0, double *lat, double *lon);
2906
2917extern "C" DECL_EXP void toSM_ECC_Plugin(double lat, double lon, double lat0,
2918 double lon0, double *x, double *y);
2919
2930extern "C" DECL_EXP void fromSM_ECC_Plugin(double x, double y, double lat0,
2931 double lon0, double *lat,
2932 double *lon);
2933
2944extern "C" DECL_EXP bool DecodeSingleVDOMessage(const wxString &str,
2946 wxString *acc);
2947
2954extern "C" DECL_EXP int GetChartbarHeight(void);
2985extern "C" DECL_EXP bool GetActiveRoutepointGPX(char *buffer,
2986 unsigned int buffer_length);
2987
2988/* API 1.9 */
2989
3018
3033extern DECL_EXP wxScrolledWindow *AddOptionsPage(OptionsParentPI parent,
3034 wxString title);
3035
3043extern DECL_EXP bool DeleteOptionsPage(wxScrolledWindow *page);
3044
3045/* API 1.10 */
3046
3047/* API 1.10 adds some common functions to avoid unnecessary code duplication */
3048/* Study the original OpenCPN source for functional definitions */
3059extern "C" DECL_EXP double toUsrDistance_Plugin(double nm_distance,
3060 int unit = -1);
3061
3070extern "C" DECL_EXP double fromUsrDistance_Plugin(double usr_distance,
3071 int unit = -1);
3072
3081extern "C" DECL_EXP double toUsrSpeed_Plugin(double kts_speed, int unit = -1);
3082
3091extern "C" DECL_EXP double fromUsrSpeed_Plugin(double usr_speed, int unit = -1);
3092
3101extern "C" DECL_EXP double toUsrTemp_Plugin(double cel_temp, int unit = -1);
3102
3111extern "C" DECL_EXP double fromUsrTemp_Plugin(double usr_temp, int unit = -1);
3112
3120extern DECL_EXP wxString getUsrDistanceUnit_Plugin(int unit = -1);
3121
3129extern DECL_EXP wxString getUsrSpeedUnit_Plugin(int unit = -1);
3130
3138extern DECL_EXP wxString getUsrTempUnit_Plugin(int unit = -1);
3139
3147extern DECL_EXP wxString getUsrWindSpeedUnit_Plugin(int unit = -1);
3148
3157extern DECL_EXP double toUsrWindSpeed_Plugin(double kts_wspeed, int unit = -1);
3158
3167extern DECL_EXP double fromUsrWindSpeed_Plugin(double usr_wspeed,
3168 int unit = -1);
3169
3177extern DECL_EXP wxString getUsrDepthUnit_Plugin(int unit = -1);
3178
3187extern DECL_EXP double toUsrDepth_Plugin(double m_depth, int unit = -1);
3188
3197extern DECL_EXP double fromUsrDepth_Plugin(double usr_depth, int unit = -1);
3198
3206extern DECL_EXP wxString getUsrHeightUnit_Plugin(int unit = -1);
3207
3216extern DECL_EXP double toUsrHeight_Plugin(double m_height, int unit = -1);
3217
3226extern DECL_EXP double fromUsrHeight_Plugin(double usr_height, int unit = -1);
3227
3244extern DECL_EXP double fromDMM_PlugIn(wxString sdms);
3245
3259struct DECL_EXP DateTimeFormatOptions {
3261 virtual ~DateTimeFormatOptions();
3262
3283
3299 wxString time_zone;
3300
3308
3314
3315 int version = 1; // For future compatibility checks
3316
3336 format_string = fmt;
3337 return *this;
3338 }
3339
3358 DateTimeFormatOptions &SetTimezone(const wxString &tz) {
3359 time_zone = tz;
3360 return *this;
3361 }
3362
3370 show_timezone = show;
3371 return *this;
3372 }
3373
3392 longitude = lon;
3393 return *this;
3394 }
3395};
3396
3416extern DECL_EXP wxString toUsrDateTimeFormat_Plugin(
3417 const wxDateTime date_time,
3419
3431extern DECL_EXP wxString GetNewGUID();
3432
3445extern "C" DECL_EXP bool PlugIn_GSHHS_CrossesLand(double lat1, double lon1,
3446 double lat2, double lon2);
3453extern DECL_EXP void PlugInPlaySound(wxString &sound_file);
3454
3455// API 1.10 Route and Waypoint Support
3456
3465extern DECL_EXP wxBitmap *FindSystemWaypointIcon(wxString &icon_name);
3466
3477extern DECL_EXP bool AddCustomWaypointIcon(wxBitmap *pimage, wxString key,
3478 wxString description);
3479
3489extern DECL_EXP bool AddSingleWaypoint(PlugIn_Waypoint *pwaypoint,
3490 bool b_permanent = true);
3491
3500extern DECL_EXP bool DeleteSingleWaypoint(wxString &GUID);
3501
3510extern DECL_EXP bool UpdateSingleWaypoint(PlugIn_Waypoint *pwaypoint);
3511
3521extern DECL_EXP bool AddPlugInRoute(PlugIn_Route *proute,
3522 bool b_permanent = true);
3523
3532extern DECL_EXP bool DeletePlugInRoute(wxString &GUID);
3533
3543extern DECL_EXP bool UpdatePlugInRoute(PlugIn_Route *proute);
3544
3554extern DECL_EXP bool AddPlugInTrack(PlugIn_Track *ptrack,
3555 bool b_permanent = true);
3556
3565extern DECL_EXP bool DeletePlugInTrack(wxString &GUID);
3566
3576extern DECL_EXP bool UpdatePlugInTrack(PlugIn_Track *ptrack);
3577
3578/* API 1.11 */
3579
3580/* API 1.11 adds some more common functions to avoid unnecessary code
3581 * duplication */
3582
3591wxColour DECL_EXP GetBaseGlobalColor(wxString colorName);
3592
3606int DECL_EXP OCPNMessageBox_PlugIn(wxWindow *parent, const wxString &message,
3607 const wxString &caption = _T("Message"),
3608 int style = wxOK, int x = -1, int y = -1);
3609
3624extern DECL_EXP wxString toSDMM_PlugIn(int NEflag, double a,
3625 bool hi_precision = true);
3626
3636extern "C" DECL_EXP wxString *GetpPrivateApplicationDataLocation();
3637
3645extern DECL_EXP wxString GetOCPN_ExePath(void);
3646
3655extern "C" DECL_EXP wxString *GetpPlugInLocation();
3656
3665extern DECL_EXP wxString GetPlugInPath(opencpn_plugin *pplugin);
3666
3676extern "C" DECL_EXP int AddChartToDBInPlace(wxString &full_path,
3677 bool b_RefreshCanvas);
3684extern "C" DECL_EXP int RemoveChartFromDBInPlace(wxString &full_path);
3685
3694extern DECL_EXP wxString GetLocaleCanonicalName();
3695
3710#define PLIB_CAPS_LINE_VBO 1
3714#define PLIB_CAPS_LINE_BUFFER 1 << 1
3715
3719#define PLIB_CAPS_SINGLEGEO_BUFFER 1 << 2
3720
3724#define PLIB_CAPS_OBJSEGLIST 1 << 3
3725
3729#define PLIB_CAPS_OBJCATMUTATE 1 << 4
3730
3731class PI_S57Obj;
3732
3733WX_DECLARE_LIST(PI_S57Obj, ListOfPI_S57Obj);
3734
3735// ----------------------------------------------------------------------------
3736// PlugInChartBaseGL
3737// Derived from PlugInChartBase, add OpenGL Vector chart support
3738// ----------------------------------------------------------------------------
3739
3752class DECL_EXP PlugInChartBaseGL : public PlugInChartBase {
3753public:
3755 virtual ~PlugInChartBaseGL();
3756
3771 virtual int RenderRegionViewOnGL(const wxGLContext &glc,
3772 const PlugIn_ViewPort &VPoint,
3773 const wxRegion &Region, bool b_use_stencil);
3774
3787 virtual ListOfPI_S57Obj *GetObjRuleListAtLatLon(float lat, float lon,
3788 float select_radius,
3789 PlugIn_ViewPort *VPoint);
3790
3800 virtual wxString CreateObjDescriptions(ListOfPI_S57Obj *obj_list);
3801
3807 virtual int GetNoCOVREntries();
3808
3815 virtual int GetNoCOVRTablePoints(int iTable);
3816
3823 virtual int GetNoCOVRTablenPoints(int iTable);
3824
3831 virtual float *GetNoCOVRTableHead(int iTable);
3832};
3833
3834// ----------------------------------------------------------------------------
3835// PlugInChartBaseGLPlus2
3836// Derived from PlugInChartBaseGL, add additional chart management methods
3837// ----------------------------------------------------------------------------
3838
3848public:
3850 virtual ~PlugInChartBaseGLPlus2();
3851
3868 virtual ListOfPI_S57Obj *GetLightsObjRuleListVisibleAtLatLon(
3869 float lat, float lon, PlugIn_ViewPort *VPoint);
3870};
3871
3872// ----------------------------------------------------------------------------
3873// PlugInChartBaseExtended
3874// Derived from PlugInChartBase, add extended chart support methods
3875// ----------------------------------------------------------------------------
3876
3885public:
3887 virtual ~PlugInChartBaseExtended();
3888
3901 virtual int RenderRegionViewOnGL(const wxGLContext &glc,
3902 const PlugIn_ViewPort &VPoint,
3903 const wxRegion &Region, bool b_use_stencil);
3904
3915 virtual wxBitmap &RenderRegionViewOnDCNoText(const PlugIn_ViewPort &VPoint,
3916 const wxRegion &Region);
3917
3928 virtual bool RenderRegionViewOnDCTextOnly(wxMemoryDC &dc,
3929 const PlugIn_ViewPort &VPoint,
3930 const wxRegion &Region);
3931
3943 virtual int RenderRegionViewOnGLNoText(const wxGLContext &glc,
3944 const PlugIn_ViewPort &VPoint,
3945 const wxRegion &Region,
3946 bool b_use_stencil);
3947
3959 virtual int RenderRegionViewOnGLTextOnly(const wxGLContext &glc,
3960 const PlugIn_ViewPort &VPoint,
3961 const wxRegion &Region,
3962 bool b_use_stencil);
3963
3964 virtual ListOfPI_S57Obj *GetObjRuleListAtLatLon(float lat, float lon,
3965 float select_radius,
3966 PlugIn_ViewPort *VPoint);
3967 virtual wxString CreateObjDescriptions(ListOfPI_S57Obj *obj_list);
3968
3969 virtual int GetNoCOVREntries();
3970 virtual int GetNoCOVRTablePoints(int iTable);
3971 virtual int GetNoCOVRTablenPoints(int iTable);
3972 virtual float *GetNoCOVRTableHead(int iTable);
3973
3980 virtual void ClearPLIBTextList();
3981};
3982
3983// ----------------------------------------------------------------------------
3984// PlugInChartBaseExtendedPlus2
3985// Derived from PlugInChartBaseExtended, add additional extended chart support
3986// methods
3987// ----------------------------------------------------------------------------
3988
3990public:
3993
3994 virtual ListOfPI_S57Obj *GetLightsObjRuleListVisibleAtLatLon(
3995 float lat, float lon, PlugIn_ViewPort *VPoint);
3996};
3997
3998class wxArrayOfS57attVal;
3999
4018
4042
4071
4085
4111
4119class DECL_EXP PI_S57Obj {
4120public:
4121 // Public Methods
4122 PI_S57Obj();
4123
4124public:
4125 // Instance Data
4126 char FeatureName[8];
4128
4130 wxArrayOfS57attVal *attVal;
4132
4133 int iOBJL;
4134 int Index;
4135
4136 double x;
4137 double y;
4138 double z;
4139 int npt;
4140 void *geoPt;
4141 double *geoPtz;
4142 double *geoPtMulti;
4143
4145
4146 double m_lat;
4147 double m_lon;
4148
4151
4152 double lat_min;
4153 double lat_max;
4154 double lon_min;
4155 double lon_max;
4156
4158
4160 int nRef;
4161
4162 bool bIsAton;
4164
4169
4171
4175
4176 // Coordinate transform coefficients
4177 double x_rate;
4178 double y_rate;
4179 double x_origin;
4180 double y_origin;
4181
4182 // OpenGL rendering parameters
4187
4191};
4192
4198wxString DECL_EXP PI_GetPLIBColorScheme();
4207int DECL_EXP PI_GetPLIBDepthUnitInt();
4208
4216int DECL_EXP PI_GetPLIBSymbolStyle();
4217
4225int DECL_EXP PI_GetPLIBBoundaryStyle();
4226
4233int DECL_EXP PI_GetPLIBStateHash();
4234
4240double DECL_EXP PI_GetPLIBMarinerSafetyContour();
4241
4252bool DECL_EXP PI_GetObjectRenderBox(PI_S57Obj *pObj, double *lat_min,
4253 double *lat_max, double *lon_min,
4254 double *lon_max);
4255
4261void DECL_EXP PI_UpdateContext(PI_S57Obj *pObj);
4262
4270bool DECL_EXP PI_PLIBObjectRenderCheck(PI_S57Obj *pObj, PlugIn_ViewPort *vp);
4271
4284
4292
4300
4307void DECL_EXP PI_PLIBSetLineFeaturePriority(PI_S57Obj *pObj, int prio);
4308
4313void DECL_EXP PI_PLIBPrepareForNewRender(void);
4314
4320void DECL_EXP PI_PLIBFreeContext(void *pContext);
4321
4331void DECL_EXP PI_PLIBSetRenderCaps(unsigned int flags);
4332
4342bool DECL_EXP PI_PLIBSetContext(PI_S57Obj *pObj);
4343
4358int DECL_EXP PI_PLIBRenderObjectToDC(wxDC *pdc, PI_S57Obj *pObj,
4359 PlugIn_ViewPort *vp);
4360
4377int DECL_EXP PI_PLIBRenderAreaToDC(wxDC *pdc, PI_S57Obj *pObj,
4378 PlugIn_ViewPort *vp, wxRect rect,
4379 unsigned char *pixbuf);
4380
4395int DECL_EXP PI_PLIBRenderAreaToGL(const wxGLContext &glcc, PI_S57Obj *pObj,
4396 PlugIn_ViewPort *vp, wxRect &render_rect);
4397
4414int DECL_EXP PI_PLIBRenderObjectToGL(const wxGLContext &glcc, PI_S57Obj *pObj,
4415 PlugIn_ViewPort *vp, wxRect &render_rect);
4416
4417/* API 1.11 OpenGL Display List and vertex buffer object routines
4418
4419 Effectively these two routines cancel each other so all
4420 of the translation, scaling and rotation can be done by opengl.
4421
4422 Display lists need only be built infrequently, but used in each frame
4423 greatly accelerates the speed of rendering. This avoids costly calculations,
4424 and also allows the vertexes to be stored in graphics memory.
4425
4426 static int dl = 0;
4427 glPushMatrix();
4428 PlugInMultMatrixViewport(current_viewport);
4429 if(dl)
4430 glCallList(dl);
4431 else {
4432 dl = glGenLists(1);
4433 PlugInViewPort norm_viewport = current_viewport;
4434 NormalizeViewPort(norm_viewport);
4435 glNewList(dl, GL_COMPILE_AND_EXECUTE);
4436 ... // use norm_viewport with GetCanvasLLPix here
4437 glEndList();
4438 }
4439 glPopMatrix();
4440 ... // use current_viewport with GetCanvasLLPix again
4441*/
4442
4452extern DECL_EXP bool PlugInHasNormalizedViewPort(PlugIn_ViewPort *vp);
4453
4468extern DECL_EXP void PlugInMultMatrixViewport(PlugIn_ViewPort *vp,
4469 float lat = 0, float lon = 0);
4470
4485extern DECL_EXP void PlugInNormalizeViewport(PlugIn_ViewPort *vp, float lat = 0,
4486 float lon = 0);
4487
4488class wxPoint2DDouble;
4489
4501extern "C" DECL_EXP void GetDoubleCanvasPixLL(PlugIn_ViewPort *vp,
4502 wxPoint2DDouble *pp, double lat,
4503 double lon);
4504
4505/* API 1.13 */
4506/* API 1.13 adds some more common functions to avoid unnecessary code
4507 * duplication */
4508
4517extern DECL_EXP double fromDMM_Plugin(wxString sdms);
4518
4529extern DECL_EXP void SetCanvasRotation(double rotation);
4530
4542extern DECL_EXP void SetCanvasProjection(int projection);
4543
4553extern DECL_EXP bool GetSingleWaypoint(wxString GUID,
4554 PlugIn_Waypoint *pwaypoint);
4555
4568extern DECL_EXP bool CheckEdgePan_PlugIn(int x, int y, bool dragging,
4569 int margin, int delta);
4570
4579extern DECL_EXP wxBitmap GetIcon_PlugIn(const wxString &name);
4580
4588extern DECL_EXP void SetCursor_PlugIn(wxCursor *pPlugin_Cursor = NULL);
4589
4625extern DECL_EXP wxFont *GetOCPNScaledFont_PlugIn(wxString TextElement,
4626 int default_size = 0);
4627
4641extern DECL_EXP wxFont GetOCPNGUIScaledFont_PlugIn(wxString item);
4642
4658extern DECL_EXP double GetOCPNGUIToolScaleFactor_PlugIn(int GUIScaledFactor);
4659
4674extern DECL_EXP double GetOCPNGUIToolScaleFactor_PlugIn();
4675
4690extern DECL_EXP float GetOCPNChartScaleFactor_Plugin();
4691
4699extern DECL_EXP wxColour GetFontColour_PlugIn(wxString TextElement);
4700
4711extern DECL_EXP double GetCanvasTilt();
4712
4723extern DECL_EXP void SetCanvasTilt(double tilt);
4724
4730extern DECL_EXP bool PlugInPlaySoundEx(wxString &sound_file,
4731 int deviceIndex = -1);
4732
4745extern DECL_EXP void AddChartDirectory(wxString &path);
4746
4757extern DECL_EXP void ForceChartDBUpdate();
4758
4770extern DECL_EXP void ForceChartDBRebuild();
4771
4777extern DECL_EXP wxString GetWritableDocumentsDir(void);
4778
4784extern DECL_EXP wxDialog *GetActiveOptionsDialog();
4785
4796extern DECL_EXP wxArrayString GetWaypointGUIDArray(void);
4797
4803extern DECL_EXP wxArrayString GetIconNameArray(void);
4804
4815extern DECL_EXP bool AddPersistentFontKey(wxString TextElement);
4816
4828extern DECL_EXP wxString GetActiveStyleName();
4829
4845extern DECL_EXP wxBitmap GetBitmapFromSVGFile(wxString filename,
4846 unsigned int width,
4847 unsigned int height);
4848
4861extern DECL_EXP bool IsTouchInterface_PlugIn(void);
4862
4863/* Platform optimized File/Dir selector dialogs */
4882extern DECL_EXP int PlatformDirSelectorDialog(wxWindow *parent,
4883 wxString *file_spec,
4884 wxString Title, wxString initDir);
4885
4907extern DECL_EXP int PlatformFileSelectorDialog(wxWindow *parent,
4908 wxString *file_spec,
4909 wxString Title, wxString initDir,
4910 wxString suggestedName,
4911 wxString wildcard);
4912
4913/* OpenCPN HTTP File Download PlugIn Interface */
4914
4915/* Various method Return Codes, etc */
4930
4943
4944// Style definitions for Synchronous file download modal dialogs, if
4945// desired. Abstracted from wxCURL package
4949 0x0002,
4952 OCPN_DLDS_SIZE = 0x0010,
4955 0x0020,
4956
4957 // styles related to the use of wxCurlConnectionSettingsDialog:
4958
4960 0x0040,
4965 0x0100,
4966
4967 OCPN_DLDS_CONN_SETTINGS_ALL = OCPN_DLDS_CONN_SETTINGS_AUTH |
4970
4971 OCPN_DLDS_SHOW_ALL = OCPN_DLDS_ELAPSED_TIME | OCPN_DLDS_ESTIMATED_TIME |
4974 OCPN_DLDS_CONN_SETTINGS_ALL,
4975
4977 OCPN_DLDS_CAN_START = 0x0400,
4980
4982 0x1000,
4983
4984 // by default all available features are enabled:
4985 OCPN_DLDS_DEFAULT_STYLE = OCPN_DLDS_CAN_START | OCPN_DLDS_CAN_PAUSE |
4986 OCPN_DLDS_CAN_ABORT | OCPN_DLDS_SHOW_ALL |
4988};
4989
4990#define ONLINE_CHECK_RETRY \
4991 30 // Recheck the Internet connection availability every ONLINE_CHECK_RETRY s
4992
5013extern DECL_EXP _OCPN_DLStatus OCPN_downloadFile(
5014 const wxString &url, const wxString &outputFile, const wxString &title,
5015 const wxString &message, const wxBitmap &bitmap, wxWindow *parent,
5016 long style, int timeout_secs);
5017
5035extern DECL_EXP _OCPN_DLStatus
5036OCPN_downloadFileBackground(const wxString &url, const wxString &outputFile,
5037 wxEvtHandler *handler, long *handle);
5038
5044extern DECL_EXP void OCPN_cancelDownloadFileBackground(long handle);
5045
5057extern DECL_EXP _OCPN_DLStatus OCPN_postDataHttp(const wxString &url,
5058 const wxString &parameters,
5059 wxString &result,
5060 int timeout_secs);
5061
5067extern DECL_EXP bool OCPN_isOnline();
5068
5069/* Supporting Event for Background downloading */
5070/* OCPN_downloadEvent Definition */
5071
5072/* PlugIn should be ready/able to handle this event after initiating a
5073 * background file transfer
5074 *
5075 * The event as received should be parsed primarily by the getDLEventCondition()
5076 * method. This will allow identification of download start, progress, and end
5077 * states.
5078 *
5079 * Other accessor methods contain status, byte counts, etc.
5080 *
5081 * A PlugIn may safely destroy its EvtHandler after receipt of an
5082 * OCPN_downloadEvent with getDLEventCondition == OCPN_DL_EVENT_TYPE_END
5083 */
5084class DECL_EXP OCPN_downloadEvent : public wxEvent {
5085public:
5086 OCPN_downloadEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
5088
5089 // accessors
5090 _OCPN_DLStatus getDLEventStatus() { return m_stat; }
5091 OCPN_DLCondition getDLEventCondition() { return m_condition; }
5092
5093 void setDLEventStatus(_OCPN_DLStatus stat) { m_stat = stat; }
5094 void setDLEventCondition(OCPN_DLCondition cond) { m_condition = cond; }
5095
5096 void setTotal(long bytes) { m_totalBytes = bytes; }
5097 void setTransferred(long bytes) { m_sofarBytes = bytes; }
5098 long getTotal() { return m_totalBytes; }
5099 long getTransferred() { return m_sofarBytes; }
5100
5101 void setComplete(bool b_complete) { m_b_complete = b_complete; }
5102 bool getComplete() { return m_b_complete; }
5103
5104 // required for sending with wxPostEvent()
5105 wxEvent *Clone() const;
5106
5107private:
5108 OCPN_DLStatus m_stat;
5109 OCPN_DLCondition m_condition;
5110
5111 long m_totalBytes;
5112 long m_sofarBytes;
5113 bool m_b_complete;
5114};
5115
5116// extern WXDLLIMPEXP_CORE const wxEventType wxEVT_DOWNLOAD_EVENT;
5117
5118#ifdef MAKING_PLUGIN
5119extern DECL_IMP wxEventType wxEVT_DOWNLOAD_EVENT;
5120#else
5121extern DECL_EXP wxEventType wxEVT_DOWNLOAD_EVENT;
5122#endif
5123
5124/* API 1.14 */
5125/* API 1.14 adds some more common functions to avoid unnecessary code
5126 * duplication */
5127
5128extern DECL_EXP bool LaunchDefaultBrowser_Plugin(wxString url);
5129
5130// API 1.14 Extra canvas Support
5131
5147extern DECL_EXP void PlugInAISDrawGL(wxGLCanvas *glcanvas,
5148 const PlugIn_ViewPort &vp);
5149
5159extern DECL_EXP bool PlugInSetFontColor(const wxString TextElement,
5160 const wxColour color);
5161
5162// API 1.15
5163
5178extern DECL_EXP double PlugInGetDisplaySizeMM();
5179
5192extern DECL_EXP wxFont *FindOrCreateFont_PlugIn(
5193 int point_size, wxFontFamily family, wxFontStyle style, wxFontWeight weight,
5194 bool underline = false, const wxString &facename = wxEmptyString,
5195 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
5196
5216
5229
5243extern DECL_EXP void PlugInHandleAutopilotRoute(bool enable);
5244
5245// API 1.16
5246//
5261extern DECL_EXP wxString GetPluginDataDir(const char *plugin_name);
5262
5268extern DECL_EXP bool ShuttingDown(void);
5269
5270// Support for MUI MultiCanvas model
5271
5294extern DECL_EXP wxWindow *PluginGetFocusCanvas();
5295
5304extern DECL_EXP wxWindow *PluginGetOverlayRenderCanvas();
5305
5314extern "C" DECL_EXP void CanvasJumpToPosition(wxWindow *canvas, double lat,
5315 double lon, double scale);
5327extern "C" DECL_EXP int AddCanvasMenuItem(wxMenuItem *pitem,
5328 opencpn_plugin *pplugin,
5329 const char *name = "");
5338extern "C" DECL_EXP void RemoveCanvasMenuItem(int item, const char *name = "");
5339
5349extern "C" DECL_EXP void SetCanvasMenuItemViz(int item, bool viz,
5350 const char *name = "");
5351
5361extern "C" DECL_EXP void SetCanvasMenuItemGrey(int item, bool grey,
5362 const char *name = "");
5363
5364// Extract waypoints, routes and tracks
5370extern DECL_EXP wxString GetSelectedWaypointGUID_Plugin();
5371
5377extern DECL_EXP wxString GetSelectedRouteGUID_Plugin();
5378
5384extern DECL_EXP wxString GetSelectedTrackGUID_Plugin();
5385
5392extern DECL_EXP std::unique_ptr<PlugIn_Waypoint> GetWaypoint_Plugin(
5393 const wxString &);
5394
5401extern DECL_EXP std::unique_ptr<PlugIn_Route> GetRoute_Plugin(const wxString &);
5402
5409extern DECL_EXP std::unique_ptr<PlugIn_Track> GetTrack_Plugin(const wxString &);
5410
5416extern DECL_EXP wxWindow *GetCanvasUnderMouse();
5417
5431extern DECL_EXP int GetCanvasIndexUnderMouse();
5432
5433// extern DECL_EXP std::vector<wxWindow *> GetCanvasArray();
5446extern DECL_EXP wxWindow *GetCanvasByIndex(int canvasIndex);
5447
5458extern DECL_EXP int GetCanvasCount();
5459
5474extern DECL_EXP bool CheckMUIEdgePan_PlugIn(int x, int y, bool dragging,
5475 int margin, int delta,
5476 int canvasIndex);
5477
5486extern DECL_EXP void SetMUICursor_PlugIn(wxCursor *pCursor, int canvasIndex);
5487
5488// API 1.17
5489//
5490
5499extern DECL_EXP wxRect GetMasterToolbarRect();
5500
5520
5528extern DECL_EXP int GetLatLonFormat(void);
5529
5530// API 1.17
5531
5542extern "C" DECL_EXP void ZeroXTE();
5543
5567class DECL_EXP PlugIn_Waypoint_Ex {
5568public:
5570 PlugIn_Waypoint_Ex(double lat, double lon, const wxString &icon_ident,
5571 const wxString &wp_name, const wxString &GUID = "",
5572 const double ScaMin = 1e9, const bool bNameVisible = false,
5573 const int nRanges = 0, const double RangeDistance = 1.0,
5574 const wxColor RangeColor = wxColor(255, 0, 0));
5586 void InitDefaults();
5587
5599 bool GetFSStatus();
5600
5609 int GetRouteMembershipCount();
5610
5611 double m_lat;
5612 double m_lon;
5613 wxString m_GUID;
5614 wxString m_MarkName;
5616 wxDateTime m_CreateTime;
5619
5620 double scamin;
5623
5627
5628 wxString IconName;
5630
5636 Plugin_HyperlinkList *m_HyperlinkList;
5637};
5638
5639WX_DECLARE_LIST(PlugIn_Waypoint_Ex, Plugin_WaypointExList);
5640
5641class DECL_EXP PlugIn_Waypoint_ExV2 {
5642public:
5644 PlugIn_Waypoint_ExV2(double lat, double lon, const wxString &icon_ident,
5645 const wxString &wp_name, const wxString &GUID = "",
5646 const double ScaMin = 1e9, const double ScaMax = 1e6,
5647 const bool bNameVisible = false,
5648 const int nRangeRings = 0,
5649 const double RangeDistance = 1.0,
5650 const int RangeRingSpaceUnits = 0, // 0:nm, 1:km
5651 const wxColor RangeColor = wxColor(255, 0, 0),
5652 const double WaypointArrivalRadius = 0.0,
5653 const bool ShowWaypointRangeRings = false,
5654 const double PlannedSpeed = 0.0,
5655 const wxString TideStation = wxEmptyString);
5656
5657 virtual ~PlugIn_Waypoint_ExV2();
5658
5670 bool GetFSStatus();
5671
5680 int GetRouteMembershipCount();
5681
5682 double m_lat;
5683 double m_lon;
5684 wxString m_GUID;
5685 wxString m_MarkName;
5687 wxDateTime m_CreateTime;
5690
5691 double scamin;
5694
5699
5700 wxString IconName;
5702
5708 Plugin_HyperlinkList *m_HyperlinkList;
5709
5710 // New fields that are not in PlugIn_Waypoint_Ex
5711 double scamax;
5716 wxDateTime m_ETD;
5719
5720protected:
5731 void InitDefaults();
5732};
5733
5734WX_DECLARE_LIST(PlugIn_Waypoint_ExV2, Plugin_WaypointExV2List);
5735
5758class DECL_EXP PlugIn_Route_Ex {
5759public:
5760 PlugIn_Route_Ex(void);
5761 ~PlugIn_Route_Ex(void);
5762
5763 wxString m_NameString;
5764 wxString m_StartString;
5765 wxString m_EndString;
5766 wxString m_GUID;
5769 wxString m_Description;
5770
5776 Plugin_WaypointExList *pWaypointList;
5777};
5778
5793class DECL_EXP PlugIn_Route_ExV2 {
5794public:
5796 virtual ~PlugIn_Route_ExV2();
5797
5798 wxString m_NameString;
5799 wxString m_StartString;
5800 wxString m_EndString;
5801 wxString m_GUID;
5804 wxString m_Description;
5805
5811 Plugin_WaypointExV2List *pWaypointList;
5812};
5813
5821extern DECL_EXP wxArrayString GetRouteGUIDArray(void);
5822
5830extern DECL_EXP wxArrayString GetTrackGUIDArray(void);
5831
5839extern DECL_EXP bool GetSingleWaypointEx(wxString GUID,
5840 PlugIn_Waypoint_Ex *pwaypoint);
5841
5849extern DECL_EXP bool GetSingleWaypointExV2(wxString GUID,
5850 PlugIn_Waypoint_ExV2 *pwaypoint);
5851
5859extern DECL_EXP bool AddSingleWaypointEx(PlugIn_Waypoint_Ex *pwaypoint,
5860 bool b_permanent = true);
5861
5869extern DECL_EXP bool AddSingleWaypointExV2(PlugIn_Waypoint_ExV2 *pwaypoint,
5870 bool b_permanent = true);
5871
5878extern DECL_EXP bool UpdateSingleWaypointEx(PlugIn_Waypoint_Ex *pwaypoint);
5879
5886extern DECL_EXP bool UpdateSingleWaypointExV2(PlugIn_Waypoint_ExV2 *pwaypoint);
5887
5895extern DECL_EXP bool AddPlugInRouteEx(PlugIn_Route_Ex *proute,
5896 bool b_permanent = true);
5897
5904extern DECL_EXP bool AddPlugInRouteExV2(PlugIn_Route_ExV2 *proute,
5905 bool b_permanent = true);
5906
5913extern DECL_EXP bool UpdatePlugInRouteEx(PlugIn_Route_Ex *proute);
5914
5923extern DECL_EXP bool UpdatePlugInRouteExV2(PlugIn_Route_ExV2 *proute);
5924
5933extern DECL_EXP std::unique_ptr<PlugIn_Waypoint_Ex> GetWaypointEx_Plugin(
5934 const wxString &GUID);
5935
5944extern DECL_EXP std::unique_ptr<PlugIn_Waypoint_ExV2> GetWaypointExV2_Plugin(
5945 const wxString &GUID);
5946
5955extern DECL_EXP std::unique_ptr<PlugIn_Route_Ex> GetRouteEx_Plugin(
5956 const wxString &GUID);
5957
5966extern DECL_EXP std::unique_ptr<PlugIn_Route_ExV2> GetRouteExV2_Plugin(
5967 const wxString &GUID);
5968
5974extern DECL_EXP wxString GetActiveWaypointGUID(void);
5975
5981extern DECL_EXP wxString GetActiveRouteGUID(void);
5982
5983// API 1.18
5984
5999extern DECL_EXP double OCPN_GetDisplayContentScaleFactor();
6000
6015extern DECL_EXP double OCPN_GetWinDIPScaleFactor();
6016
6024extern DECL_EXP std::vector<std::string> GetPriorityMaps();
6025
6030extern DECL_EXP void UpdateAndApplyPriorityMaps(std::vector<std::string> map);
6031
6039extern DECL_EXP std::vector<std::string> GetActivePriorityIdentifiers();
6040
6048extern DECL_EXP int GetGlobalWatchdogTimoutSeconds();
6049
6061
6062// FIXME (dave) Implement these
6079extern DECL_EXP wxArrayString GetRouteGUIDArray(OBJECT_LAYER_REQ req);
6080
6096extern DECL_EXP wxArrayString GetTrackGUIDArray(OBJECT_LAYER_REQ req);
6097
6115extern DECL_EXP wxArrayString GetWaypointGUIDArray(OBJECT_LAYER_REQ req);
6116
6119/* Listening to messages. */
6120class ObservableListener;
6121
6123class ObservedEvt;
6124
6125// This is a verbatim copy from observable_evt.h, don't define twice.
6126#ifndef OBSERVABLE_EVT_H
6127#define OBSERVABLE_EVT_H
6128
6129wxDECLARE_EVENT(obsNOTIFY, ObservedEvt);
6130
6145class ObservedEvt : public wxCommandEvent {
6146public:
6153 ObservedEvt(wxEventType commandType = obsNOTIFY, int id = 0)
6154 : wxCommandEvent(commandType, id) {}
6155 ObservedEvt(const ObservedEvt &event) : wxCommandEvent(event) {
6156 this->m_shared_ptr = event.m_shared_ptr;
6157 }
6158
6166 wxEvent *Clone() const { return new ObservedEvt(*this); }
6167
6173 std::shared_ptr<const void> GetSharedPtr() const { return m_shared_ptr; }
6174
6180 void SetSharedPtr(std::shared_ptr<const void> p) { m_shared_ptr = p; }
6181
6182private:
6183 std::shared_ptr<const void> m_shared_ptr;
6184};
6185
6186#endif // OBSERVABLE_EVT_H
6187
6188class ObservableListener;
6189
6197 const uint64_t id;
6202 NMEA2000Id(int value) : id(static_cast<uint64_t>(value)) {};
6203};
6204
6215extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
6216 NMEA2000Id id, wxEventType ev, wxEvtHandler *handler);
6217
6225 const std::string id;
6230 NMEA0183Id(const std::string &s) : id(s) {};
6231};
6232
6243extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
6244 NMEA0183Id id, wxEventType ev, wxEvtHandler *handler);
6245
6253 const std::string id;
6258 SignalkId(const std::string &s) : id(s) {};
6259};
6260
6271extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
6272 SignalkId id, wxEventType ev, wxEvtHandler *handler);
6273
6289extern DECL_EXP std::vector<uint8_t> GetN2000Payload(NMEA2000Id id,
6290 ObservedEvt ev);
6291
6308extern DECL_EXP std::shared_ptr<void> GetSignalkPayload(ObservedEvt ev);
6309
6314extern DECL_EXP std::string GetN2000Source(NMEA2000Id id, ObservedEvt ev);
6315
6317extern DECL_EXP std::string GetN0183Payload(NMEA0183Id id, ObservedEvt ev);
6318
6326 const int type;
6331 NavDataId() : type(0) {}
6332};
6333
6345extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
6346 NavDataId id, wxEventType ev, wxEvtHandler *handler);
6347
6355 double lat;
6356 double lon;
6357 double sog;
6358 double cog;
6359 double var;
6360 double hdt;
6361 time_t time;
6362};
6363
6365extern DECL_EXP PluginNavdata GetEventNavdata(ObservedEvt ev);
6366
6368/*
6369 * Plugins may access comm ports for direct output.
6370 * The general program flow for a plugin may look something like this
6371 * pseudo-code:
6372 * 1. Plugin will query OCPN core for a list of active comm drivers.
6373 * 2. Plugin will inspect the list, and query OCPN core for driver
6374 * attributes.
6375 * 3. Plugin will select a comm driver with appropriate attributes for output.
6376 * 4. Plugin will register a list of PGNs expected to be transmitted
6377 * (N2K specific)
6378 * 5. Plugin may then send a payload buffer to a specific comm driver for
6379 * output as soon as possible.
6380 *
6381 * The mechanism for specifying a particular comm driver uses the notion of
6382 * "handles". Each active comm driver has an associated opaque handle, managed
6383 * by OCPN core. All references by a plugin to a driver are by means of its
6384 * handle. Handles should be considered to be "opaque", meaning that the exact
6385 * contents of the handle are of no specific value to the plugin, and only
6386 * have meaning to the OCPN core management of drivers.
6387 */
6388
6390typedef std::string DriverHandle;
6391
6414
6416extern DECL_EXP std::vector<DriverHandle> GetActiveDrivers();
6417
6432extern DECL_EXP const std::unordered_map<std::string, std::string>
6434
6435/* Writing to a specific driver */
6455extern DECL_EXP CommDriverResult WriteCommDriver(
6456 DriverHandle handle, const std::shared_ptr<std::vector<uint8_t>> &payload);
6457
6459extern DECL_EXP CommDriverResult WriteCommDriverN2K(
6460 DriverHandle handle, int PGN, int destinationCANAddress, int priority,
6461 const std::shared_ptr<std::vector<uint8_t>> &payload);
6462
6505extern DECL_EXP CommDriverResult RegisterTXPGNs(DriverHandle handle,
6506 std::vector<int> &pgn_list);
6507
6508// API 1.20
6509//
6510
6547
6550 const std::string id;
6551 PluginMsgId(const std::string &s) : id(s) {};
6552};
6553
6558extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
6559 PluginMsgId id, wxEventType ev, wxEvtHandler *handler);
6560
6565extern DECL_EXP std::string GetPluginMsgPayload(PluginMsgId id, ObservedEvt ev);
6566
6572extern DECL_EXP void ExitOCPN();
6573
6582extern "C" DECL_EXP void RequestWindowRefresh(wxWindow *win,
6583 bool eraseBackground);
6584
6590extern DECL_EXP bool GetFullScreen();
6591
6597extern DECL_EXP void SetFullScreen(bool full_screen_on);
6598
6604extern DECL_EXP void EnableTouchMode(bool enable);
6605
6611extern DECL_EXP bool GetTouchMode();
6612
6620extern DECL_EXP void SetGlobalColor(std::string table, std::string name,
6621 wxColor color);
6622
6630extern DECL_EXP wxColor GetGlobalColorD(std::string map_name, std::string name);
6631
6637extern DECL_EXP void EnableStatusBar(bool enable);
6638
6644extern DECL_EXP void EnableMenu(bool enable);
6645
6651extern DECL_EXP bool GetEnableStatusBar();
6652
6658extern DECL_EXP bool GetEnableMenu();
6659
6669extern DECL_EXP void SetNavigationMode(PI_NavMode mode, int CanvasIndex);
6670
6677extern DECL_EXP PI_NavMode GetNavigationMode(int CanvasIndex);
6678
6686extern DECL_EXP void EnableLookaheadMode(bool enable, int CanvasIndex);
6687
6694extern DECL_EXP bool GetEnableLookaheadMode(int CanvasIndex);
6695
6702extern DECL_EXP void EnableMUIBar(bool enable, int CanvasIndex);
6703
6710extern DECL_EXP void EnableCompassGPSIcon(bool enable, int CanvasIndex);
6711
6718extern DECL_EXP void EnableChartBar(bool enable, int CanvasIndex);
6719
6726extern DECL_EXP bool GetEnableMUIBar(int CanvasIndex);
6727
6734extern DECL_EXP bool GetEnableCompassGPSIcon(int CanvasIndex);
6735
6742extern DECL_EXP bool GetEnableChartBar(int CanvasIndex);
6743
6751extern DECL_EXP void EnableCanvasFocusBar(bool enable, int CanvasIndex);
6752
6759extern DECL_EXP bool GetEnableCanvasFocusBar(int CanvasIndex);
6760
6761/*
6762 * Allow plugin control of "Chart Panel Options" dialog
6763 */
6764
6771extern DECL_EXP void EnableLatLonGrid(bool enable, int CanvasIndex);
6772
6779extern DECL_EXP void EnableChartOutlines(bool enable, int CanvasIndex);
6780
6787extern DECL_EXP void EnableDepthUnitDisplay(bool enable, int CanvasIndex);
6788
6795extern DECL_EXP void EnableAisTargetDisplay(bool enable, int CanvasIndex);
6796
6803extern DECL_EXP void EnableTideStationsDisplay(bool enable, int CanvasIndex);
6804
6811extern DECL_EXP void EnableCurrentStationsDisplay(bool enable, int CanvasIndex);
6812
6819extern DECL_EXP void EnableENCTextDisplay(bool enable, int CanvasIndex);
6820
6827extern DECL_EXP void EnableENCDepthSoundingsDisplay(bool enable,
6828 int CanvasIndex);
6829
6836extern DECL_EXP void EnableBuoyLightLabelsDisplay(bool enable, int CanvasIndex);
6837
6844extern DECL_EXP void EnableLightsDisplay(bool enable, int CanvasIndex);
6845
6852extern DECL_EXP void EnableLightDescriptionsDisplay(bool enable,
6853 int CanvasIndex);
6854
6861extern DECL_EXP void SetENCDisplayCategory(PI_DisCat cat, int CanvasIndex);
6862
6869extern DECL_EXP bool GetEnableLatLonGrid(int CanvasIndex);
6870
6877extern DECL_EXP bool GetEnableChartOutlines(int CanvasIndex);
6878
6885extern DECL_EXP bool GetEnableDepthUnitDisplay(int CanvasIndex);
6886
6893extern DECL_EXP bool GetEnableAisTargetDisplay(int CanvasIndex);
6894
6901extern DECL_EXP bool GetEnableTideStationsDisplay(int CanvasIndex);
6902
6909extern DECL_EXP bool GetEnableCurrentStationsDisplay(int CanvasIndex);
6910
6917extern DECL_EXP bool GetEnableENCTextDisplay(int CanvasIndex);
6918
6925extern DECL_EXP bool GetEnableENCDepthSoundingsDisplay(int CanvasIndex);
6926
6933extern DECL_EXP bool GetEnableBuoyLightLabelsDisplay(int CanvasIndex);
6934
6941extern DECL_EXP bool GetEnableLightsDisplay(int CanvasIndex);
6942
6949extern DECL_EXP bool GetEnableLightDescriptionsDisplay(int CanvasIndex);
6950
6961extern DECL_EXP PI_DisCat GetENCDisplayCategory(int CanvasIndex);
6962
6971extern DECL_EXP void PluginSetFollowMode(int CanvasIndex, bool enable_follow);
6972
6979extern DECL_EXP bool PluginGetFollowMode(int CanvasIndex);
6980
6988extern DECL_EXP void SetTrackingMode(bool enable);
6989
6995extern DECL_EXP bool GetTrackingMode();
6996
7004extern DECL_EXP void SetAppColorScheme(PI_ColorScheme cs);
7005
7011extern DECL_EXP PI_ColorScheme GetAppColorScheme();
7012
7021extern DECL_EXP void EnableSplitScreenLayout(bool enable = true);
7022
7023// ChartCanvas control utilities
7024
7032extern DECL_EXP void PluginZoomCanvas(int CanvasIndex, double factor);
7033
7039extern DECL_EXP bool GetEnableMainToolbar();
7040
7046extern DECL_EXP void SetEnableMainToolbar(bool enable);
7047
7052extern DECL_EXP void ShowGlobalSettingsDialog();
7053
7059extern DECL_EXP void PluginCenterOwnship(int CanvasIndex);
7060
7068extern DECL_EXP bool GetEnableTenHertzUpdate();
7069
7076extern DECL_EXP void EnableTenHertzUpdate(bool enable);
7077
7083extern DECL_EXP void ConfigFlushAndReload();
7084
7085/*
7086 * Reload and restore all connections by direct read of config file
7087 */
7088extern DECL_EXP void ReloadConfigConnections();
7089
7093enum class PI_NotificationSeverity : int {
7094 PI_kInformational = 0,
7095 PI_kWarning = 1,
7096 PI_kCritical = 2
7097};
7098
7100public:
7102 const std::string &_message, int _timeout_start,
7103 int _timeout_left, std::string _guid);
7104 virtual ~PI_Notification() {};
7105
7106 PI_NotificationSeverity severity;
7107 std::string message;
7108 int auto_timeout_left;
7109 int auto_timeout_start;
7110 std::string guid;
7111 std::string action_verb; // Either "ACK" or "POST", when set by a
7112 // PI_Notification message payload.
7113 // Empty otherwise
7114};
7115
7116extern DECL_EXP int GetActiveNotificationCount();
7117extern DECL_EXP PI_NotificationSeverity GetMaxActiveNotificationLevel();
7118extern DECL_EXP std::string RaiseNotification(
7119 const PI_NotificationSeverity _severity, const std::string &_message,
7120 int timeout_secs = -1);
7121extern DECL_EXP bool AcknowledgeNotification(const std::string &guid);
7122extern DECL_EXP std::vector<std::shared_ptr<PI_Notification>>
7123GetActiveNotifications();
7124extern DECL_EXP void EnableNotificationCanvasIcon(bool enable);
7125
7126/*
7127 * Messaging interface for Notification Framework
7128 *
7129 */
7130
7131/*
7132 * Typical use pattern
7133 *
7134 * 1) Establish listener
7135 wxDEFINE_EVENT(EVT_NOTIFICATION_FRAME, ObservedEvt);
7136 static std::shared_ptr<ObservableListener> listener_note;
7137 NotificationMsgId note_id = NotificationMsgId();
7138 listener_note = GetListener(note_id, EVT_NOTIFICATION_FRAME, this);
7139 Bind(EVT_NOTIFICATION_FRAME, [&](ObservedEvt ev) { HandleNotification(ev); });
7140 *
7141 *
7142 *
7143 * 2) Define actions on receipt
7144 static void HandleNotification(ObservedEvt &ev) {
7145 NotificationMsgId id;
7146 std::shared_ptr<PI_Notification>payload=GetNotificationMsgPayload(id, ev);
7147 if (payload->action_verb == "ACK"){
7148 // Do Acknowledge notification actions
7149 }
7150 else if (payload->action_verb == "POST") {
7151 // Do Add Notification actions
7152 }
7153 }
7154
7155*/
7158 const std::string id;
7159 NotificationMsgId(const std::string &s) : id(s) {};
7160 NotificationMsgId() {};
7161};
7162
7167extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
7168 NotificationMsgId id, wxEventType ev, wxEvtHandler *handler);
7169
7173extern DECL_EXP std::shared_ptr<PI_Notification> GetNotificationMsgPayload(
7175
7176// * Plugin polled Comm Status support
7177enum class PI_Conn_Bus : int { N0183 = 0, Signalk = 1, N2000 = 2 };
7178
7179enum class PI_Comm_State : int {
7180 Disabled = 0,
7181 NoStats = 1,
7182 NoData = 2,
7183 Unavailable = 3,
7184 Ok = 4
7185};
7186
7188public:
7189 PI_Comm_State state;
7190 unsigned rx_count;
7191 unsigned tx_count;
7192 unsigned error_count;
7193};
7194
7195extern DECL_EXP PI_Comm_Status GetConnState(const std::string &iface,
7196 PI_Conn_Bus _bus);
7197
7198extern "C" DECL_EXP int AddCanvasContextMenuItemExt(
7199 wxMenuItem *pitem, opencpn_plugin *pplugin, const std::string object_type);
7200
7201// Plugin API121 Utility functions
7202
7203extern DECL_EXP wxString DropMarkPI(double lat, double lon);
7204extern DECL_EXP wxString RouteCreatePI(int canvas_index, bool start);
7205extern DECL_EXP wxString NavToHerePI(double lat, double lon);
7206extern DECL_EXP bool ActivateRoutePI(wxString route_guid, bool activate);
7207
7208extern DECL_EXP void EnableDefaultConsole(bool enable);
7209extern DECL_EXP void EnableDefaultContextMenus(bool enable);
7210
7211extern DECL_EXP void SetMinZoomScale(double min_scale);
7212extern DECL_EXP void SetMaxZoomScale(double max_scale);
7213
7214extern DECL_EXP wxBitmap GetObjectIcon_PlugIn(const wxString &name);
7215
7216extern DECL_EXP void SetDepthUnitVisible(bool bviz);
7217extern DECL_EXP void SetOverzoomFlagVisible(bool bviz);
7218
7219extern DECL_EXP bool IsRouteActive(wxString route_guid);
7220extern DECL_EXP void SetBoatPosition(double zlat, double zlon);
7221
7222extern DECL_EXP void RouteInsertWaypoint(int canvas_index, wxString route_guid,
7223 double zlat, double zlon);
7224extern DECL_EXP void RouteAppendWaypoint(int canvas_index, wxString route_guid);
7225extern DECL_EXP void FinishRoute(int canvas_index);
7226extern DECL_EXP bool IsRouteBeingCreated(int canvas_index);
7227extern DECL_EXP bool AreRouteWaypointNamesVisible(wxString route_guid);
7228extern DECL_EXP void ShowRouteWaypointNames(wxString route_guid, bool show);
7229extern DECL_EXP void NavigateToWaypoint(wxString waypoint_guid);
7230extern DECL_EXP bool DoMeasurePI(int canvas_index, bool start);
7231extern DECL_EXP bool IsMeasureActive(int canvas_index);
7232extern DECL_EXP void CancelMeasure(int canvas_index);
7233
7234// AIS related
7235extern DECL_EXP bool IsAISTrackVisible(
7236 wxString ais_mmsi); // for Show/Hide Target Track
7237extern DECL_EXP void AISToggleShowTrack(
7238 wxString ais_mmsi); // for Show/Hide Target Track
7239extern DECL_EXP bool IsAIS_CPAVisible(
7240 wxString ais_mmsi); // for Show/Hide Target CPA
7241extern DECL_EXP void AISToggleShowCPA(
7242 wxString ais_mmsi); // for Show/Hide Target CPA
7243extern DECL_EXP void ShowAISTargetQueryDialog(
7244 int canvas_index,
7245 wxString ais_mmsi); // for Target Query
7246extern DECL_EXP void ShowAISTargetList(int canvas_index); // for Target List
7247
7248// Plugin Context Menu support
7249typedef enum _PI_ContextObjectType {
7250 OBJECT_CHART = 0,
7251 OBJECT_ROUTEPOINT,
7252 OBJECT_ROUTESEGMENT,
7253 OBJECT_AISTARGET,
7254 OBJECT_UNKNOWN
7255} PI_ContextObjectType;
7256
7257typedef struct _PI_PointContext {
7258 _PI_ContextObjectType object_type;
7259 std::string object_ident;
7261
7262extern DECL_EXP std::shared_ptr<PI_PointContext> GetContextAtPoint(
7263 int x, int y, int canvas_index);
7264
7265// Extended Chart table management support
7266extern DECL_EXP void AddNoShowDirectory(std::string chart_dir);
7267extern DECL_EXP void RemoveNoShowDirectory(std::string chart_dir);
7268extern DECL_EXP void ClearNoShowVector();
7269extern DECL_EXP const std::vector<std::string> &GetNoShowVector();
7270
7271// Enhanced AIS Target List support
7272// extern DECL_EXP wxString GetAISTargetColumnData(wxString ais_mmsi, int
7273// column); // same as OCPNListCtrl::GetTargetColumnData
7274extern DECL_EXP void CenterToAisTarget(wxString ais_mmsi);
7275extern DECL_EXP void AisTargetCreateWpt(wxString ais_mmsi);
7276extern DECL_EXP void AisShowAllTracks(bool show);
7277extern DECL_EXP void AisToggleTrack(wxString ais_mmsi);
7278
7279// Context menu enable/disable, by object type
7280#define CONTEXT_MENU_DISABLE_WAYPOINT 1
7281#define CONTEXT_MENU_DISABLE_ROUTE 2
7282#define CONTEXT_MENU_DISABLE_TRACK 4
7283#define CONTEXT_MENU_DISABLE_AISTARGET 8
7284
7285extern DECL_EXP int GetContextMenuMask();
7286extern DECL_EXP void SetContextMenuMask(int mask);
7287
7288// Extended plugin route, V3
7289class DECL_EXP PlugIn_Route_ExV3 : public PlugIn_Route_ExV2 {
7290public:
7292 virtual ~PlugIn_Route_ExV3();
7293
7294 double m_PlannedSpeed;
7295 wxString m_Colour;
7296 wxPenStyle m_style;
7297 wxDateTime m_PlannedDeparture;
7298 wxString m_TimeDisplayFormat;
7299};
7300
7301extern DECL_EXP bool AddPlugInRouteExV3(PlugIn_Route_ExV3 *proute,
7302 bool b_permanent = true);
7303extern DECL_EXP bool UpdatePlugInRouteExV3(PlugIn_Route_ExV3 *proute);
7304extern DECL_EXP std::unique_ptr<PlugIn_Route_ExV3> GetRouteExV3_Plugin(
7305 const wxString &GUID);
7306
7307#endif //_PLUGIN_H_
Keeps listening over its lifespan, removes itself on destruction.
Definition observable.h:155
Custom event class for OpenCPN's notification system.
ObservedEvt(wxEventType commandType=obsNOTIFY, int id=0)
Constructor.
void SetSharedPtr(std::shared_ptr< const void > p)
Sets the event's payload data.
wxEvent * Clone() const
Creates a cloned copy of this event.
std::shared_ptr< const void > GetSharedPtr() const
Gets the event's payload data.
unsigned error_count
Number of detected errors since program start.
unsigned tx_count
Number of bytes sent since program start.
unsigned rx_count
Number of bytes received since program start.
Class representing an S-57 chart object.
int auxParm3
Auxiliary parameter 3.
PI_S57Obj * next
Linked list pointer.
PI_DisCat m_DisplayCat
Display category (base, standard, other)
double m_lon
Reference longitude.
double lon_max
Bounding box maximum longitude.
int Scamin
Minimum display scale.
int * m_lsindex_array
Array of line segment indices.
double x
X coordinate for point features.
int auxParm1
Auxiliary parameter 1.
void * m_chart_context
Parent chart context.
int m_n_lsindex
Number of line segments.
double lon_min
Bounding box minimum longitude.
PI_S57Obj * child
Child object list (for multipoint soundings)
double x_rate
X scale factor.
int npt
Number of points in geometry.
int auxParm2
Auxiliary parameter 2.
double lat_max
Bounding box maximum latitude.
int auxParm0
Auxiliary parameter 0.
int iOBJL
Object lookup index.
void * pPolyTessGeo
Tesselated polygon geometry.
double chart_ref_lon
Chart reference longitude.
bool bIsAssociable
True if object can have relationships.
int m_n_edge_max_points
Maximum points per edge.
void * geoPt
Geometry data for lines/areas.
double y
Y coordinate for point features.
int nRef
Reference count for memory management.
int n_attr
Number of attributes.
double * geoPtMulti
Lat/lon pairs for decomposed points.
double y_origin
Y origin offset.
PI_line_segment_element * m_ls_list
Line segment list.
int Index
Runtime object index.
void * S52_Context
S52 presentation data.
bool bIsClone
True if object is a clone.
char * att_array
Array of attribute types.
double * geoPtz
Z values for multipoint features.
double m_lat
Reference latitude.
int m_DPRI
Display priority.
bool m_bcategory_mutable
True if category can change.
bool bIsAton
True if object is an aid to navigation.
double chart_ref_lat
Chart reference latitude.
double z
Z coordinate (usually depth)
wxArrayOfS57attVal * attVal
Array of attribute values.
double y_rate
Y scale factor.
double lat_min
Bounding box minimum latitude.
double x_origin
X origin offset.
int Primitive_type
Geometry type (point, line, area)
Represents a line segment element for efficient vector chart rendering.
int priority
Drawing priority (higher draws on top)
int type
Line type identifier.
void * private0
Private data pointer for implementation use.
float lon_min
Minimum longitude of segment's bounding box.
float lat_min
Minimum latitude of segment's bounding box.
size_t vbo_offset
Offset into vertex buffer object for this segment.
float lat_max
Maximum latitude of segment's bounding box.
float lon_max
Maximum longitude of segment's bounding box.
PI_line_segment_element * next
Pointer to next segment in linked list.
size_t n_points
Number of points in this line segment.
Extended chart base class with separated text rendering.
Extended OpenGL-optimized chart base class with additional querying capabilities.
OpenGL-optimized chart base class for plugin chart types.
Base class for implementing custom chart types in OpenCPN plugins.
virtual ChartFamilyEnumPI GetChartFamily()
Returns the chart family classification.
virtual wxString GetID()
Returns a unique identifier for the chart.
virtual wxString GetDatumString()
Returns the horizontal geodetic datum of the chart.
virtual wxString GetName()
Returns the chart's name or title.
virtual wxDateTime GetEditionDate(void)
Returns the edition date of the chart.
virtual int GetCOVRTablenPoints(int iTable)
Alternative method to get the number of points in a coverage table entry.
virtual int GetCOVREntries()
Returns the number of coverage table entries for this chart.
virtual wxString GetSoundingsDatum()
Returns the vertical datum used for soundings in the chart.
virtual wxString GetExtraInfo()
Returns additional information about the chart.
virtual wxString GetDescription()
Returns a descriptive text about the chart.
virtual wxString GetFullPath() const
Returns the full file path of the chart.
virtual wxString GetSE()
Returns the chart's source edition identifier.
virtual bool IsReadyToRender()
Indicates whether the chart is ready for rendering.
virtual int GetNativeScale()
Returns the native scale of the chart.
virtual double GetChartSkew()
Returns the skew/rotation angle of the chart.
virtual wxString GetDepthUnits()
Returns the depth units used in the chart.
virtual float * GetCOVRTableHead(int iTable)
Returns a pointer to the coverage table data for a specific entry.
virtual double GetChartErrorFactor()
Returns the error factor for the chart.
virtual OcpnProjTypePI GetChartProjection()
Returns the projection type used by the chart.
virtual wxString GetPubDate()
Returns the publication date/year of the chart.
virtual ChartTypeEnumPI GetChartType()
Returns the chart type identifier.
virtual int GetCOVRTablePoints(int iTable)
Returns the number of points in a specific coverage table entry.
virtual ChartDepthUnitTypePI GetDepthUnitId()
Returns the depth unit type identifier.
AIS target information accessible to plugins.
char CallSign[8]
Call sign, includes NULL terminator.
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.
char ShipName[21]
Ship name, includes NULL terminator.
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 [0-360).
double Lat
Latitude in decimal degrees.
double Hdm
Heading magnetic in degrees [0-360).
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 [0-360).
Basic position fix information.
double Cog
Course over ground in degrees [0-360).
double Sog
Speed over ground in knots.
time_t FixTime
UTC time of fix as time_t value.
double Lat
Latitude in decimal degrees.
int nSats
Number of satellites used in the fix.
double Var
Magnetic variation in degrees, typically from RMC message.
double Lon
Longitude in decimal 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.
wxString m_GUID
Globally unique identifier.
wxString m_TideStation
Tide Station Identifier.
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.
Extended waypoint class with additional navigation features.
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.
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.
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.
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.
Information about the currently active route leg.
double Dtw
Distance to waypoint in nautical miles.
wxString wp_name
Name of destination waypoint for the active leg.
double Xte
Cross track error in nautical miles, negative values indicate left side of track.
double Btw
Bearing to waypoint in degrees true.
bool arrival
True when vessel is within the arrival circle of the destination waypoint.
virtual bool RenderOverlayMultiCanvas(wxDC &dc, PlugIn_ViewPort *vp, int canvasIndex)
Renders plugin overlay graphics in standard DC mode for multi-canvas support.
virtual bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext, PlugIn_ViewPort *vp, int canvasIndex)
Renders plugin overlay graphics in OpenGL mode for multi-canvas support.
bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext, PlugIn_ViewPort *vp, int canvas_ix) override
Renders plugin overlay graphics in OpenGL mode for multi-canvas support.
bool RenderOverlayMultiCanvas(wxDC &dc, PlugIn_ViewPort *vp, int canvas_ix) override
Renders plugin overlay graphics in standard DC mode for multi-canvas support.
Base class for OpenCPN plugins.
virtual bool RenderOverlay(wxMemoryDC *pmdc, PlugIn_ViewPort *vp)
Render plugin overlay graphics using standard device context.
DECL_EXP void RemovePlugInTool(int tool_id)
Removes a tool from OpenCPN's toolbar.
DECL_EXP void EnableNotificationCanvasIcon(bool enable)
Plugin Notification Framework GUI support.
DECL_EXP void ForceChartDBUpdate()
Forces an update of the chart database.
DECL_EXP wxArrayString GetRouteGUIDArray(void)
Gets array of route GUIDs.
DECL_EXP std::unique_ptr< PlugIn_Route_Ex > GetRouteEx_Plugin(const wxString &GUID)
Gets extended route by GUID.
DECL_EXP CommDriverResult WriteCommDriverN2K(DriverHandle handle, int PGN, int destinationCANAddress, int priority, const std::shared_ptr< std::vector< uint8_t > > &payload)
Send a PGN message to an NMEA2000 address.
_OBJECT_LAYER_REQ
Filter options for object queries.
@ 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.
DECL_EXP void toSM_ECC_Plugin(double lat, double lon, double lat0, double lon0, double *x, double *y)
Converts geographic coordinates to Elliptical Simple Mercator projection.
DECL_EXP void EnableENCDepthSoundingsDisplay(bool enable, int CanvasIndex)
Controls ENC depth sounding display.
DECL_EXP void EnableChartBar(bool enable, int CanvasIndex)
Controls visibility of chart info bar.
DECL_EXP double fromDMM_Plugin(wxString sdms)
Converts degrees/decimal minutes string to decimal degrees.
DECL_EXP void SetCanvasMenuItemGrey(int item, bool grey, const char *name="")
Sets menu item enabled/disabled state.
DECL_EXP void EnableLatLonGrid(bool enable, int CanvasIndex)
Controls latitude/longitude grid display.
DECL_EXP void SetNavigationMode(PI_NavMode mode, int CanvasIndex)
Sets the navigation mode for a specific chart canvas.
DECL_EXP bool GetEnableENCDepthSoundingsDisplay(int CanvasIndex)
Gets ENC depth sounding visibility.
DECL_EXP void EnableENCTextDisplay(bool enable, int CanvasIndex)
Controls ENC text label display.
DECL_EXP wxXmlDocument GetChartDatabaseEntryXML(int dbIndex, bool b_getGeom)
Gets chart database entry as XML.
DECL_EXP void AddChartDirectory(wxString &path)
Adds a chart directory to OpenCPN's chart database.
DECL_EXP wxBitmap GetBitmapFromSVGFile(wxString filename, unsigned int width, unsigned int height)
Creates bitmap from SVG file.
DECL_EXP wxArrayString GetChartDBDirArrayString()
Gets chart database directory list.
DECL_EXP wxWindow * GetCanvasByIndex(int canvasIndex)
Gets chart canvas window by index.
DECL_EXP bool GetEnableCanvasFocusBar(int CanvasIndex)
Gets focus indicator visibility state.
DECL_EXP void UpdateAndApplyPriorityMaps(std::vector< std::string > map)
Sets and applies new priority mapping scheme.
DECL_EXP int GetCanvasIndexUnderMouse()
Gets index of chart canvas under mouse cursor.
DECL_EXP void DimeWindow(wxWindow *)
Applies system color scheme to window.
plugin_ais_alarm_type
Enumeration of AIS alarm states.
@ PI_AIS_ALARM_ACKNOWLEDGED
Alarm has been acknowledged by the user.
@ PI_AIS_NO_ALARM
No alarm condition exists.
@ PI_AIS_ALARM_SET
Alarm has been set but not acknowledged.
DECL_EXP bool GetSingleWaypointExV2(wxString GUID, PlugIn_Waypoint_ExV2 *pwaypoint)
Gets extended waypoint data by GUID.
enum ChartDepthUnitTypePI _ChartDepthUnitTypePI
Enumeration of depth unit types used in charts.
DECL_EXP std::unique_ptr< PlugIn_Waypoint_ExV2 > GetWaypointExV2_Plugin(const wxString &GUID)
Gets complete waypoint details by GUID.
DECL_EXP void EnableCanvasFocusBar(bool enable, int CanvasIndex)
Controls visibility of canvas focus indicator.
DECL_EXP void EnableTideStationsDisplay(bool enable, int CanvasIndex)
Controls tide station icon display.
enum _PI_DisCat PI_DisCat
Display categories for S52 chart features.
DECL_EXP void RemoveCanvasContextMenuItem(int item)
Removes a context menu item completely.
void DECL_EXP PI_PLIBSetRenderCaps(unsigned int flags)
Sets rendering capability flags.
DECL_EXP void fromSM_ECC_Plugin(double x, double y, double lat0, double lon0, double *lat, double *lon)
Converts Elliptical Simple Mercator coordinates to geographic.
DECL_EXP bool GetEnableChartBar(int CanvasIndex)
Gets chart bar visibility state.
DECL_EXP wxFont GetOCPNGUIScaledFont_PlugIn(wxString item)
Gets a uniquely scaled font copy for responsive UI elements.
DECL_EXP double DistGreatCircle_Plugin(double slat, double slon, double dlat, double dlon)
Calculates great circle distance between two points.
CommDriverResult
Error return values
@ RESULT_COMM_INVALID_PARMS
Invalid parameters provided to operation.
@ RESULT_COMM_REGISTER_GATEWAY_ERROR
Failed to register with gateway device.
@ RESULT_COMM_TX_ERROR
Error occurred during transmission.
@ RESULT_COMM_REGISTER_PGN_ERROR
Failed to register PGN parameters.
@ RESULT_COMM_NO_ERROR
Operation completed successfully.
@ RESULT_COMM_INVALID_HANDLE
Invalid or unknown driver handle specified.
DECL_EXP void RequestWindowRefresh(wxWindow *win, bool eraseBackground)
Requests window refresh.
DECL_EXP bool UpdateChartDBInplace(wxArrayString dir_array, bool b_force_update, bool b_ProgressDialog)
Updates chart database in place.
DECL_EXP wxString GetLocaleCanonicalName()
Gets system locale canonical name.
DECL_EXP bool GetEnableDepthUnitDisplay(int CanvasIndex)
Gets depth unit display state.
enum OptionsParentPI _OptionsParentPI
Enum defining parent pages in OpenCPN options dialog where plugins can add panels.
DECL_EXP void SetToolbarItemState(int item, bool toggle)
Sets toolbar item toggle state.
DECL_EXP bool UpdatePlugInRoute(PlugIn_Route *proute)
Updates an existing route.
DECL_EXP bool AddLocaleCatalog(wxString catalog)
Adds a locale catalog for translations.
int DECL_EXP PI_PLIBRenderObjectToDC(wxDC *pdc, PI_S57Obj *pObj, PlugIn_ViewPort *vp)
Renders an S57 object using standard device context.
DECL_EXP _OCPN_DLStatus OCPN_downloadFile(const wxString &url, const wxString &outputFile, const wxString &title, const wxString &message, const wxBitmap &bitmap, wxWindow *parent, long style, int timeout_secs)
Synchronously download a file with progress dialog.
void DECL_EXP PI_PLIBSetLineFeaturePriority(PI_S57Obj *pObj, int prio)
Sets rendering priority for line feature.
enum _PI_DisPrio PI_DisPrio
Display priority levels for S52 chart objects.
DECL_EXP void EnableCurrentStationsDisplay(bool enable, int CanvasIndex)
Controls current station icon display.
DECL_EXP wxArrayString GetIconNameArray(void)
Gets array of available waypoint icons.
DECL_EXP void toTM_Plugin(float lat, float lon, float lat0, float lon0, double *x, double *y)
Converts geographic coordinates to Transverse Mercator projection.
DECL_EXP bool GetGlobalColor(wxString colorName, wxColour *pcolour)
Gets a functionally-named color for a specific UI purpose.
DECL_EXP bool GetSingleWaypointEx(wxString GUID, PlugIn_Waypoint_Ex *pwaypoint)
Gets extended waypoint data by GUID.
DECL_EXP int PlatformFileSelectorDialog(wxWindow *parent, wxString *file_spec, wxString Title, wxString initDir, wxString suggestedName, wxString wildcard)
Shows platform-optimized file selector dialog.
DECL_EXP PI_DisCat GetENCDisplayCategory(int CanvasIndex)
Gets current ENC display category.
void DECL_EXP PI_UpdateContext(PI_S57Obj *pObj)
Updates rendering context for S57 object.
DECL_EXP int AddCanvasContextMenuItem(wxMenuItem *pitem, opencpn_plugin *pplugin)
Adds item to chart canvas context menu.
DECL_EXP double fromUsrSpeed_Plugin(double usr_speed, int unit=-1)
Converts from user's preferred speed unit to knots.
DECL_EXP _OCPN_DLStatus OCPN_postDataHttp(const wxString &url, const wxString &parameters, wxString &result, int timeout_secs)
Performs HTTP POST request.
DECL_EXP wxString GetActiveRouteGUID(void)
Gets GUID of currently active route.
DECL_EXP void RequestRefresh(wxWindow *)
Requests window refresh.
void DECL_EXP PI_PLIBPrepareForNewRender(void)
Prepares PLIB for new rendering pass.
DECL_EXP PI_NavMode GetNavigationMode(int CanvasIndex)
Gets current navigation mode for a canvas.
DECL_EXP void SetCanvasRotation(double rotation)
Sets chart display rotation angle.
DECL_EXP void PlugInMultMatrixViewport(PlugIn_ViewPort *vp, float lat=0, float lon=0)
Applies viewport transformation matrix.
DECL_EXP double toUsrDepth_Plugin(double m_depth, int unit=-1)
Converts meters to user's preferred depth unit.
DECL_EXP PI_Comm_Status GetConnState(const std::string &iface, PI_Conn_Bus _bus)
Plugin polled Comm Status support.
int DECL_EXP PI_GetPLIBDepthUnitInt()
Gets configured depth unit for S52 display.
DECL_EXP wxArrayString GetWaypointGUIDArray(void)
Gets array of all waypoint/marks GUIDs.
DECL_EXP double toUsrTemp_Plugin(double cel_temp, int unit=-1)
Converts Celsius to user's preferred temperature unit.
DECL_EXP bool CheckEdgePan_PlugIn(int x, int y, bool dragging, int margin, int delta)
Checks if chart should pan when cursor near edge.
DECL_EXP wxString * GetpSharedDataLocation()
Gets shared application data location.
DECL_EXP double toUsrSpeed_Plugin(double kts_speed, int unit=-1)
Converts knots to user's preferred speed unit.
DECL_EXP bool GetEnableBuoyLightLabelsDisplay(int CanvasIndex)
Gets buoy/light label visibility.
_OCPN_DLCondition
Event types for HTTP file download operations.
@ OCPN_DL_EVENT_TYPE_UNKNOWN
Unknown event type.
@ OCPN_DL_EVENT_TYPE_PROGRESS
Download progress update.
@ OCPN_DL_EVENT_TYPE_END
Download has completed.
@ OCPN_DL_EVENT_TYPE_START
Download is starting.
DECL_EXP bool DeleteOptionsPage(wxScrolledWindow *page)
Remove a previously added options page.
DECL_EXP void EnableTenHertzUpdate(bool enable)
Enable or disable 10 Hz update rate.
DECL_EXP void EnableLightDescriptionsDisplay(bool enable, int CanvasIndex)
Controls light description text display.
DECL_EXP bool AddPlugInRouteEx(PlugIn_Route_Ex *proute, bool b_permanent=true)
Adds a route with extended features.
bool DECL_EXP PI_PLIBObjectRenderCheck(PI_S57Obj *pObj, PlugIn_ViewPort *vp)
Checks if object should be rendered.
DECL_EXP void GetCanvasPixLL(PlugIn_ViewPort *vp, wxPoint *pp, double lat, double lon)
Converts lat/lon to canvas physical pixel coordinates.
DECL_EXP bool PlugIn_GSHHS_CrossesLand(double lat1, double lon1, double lat2, double lon2)
Checks if a great circle route crosses land.
ChartTypeEnumPI
Enumeration of chart types.
@ PI_CHART_TYPE_PLUGIN
Chart type provided by a plugin.
@ PI_CHART_TYPE_CM93COMP
CM93 Composite vector chart format.
@ PI_CHART_TYPE_CM93
CM93 vector chart format.
@ PI_CHART_TYPE_S57
S-57 vector chart format.
@ PI_CHART_TYPE_UNKNOWN
Chart type is unknown or undefined.
@ PI_CHART_TYPE_DONTCARE
Chart type is not important for the operation.
@ PI_CHART_TYPE_KAP
BSB/KAP raster chart format.
@ PI_CHART_TYPE_DUMMY
Dummy chart used when no actual chart is available.
@ PI_CHART_TYPE_GEO
GEO raster chart format.
DECL_EXP int GetChartbarHeight(void)
Gets height of chart bar in pixels.
DECL_EXP wxString GetNewGUID()
Generates a new globally unique identifier (GUID).
PI_ColorScheme
Color schemes for different lighting conditions.
@ PI_GLOBAL_COLOR_SCHEME_DAY
Day color scheme, optimized for bright ambient light.
@ PI_GLOBAL_COLOR_SCHEME_NIGHT
Night/dark color scheme, optimized for dark conditions with minimal impact on night vision.
@ PI_N_COLOR_SCHEMES
Number of color schemes, used for bounds checking.
@ PI_GLOBAL_COLOR_SCHEME_RGB
RGB color scheme, unmodified colors.
@ PI_GLOBAL_COLOR_SCHEME_DUSK
Dusk color scheme, optimized for low ambient light.
DECL_EXP wxString toSDMM_PlugIn(int NEflag, double a, bool hi_precision=true)
Convert decimal degrees to a formatted string.
DECL_EXP void SetEnableMainToolbar(bool enable)
Show or hide the main toolbar.
enum _OCPN_DLCondition OCPN_DLCondition
Event types for HTTP file download operations.
DECL_EXP wxString GetActiveStyleName()
Gets name of currently active style sheet.
DECL_EXP void EnableAisTargetDisplay(bool enable, int CanvasIndex)
Controls AIS target display.
DECL_EXP void ZeroXTE()
Resets cross track error to zero.
DECL_EXP void SetENCDisplayCategory(PI_DisCat cat, int CanvasIndex)
Sets ENC (Electronic Navigation Chart) feature display category.
DECL_EXP wxString GetOCPN_ExePath(void)
Gets OpenCPN executable path.
int DECL_EXP OCPNMessageBox_PlugIn(wxWindow *parent, const wxString &message, const wxString &caption=_T("Message"), int style=wxOK, int x=-1, int y=-1)
Shows a message box dialog.
DECL_EXP wxString * GetpPlugInLocation()
Gets plugins directory location.
DECL_EXP std::string GetN2000Source(NMEA2000Id id, ObservedEvt ev)
Return source identifier (iface) of a received n2000 message of type id in ev.
DECL_EXP int GetLatLonFormat(void)
Gets currently selected latitude/longitude display format.
PI_NotificationSeverity
Plugin Notification Framework support.
DECL_EXP std::shared_ptr< void > GetSignalkPayload(ObservedEvt ev)
Get SignalK status payload after receiving a message.
DECL_EXP double OCPN_GetWinDIPScaleFactor()
Gets Windows-specific DPI scaling factor.
DECL_EXP std::shared_ptr< ObservableListener > GetListener(NMEA2000Id id, wxEventType ev, wxEvtHandler *handler)
Gets listener for NMEA 2000 messages.
DECL_EXP wxWindow * GetCanvasUnderMouse()
Gets canvas window under mouse cursor.
DECL_EXP void EnableBuoyLightLabelsDisplay(bool enable, int CanvasIndex)
Controls buoy/light name label display.
int DECL_EXP PI_PLIBRenderAreaToDC(wxDC *pdc, PI_S57Obj *pObj, PlugIn_ViewPort *vp, wxRect rect, unsigned char *pixbuf)
Renders an S57 area object using standard device context.
DECL_EXP void SetGlobalColor(std::string table, std::string name, wxColor color)
Sets a color in the global color scheme.
DECL_EXP void PushNMEABuffer(wxString str)
Pushes NMEA sentence to the system.
DECL_EXP bool OCPN_isOnline()
Checks internet connectivity.
DECL_EXP void SetCanvasContextMenuItemGrey(int item, bool grey)
Sets menu item enabled/disabled state.
DECL_EXP wxString getUsrHeightUnit_Plugin(int unit=-1)
Gets display string for user's preferred height unit.
DECL_EXP std::unique_ptr< PlugIn_Waypoint > GetWaypoint_Plugin(const wxString &)
Gets waypoint details by GUID.
enum PI_InitReturn _PI_InitReturn
Return values for plugin initialization.
DECL_EXP void CanvasJumpToPosition(wxWindow *canvas, double lat, double lon, double scale)
Centers specified canvas on given position at given scale.
DECL_EXP double fromUsrTemp_Plugin(double usr_temp, int unit=-1)
Converts from user's preferred temperature unit to Celsius.
DECL_EXP bool GetEnableMenu()
Gets menu bar visibility state.
bool DECL_EXP PI_GetObjectRenderBox(PI_S57Obj *pObj, double *lat_min, double *lat_max, double *lon_min, double *lon_max)
Gets geographic bounding box of S57 object.
_OCPN_DLStatus
Status codes for HTTP file download operations.
@ OCPN_DL_NO_ERROR
Download completed successfully.
@ OCPN_DL_USER_TIMEOUT
Download timed out waiting for user action.
@ OCPN_DL_STARTED
Download has begun but not yet complete.
@ OCPN_DL_FAILED
Download failed (general error)
@ OCPN_DL_UNKNOWN
Unknown or uninitialized status.
@ OCPN_DL_ABORTED
Download was cancelled by user.
SDDMFORMAT
Coordinate format options for lat/lon display.
@ DEGREES_DECIMAL_MINUTES
Format like "50° 12.345' N".
@ DEGREES_MINUTES_SECONDS
Format like "50° 12' 34.5" N".
@ DECIMAL_DEGREES
Format like "50.12345° N".
@ END_SDDMFORMATS
Number of available formats.
DECL_EXP bool IsTouchInterface_PlugIn(void)
Checks if touch interface mode is enabled.
DECL_EXP wxString GetPlugInPath(opencpn_plugin *pplugin)
Gets the installation path for a specific plugin.
DECL_EXP double GetCanvasTilt()
Gets current canvas tilt angle.
DECL_EXP bool GetEnableAisTargetDisplay(int CanvasIndex)
Gets AIS target display state.
OCPN_DLDialogStyle
@ OCPN_DLDS_CONN_SETTINGS_AUTH
The dialog allows the user to change the authentication settings.
@ OCPN_DLDS_CAN_START
The transfer won't start automatically.
@ OCPN_DLDS_URL
The dialog shows the URL involved in the transfer.
@ OCPN_DLDS_AUTO_CLOSE
The dialog auto closes when transfer is complete.
@ OCPN_DLDS_CAN_ABORT
The transfer can be aborted by the user.
@ OCPN_DLDS_ESTIMATED_TIME
The dialog shows the estimated total time.
@ OCPN_DLDS_SIZE
The dialog shows the size of the resource to download/upload.
@ OCPN_DLDS_CONN_SETTINGS_PROXY
The dialog allows the user to change the proxy settings.
@ OCPN_DLDS_REMAINING_TIME
The dialog shows the remaining time.
@ OCPN_DLDS_SPEED
The dialog shows the transfer speed.
@ OCPN_DLDS_ELAPSED_TIME
The dialog shows the elapsed time.
@ OCPN_DLDS_CAN_PAUSE
The transfer can be paused.
@ OCPN_DLDS_CONN_SETTINGS_PORT
The dialog allows the user to change the port for the transfer.
DECL_EXP void RemoveCanvasMenuItem(int item, const char *name="")
Removes a context menu item completely.
DECL_EXP void EnableStatusBar(bool enable)
Shows/hides the status bar.
ChartFamilyEnumPI
Enumeration of chart families (broad categories).
@ PI_CHART_FAMILY_UNKNOWN
Chart family is unknown.
@ PI_CHART_FAMILY_VECTOR
Vector chart formats (S-57, CM93, etc.)
@ PI_CHART_FAMILY_RASTER
Raster chart formats (KAP, GEO, etc.)
@ PI_CHART_FAMILY_DONTCARE
Chart family is not important for the operation.
DECL_EXP void EnableChartOutlines(bool enable, int CanvasIndex)
Controls chart outline display.
DECL_EXP bool UpdatePlugInRouteExV2(PlugIn_Route_ExV2 *proute)
Updates existing route with V2 waypoints.
DECL_EXP wxString GetWritableDocumentsDir(void)
Returns the platform-specific default documents directory.
DECL_EXP wxString GetSelectedTrackGUID_Plugin()
Gets GUID of currently selected track.
DECL_EXP bool GetEnableTenHertzUpdate()
Check if 10 Hz update rate is enabled.
DECL_EXP std::unique_ptr< PlugIn_Route_ExV2 > GetRouteExV2_Plugin(const wxString &GUID)
Gets route details with V2 waypoints by GUID.
DECL_EXP bool DeletePlugInRoute(wxString &GUID)
Deletes a route.
DECL_EXP void GetDoubleCanvasPixLL(PlugIn_ViewPort *vp, wxPoint2DDouble *pp, double lat, double lon)
Converts lat/lon to canvas pixels with double precision.
DECL_EXP bool GetFullScreen()
Gets full screen state.
DECL_EXP bool PluginGetFollowMode(int CanvasIndex)
Get the current follow mode status for a specific canvas.
DECL_EXP bool GetSingleWaypoint(wxString GUID, PlugIn_Waypoint *pwaypoint)
Gets waypoint data by GUID.
enum _PI_LUPname PI_LUPname
Name identifiers for S57 lookup table sets.
DECL_EXP double OCPN_GetDisplayContentScaleFactor()
Gets content scaling factor for current display.
DECL_EXP double fromUsrDepth_Plugin(double usr_depth, int unit=-1)
Converts from user's preferred depth unit to meters.
DECL_EXP bool UpdatePlugInTrack(PlugIn_Track *ptrack)
Updates an existing track.
DECL_EXP wxArrayString GetTrackGUIDArray(void)
Gets array of track GUIDs.
DECL_EXP bool GetEnableLightsDisplay(int CanvasIndex)
Gets light icon visibility.
int DECL_EXP PI_GetPLIBStateHash()
Gets hash value representing current PLIB state.
DECL_EXP double toUsrDistance_Plugin(double nm_distance, int unit=-1)
Converts nautical miles to user's preferred distance unit.
DECL_EXP bool GetActiveRoutepointGPX(char *buffer, unsigned int buffer_length)
Gets GPX representation of active route waypoint.
DECL_EXP double toUsrHeight_Plugin(double m_height, int unit=-1)
Converts meters to user's preferred height unit.
DECL_EXP wxBitmap * FindSystemWaypointIcon(wxString &icon_name)
Finds built-in system waypoint icon.
DECL_EXP void ExitOCPN()
Exits OpenCPN application.
DECL_EXP int PlugInGetMinAvailableGshhgQuality()
Gets minimum available GSHHS coastline data quality.
DECL_EXP bool GetEnableLookaheadMode(int CanvasIndex)
Gets look-ahead mode state for a canvas.
DECL_EXP wxString getUsrTempUnit_Plugin(int unit=-1)
Gets display string for user's preferred temperature unit.
DECL_EXP double fromDMM_PlugIn(wxString sdms)
Parse a formatted coordinate string to get decimal degrees.
DECL_EXP int PlugInGetMaxAvailableGshhgQuality()
Gets maximum available GSHHS coastline data quality.
ChartDepthUnitTypePI
Enumeration of depth unit types used in charts.
@ PI_DEPTH_UNIT_METERS
Depths shown in meters.
@ PI_DEPTH_UNIT_UNKNOWN
Depth unit is unknown or not specified.
@ PI_DEPTH_UNIT_FATHOMS
Depths shown in fathoms.
@ PI_DEPTH_UNIT_FEET
Depths shown in feet.
DECL_EXP bool PlugInHasNormalizedViewPort(PlugIn_ViewPort *vp)
Checks if viewport has been normalized.
DECL_EXP bool AddSingleWaypoint(PlugIn_Waypoint *pwaypoint, bool b_permanent=true)
Adds a single waypoint.
DECL_EXP double fromUsrWindSpeed_Plugin(double usr_wspeed, int unit=-1)
Converts from user's preferred wind speed unit to knots.
DECL_EXP bool PlugInSetFontColor(const wxString TextElement, const wxColour color)
Sets text color for a UI element.
DECL_EXP wxString getUsrWindSpeedUnit_Plugin(int unit=-1)
Gets display string for user's preferred wind speed unit.
DECL_EXP bool DeleteSingleWaypoint(wxString &GUID)
Deletes a single waypoint.
DECL_EXP bool ShuttingDown(void)
Checks if OpenCPN is in shutdown process.
DECL_EXP void EnableDepthUnitDisplay(bool enable, int CanvasIndex)
Controls depth unit display.
DECL_EXP void PlugInAISDrawGL(wxGLCanvas *glcanvas, const PlugIn_ViewPort &vp)
Renders AIS targets on a secondary OpenGL canvas.
DECL_EXP void PlugInHandleAutopilotRoute(bool enable)
Controls autopilot route handling.
DECL_EXP void EnableMUIBar(bool enable, int CanvasIndex)
Controls visibility of MUI (Mobile/Touch User Interface) bar.
DECL_EXP void JumpToPosition(double lat, double lon, double scale)
Centers chart display on specified position at given scale.
DECL_EXP CommDriverResult WriteCommDriver(DriverHandle handle, const std::shared_ptr< std::vector< uint8_t > > &payload)
Send a non-NMEA2000 message.
DECL_EXP int PlatformDirSelectorDialog(wxWindow *parent, wxString *file_spec, wxString Title, wxString initDir)
Shows platform-optimized directory selector dialog.
DECL_EXP std::string GetN0183Payload(NMEA0183Id id, ObservedEvt ev)
Return payload in a received n0183 message of type id in ev.
wxString DECL_EXP PI_GetPLIBColorScheme()
Gets current color scheme used by S52 PLIB.
DECL_EXP void SetToolbarToolBitmaps(int item, wxBitmap *bitmap, wxBitmap *bmpRollover)
Updates toolbar tool bitmaps.
DECL_EXP bool GetTrackingMode()
Get the current tracking mode status.
std::string DriverHandle
Plugin API supporting direct access to comm drivers for output purposes.
PI_LUPname DECL_EXP PI_GetObjectLUPName(PI_S57Obj *pObj)
Gets Look-Up Table (LUP) name for object.
DECL_EXP bool AddPersistentFontKey(wxString TextElement)
Registers a new font configuration element.
enum _OCPN_DLStatus OCPN_DLStatus
Status codes for HTTP file download operations.
DECL_EXP bool AddPlugInRouteExV2(PlugIn_Route_ExV2 *proute, bool b_permanent=true)
Adds a new route with V2 waypoints.
DECL_EXP wxAuiManager * GetFrameAuiManager(void)
Gets main frame AUI manager.
DECL_EXP void PlugInNormalizeViewport(PlugIn_ViewPort *vp, float lat=0, float lon=0)
Normalizes viewport parameters.
DECL_EXP wxString getUsrDistanceUnit_Plugin(int unit=-1)
Gets display string for user's preferred distance unit.
struct _ExtentPI ExtentPI
Geographic extent structure defining a bounding box.
DECL_EXP wxFileConfig * GetOCPNConfigObject(void)
Gets OpenCPN's configuration object.
DECL_EXP bool AddCustomWaypointIcon(wxBitmap *pimage, wxString key, wxString description)
Adds a custom waypoint icon.
DECL_EXP wxString toUsrDateTimeFormat_Plugin(const wxDateTime date_time, const DateTimeFormatOptions &options=DateTimeFormatOptions())
Format a date/time to a localized string representation, conforming to the global date/time format an...
DECL_EXP wxRect GetMasterToolbarRect()
Gets bounding rectangle of master toolbar.
DECL_EXP wxWindow * PluginGetOverlayRenderCanvas()
Gets the canvas currently designated for overlay rendering.
DECL_EXP void EnableLookaheadMode(bool enable, int CanvasIndex)
Enables/disables look-ahead mode for a canvas.
DECL_EXP void OCPN_cancelDownloadFileBackground(long handle)
Cancels a background download.
DECL_EXP PI_ColorScheme GetAppColorScheme()
Get the current application color scheme.
DECL_EXP PluginNavdata GetEventNavdata(ObservedEvt ev)
Return BasicNavDataMsg decoded data available in ev.
DECL_EXP bool UpdateSingleWaypointExV2(PlugIn_Waypoint_ExV2 *pwaypoint)
Updates an existing extended V2 waypoint.
DECL_EXP int AddChartToDBInPlace(wxString &full_path, bool b_RefreshCanvas)
Adds a chart to the database without full rebuild.
DECL_EXP void toSM_Plugin(double lat, double lon, double lat0, double lon0, double *x, double *y)
Converts geographic coordinates to Simple Mercator projection.
DECL_EXP wxString getUsrDepthUnit_Plugin(int unit=-1)
Gets display string for user's preferred depth unit.
DECL_EXP void EnableMenu(bool enable)
Shows/hides the main menu bar.
DECL_EXP wxFont * OCPNGetFont(wxString TextElement, int default_size=0)
Gets a font for UI elements.
DECL_EXP int GetGlobalWatchdogTimoutSeconds()
Gets global watchdog timeout value.
DECL_EXP void SetTrackingMode(bool enable)
Enable or disable tracking mode.
enum ChartTypeEnumPI _ChartTypeEnumPI
Enumeration of chart types.
DECL_EXP std::shared_ptr< PI_Notification > GetNotificationMsgPayload(NotificationMsgId id, ObservedEvt ev)
Retrieve the Notification Event in a Notification message.
enum OcpnProjTypePI _OcpnProjTypePI
Enumeration of chart projection types.
DECL_EXP bool GetEnableStatusBar()
Gets status bar visibility state.
DECL_EXP float GetOCPNChartScaleFactor_Plugin()
Gets chart rendering scale factor.
void DECL_EXP PI_PLIBFreeContext(void *pContext)
Frees S52 PLIB context.
DECL_EXP bool GetEnableChartOutlines(int CanvasIndex)
Gets chart outline visibility state.
DECL_EXP std::unique_ptr< PlugIn_Track > GetTrack_Plugin(const wxString &)
Gets track details by GUID.
DECL_EXP bool AddPlugInRoute(PlugIn_Route *proute, bool b_permanent=true)
Adds a new route.
DECL_EXP std::vector< uint8_t > GetN2000Payload(NMEA2000Id id, ObservedEvt ev)
Return N2K payload for a received n2000 message of type id in ev.
DECL_EXP wxColour GetFontColour_PlugIn(wxString TextElement)
Gets color configured for a UI text element.
DECL_EXP bool GetEnableMainToolbar()
Check if the main toolbar is enabled.
enum ChartFamilyEnumPI _ChartFamilyEnumPI
Enumeration of chart families (broad categories).
DECL_EXP wxFont * FindOrCreateFont_PlugIn(int point_size, wxFontFamily family, wxFontStyle style, wxFontWeight weight, bool underline=false, const wxString &facename=wxEmptyString, wxFontEncoding encoding=wxFONTENCODING_DEFAULT)
Creates or finds a font in the font cache.
DECL_EXP void SetCanvasContextMenuItemViz(int item, bool viz)
Temporarily changes context menu item visibility.
DECL_EXP bool PlugInPlaySoundEx(wxString &sound_file, int deviceIndex=-1)
Start playing a sound file asynchronously.
DECL_EXP wxBitmap GetIcon_PlugIn(const wxString &name)
Gets icon bitmap by name.
DECL_EXP double toUsrWindSpeed_Plugin(double kts_wspeed, int unit=-1)
Converts knots to user's preferred wind speed unit.
DECL_EXP wxWindow * GetOCPNCanvasWindow()
Gets OpenCPN's main canvas window.
_PI_NavMode
Navigation mode options for chart display orientation.
@ PI_NORTH_UP_MODE
North Up Mode - True north is always at the top of the display.
@ 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.
DECL_EXP void SetMUICursor_PlugIn(wxCursor *pCursor, int canvasIndex)
Sets mouse cursor for specific canvas.
DECL_EXP const std::unordered_map< std::string, std::string > GetAttributes(DriverHandle handle)
Query a specific driver for attributes.
DECL_EXP 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.
DECL_EXP void ConfigFlushAndReload()
Flush configuration changes to disk and reload settings.
DECL_EXP bool AddSingleWaypointEx(PlugIn_Waypoint_Ex *pwaypoint, bool b_permanent=true)
Adds a waypoint with extended properties.
DECL_EXP bool GetEnableLatLonGrid(int CanvasIndex)
Gets latitude/longitude grid visibility state.
_PI_DisPrio
Display priority levels for S52 chart objects.
@ PI_PRIO_AREA_2
Superimposed areas including water features.
@ PI_PRIO_NUM
Number of priority levels.
@ PI_PRIO_AREA_1
Superimposed areas.
@ PI_PRIO_MARINERS
VRM, EBL, own ship (highest priority)
@ PI_PRIO_SYMB_POINT
Point symbols including land features.
@ PI_PRIO_ROUTEING
Routeing lines (TSS, recommended tracks)
@ PI_PRIO_GROUP1
S57 group 1 filled areas (land, etc)
@ PI_PRIO_SYMB_AREA
Area symbols including traffic areas.
@ PI_PRIO_SYMB_LINE
Line symbols including restricted areas.
@ PI_PRIO_NODATA
No data fill area pattern (lowest priority)
@ PI_PRIO_HAZARDS
Hazards, buoys, beacons.
bool DECL_EXP PI_PLIBSetContext(PI_S57Obj *pObj)
Sets S52 PLIB rendering context for an object.
DECL_EXP bool UpdatePlugInRouteEx(PlugIn_Route_Ex *proute)
Updates an existing extended route.
DECL_EXP std::vector< DriverHandle > GetActiveDrivers()
Query OCPN core for a list of active drivers
DECL_EXP void SetCursor_PlugIn(wxCursor *pPlugin_Cursor=NULL)
Sets mouse cursor.
enum CommDriverResult _CommDriverResult
Error return values
DECL_EXP void PositionBearingDistanceMercator_Plugin(double lat, double lon, double brg, double dist, double *dlat, double *dlon)
Calculates destination point given starting point, bearing and distance.
DECL_EXP std::unique_ptr< PlugIn_Route > GetRoute_Plugin(const wxString &)
Gets route details by GUID.
_PI_DisCat
Display categories for S52 chart features.
@ PI_DISP_CAT_NUM
Number of categories (for array sizing)
@ PI_OTHER
Other - additional features for detailed navigation.
@ PI_MARINERS_OTHER
Additional mariner specified features.
@ 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.
DECL_EXP bool DecodeSingleVDOMessage(const wxString &str, PlugIn_Position_Fix_Ex *pos, wxString *acc)
Decodes a single VDO (Own Ship AIS) message.
PI_DisPrio DECL_EXP PI_GetObjectDisplayPriority(PI_S57Obj *pObj)
Gets display priority for object.
DECL_EXP double PlugInGetDisplaySizeMM()
Gets physical display size in millimeters.
DECL_EXP std::string GetPluginMsgPayload(PluginMsgId id, ObservedEvt ev)
Retrieve the string in a plugin message, internal or received on the REST insterface.
DECL_EXP double fromUsrDistance_Plugin(double usr_distance, int unit=-1)
Converts from user's preferred distance unit to nautical miles.
DECL_EXP wxWindow * PluginGetFocusCanvas()
Gets the currently focused chart canvas.
int DECL_EXP PI_PLIBRenderAreaToGL(const wxGLContext &glcc, PI_S57Obj *pObj, PlugIn_ViewPort *vp, wxRect &render_rect)
Renders an S57 area object using OpenGL.
DECL_EXP bool UpdateSingleWaypointEx(PlugIn_Waypoint_Ex *pwaypoint)
Updates an existing extended waypoint.
DECL_EXP void SetFullScreen(bool full_screen_on)
Sets full screen mode.
DECL_EXP void PluginCenterOwnship(int CanvasIndex)
Center the chart view on the own ship position for a specific canvas.
DECL_EXP double GetOCPNGUIToolScaleFactor_PlugIn()
Gets current global GUI scaling factor.
DECL_EXP wxString GetSelectedRouteGUID_Plugin()
Gets GUID of currently selected route.
DECL_EXP void DistanceBearingMercator_Plugin(double lat0, double lon0, double lat1, double lon1, double *brg, double *dist)
Calculates bearing and distance between two points using Mercator projection.
DECL_EXP std::unique_ptr< PlugIn_Waypoint_Ex > GetWaypointEx_Plugin(const wxString &GUID)
Gets extended waypoint by GUID.
DECL_EXP wxColor GetGlobalColorD(std::string map_name, std::string name)
Gets a color from the global color scheme.
enum _PI_NavMode PI_NavMode
Navigation mode options for chart display orientation.
DECL_EXP void ShowGlobalSettingsDialog()
Display the global settings dialog.
DECL_EXP void SetToolbarToolBitmapsSVG(int item, wxString SVGfile, wxString SVGfileRollover, wxString SVGfileToggled)
Updates SVG graphics for toolbar tool.
DECL_EXP void PlugInPlaySound(wxString &sound_file)
Plays a sound file asynchronously.
_PI_LUPname
Name identifiers for S57 lookup table sets.
@ PI_PLAIN_BOUNDARIES
Area objects with simple boundaries.
@ PI_PAPER_CHART
Point objects using traditional paper chart symbols.
@ PI_LINES
Line objects (e.g., depth contours, coastlines)
@ PI_LUPNAME_NUM
Total number of lookup table types.
@ PI_SIMPLIFIED
Point objects using simplified symbols.
@ PI_SYMBOLIZED_BOUNDARIES
Area objects with symbolized boundaries.
DECL_EXP std::vector< std::string > GetPriorityMaps()
Gets list of configured priority mapping schemes.
DECL_EXP ArrayOfPlugIn_AIS_Targets * GetAISTargetArray(void)
Gets array of AIS targets.
DECL_EXP void EnableSplitScreenLayout(bool enable=true)
Enable or disable the split-screen layout.
DECL_EXP bool UpdateSingleWaypoint(PlugIn_Waypoint *pwaypoint)
Updates a single waypoint.
DECL_EXP double fromUsrHeight_Plugin(double usr_height, int unit=-1)
Converts from user's preferred height unit to meters.
DECL_EXP void SetCanvasProjection(int projection)
Sets chart projection type.
DECL_EXP bool AddPlugInTrack(PlugIn_Track *ptrack, bool b_permanent=true)
Adds a new track.
DECL_EXP 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.
DECL_EXP wxString getUsrSpeedUnit_Plugin(int unit=-1)
Gets display string for user's preferred speed unit.
wxColour DECL_EXP GetBaseGlobalColor(wxString colorName)
Gets a global system color.
DECL_EXP bool GetEnableENCTextDisplay(int CanvasIndex)
Gets ENC text label visibility.
DECL_EXP bool GetEnableCompassGPSIcon(int CanvasIndex)
Gets compass icon visibility state.
OcpnProjTypePI
Enumeration of chart projection types.
@ PI_PROJECTION_UNKNOWN
Projection type is unknown or undefined.
@ PI_PROJECTION_MERCATOR
Mercator projection, standard for navigation charts.
@ PI_PROJECTION_STEREOGRAPHIC
Stereographic projection, used for polar and specialty charts.
@ PI_PROJECTION_GNOMONIC
Gnomonic projection, in which great circles appear as straight lines.
@ PI_PROJECTION_POLAR
Polar projection, used for polar regions.
@ PI_PROJECTION_POLYCONIC
Polyconic projection, sometimes used for inland charts.
@ PI_PROJECTION_TRANSVERSE_MERCATOR
Transverse Mercator projection, used for some coastal charts.
@ PI_PROJECTION_ORTHOGRAPHIC
Orthographic projection, showing Earth as viewed from space.
@ PI_PROJECTION_EQUIRECTANGULAR
Equirectangular/Plate Carrée projection, simple lat/lon grid.
DECL_EXP bool GetEnableMUIBar(int CanvasIndex)
Gets MUI bar visibility state.
DECL_EXP bool CheckMUIEdgePan_PlugIn(int x, int y, bool dragging, int margin, int delta, int canvasIndex)
Checks if chart should pan when cursor near edge.
DECL_EXP void EnableTouchMode(bool enable)
Enables/disables touch interface mode.
DECL_EXP void PluginZoomCanvas(int CanvasIndex, double factor)
Zoom a specific chart canvas by the given factor.
DECL_EXP wxString GetActiveWaypointGUID(void)
Gets GUID of currently active waypoint.
DECL_EXP bool AddSingleWaypointExV2(PlugIn_Waypoint_ExV2 *pwaypoint, bool b_permanent=true)
Adds a waypoint with extended V2 properties.
DECL_EXP void GetCanvasLLPix(PlugIn_ViewPort *vp, wxPoint p, double *plat, double *plon)
Converts canvas physical pixel coordinates to lat/lon.
DECL_EXP bool GetEnableLightDescriptionsDisplay(int CanvasIndex)
Gets light description text visibility.
enum _OBJECT_LAYER_REQ OBJECT_LAYER_REQ
Filter options for object queries.
DECL_EXP CommDriverResult RegisterTXPGNs(DriverHandle handle, std::vector< int > &pgn_list)
Register PGNs that this application intends to transmit for some NMEA 2000 adapters like Actisense NG...
DECL_EXP void SendPluginMessage(wxString message_id, wxString message_body)
Sends message to other plugins.
DECL_EXP wxString * GetpPrivateApplicationDataLocation()
Gets private application data directory.
DECL_EXP wxDialog * GetActiveOptionsDialog()
Gets pointer to active options dialog.
DECL_EXP void SetAppColorScheme(PI_ColorScheme cs)
Set the application color scheme.
DECL_EXP bool DeletePlugInTrack(wxString &GUID)
Deletes a track.
DECL_EXP bool GetEnableCurrentStationsDisplay(int CanvasIndex)
Gets current station icon visibility.
DECL_EXP int AddCanvasMenuItem(wxMenuItem *pitem, opencpn_plugin *pplugin, const char *name="")
Adds item to canvas context menu.
int DECL_EXP PI_PLIBRenderObjectToGL(const wxGLContext &glcc, PI_S57Obj *pObj, PlugIn_ViewPort *vp, wxRect &render_rect)
Renders any S57 object using OpenGL.
DECL_EXP bool GetEnableTideStationsDisplay(int CanvasIndex)
Gets tide station icon visibility.
DECL_EXP void SetCanvasMenuItemViz(int item, bool viz, const char *name="")
Temporarily changes context menu item visibility.
DECL_EXP void SetCanvasTilt(double tilt)
Gets current canvas tilt angle.
DECL_EXP std::vector< std::string > GetActivePriorityIdentifiers()
Gets list of active priority identifiers.
DECL_EXP void fromSM_Plugin(double x, double y, double lat0, double lon0, double *lat, double *lon)
Converts Simple Mercator coordinates to geographic.
DECL_EXP int GetCanvasCount()
Gets total number of chart canvases.
DECL_EXP void PluginSetFollowMode(int CanvasIndex, bool enable_follow)
Set follow mode for a specific canvas.
double DECL_EXP PI_GetPLIBMarinerSafetyContour()
Gets configured safety contour depth.
DECL_EXP void EnableLightsDisplay(bool enable, int CanvasIndex)
Controls light icon display.
PI_InitReturn
Return values for plugin initialization.
@ PI_INIT_OK
Initialization successful.
@ PI_INIT_FAIL_NOERROR
Init failed, request no explicit error message.
@ PI_INIT_FAIL_RETRY
Init failed, retry suggested.
@ PI_INIT_FAIL_REMOVE
Init failed, suggest remove from further use.
DECL_EXP void fromTM_Plugin(double x, double y, double lat0, double lon0, double *lat, double *lon)
Converts Transverse Mercator coordinates to geographic.
PI_DisCat DECL_EXP PI_GetObjectDisplayCategory(PI_S57Obj *pObj)
Gets display category for object.
DECL_EXP int RemoveChartFromDBInPlace(wxString &full_path)
Removes a chart from database without full rebuild.
DECL_EXP _OCPN_DLStatus OCPN_downloadFileBackground(const wxString &url, const wxString &outputFile, wxEvtHandler *handler, long *handle)
Asynchronously downloads a file in the background.
DECL_EXP wxString GetPluginDataDir(const char *plugin_name)
Returns an installed plugin's data directory given a plugin name.
DECL_EXP wxScrolledWindow * AddOptionsPage(OptionsParentPI parent, wxString title)
Adds a new preferences page to OpenCPN options dialog.
DECL_EXP bool GetTouchMode()
Gets touch interface mode state.
DECL_EXP wxString GetSelectedWaypointGUID_Plugin()
Gets GUID of currently selected waypoint.
DECL_EXP void ForceChartDBRebuild()
Forces complete rebuild of chart database.
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.
DECL_EXP void SetToolbarToolViz(int item, bool viz)
Temporarily changes toolbar tool visibility.
int DECL_EXP PI_GetPLIBSymbolStyle()
Gets configured S52 symbol style.
DECL_EXP void EnableCompassGPSIcon(bool enable, int CanvasIndex)
Controls visibility of compass/GPS status icon.
int DECL_EXP PI_GetPLIBBoundaryStyle()
Gets configured S52 boundary style.
Configuration options for date and time formatting.
bool show_timezone
Whether to show timezone information in the formatted date/time string.
wxString format_string
The format string for date/time.
DateTimeFormatOptions & SetFormatString(const wxString &fmt)
Sets the date/time format pattern string.
DateTimeFormatOptions & SetShowTimezone(bool show)
Sets whether to show timezone information in the formatted output.
DateTimeFormatOptions & SetTimezone(const wxString &tz)
Sets the timezone mode for date/time display.
wxString time_zone
The timezone to use when formatting the date/time.
DateTimeFormatOptions & SetLongitude(double lon)
Sets the reference longitude for Local Mean Time (LMT) calculations.
double longitude
The longitude to use when formatting the date/time in Local Mean Time (LMT).
Identifier for NMEA 0183 sentence types.
const std::string id
Sentence identifier.
NMEA0183Id(const std::string &s)
Creates identifier from sentence type.
Identifier for NMEA 2000 message types.
const uint64_t id
The PGN value.
NMEA2000Id(int value)
Creates identifier from PGN value.
Navigation data message identifier.
const int type
Message type identifier (currently only 0 supported)
NavDataId()
Default constructor.
Facade for NotificationMsg.
Facade for NavAddrPluginMsg.
Basic navigation data structure.
double var
Magnetic variation in degrees.
double cog
Course over ground in degrees.
double lon
Longitude in decimal degrees.
double lat
Latitude in decimal degrees.
double sog
Speed over ground in knots.
double hdt
True heading in degrees.
time_t time
UTC timestamp of data.
Identifier for Signal K paths.
SignalkId(const std::string &s)
Creates identifier from Signal K path.
const std::string id
Signal K path.
Geographic extent structure defining a bounding box.
double NLAT
Northern latitude boundary in decimal degrees.
double WLON
Western longitude boundary in decimal degrees.
double SLAT
Southern latitude boundary in decimal degrees.
double ELON
Eastern longitude boundary in decimal degrees.