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 <functional>
48#include <memory>
49#include <set>
50#include <string>
51#include <vector>
52#include <unordered_map>
53
54#include <wx/arrstr.h>
55#include <wx/aui/framemanager.h>
56#include <wx/bitmap.h>
57#include <wx/colour.h>
58#include <wx/cursor.h>
59#include <wx/dcmemory.h>
60#include <wx/dialog.h>
61#include <wx/event.h>
62#include <wx/fileconf.h>
63#include <wx/gdicmn.h>
64#include <wx/menuitem.h>
65#include <wx/notebook.h>
66#include <wx/region.h>
67#include <wx/scrolwin.h>
68#include <wx/xml/xml.h>
69
70// This is the most modern API Version number
71// It is expected that the API will remain downward compatible, meaning that
72// PlugIns conforming to API Version less than the most modern will also
73// be correctly supported.
74#define API_VERSION_MAJOR 1
75#define API_VERSION_MINOR 21
76
77// Using the correct #include <wx/glcanvas.h> causes compilation errors
78// on windows, probably errors in bundled and partly modified GL headers.
79// For now, use this as work around.
80class wxGLContext;
81class wxGLCanvas;
82
83//---------------------------------------------------------------------------------------------------------
84//
85// Bitfield PlugIn Capabilities flag definition
86//
87//---------------------------------------------------------------------------------------------------------
91#define WANTS_OVERLAY_CALLBACK 0x00000001
95#define WANTS_CURSOR_LATLON 0x00000002
105#define WANTS_TOOLBAR_CALLBACK 0x00000004
111#define INSTALLS_TOOLBAR_TOOL 0x00000008
114#define WANTS_CONFIG 0x00000010
117#define INSTALLS_TOOLBOX_PAGE 0x00000020
120#define INSTALLS_CONTEXTMENU_ITEMS 0x00000040
123#define WANTS_NMEA_SENTENCES 0x00000080
127#define WANTS_NMEA_EVENTS 0x00000100
130#define WANTS_AIS_SENTENCES 0x00000200
133#define USES_AUI_MANAGER 0x00000400
136#define WANTS_PREFERENCES 0x00000800
139#define INSTALLS_PLUGIN_CHART 0x00001000
142#define WANTS_ONPAINT_VIEWPORT 0x00002000
145#define WANTS_PLUGIN_MESSAGING 0x00004000
146#define WANTS_OPENGL_OVERLAY_CALLBACK 0x00008000
147#define WANTS_DYNAMIC_OPENGL_OVERLAY_CALLBACK 0x00010000
150#define WANTS_LATE_INIT 0x00020000
153#define INSTALLS_PLUGIN_CHART_GL 0x00040000
156#define WANTS_MOUSE_EVENTS 0x00080000
159#define WANTS_VECTOR_CHART_OBJECT_INFO 0x00100000
162#define WANTS_KEYBOARD_EVENTS 0x00200000
165#define WANTS_PRESHUTDOWN_HOOK 0x00400000
166
167#define WANTS_TIDECURRENT_CLICK 0x00800000
168
190#define OVERLAY_LEGACY 0
191
200#define OVERLAY_OVER_SHIPS 64
201
210#define OVERLAY_OVER_EMBOSS 96
211
221#define OVERLAY_OVER_UI 128
222
226#define OVERLAY_CHARTS 256
227
228//----------------------------------------------------------------------------------------------------------
229// Some PlugIn API interface object class definitions
230//----------------------------------------------------------------------------------------------------------
250
255public:
256 double clat;
257 double clon;
259 double skew;
260 double rotation;
261
263
266 wxRect rv_rect;
267 bool b_quilt;
270
271 double lat_min;
272 double lat_max;
273 double lon_min;
274 double lon_max;
275
276 bool
278};
279
284public:
285 double Lat;
286 double Lon;
287 double Cog;
288 double Sog;
289 double Var;
290 time_t FixTime;
291 int nSats;
292};
304public:
311 double Lat;
312
319 double Lon;
320
324 double Cog;
325
330 double Sog;
331
333 double Var;
334
339 double Hdm;
340
346 double Hdt;
347
353 time_t FixTime;
354
361 int nSats;
362};
363
368public:
369 double Xte;
371 double Btw;
372 double Dtw;
373 wxString wp_name;
374 bool arrival;
376};
377
386
391public:
392 int MMSI;
393 int Class;
395 double SOG;
396 double COG;
397 double HDG;
398 double Lon;
399 double Lat;
400 int ROTAIS;
401 char CallSign[8];
402 char ShipName[21];
403 unsigned char ShipType;
404 int IMO;
405
406 double Range_NM;
407 double Brg;
408
409 // Per target collision parameters
411 double TCPA;
412 double CPA;
413
415};
416
431
441
451
474
478typedef struct _ExtentPI {
479 double SLAT;
480 double WLON;
481 double NLAT;
482 double ELON;
484
485// PlugInChartBase::Init() init_flags constants
488#define PI_FULL_INIT 0
491#define PI_HEADER_ONLY 1
493#define PI_THUMB_ONLY 2
494
508class DECL_EXP PlugInChartBase : public wxObject {
509public:
510 // These methods Must be overriden in any derived class
512 virtual ~PlugInChartBase();
513
534 virtual wxString GetFileSearchMask(void);
535
560 virtual int Init(const wxString &full_path, int init_flags);
561
581 virtual void SetColorScheme(int cs, bool bApplyImmediate);
582
603 virtual double GetNormalScaleMin(double canvas_scale_factor,
604 bool b_allow_overzoom);
622 virtual double GetNormalScaleMax(double canvas_scale_factor,
623 int canvas_width);
638 virtual double GetNearestPreferredScalePPM(double target_scale_ppm);
639
657 virtual bool GetChartExtent(ExtentPI *pext);
658
685 virtual wxBitmap &RenderRegionView(const PlugIn_ViewPort &VPoint,
686 const wxRegion &Region);
687
702 virtual bool AdjustVP(PlugIn_ViewPort &vp_last, PlugIn_ViewPort &vp_proposed);
703
719 virtual void GetValidCanvasRegion(const PlugIn_ViewPort &VPoint,
720 wxRegion *pValidRegion);
721
739 virtual int GetCOVREntries() { return 0; }
740
756 virtual int GetCOVRTablePoints(int iTable) { return 0; }
757
771 virtual int GetCOVRTablenPoints(int iTable) { return 0; }
772
793 virtual float *GetCOVRTableHead(int iTable) { return (float *)NULL; }
794
817 virtual wxBitmap *GetThumbnail(int tnx, int tny, int cs);
818
819 // Accessors, need not be overridden in derived class if the member
820 // variables are maintained
821
835 virtual wxString GetFullPath() const { return m_FullPath; }
836
858 virtual ChartTypeEnumPI GetChartType() { return m_ChartType; }
859
873 virtual ChartFamilyEnumPI GetChartFamily() { return m_ChartFamily; }
874
894 virtual OcpnProjTypePI GetChartProjection() { return m_projection; }
895
908 virtual wxString GetName() { return m_Name; }
909
920 virtual wxString GetDescription() { return m_Description; }
921
933 virtual wxString GetID() { return m_ID; }
934
948 virtual wxString GetSE() { return m_SE; }
949
965 virtual wxString GetDepthUnits() { return m_DepthUnits; }
966
983 virtual wxString GetSoundingsDatum() { return m_SoundingsDatum; }
984
1000 virtual wxString GetDatumString() { return m_datum_str; }
1001
1015 virtual wxString GetExtraInfo() { return m_ExtraInfo; }
1016
1029 virtual wxString GetPubDate() { return m_PubYear; }
1030
1044 virtual double GetChartErrorFactor() { return m_Chart_Error_Factor; }
1045
1061 virtual ChartDepthUnitTypePI GetDepthUnitId() { return m_depth_unit_id; }
1062
1077 virtual bool IsReadyToRender() { return m_bReadyToRender; }
1078
1091 virtual int GetNativeScale() { return m_Chart_Scale; };
1092
1105 virtual double GetChartSkew() { return m_Chart_Skew; }
1106
1119 virtual wxDateTime GetEditionDate(void) { return m_EdDate; }
1120
1121 // Methods pertaining to CHART_FAMILY_RASTER type PlugIn charts only
1122
1141 virtual void ComputeSourceRectangle(const PlugIn_ViewPort &vp,
1142 wxRect *pSourceRect);
1143
1158 virtual double GetRasterScaleFactor();
1159
1180 virtual bool GetChartBits(wxRect &source, unsigned char *pPix, int sub_samp);
1181
1193 virtual int GetSize_X();
1194
1206 virtual int GetSize_Y();
1207
1222 virtual void latlong_to_chartpix(double lat, double lon, double &pixx,
1223 double &pixy);
1224
1239 virtual void chartpix_to_latlong(double pixx, double pixy, double *plat,
1240 double *plon);
1241
1242protected:
1243 ChartTypeEnumPI m_ChartType;
1244 ChartFamilyEnumPI m_ChartFamily;
1245
1246 wxString m_FullPath;
1247 OcpnProjTypePI m_projection;
1248 int m_Chart_Scale;
1249 double m_Chart_Skew;
1250
1251 wxDateTime m_EdDate;
1252 bool m_bReadyToRender;
1253
1254 wxString m_Name;
1255 wxString m_Description;
1256 wxString m_ID;
1257 wxString m_SE;
1258 wxString m_SoundingsDatum;
1259 wxString m_datum_str;
1260 wxString m_PubYear;
1261 wxString m_DepthUnits;
1262 wxString m_ExtraInfo;
1263
1264 ChartDepthUnitTypePI m_depth_unit_id;
1265
1266 double m_Chart_Error_Factor;
1267};
1268
1269// Declare an array of PlugIn_AIS_Targets
1270WX_DEFINE_ARRAY_PTR(PlugIn_AIS_Target *, ArrayOfPlugIn_AIS_Targets);
1271
1272// Support for plugin Tide/Current access
1273typedef enum TideStationType {
1274 TIDE_STATION = 0,
1275 CURRENT_STATION
1276} _TideStationType;
1277
1279 TideStationType point_type;
1280 int index;
1281 std::string name;
1282 int tz_offset_minutes;
1283 std::function<bool(time_t, int, float &, float &)> getTide;
1284};
1285
1286// Tide query API for plugins
1288 int index;
1289 char name[90];
1290 double lat;
1291 double lon;
1292};
1293
1308class DECL_EXP opencpn_plugin {
1309public:
1310 opencpn_plugin(void *pmgr) {}
1311 virtual ~opencpn_plugin();
1312
1313 // Public API to the PlugIn class
1314
1315 // This group of methods is required, and will be called by the opencpn
1316 // host opencpn PlugIns must implement this group
1317
1332 virtual int Init(void);
1333
1343 virtual bool DeInit(void);
1344
1357 virtual int GetAPIVersionMajor();
1358
1371 virtual int GetAPIVersionMinor();
1372
1384 virtual int GetPlugInVersionMajor();
1385
1397 virtual int GetPlugInVersionMinor();
1398
1411 virtual wxBitmap *GetPlugInBitmap();
1412
1413 // These three methods should produce valid, meaningful strings always
1414 // ---EVEN IF--- the PlugIn has not (yet) been initialized.
1415 // They are used by the PlugInManager GUI
1416
1428 virtual wxString GetCommonName();
1429
1441 virtual wxString GetShortDescription();
1442
1456 virtual wxString GetLongDescription();
1457
1458 // This group is optional.
1459 // PlugIns may override any of these methods as required
1460
1472 virtual void SetDefaults(void);
1473
1487 virtual int GetToolbarToolCount(void);
1488
1501 virtual int GetToolboxPanelCount(void);
1502
1517 virtual void SetupToolboxPanel(int page_sel, wxNotebook *pnotebook);
1518
1534 virtual void OnCloseToolboxPanel(int page_sel, int ok_apply_cancel);
1535
1549 virtual void ShowPreferencesDialog(wxWindow *parent);
1550
1576 virtual bool RenderOverlay(wxMemoryDC *pmdc, PlugIn_ViewPort *vp);
1577
1591 virtual void SetCursorLatLon(double lat, double lon);
1610 virtual void SetCurrentViewPort(PlugIn_ViewPort &vp);
1611
1637 virtual void SetPositionFix(PlugIn_Position_Fix &pfix);
1652 virtual void SetNMEASentence(wxString &sentence);
1669 virtual void SetAISSentence(wxString &sentence);
1670
1680 virtual void ProcessParentResize(int x, int y);
1681
1696 virtual void SetColorScheme(PI_ColorScheme cs);
1697
1706 virtual void OnToolbarToolCallback(int id);
1707
1716 virtual void OnContextMenuItemCallback(int id);
1717
1725 virtual void UpdateAuiStatus(void);
1726
1738 virtual wxArrayString GetDynamicChartClassNameArray(void);
1739};
1740
1741// the types of the class factories used to create PlugIn instances
1742typedef opencpn_plugin *create_t(void *);
1743typedef void destroy_t(opencpn_plugin *);
1744
1745#ifdef __clang__
1746#pragma clang diagnostic push
1747#pragma clang diagnostic ignored "-Woverloaded-virtual"
1748#endif
1749
1750class DECL_EXP opencpn_plugin_16 : public opencpn_plugin {
1751public:
1752 opencpn_plugin_16(void *pmgr);
1753 virtual ~opencpn_plugin_16();
1754
1756
1794 virtual bool RenderOverlay(wxDC &dc, PlugIn_ViewPort *vp);
1795
1810 virtual void SetPluginMessage(wxString &message_id, wxString &message_body);
1811};
1812
1813class DECL_EXP opencpn_plugin_17 : public opencpn_plugin {
1814public:
1815 opencpn_plugin_17(void *pmgr);
1816 virtual ~opencpn_plugin_17();
1817
1819
1820 virtual bool RenderOverlay(wxDC &dc, PlugIn_ViewPort *vp);
1821 virtual bool RenderGLOverlay(wxGLContext *pcontext, PlugIn_ViewPort *vp);
1822
1823 virtual void SetPluginMessage(wxString &message_id, wxString &message_body);
1824};
1825
1826class DECL_EXP opencpn_plugin_18 : public opencpn_plugin {
1827public:
1828 opencpn_plugin_18(void *pmgr);
1829 virtual ~opencpn_plugin_18();
1830
1832
1833 virtual bool RenderOverlay(wxDC &dc, PlugIn_ViewPort *vp);
1871 virtual bool RenderGLOverlay(wxGLContext *pcontext, PlugIn_ViewPort *vp);
1872 virtual void SetPluginMessage(wxString &message_id, wxString &message_body);
1873
1894 virtual void SetPositionFixEx(PlugIn_Position_Fix_Ex &pfix);
1895};
1896
1897#ifdef __clang__
1898#pragma clang diagnostic pop
1899#endif
1900
1901class DECL_EXP opencpn_plugin_19 : public opencpn_plugin_18 {
1902public:
1903 opencpn_plugin_19(void *pmgr);
1904 virtual ~opencpn_plugin_19();
1905
1913 virtual void OnSetupOptions(void);
1914};
1915
1916class DECL_EXP opencpn_plugin_110 : public opencpn_plugin_19 {
1917public:
1918 opencpn_plugin_110(void *pmgr);
1919 virtual ~opencpn_plugin_110();
1920
1921 virtual void LateInit(void); // If WANTS_LATE_INIT is returned by Init()
1922};
1923
1925public:
1926 opencpn_plugin_111(void *pmgr);
1927 virtual ~opencpn_plugin_111();
1928};
1929
1931public:
1932 opencpn_plugin_112(void *pmgr);
1933 virtual ~opencpn_plugin_112();
1934
1944 virtual bool MouseEventHook(wxMouseEvent &event);
1945
1960 virtual void SendVectorChartObjectInfo(wxString &chart, wxString &feature,
1961 wxString &objname, double lat,
1962 double lon, double scale,
1963 int nativescale);
1964};
1965
1967public:
1968 opencpn_plugin_113(void *pmgr);
1969 virtual ~opencpn_plugin_113();
1970
1980 virtual bool KeyboardEventHook(wxKeyEvent &event);
1981
1989 virtual void OnToolbarToolDownCallback(int id);
1990
1998 virtual void OnToolbarToolUpCallback(int id);
1999};
2000
2002public:
2003 opencpn_plugin_114(void *pmgr);
2004 virtual ~opencpn_plugin_114();
2005};
2006
2008public:
2009 opencpn_plugin_115(void *pmgr);
2010 virtual ~opencpn_plugin_115();
2011};
2012
2014public:
2015 opencpn_plugin_116(void *pmgr);
2016 virtual ~opencpn_plugin_116();
2049 virtual bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext,
2050 PlugIn_ViewPort *vp, int canvasIndex);
2051
2084 virtual bool RenderOverlayMultiCanvas(wxDC &dc, PlugIn_ViewPort *vp,
2085 int canvasIndex);
2094 virtual void PrepareContextMenu(int canvasIndex);
2095};
2096
2098public:
2099 opencpn_plugin_117(void *pmgr);
2106 virtual int GetPlugInVersionPatch();
2107
2109 virtual int GetPlugInVersionPost();
2110
2112 virtual const char *GetPlugInVersionPre();
2113
2115 virtual const char *GetPlugInVersionBuild();
2116
2117 /*Provide active leg data to plugins*/
2118 virtual void SetActiveLegInfo(Plugin_Active_Leg_Info &leg_info);
2119};
2120
2122public:
2123 opencpn_plugin_118(void *pmgr);
2124
2127
2185#ifdef _MSC_VER
2186 virtual bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext,
2187 PlugIn_ViewPort *vp, int canvasIndex,
2188 int priority = -1);
2189#else
2190 virtual bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext,
2191 PlugIn_ViewPort *vp, int canvasIndex,
2192 int priority);
2193
2194 bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext, PlugIn_ViewPort *vp,
2195 int canvas_ix) override {
2196 return RenderGLOverlayMultiCanvas(pcontext, vp, canvas_ix, -1);
2197 }
2198#endif
2199
2255#ifdef _MSC_VER
2256 virtual bool RenderOverlayMultiCanvas(wxDC &dc, PlugIn_ViewPort *vp,
2257 int canvasIndex, int priority = -1);
2258#else
2259 virtual bool RenderOverlayMultiCanvas(wxDC &dc, PlugIn_ViewPort *vp,
2260 int canvas_ix, int priority);
2262 int canvas_ix) override {
2263 return RenderOverlayMultiCanvas(dc, vp, canvas_ix, -1);
2264 }
2265#endif
2266};
2267
2269public:
2270 opencpn_plugin_119(void *pmgr);
2271
2289 virtual void PreShutdownHook();
2290};
2291
2293public:
2294 opencpn_plugin_120(void *pmgr);
2295
2296 virtual void OnContextMenuItemCallbackExt(int id, std::string obj_ident,
2297 std::string obj_type, double lat,
2298 double lon);
2299};
2300
2302public:
2303 opencpn_plugin_121(void *pmgr);
2304 virtual void UpdateFollowState(int canvas_index, bool state);
2305 virtual void OnTideCurrentClick(TCClickInfo info);
2306};
2307
2309public:
2310 opencpn_plugin_122(void *pmgr) : opencpn_plugin_121(pmgr) {}
2311};
2312
2313//------------------------------------------------------------------
2314// Route and Waypoint PlugIn support
2315//
2316//------------------------------------------------------------------
2317
2329class DECL_EXP Plugin_Hyperlink {
2330public:
2331 wxString DescrText;
2332 wxString Link;
2333 wxString Type;
2334};
2335
2336WX_DECLARE_LIST(Plugin_Hyperlink, Plugin_HyperlinkList);
2337
2352class DECL_EXP PlugIn_Waypoint {
2353public:
2358
2368 PlugIn_Waypoint(double lat, double lon, const wxString &icon_ident,
2369 const wxString &wp_name, const wxString &GUID = _T(""));
2371
2372 double m_lat;
2373 double m_lon;
2374 wxString m_GUID;
2375 wxString m_MarkName;
2377 wxDateTime m_CreateTime;
2379 wxString m_IconName;
2380
2381 Plugin_HyperlinkList *m_HyperlinkList;
2382};
2383
2384WX_DECLARE_LIST(PlugIn_Waypoint, Plugin_WaypointList);
2385
2392class DECL_EXP PlugIn_Route {
2393public:
2394 PlugIn_Route(void);
2395 ~PlugIn_Route(void);
2396
2397 wxString m_NameString;
2398 wxString m_StartString;
2399 wxString m_EndString;
2400 wxString m_GUID;
2401
2406 Plugin_WaypointList *pWaypointList;
2407};
2408
2422class DECL_EXP PlugIn_Track {
2423public:
2424 PlugIn_Track(void);
2425 ~PlugIn_Track(void);
2426
2427 wxString m_NameString;
2428 wxString m_StartString;
2429 wxString m_EndString;
2430 wxString m_GUID;
2431
2438 Plugin_WaypointList *pWaypointList;
2439};
2440
2441//----------------------------------------------------------------------------------------------------------
2442// The PlugIn CallBack API Definition
2443//
2444// The API back up to the PlugIn Manager
2445// PlugIns may call these static functions as necessary for system services
2446//
2447//----------------------------------------------------------------------------------------------------------
2448
2469extern "C" DECL_EXP int InsertPlugInTool(wxString label, wxBitmap *bitmap,
2470 wxBitmap *bmpRollover, wxItemKind kind,
2471 wxString shortHelp, wxString longHelp,
2472 wxObject *clientData, int position,
2473 int tool_sel, opencpn_plugin *pplugin);
2481extern "C" DECL_EXP void RemovePlugInTool(int tool_id);
2482
2491extern "C" DECL_EXP void SetToolbarToolViz(int item, bool viz);
2492
2501extern "C" DECL_EXP void SetToolbarItemState(int item, bool toggle);
2502
2512extern "C" DECL_EXP void SetToolbarToolBitmaps(int item, wxBitmap *bitmap,
2513 wxBitmap *bmpRollover);
2532extern "C" DECL_EXP int InsertPlugInToolSVG(
2533 wxString label, wxString SVGfile, wxString SVGfileRollover,
2534 wxString SVGfileToggled, wxItemKind kind, wxString shortHelp,
2535 wxString longHelp, wxObject *clientData, int position, int tool_sel,
2536 opencpn_plugin *pplugin);
2537
2548extern "C" DECL_EXP void SetToolbarToolBitmapsSVG(int item, wxString SVGfile,
2549 wxString SVGfileRollover,
2550 wxString SVGfileToggled);
2560extern "C" DECL_EXP int AddCanvasContextMenuItem(wxMenuItem *pitem,
2561 opencpn_plugin *pplugin);
2569extern "C" DECL_EXP void RemoveCanvasContextMenuItem(int item);
2570
2579extern "C" DECL_EXP void SetCanvasContextMenuItemViz(int item, bool viz);
2580
2589extern "C" DECL_EXP void SetCanvasContextMenuItemGrey(int item, bool grey);
2590
2600extern "C" DECL_EXP wxFileConfig *GetOCPNConfigObject(void);
2601
2609extern "C" DECL_EXP void RequestRefresh(wxWindow *);
2610
2626extern "C" DECL_EXP bool GetGlobalColor(wxString colorName, wxColour *pcolour);
2627
2639extern "C" DECL_EXP void GetCanvasPixLL(PlugIn_ViewPort *vp, wxPoint *pp,
2640 double lat, double lon);
2652extern "C" DECL_EXP void GetCanvasLLPix(PlugIn_ViewPort *vp, wxPoint p,
2653 double *plat, double *plon);
2661extern "C" DECL_EXP wxWindow *GetOCPNCanvasWindow();
2662
2701extern "C" DECL_EXP wxFont *OCPNGetFont(wxString TextElement,
2702 int default_size = 0);
2703
2716extern "C" DECL_EXP wxString *GetpSharedDataLocation();
2717
2726extern "C" DECL_EXP ArrayOfPlugIn_AIS_Targets *GetAISTargetArray(void);
2727
2737extern "C" DECL_EXP wxAuiManager *GetFrameAuiManager(void);
2738
2747extern "C" DECL_EXP bool AddLocaleCatalog(wxString catalog);
2748
2756extern "C" DECL_EXP void PushNMEABuffer(wxString str);
2757
2767extern DECL_EXP wxXmlDocument GetChartDatabaseEntryXML(int dbIndex,
2768 bool b_getGeom);
2779extern DECL_EXP bool UpdateChartDBInplace(wxArrayString dir_array,
2780 bool b_force_update,
2781 bool b_ProgressDialog);
2789extern DECL_EXP wxArrayString GetChartDBDirArrayString();
2790
2799extern "C" DECL_EXP void SendPluginMessage(wxString message_id,
2800 wxString message_body);
2808extern "C" DECL_EXP void DimeWindow(wxWindow *);
2809
2817extern "C" DECL_EXP void JumpToPosition(double lat, double lon, double scale);
2818
2819/* API 1.9 adds some common cartographic functions to avoid unnecessary code
2820 * duplication */
2821/* Study the original OpenCPN source (georef.c) for functional definitions */
2822
2847extern "C" DECL_EXP void PositionBearingDistanceMercator_Plugin(
2848 double lat, double lon, double brg, double dist, double *dlat,
2849 double *dlon);
2872extern "C" DECL_EXP void DistanceBearingMercator_Plugin(
2873 double lat0, double lon0, double lat1, double lon1, double *brg,
2874 double *dist);
2875
2885extern "C" DECL_EXP double DistGreatCircle_Plugin(double slat, double slon,
2886 double dlat, double dlon);
2897extern "C" DECL_EXP void toTM_Plugin(float lat, float lon, float lat0,
2898 float lon0, double *x, double *y);
2899
2910extern "C" DECL_EXP void fromTM_Plugin(double x, double y, double lat0,
2911 double lon0, double *lat, double *lon);
2912
2923extern "C" DECL_EXP void toSM_Plugin(double lat, double lon, double lat0,
2924 double lon0, double *x, double *y);
2925
2936extern "C" DECL_EXP void fromSM_Plugin(double x, double y, double lat0,
2937 double lon0, double *lat, double *lon);
2938
2949extern "C" DECL_EXP void toSM_ECC_Plugin(double lat, double lon, double lat0,
2950 double lon0, double *x, double *y);
2951
2962extern "C" DECL_EXP void fromSM_ECC_Plugin(double x, double y, double lat0,
2963 double lon0, double *lat,
2964 double *lon);
2965
2976extern "C" DECL_EXP bool DecodeSingleVDOMessage(const wxString &str,
2978 wxString *acc);
2979
2986extern "C" DECL_EXP int GetChartbarHeight(void);
3017extern "C" DECL_EXP bool GetActiveRoutepointGPX(char *buffer,
3018 unsigned int buffer_length);
3019
3020/* API 1.9 */
3021
3050
3065extern DECL_EXP wxScrolledWindow *AddOptionsPage(OptionsParentPI parent,
3066 wxString title);
3067
3075extern DECL_EXP bool DeleteOptionsPage(wxScrolledWindow *page);
3076
3077/* API 1.10 */
3078
3079/* API 1.10 adds some common functions to avoid unnecessary code duplication */
3080/* Study the original OpenCPN source for functional definitions */
3091extern "C" DECL_EXP double toUsrDistance_Plugin(double nm_distance,
3092 int unit = -1);
3093
3102extern "C" DECL_EXP double fromUsrDistance_Plugin(double usr_distance,
3103 int unit = -1);
3104
3113extern "C" DECL_EXP double toUsrSpeed_Plugin(double kts_speed, int unit = -1);
3114
3123extern "C" DECL_EXP double fromUsrSpeed_Plugin(double usr_speed, int unit = -1);
3124
3133extern "C" DECL_EXP double toUsrTemp_Plugin(double cel_temp, int unit = -1);
3134
3143extern "C" DECL_EXP double fromUsrTemp_Plugin(double usr_temp, int unit = -1);
3144
3152extern DECL_EXP wxString getUsrDistanceUnit_Plugin(int unit = -1);
3153
3161extern DECL_EXP wxString getUsrSpeedUnit_Plugin(int unit = -1);
3162
3170extern DECL_EXP wxString getUsrTempUnit_Plugin(int unit = -1);
3171
3179extern DECL_EXP wxString getUsrWindSpeedUnit_Plugin(int unit = -1);
3180
3189extern DECL_EXP double toUsrWindSpeed_Plugin(double kts_wspeed, int unit = -1);
3190
3199extern DECL_EXP double fromUsrWindSpeed_Plugin(double usr_wspeed,
3200 int unit = -1);
3201
3209extern DECL_EXP wxString getUsrDepthUnit_Plugin(int unit = -1);
3210
3219extern DECL_EXP double toUsrDepth_Plugin(double m_depth, int unit = -1);
3220
3229extern DECL_EXP double fromUsrDepth_Plugin(double usr_depth, int unit = -1);
3230
3238extern DECL_EXP wxString getUsrHeightUnit_Plugin(int unit = -1);
3239
3248extern DECL_EXP double toUsrHeight_Plugin(double m_height, int unit = -1);
3249
3258extern DECL_EXP double fromUsrHeight_Plugin(double usr_height, int unit = -1);
3259
3276extern DECL_EXP double fromDMM_PlugIn(wxString sdms);
3277
3291struct DECL_EXP DateTimeFormatOptions {
3293 virtual ~DateTimeFormatOptions();
3294
3315
3331 wxString time_zone;
3332
3340
3346
3347 int version = 1; // For future compatibility checks
3348
3368 format_string = fmt;
3369 return *this;
3370 }
3371
3390 DateTimeFormatOptions &SetTimezone(const wxString &tz) {
3391 time_zone = tz;
3392 return *this;
3393 }
3394
3402 show_timezone = show;
3403 return *this;
3404 }
3405
3424 longitude = lon;
3425 return *this;
3426 }
3427};
3428
3448extern DECL_EXP wxString toUsrDateTimeFormat_Plugin(
3449 const wxDateTime date_time,
3451
3463extern DECL_EXP wxString GetNewGUID();
3464
3477extern "C" DECL_EXP bool PlugIn_GSHHS_CrossesLand(double lat1, double lon1,
3478 double lat2, double lon2);
3485extern DECL_EXP void PlugInPlaySound(wxString &sound_file);
3486
3487// API 1.10 Route and Waypoint Support
3488
3497extern DECL_EXP wxBitmap *FindSystemWaypointIcon(wxString &icon_name);
3498
3509extern DECL_EXP bool AddCustomWaypointIcon(wxBitmap *pimage, wxString key,
3510 wxString description);
3511
3521extern DECL_EXP bool AddSingleWaypoint(PlugIn_Waypoint *pwaypoint,
3522 bool b_permanent = true);
3523
3532extern DECL_EXP bool DeleteSingleWaypoint(wxString &GUID);
3533
3542extern DECL_EXP bool UpdateSingleWaypoint(PlugIn_Waypoint *pwaypoint);
3543
3553extern DECL_EXP bool AddPlugInRoute(PlugIn_Route *proute,
3554 bool b_permanent = true);
3555
3564extern DECL_EXP bool DeletePlugInRoute(wxString &GUID);
3565
3575extern DECL_EXP bool UpdatePlugInRoute(PlugIn_Route *proute);
3576
3586extern DECL_EXP bool AddPlugInTrack(PlugIn_Track *ptrack,
3587 bool b_permanent = true);
3588
3597extern DECL_EXP bool DeletePlugInTrack(wxString &GUID);
3598
3608extern DECL_EXP bool UpdatePlugInTrack(PlugIn_Track *ptrack);
3609
3610/* API 1.11 */
3611
3612/* API 1.11 adds some more common functions to avoid unnecessary code
3613 * duplication */
3614
3623wxColour DECL_EXP GetBaseGlobalColor(wxString colorName);
3624
3638int DECL_EXP OCPNMessageBox_PlugIn(wxWindow *parent, const wxString &message,
3639 const wxString &caption = _T("Message"),
3640 int style = wxOK, int x = -1, int y = -1);
3641
3656extern DECL_EXP wxString toSDMM_PlugIn(int NEflag, double a,
3657 bool hi_precision = true);
3658
3668extern "C" DECL_EXP wxString *GetpPrivateApplicationDataLocation();
3669
3677extern DECL_EXP wxString GetOCPN_ExePath(void);
3678
3687extern "C" DECL_EXP wxString *GetpPlugInLocation();
3688
3697extern DECL_EXP wxString GetPlugInPath(opencpn_plugin *pplugin);
3698
3708extern "C" DECL_EXP int AddChartToDBInPlace(wxString &full_path,
3709 bool b_RefreshCanvas);
3716extern "C" DECL_EXP int RemoveChartFromDBInPlace(wxString &full_path);
3717
3726extern DECL_EXP wxString GetLocaleCanonicalName();
3727
3742#define PLIB_CAPS_LINE_VBO 1
3746#define PLIB_CAPS_LINE_BUFFER 1 << 1
3747
3751#define PLIB_CAPS_SINGLEGEO_BUFFER 1 << 2
3752
3756#define PLIB_CAPS_OBJSEGLIST 1 << 3
3757
3761#define PLIB_CAPS_OBJCATMUTATE 1 << 4
3762
3763class PI_S57Obj;
3764
3765WX_DECLARE_LIST(PI_S57Obj, ListOfPI_S57Obj);
3766
3767// ----------------------------------------------------------------------------
3768// PlugInChartBaseGL
3769// Derived from PlugInChartBase, add OpenGL Vector chart support
3770// ----------------------------------------------------------------------------
3771
3784class DECL_EXP PlugInChartBaseGL : public PlugInChartBase {
3785public:
3787 virtual ~PlugInChartBaseGL();
3788
3803 virtual int RenderRegionViewOnGL(const wxGLContext &glc,
3804 const PlugIn_ViewPort &VPoint,
3805 const wxRegion &Region, bool b_use_stencil);
3806
3819 virtual ListOfPI_S57Obj *GetObjRuleListAtLatLon(float lat, float lon,
3820 float select_radius,
3821 PlugIn_ViewPort *VPoint);
3822
3832 virtual wxString CreateObjDescriptions(ListOfPI_S57Obj *obj_list);
3833
3839 virtual int GetNoCOVREntries();
3840
3847 virtual int GetNoCOVRTablePoints(int iTable);
3848
3855 virtual int GetNoCOVRTablenPoints(int iTable);
3856
3863 virtual float *GetNoCOVRTableHead(int iTable);
3864};
3865
3866// ----------------------------------------------------------------------------
3867// PlugInChartBaseGLPlus2
3868// Derived from PlugInChartBaseGL, add additional chart management methods
3869// ----------------------------------------------------------------------------
3870
3880public:
3882 virtual ~PlugInChartBaseGLPlus2();
3883
3900 virtual ListOfPI_S57Obj *GetLightsObjRuleListVisibleAtLatLon(
3901 float lat, float lon, PlugIn_ViewPort *VPoint);
3902};
3903
3904// ----------------------------------------------------------------------------
3905// PlugInChartBaseExtended
3906// Derived from PlugInChartBase, add extended chart support methods
3907// ----------------------------------------------------------------------------
3908
3917public:
3919 virtual ~PlugInChartBaseExtended();
3920
3933 virtual int RenderRegionViewOnGL(const wxGLContext &glc,
3934 const PlugIn_ViewPort &VPoint,
3935 const wxRegion &Region, bool b_use_stencil);
3936
3947 virtual wxBitmap &RenderRegionViewOnDCNoText(const PlugIn_ViewPort &VPoint,
3948 const wxRegion &Region);
3949
3960 virtual bool RenderRegionViewOnDCTextOnly(wxMemoryDC &dc,
3961 const PlugIn_ViewPort &VPoint,
3962 const wxRegion &Region);
3963
3975 virtual int RenderRegionViewOnGLNoText(const wxGLContext &glc,
3976 const PlugIn_ViewPort &VPoint,
3977 const wxRegion &Region,
3978 bool b_use_stencil);
3979
3991 virtual int RenderRegionViewOnGLTextOnly(const wxGLContext &glc,
3992 const PlugIn_ViewPort &VPoint,
3993 const wxRegion &Region,
3994 bool b_use_stencil);
3995
3996 virtual ListOfPI_S57Obj *GetObjRuleListAtLatLon(float lat, float lon,
3997 float select_radius,
3998 PlugIn_ViewPort *VPoint);
3999 virtual wxString CreateObjDescriptions(ListOfPI_S57Obj *obj_list);
4000
4001 virtual int GetNoCOVREntries();
4002 virtual int GetNoCOVRTablePoints(int iTable);
4003 virtual int GetNoCOVRTablenPoints(int iTable);
4004 virtual float *GetNoCOVRTableHead(int iTable);
4005
4012 virtual void ClearPLIBTextList();
4013};
4014
4015// ----------------------------------------------------------------------------
4016// PlugInChartBaseExtendedPlus2
4017// Derived from PlugInChartBaseExtended, add additional extended chart support
4018// methods
4019// ----------------------------------------------------------------------------
4020
4022public:
4025
4026 virtual ListOfPI_S57Obj *GetLightsObjRuleListVisibleAtLatLon(
4027 float lat, float lon, PlugIn_ViewPort *VPoint);
4028};
4029
4030class wxArrayOfS57attVal;
4031
4050
4074
4103
4117
4143
4151class DECL_EXP PI_S57Obj {
4152public:
4153 // Public Methods
4154 PI_S57Obj();
4155
4156public:
4157 // Instance Data
4158 char FeatureName[8];
4160
4162 wxArrayOfS57attVal *attVal;
4164
4165 int iOBJL;
4166 int Index;
4167
4168 double x;
4169 double y;
4170 double z;
4171 int npt;
4172 void *geoPt;
4173 double *geoPtz;
4174 double *geoPtMulti;
4175
4177
4178 double m_lat;
4179 double m_lon;
4180
4183
4184 double lat_min;
4185 double lat_max;
4186 double lon_min;
4187 double lon_max;
4188
4190
4192 int nRef;
4193
4194 bool bIsAton;
4196
4201
4203
4207
4208 // Coordinate transform coefficients
4209 double x_rate;
4210 double y_rate;
4211 double x_origin;
4212 double y_origin;
4213
4214 // OpenGL rendering parameters
4219
4223};
4224
4230wxString DECL_EXP PI_GetPLIBColorScheme();
4239int DECL_EXP PI_GetPLIBDepthUnitInt();
4240
4248int DECL_EXP PI_GetPLIBSymbolStyle();
4249
4257int DECL_EXP PI_GetPLIBBoundaryStyle();
4258
4265int DECL_EXP PI_GetPLIBStateHash();
4266
4272double DECL_EXP PI_GetPLIBMarinerSafetyContour();
4273
4284bool DECL_EXP PI_GetObjectRenderBox(PI_S57Obj *pObj, double *lat_min,
4285 double *lat_max, double *lon_min,
4286 double *lon_max);
4287
4293void DECL_EXP PI_UpdateContext(PI_S57Obj *pObj);
4294
4302bool DECL_EXP PI_PLIBObjectRenderCheck(PI_S57Obj *pObj, PlugIn_ViewPort *vp);
4303
4316
4324
4332
4339void DECL_EXP PI_PLIBSetLineFeaturePriority(PI_S57Obj *pObj, int prio);
4340
4345void DECL_EXP PI_PLIBPrepareForNewRender(void);
4346
4352void DECL_EXP PI_PLIBFreeContext(void *pContext);
4353
4363void DECL_EXP PI_PLIBSetRenderCaps(unsigned int flags);
4364
4374bool DECL_EXP PI_PLIBSetContext(PI_S57Obj *pObj);
4375
4390int DECL_EXP PI_PLIBRenderObjectToDC(wxDC *pdc, PI_S57Obj *pObj,
4391 PlugIn_ViewPort *vp);
4392
4409int DECL_EXP PI_PLIBRenderAreaToDC(wxDC *pdc, PI_S57Obj *pObj,
4410 PlugIn_ViewPort *vp, wxRect rect,
4411 unsigned char *pixbuf);
4412
4427int DECL_EXP PI_PLIBRenderAreaToGL(const wxGLContext &glcc, PI_S57Obj *pObj,
4428 PlugIn_ViewPort *vp, wxRect &render_rect);
4429
4446int DECL_EXP PI_PLIBRenderObjectToGL(const wxGLContext &glcc, PI_S57Obj *pObj,
4447 PlugIn_ViewPort *vp, wxRect &render_rect);
4448
4449/* API 1.11 OpenGL Display List and vertex buffer object routines
4450
4451 Effectively these two routines cancel each other so all
4452 of the translation, scaling and rotation can be done by opengl.
4453
4454 Display lists need only be built infrequently, but used in each frame
4455 greatly accelerates the speed of rendering. This avoids costly calculations,
4456 and also allows the vertexes to be stored in graphics memory.
4457
4458 static int dl = 0;
4459 glPushMatrix();
4460 PlugInMultMatrixViewport(current_viewport);
4461 if(dl)
4462 glCallList(dl);
4463 else {
4464 dl = glGenLists(1);
4465 PlugInViewPort norm_viewport = current_viewport;
4466 NormalizeViewPort(norm_viewport);
4467 glNewList(dl, GL_COMPILE_AND_EXECUTE);
4468 ... // use norm_viewport with GetCanvasLLPix here
4469 glEndList();
4470 }
4471 glPopMatrix();
4472 ... // use current_viewport with GetCanvasLLPix again
4473*/
4474
4484extern DECL_EXP bool PlugInHasNormalizedViewPort(PlugIn_ViewPort *vp);
4485
4500extern DECL_EXP void PlugInMultMatrixViewport(PlugIn_ViewPort *vp,
4501 float lat = 0, float lon = 0);
4502
4517extern DECL_EXP void PlugInNormalizeViewport(PlugIn_ViewPort *vp, float lat = 0,
4518 float lon = 0);
4519
4520class wxPoint2DDouble;
4521
4533extern "C" DECL_EXP void GetDoubleCanvasPixLL(PlugIn_ViewPort *vp,
4534 wxPoint2DDouble *pp, double lat,
4535 double lon);
4536
4537/* API 1.13 */
4538/* API 1.13 adds some more common functions to avoid unnecessary code
4539 * duplication */
4540
4549extern DECL_EXP double fromDMM_Plugin(wxString sdms);
4550
4561extern DECL_EXP void SetCanvasRotation(double rotation);
4562
4574extern DECL_EXP void SetCanvasProjection(int projection);
4575
4585extern DECL_EXP bool GetSingleWaypoint(wxString GUID,
4586 PlugIn_Waypoint *pwaypoint);
4587
4600extern DECL_EXP bool CheckEdgePan_PlugIn(int x, int y, bool dragging,
4601 int margin, int delta);
4602
4611extern DECL_EXP wxBitmap GetIcon_PlugIn(const wxString &name);
4612
4620extern DECL_EXP void SetCursor_PlugIn(wxCursor *pPlugin_Cursor = NULL);
4621
4657extern DECL_EXP wxFont *GetOCPNScaledFont_PlugIn(wxString TextElement,
4658 int default_size = 0);
4659
4673extern DECL_EXP wxFont GetOCPNGUIScaledFont_PlugIn(wxString item);
4674
4690extern DECL_EXP double GetOCPNGUIToolScaleFactor_PlugIn(int GUIScaledFactor);
4691
4706extern DECL_EXP double GetOCPNGUIToolScaleFactor_PlugIn();
4707
4722extern DECL_EXP float GetOCPNChartScaleFactor_Plugin();
4723
4731extern DECL_EXP wxColour GetFontColour_PlugIn(wxString TextElement);
4732
4743extern DECL_EXP double GetCanvasTilt();
4744
4755extern DECL_EXP void SetCanvasTilt(double tilt);
4756
4762extern DECL_EXP bool PlugInPlaySoundEx(wxString &sound_file,
4763 int deviceIndex = -1);
4764
4777extern DECL_EXP void AddChartDirectory(wxString &path);
4778
4789extern DECL_EXP void ForceChartDBUpdate();
4790
4802extern DECL_EXP void ForceChartDBRebuild();
4803
4809extern DECL_EXP wxString GetWritableDocumentsDir(void);
4810
4816extern DECL_EXP wxDialog *GetActiveOptionsDialog();
4817
4828extern DECL_EXP wxArrayString GetWaypointGUIDArray(void);
4829
4835extern DECL_EXP wxArrayString GetIconNameArray(void);
4836
4847extern DECL_EXP bool AddPersistentFontKey(wxString TextElement);
4848
4860extern DECL_EXP wxString GetActiveStyleName();
4861
4877extern DECL_EXP wxBitmap GetBitmapFromSVGFile(wxString filename,
4878 unsigned int width,
4879 unsigned int height);
4880
4893extern DECL_EXP bool IsTouchInterface_PlugIn(void);
4894
4895/* Platform optimized File/Dir selector dialogs */
4914extern DECL_EXP int PlatformDirSelectorDialog(wxWindow *parent,
4915 wxString *file_spec,
4916 wxString Title, wxString initDir);
4917
4939extern DECL_EXP int PlatformFileSelectorDialog(wxWindow *parent,
4940 wxString *file_spec,
4941 wxString Title, wxString initDir,
4942 wxString suggestedName,
4943 wxString wildcard);
4944
4945/* OpenCPN HTTP File Download PlugIn Interface */
4946
4947/* Various method Return Codes, etc */
4962
4975
4976// Style definitions for Synchronous file download modal dialogs, if
4977// desired. Abstracted from wxCURL package
4981 0x0002,
4984 OCPN_DLDS_SIZE = 0x0010,
4987 0x0020,
4988
4989 // styles related to the use of wxCurlConnectionSettingsDialog:
4990
4992 0x0040,
4997 0x0100,
4998
4999 OCPN_DLDS_CONN_SETTINGS_ALL = OCPN_DLDS_CONN_SETTINGS_AUTH |
5002
5003 OCPN_DLDS_SHOW_ALL = OCPN_DLDS_ELAPSED_TIME | OCPN_DLDS_ESTIMATED_TIME |
5006 OCPN_DLDS_CONN_SETTINGS_ALL,
5007
5009 OCPN_DLDS_CAN_START = 0x0400,
5012
5014 0x1000,
5015
5016 // by default all available features are enabled:
5017 OCPN_DLDS_DEFAULT_STYLE = OCPN_DLDS_CAN_START | OCPN_DLDS_CAN_PAUSE |
5018 OCPN_DLDS_CAN_ABORT | OCPN_DLDS_SHOW_ALL |
5020};
5021
5022#define ONLINE_CHECK_RETRY \
5023 30 // Recheck the Internet connection availability every ONLINE_CHECK_RETRY s
5024
5045extern DECL_EXP _OCPN_DLStatus OCPN_downloadFile(
5046 const wxString &url, const wxString &outputFile, const wxString &title,
5047 const wxString &message, const wxBitmap &bitmap, wxWindow *parent,
5048 long style, int timeout_secs);
5049
5067extern DECL_EXP _OCPN_DLStatus
5068OCPN_downloadFileBackground(const wxString &url, const wxString &outputFile,
5069 wxEvtHandler *handler, long *handle);
5070
5076extern DECL_EXP void OCPN_cancelDownloadFileBackground(long handle);
5077
5089extern DECL_EXP _OCPN_DLStatus OCPN_postDataHttp(const wxString &url,
5090 const wxString &parameters,
5091 wxString &result,
5092 int timeout_secs);
5093
5099extern DECL_EXP bool OCPN_isOnline();
5100
5101/* Supporting Event for Background downloading */
5102/* OCPN_downloadEvent Definition */
5103
5104/* PlugIn should be ready/able to handle this event after initiating a
5105 * background file transfer
5106 *
5107 * The event as received should be parsed primarily by the getDLEventCondition()
5108 * method. This will allow identification of download start, progress, and end
5109 * states.
5110 *
5111 * Other accessor methods contain status, byte counts, etc.
5112 *
5113 * A PlugIn may safely destroy its EvtHandler after receipt of an
5114 * OCPN_downloadEvent with getDLEventCondition == OCPN_DL_EVENT_TYPE_END
5115 */
5116class DECL_EXP OCPN_downloadEvent : public wxEvent {
5117public:
5118 OCPN_downloadEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
5120
5121 // accessors
5122 _OCPN_DLStatus getDLEventStatus() { return m_stat; }
5123 OCPN_DLCondition getDLEventCondition() { return m_condition; }
5124
5125 void setDLEventStatus(_OCPN_DLStatus stat) { m_stat = stat; }
5126 void setDLEventCondition(OCPN_DLCondition cond) { m_condition = cond; }
5127
5128 void setTotal(long bytes) { m_totalBytes = bytes; }
5129 void setTransferred(long bytes) { m_sofarBytes = bytes; }
5130 long getTotal() { return m_totalBytes; }
5131 long getTransferred() { return m_sofarBytes; }
5132
5133 void setComplete(bool b_complete) { m_b_complete = b_complete; }
5134 bool getComplete() { return m_b_complete; }
5135
5136 // required for sending with wxPostEvent()
5137 wxEvent *Clone() const;
5138
5139private:
5140 OCPN_DLStatus m_stat;
5141 OCPN_DLCondition m_condition;
5142
5143 long m_totalBytes;
5144 long m_sofarBytes;
5145 bool m_b_complete;
5146};
5147
5148// extern WXDLLIMPEXP_CORE const wxEventType wxEVT_DOWNLOAD_EVENT;
5149
5150#ifdef MAKING_PLUGIN
5151extern DECL_IMP wxEventType wxEVT_DOWNLOAD_EVENT;
5152#else
5153extern DECL_EXP wxEventType wxEVT_DOWNLOAD_EVENT;
5154#endif
5155
5156/* API 1.14 */
5157/* API 1.14 adds some more common functions to avoid unnecessary code
5158 * duplication */
5159
5160extern DECL_EXP bool LaunchDefaultBrowser_Plugin(wxString url);
5161
5162// API 1.14 Extra canvas Support
5163
5179extern DECL_EXP void PlugInAISDrawGL(wxGLCanvas *glcanvas,
5180 const PlugIn_ViewPort &vp);
5181
5191extern DECL_EXP bool PlugInSetFontColor(const wxString TextElement,
5192 const wxColour color);
5193
5194// API 1.15
5195
5210extern DECL_EXP double PlugInGetDisplaySizeMM();
5211
5224extern DECL_EXP wxFont *FindOrCreateFont_PlugIn(
5225 int point_size, wxFontFamily family, wxFontStyle style, wxFontWeight weight,
5226 bool underline = false, const wxString &facename = wxEmptyString,
5227 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
5228
5248
5261
5275extern DECL_EXP void PlugInHandleAutopilotRoute(bool enable);
5276
5277// API 1.16
5278//
5293extern DECL_EXP wxString GetPluginDataDir(const char *plugin_name);
5294
5300extern DECL_EXP bool ShuttingDown(void);
5301
5302// Support for MUI MultiCanvas model
5303
5326extern DECL_EXP wxWindow *PluginGetFocusCanvas();
5327
5336extern DECL_EXP wxWindow *PluginGetOverlayRenderCanvas();
5337
5346extern "C" DECL_EXP void CanvasJumpToPosition(wxWindow *canvas, double lat,
5347 double lon, double scale);
5359extern "C" DECL_EXP int AddCanvasMenuItem(wxMenuItem *pitem,
5360 opencpn_plugin *pplugin,
5361 const char *name = "");
5370extern "C" DECL_EXP void RemoveCanvasMenuItem(int item, const char *name = "");
5371
5381extern "C" DECL_EXP void SetCanvasMenuItemViz(int item, bool viz,
5382 const char *name = "");
5383
5393extern "C" DECL_EXP void SetCanvasMenuItemGrey(int item, bool grey,
5394 const char *name = "");
5395
5396// Extract waypoints, routes and tracks
5402extern DECL_EXP wxString GetSelectedWaypointGUID_Plugin();
5403
5409extern DECL_EXP wxString GetSelectedRouteGUID_Plugin();
5410
5416extern DECL_EXP wxString GetSelectedTrackGUID_Plugin();
5417
5424extern DECL_EXP std::unique_ptr<PlugIn_Waypoint> GetWaypoint_Plugin(
5425 const wxString &);
5426
5433extern DECL_EXP std::unique_ptr<PlugIn_Route> GetRoute_Plugin(const wxString &);
5434
5441extern DECL_EXP std::unique_ptr<PlugIn_Track> GetTrack_Plugin(const wxString &);
5442
5448extern DECL_EXP wxWindow *GetCanvasUnderMouse();
5449
5463extern DECL_EXP int GetCanvasIndexUnderMouse();
5464
5465// extern DECL_EXP std::vector<wxWindow *> GetCanvasArray();
5478extern DECL_EXP wxWindow *GetCanvasByIndex(int canvasIndex);
5479
5490extern DECL_EXP int GetCanvasCount();
5491
5506extern DECL_EXP bool CheckMUIEdgePan_PlugIn(int x, int y, bool dragging,
5507 int margin, int delta,
5508 int canvasIndex);
5509
5518extern DECL_EXP void SetMUICursor_PlugIn(wxCursor *pCursor, int canvasIndex);
5519
5520// API 1.17
5521//
5522
5531extern DECL_EXP wxRect GetMasterToolbarRect();
5532
5552
5560extern DECL_EXP int GetLatLonFormat(void);
5561
5562// API 1.17
5563
5574extern "C" DECL_EXP void ZeroXTE();
5575
5599class DECL_EXP PlugIn_Waypoint_Ex {
5600public:
5602 PlugIn_Waypoint_Ex(double lat, double lon, const wxString &icon_ident,
5603 const wxString &wp_name, const wxString &GUID = "",
5604 const double ScaMin = 1e9, const bool bNameVisible = false,
5605 const int nRanges = 0, const double RangeDistance = 1.0,
5606 const wxColor RangeColor = wxColor(255, 0, 0));
5618 void InitDefaults();
5619
5631 bool GetFSStatus();
5632
5641 int GetRouteMembershipCount();
5642
5643 double m_lat;
5644 double m_lon;
5645 wxString m_GUID;
5646 wxString m_MarkName;
5648 wxDateTime m_CreateTime;
5651
5652 double scamin;
5655
5659
5660 wxString IconName;
5662
5668 Plugin_HyperlinkList *m_HyperlinkList;
5669};
5670
5671WX_DECLARE_LIST(PlugIn_Waypoint_Ex, Plugin_WaypointExList);
5672
5673class DECL_EXP PlugIn_Waypoint_ExV2 {
5674public:
5676 PlugIn_Waypoint_ExV2(double lat, double lon, const wxString &icon_ident,
5677 const wxString &wp_name, const wxString &GUID = "",
5678 const double ScaMin = 1e9, const double ScaMax = 1e6,
5679 const bool bNameVisible = false,
5680 const int nRangeRings = 0,
5681 const double RangeDistance = 1.0,
5682 const int RangeRingSpaceUnits = 0, // 0:nm, 1:km
5683 const wxColor RangeColor = wxColor(255, 0, 0),
5684 const double WaypointArrivalRadius = 0.0,
5685 const bool ShowWaypointRangeRings = false,
5686 const double PlannedSpeed = 0.0,
5687 const wxString TideStation = wxEmptyString);
5688
5689 virtual ~PlugIn_Waypoint_ExV2();
5690
5702 bool GetFSStatus();
5703
5712 int GetRouteMembershipCount();
5713
5714 double m_lat;
5715 double m_lon;
5716 wxString m_GUID;
5717 wxString m_MarkName;
5719 wxDateTime m_CreateTime;
5722
5723 double scamin;
5726
5731
5732 wxString IconName;
5734
5740 Plugin_HyperlinkList *m_HyperlinkList;
5741
5742 // New fields that are not in PlugIn_Waypoint_Ex
5743 double scamax;
5748 wxDateTime m_ETD;
5751
5752protected:
5763 void InitDefaults();
5764};
5765
5766WX_DECLARE_LIST(PlugIn_Waypoint_ExV2, Plugin_WaypointExV2List);
5767
5790class DECL_EXP PlugIn_Route_Ex {
5791public:
5792 PlugIn_Route_Ex(void);
5793 ~PlugIn_Route_Ex(void);
5794
5795 wxString m_NameString;
5796 wxString m_StartString;
5797 wxString m_EndString;
5798 wxString m_GUID;
5801 wxString m_Description;
5802
5808 Plugin_WaypointExList *pWaypointList;
5809};
5810
5825class DECL_EXP PlugIn_Route_ExV2 {
5826public:
5828 virtual ~PlugIn_Route_ExV2();
5829
5830 wxString m_NameString;
5831 wxString m_StartString;
5832 wxString m_EndString;
5833 wxString m_GUID;
5836 wxString m_Description;
5837
5843 Plugin_WaypointExV2List *pWaypointList;
5844};
5845
5853extern DECL_EXP wxArrayString GetRouteGUIDArray(void);
5854
5862extern DECL_EXP wxArrayString GetTrackGUIDArray(void);
5863
5871extern DECL_EXP bool GetSingleWaypointEx(wxString GUID,
5872 PlugIn_Waypoint_Ex *pwaypoint);
5873
5881extern DECL_EXP bool GetSingleWaypointExV2(wxString GUID,
5882 PlugIn_Waypoint_ExV2 *pwaypoint);
5883
5891extern DECL_EXP bool AddSingleWaypointEx(PlugIn_Waypoint_Ex *pwaypoint,
5892 bool b_permanent = true);
5893
5901extern DECL_EXP bool AddSingleWaypointExV2(PlugIn_Waypoint_ExV2 *pwaypoint,
5902 bool b_permanent = true);
5903
5910extern DECL_EXP bool UpdateSingleWaypointEx(PlugIn_Waypoint_Ex *pwaypoint);
5911
5918extern DECL_EXP bool UpdateSingleWaypointExV2(PlugIn_Waypoint_ExV2 *pwaypoint);
5919
5927extern DECL_EXP bool AddPlugInRouteEx(PlugIn_Route_Ex *proute,
5928 bool b_permanent = true);
5929
5936extern DECL_EXP bool AddPlugInRouteExV2(PlugIn_Route_ExV2 *proute,
5937 bool b_permanent = true);
5938
5945extern DECL_EXP bool UpdatePlugInRouteEx(PlugIn_Route_Ex *proute);
5946
5955extern DECL_EXP bool UpdatePlugInRouteExV2(PlugIn_Route_ExV2 *proute);
5956
5965extern DECL_EXP std::unique_ptr<PlugIn_Waypoint_Ex> GetWaypointEx_Plugin(
5966 const wxString &GUID);
5967
5976extern DECL_EXP std::unique_ptr<PlugIn_Waypoint_ExV2> GetWaypointExV2_Plugin(
5977 const wxString &GUID);
5978
5987extern DECL_EXP std::unique_ptr<PlugIn_Route_Ex> GetRouteEx_Plugin(
5988 const wxString &GUID);
5989
5998extern DECL_EXP std::unique_ptr<PlugIn_Route_ExV2> GetRouteExV2_Plugin(
5999 const wxString &GUID);
6000
6006extern DECL_EXP wxString GetActiveWaypointGUID(void);
6007
6013extern DECL_EXP wxString GetActiveRouteGUID(void);
6014
6015// API 1.18
6016
6031extern DECL_EXP double OCPN_GetDisplayContentScaleFactor();
6032
6047extern DECL_EXP double OCPN_GetWinDIPScaleFactor();
6048
6056extern DECL_EXP std::vector<std::string> GetPriorityMaps();
6057
6062extern DECL_EXP void UpdateAndApplyPriorityMaps(std::vector<std::string> map);
6063
6071extern DECL_EXP std::vector<std::string> GetActivePriorityIdentifiers();
6072
6080extern DECL_EXP int GetGlobalWatchdogTimoutSeconds();
6081
6093
6094// FIXME (dave) Implement these
6111extern DECL_EXP wxArrayString GetRouteGUIDArray(OBJECT_LAYER_REQ req);
6112
6128extern DECL_EXP wxArrayString GetTrackGUIDArray(OBJECT_LAYER_REQ req);
6129
6147extern DECL_EXP wxArrayString GetWaypointGUIDArray(OBJECT_LAYER_REQ req);
6148
6151/* Listening to messages. */
6152class ObservableListener;
6153
6155class ObservedEvt;
6156
6157// This is a verbatim copy from observable_evt.h, don't define twice.
6158#ifndef OBSERVABLE_EVT_H
6159#define OBSERVABLE_EVT_H
6160
6161wxDECLARE_EVENT(obsNOTIFY, ObservedEvt);
6162
6177class ObservedEvt : public wxCommandEvent {
6178public:
6185 ObservedEvt(wxEventType commandType = obsNOTIFY, int id = 0)
6186 : wxCommandEvent(commandType, id) {}
6187 ObservedEvt(const ObservedEvt &event) : wxCommandEvent(event) {
6188 this->m_shared_ptr = event.m_shared_ptr;
6189 }
6190
6198 wxEvent *Clone() const { return new ObservedEvt(*this); }
6199
6205 std::shared_ptr<const void> GetSharedPtr() const { return m_shared_ptr; }
6206
6212 void SetSharedPtr(std::shared_ptr<const void> p) { m_shared_ptr = p; }
6213
6214private:
6215 std::shared_ptr<const void> m_shared_ptr;
6216};
6217
6218#endif // OBSERVABLE_EVT_H
6219
6220class ObservableListener;
6221
6229 const uint64_t id;
6234 NMEA2000Id(int value) : id(static_cast<uint64_t>(value)) {};
6235};
6236
6247extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
6248 NMEA2000Id id, wxEventType ev, wxEvtHandler *handler);
6249
6257 const std::string id;
6262 NMEA0183Id(const std::string &s) : id(s) {};
6263};
6264
6275extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
6276 NMEA0183Id id, wxEventType ev, wxEvtHandler *handler);
6277
6285 const std::string id;
6290 SignalkId(const std::string &s) : id(s) {};
6291};
6292
6303extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
6304 SignalkId id, wxEventType ev, wxEvtHandler *handler);
6305
6321extern DECL_EXP std::vector<uint8_t> GetN2000Payload(NMEA2000Id id,
6322 ObservedEvt ev);
6323
6340extern DECL_EXP std::shared_ptr<void> GetSignalkPayload(ObservedEvt ev);
6341
6346extern DECL_EXP std::string GetN2000Source(NMEA2000Id id, ObservedEvt ev);
6347
6349extern DECL_EXP std::string GetN0183Payload(NMEA0183Id id, ObservedEvt ev);
6350
6358 const int type;
6363 NavDataId() : type(0) {}
6364};
6365
6377extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
6378 NavDataId id, wxEventType ev, wxEvtHandler *handler);
6379
6387 double lat;
6388 double lon;
6389 double sog;
6390 double cog;
6391 double var;
6392 double hdt;
6393 time_t time;
6394};
6395
6397extern DECL_EXP PluginNavdata GetEventNavdata(ObservedEvt ev);
6398
6400/*
6401 * Plugins may access comm ports for direct output.
6402 * The general program flow for a plugin may look something like this
6403 * pseudo-code:
6404 * 1. Plugin will query OCPN core for a list of active comm drivers.
6405 * 2. Plugin will inspect the list, and query OCPN core for driver
6406 * attributes.
6407 * 3. Plugin will select a comm driver with appropriate attributes for output.
6408 * 4. Plugin will register a list of PGNs expected to be transmitted
6409 * (N2K specific)
6410 * 5. Plugin may then send a payload buffer to a specific comm driver for
6411 * output as soon as possible.
6412 *
6413 * The mechanism for specifying a particular comm driver uses the notion of
6414 * "handles". Each active comm driver has an associated opaque handle, managed
6415 * by OCPN core. All references by a plugin to a driver are by means of its
6416 * handle. Handles should be considered to be "opaque", meaning that the exact
6417 * contents of the handle are of no specific value to the plugin, and only
6418 * have meaning to the OCPN core management of drivers.
6419 */
6420
6422typedef std::string DriverHandle;
6423
6446
6448extern DECL_EXP std::vector<DriverHandle> GetActiveDrivers();
6449
6464extern DECL_EXP const std::unordered_map<std::string, std::string>
6466
6467/* Writing to a specific driver */
6487extern DECL_EXP CommDriverResult WriteCommDriver(
6488 DriverHandle handle, const std::shared_ptr<std::vector<uint8_t>> &payload);
6489
6491extern DECL_EXP CommDriverResult WriteCommDriverN2K(
6492 DriverHandle handle, int PGN, int destinationCANAddress, int priority,
6493 const std::shared_ptr<std::vector<uint8_t>> &payload);
6494
6537extern DECL_EXP CommDriverResult RegisterTXPGNs(DriverHandle handle,
6538 std::vector<int> &pgn_list);
6539
6540// API 1.20
6541//
6542
6579
6582 const std::string id;
6583 PluginMsgId(const std::string &s) : id(s) {};
6584};
6585
6590extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
6591 PluginMsgId id, wxEventType ev, wxEvtHandler *handler);
6592
6597extern DECL_EXP std::string GetPluginMsgPayload(PluginMsgId id, ObservedEvt ev);
6598
6604extern DECL_EXP void ExitOCPN();
6605
6614extern "C" DECL_EXP void RequestWindowRefresh(wxWindow *win,
6615 bool eraseBackground);
6616
6622extern DECL_EXP bool GetFullScreen();
6623
6629extern DECL_EXP void SetFullScreen(bool full_screen_on);
6630
6636extern DECL_EXP void EnableTouchMode(bool enable);
6637
6643extern DECL_EXP bool GetTouchMode();
6644
6652extern DECL_EXP void SetGlobalColor(std::string table, std::string name,
6653 wxColor color);
6654
6662extern DECL_EXP wxColor GetGlobalColorD(std::string map_name, std::string name);
6663
6669extern DECL_EXP void EnableStatusBar(bool enable);
6670
6676extern DECL_EXP void EnableMenu(bool enable);
6677
6683extern DECL_EXP bool GetEnableStatusBar();
6684
6690extern DECL_EXP bool GetEnableMenu();
6691
6701extern DECL_EXP void SetNavigationMode(PI_NavMode mode, int CanvasIndex);
6702
6709extern DECL_EXP PI_NavMode GetNavigationMode(int CanvasIndex);
6710
6718extern DECL_EXP void EnableLookaheadMode(bool enable, int CanvasIndex);
6719
6726extern DECL_EXP bool GetEnableLookaheadMode(int CanvasIndex);
6727
6734extern DECL_EXP void EnableMUIBar(bool enable, int CanvasIndex);
6735
6742extern DECL_EXP void EnableCompassGPSIcon(bool enable, int CanvasIndex);
6743
6750extern DECL_EXP void EnableChartBar(bool enable, int CanvasIndex);
6751
6758extern DECL_EXP bool GetEnableMUIBar(int CanvasIndex);
6759
6766extern DECL_EXP bool GetEnableCompassGPSIcon(int CanvasIndex);
6767
6774extern DECL_EXP bool GetEnableChartBar(int CanvasIndex);
6775
6783extern DECL_EXP void EnableCanvasFocusBar(bool enable, int CanvasIndex);
6784
6791extern DECL_EXP bool GetEnableCanvasFocusBar(int CanvasIndex);
6792
6793/*
6794 * Allow plugin control of "Chart Panel Options" dialog
6795 */
6796
6803extern DECL_EXP void EnableLatLonGrid(bool enable, int CanvasIndex);
6804
6811extern DECL_EXP void EnableChartOutlines(bool enable, int CanvasIndex);
6812
6819extern DECL_EXP void EnableDepthUnitDisplay(bool enable, int CanvasIndex);
6820
6827extern DECL_EXP void EnableAisTargetDisplay(bool enable, int CanvasIndex);
6828
6835extern DECL_EXP void EnableTideStationsDisplay(bool enable, int CanvasIndex);
6836
6843extern DECL_EXP void EnableCurrentStationsDisplay(bool enable, int CanvasIndex);
6844
6851extern DECL_EXP void EnableENCTextDisplay(bool enable, int CanvasIndex);
6852
6859extern DECL_EXP void EnableENCDepthSoundingsDisplay(bool enable,
6860 int CanvasIndex);
6861
6868extern DECL_EXP void EnableBuoyLightLabelsDisplay(bool enable, int CanvasIndex);
6869
6876extern DECL_EXP void EnableLightsDisplay(bool enable, int CanvasIndex);
6877
6884extern DECL_EXP void EnableLightDescriptionsDisplay(bool enable,
6885 int CanvasIndex);
6886
6893extern DECL_EXP void SetENCDisplayCategory(PI_DisCat cat, int CanvasIndex);
6894
6901extern DECL_EXP bool GetEnableLatLonGrid(int CanvasIndex);
6902
6909extern DECL_EXP bool GetEnableChartOutlines(int CanvasIndex);
6910
6917extern DECL_EXP bool GetEnableDepthUnitDisplay(int CanvasIndex);
6918
6925extern DECL_EXP bool GetEnableAisTargetDisplay(int CanvasIndex);
6926
6933extern DECL_EXP bool GetEnableTideStationsDisplay(int CanvasIndex);
6934
6941extern DECL_EXP bool GetEnableCurrentStationsDisplay(int CanvasIndex);
6942
6949extern DECL_EXP bool GetEnableENCTextDisplay(int CanvasIndex);
6950
6957extern DECL_EXP bool GetEnableENCDepthSoundingsDisplay(int CanvasIndex);
6958
6965extern DECL_EXP bool GetEnableBuoyLightLabelsDisplay(int CanvasIndex);
6966
6973extern DECL_EXP bool GetEnableLightsDisplay(int CanvasIndex);
6974
6981extern DECL_EXP bool GetEnableLightDescriptionsDisplay(int CanvasIndex);
6982
6993extern DECL_EXP PI_DisCat GetENCDisplayCategory(int CanvasIndex);
6994
7003extern DECL_EXP void PluginSetFollowMode(int CanvasIndex, bool enable_follow);
7004
7011extern DECL_EXP bool PluginGetFollowMode(int CanvasIndex);
7012
7020extern DECL_EXP void SetTrackingMode(bool enable);
7021
7027extern DECL_EXP bool GetTrackingMode();
7028
7036extern DECL_EXP void SetAppColorScheme(PI_ColorScheme cs);
7037
7043extern DECL_EXP PI_ColorScheme GetAppColorScheme();
7044
7053extern DECL_EXP void EnableSplitScreenLayout(bool enable = true);
7054
7055// ChartCanvas control utilities
7056
7064extern DECL_EXP void PluginZoomCanvas(int CanvasIndex, double factor);
7065
7071extern DECL_EXP bool GetEnableMainToolbar();
7072
7078extern DECL_EXP void SetEnableMainToolbar(bool enable);
7079
7084extern DECL_EXP void ShowGlobalSettingsDialog();
7085
7091extern DECL_EXP void PluginCenterOwnship(int CanvasIndex);
7092
7100extern DECL_EXP bool GetEnableTenHertzUpdate();
7101
7108extern DECL_EXP void EnableTenHertzUpdate(bool enable);
7109
7115extern DECL_EXP void ConfigFlushAndReload();
7116
7117/*
7118 * Reload and restore all connections by direct read of config file
7119 */
7120extern DECL_EXP void ReloadConfigConnections();
7121
7125enum class PI_NotificationSeverity : int {
7126 PI_kInformational = 0,
7127 PI_kWarning = 1,
7128 PI_kCritical = 2
7129};
7130
7132public:
7134 const std::string &_message, int _timeout_start,
7135 int _timeout_left, std::string _guid);
7136 virtual ~PI_Notification() {};
7137
7138 PI_NotificationSeverity severity;
7139 std::string message;
7140 int auto_timeout_left;
7141 int auto_timeout_start;
7142 std::string guid;
7143 std::string action_verb; // Either "ACK" or "POST", when set by a
7144 // PI_Notification message payload.
7145 // Empty otherwise
7146};
7147
7148extern DECL_EXP int GetActiveNotificationCount();
7149extern DECL_EXP PI_NotificationSeverity GetMaxActiveNotificationLevel();
7150extern DECL_EXP std::string RaiseNotification(
7151 const PI_NotificationSeverity _severity, const std::string &_message,
7152 int timeout_secs = -1);
7153extern DECL_EXP bool AcknowledgeNotification(const std::string &guid);
7154extern DECL_EXP std::vector<std::shared_ptr<PI_Notification>>
7155GetActiveNotifications();
7156extern DECL_EXP void EnableNotificationCanvasIcon(bool enable);
7157
7158/*
7159 * Messaging interface for Notification Framework
7160 *
7161 */
7162
7163/*
7164 * Typical use pattern
7165 *
7166 * 1) Establish listener
7167 wxDEFINE_EVENT(EVT_NOTIFICATION_FRAME, ObservedEvt);
7168 static std::shared_ptr<ObservableListener> listener_note;
7169 NotificationMsgId note_id = NotificationMsgId();
7170 listener_note = GetListener(note_id, EVT_NOTIFICATION_FRAME, this);
7171 Bind(EVT_NOTIFICATION_FRAME, [&](ObservedEvt ev) { HandleNotification(ev); });
7172 *
7173 *
7174 *
7175 * 2) Define actions on receipt
7176 static void HandleNotification(ObservedEvt &ev) {
7177 NotificationMsgId id;
7178 std::shared_ptr<PI_Notification>payload=GetNotificationMsgPayload(id, ev);
7179 if (payload->action_verb == "ACK"){
7180 // Do Acknowledge notification actions
7181 }
7182 else if (payload->action_verb == "POST") {
7183 // Do Add Notification actions
7184 }
7185 }
7186
7187*/
7190 const std::string id;
7191 NotificationMsgId(const std::string &s) : id(s) {};
7192 NotificationMsgId() {};
7193};
7194
7199extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
7200 NotificationMsgId id, wxEventType ev, wxEvtHandler *handler);
7201
7205extern DECL_EXP std::shared_ptr<PI_Notification> GetNotificationMsgPayload(
7207
7208// * Plugin polled Comm Status support
7209enum class PI_Conn_Bus : int { N0183 = 0, Signalk = 1, N2000 = 2 };
7210
7211enum class PI_Comm_State : int {
7212 Disabled = 0,
7213 NoStats = 1,
7214 NoData = 2,
7215 Unavailable = 3,
7216 Ok = 4
7217};
7218
7220public:
7221 PI_Comm_State state;
7222 unsigned rx_count;
7223 unsigned tx_count;
7224 unsigned error_count;
7225};
7226
7227extern DECL_EXP PI_Comm_Status GetConnState(const std::string &iface,
7228 PI_Conn_Bus _bus);
7229
7230extern "C" DECL_EXP int AddCanvasContextMenuItemExt(
7231 wxMenuItem *pitem, opencpn_plugin *pplugin, const std::string object_type);
7232
7234class HostApi {
7235public:
7236 virtual ~HostApi() = default;
7237};
7238
7243extern DECL_EXP std::unique_ptr<HostApi> GetHostApi();
7244
7254class HostApi121 : public HostApi {
7255public:
7256 HostApi121()
7257 : HostApi(),
7258 kContextMenuDisableWaypoint(1),
7259 kContextMenuDisableRoute(2),
7260 kContextMenuDisableTrack(4),
7261 kContextMenuDisableAistarget(8) {}
7262
7263 ~HostApi121() override = default;
7264
7265 const int kContextMenuDisableWaypoint;
7266 const int kContextMenuDisableRoute;
7267 const int kContextMenuDisableTrack;
7268 const int kContextMenuDisableAistarget;
7269
7270 enum class PiContextObjectType {
7271 kObjectChart = 0,
7272 kObjectRoutepoint,
7273 kObjectRoutesegment,
7274 kObjectTracksegment,
7275 kObjectAisTarget,
7276 kObjectUnknown
7277 };
7278
7280 PiContextObjectType object_type;
7281 std::string object_ident;
7282 };
7283
7284 // Extended plugin route
7285 class Route : public PlugIn_Route_ExV2 {
7286 public:
7287 Route()
7288 : m_PlannedSpeed(0),
7289 m_Colour(""),
7290 m_style(wxPENSTYLE_SOLID),
7291 m_PlannedDeparture(wxDateTime::Now()),
7292 m_TimeDisplayFormat("UTC") {}
7293
7294 ~Route() override {
7295 if (pWaypointList) {
7296 pWaypointList->DeleteContents(true);
7297 delete pWaypointList;
7298 pWaypointList = NULL;
7299 }
7300 }
7301
7302 double m_PlannedSpeed;
7303 wxString m_Colour;
7304 wxPenStyle m_style;
7305 wxDateTime m_PlannedDeparture;
7306 wxString m_TimeDisplayFormat;
7307 };
7308
7309 virtual wxString DropMarkPI(double lat, double lon);
7310 virtual wxString RouteCreatePI(int canvas_index, bool start);
7311 virtual wxString NavToHerePI(double lat, double lon);
7312 virtual bool ActivateRoutePI(wxString route_guid, bool activate);
7313
7314 virtual void EnableDefaultConsole(bool enable);
7315 virtual void EnableDefaultContextMenus(bool enable);
7316
7317 virtual void SetMinZoomScale(double min_scale);
7318 virtual void SetMaxZoomScale(double max_scale);
7319
7320 virtual wxBitmap GetObjectIcon_PlugIn(const wxString &name);
7321
7322 virtual void SetDepthUnitVisible(bool bviz);
7323 virtual void SetOverzoomFlagVisible(bool bviz);
7324
7325 virtual bool IsRouteActive(wxString route_guid);
7326 virtual void SetBoatPosition(double zlat, double zlon);
7327
7328 virtual void RouteInsertWaypoint(int canvas_index, wxString route_guid,
7329 double zlat, double zlon);
7330 virtual void RouteAppendWaypoint(int canvas_index, wxString route_guid);
7331 virtual void FinishRoute(int canvas_index);
7332 virtual bool IsRouteBeingCreated(int canvas_index);
7333 virtual bool AreRouteWaypointNamesVisible(wxString route_guid);
7334 virtual void ShowRouteWaypointNames(wxString route_guid, bool show);
7335 virtual void NavigateToWaypoint(wxString waypoint_guid);
7336 virtual bool DoMeasurePI(int canvas_index, bool start);
7337 virtual bool IsMeasureActive(int canvas_index);
7338 virtual void CancelMeasure(int canvas_index);
7339
7340 // AIS related
7341 // for Show/Hide Target Track
7342 virtual bool IsAISTrackVisible(const wxString &ais_mmsi) const;
7343 // for Show/Hide Target Track
7344 virtual void AISToggleShowTrack(const wxString &ais_mmsi);
7345 // for Show/Hide Target CPA
7346 virtual bool IsAIS_CPAVisible(const wxString &ais_mmsi) const;
7347 // for Show/Hide Target CPA
7348 virtual void AISToggleShowCPA(const wxString &ais_mmsi);
7349 // for Target Query
7350 virtual void ShowAISTargetQueryDialog(int canvas_index,
7351 const wxString &ais_mmsi);
7352 // for Target List
7353 virtual void ShowAISTargetList(int canvas_index);
7354 virtual std::shared_ptr<PiPointContext> GetContextAtPoint(int x, int y,
7355 int canvas_index);
7356
7357 // Extended Chart table management support
7358 virtual void AddNoShowDirectory(std::string chart_dir);
7359 virtual void RemoveNoShowDirectory(std::string chart_dir);
7360 virtual void ClearNoShowVector();
7361 virtual const std::vector<std::string> &GetNoShowVector();
7362 virtual bool SelectChartFamily(int CanvasIndex, ChartFamilyEnumPI Family);
7363
7364 // Enhanced AIS Target List support
7365 virtual void CenterToAisTarget(wxString ais_mmsi);
7366 virtual void AisTargetCreateWpt(wxString ais_mmsi);
7367 virtual void AisShowAllTracks(bool show);
7368 virtual void AisToggleTrack(wxString ais_mmsi);
7369
7370 virtual int GetContextMenuMask();
7371 virtual void SetContextMenuMask(int mask);
7372
7373 // Enhanced Track support
7374 virtual void SetTrackVisibiiity(const wxString &track_GUID, bool viz);
7375
7376 // Extended plugin route, V3
7378 virtual bool AddRoute(Route *route, bool permanent = true);
7379
7381 virtual bool UpdateRoute(Route *route);
7382
7384 virtual std::unique_ptr<HostApi121::Route> GetRoute(const wxString &guid);
7385
7386 // Enhanced Tide query support.
7387 virtual bool GetNearestTideStation(double lat, double lon,
7388 PlugIn_TideStation *station);
7389 virtual bool GetTideHeight(int stationIndex, time_t time, float *height);
7390};
7391
7392class Api122Impl; // forward
7393
7395class HostApi122 : public HostApi121 {
7396public:
7397 HostApi122(Api122Impl *support) : m_api_impl(support) {}
7398
7400 enum class EventType {
7401 kNewMessageType = 1 // A new message type is detected
7402 };
7403
7412 void RegisterApiEventCallback(const std::string &plugin_name,
7413 std::function<void(EventType what)> callback);
7414
7422 const std::set<std::string> &GetActiveMessages();
7423
7424private:
7425 Api122Impl *m_api_impl; // Raw ptr to app object managed by wxWidgets
7426};
7427
7430public:
7431 virtual void RegisterApiEventCallback(
7432 const std::string &, std::function<void(HostApi122::EventType what)>) = 0;
7433};
7434
7435#endif //_PLUGIN_H_
Locked down interface published in 5.14.1.
virtual bool AddRoute(Route *route, bool permanent=true)
Add route to database, updated version of AddPlugInRouteExV2.
Definition api_121.cpp:871
virtual std::unique_ptr< HostApi121::Route > GetRoute(const wxString &guid)
Retrieve route from database.
Definition api_121.cpp:879
virtual bool UpdateRoute(Route *route)
Update database route, updated version of UpdatePlugInRouteExV2.
Definition api_121.cpp:875
Unstable development API.
const std::set< std::string > & GetActiveMessages()
Return currently known messages types flowing through system.
void RegisterApiEventCallback(const std::string &plugin_name, std::function< void(EventType what)> callback)
Register a new callback invoked when an EventType event occurs.
Definition api_122.cpp:36
EventType
Reported events bitmask.
Empty, virtual base class for HostApi versions.
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 std::unique_ptr< HostApi > GetHostApi()
HostApi factory,.
Definition api_122.cpp:30
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.