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 <wx/xml/xml.h>
47#include <wx/dcmemory.h>
48#include <wx/dialog.h>
49#include <wx/event.h>
50#include <wx/menuitem.h>
51#include <wx/gdicmn.h>
52
53#ifdef ocpnUSE_SVG
54#include <wx/bitmap.h>
55#endif // ocpnUSE_SVG
56
57#include <cstdint>
58#include <memory>
59#include <vector>
60#include <unordered_map>
61
62class wxGLContext;
63
64// This is the most modern API Version number
65// It is expected that the API will remain downward compatible, meaning that
66// PlugIns conforming to API Version less than the most modern will also
67// be correctly supported.
68#define API_VERSION_MAJOR 1
69#define API_VERSION_MINOR 21
70
71// Fwd Definitions
72class wxFileConfig;
73class wxNotebook;
74class wxFont;
75class wxAuiManager;
76class wxScrolledWindow;
77class wxGLCanvas;
78
79//---------------------------------------------------------------------------------------------------------
80//
81// Bitfield PlugIn Capabilities flag definition
82//
83//---------------------------------------------------------------------------------------------------------
87#define WANTS_OVERLAY_CALLBACK 0x00000001
91#define WANTS_CURSOR_LATLON 0x00000002
101#define WANTS_TOOLBAR_CALLBACK 0x00000004
107#define INSTALLS_TOOLBAR_TOOL 0x00000008
110#define WANTS_CONFIG 0x00000010
113#define INSTALLS_TOOLBOX_PAGE 0x00000020
116#define INSTALLS_CONTEXTMENU_ITEMS 0x00000040
119#define WANTS_NMEA_SENTENCES 0x00000080
123#define WANTS_NMEA_EVENTS 0x00000100
126#define WANTS_AIS_SENTENCES 0x00000200
129#define USES_AUI_MANAGER 0x00000400
132#define WANTS_PREFERENCES 0x00000800
135#define INSTALLS_PLUGIN_CHART 0x00001000
138#define WANTS_ONPAINT_VIEWPORT 0x00002000
141#define WANTS_PLUGIN_MESSAGING 0x00004000
142#define WANTS_OPENGL_OVERLAY_CALLBACK 0x00008000
143#define WANTS_DYNAMIC_OPENGL_OVERLAY_CALLBACK 0x00010000
146#define WANTS_LATE_INIT 0x00020000
149#define INSTALLS_PLUGIN_CHART_GL 0x00040000
152#define WANTS_MOUSE_EVENTS 0x00080000
155#define WANTS_VECTOR_CHART_OBJECT_INFO 0x00100000
158#define WANTS_KEYBOARD_EVENTS 0x00200000
161#define WANTS_PRESHUTDOWN_HOOK 0x00400000
162
184#define OVERLAY_LEGACY 0
185
194#define OVERLAY_OVER_SHIPS 64
195
204#define OVERLAY_OVER_EMBOSS 96
205
215#define OVERLAY_OVER_UI 128
216
220#define OVERLAY_CHARTS 256
221
222//----------------------------------------------------------------------------------------------------------
223// Some PlugIn API interface object class definitions
224//----------------------------------------------------------------------------------------------------------
244
249public:
250 double clat;
251 double clon;
253 double skew;
254 double rotation;
255
257
260 wxRect rv_rect;
261 bool b_quilt;
264
265 double lat_min;
266 double lat_max;
267 double lon_min;
268 double lon_max;
269
270 bool
272};
273
278public:
279 double Lat;
280 double Lon;
281 double Cog;
282 double Sog;
283 double Var;
284 time_t FixTime;
285 int nSats;
286};
298public:
305 double Lat;
306
313 double Lon;
314
318 double Cog;
319
324 double Sog;
325
327 double Var;
328
333 double Hdm;
334
340 double Hdt;
341
347 time_t FixTime;
348
355 int nSats;
356};
357
362public:
363 double Xte;
365 double Btw;
366 double Dtw;
367 wxString wp_name;
368 bool arrival;
370};
371
380
385public:
386 int MMSI;
387 int Class;
389 double SOG;
390 double COG;
391 double HDG;
392 double Lon;
393 double Lat;
394 int ROTAIS;
395 char CallSign[8];
396 char ShipName[21];
397 unsigned char ShipType;
398 int IMO;
399
400 double Range_NM;
401 double Brg;
402
403 // Per target collision parameters
405 double TCPA;
406 double CPA;
407
409};
410
425
435
445
468
472typedef struct _ExtentPI {
473 double SLAT;
474 double WLON;
475 double NLAT;
476 double ELON;
478
479// PlugInChartBase::Init() init_flags constants
482#define PI_FULL_INIT 0
485#define PI_HEADER_ONLY 1
487#define PI_THUMB_ONLY 2
488
502class DECL_EXP PlugInChartBase : public wxObject {
503public:
504 // These methods Must be overriden in any derived class
506 virtual ~PlugInChartBase();
507
528 virtual wxString GetFileSearchMask(void);
529
554 virtual int Init(const wxString &full_path, int init_flags);
555
575 virtual void SetColorScheme(int cs, bool bApplyImmediate);
576
597 virtual double GetNormalScaleMin(double canvas_scale_factor,
598 bool b_allow_overzoom);
616 virtual double GetNormalScaleMax(double canvas_scale_factor,
617 int canvas_width);
632 virtual double GetNearestPreferredScalePPM(double target_scale_ppm);
633
651 virtual bool GetChartExtent(ExtentPI *pext);
652
679 virtual wxBitmap &RenderRegionView(const PlugIn_ViewPort &VPoint,
680 const wxRegion &Region);
681
696 virtual bool AdjustVP(PlugIn_ViewPort &vp_last, PlugIn_ViewPort &vp_proposed);
697
713 virtual void GetValidCanvasRegion(const PlugIn_ViewPort &VPoint,
714 wxRegion *pValidRegion);
715
733 virtual int GetCOVREntries() { return 0; }
734
750 virtual int GetCOVRTablePoints(int iTable) { return 0; }
751
765 virtual int GetCOVRTablenPoints(int iTable) { return 0; }
766
787 virtual float *GetCOVRTableHead(int iTable) { return (float *)NULL; }
788
811 virtual wxBitmap *GetThumbnail(int tnx, int tny, int cs);
812
813 // Accessors, need not be overridden in derived class if the member
814 // variables are maintained
815
829 virtual wxString GetFullPath() const { return m_FullPath; }
830
852 virtual ChartTypeEnumPI GetChartType() { return m_ChartType; }
853
867 virtual ChartFamilyEnumPI GetChartFamily() { return m_ChartFamily; }
868
888 virtual OcpnProjTypePI GetChartProjection() { return m_projection; }
889
902 virtual wxString GetName() { return m_Name; }
903
914 virtual wxString GetDescription() { return m_Description; }
915
927 virtual wxString GetID() { return m_ID; }
928
942 virtual wxString GetSE() { return m_SE; }
943
959 virtual wxString GetDepthUnits() { return m_DepthUnits; }
960
977 virtual wxString GetSoundingsDatum() { return m_SoundingsDatum; }
978
994 virtual wxString GetDatumString() { return m_datum_str; }
995
1009 virtual wxString GetExtraInfo() { return m_ExtraInfo; }
1010
1023 virtual wxString GetPubDate() { return m_PubYear; }
1024
1038 virtual double GetChartErrorFactor() { return m_Chart_Error_Factor; }
1039
1055 virtual ChartDepthUnitTypePI GetDepthUnitId() { return m_depth_unit_id; }
1056
1071 virtual bool IsReadyToRender() { return m_bReadyToRender; }
1072
1085 virtual int GetNativeScale() { return m_Chart_Scale; };
1086
1099 virtual double GetChartSkew() { return m_Chart_Skew; }
1100
1113 virtual wxDateTime GetEditionDate(void) { return m_EdDate; }
1114
1115 // Methods pertaining to CHART_FAMILY_RASTER type PlugIn charts only
1116
1135 virtual void ComputeSourceRectangle(const PlugIn_ViewPort &vp,
1136 wxRect *pSourceRect);
1137
1152 virtual double GetRasterScaleFactor();
1153
1174 virtual bool GetChartBits(wxRect &source, unsigned char *pPix, int sub_samp);
1175
1187 virtual int GetSize_X();
1188
1200 virtual int GetSize_Y();
1201
1216 virtual void latlong_to_chartpix(double lat, double lon, double &pixx,
1217 double &pixy);
1218
1233 virtual void chartpix_to_latlong(double pixx, double pixy, double *plat,
1234 double *plon);
1235
1236protected:
1237 ChartTypeEnumPI m_ChartType;
1238 ChartFamilyEnumPI m_ChartFamily;
1239
1240 wxString m_FullPath;
1241 OcpnProjTypePI m_projection;
1242 int m_Chart_Scale;
1243 double m_Chart_Skew;
1244
1245 wxDateTime m_EdDate;
1246 bool m_bReadyToRender;
1247
1248 wxString m_Name;
1249 wxString m_Description;
1250 wxString m_ID;
1251 wxString m_SE;
1252 wxString m_SoundingsDatum;
1253 wxString m_datum_str;
1254 wxString m_PubYear;
1255 wxString m_DepthUnits;
1256 wxString m_ExtraInfo;
1257
1258 ChartDepthUnitTypePI m_depth_unit_id;
1259
1260 double m_Chart_Error_Factor;
1261};
1262
1263// Declare an array of PlugIn_AIS_Targets
1264WX_DEFINE_ARRAY_PTR(PlugIn_AIS_Target *, ArrayOfPlugIn_AIS_Targets);
1265
1280class DECL_EXP opencpn_plugin {
1281public:
1282 opencpn_plugin(void *pmgr) {}
1283 virtual ~opencpn_plugin();
1284
1285 // Public API to the PlugIn class
1286
1287 // This group of methods is required, and will be called by the opencpn
1288 // host opencpn PlugIns must implement this group
1289
1304 virtual int Init(void);
1305
1315 virtual bool DeInit(void);
1316
1329 virtual int GetAPIVersionMajor();
1330
1343 virtual int GetAPIVersionMinor();
1344
1356 virtual int GetPlugInVersionMajor();
1357
1369 virtual int GetPlugInVersionMinor();
1370
1383 virtual wxBitmap *GetPlugInBitmap();
1384
1385 // These three methods should produce valid, meaningful strings always
1386 // ---EVEN IF--- the PlugIn has not (yet) been initialized.
1387 // They are used by the PlugInManager GUI
1388
1400 virtual wxString GetCommonName();
1401
1413 virtual wxString GetShortDescription();
1414
1428 virtual wxString GetLongDescription();
1429
1430 // This group is optional.
1431 // PlugIns may override any of these methods as required
1432
1444 virtual void SetDefaults(void);
1445
1459 virtual int GetToolbarToolCount(void);
1460
1473 virtual int GetToolboxPanelCount(void);
1474
1489 virtual void SetupToolboxPanel(int page_sel, wxNotebook *pnotebook);
1490
1506 virtual void OnCloseToolboxPanel(int page_sel, int ok_apply_cancel);
1507
1521 virtual void ShowPreferencesDialog(wxWindow *parent);
1522
1548 virtual bool RenderOverlay(wxMemoryDC *pmdc, PlugIn_ViewPort *vp);
1549
1563 virtual void SetCursorLatLon(double lat, double lon);
1582 virtual void SetCurrentViewPort(PlugIn_ViewPort &vp);
1583
1609 virtual void SetPositionFix(PlugIn_Position_Fix &pfix);
1624 virtual void SetNMEASentence(wxString &sentence);
1641 virtual void SetAISSentence(wxString &sentence);
1642
1652 virtual void ProcessParentResize(int x, int y);
1653
1668 virtual void SetColorScheme(PI_ColorScheme cs);
1669
1678 virtual void OnToolbarToolCallback(int id);
1679
1688 virtual void OnContextMenuItemCallback(int id);
1689
1697 virtual void UpdateAuiStatus(void);
1698
1710 virtual wxArrayString GetDynamicChartClassNameArray(void);
1711};
1712
1713// the types of the class factories used to create PlugIn instances
1714typedef opencpn_plugin *create_t(void *);
1715typedef void destroy_t(opencpn_plugin *);
1716
1717#ifdef __clang__
1718#pragma clang diagnostic push
1719#pragma clang diagnostic ignored "-Woverloaded-virtual"
1720#endif
1721
1722class DECL_EXP opencpn_plugin_16 : public opencpn_plugin {
1723public:
1724 opencpn_plugin_16(void *pmgr);
1725 virtual ~opencpn_plugin_16();
1726
1728
1766 virtual bool RenderOverlay(wxDC &dc, PlugIn_ViewPort *vp);
1767
1782 virtual void SetPluginMessage(wxString &message_id, wxString &message_body);
1783};
1784
1785class DECL_EXP opencpn_plugin_17 : public opencpn_plugin {
1786public:
1787 opencpn_plugin_17(void *pmgr);
1788 virtual ~opencpn_plugin_17();
1789
1791
1792 virtual bool RenderOverlay(wxDC &dc, PlugIn_ViewPort *vp);
1793 virtual bool RenderGLOverlay(wxGLContext *pcontext, PlugIn_ViewPort *vp);
1794
1795 virtual void SetPluginMessage(wxString &message_id, wxString &message_body);
1796};
1797
1798class DECL_EXP opencpn_plugin_18 : public opencpn_plugin {
1799public:
1800 opencpn_plugin_18(void *pmgr);
1801 virtual ~opencpn_plugin_18();
1802
1804
1805 virtual bool RenderOverlay(wxDC &dc, PlugIn_ViewPort *vp);
1843 virtual bool RenderGLOverlay(wxGLContext *pcontext, PlugIn_ViewPort *vp);
1844 virtual void SetPluginMessage(wxString &message_id, wxString &message_body);
1845
1866 virtual void SetPositionFixEx(PlugIn_Position_Fix_Ex &pfix);
1867};
1868
1869#ifdef __clang__
1870#pragma clang diagnostic pop
1871#endif
1872
1873class DECL_EXP opencpn_plugin_19 : public opencpn_plugin_18 {
1874public:
1875 opencpn_plugin_19(void *pmgr);
1876 virtual ~opencpn_plugin_19();
1877
1885 virtual void OnSetupOptions(void);
1886};
1887
1888class DECL_EXP opencpn_plugin_110 : public opencpn_plugin_19 {
1889public:
1890 opencpn_plugin_110(void *pmgr);
1891 virtual ~opencpn_plugin_110();
1892
1893 virtual void LateInit(void); // If WANTS_LATE_INIT is returned by Init()
1894};
1895
1897public:
1898 opencpn_plugin_111(void *pmgr);
1899 virtual ~opencpn_plugin_111();
1900};
1901
1903public:
1904 opencpn_plugin_112(void *pmgr);
1905 virtual ~opencpn_plugin_112();
1906
1916 virtual bool MouseEventHook(wxMouseEvent &event);
1917
1932 virtual void SendVectorChartObjectInfo(wxString &chart, wxString &feature,
1933 wxString &objname, double lat,
1934 double lon, double scale,
1935 int nativescale);
1936};
1937
1939public:
1940 opencpn_plugin_113(void *pmgr);
1941 virtual ~opencpn_plugin_113();
1942
1952 virtual bool KeyboardEventHook(wxKeyEvent &event);
1953
1961 virtual void OnToolbarToolDownCallback(int id);
1962
1970 virtual void OnToolbarToolUpCallback(int id);
1971};
1972
1974public:
1975 opencpn_plugin_114(void *pmgr);
1976 virtual ~opencpn_plugin_114();
1977};
1978
1980public:
1981 opencpn_plugin_115(void *pmgr);
1982 virtual ~opencpn_plugin_115();
1983};
1984
1986public:
1987 opencpn_plugin_116(void *pmgr);
1988 virtual ~opencpn_plugin_116();
2021 virtual bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext,
2022 PlugIn_ViewPort *vp, int canvasIndex);
2023
2056 virtual bool RenderOverlayMultiCanvas(wxDC &dc, PlugIn_ViewPort *vp,
2057 int canvasIndex);
2066 virtual void PrepareContextMenu(int canvasIndex);
2067};
2068
2070public:
2071 opencpn_plugin_117(void *pmgr);
2078 virtual int GetPlugInVersionPatch();
2079
2081 virtual int GetPlugInVersionPost();
2082
2084 virtual const char *GetPlugInVersionPre();
2085
2087 virtual const char *GetPlugInVersionBuild();
2088
2089 /*Provide active leg data to plugins*/
2090 virtual void SetActiveLegInfo(Plugin_Active_Leg_Info &leg_info);
2091};
2092
2094public:
2095 opencpn_plugin_118(void *pmgr);
2096
2099
2157#ifdef _MSC_VER
2158 virtual bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext,
2159 PlugIn_ViewPort *vp, int canvasIndex,
2160 int priority = -1);
2161#else
2162 virtual bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext,
2163 PlugIn_ViewPort *vp, int canvasIndex,
2164 int priority);
2165
2166 bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext, PlugIn_ViewPort *vp,
2167 int canvas_ix) override {
2168 return RenderGLOverlayMultiCanvas(pcontext, vp, canvas_ix, -1);
2169 }
2170#endif
2171
2227#ifdef _MSC_VER
2228 virtual bool RenderOverlayMultiCanvas(wxDC &dc, PlugIn_ViewPort *vp,
2229 int canvasIndex, int priority = -1);
2230#else
2231 virtual bool RenderOverlayMultiCanvas(wxDC &dc, PlugIn_ViewPort *vp,
2232 int canvas_ix, int priority);
2234 int canvas_ix) override {
2235 return RenderOverlayMultiCanvas(dc, vp, canvas_ix, -1);
2236 }
2237#endif
2238};
2239
2241public:
2242 opencpn_plugin_119(void *pmgr);
2243
2261 virtual void PreShutdownHook();
2262};
2263
2265public:
2266 opencpn_plugin_120(void *pmgr);
2267
2268 virtual void OnContextMenuItemCallbackExt(int id, std::string obj_ident,
2269 std::string obj_type, double lat,
2270 double lon);
2271};
2272
2274public:
2275 opencpn_plugin_121(void *pmgr);
2276 virtual void UpdateFollowState(int canvas_index, bool state);
2277};
2278
2279//------------------------------------------------------------------
2280// Route and Waypoint PlugIn support
2281//
2282//------------------------------------------------------------------
2283
2295class DECL_EXP Plugin_Hyperlink {
2296public:
2297 wxString DescrText;
2298 wxString Link;
2299 wxString Type;
2300};
2301
2302WX_DECLARE_LIST(Plugin_Hyperlink, Plugin_HyperlinkList);
2303
2318class DECL_EXP PlugIn_Waypoint {
2319public:
2324
2334 PlugIn_Waypoint(double lat, double lon, const wxString &icon_ident,
2335 const wxString &wp_name, const wxString &GUID = _T(""));
2337
2338 double m_lat;
2339 double m_lon;
2340 wxString m_GUID;
2341 wxString m_MarkName;
2343 wxDateTime m_CreateTime;
2345 wxString m_IconName;
2346
2347 Plugin_HyperlinkList *m_HyperlinkList;
2348};
2349
2350WX_DECLARE_LIST(PlugIn_Waypoint, Plugin_WaypointList);
2351
2358class DECL_EXP PlugIn_Route {
2359public:
2360 PlugIn_Route(void);
2361 ~PlugIn_Route(void);
2362
2363 wxString m_NameString;
2364 wxString m_StartString;
2365 wxString m_EndString;
2366 wxString m_GUID;
2367
2372 Plugin_WaypointList *pWaypointList;
2373};
2374
2388class DECL_EXP PlugIn_Track {
2389public:
2390 PlugIn_Track(void);
2391 ~PlugIn_Track(void);
2392
2393 wxString m_NameString;
2394 wxString m_StartString;
2395 wxString m_EndString;
2396 wxString m_GUID;
2397
2404 Plugin_WaypointList *pWaypointList;
2405};
2406
2407//----------------------------------------------------------------------------------------------------------
2408// The PlugIn CallBack API Definition
2409//
2410// The API back up to the PlugIn Manager
2411// PlugIns may call these static functions as necessary for system services
2412//
2413//----------------------------------------------------------------------------------------------------------
2414
2435extern "C" DECL_EXP int InsertPlugInTool(wxString label, wxBitmap *bitmap,
2436 wxBitmap *bmpRollover, wxItemKind kind,
2437 wxString shortHelp, wxString longHelp,
2438 wxObject *clientData, int position,
2439 int tool_sel, opencpn_plugin *pplugin);
2447extern "C" DECL_EXP void RemovePlugInTool(int tool_id);
2448
2457extern "C" DECL_EXP void SetToolbarToolViz(int item, bool viz);
2458
2467extern "C" DECL_EXP void SetToolbarItemState(int item, bool toggle);
2468
2478extern "C" DECL_EXP void SetToolbarToolBitmaps(int item, wxBitmap *bitmap,
2479 wxBitmap *bmpRollover);
2498extern "C" DECL_EXP int InsertPlugInToolSVG(
2499 wxString label, wxString SVGfile, wxString SVGfileRollover,
2500 wxString SVGfileToggled, wxItemKind kind, wxString shortHelp,
2501 wxString longHelp, wxObject *clientData, int position, int tool_sel,
2502 opencpn_plugin *pplugin);
2503
2514extern "C" DECL_EXP void SetToolbarToolBitmapsSVG(int item, wxString SVGfile,
2515 wxString SVGfileRollover,
2516 wxString SVGfileToggled);
2526extern "C" DECL_EXP int AddCanvasContextMenuItem(wxMenuItem *pitem,
2527 opencpn_plugin *pplugin);
2535extern "C" DECL_EXP void RemoveCanvasContextMenuItem(int item);
2536
2545extern "C" DECL_EXP void SetCanvasContextMenuItemViz(int item, bool viz);
2546
2555extern "C" DECL_EXP void SetCanvasContextMenuItemGrey(int item, bool grey);
2556
2566extern "C" DECL_EXP wxFileConfig *GetOCPNConfigObject(void);
2567
2575extern "C" DECL_EXP void RequestRefresh(wxWindow *);
2576
2592extern "C" DECL_EXP bool GetGlobalColor(wxString colorName, wxColour *pcolour);
2593
2605extern "C" DECL_EXP void GetCanvasPixLL(PlugIn_ViewPort *vp, wxPoint *pp,
2606 double lat, double lon);
2618extern "C" DECL_EXP void GetCanvasLLPix(PlugIn_ViewPort *vp, wxPoint p,
2619 double *plat, double *plon);
2627extern "C" DECL_EXP wxWindow *GetOCPNCanvasWindow();
2628
2667extern "C" DECL_EXP wxFont *OCPNGetFont(wxString TextElement,
2668 int default_size = 0);
2669
2682extern "C" DECL_EXP wxString *GetpSharedDataLocation();
2683
2692extern "C" DECL_EXP ArrayOfPlugIn_AIS_Targets *GetAISTargetArray(void);
2693
2703extern "C" DECL_EXP wxAuiManager *GetFrameAuiManager(void);
2704
2713extern "C" DECL_EXP bool AddLocaleCatalog(wxString catalog);
2714
2722extern "C" DECL_EXP void PushNMEABuffer(wxString str);
2723
2733extern DECL_EXP wxXmlDocument GetChartDatabaseEntryXML(int dbIndex,
2734 bool b_getGeom);
2745extern DECL_EXP bool UpdateChartDBInplace(wxArrayString dir_array,
2746 bool b_force_update,
2747 bool b_ProgressDialog);
2755extern DECL_EXP wxArrayString GetChartDBDirArrayString();
2756
2765extern "C" DECL_EXP void SendPluginMessage(wxString message_id,
2766 wxString message_body);
2774extern "C" DECL_EXP void DimeWindow(wxWindow *);
2775
2783extern "C" DECL_EXP void JumpToPosition(double lat, double lon, double scale);
2784
2785/* API 1.9 adds some common cartographic functions to avoid unnecessary code
2786 * duplication */
2787/* Study the original OpenCPN source (georef.c) for functional definitions */
2788
2813extern "C" DECL_EXP void PositionBearingDistanceMercator_Plugin(
2814 double lat, double lon, double brg, double dist, double *dlat,
2815 double *dlon);
2838extern "C" DECL_EXP void DistanceBearingMercator_Plugin(
2839 double lat0, double lon0, double lat1, double lon1, double *brg,
2840 double *dist);
2841
2851extern "C" DECL_EXP double DistGreatCircle_Plugin(double slat, double slon,
2852 double dlat, double dlon);
2863extern "C" DECL_EXP void toTM_Plugin(float lat, float lon, float lat0,
2864 float lon0, double *x, double *y);
2865
2876extern "C" DECL_EXP void fromTM_Plugin(double x, double y, double lat0,
2877 double lon0, double *lat, double *lon);
2878
2889extern "C" DECL_EXP void toSM_Plugin(double lat, double lon, double lat0,
2890 double lon0, double *x, double *y);
2891
2902extern "C" DECL_EXP void fromSM_Plugin(double x, double y, double lat0,
2903 double lon0, double *lat, double *lon);
2904
2915extern "C" DECL_EXP void toSM_ECC_Plugin(double lat, double lon, double lat0,
2916 double lon0, double *x, double *y);
2917
2928extern "C" DECL_EXP void fromSM_ECC_Plugin(double x, double y, double lat0,
2929 double lon0, double *lat,
2930 double *lon);
2931
2942extern "C" DECL_EXP bool DecodeSingleVDOMessage(const wxString &str,
2944 wxString *acc);
2945
2952extern "C" DECL_EXP int GetChartbarHeight(void);
2983extern "C" DECL_EXP bool GetActiveRoutepointGPX(char *buffer,
2984 unsigned int buffer_length);
2985
2986/* API 1.9 */
2987
3016
3031extern DECL_EXP wxScrolledWindow *AddOptionsPage(OptionsParentPI parent,
3032 wxString title);
3033
3041extern DECL_EXP bool DeleteOptionsPage(wxScrolledWindow *page);
3042
3043/* API 1.10 */
3044
3045/* API 1.10 adds some common functions to avoid unnecessary code duplication */
3046/* Study the original OpenCPN source for functional definitions */
3057extern "C" DECL_EXP double toUsrDistance_Plugin(double nm_distance,
3058 int unit = -1);
3059
3068extern "C" DECL_EXP double fromUsrDistance_Plugin(double usr_distance,
3069 int unit = -1);
3070
3079extern "C" DECL_EXP double toUsrSpeed_Plugin(double kts_speed, int unit = -1);
3080
3089extern "C" DECL_EXP double fromUsrSpeed_Plugin(double usr_speed, int unit = -1);
3090
3099extern "C" DECL_EXP double toUsrTemp_Plugin(double cel_temp, int unit = -1);
3100
3109extern "C" DECL_EXP double fromUsrTemp_Plugin(double usr_temp, int unit = -1);
3110
3118extern DECL_EXP wxString getUsrDistanceUnit_Plugin(int unit = -1);
3119
3127extern DECL_EXP wxString getUsrSpeedUnit_Plugin(int unit = -1);
3128
3136extern DECL_EXP wxString getUsrTempUnit_Plugin(int unit = -1);
3137
3145extern DECL_EXP wxString getUsrWindSpeedUnit_Plugin(int unit = -1);
3146
3155extern DECL_EXP double toUsrWindSpeed_Plugin(double kts_wspeed, int unit = -1);
3156
3165extern DECL_EXP double fromUsrWindSpeed_Plugin(double usr_wspeed,
3166 int unit = -1);
3167
3175extern DECL_EXP wxString getUsrDepthUnit_Plugin(int unit = -1);
3176
3185extern DECL_EXP double toUsrDepth_Plugin(double m_depth, int unit = -1);
3186
3195extern DECL_EXP double fromUsrDepth_Plugin(double usr_depth, int unit = -1);
3196
3204extern DECL_EXP wxString getUsrHeightUnit_Plugin(int unit = -1);
3205
3214extern DECL_EXP double toUsrHeight_Plugin(double m_height, int unit = -1);
3215
3224extern DECL_EXP double fromUsrHeight_Plugin(double usr_height, int unit = -1);
3225
3242extern DECL_EXP double fromDMM_PlugIn(wxString sdms);
3243
3257struct DECL_EXP DateTimeFormatOptions {
3259 virtual ~DateTimeFormatOptions();
3260
3281
3297 wxString time_zone;
3298
3306
3312
3313 int version = 1; // For future compatibility checks
3314
3334 format_string = fmt;
3335 return *this;
3336 }
3337
3356 DateTimeFormatOptions &SetTimezone(const wxString &tz) {
3357 time_zone = tz;
3358 return *this;
3359 }
3360
3368 show_timezone = show;
3369 return *this;
3370 }
3371
3390 longitude = lon;
3391 return *this;
3392 }
3393};
3394
3414extern DECL_EXP wxString toUsrDateTimeFormat_Plugin(
3415 const wxDateTime date_time,
3417
3429extern DECL_EXP wxString GetNewGUID();
3430
3443extern "C" DECL_EXP bool PlugIn_GSHHS_CrossesLand(double lat1, double lon1,
3444 double lat2, double lon2);
3451extern DECL_EXP void PlugInPlaySound(wxString &sound_file);
3452
3453// API 1.10 Route and Waypoint Support
3454
3463extern DECL_EXP wxBitmap *FindSystemWaypointIcon(wxString &icon_name);
3464
3475extern DECL_EXP bool AddCustomWaypointIcon(wxBitmap *pimage, wxString key,
3476 wxString description);
3477
3487extern DECL_EXP bool AddSingleWaypoint(PlugIn_Waypoint *pwaypoint,
3488 bool b_permanent = true);
3489
3498extern DECL_EXP bool DeleteSingleWaypoint(wxString &GUID);
3499
3508extern DECL_EXP bool UpdateSingleWaypoint(PlugIn_Waypoint *pwaypoint);
3509
3519extern DECL_EXP bool AddPlugInRoute(PlugIn_Route *proute,
3520 bool b_permanent = true);
3521
3530extern DECL_EXP bool DeletePlugInRoute(wxString &GUID);
3531
3541extern DECL_EXP bool UpdatePlugInRoute(PlugIn_Route *proute);
3542
3552extern DECL_EXP bool AddPlugInTrack(PlugIn_Track *ptrack,
3553 bool b_permanent = true);
3554
3563extern DECL_EXP bool DeletePlugInTrack(wxString &GUID);
3564
3574extern DECL_EXP bool UpdatePlugInTrack(PlugIn_Track *ptrack);
3575
3576/* API 1.11 */
3577
3578/* API 1.11 adds some more common functions to avoid unnecessary code
3579 * duplication */
3580
3589wxColour DECL_EXP GetBaseGlobalColor(wxString colorName);
3590
3604int DECL_EXP OCPNMessageBox_PlugIn(wxWindow *parent, const wxString &message,
3605 const wxString &caption = _T("Message"),
3606 int style = wxOK, int x = -1, int y = -1);
3607
3622extern DECL_EXP wxString toSDMM_PlugIn(int NEflag, double a,
3623 bool hi_precision = true);
3624
3634extern "C" DECL_EXP wxString *GetpPrivateApplicationDataLocation();
3635
3643extern DECL_EXP wxString GetOCPN_ExePath(void);
3644
3653extern "C" DECL_EXP wxString *GetpPlugInLocation();
3654
3663extern DECL_EXP wxString GetPlugInPath(opencpn_plugin *pplugin);
3664
3674extern "C" DECL_EXP int AddChartToDBInPlace(wxString &full_path,
3675 bool b_RefreshCanvas);
3682extern "C" DECL_EXP int RemoveChartFromDBInPlace(wxString &full_path);
3683
3692extern DECL_EXP wxString GetLocaleCanonicalName();
3693
3708#define PLIB_CAPS_LINE_VBO 1
3712#define PLIB_CAPS_LINE_BUFFER 1 << 1
3713
3717#define PLIB_CAPS_SINGLEGEO_BUFFER 1 << 2
3718
3722#define PLIB_CAPS_OBJSEGLIST 1 << 3
3723
3727#define PLIB_CAPS_OBJCATMUTATE 1 << 4
3728
3729class PI_S57Obj;
3730
3731WX_DECLARE_LIST(PI_S57Obj, ListOfPI_S57Obj);
3732
3733// ----------------------------------------------------------------------------
3734// PlugInChartBaseGL
3735// Derived from PlugInChartBase, add OpenGL Vector chart support
3736// ----------------------------------------------------------------------------
3737
3750class DECL_EXP PlugInChartBaseGL : public PlugInChartBase {
3751public:
3753 virtual ~PlugInChartBaseGL();
3754
3769 virtual int RenderRegionViewOnGL(const wxGLContext &glc,
3770 const PlugIn_ViewPort &VPoint,
3771 const wxRegion &Region, bool b_use_stencil);
3772
3785 virtual ListOfPI_S57Obj *GetObjRuleListAtLatLon(float lat, float lon,
3786 float select_radius,
3787 PlugIn_ViewPort *VPoint);
3788
3798 virtual wxString CreateObjDescriptions(ListOfPI_S57Obj *obj_list);
3799
3805 virtual int GetNoCOVREntries();
3806
3813 virtual int GetNoCOVRTablePoints(int iTable);
3814
3821 virtual int GetNoCOVRTablenPoints(int iTable);
3822
3829 virtual float *GetNoCOVRTableHead(int iTable);
3830};
3831
3832// ----------------------------------------------------------------------------
3833// PlugInChartBaseGLPlus2
3834// Derived from PlugInChartBaseGL, add additional chart management methods
3835// ----------------------------------------------------------------------------
3836
3846public:
3848 virtual ~PlugInChartBaseGLPlus2();
3849
3866 virtual ListOfPI_S57Obj *GetLightsObjRuleListVisibleAtLatLon(
3867 float lat, float lon, PlugIn_ViewPort *VPoint);
3868};
3869
3870// ----------------------------------------------------------------------------
3871// PlugInChartBaseExtended
3872// Derived from PlugInChartBase, add extended chart support methods
3873// ----------------------------------------------------------------------------
3874
3883public:
3885 virtual ~PlugInChartBaseExtended();
3886
3899 virtual int RenderRegionViewOnGL(const wxGLContext &glc,
3900 const PlugIn_ViewPort &VPoint,
3901 const wxRegion &Region, bool b_use_stencil);
3902
3913 virtual wxBitmap &RenderRegionViewOnDCNoText(const PlugIn_ViewPort &VPoint,
3914 const wxRegion &Region);
3915
3926 virtual bool RenderRegionViewOnDCTextOnly(wxMemoryDC &dc,
3927 const PlugIn_ViewPort &VPoint,
3928 const wxRegion &Region);
3929
3941 virtual int RenderRegionViewOnGLNoText(const wxGLContext &glc,
3942 const PlugIn_ViewPort &VPoint,
3943 const wxRegion &Region,
3944 bool b_use_stencil);
3945
3957 virtual int RenderRegionViewOnGLTextOnly(const wxGLContext &glc,
3958 const PlugIn_ViewPort &VPoint,
3959 const wxRegion &Region,
3960 bool b_use_stencil);
3961
3962 virtual ListOfPI_S57Obj *GetObjRuleListAtLatLon(float lat, float lon,
3963 float select_radius,
3964 PlugIn_ViewPort *VPoint);
3965 virtual wxString CreateObjDescriptions(ListOfPI_S57Obj *obj_list);
3966
3967 virtual int GetNoCOVREntries();
3968 virtual int GetNoCOVRTablePoints(int iTable);
3969 virtual int GetNoCOVRTablenPoints(int iTable);
3970 virtual float *GetNoCOVRTableHead(int iTable);
3971
3978 virtual void ClearPLIBTextList();
3979};
3980
3981// ----------------------------------------------------------------------------
3982// PlugInChartBaseExtendedPlus2
3983// Derived from PlugInChartBaseExtended, add additional extended chart support
3984// methods
3985// ----------------------------------------------------------------------------
3986
3988public:
3991
3992 virtual ListOfPI_S57Obj *GetLightsObjRuleListVisibleAtLatLon(
3993 float lat, float lon, PlugIn_ViewPort *VPoint);
3994};
3995
3996class wxArrayOfS57attVal;
3997
4016
4040
4069
4083
4109
4117class DECL_EXP PI_S57Obj {
4118public:
4119 // Public Methods
4120 PI_S57Obj();
4121
4122public:
4123 // Instance Data
4124 char FeatureName[8];
4126
4128 wxArrayOfS57attVal *attVal;
4130
4131 int iOBJL;
4132 int Index;
4133
4134 double x;
4135 double y;
4136 double z;
4137 int npt;
4138 void *geoPt;
4139 double *geoPtz;
4140 double *geoPtMulti;
4141
4143
4144 double m_lat;
4145 double m_lon;
4146
4149
4150 double lat_min;
4151 double lat_max;
4152 double lon_min;
4153 double lon_max;
4154
4156
4158 int nRef;
4159
4160 bool bIsAton;
4162
4167
4169
4173
4174 // Coordinate transform coefficients
4175 double x_rate;
4176 double y_rate;
4177 double x_origin;
4178 double y_origin;
4179
4180 // OpenGL rendering parameters
4185
4189};
4190
4196wxString DECL_EXP PI_GetPLIBColorScheme();
4205int DECL_EXP PI_GetPLIBDepthUnitInt();
4206
4214int DECL_EXP PI_GetPLIBSymbolStyle();
4215
4223int DECL_EXP PI_GetPLIBBoundaryStyle();
4224
4231int DECL_EXP PI_GetPLIBStateHash();
4232
4238double DECL_EXP PI_GetPLIBMarinerSafetyContour();
4239
4250bool DECL_EXP PI_GetObjectRenderBox(PI_S57Obj *pObj, double *lat_min,
4251 double *lat_max, double *lon_min,
4252 double *lon_max);
4253
4259void DECL_EXP PI_UpdateContext(PI_S57Obj *pObj);
4260
4268bool DECL_EXP PI_PLIBObjectRenderCheck(PI_S57Obj *pObj, PlugIn_ViewPort *vp);
4269
4282
4290
4298
4305void DECL_EXP PI_PLIBSetLineFeaturePriority(PI_S57Obj *pObj, int prio);
4306
4311void DECL_EXP PI_PLIBPrepareForNewRender(void);
4312
4318void DECL_EXP PI_PLIBFreeContext(void *pContext);
4319
4329void DECL_EXP PI_PLIBSetRenderCaps(unsigned int flags);
4330
4340bool DECL_EXP PI_PLIBSetContext(PI_S57Obj *pObj);
4341
4356int DECL_EXP PI_PLIBRenderObjectToDC(wxDC *pdc, PI_S57Obj *pObj,
4357 PlugIn_ViewPort *vp);
4358
4375int DECL_EXP PI_PLIBRenderAreaToDC(wxDC *pdc, PI_S57Obj *pObj,
4376 PlugIn_ViewPort *vp, wxRect rect,
4377 unsigned char *pixbuf);
4378
4393int DECL_EXP PI_PLIBRenderAreaToGL(const wxGLContext &glcc, PI_S57Obj *pObj,
4394 PlugIn_ViewPort *vp, wxRect &render_rect);
4395
4412int DECL_EXP PI_PLIBRenderObjectToGL(const wxGLContext &glcc, PI_S57Obj *pObj,
4413 PlugIn_ViewPort *vp, wxRect &render_rect);
4414
4415/* API 1.11 OpenGL Display List and vertex buffer object routines
4416
4417 Effectively these two routines cancel each other so all
4418 of the translation, scaling and rotation can be done by opengl.
4419
4420 Display lists need only be built infrequently, but used in each frame
4421 greatly accelerates the speed of rendering. This avoids costly calculations,
4422 and also allows the vertexes to be stored in graphics memory.
4423
4424 static int dl = 0;
4425 glPushMatrix();
4426 PlugInMultMatrixViewport(current_viewport);
4427 if(dl)
4428 glCallList(dl);
4429 else {
4430 dl = glGenLists(1);
4431 PlugInViewPort norm_viewport = current_viewport;
4432 NormalizeViewPort(norm_viewport);
4433 glNewList(dl, GL_COMPILE_AND_EXECUTE);
4434 ... // use norm_viewport with GetCanvasLLPix here
4435 glEndList();
4436 }
4437 glPopMatrix();
4438 ... // use current_viewport with GetCanvasLLPix again
4439*/
4440
4450extern DECL_EXP bool PlugInHasNormalizedViewPort(PlugIn_ViewPort *vp);
4451
4466extern DECL_EXP void PlugInMultMatrixViewport(PlugIn_ViewPort *vp,
4467 float lat = 0, float lon = 0);
4468
4483extern DECL_EXP void PlugInNormalizeViewport(PlugIn_ViewPort *vp, float lat = 0,
4484 float lon = 0);
4485
4486class wxPoint2DDouble;
4487
4499extern "C" DECL_EXP void GetDoubleCanvasPixLL(PlugIn_ViewPort *vp,
4500 wxPoint2DDouble *pp, double lat,
4501 double lon);
4502
4503/* API 1.13 */
4504/* API 1.13 adds some more common functions to avoid unnecessary code
4505 * duplication */
4506
4515extern DECL_EXP double fromDMM_Plugin(wxString sdms);
4516
4527extern DECL_EXP void SetCanvasRotation(double rotation);
4528
4540extern DECL_EXP void SetCanvasProjection(int projection);
4541
4551extern DECL_EXP bool GetSingleWaypoint(wxString GUID,
4552 PlugIn_Waypoint *pwaypoint);
4553
4566extern DECL_EXP bool CheckEdgePan_PlugIn(int x, int y, bool dragging,
4567 int margin, int delta);
4568
4577extern DECL_EXP wxBitmap GetIcon_PlugIn(const wxString &name);
4578
4586extern DECL_EXP void SetCursor_PlugIn(wxCursor *pPlugin_Cursor = NULL);
4587
4623extern DECL_EXP wxFont *GetOCPNScaledFont_PlugIn(wxString TextElement,
4624 int default_size = 0);
4625
4639extern DECL_EXP wxFont GetOCPNGUIScaledFont_PlugIn(wxString item);
4640
4656extern DECL_EXP double GetOCPNGUIToolScaleFactor_PlugIn(int GUIScaledFactor);
4657
4672extern DECL_EXP double GetOCPNGUIToolScaleFactor_PlugIn();
4673
4688extern DECL_EXP float GetOCPNChartScaleFactor_Plugin();
4689
4697extern DECL_EXP wxColour GetFontColour_PlugIn(wxString TextElement);
4698
4709extern DECL_EXP double GetCanvasTilt();
4710
4721extern DECL_EXP void SetCanvasTilt(double tilt);
4722
4728extern DECL_EXP bool PlugInPlaySoundEx(wxString &sound_file,
4729 int deviceIndex = -1);
4730
4743extern DECL_EXP void AddChartDirectory(wxString &path);
4744
4755extern DECL_EXP void ForceChartDBUpdate();
4756
4768extern DECL_EXP void ForceChartDBRebuild();
4769
4775extern DECL_EXP wxString GetWritableDocumentsDir(void);
4776
4782extern DECL_EXP wxDialog *GetActiveOptionsDialog();
4783
4794extern DECL_EXP wxArrayString GetWaypointGUIDArray(void);
4795
4801extern DECL_EXP wxArrayString GetIconNameArray(void);
4802
4813extern DECL_EXP bool AddPersistentFontKey(wxString TextElement);
4814
4826extern DECL_EXP wxString GetActiveStyleName();
4827
4843extern DECL_EXP wxBitmap GetBitmapFromSVGFile(wxString filename,
4844 unsigned int width,
4845 unsigned int height);
4846
4859extern DECL_EXP bool IsTouchInterface_PlugIn(void);
4860
4861/* Platform optimized File/Dir selector dialogs */
4880extern DECL_EXP int PlatformDirSelectorDialog(wxWindow *parent,
4881 wxString *file_spec,
4882 wxString Title, wxString initDir);
4883
4905extern DECL_EXP int PlatformFileSelectorDialog(wxWindow *parent,
4906 wxString *file_spec,
4907 wxString Title, wxString initDir,
4908 wxString suggestedName,
4909 wxString wildcard);
4910
4911/* OpenCPN HTTP File Download PlugIn Interface */
4912
4913/* Various method Return Codes, etc */
4928
4941
4942// Style definitions for Synchronous file download modal dialogs, if
4943// desired. Abstracted from wxCURL package
4947 0x0002,
4950 OCPN_DLDS_SIZE = 0x0010,
4953 0x0020,
4954
4955 // styles related to the use of wxCurlConnectionSettingsDialog:
4956
4958 0x0040,
4963 0x0100,
4964
4965 OCPN_DLDS_CONN_SETTINGS_ALL = OCPN_DLDS_CONN_SETTINGS_AUTH |
4968
4969 OCPN_DLDS_SHOW_ALL = OCPN_DLDS_ELAPSED_TIME | OCPN_DLDS_ESTIMATED_TIME |
4972 OCPN_DLDS_CONN_SETTINGS_ALL,
4973
4975 OCPN_DLDS_CAN_START = 0x0400,
4978
4980 0x1000,
4981
4982 // by default all available features are enabled:
4983 OCPN_DLDS_DEFAULT_STYLE = OCPN_DLDS_CAN_START | OCPN_DLDS_CAN_PAUSE |
4984 OCPN_DLDS_CAN_ABORT | OCPN_DLDS_SHOW_ALL |
4986};
4987
4988#define ONLINE_CHECK_RETRY \
4989 30 // Recheck the Internet connection availability every ONLINE_CHECK_RETRY s
4990
5011extern DECL_EXP _OCPN_DLStatus OCPN_downloadFile(
5012 const wxString &url, const wxString &outputFile, const wxString &title,
5013 const wxString &message, const wxBitmap &bitmap, wxWindow *parent,
5014 long style, int timeout_secs);
5015
5033extern DECL_EXP _OCPN_DLStatus
5034OCPN_downloadFileBackground(const wxString &url, const wxString &outputFile,
5035 wxEvtHandler *handler, long *handle);
5036
5042extern DECL_EXP void OCPN_cancelDownloadFileBackground(long handle);
5043
5055extern DECL_EXP _OCPN_DLStatus OCPN_postDataHttp(const wxString &url,
5056 const wxString &parameters,
5057 wxString &result,
5058 int timeout_secs);
5059
5065extern DECL_EXP bool OCPN_isOnline();
5066
5067/* Supporting Event for Background downloading */
5068/* OCPN_downloadEvent Definition */
5069
5070/* PlugIn should be ready/able to handle this event after initiating a
5071 * background file transfer
5072 *
5073 * The event as received should be parsed primarily by the getDLEventCondition()
5074 * method. This will allow identification of download start, progress, and end
5075 * states.
5076 *
5077 * Other accessor methods contain status, byte counts, etc.
5078 *
5079 * A PlugIn may safely destroy its EvtHandler after receipt of an
5080 * OCPN_downloadEvent with getDLEventCondition == OCPN_DL_EVENT_TYPE_END
5081 */
5082class DECL_EXP OCPN_downloadEvent : public wxEvent {
5083public:
5084 OCPN_downloadEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
5086
5087 // accessors
5088 _OCPN_DLStatus getDLEventStatus() { return m_stat; }
5089 OCPN_DLCondition getDLEventCondition() { return m_condition; }
5090
5091 void setDLEventStatus(_OCPN_DLStatus stat) { m_stat = stat; }
5092 void setDLEventCondition(OCPN_DLCondition cond) { m_condition = cond; }
5093
5094 void setTotal(long bytes) { m_totalBytes = bytes; }
5095 void setTransferred(long bytes) { m_sofarBytes = bytes; }
5096 long getTotal() { return m_totalBytes; }
5097 long getTransferred() { return m_sofarBytes; }
5098
5099 void setComplete(bool b_complete) { m_b_complete = b_complete; }
5100 bool getComplete() { return m_b_complete; }
5101
5102 // required for sending with wxPostEvent()
5103 wxEvent *Clone() const;
5104
5105private:
5106 OCPN_DLStatus m_stat;
5107 OCPN_DLCondition m_condition;
5108
5109 long m_totalBytes;
5110 long m_sofarBytes;
5111 bool m_b_complete;
5112};
5113
5114// extern WXDLLIMPEXP_CORE const wxEventType wxEVT_DOWNLOAD_EVENT;
5115
5116#ifdef MAKING_PLUGIN
5117extern DECL_IMP wxEventType wxEVT_DOWNLOAD_EVENT;
5118#else
5119extern DECL_EXP wxEventType wxEVT_DOWNLOAD_EVENT;
5120#endif
5121
5122/* API 1.14 */
5123/* API 1.14 adds some more common functions to avoid unnecessary code
5124 * duplication */
5125
5126extern DECL_EXP bool LaunchDefaultBrowser_Plugin(wxString url);
5127
5128// API 1.14 Extra canvas Support
5129
5145extern DECL_EXP void PlugInAISDrawGL(wxGLCanvas *glcanvas,
5146 const PlugIn_ViewPort &vp);
5147
5157extern DECL_EXP bool PlugInSetFontColor(const wxString TextElement,
5158 const wxColour color);
5159
5160// API 1.15
5161
5176extern DECL_EXP double PlugInGetDisplaySizeMM();
5177
5190extern DECL_EXP wxFont *FindOrCreateFont_PlugIn(
5191 int point_size, wxFontFamily family, wxFontStyle style, wxFontWeight weight,
5192 bool underline = false, const wxString &facename = wxEmptyString,
5193 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
5194
5214
5227
5241extern DECL_EXP void PlugInHandleAutopilotRoute(bool enable);
5242
5243// API 1.16
5244//
5259extern DECL_EXP wxString GetPluginDataDir(const char *plugin_name);
5260
5266extern DECL_EXP bool ShuttingDown(void);
5267
5268// Support for MUI MultiCanvas model
5269
5292extern DECL_EXP wxWindow *PluginGetFocusCanvas();
5293
5302extern DECL_EXP wxWindow *PluginGetOverlayRenderCanvas();
5303
5312extern "C" DECL_EXP void CanvasJumpToPosition(wxWindow *canvas, double lat,
5313 double lon, double scale);
5325extern "C" DECL_EXP int AddCanvasMenuItem(wxMenuItem *pitem,
5326 opencpn_plugin *pplugin,
5327 const char *name = "");
5336extern "C" DECL_EXP void RemoveCanvasMenuItem(int item, const char *name = "");
5337
5347extern "C" DECL_EXP void SetCanvasMenuItemViz(int item, bool viz,
5348 const char *name = "");
5349
5359extern "C" DECL_EXP void SetCanvasMenuItemGrey(int item, bool grey,
5360 const char *name = "");
5361
5362// Extract waypoints, routes and tracks
5368extern DECL_EXP wxString GetSelectedWaypointGUID_Plugin();
5369
5375extern DECL_EXP wxString GetSelectedRouteGUID_Plugin();
5376
5382extern DECL_EXP wxString GetSelectedTrackGUID_Plugin();
5383
5390extern DECL_EXP std::unique_ptr<PlugIn_Waypoint> GetWaypoint_Plugin(
5391 const wxString &);
5392
5399extern DECL_EXP std::unique_ptr<PlugIn_Route> GetRoute_Plugin(const wxString &);
5400
5407extern DECL_EXP std::unique_ptr<PlugIn_Track> GetTrack_Plugin(const wxString &);
5408
5414extern DECL_EXP wxWindow *GetCanvasUnderMouse();
5415
5429extern DECL_EXP int GetCanvasIndexUnderMouse();
5430
5431// extern DECL_EXP std::vector<wxWindow *> GetCanvasArray();
5444extern DECL_EXP wxWindow *GetCanvasByIndex(int canvasIndex);
5445
5456extern DECL_EXP int GetCanvasCount();
5457
5472extern DECL_EXP bool CheckMUIEdgePan_PlugIn(int x, int y, bool dragging,
5473 int margin, int delta,
5474 int canvasIndex);
5475
5484extern DECL_EXP void SetMUICursor_PlugIn(wxCursor *pCursor, int canvasIndex);
5485
5486// API 1.17
5487//
5488
5497extern DECL_EXP wxRect GetMasterToolbarRect();
5498
5518
5526extern DECL_EXP int GetLatLonFormat(void);
5527
5528// API 1.17
5529
5540extern "C" DECL_EXP void ZeroXTE();
5541
5565class DECL_EXP PlugIn_Waypoint_Ex {
5566public:
5568 PlugIn_Waypoint_Ex(double lat, double lon, const wxString &icon_ident,
5569 const wxString &wp_name, const wxString &GUID = "",
5570 const double ScaMin = 1e9, const bool bNameVisible = false,
5571 const int nRanges = 0, const double RangeDistance = 1.0,
5572 const wxColor RangeColor = wxColor(255, 0, 0));
5584 void InitDefaults();
5585
5597 bool GetFSStatus();
5598
5607 int GetRouteMembershipCount();
5608
5609 double m_lat;
5610 double m_lon;
5611 wxString m_GUID;
5612 wxString m_MarkName;
5614 wxDateTime m_CreateTime;
5617
5618 double scamin;
5621
5625
5626 wxString IconName;
5628
5634 Plugin_HyperlinkList *m_HyperlinkList;
5635};
5636
5637WX_DECLARE_LIST(PlugIn_Waypoint_Ex, Plugin_WaypointExList);
5638
5639class DECL_EXP PlugIn_Waypoint_ExV2 {
5640public:
5642 PlugIn_Waypoint_ExV2(double lat, double lon, const wxString &icon_ident,
5643 const wxString &wp_name, const wxString &GUID = "",
5644 const double ScaMin = 1e9, const double ScaMax = 1e6,
5645 const bool bNameVisible = false,
5646 const int nRangeRings = 0,
5647 const double RangeDistance = 1.0,
5648 const int RangeRingSpaceUnits = 0, // 0:nm, 1:km
5649 const wxColor RangeColor = wxColor(255, 0, 0),
5650 const double WaypointArrivalRadius = 0.0,
5651 const bool ShowWaypointRangeRings = false,
5652 const double PlannedSpeed = 0.0,
5653 const wxString TideStation = wxEmptyString);
5654
5655 virtual ~PlugIn_Waypoint_ExV2();
5656
5668 bool GetFSStatus();
5669
5678 int GetRouteMembershipCount();
5679
5680 double m_lat;
5681 double m_lon;
5682 wxString m_GUID;
5683 wxString m_MarkName;
5685 wxDateTime m_CreateTime;
5688
5689 double scamin;
5692
5697
5698 wxString IconName;
5700
5706 Plugin_HyperlinkList *m_HyperlinkList;
5707
5708 // New fields that are not in PlugIn_Waypoint_Ex
5709 double scamax;
5714 wxDateTime m_ETD;
5717
5718protected:
5729 void InitDefaults();
5730};
5731
5732WX_DECLARE_LIST(PlugIn_Waypoint_ExV2, Plugin_WaypointExV2List);
5733
5756class DECL_EXP PlugIn_Route_Ex {
5757public:
5758 PlugIn_Route_Ex(void);
5759 ~PlugIn_Route_Ex(void);
5760
5761 wxString m_NameString;
5762 wxString m_StartString;
5763 wxString m_EndString;
5764 wxString m_GUID;
5767 wxString m_Description;
5768
5774 Plugin_WaypointExList *pWaypointList;
5775};
5776
5791class DECL_EXP PlugIn_Route_ExV2 {
5792public:
5794 virtual ~PlugIn_Route_ExV2();
5795
5796 wxString m_NameString;
5797 wxString m_StartString;
5798 wxString m_EndString;
5799 wxString m_GUID;
5802 wxString m_Description;
5803
5809 Plugin_WaypointExV2List *pWaypointList;
5810};
5811
5819extern DECL_EXP wxArrayString GetRouteGUIDArray(void);
5820
5828extern DECL_EXP wxArrayString GetTrackGUIDArray(void);
5829
5837extern DECL_EXP bool GetSingleWaypointEx(wxString GUID,
5838 PlugIn_Waypoint_Ex *pwaypoint);
5839
5847extern DECL_EXP bool GetSingleWaypointExV2(wxString GUID,
5848 PlugIn_Waypoint_ExV2 *pwaypoint);
5849
5857extern DECL_EXP bool AddSingleWaypointEx(PlugIn_Waypoint_Ex *pwaypoint,
5858 bool b_permanent = true);
5859
5867extern DECL_EXP bool AddSingleWaypointExV2(PlugIn_Waypoint_ExV2 *pwaypoint,
5868 bool b_permanent = true);
5869
5876extern DECL_EXP bool UpdateSingleWaypointEx(PlugIn_Waypoint_Ex *pwaypoint);
5877
5884extern DECL_EXP bool UpdateSingleWaypointExV2(PlugIn_Waypoint_ExV2 *pwaypoint);
5885
5893extern DECL_EXP bool AddPlugInRouteEx(PlugIn_Route_Ex *proute,
5894 bool b_permanent = true);
5895
5902extern DECL_EXP bool AddPlugInRouteExV2(PlugIn_Route_ExV2 *proute,
5903 bool b_permanent = true);
5904
5911extern DECL_EXP bool UpdatePlugInRouteEx(PlugIn_Route_Ex *proute);
5912
5921extern DECL_EXP bool UpdatePlugInRouteExV2(PlugIn_Route_ExV2 *proute);
5922
5931extern DECL_EXP std::unique_ptr<PlugIn_Waypoint_Ex> GetWaypointEx_Plugin(
5932 const wxString &GUID);
5933
5942extern DECL_EXP std::unique_ptr<PlugIn_Waypoint_ExV2> GetWaypointExV2_Plugin(
5943 const wxString &GUID);
5944
5953extern DECL_EXP std::unique_ptr<PlugIn_Route_Ex> GetRouteEx_Plugin(
5954 const wxString &GUID);
5955
5964extern DECL_EXP std::unique_ptr<PlugIn_Route_ExV2> GetRouteExV2_Plugin(
5965 const wxString &GUID);
5966
5972extern DECL_EXP wxString GetActiveWaypointGUID(void);
5973
5979extern DECL_EXP wxString GetActiveRouteGUID(void);
5980
5981// API 1.18
5982
5997extern DECL_EXP double OCPN_GetDisplayContentScaleFactor();
5998
6013extern DECL_EXP double OCPN_GetWinDIPScaleFactor();
6014
6022extern DECL_EXP std::vector<std::string> GetPriorityMaps();
6023
6028extern DECL_EXP void UpdateAndApplyPriorityMaps(std::vector<std::string> map);
6029
6037extern DECL_EXP std::vector<std::string> GetActivePriorityIdentifiers();
6038
6046extern DECL_EXP int GetGlobalWatchdogTimoutSeconds();
6047
6059
6060// FIXME (dave) Implement these
6077extern DECL_EXP wxArrayString GetRouteGUIDArray(OBJECT_LAYER_REQ req);
6078
6094extern DECL_EXP wxArrayString GetTrackGUIDArray(OBJECT_LAYER_REQ req);
6095
6113extern DECL_EXP wxArrayString GetWaypointGUIDArray(OBJECT_LAYER_REQ req);
6114
6117/* Listening to messages. */
6118class ObservableListener;
6119
6121class ObservedEvt;
6122
6123// This is a verbatim copy from observable_evt.h, don't define twice.
6124#ifndef OBSERVABLE_EVT_H
6125#define OBSERVABLE_EVT_H
6126
6127wxDECLARE_EVENT(obsNOTIFY, ObservedEvt);
6128
6143class ObservedEvt : public wxCommandEvent {
6144public:
6151 ObservedEvt(wxEventType commandType = obsNOTIFY, int id = 0)
6152 : wxCommandEvent(commandType, id) {}
6153 ObservedEvt(const ObservedEvt &event) : wxCommandEvent(event) {
6154 this->m_shared_ptr = event.m_shared_ptr;
6155 }
6156
6164 wxEvent *Clone() const { return new ObservedEvt(*this); }
6165
6171 std::shared_ptr<const void> GetSharedPtr() const { return m_shared_ptr; }
6172
6178 void SetSharedPtr(std::shared_ptr<const void> p) { m_shared_ptr = p; }
6179
6180private:
6181 std::shared_ptr<const void> m_shared_ptr;
6182};
6183
6184#endif // OBSERVABLE_EVT_H
6185
6186class ObservableListener;
6187
6195 const uint64_t id;
6200 NMEA2000Id(int value) : id(static_cast<uint64_t>(value)) {};
6201};
6202
6213extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
6214 NMEA2000Id id, wxEventType ev, wxEvtHandler *handler);
6215
6223 const std::string id;
6228 NMEA0183Id(const std::string &s) : id(s) {};
6229};
6230
6241extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
6242 NMEA0183Id id, wxEventType ev, wxEvtHandler *handler);
6243
6251 const std::string id;
6256 SignalkId(const std::string &s) : id(s) {};
6257};
6258
6269extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
6270 SignalkId id, wxEventType ev, wxEvtHandler *handler);
6271
6287extern DECL_EXP std::vector<uint8_t> GetN2000Payload(NMEA2000Id id,
6288 ObservedEvt ev);
6289
6306extern DECL_EXP std::shared_ptr<void> GetSignalkPayload(ObservedEvt ev);
6307
6312extern DECL_EXP std::string GetN2000Source(NMEA2000Id id, ObservedEvt ev);
6313
6315extern DECL_EXP std::string GetN0183Payload(NMEA0183Id id, ObservedEvt ev);
6316
6324 const int type;
6329 NavDataId() : type(0) {}
6330};
6331
6343extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
6344 NavDataId id, wxEventType ev, wxEvtHandler *handler);
6345
6353 double lat;
6354 double lon;
6355 double sog;
6356 double cog;
6357 double var;
6358 double hdt;
6359 time_t time;
6360};
6361
6363extern DECL_EXP PluginNavdata GetEventNavdata(ObservedEvt ev);
6364
6366/*
6367 * Plugins may access comm ports for direct output.
6368 * The general program flow for a plugin may look something like this
6369 * pseudo-code:
6370 * 1. Plugin will query OCPN core for a list of active comm drivers.
6371 * 2. Plugin will inspect the list, and query OCPN core for driver
6372 * attributes.
6373 * 3. Plugin will select a comm driver with appropriate attributes for output.
6374 * 4. Plugin will register a list of PGNs expected to be transmitted
6375 * (N2K specific)
6376 * 5. Plugin may then send a payload buffer to a specific comm driver for
6377 * output as soon as possible.
6378 *
6379 * The mechanism for specifying a particular comm driver uses the notion of
6380 * "handles". Each active comm driver has an associated opaque handle, managed
6381 * by OCPN core. All references by a plugin to a driver are by means of its
6382 * handle. Handles should be considered to be "opaque", meaning that the exact
6383 * contents of the handle are of no specific value to the plugin, and only
6384 * have meaning to the OCPN core management of drivers.
6385 */
6386
6388typedef std::string DriverHandle;
6389
6412
6414extern DECL_EXP std::vector<DriverHandle> GetActiveDrivers();
6415
6430extern DECL_EXP const std::unordered_map<std::string, std::string>
6432
6433/* Writing to a specific driver */
6453extern DECL_EXP CommDriverResult WriteCommDriver(
6454 DriverHandle handle, const std::shared_ptr<std::vector<uint8_t>> &payload);
6455
6457extern DECL_EXP CommDriverResult WriteCommDriverN2K(
6458 DriverHandle handle, int PGN, int destinationCANAddress, int priority,
6459 const std::shared_ptr<std::vector<uint8_t>> &payload);
6460
6503extern DECL_EXP CommDriverResult RegisterTXPGNs(DriverHandle handle,
6504 std::vector<int> &pgn_list);
6505
6506// API 1.20
6507//
6508
6545
6548 const std::string id;
6549 PluginMsgId(const std::string &s) : id(s) {};
6550};
6551
6556extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
6557 PluginMsgId id, wxEventType ev, wxEvtHandler *handler);
6558
6563extern DECL_EXP std::string GetPluginMsgPayload(PluginMsgId id, ObservedEvt ev);
6564
6570extern DECL_EXP void ExitOCPN();
6571
6580extern "C" DECL_EXP void RequestWindowRefresh(wxWindow *win,
6581 bool eraseBackground);
6582
6588extern DECL_EXP bool GetFullScreen();
6589
6595extern DECL_EXP void SetFullScreen(bool full_screen_on);
6596
6602extern DECL_EXP void EnableTouchMode(bool enable);
6603
6609extern DECL_EXP bool GetTouchMode();
6610
6618extern DECL_EXP void SetGlobalColor(std::string table, std::string name,
6619 wxColor color);
6620
6628extern DECL_EXP wxColor GetGlobalColorD(std::string map_name, std::string name);
6629
6635extern DECL_EXP void EnableStatusBar(bool enable);
6636
6642extern DECL_EXP void EnableMenu(bool enable);
6643
6649extern DECL_EXP bool GetEnableStatusBar();
6650
6656extern DECL_EXP bool GetEnableMenu();
6657
6667extern DECL_EXP void SetNavigationMode(PI_NavMode mode, int CanvasIndex);
6668
6675extern DECL_EXP PI_NavMode GetNavigationMode(int CanvasIndex);
6676
6684extern DECL_EXP void EnableLookaheadMode(bool enable, int CanvasIndex);
6685
6692extern DECL_EXP bool GetEnableLookaheadMode(int CanvasIndex);
6693
6700extern DECL_EXP void EnableMUIBar(bool enable, int CanvasIndex);
6701
6708extern DECL_EXP void EnableCompassGPSIcon(bool enable, int CanvasIndex);
6709
6716extern DECL_EXP void EnableChartBar(bool enable, int CanvasIndex);
6717
6724extern DECL_EXP bool GetEnableMUIBar(int CanvasIndex);
6725
6732extern DECL_EXP bool GetEnableCompassGPSIcon(int CanvasIndex);
6733
6740extern DECL_EXP bool GetEnableChartBar(int CanvasIndex);
6741
6749extern DECL_EXP void EnableCanvasFocusBar(bool enable, int CanvasIndex);
6750
6757extern DECL_EXP bool GetEnableCanvasFocusBar(int CanvasIndex);
6758
6759/*
6760 * Allow plugin control of "Chart Panel Options" dialog
6761 */
6762
6769extern DECL_EXP void EnableLatLonGrid(bool enable, int CanvasIndex);
6770
6777extern DECL_EXP void EnableChartOutlines(bool enable, int CanvasIndex);
6778
6785extern DECL_EXP void EnableDepthUnitDisplay(bool enable, int CanvasIndex);
6786
6793extern DECL_EXP void EnableAisTargetDisplay(bool enable, int CanvasIndex);
6794
6801extern DECL_EXP void EnableTideStationsDisplay(bool enable, int CanvasIndex);
6802
6809extern DECL_EXP void EnableCurrentStationsDisplay(bool enable, int CanvasIndex);
6810
6817extern DECL_EXP void EnableENCTextDisplay(bool enable, int CanvasIndex);
6818
6825extern DECL_EXP void EnableENCDepthSoundingsDisplay(bool enable,
6826 int CanvasIndex);
6827
6834extern DECL_EXP void EnableBuoyLightLabelsDisplay(bool enable, int CanvasIndex);
6835
6842extern DECL_EXP void EnableLightsDisplay(bool enable, int CanvasIndex);
6843
6850extern DECL_EXP void EnableLightDescriptionsDisplay(bool enable,
6851 int CanvasIndex);
6852
6859extern DECL_EXP void SetENCDisplayCategory(PI_DisCat cat, int CanvasIndex);
6860
6867extern DECL_EXP bool GetEnableLatLonGrid(int CanvasIndex);
6868
6875extern DECL_EXP bool GetEnableChartOutlines(int CanvasIndex);
6876
6883extern DECL_EXP bool GetEnableDepthUnitDisplay(int CanvasIndex);
6884
6891extern DECL_EXP bool GetEnableAisTargetDisplay(int CanvasIndex);
6892
6899extern DECL_EXP bool GetEnableTideStationsDisplay(int CanvasIndex);
6900
6907extern DECL_EXP bool GetEnableCurrentStationsDisplay(int CanvasIndex);
6908
6915extern DECL_EXP bool GetEnableENCTextDisplay(int CanvasIndex);
6916
6923extern DECL_EXP bool GetEnableENCDepthSoundingsDisplay(int CanvasIndex);
6924
6931extern DECL_EXP bool GetEnableBuoyLightLabelsDisplay(int CanvasIndex);
6932
6939extern DECL_EXP bool GetEnableLightsDisplay(int CanvasIndex);
6940
6947extern DECL_EXP bool GetEnableLightDescriptionsDisplay(int CanvasIndex);
6948
6959extern DECL_EXP PI_DisCat GetENCDisplayCategory(int CanvasIndex);
6960
6969extern DECL_EXP void PluginSetFollowMode(int CanvasIndex, bool enable_follow);
6970
6977extern DECL_EXP bool PluginGetFollowMode(int CanvasIndex);
6978
6986extern DECL_EXP void SetTrackingMode(bool enable);
6987
6993extern DECL_EXP bool GetTrackingMode();
6994
7002extern DECL_EXP void SetAppColorScheme(PI_ColorScheme cs);
7003
7009extern DECL_EXP PI_ColorScheme GetAppColorScheme();
7010
7019extern DECL_EXP void EnableSplitScreenLayout(bool enable = true);
7020
7021// ChartCanvas control utilities
7022
7030extern DECL_EXP void PluginZoomCanvas(int CanvasIndex, double factor);
7031
7037extern DECL_EXP bool GetEnableMainToolbar();
7038
7044extern DECL_EXP void SetEnableMainToolbar(bool enable);
7045
7050extern DECL_EXP void ShowGlobalSettingsDialog();
7051
7057extern DECL_EXP void PluginCenterOwnship(int CanvasIndex);
7058
7066extern DECL_EXP bool GetEnableTenHertzUpdate();
7067
7074extern DECL_EXP void EnableTenHertzUpdate(bool enable);
7075
7081extern DECL_EXP void ConfigFlushAndReload();
7082
7083/*
7084 * Reload and restore all connections by direct read of config file
7085 */
7086extern DECL_EXP void ReloadConfigConnections();
7087
7091enum class PI_NotificationSeverity : int {
7092 PI_kInformational = 0,
7093 PI_kWarning = 1,
7094 PI_kCritical = 2
7095};
7096
7098public:
7100 const std::string &_message, int _timeout_start,
7101 int _timeout_left, std::string _guid);
7102 virtual ~PI_Notification() {};
7103
7104 PI_NotificationSeverity severity;
7105 std::string message;
7106 int auto_timeout_left;
7107 int auto_timeout_start;
7108 std::string guid;
7109 std::string action_verb; // Either "ACK" or "POST", when set by a
7110 // PI_Notification message payload.
7111 // Empty otherwise
7112};
7113
7114extern DECL_EXP int GetActiveNotificationCount();
7115extern DECL_EXP PI_NotificationSeverity GetMaxActiveNotificationLevel();
7116extern DECL_EXP std::string RaiseNotification(
7117 const PI_NotificationSeverity _severity, const std::string &_message,
7118 int timeout_secs = -1);
7119extern DECL_EXP bool AcknowledgeNotification(const std::string &guid);
7120extern DECL_EXP std::vector<std::shared_ptr<PI_Notification>>
7121GetActiveNotifications();
7122extern DECL_EXP void EnableNotificationCanvasIcon(bool enable);
7123
7124/*
7125 * Messaging interface for Notification Framework
7126 *
7127 */
7128
7129/*
7130 * Typical use pattern
7131 *
7132 * 1) Establish listener
7133 wxDEFINE_EVENT(EVT_NOTIFICATION_FRAME, ObservedEvt);
7134 static std::shared_ptr<ObservableListener> listener_note;
7135 NotificationMsgId note_id = NotificationMsgId();
7136 listener_note = GetListener(note_id, EVT_NOTIFICATION_FRAME, this);
7137 Bind(EVT_NOTIFICATION_FRAME, [&](ObservedEvt ev) { HandleNotification(ev); });
7138 *
7139 *
7140 *
7141 * 2) Define actions on receipt
7142 static void HandleNotification(ObservedEvt &ev) {
7143 NotificationMsgId id;
7144 std::shared_ptr<PI_Notification>payload=GetNotificationMsgPayload(id, ev);
7145 if (payload->action_verb == "ACK"){
7146 // Do Acknowledge notification actions
7147 }
7148 else if (payload->action_verb == "POST") {
7149 // Do Add Notification actions
7150 }
7151 }
7152
7153*/
7156 const std::string id;
7157 NotificationMsgId(const std::string &s) : id(s) {};
7158 NotificationMsgId() {};
7159};
7160
7165extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
7166 NotificationMsgId id, wxEventType ev, wxEvtHandler *handler);
7167
7171extern DECL_EXP std::shared_ptr<PI_Notification> GetNotificationMsgPayload(
7173
7174// * Plugin polled Comm Status support
7175enum class PI_Conn_Bus : int { N0183 = 0, Signalk = 1, N2000 = 2 };
7176
7177enum class PI_Comm_State : int {
7178 Disabled = 0,
7179 NoStats = 1,
7180 NoData = 2,
7181 Unavailable = 3,
7182 Ok = 4
7183};
7184
7186public:
7187 PI_Comm_State state;
7188 unsigned rx_count;
7189 unsigned tx_count;
7190 unsigned error_count;
7191};
7192
7193extern DECL_EXP PI_Comm_Status GetConnState(const std::string &iface,
7194 PI_Conn_Bus _bus);
7195
7196extern "C" DECL_EXP int AddCanvasContextMenuItemExt(
7197 wxMenuItem *pitem, opencpn_plugin *pplugin, const std::string object_type);
7198
7199// Plugin API121 Utility functions
7200
7201extern DECL_EXP wxString DropMarkPI(double lat, double lon);
7202extern DECL_EXP wxString RouteCreatePI(int canvas_index, bool start);
7203extern DECL_EXP wxString NavToHerePI(double lat, double lon);
7204extern DECL_EXP bool ActivateRoutePI(wxString route_guid, bool activate);
7205
7206extern DECL_EXP void EnableDefaultConsole(bool enable);
7207extern DECL_EXP void EnableDefaultContextMenus(bool enable);
7208
7209extern DECL_EXP void SetMinZoomScale(double min_scale);
7210extern DECL_EXP void SetMaxZoomScale(double max_scale);
7211
7212extern DECL_EXP wxBitmap GetObjectIcon_PlugIn(const wxString &name);
7213
7214extern DECL_EXP void SetDepthUnitVisible(bool bviz);
7215extern DECL_EXP void SetOverzoomFlagVisible(bool bviz);
7216
7217extern DECL_EXP bool IsRouteActive(wxString route_guid);
7218extern DECL_EXP void SetBoatPosition(double zlat, double zlon);
7219
7220extern DECL_EXP void RouteInsertWaypoint(int canvas_index, wxString route_guid,
7221 double zlat, double zlon);
7222extern DECL_EXP void RouteAppendWaypoint(int canvas_index, wxString route_guid);
7223extern DECL_EXP void FinishRoute(int canvas_index);
7224extern DECL_EXP bool IsRouteBeingCreated(int canvas_index);
7225extern DECL_EXP bool AreRouteWaypointNamesVisible(wxString route_guid);
7226extern DECL_EXP void ShowRouteWaypointNames(wxString route_guid, bool show);
7227extern DECL_EXP void NavigateToWaypoint(wxString waypoint_guid);
7228extern DECL_EXP bool DoMeasurePI(int canvas_index, bool start);
7229extern DECL_EXP bool IsMeasureActive(int canvas_index);
7230extern DECL_EXP void CancelMeasure(int canvas_index);
7231
7232// AIS related
7233extern DECL_EXP bool IsAISTrackVisible(
7234 wxString ais_mmsi); // for Show/Hide Target Track
7235extern DECL_EXP void AISToggleShowTrack(
7236 wxString ais_mmsi); // for Show/Hide Target Track
7237extern DECL_EXP bool IsAIS_CPAVisible(
7238 wxString ais_mmsi); // for Show/Hide Target CPA
7239extern DECL_EXP void AISToggleShowCPA(
7240 wxString ais_mmsi); // for Show/Hide Target CPA
7241extern DECL_EXP void ShowAISTargetQueryDialog(
7242 int canvas_index,
7243 wxString ais_mmsi); // for Target Query
7244extern DECL_EXP void ShowAISTargetList(int canvas_index); // for Target List
7245
7246// Plugin Context Menu support
7247typedef enum _PI_ContextObjectType {
7248 OBJECT_CHART = 0,
7249 OBJECT_ROUTEPOINT,
7250 OBJECT_ROUTESEGMENT,
7251 OBJECT_AISTARGET,
7252 OBJECT_UNKNOWN
7253} PI_ContextObjectType;
7254
7255typedef struct _PI_PointContext {
7256 _PI_ContextObjectType object_type;
7257 std::string object_ident;
7259
7260extern DECL_EXP std::shared_ptr<PI_PointContext> GetContextAtPoint(
7261 int x, int y, int canvas_index);
7262
7263// Extended Chart table management support
7264extern DECL_EXP void AddNoShowDirectory(std::string chart_dir);
7265extern DECL_EXP void RemoveNoShowDirectory(std::string chart_dir);
7266extern DECL_EXP void ClearNoShowVector();
7267extern DECL_EXP const std::vector<std::string> &GetNoShowVector();
7268
7269// Enhanced AIS Target List support
7270// extern DECL_EXP wxString GetAISTargetColumnData(wxString ais_mmsi, int
7271// column); // same as OCPNListCtrl::GetTargetColumnData
7272extern DECL_EXP void CenterToAisTarget(wxString ais_mmsi);
7273extern DECL_EXP void AisTargetCreateWpt(wxString ais_mmsi);
7274extern DECL_EXP void AisShowAllTracks(bool show);
7275extern DECL_EXP void AisToggleTrack(wxString ais_mmsi);
7276
7277// Context menu enable/disable, by object type
7278#define CONTEXT_MENU_DISABLE_WAYPOINT 1
7279#define CONTEXT_MENU_DISABLE_ROUTE 2
7280#define CONTEXT_MENU_DISABLE_TRACK 4
7281#define CONTEXT_MENU_DISABLE_AISTARGET 8
7282
7283extern DECL_EXP int GetContextMenuMask();
7284extern DECL_EXP void SetContextMenuMask(int mask);
7285
7286#endif //_PLUGIN_H_
Keeps listening over its lifespan, removes itself on destruction.
Definition observable.h:155
Custom event class for OpenCPN's notification system.
ObservedEvt(wxEventType commandType=obsNOTIFY, int id=0)
Constructor.
void SetSharedPtr(std::shared_ptr< const void > p)
Sets the event's payload data.
wxEvent * Clone() const
Creates a cloned copy of this event.
std::shared_ptr< const void > GetSharedPtr() const
Gets the event's payload data.
unsigned error_count
Number of detected errors since program start.
unsigned tx_count
Number of bytes sent since program start.
unsigned rx_count
Number of bytes received since program start.
Class representing an S-57 chart object.
int auxParm3
Auxiliary parameter 3.
PI_S57Obj * next
Linked list pointer.
PI_DisCat m_DisplayCat
Display category (base, standard, other)
double m_lon
Reference longitude.
double lon_max
Bounding box maximum longitude.
int Scamin
Minimum display scale.
int * m_lsindex_array
Array of line segment indices.
double x
X coordinate for point features.
int auxParm1
Auxiliary parameter 1.
void * m_chart_context
Parent chart context.
int m_n_lsindex
Number of line segments.
double lon_min
Bounding box minimum longitude.
PI_S57Obj * child
Child object list (for multipoint soundings)
double x_rate
X scale factor.
int npt
Number of points in geometry.
int auxParm2
Auxiliary parameter 2.
double lat_max
Bounding box maximum latitude.
int auxParm0
Auxiliary parameter 0.
int iOBJL
Object lookup index.
void * pPolyTessGeo
Tesselated polygon geometry.
double chart_ref_lon
Chart reference longitude.
bool bIsAssociable
True if object can have relationships.
int m_n_edge_max_points
Maximum points per edge.
void * geoPt
Geometry data for lines/areas.
double y
Y coordinate for point features.
int nRef
Reference count for memory management.
int n_attr
Number of attributes.
double * geoPtMulti
Lat/lon pairs for decomposed points.
double y_origin
Y origin offset.
PI_line_segment_element * m_ls_list
Line segment list.
int Index
Runtime object index.
void * S52_Context
S52 presentation data.
bool bIsClone
True if object is a clone.
char * att_array
Array of attribute types.
double * geoPtz
Z values for multipoint features.
double m_lat
Reference latitude.
int m_DPRI
Display priority.
bool m_bcategory_mutable
True if category can change.
bool bIsAton
True if object is an aid to navigation.
double chart_ref_lat
Chart reference latitude.
double z
Z coordinate (usually depth)
wxArrayOfS57attVal * attVal
Array of attribute values.
double y_rate
Y scale factor.
double lat_min
Bounding box minimum latitude.
double x_origin
X origin offset.
int Primitive_type
Geometry type (point, line, area)
Represents a line segment element for efficient vector chart rendering.
int priority
Drawing priority (higher draws on top)
int type
Line type identifier.
void * private0
Private data pointer for implementation use.
float lon_min
Minimum longitude of segment's bounding box.
float lat_min
Minimum latitude of segment's bounding box.
size_t vbo_offset
Offset into vertex buffer object for this segment.
float lat_max
Maximum latitude of segment's bounding box.
float lon_max
Maximum longitude of segment's bounding box.
PI_line_segment_element * next
Pointer to next segment in linked list.
size_t n_points
Number of points in this line segment.
Extended chart base class with separated text rendering.
Extended OpenGL-optimized chart base class with additional querying capabilities.
OpenGL-optimized chart base class for plugin chart types.
Base class for implementing custom chart types in OpenCPN plugins.
virtual ChartFamilyEnumPI GetChartFamily()
Returns the chart family classification.
virtual wxString GetID()
Returns a unique identifier for the chart.
virtual wxString GetDatumString()
Returns the horizontal geodetic datum of the chart.
virtual wxString GetName()
Returns the chart's name or title.
virtual wxDateTime GetEditionDate(void)
Returns the edition date of the chart.
virtual int GetCOVRTablenPoints(int iTable)
Alternative method to get the number of points in a coverage table entry.
virtual int GetCOVREntries()
Returns the number of coverage table entries for this chart.
virtual wxString GetSoundingsDatum()
Returns the vertical datum used for soundings in the chart.
virtual wxString GetExtraInfo()
Returns additional information about the chart.
virtual wxString GetDescription()
Returns a descriptive text about the chart.
virtual wxString GetFullPath() const
Returns the full file path of the chart.
virtual wxString GetSE()
Returns the chart's source edition identifier.
virtual bool IsReadyToRender()
Indicates whether the chart is ready for rendering.
virtual int GetNativeScale()
Returns the native scale of the chart.
virtual double GetChartSkew()
Returns the skew/rotation angle of the chart.
virtual wxString GetDepthUnits()
Returns the depth units used in the chart.
virtual float * GetCOVRTableHead(int iTable)
Returns a pointer to the coverage table data for a specific entry.
virtual double GetChartErrorFactor()
Returns the error factor for the chart.
virtual OcpnProjTypePI GetChartProjection()
Returns the projection type used by the chart.
virtual wxString GetPubDate()
Returns the publication date/year of the chart.
virtual ChartTypeEnumPI GetChartType()
Returns the chart type identifier.
virtual int GetCOVRTablePoints(int iTable)
Returns the number of points in a specific coverage table entry.
virtual ChartDepthUnitTypePI GetDepthUnitId()
Returns the depth unit type identifier.
AIS target information accessible to plugins.
char CallSign[8]
Call sign, includes NULL terminator.
double HDG
Heading in degrees true.
int ROTAIS
Rate of turn as indicated in AIS message.
unsigned char ShipType
Ship type as per ITU-R M.1371.
double Lat
Latitude in decimal degrees.
int MMSI
Maritime Mobile Service Identity number.
bool bCPA_Valid
True if CPA calculation is valid.
double Brg
Bearing to target in degrees true.
double Lon
Longitude in decimal degrees.
double CPA
Closest Point of Approach in nautical miles.
int Class
AIS class (Class A: 0, Class B: 1)
double SOG
Speed over ground in knots.
double Range_NM
Range to target in nautical miles.
int NavStatus
Navigational status (0-15 as per ITU-R M.1371)
int IMO
IMO ship identification number.
char ShipName[21]
Ship name, includes NULL terminator.
double TCPA
Time to Closest Point of Approach in minutes.
double COG
Course over ground in degrees.
plugin_ais_alarm_type alarm_state
Current alarm state for this target.
Extended position fix information.
int nSats
Number of satellites used in the fix.
double Var
Magnetic variation in degrees, typically from RMC message.
double Cog
Course over ground in degrees [0-360).
double Lat
Latitude in decimal degrees.
double Hdm
Heading magnetic in degrees [0-360).
time_t FixTime
UTC time of fix.
double Lon
Longitude in decimal degrees.
double Sog
Speed over ground in knots.
double Hdt
Heading true in degrees [0-360).
Basic position fix information.
double Cog
Course over ground in degrees [0-360).
double Sog
Speed over ground in knots.
time_t FixTime
UTC time of fix as time_t value.
double Lat
Latitude in decimal degrees.
int nSats
Number of satellites used in the fix.
double Var
Magnetic variation in degrees, typically from RMC message.
double Lon
Longitude in decimal degrees.
Enhanced route class for working with PlugIn_Waypoint_ExV2 waypoints.
bool m_isVisible
True if route should be displayed.
Plugin_WaypointExV2List * pWaypointList
List of waypoints making up this route in order.
wxString m_StartString
Description of route start point.
wxString m_Description
Optional route description/notes.
wxString m_NameString
User-visible name of the route.
bool m_isActive
True if this is the active route.
wxString m_GUID
Globally unique identifier.
wxString m_EndString
Description of route end point.
Extended route class for managing complex route features.
wxString m_Description
Optional route description/notes.
wxString m_EndString
Description of route end point.
Plugin_WaypointExList * pWaypointList
List of waypoints making up this route in order.
wxString m_NameString
User-visible name of the route.
bool m_isVisible
True if route should be displayed.
wxString m_GUID
Globally unique identifier.
bool m_isActive
True if this is the active route.
wxString m_StartString
Description of route start point.
Plugin route class for managing ordered waypoint collections.
wxString m_GUID
Globally unique identifier.
wxString m_EndString
Name/description of ending point.
wxString m_NameString
Route name.
Plugin_WaypointList * pWaypointList
List of waypoints making up this route in order.
wxString m_StartString
Name/description of starting point.
Plugin track class for managing recorded track data.
Plugin_WaypointList * pWaypointList
List of waypoints making up this track in chronological order.
wxString m_GUID
Globally unique identifier.
wxString m_EndString
Description of track end point/time.
wxString m_StartString
Description of track start point/time.
wxString m_NameString
Display name of the track.
Contains view parameters and status information for a chart display viewport.
double view_scale_ppm
Display scale in pixels per meter.
wxRect rv_rect
Rectangle defining the rendered view area.
int pix_width
Viewport width in pixels.
double lon_max
Maximum longitude of the viewport.
double clon
Center longitude of the viewport in decimal degrees.
double lat_max
Maximum latitude of the viewport.
int pix_height
Viewport height in pixels.
double clat
Center latitude of the viewport in decimal degrees.
double skew
Display skew angle in radians.
double rotation
Display rotation angle in radians.
bool bValid
True if this viewport is valid and can be used for rendering.
double lon_min
Minimum longitude of the viewport.
double lat_min
Minimum latitude of the viewport.
int m_projection_type
Chart projection type (PROJECTION_MERCATOR, etc.)
bool b_quilt
True if the viewport is in quilt mode (showing multiple charts)
float chart_scale
Conventional chart displayed scale (e.g., 1:50000)
wxDateTime m_ETD
Estimated departure time in UTC, or wxInvalidDateTime if not set.
wxString m_MarkDescription
Optional description text.
wxString m_GUID
Globally unique identifier.
wxString m_TideStation
Tide Station Identifier.
wxDateTime m_CreateTime
Creation timestamp in UTC.
bool m_bShowWaypointRangeRings
True to show range rings on chart.
wxString IconDescription
User-friendly description of icon.
double m_lat
Latitude in decimal degrees.
wxColour RangeRingColor
Color to draw range rings.
bool IsActive
Active state (e.g. destination)
Plugin_HyperlinkList * m_HyperlinkList
List of hyperlinks associated with this waypoint.
double scamin
Minimum display scale (1:X) for waypoint visibility.
double scamax
Maximum display scale (1:X) for waypoint visibility.
bool b_useScamin
True to enable scale-dependent visibility.
wxString IconName
Name of icon to use for waypoint symbol.
bool IsNameVisible
True to show waypoint name on chart.
double m_PlannedSpeed
Planned speed for next leg (knots)
double RangeRingSpace
Distance between range rings in preferred units.
double m_lon
Longitude in decimal degrees.
double m_WaypointArrivalRadius
Arrival radius in nautical miles.
int RangeRingSpaceUnits
Units for range ring spacing - 0:nm, 1:km.
wxString m_MarkName
Display name of waypoint.
bool IsVisible
Visibility state on chart.
int nrange_rings
Number of range rings to display around waypoint.
Extended waypoint class with additional navigation features.
wxDateTime m_CreateTime
Creation timestamp in UTC.
wxColour RangeRingColor
Color to draw range rings.
int nrange_rings
Number of range rings to display around waypoint.
wxString IconDescription
User-friendly description of icon.
bool b_useScamin
True to enable scale-dependent visibility.
double RangeRingSpace
Distance between range rings in preferred units.
Plugin_HyperlinkList * m_HyperlinkList
List of hyperlinks associated with this waypoint.
wxString m_MarkName
Display name of waypoint.
wxString m_GUID
Globally unique identifier.
double m_lon
Longitude in decimal degrees.
wxString IconName
Name of icon to use for waypoint symbol.
double scamin
Minimum display scale (1:X) for waypoint visibility.
bool IsNameVisible
True to show waypoint name on chart.
double m_lat
Latitude in decimal degrees.
wxString m_MarkDescription
Optional description text.
bool IsActive
Active state (e.g. destination)
bool IsVisible
Visibility state on chart.
Plugin waypoint class providing core waypoint/mark functionality.
double m_lon
Longitude in decimal degrees.
wxString m_IconName
Icon identifier.
wxString m_MarkDescription
Optional description.
wxString m_GUID
Globally unique identifier.
bool m_IsVisible
Visibility state.
wxDateTime m_CreateTime
Creation timestamp in UTC.
wxString m_MarkName
Display name.
double m_lat
Latitude in decimal degrees.
Plugin_HyperlinkList * m_HyperlinkList
List of associated hyperlinks.
Information about the currently active route leg.
double Dtw
Distance to waypoint in nautical miles.
wxString wp_name
Name of destination waypoint for the active leg.
double Xte
Cross track error in nautical miles, negative values indicate left side of track.
double Btw
Bearing to waypoint in degrees true.
bool arrival
True when vessel is within the arrival circle of the destination waypoint.
virtual bool RenderOverlayMultiCanvas(wxDC &dc, PlugIn_ViewPort *vp, int canvasIndex)
Renders plugin overlay graphics in standard DC mode for multi-canvas support.
virtual bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext, PlugIn_ViewPort *vp, int canvasIndex)
Renders plugin overlay graphics in OpenGL mode for multi-canvas support.
bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext, PlugIn_ViewPort *vp, int canvas_ix) override
Renders plugin overlay graphics in OpenGL mode for multi-canvas support.
bool RenderOverlayMultiCanvas(wxDC &dc, PlugIn_ViewPort *vp, int canvas_ix) override
Renders plugin overlay graphics in standard DC mode for multi-canvas support.
Base class for OpenCPN plugins.
virtual bool RenderOverlay(wxMemoryDC *pmdc, PlugIn_ViewPort *vp)
Render plugin overlay graphics using standard device context.
DECL_EXP void RemovePlugInTool(int tool_id)
Removes a tool from OpenCPN's toolbar.
DECL_EXP void EnableNotificationCanvasIcon(bool enable)
Plugin Notification Framework GUI support.
DECL_EXP void ForceChartDBUpdate()
Forces an update of the chart database.
DECL_EXP wxArrayString GetRouteGUIDArray(void)
Gets array of route GUIDs.
DECL_EXP std::unique_ptr< PlugIn_Route_Ex > GetRouteEx_Plugin(const wxString &GUID)
Gets extended route by GUID.
DECL_EXP CommDriverResult WriteCommDriverN2K(DriverHandle handle, int PGN, int destinationCANAddress, int priority, const std::shared_ptr< std::vector< uint8_t > > &payload)
Send a PGN message to an NMEA2000 address.
_OBJECT_LAYER_REQ
Filter options for object queries.
@ OBJECTS_ALL
Return all objects including those in layers.
@ OBJECTS_ONLY_LAYERS
Return only objects that are in layers.
@ OBJECTS_NO_LAYERS
Exclude objects that are in layers.
DECL_EXP void toSM_ECC_Plugin(double lat, double lon, double lat0, double lon0, double *x, double *y)
Converts geographic coordinates to Elliptical Simple Mercator projection.
DECL_EXP void EnableENCDepthSoundingsDisplay(bool enable, int CanvasIndex)
Controls ENC depth sounding display.
DECL_EXP void EnableChartBar(bool enable, int CanvasIndex)
Controls visibility of chart info bar.
DECL_EXP double fromDMM_Plugin(wxString sdms)
Converts degrees/decimal minutes string to decimal degrees.
DECL_EXP void SetCanvasMenuItemGrey(int item, bool grey, const char *name="")
Sets menu item enabled/disabled state.
DECL_EXP void EnableLatLonGrid(bool enable, int CanvasIndex)
Controls latitude/longitude grid display.
DECL_EXP void SetNavigationMode(PI_NavMode mode, int CanvasIndex)
Sets the navigation mode for a specific chart canvas.
DECL_EXP bool GetEnableENCDepthSoundingsDisplay(int CanvasIndex)
Gets ENC depth sounding visibility.
DECL_EXP void EnableENCTextDisplay(bool enable, int CanvasIndex)
Controls ENC text label display.
DECL_EXP wxXmlDocument GetChartDatabaseEntryXML(int dbIndex, bool b_getGeom)
Gets chart database entry as XML.
DECL_EXP void AddChartDirectory(wxString &path)
Adds a chart directory to OpenCPN's chart database.
DECL_EXP wxBitmap GetBitmapFromSVGFile(wxString filename, unsigned int width, unsigned int height)
Creates bitmap from SVG file.
DECL_EXP wxArrayString GetChartDBDirArrayString()
Gets chart database directory list.
DECL_EXP wxWindow * GetCanvasByIndex(int canvasIndex)
Gets chart canvas window by index.
DECL_EXP bool GetEnableCanvasFocusBar(int CanvasIndex)
Gets focus indicator visibility state.
DECL_EXP void UpdateAndApplyPriorityMaps(std::vector< std::string > map)
Sets and applies new priority mapping scheme.
DECL_EXP int GetCanvasIndexUnderMouse()
Gets index of chart canvas under mouse cursor.
DECL_EXP void DimeWindow(wxWindow *)
Applies system color scheme to window.
plugin_ais_alarm_type
Enumeration of AIS alarm states.
@ PI_AIS_ALARM_ACKNOWLEDGED
Alarm has been acknowledged by the user.
@ PI_AIS_NO_ALARM
No alarm condition exists.
@ PI_AIS_ALARM_SET
Alarm has been set but not acknowledged.
DECL_EXP bool GetSingleWaypointExV2(wxString GUID, PlugIn_Waypoint_ExV2 *pwaypoint)
Gets extended waypoint data by GUID.
enum ChartDepthUnitTypePI _ChartDepthUnitTypePI
Enumeration of depth unit types used in charts.
DECL_EXP std::unique_ptr< PlugIn_Waypoint_ExV2 > GetWaypointExV2_Plugin(const wxString &GUID)
Gets complete waypoint details by GUID.
DECL_EXP void EnableCanvasFocusBar(bool enable, int CanvasIndex)
Controls visibility of canvas focus indicator.
DECL_EXP void EnableTideStationsDisplay(bool enable, int CanvasIndex)
Controls tide station icon display.
enum _PI_DisCat PI_DisCat
Display categories for S52 chart features.
DECL_EXP void RemoveCanvasContextMenuItem(int item)
Removes a context menu item completely.
void DECL_EXP PI_PLIBSetRenderCaps(unsigned int flags)
Sets rendering capability flags.
DECL_EXP void fromSM_ECC_Plugin(double x, double y, double lat0, double lon0, double *lat, double *lon)
Converts Elliptical Simple Mercator coordinates to geographic.
DECL_EXP bool GetEnableChartBar(int CanvasIndex)
Gets chart bar visibility state.
DECL_EXP wxFont GetOCPNGUIScaledFont_PlugIn(wxString item)
Gets a uniquely scaled font copy for responsive UI elements.
DECL_EXP double DistGreatCircle_Plugin(double slat, double slon, double dlat, double dlon)
Calculates great circle distance between two points.
CommDriverResult
Error return values
@ RESULT_COMM_INVALID_PARMS
Invalid parameters provided to operation.
@ RESULT_COMM_REGISTER_GATEWAY_ERROR
Failed to register with gateway device.
@ RESULT_COMM_TX_ERROR
Error occurred during transmission.
@ RESULT_COMM_REGISTER_PGN_ERROR
Failed to register PGN parameters.
@ RESULT_COMM_NO_ERROR
Operation completed successfully.
@ RESULT_COMM_INVALID_HANDLE
Invalid or unknown driver handle specified.
DECL_EXP void RequestWindowRefresh(wxWindow *win, bool eraseBackground)
Requests window refresh.
DECL_EXP bool UpdateChartDBInplace(wxArrayString dir_array, bool b_force_update, bool b_ProgressDialog)
Updates chart database in place.
DECL_EXP wxString GetLocaleCanonicalName()
Gets system locale canonical name.
DECL_EXP bool GetEnableDepthUnitDisplay(int CanvasIndex)
Gets depth unit display state.
enum OptionsParentPI _OptionsParentPI
Enum defining parent pages in OpenCPN options dialog where plugins can add panels.
DECL_EXP void SetToolbarItemState(int item, bool toggle)
Sets toolbar item toggle state.
DECL_EXP bool UpdatePlugInRoute(PlugIn_Route *proute)
Updates an existing route.
DECL_EXP bool AddLocaleCatalog(wxString catalog)
Adds a locale catalog for translations.
int DECL_EXP PI_PLIBRenderObjectToDC(wxDC *pdc, PI_S57Obj *pObj, PlugIn_ViewPort *vp)
Renders an S57 object using standard device context.
DECL_EXP _OCPN_DLStatus OCPN_downloadFile(const wxString &url, const wxString &outputFile, const wxString &title, const wxString &message, const wxBitmap &bitmap, wxWindow *parent, long style, int timeout_secs)
Synchronously download a file with progress dialog.
void DECL_EXP PI_PLIBSetLineFeaturePriority(PI_S57Obj *pObj, int prio)
Sets rendering priority for line feature.
enum _PI_DisPrio PI_DisPrio
Display priority levels for S52 chart objects.
DECL_EXP void EnableCurrentStationsDisplay(bool enable, int CanvasIndex)
Controls current station icon display.
DECL_EXP wxArrayString GetIconNameArray(void)
Gets array of available waypoint icons.
DECL_EXP void toTM_Plugin(float lat, float lon, float lat0, float lon0, double *x, double *y)
Converts geographic coordinates to Transverse Mercator projection.
DECL_EXP bool GetGlobalColor(wxString colorName, wxColour *pcolour)
Gets a functionally-named color for a specific UI purpose.
DECL_EXP bool GetSingleWaypointEx(wxString GUID, PlugIn_Waypoint_Ex *pwaypoint)
Gets extended waypoint data by GUID.
DECL_EXP int PlatformFileSelectorDialog(wxWindow *parent, wxString *file_spec, wxString Title, wxString initDir, wxString suggestedName, wxString wildcard)
Shows platform-optimized file selector dialog.
DECL_EXP PI_DisCat GetENCDisplayCategory(int CanvasIndex)
Gets current ENC display category.
void DECL_EXP PI_UpdateContext(PI_S57Obj *pObj)
Updates rendering context for S57 object.
DECL_EXP int AddCanvasContextMenuItem(wxMenuItem *pitem, opencpn_plugin *pplugin)
Adds item to chart canvas context menu.
DECL_EXP double fromUsrSpeed_Plugin(double usr_speed, int unit=-1)
Converts from user's preferred speed unit to knots.
DECL_EXP _OCPN_DLStatus OCPN_postDataHttp(const wxString &url, const wxString &parameters, wxString &result, int timeout_secs)
Performs HTTP POST request.
DECL_EXP wxString GetActiveRouteGUID(void)
Gets GUID of currently active route.
DECL_EXP void RequestRefresh(wxWindow *)
Requests window refresh.
void DECL_EXP PI_PLIBPrepareForNewRender(void)
Prepares PLIB for new rendering pass.
DECL_EXP PI_NavMode GetNavigationMode(int CanvasIndex)
Gets current navigation mode for a canvas.
DECL_EXP void SetCanvasRotation(double rotation)
Sets chart display rotation angle.
DECL_EXP void PlugInMultMatrixViewport(PlugIn_ViewPort *vp, float lat=0, float lon=0)
Applies viewport transformation matrix.
DECL_EXP double toUsrDepth_Plugin(double m_depth, int unit=-1)
Converts meters to user's preferred depth unit.
DECL_EXP PI_Comm_Status GetConnState(const std::string &iface, PI_Conn_Bus _bus)
Plugin polled Comm Status support.
int DECL_EXP PI_GetPLIBDepthUnitInt()
Gets configured depth unit for S52 display.
DECL_EXP wxArrayString GetWaypointGUIDArray(void)
Gets array of all waypoint/marks GUIDs.
DECL_EXP double toUsrTemp_Plugin(double cel_temp, int unit=-1)
Converts Celsius to user's preferred temperature unit.
DECL_EXP bool CheckEdgePan_PlugIn(int x, int y, bool dragging, int margin, int delta)
Checks if chart should pan when cursor near edge.
DECL_EXP wxString * GetpSharedDataLocation()
Gets shared application data location.
DECL_EXP double toUsrSpeed_Plugin(double kts_speed, int unit=-1)
Converts knots to user's preferred speed unit.
DECL_EXP bool GetEnableBuoyLightLabelsDisplay(int CanvasIndex)
Gets buoy/light label visibility.
_OCPN_DLCondition
Event types for HTTP file download operations.
@ OCPN_DL_EVENT_TYPE_UNKNOWN
Unknown event type.
@ OCPN_DL_EVENT_TYPE_PROGRESS
Download progress update.
@ OCPN_DL_EVENT_TYPE_END
Download has completed.
@ OCPN_DL_EVENT_TYPE_START
Download is starting.
DECL_EXP bool DeleteOptionsPage(wxScrolledWindow *page)
Remove a previously added options page.
DECL_EXP void EnableTenHertzUpdate(bool enable)
Enable or disable 10 Hz update rate.
DECL_EXP void EnableLightDescriptionsDisplay(bool enable, int CanvasIndex)
Controls light description text display.
DECL_EXP bool AddPlugInRouteEx(PlugIn_Route_Ex *proute, bool b_permanent=true)
Adds a route with extended features.
bool DECL_EXP PI_PLIBObjectRenderCheck(PI_S57Obj *pObj, PlugIn_ViewPort *vp)
Checks if object should be rendered.
DECL_EXP void GetCanvasPixLL(PlugIn_ViewPort *vp, wxPoint *pp, double lat, double lon)
Converts lat/lon to canvas physical pixel coordinates.
DECL_EXP bool PlugIn_GSHHS_CrossesLand(double lat1, double lon1, double lat2, double lon2)
Checks if a great circle route crosses land.
ChartTypeEnumPI
Enumeration of chart types.
@ PI_CHART_TYPE_PLUGIN
Chart type provided by a plugin.
@ PI_CHART_TYPE_CM93COMP
CM93 Composite vector chart format.
@ PI_CHART_TYPE_CM93
CM93 vector chart format.
@ PI_CHART_TYPE_S57
S-57 vector chart format.
@ PI_CHART_TYPE_UNKNOWN
Chart type is unknown or undefined.
@ PI_CHART_TYPE_DONTCARE
Chart type is not important for the operation.
@ PI_CHART_TYPE_KAP
BSB/KAP raster chart format.
@ PI_CHART_TYPE_DUMMY
Dummy chart used when no actual chart is available.
@ PI_CHART_TYPE_GEO
GEO raster chart format.
DECL_EXP int GetChartbarHeight(void)
Gets height of chart bar in pixels.
DECL_EXP wxString GetNewGUID()
Generates a new globally unique identifier (GUID).
PI_ColorScheme
Color schemes for different lighting conditions.
@ PI_GLOBAL_COLOR_SCHEME_DAY
Day color scheme, optimized for bright ambient light.
@ PI_GLOBAL_COLOR_SCHEME_NIGHT
Night/dark color scheme, optimized for dark conditions with minimal impact on night vision.
@ PI_N_COLOR_SCHEMES
Number of color schemes, used for bounds checking.
@ PI_GLOBAL_COLOR_SCHEME_RGB
RGB color scheme, unmodified colors.
@ PI_GLOBAL_COLOR_SCHEME_DUSK
Dusk color scheme, optimized for low ambient light.
DECL_EXP wxString toSDMM_PlugIn(int NEflag, double a, bool hi_precision=true)
Convert decimal degrees to a formatted string.
DECL_EXP void SetEnableMainToolbar(bool enable)
Show or hide the main toolbar.
enum _OCPN_DLCondition OCPN_DLCondition
Event types for HTTP file download operations.
DECL_EXP wxString GetActiveStyleName()
Gets name of currently active style sheet.
DECL_EXP void EnableAisTargetDisplay(bool enable, int CanvasIndex)
Controls AIS target display.
DECL_EXP void ZeroXTE()
Resets cross track error to zero.
DECL_EXP void SetENCDisplayCategory(PI_DisCat cat, int CanvasIndex)
Sets ENC (Electronic Navigation Chart) feature display category.
DECL_EXP wxString GetOCPN_ExePath(void)
Gets OpenCPN executable path.
int DECL_EXP OCPNMessageBox_PlugIn(wxWindow *parent, const wxString &message, const wxString &caption=_T("Message"), int style=wxOK, int x=-1, int y=-1)
Shows a message box dialog.
DECL_EXP wxString * GetpPlugInLocation()
Gets plugins directory location.
DECL_EXP std::string GetN2000Source(NMEA2000Id id, ObservedEvt ev)
Return source identifier (iface) of a received n2000 message of type id in ev.
DECL_EXP int GetLatLonFormat(void)
Gets currently selected latitude/longitude display format.
PI_NotificationSeverity
Plugin Notification Framework support.
DECL_EXP std::shared_ptr< void > GetSignalkPayload(ObservedEvt ev)
Get SignalK status payload after receiving a message.
DECL_EXP double OCPN_GetWinDIPScaleFactor()
Gets Windows-specific DPI scaling factor.
DECL_EXP std::shared_ptr< ObservableListener > GetListener(NMEA2000Id id, wxEventType ev, wxEvtHandler *handler)
Gets listener for NMEA 2000 messages.
DECL_EXP wxWindow * GetCanvasUnderMouse()
Gets canvas window under mouse cursor.
DECL_EXP void EnableBuoyLightLabelsDisplay(bool enable, int CanvasIndex)
Controls buoy/light name label display.
int DECL_EXP PI_PLIBRenderAreaToDC(wxDC *pdc, PI_S57Obj *pObj, PlugIn_ViewPort *vp, wxRect rect, unsigned char *pixbuf)
Renders an S57 area object using standard device context.
DECL_EXP void SetGlobalColor(std::string table, std::string name, wxColor color)
Sets a color in the global color scheme.
DECL_EXP void PushNMEABuffer(wxString str)
Pushes NMEA sentence to the system.
DECL_EXP bool OCPN_isOnline()
Checks internet connectivity.
DECL_EXP void SetCanvasContextMenuItemGrey(int item, bool grey)
Sets menu item enabled/disabled state.
DECL_EXP wxString getUsrHeightUnit_Plugin(int unit=-1)
Gets display string for user's preferred height unit.
DECL_EXP std::unique_ptr< PlugIn_Waypoint > GetWaypoint_Plugin(const wxString &)
Gets waypoint details by GUID.
enum PI_InitReturn _PI_InitReturn
Return values for plugin initialization.
DECL_EXP void CanvasJumpToPosition(wxWindow *canvas, double lat, double lon, double scale)
Centers specified canvas on given position at given scale.
DECL_EXP double fromUsrTemp_Plugin(double usr_temp, int unit=-1)
Converts from user's preferred temperature unit to Celsius.
DECL_EXP bool GetEnableMenu()
Gets menu bar visibility state.
bool DECL_EXP PI_GetObjectRenderBox(PI_S57Obj *pObj, double *lat_min, double *lat_max, double *lon_min, double *lon_max)
Gets geographic bounding box of S57 object.
_OCPN_DLStatus
Status codes for HTTP file download operations.
@ OCPN_DL_NO_ERROR
Download completed successfully.
@ OCPN_DL_USER_TIMEOUT
Download timed out waiting for user action.
@ OCPN_DL_STARTED
Download has begun but not yet complete.
@ OCPN_DL_FAILED
Download failed (general error)
@ OCPN_DL_UNKNOWN
Unknown or uninitialized status.
@ OCPN_DL_ABORTED
Download was cancelled by user.
SDDMFORMAT
Coordinate format options for lat/lon display.
@ DEGREES_DECIMAL_MINUTES
Format like "50° 12.345' N".
@ DEGREES_MINUTES_SECONDS
Format like "50° 12' 34.5" N".
@ DECIMAL_DEGREES
Format like "50.12345° N".
@ END_SDDMFORMATS
Number of available formats.
DECL_EXP bool IsTouchInterface_PlugIn(void)
Checks if touch interface mode is enabled.
DECL_EXP wxString GetPlugInPath(opencpn_plugin *pplugin)
Gets the installation path for a specific plugin.
DECL_EXP double GetCanvasTilt()
Gets current canvas tilt angle.
DECL_EXP bool GetEnableAisTargetDisplay(int CanvasIndex)
Gets AIS target display state.
OCPN_DLDialogStyle
@ OCPN_DLDS_CONN_SETTINGS_AUTH
The dialog allows the user to change the authentication settings.
@ OCPN_DLDS_CAN_START
The transfer won't start automatically.
@ OCPN_DLDS_URL
The dialog shows the URL involved in the transfer.
@ OCPN_DLDS_AUTO_CLOSE
The dialog auto closes when transfer is complete.
@ OCPN_DLDS_CAN_ABORT
The transfer can be aborted by the user.
@ OCPN_DLDS_ESTIMATED_TIME
The dialog shows the estimated total time.
@ OCPN_DLDS_SIZE
The dialog shows the size of the resource to download/upload.
@ OCPN_DLDS_CONN_SETTINGS_PROXY
The dialog allows the user to change the proxy settings.
@ OCPN_DLDS_REMAINING_TIME
The dialog shows the remaining time.
@ OCPN_DLDS_SPEED
The dialog shows the transfer speed.
@ OCPN_DLDS_ELAPSED_TIME
The dialog shows the elapsed time.
@ OCPN_DLDS_CAN_PAUSE
The transfer can be paused.
@ OCPN_DLDS_CONN_SETTINGS_PORT
The dialog allows the user to change the port for the transfer.
DECL_EXP void RemoveCanvasMenuItem(int item, const char *name="")
Removes a context menu item completely.
DECL_EXP void EnableStatusBar(bool enable)
Shows/hides the status bar.
ChartFamilyEnumPI
Enumeration of chart families (broad categories).
@ PI_CHART_FAMILY_UNKNOWN
Chart family is unknown.
@ PI_CHART_FAMILY_VECTOR
Vector chart formats (S-57, CM93, etc.)
@ PI_CHART_FAMILY_RASTER
Raster chart formats (KAP, GEO, etc.)
@ PI_CHART_FAMILY_DONTCARE
Chart family is not important for the operation.
DECL_EXP void EnableChartOutlines(bool enable, int CanvasIndex)
Controls chart outline display.
DECL_EXP bool UpdatePlugInRouteExV2(PlugIn_Route_ExV2 *proute)
Updates existing route with V2 waypoints.
DECL_EXP wxString GetWritableDocumentsDir(void)
Returns the platform-specific default documents directory.
DECL_EXP wxString GetSelectedTrackGUID_Plugin()
Gets GUID of currently selected track.
DECL_EXP bool GetEnableTenHertzUpdate()
Check if 10 Hz update rate is enabled.
DECL_EXP std::unique_ptr< PlugIn_Route_ExV2 > GetRouteExV2_Plugin(const wxString &GUID)
Gets route details with V2 waypoints by GUID.
DECL_EXP bool DeletePlugInRoute(wxString &GUID)
Deletes a route.
DECL_EXP void GetDoubleCanvasPixLL(PlugIn_ViewPort *vp, wxPoint2DDouble *pp, double lat, double lon)
Converts lat/lon to canvas pixels with double precision.
DECL_EXP bool GetFullScreen()
Gets full screen state.
DECL_EXP bool PluginGetFollowMode(int CanvasIndex)
Get the current follow mode status for a specific canvas.
DECL_EXP bool GetSingleWaypoint(wxString GUID, PlugIn_Waypoint *pwaypoint)
Gets waypoint data by GUID.
enum _PI_LUPname PI_LUPname
Name identifiers for S57 lookup table sets.
DECL_EXP double OCPN_GetDisplayContentScaleFactor()
Gets content scaling factor for current display.
DECL_EXP double fromUsrDepth_Plugin(double usr_depth, int unit=-1)
Converts from user's preferred depth unit to meters.
DECL_EXP bool UpdatePlugInTrack(PlugIn_Track *ptrack)
Updates an existing track.
DECL_EXP wxArrayString GetTrackGUIDArray(void)
Gets array of track GUIDs.
DECL_EXP bool GetEnableLightsDisplay(int CanvasIndex)
Gets light icon visibility.
int DECL_EXP PI_GetPLIBStateHash()
Gets hash value representing current PLIB state.
DECL_EXP double toUsrDistance_Plugin(double nm_distance, int unit=-1)
Converts nautical miles to user's preferred distance unit.
DECL_EXP bool GetActiveRoutepointGPX(char *buffer, unsigned int buffer_length)
Gets GPX representation of active route waypoint.
DECL_EXP double toUsrHeight_Plugin(double m_height, int unit=-1)
Converts meters to user's preferred height unit.
DECL_EXP wxBitmap * FindSystemWaypointIcon(wxString &icon_name)
Finds built-in system waypoint icon.
DECL_EXP void ExitOCPN()
Exits OpenCPN application.
DECL_EXP int PlugInGetMinAvailableGshhgQuality()
Gets minimum available GSHHS coastline data quality.
DECL_EXP bool GetEnableLookaheadMode(int CanvasIndex)
Gets look-ahead mode state for a canvas.
DECL_EXP wxString getUsrTempUnit_Plugin(int unit=-1)
Gets display string for user's preferred temperature unit.
DECL_EXP double fromDMM_PlugIn(wxString sdms)
Parse a formatted coordinate string to get decimal degrees.
DECL_EXP int PlugInGetMaxAvailableGshhgQuality()
Gets maximum available GSHHS coastline data quality.
ChartDepthUnitTypePI
Enumeration of depth unit types used in charts.
@ PI_DEPTH_UNIT_METERS
Depths shown in meters.
@ PI_DEPTH_UNIT_UNKNOWN
Depth unit is unknown or not specified.
@ PI_DEPTH_UNIT_FATHOMS
Depths shown in fathoms.
@ PI_DEPTH_UNIT_FEET
Depths shown in feet.
DECL_EXP bool PlugInHasNormalizedViewPort(PlugIn_ViewPort *vp)
Checks if viewport has been normalized.
DECL_EXP bool AddSingleWaypoint(PlugIn_Waypoint *pwaypoint, bool b_permanent=true)
Adds a single waypoint.
DECL_EXP double fromUsrWindSpeed_Plugin(double usr_wspeed, int unit=-1)
Converts from user's preferred wind speed unit to knots.
DECL_EXP bool PlugInSetFontColor(const wxString TextElement, const wxColour color)
Sets text color for a UI element.
DECL_EXP wxString getUsrWindSpeedUnit_Plugin(int unit=-1)
Gets display string for user's preferred wind speed unit.
DECL_EXP bool DeleteSingleWaypoint(wxString &GUID)
Deletes a single waypoint.
DECL_EXP bool ShuttingDown(void)
Checks if OpenCPN is in shutdown process.
DECL_EXP void EnableDepthUnitDisplay(bool enable, int CanvasIndex)
Controls depth unit display.
DECL_EXP void PlugInAISDrawGL(wxGLCanvas *glcanvas, const PlugIn_ViewPort &vp)
Renders AIS targets on a secondary OpenGL canvas.
DECL_EXP void PlugInHandleAutopilotRoute(bool enable)
Controls autopilot route handling.
DECL_EXP void EnableMUIBar(bool enable, int CanvasIndex)
Controls visibility of MUI (Mobile/Touch User Interface) bar.
DECL_EXP void JumpToPosition(double lat, double lon, double scale)
Centers chart display on specified position at given scale.
DECL_EXP CommDriverResult WriteCommDriver(DriverHandle handle, const std::shared_ptr< std::vector< uint8_t > > &payload)
Send a non-NMEA2000 message.
DECL_EXP int PlatformDirSelectorDialog(wxWindow *parent, wxString *file_spec, wxString Title, wxString initDir)
Shows platform-optimized directory selector dialog.
DECL_EXP std::string GetN0183Payload(NMEA0183Id id, ObservedEvt ev)
Return payload in a received n0183 message of type id in ev.
wxString DECL_EXP PI_GetPLIBColorScheme()
Gets current color scheme used by S52 PLIB.
DECL_EXP void SetToolbarToolBitmaps(int item, wxBitmap *bitmap, wxBitmap *bmpRollover)
Updates toolbar tool bitmaps.
DECL_EXP bool GetTrackingMode()
Get the current tracking mode status.
std::string DriverHandle
Plugin API supporting direct access to comm drivers for output purposes.
PI_LUPname DECL_EXP PI_GetObjectLUPName(PI_S57Obj *pObj)
Gets Look-Up Table (LUP) name for object.
DECL_EXP bool AddPersistentFontKey(wxString TextElement)
Registers a new font configuration element.
enum _OCPN_DLStatus OCPN_DLStatus
Status codes for HTTP file download operations.
DECL_EXP bool AddPlugInRouteExV2(PlugIn_Route_ExV2 *proute, bool b_permanent=true)
Adds a new route with V2 waypoints.
DECL_EXP wxAuiManager * GetFrameAuiManager(void)
Gets main frame AUI manager.
DECL_EXP void PlugInNormalizeViewport(PlugIn_ViewPort *vp, float lat=0, float lon=0)
Normalizes viewport parameters.
DECL_EXP wxString getUsrDistanceUnit_Plugin(int unit=-1)
Gets display string for user's preferred distance unit.
struct _ExtentPI ExtentPI
Geographic extent structure defining a bounding box.
DECL_EXP wxFileConfig * GetOCPNConfigObject(void)
Gets OpenCPN's configuration object.
DECL_EXP bool AddCustomWaypointIcon(wxBitmap *pimage, wxString key, wxString description)
Adds a custom waypoint icon.
DECL_EXP wxString toUsrDateTimeFormat_Plugin(const wxDateTime date_time, const DateTimeFormatOptions &options=DateTimeFormatOptions())
Format a date/time to a localized string representation, conforming to the global date/time format an...
DECL_EXP wxRect GetMasterToolbarRect()
Gets bounding rectangle of master toolbar.
DECL_EXP wxWindow * PluginGetOverlayRenderCanvas()
Gets the canvas currently designated for overlay rendering.
DECL_EXP void EnableLookaheadMode(bool enable, int CanvasIndex)
Enables/disables look-ahead mode for a canvas.
DECL_EXP void OCPN_cancelDownloadFileBackground(long handle)
Cancels a background download.
DECL_EXP PI_ColorScheme GetAppColorScheme()
Get the current application color scheme.
DECL_EXP PluginNavdata GetEventNavdata(ObservedEvt ev)
Return BasicNavDataMsg decoded data available in ev.
DECL_EXP bool UpdateSingleWaypointExV2(PlugIn_Waypoint_ExV2 *pwaypoint)
Updates an existing extended V2 waypoint.
DECL_EXP int AddChartToDBInPlace(wxString &full_path, bool b_RefreshCanvas)
Adds a chart to the database without full rebuild.
DECL_EXP void toSM_Plugin(double lat, double lon, double lat0, double lon0, double *x, double *y)
Converts geographic coordinates to Simple Mercator projection.
DECL_EXP wxString getUsrDepthUnit_Plugin(int unit=-1)
Gets display string for user's preferred depth unit.
DECL_EXP void EnableMenu(bool enable)
Shows/hides the main menu bar.
DECL_EXP wxFont * OCPNGetFont(wxString TextElement, int default_size=0)
Gets a font for UI elements.
DECL_EXP int GetGlobalWatchdogTimoutSeconds()
Gets global watchdog timeout value.
DECL_EXP void SetTrackingMode(bool enable)
Enable or disable tracking mode.
enum ChartTypeEnumPI _ChartTypeEnumPI
Enumeration of chart types.
DECL_EXP std::shared_ptr< PI_Notification > GetNotificationMsgPayload(NotificationMsgId id, ObservedEvt ev)
Retrieve the Notification Event in a Notification message.
enum OcpnProjTypePI _OcpnProjTypePI
Enumeration of chart projection types.
DECL_EXP bool GetEnableStatusBar()
Gets status bar visibility state.
DECL_EXP float GetOCPNChartScaleFactor_Plugin()
Gets chart rendering scale factor.
void DECL_EXP PI_PLIBFreeContext(void *pContext)
Frees S52 PLIB context.
DECL_EXP bool GetEnableChartOutlines(int CanvasIndex)
Gets chart outline visibility state.
DECL_EXP std::unique_ptr< PlugIn_Track > GetTrack_Plugin(const wxString &)
Gets track details by GUID.
DECL_EXP bool AddPlugInRoute(PlugIn_Route *proute, bool b_permanent=true)
Adds a new route.
DECL_EXP std::vector< uint8_t > GetN2000Payload(NMEA2000Id id, ObservedEvt ev)
Return N2K payload for a received n2000 message of type id in ev.
DECL_EXP wxColour GetFontColour_PlugIn(wxString TextElement)
Gets color configured for a UI text element.
DECL_EXP bool GetEnableMainToolbar()
Check if the main toolbar is enabled.
enum ChartFamilyEnumPI _ChartFamilyEnumPI
Enumeration of chart families (broad categories).
DECL_EXP wxFont * FindOrCreateFont_PlugIn(int point_size, wxFontFamily family, wxFontStyle style, wxFontWeight weight, bool underline=false, const wxString &facename=wxEmptyString, wxFontEncoding encoding=wxFONTENCODING_DEFAULT)
Creates or finds a font in the font cache.
DECL_EXP void SetCanvasContextMenuItemViz(int item, bool viz)
Temporarily changes context menu item visibility.
DECL_EXP bool PlugInPlaySoundEx(wxString &sound_file, int deviceIndex=-1)
Start playing a sound file asynchronously.
DECL_EXP wxBitmap GetIcon_PlugIn(const wxString &name)
Gets icon bitmap by name.
DECL_EXP double toUsrWindSpeed_Plugin(double kts_wspeed, int unit=-1)
Converts knots to user's preferred wind speed unit.
DECL_EXP wxWindow * GetOCPNCanvasWindow()
Gets OpenCPN's main canvas window.
_PI_NavMode
Navigation mode options for chart display orientation.
@ PI_NORTH_UP_MODE
North Up Mode - True north is always at the top of the display.
@ PI_COURSE_UP_MODE
Course Up Mode - Current course over ground at the top.
@ PI_HEAD_UP_MODE
Head Up Mode - Current vessel heading at the top.
DECL_EXP void SetMUICursor_PlugIn(wxCursor *pCursor, int canvasIndex)
Sets mouse cursor for specific canvas.
DECL_EXP const std::unordered_map< std::string, std::string > GetAttributes(DriverHandle handle)
Query a specific driver for attributes.
DECL_EXP int InsertPlugInTool(wxString label, wxBitmap *bitmap, wxBitmap *bmpRollover, wxItemKind kind, wxString shortHelp, wxString longHelp, wxObject *clientData, int position, int tool_sel, opencpn_plugin *pplugin)
Adds a tool to OpenCPN's toolbar.
DECL_EXP void ConfigFlushAndReload()
Flush configuration changes to disk and reload settings.
DECL_EXP bool AddSingleWaypointEx(PlugIn_Waypoint_Ex *pwaypoint, bool b_permanent=true)
Adds a waypoint with extended properties.
DECL_EXP bool GetEnableLatLonGrid(int CanvasIndex)
Gets latitude/longitude grid visibility state.
_PI_DisPrio
Display priority levels for S52 chart objects.
@ PI_PRIO_AREA_2
Superimposed areas including water features.
@ PI_PRIO_NUM
Number of priority levels.
@ PI_PRIO_AREA_1
Superimposed areas.
@ PI_PRIO_MARINERS
VRM, EBL, own ship (highest priority)
@ PI_PRIO_SYMB_POINT
Point symbols including land features.
@ PI_PRIO_ROUTEING
Routeing lines (TSS, recommended tracks)
@ PI_PRIO_GROUP1
S57 group 1 filled areas (land, etc)
@ PI_PRIO_SYMB_AREA
Area symbols including traffic areas.
@ PI_PRIO_SYMB_LINE
Line symbols including restricted areas.
@ PI_PRIO_NODATA
No data fill area pattern (lowest priority)
@ PI_PRIO_HAZARDS
Hazards, buoys, beacons.
bool DECL_EXP PI_PLIBSetContext(PI_S57Obj *pObj)
Sets S52 PLIB rendering context for an object.
DECL_EXP bool UpdatePlugInRouteEx(PlugIn_Route_Ex *proute)
Updates an existing extended route.
DECL_EXP std::vector< DriverHandle > GetActiveDrivers()
Query OCPN core for a list of active drivers
DECL_EXP void SetCursor_PlugIn(wxCursor *pPlugin_Cursor=NULL)
Sets mouse cursor.
enum CommDriverResult _CommDriverResult
Error return values
DECL_EXP void PositionBearingDistanceMercator_Plugin(double lat, double lon, double brg, double dist, double *dlat, double *dlon)
Calculates destination point given starting point, bearing and distance.
DECL_EXP std::unique_ptr< PlugIn_Route > GetRoute_Plugin(const wxString &)
Gets route details by GUID.
_PI_DisCat
Display categories for S52 chart features.
@ PI_DISP_CAT_NUM
Number of categories (for array sizing)
@ PI_OTHER
Other - additional features for detailed navigation.
@ PI_MARINERS_OTHER
Additional mariner specified features.
@ PI_DISPLAYBASE
Display Base - features that must always be shown.
@ PI_STANDARD
Standard - default features for safe navigation.
@ PI_MARINERS_STANDARD
Mariner specified standard features.
DECL_EXP bool DecodeSingleVDOMessage(const wxString &str, PlugIn_Position_Fix_Ex *pos, wxString *acc)
Decodes a single VDO (Own Ship AIS) message.
PI_DisPrio DECL_EXP PI_GetObjectDisplayPriority(PI_S57Obj *pObj)
Gets display priority for object.
DECL_EXP double PlugInGetDisplaySizeMM()
Gets physical display size in millimeters.
DECL_EXP std::string GetPluginMsgPayload(PluginMsgId id, ObservedEvt ev)
Retrieve the string in a plugin message, internal or received on the REST insterface.
DECL_EXP double fromUsrDistance_Plugin(double usr_distance, int unit=-1)
Converts from user's preferred distance unit to nautical miles.
DECL_EXP wxWindow * PluginGetFocusCanvas()
Gets the currently focused chart canvas.
int DECL_EXP PI_PLIBRenderAreaToGL(const wxGLContext &glcc, PI_S57Obj *pObj, PlugIn_ViewPort *vp, wxRect &render_rect)
Renders an S57 area object using OpenGL.
DECL_EXP bool UpdateSingleWaypointEx(PlugIn_Waypoint_Ex *pwaypoint)
Updates an existing extended waypoint.
DECL_EXP void SetFullScreen(bool full_screen_on)
Sets full screen mode.
DECL_EXP void PluginCenterOwnship(int CanvasIndex)
Center the chart view on the own ship position for a specific canvas.
DECL_EXP double GetOCPNGUIToolScaleFactor_PlugIn()
Gets current global GUI scaling factor.
DECL_EXP wxString GetSelectedRouteGUID_Plugin()
Gets GUID of currently selected route.
DECL_EXP void DistanceBearingMercator_Plugin(double lat0, double lon0, double lat1, double lon1, double *brg, double *dist)
Calculates bearing and distance between two points using Mercator projection.
DECL_EXP std::unique_ptr< PlugIn_Waypoint_Ex > GetWaypointEx_Plugin(const wxString &GUID)
Gets extended waypoint by GUID.
DECL_EXP wxColor GetGlobalColorD(std::string map_name, std::string name)
Gets a color from the global color scheme.
enum _PI_NavMode PI_NavMode
Navigation mode options for chart display orientation.
DECL_EXP void ShowGlobalSettingsDialog()
Display the global settings dialog.
DECL_EXP void SetToolbarToolBitmapsSVG(int item, wxString SVGfile, wxString SVGfileRollover, wxString SVGfileToggled)
Updates SVG graphics for toolbar tool.
DECL_EXP void PlugInPlaySound(wxString &sound_file)
Plays a sound file asynchronously.
_PI_LUPname
Name identifiers for S57 lookup table sets.
@ PI_PLAIN_BOUNDARIES
Area objects with simple boundaries.
@ PI_PAPER_CHART
Point objects using traditional paper chart symbols.
@ PI_LINES
Line objects (e.g., depth contours, coastlines)
@ PI_LUPNAME_NUM
Total number of lookup table types.
@ PI_SIMPLIFIED
Point objects using simplified symbols.
@ PI_SYMBOLIZED_BOUNDARIES
Area objects with symbolized boundaries.
DECL_EXP std::vector< std::string > GetPriorityMaps()
Gets list of configured priority mapping schemes.
DECL_EXP ArrayOfPlugIn_AIS_Targets * GetAISTargetArray(void)
Gets array of AIS targets.
DECL_EXP void EnableSplitScreenLayout(bool enable=true)
Enable or disable the split-screen layout.
DECL_EXP bool UpdateSingleWaypoint(PlugIn_Waypoint *pwaypoint)
Updates a single waypoint.
DECL_EXP double fromUsrHeight_Plugin(double usr_height, int unit=-1)
Converts from user's preferred height unit to meters.
DECL_EXP void SetCanvasProjection(int projection)
Sets chart projection type.
DECL_EXP bool AddPlugInTrack(PlugIn_Track *ptrack, bool b_permanent=true)
Adds a new track.
DECL_EXP int InsertPlugInToolSVG(wxString label, wxString SVGfile, wxString SVGfileRollover, wxString SVGfileToggled, wxItemKind kind, wxString shortHelp, wxString longHelp, wxObject *clientData, int position, int tool_sel, opencpn_plugin *pplugin)
Adds a tool using SVG graphics.
DECL_EXP wxString getUsrSpeedUnit_Plugin(int unit=-1)
Gets display string for user's preferred speed unit.
wxColour DECL_EXP GetBaseGlobalColor(wxString colorName)
Gets a global system color.
DECL_EXP bool GetEnableENCTextDisplay(int CanvasIndex)
Gets ENC text label visibility.
DECL_EXP bool GetEnableCompassGPSIcon(int CanvasIndex)
Gets compass icon visibility state.
OcpnProjTypePI
Enumeration of chart projection types.
@ PI_PROJECTION_UNKNOWN
Projection type is unknown or undefined.
@ PI_PROJECTION_MERCATOR
Mercator projection, standard for navigation charts.
@ PI_PROJECTION_STEREOGRAPHIC
Stereographic projection, used for polar and specialty charts.
@ PI_PROJECTION_GNOMONIC
Gnomonic projection, in which great circles appear as straight lines.
@ PI_PROJECTION_POLAR
Polar projection, used for polar regions.
@ PI_PROJECTION_POLYCONIC
Polyconic projection, sometimes used for inland charts.
@ PI_PROJECTION_TRANSVERSE_MERCATOR
Transverse Mercator projection, used for some coastal charts.
@ PI_PROJECTION_ORTHOGRAPHIC
Orthographic projection, showing Earth as viewed from space.
@ PI_PROJECTION_EQUIRECTANGULAR
Equirectangular/Plate Carrée projection, simple lat/lon grid.
DECL_EXP bool GetEnableMUIBar(int CanvasIndex)
Gets MUI bar visibility state.
DECL_EXP bool CheckMUIEdgePan_PlugIn(int x, int y, bool dragging, int margin, int delta, int canvasIndex)
Checks if chart should pan when cursor near edge.
DECL_EXP void EnableTouchMode(bool enable)
Enables/disables touch interface mode.
DECL_EXP void PluginZoomCanvas(int CanvasIndex, double factor)
Zoom a specific chart canvas by the given factor.
DECL_EXP wxString GetActiveWaypointGUID(void)
Gets GUID of currently active waypoint.
DECL_EXP bool AddSingleWaypointExV2(PlugIn_Waypoint_ExV2 *pwaypoint, bool b_permanent=true)
Adds a waypoint with extended V2 properties.
DECL_EXP void GetCanvasLLPix(PlugIn_ViewPort *vp, wxPoint p, double *plat, double *plon)
Converts canvas physical pixel coordinates to lat/lon.
DECL_EXP bool GetEnableLightDescriptionsDisplay(int CanvasIndex)
Gets light description text visibility.
enum _OBJECT_LAYER_REQ OBJECT_LAYER_REQ
Filter options for object queries.
DECL_EXP CommDriverResult RegisterTXPGNs(DriverHandle handle, std::vector< int > &pgn_list)
Register PGNs that this application intends to transmit for some NMEA 2000 adapters like Actisense NG...
DECL_EXP void SendPluginMessage(wxString message_id, wxString message_body)
Sends message to other plugins.
DECL_EXP wxString * GetpPrivateApplicationDataLocation()
Gets private application data directory.
DECL_EXP wxDialog * GetActiveOptionsDialog()
Gets pointer to active options dialog.
DECL_EXP void SetAppColorScheme(PI_ColorScheme cs)
Set the application color scheme.
DECL_EXP bool DeletePlugInTrack(wxString &GUID)
Deletes a track.
DECL_EXP bool GetEnableCurrentStationsDisplay(int CanvasIndex)
Gets current station icon visibility.
DECL_EXP int AddCanvasMenuItem(wxMenuItem *pitem, opencpn_plugin *pplugin, const char *name="")
Adds item to canvas context menu.
int DECL_EXP PI_PLIBRenderObjectToGL(const wxGLContext &glcc, PI_S57Obj *pObj, PlugIn_ViewPort *vp, wxRect &render_rect)
Renders any S57 object using OpenGL.
DECL_EXP bool GetEnableTideStationsDisplay(int CanvasIndex)
Gets tide station icon visibility.
DECL_EXP void SetCanvasMenuItemViz(int item, bool viz, const char *name="")
Temporarily changes context menu item visibility.
DECL_EXP void SetCanvasTilt(double tilt)
Gets current canvas tilt angle.
DECL_EXP std::vector< std::string > GetActivePriorityIdentifiers()
Gets list of active priority identifiers.
DECL_EXP void fromSM_Plugin(double x, double y, double lat0, double lon0, double *lat, double *lon)
Converts Simple Mercator coordinates to geographic.
DECL_EXP int GetCanvasCount()
Gets total number of chart canvases.
DECL_EXP void PluginSetFollowMode(int CanvasIndex, bool enable_follow)
Set follow mode for a specific canvas.
double DECL_EXP PI_GetPLIBMarinerSafetyContour()
Gets configured safety contour depth.
DECL_EXP void EnableLightsDisplay(bool enable, int CanvasIndex)
Controls light icon display.
PI_InitReturn
Return values for plugin initialization.
@ PI_INIT_OK
Initialization successful.
@ PI_INIT_FAIL_NOERROR
Init failed, request no explicit error message.
@ PI_INIT_FAIL_RETRY
Init failed, retry suggested.
@ PI_INIT_FAIL_REMOVE
Init failed, suggest remove from further use.
DECL_EXP void fromTM_Plugin(double x, double y, double lat0, double lon0, double *lat, double *lon)
Converts Transverse Mercator coordinates to geographic.
PI_DisCat DECL_EXP PI_GetObjectDisplayCategory(PI_S57Obj *pObj)
Gets display category for object.
DECL_EXP int RemoveChartFromDBInPlace(wxString &full_path)
Removes a chart from database without full rebuild.
DECL_EXP _OCPN_DLStatus OCPN_downloadFileBackground(const wxString &url, const wxString &outputFile, wxEvtHandler *handler, long *handle)
Asynchronously downloads a file in the background.
DECL_EXP wxString GetPluginDataDir(const char *plugin_name)
Returns an installed plugin's data directory given a plugin name.
DECL_EXP wxScrolledWindow * AddOptionsPage(OptionsParentPI parent, wxString title)
Adds a new preferences page to OpenCPN options dialog.
DECL_EXP bool GetTouchMode()
Gets touch interface mode state.
DECL_EXP wxString GetSelectedWaypointGUID_Plugin()
Gets GUID of currently selected waypoint.
DECL_EXP void ForceChartDBRebuild()
Forces complete rebuild of chart database.
OptionsParentPI
Enum defining parent pages in OpenCPN options dialog where plugins can add panels.
@ PI_OPTIONS_PARENT_DISPLAY
Display settings section.
@ PI_OPTIONS_PARENT_UI
User Interface section.
@ PI_OPTIONS_PARENT_SHIPS
Ships section.
@ PI_OPTIONS_PARENT_CHARTS
Charts section.
@ PI_OPTIONS_PARENT_PLUGINS
Plugins section.
@ PI_OPTIONS_PARENT_CONNECTIONS
Connections section.
DECL_EXP void SetToolbarToolViz(int item, bool viz)
Temporarily changes toolbar tool visibility.
int DECL_EXP PI_GetPLIBSymbolStyle()
Gets configured S52 symbol style.
DECL_EXP void EnableCompassGPSIcon(bool enable, int CanvasIndex)
Controls visibility of compass/GPS status icon.
int DECL_EXP PI_GetPLIBBoundaryStyle()
Gets configured S52 boundary style.
Configuration options for date and time formatting.
bool show_timezone
Whether to show timezone information in the formatted date/time string.
wxString format_string
The format string for date/time.
DateTimeFormatOptions & SetFormatString(const wxString &fmt)
Sets the date/time format pattern string.
DateTimeFormatOptions & SetShowTimezone(bool show)
Sets whether to show timezone information in the formatted output.
DateTimeFormatOptions & SetTimezone(const wxString &tz)
Sets the timezone mode for date/time display.
wxString time_zone
The timezone to use when formatting the date/time.
DateTimeFormatOptions & SetLongitude(double lon)
Sets the reference longitude for Local Mean Time (LMT) calculations.
double longitude
The longitude to use when formatting the date/time in Local Mean Time (LMT).
Identifier for NMEA 0183 sentence types.
const std::string id
Sentence identifier.
NMEA0183Id(const std::string &s)
Creates identifier from sentence type.
Identifier for NMEA 2000 message types.
const uint64_t id
The PGN value.
NMEA2000Id(int value)
Creates identifier from PGN value.
Navigation data message identifier.
const int type
Message type identifier (currently only 0 supported)
NavDataId()
Default constructor.
Facade for NotificationMsg.
Facade for NavAddrPluginMsg.
Basic navigation data structure.
double var
Magnetic variation in degrees.
double cog
Course over ground in degrees.
double lon
Longitude in decimal degrees.
double lat
Latitude in decimal degrees.
double sog
Speed over ground in knots.
double hdt
True heading in degrees.
time_t time
UTC timestamp of data.
Identifier for Signal K paths.
SignalkId(const std::string &s)
Creates identifier from Signal K path.
const std::string id
Signal K path.
Geographic extent structure defining a bounding box.
double NLAT
Northern latitude boundary in decimal degrees.
double WLON
Western longitude boundary in decimal degrees.
double SLAT
Southern latitude boundary in decimal degrees.
double ELON
Eastern longitude boundary in decimal degrees.