OpenCPN Partial API docs
Loading...
Searching...
No Matches
ocpn_plugin.h
Go to the documentation of this file.
1/**************************************************************************
2 * Copyright (C) 2010 - 2024 by David S. Register *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 **************************************************************************/
19
25#ifndef _PLUGIN_H_
26#define _PLUGIN_H_
27
28#ifndef DECL_EXP
29#if defined(__WXMSW__) || defined(__CYGWIN__)
30#define DECL_EXP __declspec(dllexport)
31#elif defined __GNUC__ && __GNUC__ >= 4
32#define DECL_EXP __attribute__((visibility("default")))
33#elif defined __WXOSX__
34#define DECL_EXP __attribute__((visibility("default")))
35#else
36#define DECL_EXP
37#endif
38#endif
39
40#if defined(__WXMSW__) && defined(MAKING_PLUGIN)
41#define DECL_IMP __declspec(dllimport)
42#else
43#define DECL_IMP
44#endif
45
46#include <cstdint>
47#include <functional>
48#include <memory>
49#include <string>
50#include <vector>
51#include <unordered_map>
52
53#include <wx/arrstr.h>
54#include <wx/aui/framemanager.h>
55#include <wx/bitmap.h>
56#include <wx/colour.h>
57#include <wx/cursor.h>
58#include <wx/dcmemory.h>
59#include <wx/dialog.h>
60#include <wx/event.h>
61#include <wx/fileconf.h>
62#include <wx/gdicmn.h>
63#include <wx/menuitem.h>
64#include <wx/notebook.h>
65#include <wx/region.h>
66#include <wx/scrolwin.h>
67#include <wx/xml/xml.h>
68
69// This is the most modern API Version number
70// It is expected that the API will remain downward compatible, meaning that
71// PlugIns conforming to API Version less than the most modern will also
72// be correctly supported.
73#define API_VERSION_MAJOR 1
74#define API_VERSION_MINOR 21
75
76// Using the correct #include <wx/glcanvas.h> causes compilation errors
77// on windows, probably errors in bundled and partly modified GL headers.
78// For now, use this as work around.
79class wxGLContext;
80class wxGLCanvas;
81
82//---------------------------------------------------------------------------------------------------------
83//
84// Bitfield PlugIn Capabilities flag definition
85//
86//---------------------------------------------------------------------------------------------------------
90#define WANTS_OVERLAY_CALLBACK 0x00000001
94#define WANTS_CURSOR_LATLON 0x00000002
104#define WANTS_TOOLBAR_CALLBACK 0x00000004
110#define INSTALLS_TOOLBAR_TOOL 0x00000008
113#define WANTS_CONFIG 0x00000010
116#define INSTALLS_TOOLBOX_PAGE 0x00000020
119#define INSTALLS_CONTEXTMENU_ITEMS 0x00000040
122#define WANTS_NMEA_SENTENCES 0x00000080
126#define WANTS_NMEA_EVENTS 0x00000100
129#define WANTS_AIS_SENTENCES 0x00000200
132#define USES_AUI_MANAGER 0x00000400
135#define WANTS_PREFERENCES 0x00000800
138#define INSTALLS_PLUGIN_CHART 0x00001000
141#define WANTS_ONPAINT_VIEWPORT 0x00002000
144#define WANTS_PLUGIN_MESSAGING 0x00004000
145#define WANTS_OPENGL_OVERLAY_CALLBACK 0x00008000
146#define WANTS_DYNAMIC_OPENGL_OVERLAY_CALLBACK 0x00010000
149#define WANTS_LATE_INIT 0x00020000
152#define INSTALLS_PLUGIN_CHART_GL 0x00040000
155#define WANTS_MOUSE_EVENTS 0x00080000
158#define WANTS_VECTOR_CHART_OBJECT_INFO 0x00100000
161#define WANTS_KEYBOARD_EVENTS 0x00200000
164#define WANTS_PRESHUTDOWN_HOOK 0x00400000
165
166#define WANTS_TIDECURRENT_CLICK 0x00800000
167
189#define OVERLAY_LEGACY 0
190
199#define OVERLAY_OVER_SHIPS 64
200
209#define OVERLAY_OVER_EMBOSS 96
210
220#define OVERLAY_OVER_UI 128
221
225#define OVERLAY_CHARTS 256
226
227//----------------------------------------------------------------------------------------------------------
228// Some PlugIn API interface object class definitions
229//----------------------------------------------------------------------------------------------------------
249
254public:
255 double clat;
256 double clon;
258 double skew;
259 double rotation;
260
262
265 wxRect rv_rect;
266 bool b_quilt;
269
270 double lat_min;
271 double lat_max;
272 double lon_min;
273 double lon_max;
274
275 bool
277};
278
283public:
284 double Lat;
285 double Lon;
286 double Cog;
287 double Sog;
288 double Var;
289 time_t FixTime;
290 int nSats;
291};
303public:
310 double Lat;
311
318 double Lon;
319
323 double Cog;
324
329 double Sog;
330
332 double Var;
333
338 double Hdm;
339
345 double Hdt;
346
352 time_t FixTime;
353
360 int nSats;
361};
362
367public:
368 double Xte;
370 double Btw;
371 double Dtw;
372 wxString wp_name;
373 bool arrival;
375};
376
385
390public:
391 int MMSI;
392 int Class;
394 double SOG;
395 double COG;
396 double HDG;
397 double Lon;
398 double Lat;
399 int ROTAIS;
400 char CallSign[8];
401 char ShipName[21];
402 unsigned char ShipType;
403 int IMO;
404
405 double Range_NM;
406 double Brg;
407
408 // Per target collision parameters
410 double TCPA;
411 double CPA;
412
414};
415
430
440
450
473
477typedef struct _ExtentPI {
478 double SLAT;
479 double WLON;
480 double NLAT;
481 double ELON;
483
484// PlugInChartBase::Init() init_flags constants
487#define PI_FULL_INIT 0
490#define PI_HEADER_ONLY 1
492#define PI_THUMB_ONLY 2
493
507class DECL_EXP PlugInChartBase : public wxObject {
508public:
509 // These methods Must be overriden in any derived class
511 virtual ~PlugInChartBase();
512
533 virtual wxString GetFileSearchMask(void);
534
559 virtual int Init(const wxString &full_path, int init_flags);
560
580 virtual void SetColorScheme(int cs, bool bApplyImmediate);
581
602 virtual double GetNormalScaleMin(double canvas_scale_factor,
603 bool b_allow_overzoom);
621 virtual double GetNormalScaleMax(double canvas_scale_factor,
622 int canvas_width);
637 virtual double GetNearestPreferredScalePPM(double target_scale_ppm);
638
656 virtual bool GetChartExtent(ExtentPI *pext);
657
684 virtual wxBitmap &RenderRegionView(const PlugIn_ViewPort &VPoint,
685 const wxRegion &Region);
686
701 virtual bool AdjustVP(PlugIn_ViewPort &vp_last, PlugIn_ViewPort &vp_proposed);
702
718 virtual void GetValidCanvasRegion(const PlugIn_ViewPort &VPoint,
719 wxRegion *pValidRegion);
720
738 virtual int GetCOVREntries() { return 0; }
739
755 virtual int GetCOVRTablePoints(int iTable) { return 0; }
756
770 virtual int GetCOVRTablenPoints(int iTable) { return 0; }
771
792 virtual float *GetCOVRTableHead(int iTable) { return (float *)NULL; }
793
816 virtual wxBitmap *GetThumbnail(int tnx, int tny, int cs);
817
818 // Accessors, need not be overridden in derived class if the member
819 // variables are maintained
820
834 virtual wxString GetFullPath() const { return m_FullPath; }
835
857 virtual ChartTypeEnumPI GetChartType() { return m_ChartType; }
858
872 virtual ChartFamilyEnumPI GetChartFamily() { return m_ChartFamily; }
873
893 virtual OcpnProjTypePI GetChartProjection() { return m_projection; }
894
907 virtual wxString GetName() { return m_Name; }
908
919 virtual wxString GetDescription() { return m_Description; }
920
932 virtual wxString GetID() { return m_ID; }
933
947 virtual wxString GetSE() { return m_SE; }
948
964 virtual wxString GetDepthUnits() { return m_DepthUnits; }
965
982 virtual wxString GetSoundingsDatum() { return m_SoundingsDatum; }
983
999 virtual wxString GetDatumString() { return m_datum_str; }
1000
1014 virtual wxString GetExtraInfo() { return m_ExtraInfo; }
1015
1028 virtual wxString GetPubDate() { return m_PubYear; }
1029
1043 virtual double GetChartErrorFactor() { return m_Chart_Error_Factor; }
1044
1060 virtual ChartDepthUnitTypePI GetDepthUnitId() { return m_depth_unit_id; }
1061
1076 virtual bool IsReadyToRender() { return m_bReadyToRender; }
1077
1090 virtual int GetNativeScale() { return m_Chart_Scale; };
1091
1104 virtual double GetChartSkew() { return m_Chart_Skew; }
1105
1118 virtual wxDateTime GetEditionDate(void) { return m_EdDate; }
1119
1120 // Methods pertaining to CHART_FAMILY_RASTER type PlugIn charts only
1121
1140 virtual void ComputeSourceRectangle(const PlugIn_ViewPort &vp,
1141 wxRect *pSourceRect);
1142
1157 virtual double GetRasterScaleFactor();
1158
1179 virtual bool GetChartBits(wxRect &source, unsigned char *pPix, int sub_samp);
1180
1192 virtual int GetSize_X();
1193
1205 virtual int GetSize_Y();
1206
1221 virtual void latlong_to_chartpix(double lat, double lon, double &pixx,
1222 double &pixy);
1223
1238 virtual void chartpix_to_latlong(double pixx, double pixy, double *plat,
1239 double *plon);
1240
1241protected:
1242 ChartTypeEnumPI m_ChartType;
1243 ChartFamilyEnumPI m_ChartFamily;
1244
1245 wxString m_FullPath;
1246 OcpnProjTypePI m_projection;
1247 int m_Chart_Scale;
1248 double m_Chart_Skew;
1249
1250 wxDateTime m_EdDate;
1251 bool m_bReadyToRender;
1252
1253 wxString m_Name;
1254 wxString m_Description;
1255 wxString m_ID;
1256 wxString m_SE;
1257 wxString m_SoundingsDatum;
1258 wxString m_datum_str;
1259 wxString m_PubYear;
1260 wxString m_DepthUnits;
1261 wxString m_ExtraInfo;
1262
1263 ChartDepthUnitTypePI m_depth_unit_id;
1264
1265 double m_Chart_Error_Factor;
1266};
1267
1268// Declare an array of PlugIn_AIS_Targets
1269WX_DEFINE_ARRAY_PTR(PlugIn_AIS_Target *, ArrayOfPlugIn_AIS_Targets);
1270
1271// Support for plugin Tide/Current access
1272typedef enum TideStationType {
1273 TIDE_STATION = 0,
1274 CURRENT_STATION
1275} _TideStationType;
1276
1278 TideStationType point_type;
1279 int index;
1280 std::string name;
1281 int tz_offset_minutes;
1282 std::function<bool(time_t, int, float &, float &)> getTide;
1283};
1284
1285// Tide query API for plugins
1287 int index;
1288 char name[90];
1289 double lat;
1290 double lon;
1291};
1292
1307class DECL_EXP opencpn_plugin {
1308public:
1309 opencpn_plugin(void *pmgr) {}
1310 virtual ~opencpn_plugin();
1311
1312 // Public API to the PlugIn class
1313
1314 // This group of methods is required, and will be called by the opencpn
1315 // host opencpn PlugIns must implement this group
1316
1331 virtual int Init(void);
1332
1342 virtual bool DeInit(void);
1343
1356 virtual int GetAPIVersionMajor();
1357
1370 virtual int GetAPIVersionMinor();
1371
1383 virtual int GetPlugInVersionMajor();
1384
1396 virtual int GetPlugInVersionMinor();
1397
1410 virtual wxBitmap *GetPlugInBitmap();
1411
1412 // These three methods should produce valid, meaningful strings always
1413 // ---EVEN IF--- the PlugIn has not (yet) been initialized.
1414 // They are used by the PlugInManager GUI
1415
1427 virtual wxString GetCommonName();
1428
1440 virtual wxString GetShortDescription();
1441
1455 virtual wxString GetLongDescription();
1456
1457 // This group is optional.
1458 // PlugIns may override any of these methods as required
1459
1471 virtual void SetDefaults(void);
1472
1486 virtual int GetToolbarToolCount(void);
1487
1500 virtual int GetToolboxPanelCount(void);
1501
1516 virtual void SetupToolboxPanel(int page_sel, wxNotebook *pnotebook);
1517
1533 virtual void OnCloseToolboxPanel(int page_sel, int ok_apply_cancel);
1534
1548 virtual void ShowPreferencesDialog(wxWindow *parent);
1549
1575 virtual bool RenderOverlay(wxMemoryDC *pmdc, PlugIn_ViewPort *vp);
1576
1590 virtual void SetCursorLatLon(double lat, double lon);
1609 virtual void SetCurrentViewPort(PlugIn_ViewPort &vp);
1610
1636 virtual void SetPositionFix(PlugIn_Position_Fix &pfix);
1651 virtual void SetNMEASentence(wxString &sentence);
1668 virtual void SetAISSentence(wxString &sentence);
1669
1679 virtual void ProcessParentResize(int x, int y);
1680
1695 virtual void SetColorScheme(PI_ColorScheme cs);
1696
1705 virtual void OnToolbarToolCallback(int id);
1706
1715 virtual void OnContextMenuItemCallback(int id);
1716
1724 virtual void UpdateAuiStatus(void);
1725
1737 virtual wxArrayString GetDynamicChartClassNameArray(void);
1738};
1739
1740// the types of the class factories used to create PlugIn instances
1741typedef opencpn_plugin *create_t(void *);
1742typedef void destroy_t(opencpn_plugin *);
1743
1744#ifdef __clang__
1745#pragma clang diagnostic push
1746#pragma clang diagnostic ignored "-Woverloaded-virtual"
1747#endif
1748
1749class DECL_EXP opencpn_plugin_16 : public opencpn_plugin {
1750public:
1751 opencpn_plugin_16(void *pmgr);
1752 virtual ~opencpn_plugin_16();
1753
1755
1793 virtual bool RenderOverlay(wxDC &dc, PlugIn_ViewPort *vp);
1794
1809 virtual void SetPluginMessage(wxString &message_id, wxString &message_body);
1810};
1811
1812class DECL_EXP opencpn_plugin_17 : public opencpn_plugin {
1813public:
1814 opencpn_plugin_17(void *pmgr);
1815 virtual ~opencpn_plugin_17();
1816
1818
1819 virtual bool RenderOverlay(wxDC &dc, PlugIn_ViewPort *vp);
1820 virtual bool RenderGLOverlay(wxGLContext *pcontext, PlugIn_ViewPort *vp);
1821
1822 virtual void SetPluginMessage(wxString &message_id, wxString &message_body);
1823};
1824
1825class DECL_EXP opencpn_plugin_18 : public opencpn_plugin {
1826public:
1827 opencpn_plugin_18(void *pmgr);
1828 virtual ~opencpn_plugin_18();
1829
1831
1832 virtual bool RenderOverlay(wxDC &dc, PlugIn_ViewPort *vp);
1870 virtual bool RenderGLOverlay(wxGLContext *pcontext, PlugIn_ViewPort *vp);
1871 virtual void SetPluginMessage(wxString &message_id, wxString &message_body);
1872
1893 virtual void SetPositionFixEx(PlugIn_Position_Fix_Ex &pfix);
1894};
1895
1896#ifdef __clang__
1897#pragma clang diagnostic pop
1898#endif
1899
1900class DECL_EXP opencpn_plugin_19 : public opencpn_plugin_18 {
1901public:
1902 opencpn_plugin_19(void *pmgr);
1903 virtual ~opencpn_plugin_19();
1904
1912 virtual void OnSetupOptions(void);
1913};
1914
1915class DECL_EXP opencpn_plugin_110 : public opencpn_plugin_19 {
1916public:
1917 opencpn_plugin_110(void *pmgr);
1918 virtual ~opencpn_plugin_110();
1919
1920 virtual void LateInit(void); // If WANTS_LATE_INIT is returned by Init()
1921};
1922
1924public:
1925 opencpn_plugin_111(void *pmgr);
1926 virtual ~opencpn_plugin_111();
1927};
1928
1930public:
1931 opencpn_plugin_112(void *pmgr);
1932 virtual ~opencpn_plugin_112();
1933
1943 virtual bool MouseEventHook(wxMouseEvent &event);
1944
1959 virtual void SendVectorChartObjectInfo(wxString &chart, wxString &feature,
1960 wxString &objname, double lat,
1961 double lon, double scale,
1962 int nativescale);
1963};
1964
1966public:
1967 opencpn_plugin_113(void *pmgr);
1968 virtual ~opencpn_plugin_113();
1969
1979 virtual bool KeyboardEventHook(wxKeyEvent &event);
1980
1988 virtual void OnToolbarToolDownCallback(int id);
1989
1997 virtual void OnToolbarToolUpCallback(int id);
1998};
1999
2001public:
2002 opencpn_plugin_114(void *pmgr);
2003 virtual ~opencpn_plugin_114();
2004};
2005
2007public:
2008 opencpn_plugin_115(void *pmgr);
2009 virtual ~opencpn_plugin_115();
2010};
2011
2013public:
2014 opencpn_plugin_116(void *pmgr);
2015 virtual ~opencpn_plugin_116();
2048 virtual bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext,
2049 PlugIn_ViewPort *vp, int canvasIndex);
2050
2083 virtual bool RenderOverlayMultiCanvas(wxDC &dc, PlugIn_ViewPort *vp,
2084 int canvasIndex);
2093 virtual void PrepareContextMenu(int canvasIndex);
2094};
2095
2097public:
2098 opencpn_plugin_117(void *pmgr);
2105 virtual int GetPlugInVersionPatch();
2106
2108 virtual int GetPlugInVersionPost();
2109
2111 virtual const char *GetPlugInVersionPre();
2112
2114 virtual const char *GetPlugInVersionBuild();
2115
2116 /*Provide active leg data to plugins*/
2117 virtual void SetActiveLegInfo(Plugin_Active_Leg_Info &leg_info);
2118};
2119
2121public:
2122 opencpn_plugin_118(void *pmgr);
2123
2126
2184#ifdef _MSC_VER
2185 virtual bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext,
2186 PlugIn_ViewPort *vp, int canvasIndex,
2187 int priority = -1);
2188#else
2189 virtual bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext,
2190 PlugIn_ViewPort *vp, int canvasIndex,
2191 int priority);
2192
2193 bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext, PlugIn_ViewPort *vp,
2194 int canvas_ix) override {
2195 return RenderGLOverlayMultiCanvas(pcontext, vp, canvas_ix, -1);
2196 }
2197#endif
2198
2254#ifdef _MSC_VER
2255 virtual bool RenderOverlayMultiCanvas(wxDC &dc, PlugIn_ViewPort *vp,
2256 int canvasIndex, int priority = -1);
2257#else
2258 virtual bool RenderOverlayMultiCanvas(wxDC &dc, PlugIn_ViewPort *vp,
2259 int canvas_ix, int priority);
2261 int canvas_ix) override {
2262 return RenderOverlayMultiCanvas(dc, vp, canvas_ix, -1);
2263 }
2264#endif
2265};
2266
2268public:
2269 opencpn_plugin_119(void *pmgr);
2270
2288 virtual void PreShutdownHook();
2289};
2290
2292public:
2293 opencpn_plugin_120(void *pmgr);
2294
2295 virtual void OnContextMenuItemCallbackExt(int id, std::string obj_ident,
2296 std::string obj_type, double lat,
2297 double lon);
2298};
2299
2301public:
2302 opencpn_plugin_121(void *pmgr);
2303 virtual void UpdateFollowState(int canvas_index, bool state);
2304 virtual void OnTideCurrentClick(TCClickInfo info);
2305};
2306
2307//------------------------------------------------------------------
2308// Route and Waypoint PlugIn support
2309//
2310//------------------------------------------------------------------
2311
2323class DECL_EXP Plugin_Hyperlink {
2324public:
2325 wxString DescrText;
2326 wxString Link;
2327 wxString Type;
2328};
2329
2330WX_DECLARE_LIST(Plugin_Hyperlink, Plugin_HyperlinkList);
2331
2346class DECL_EXP PlugIn_Waypoint {
2347public:
2352
2362 PlugIn_Waypoint(double lat, double lon, const wxString &icon_ident,
2363 const wxString &wp_name, const wxString &GUID = _T(""));
2365
2366 double m_lat;
2367 double m_lon;
2368 wxString m_GUID;
2369 wxString m_MarkName;
2371 wxDateTime m_CreateTime;
2373 wxString m_IconName;
2374
2375 Plugin_HyperlinkList *m_HyperlinkList;
2376};
2377
2378WX_DECLARE_LIST(PlugIn_Waypoint, Plugin_WaypointList);
2379
2386class DECL_EXP PlugIn_Route {
2387public:
2388 PlugIn_Route(void);
2389 ~PlugIn_Route(void);
2390
2391 wxString m_NameString;
2392 wxString m_StartString;
2393 wxString m_EndString;
2394 wxString m_GUID;
2395
2400 Plugin_WaypointList *pWaypointList;
2401};
2402
2416class DECL_EXP PlugIn_Track {
2417public:
2418 PlugIn_Track(void);
2419 ~PlugIn_Track(void);
2420
2421 wxString m_NameString;
2422 wxString m_StartString;
2423 wxString m_EndString;
2424 wxString m_GUID;
2425
2432 Plugin_WaypointList *pWaypointList;
2433};
2434
2435//----------------------------------------------------------------------------------------------------------
2436// The PlugIn CallBack API Definition
2437//
2438// The API back up to the PlugIn Manager
2439// PlugIns may call these static functions as necessary for system services
2440//
2441//----------------------------------------------------------------------------------------------------------
2442
2463extern "C" DECL_EXP int InsertPlugInTool(wxString label, wxBitmap *bitmap,
2464 wxBitmap *bmpRollover, wxItemKind kind,
2465 wxString shortHelp, wxString longHelp,
2466 wxObject *clientData, int position,
2467 int tool_sel, opencpn_plugin *pplugin);
2475extern "C" DECL_EXP void RemovePlugInTool(int tool_id);
2476
2485extern "C" DECL_EXP void SetToolbarToolViz(int item, bool viz);
2486
2495extern "C" DECL_EXP void SetToolbarItemState(int item, bool toggle);
2496
2506extern "C" DECL_EXP void SetToolbarToolBitmaps(int item, wxBitmap *bitmap,
2507 wxBitmap *bmpRollover);
2526extern "C" DECL_EXP int InsertPlugInToolSVG(
2527 wxString label, wxString SVGfile, wxString SVGfileRollover,
2528 wxString SVGfileToggled, wxItemKind kind, wxString shortHelp,
2529 wxString longHelp, wxObject *clientData, int position, int tool_sel,
2530 opencpn_plugin *pplugin);
2531
2542extern "C" DECL_EXP void SetToolbarToolBitmapsSVG(int item, wxString SVGfile,
2543 wxString SVGfileRollover,
2544 wxString SVGfileToggled);
2554extern "C" DECL_EXP int AddCanvasContextMenuItem(wxMenuItem *pitem,
2555 opencpn_plugin *pplugin);
2563extern "C" DECL_EXP void RemoveCanvasContextMenuItem(int item);
2564
2573extern "C" DECL_EXP void SetCanvasContextMenuItemViz(int item, bool viz);
2574
2583extern "C" DECL_EXP void SetCanvasContextMenuItemGrey(int item, bool grey);
2584
2594extern "C" DECL_EXP wxFileConfig *GetOCPNConfigObject(void);
2595
2603extern "C" DECL_EXP void RequestRefresh(wxWindow *);
2604
2620extern "C" DECL_EXP bool GetGlobalColor(wxString colorName, wxColour *pcolour);
2621
2633extern "C" DECL_EXP void GetCanvasPixLL(PlugIn_ViewPort *vp, wxPoint *pp,
2634 double lat, double lon);
2646extern "C" DECL_EXP void GetCanvasLLPix(PlugIn_ViewPort *vp, wxPoint p,
2647 double *plat, double *plon);
2655extern "C" DECL_EXP wxWindow *GetOCPNCanvasWindow();
2656
2695extern "C" DECL_EXP wxFont *OCPNGetFont(wxString TextElement,
2696 int default_size = 0);
2697
2710extern "C" DECL_EXP wxString *GetpSharedDataLocation();
2711
2720extern "C" DECL_EXP ArrayOfPlugIn_AIS_Targets *GetAISTargetArray(void);
2721
2731extern "C" DECL_EXP wxAuiManager *GetFrameAuiManager(void);
2732
2741extern "C" DECL_EXP bool AddLocaleCatalog(wxString catalog);
2742
2750extern "C" DECL_EXP void PushNMEABuffer(wxString str);
2751
2761extern DECL_EXP wxXmlDocument GetChartDatabaseEntryXML(int dbIndex,
2762 bool b_getGeom);
2773extern DECL_EXP bool UpdateChartDBInplace(wxArrayString dir_array,
2774 bool b_force_update,
2775 bool b_ProgressDialog);
2783extern DECL_EXP wxArrayString GetChartDBDirArrayString();
2784
2793extern "C" DECL_EXP void SendPluginMessage(wxString message_id,
2794 wxString message_body);
2802extern "C" DECL_EXP void DimeWindow(wxWindow *);
2803
2811extern "C" DECL_EXP void JumpToPosition(double lat, double lon, double scale);
2812
2813/* API 1.9 adds some common cartographic functions to avoid unnecessary code
2814 * duplication */
2815/* Study the original OpenCPN source (georef.c) for functional definitions */
2816
2841extern "C" DECL_EXP void PositionBearingDistanceMercator_Plugin(
2842 double lat, double lon, double brg, double dist, double *dlat,
2843 double *dlon);
2866extern "C" DECL_EXP void DistanceBearingMercator_Plugin(
2867 double lat0, double lon0, double lat1, double lon1, double *brg,
2868 double *dist);
2869
2879extern "C" DECL_EXP double DistGreatCircle_Plugin(double slat, double slon,
2880 double dlat, double dlon);
2891extern "C" DECL_EXP void toTM_Plugin(float lat, float lon, float lat0,
2892 float lon0, double *x, double *y);
2893
2904extern "C" DECL_EXP void fromTM_Plugin(double x, double y, double lat0,
2905 double lon0, double *lat, double *lon);
2906
2917extern "C" DECL_EXP void toSM_Plugin(double lat, double lon, double lat0,
2918 double lon0, double *x, double *y);
2919
2930extern "C" DECL_EXP void fromSM_Plugin(double x, double y, double lat0,
2931 double lon0, double *lat, double *lon);
2932
2943extern "C" DECL_EXP void toSM_ECC_Plugin(double lat, double lon, double lat0,
2944 double lon0, double *x, double *y);
2945
2956extern "C" DECL_EXP void fromSM_ECC_Plugin(double x, double y, double lat0,
2957 double lon0, double *lat,
2958 double *lon);
2959
2970extern "C" DECL_EXP bool DecodeSingleVDOMessage(const wxString &str,
2972 wxString *acc);
2973
2980extern "C" DECL_EXP int GetChartbarHeight(void);
3011extern "C" DECL_EXP bool GetActiveRoutepointGPX(char *buffer,
3012 unsigned int buffer_length);
3013
3014/* API 1.9 */
3015
3044
3059extern DECL_EXP wxScrolledWindow *AddOptionsPage(OptionsParentPI parent,
3060 wxString title);
3061
3069extern DECL_EXP bool DeleteOptionsPage(wxScrolledWindow *page);
3070
3071/* API 1.10 */
3072
3073/* API 1.10 adds some common functions to avoid unnecessary code duplication */
3074/* Study the original OpenCPN source for functional definitions */
3085extern "C" DECL_EXP double toUsrDistance_Plugin(double nm_distance,
3086 int unit = -1);
3087
3096extern "C" DECL_EXP double fromUsrDistance_Plugin(double usr_distance,
3097 int unit = -1);
3098
3107extern "C" DECL_EXP double toUsrSpeed_Plugin(double kts_speed, int unit = -1);
3108
3117extern "C" DECL_EXP double fromUsrSpeed_Plugin(double usr_speed, int unit = -1);
3118
3127extern "C" DECL_EXP double toUsrTemp_Plugin(double cel_temp, int unit = -1);
3128
3137extern "C" DECL_EXP double fromUsrTemp_Plugin(double usr_temp, int unit = -1);
3138
3146extern DECL_EXP wxString getUsrDistanceUnit_Plugin(int unit = -1);
3147
3155extern DECL_EXP wxString getUsrSpeedUnit_Plugin(int unit = -1);
3156
3164extern DECL_EXP wxString getUsrTempUnit_Plugin(int unit = -1);
3165
3173extern DECL_EXP wxString getUsrWindSpeedUnit_Plugin(int unit = -1);
3174
3183extern DECL_EXP double toUsrWindSpeed_Plugin(double kts_wspeed, int unit = -1);
3184
3193extern DECL_EXP double fromUsrWindSpeed_Plugin(double usr_wspeed,
3194 int unit = -1);
3195
3203extern DECL_EXP wxString getUsrDepthUnit_Plugin(int unit = -1);
3204
3213extern DECL_EXP double toUsrDepth_Plugin(double m_depth, int unit = -1);
3214
3223extern DECL_EXP double fromUsrDepth_Plugin(double usr_depth, int unit = -1);
3224
3232extern DECL_EXP wxString getUsrHeightUnit_Plugin(int unit = -1);
3233
3242extern DECL_EXP double toUsrHeight_Plugin(double m_height, int unit = -1);
3243
3252extern DECL_EXP double fromUsrHeight_Plugin(double usr_height, int unit = -1);
3253
3270extern DECL_EXP double fromDMM_PlugIn(wxString sdms);
3271
3285struct DECL_EXP DateTimeFormatOptions {
3287 virtual ~DateTimeFormatOptions();
3288
3309
3325 wxString time_zone;
3326
3334
3340
3341 int version = 1; // For future compatibility checks
3342
3362 format_string = fmt;
3363 return *this;
3364 }
3365
3384 DateTimeFormatOptions &SetTimezone(const wxString &tz) {
3385 time_zone = tz;
3386 return *this;
3387 }
3388
3396 show_timezone = show;
3397 return *this;
3398 }
3399
3418 longitude = lon;
3419 return *this;
3420 }
3421};
3422
3442extern DECL_EXP wxString toUsrDateTimeFormat_Plugin(
3443 const wxDateTime date_time,
3445
3457extern DECL_EXP wxString GetNewGUID();
3458
3471extern "C" DECL_EXP bool PlugIn_GSHHS_CrossesLand(double lat1, double lon1,
3472 double lat2, double lon2);
3479extern DECL_EXP void PlugInPlaySound(wxString &sound_file);
3480
3481// API 1.10 Route and Waypoint Support
3482
3491extern DECL_EXP wxBitmap *FindSystemWaypointIcon(wxString &icon_name);
3492
3503extern DECL_EXP bool AddCustomWaypointIcon(wxBitmap *pimage, wxString key,
3504 wxString description);
3505
3515extern DECL_EXP bool AddSingleWaypoint(PlugIn_Waypoint *pwaypoint,
3516 bool b_permanent = true);
3517
3526extern DECL_EXP bool DeleteSingleWaypoint(wxString &GUID);
3527
3536extern DECL_EXP bool UpdateSingleWaypoint(PlugIn_Waypoint *pwaypoint);
3537
3547extern DECL_EXP bool AddPlugInRoute(PlugIn_Route *proute,
3548 bool b_permanent = true);
3549
3558extern DECL_EXP bool DeletePlugInRoute(wxString &GUID);
3559
3569extern DECL_EXP bool UpdatePlugInRoute(PlugIn_Route *proute);
3570
3580extern DECL_EXP bool AddPlugInTrack(PlugIn_Track *ptrack,
3581 bool b_permanent = true);
3582
3591extern DECL_EXP bool DeletePlugInTrack(wxString &GUID);
3592
3602extern DECL_EXP bool UpdatePlugInTrack(PlugIn_Track *ptrack);
3603
3604/* API 1.11 */
3605
3606/* API 1.11 adds some more common functions to avoid unnecessary code
3607 * duplication */
3608
3617wxColour DECL_EXP GetBaseGlobalColor(wxString colorName);
3618
3632int DECL_EXP OCPNMessageBox_PlugIn(wxWindow *parent, const wxString &message,
3633 const wxString &caption = _T("Message"),
3634 int style = wxOK, int x = -1, int y = -1);
3635
3650extern DECL_EXP wxString toSDMM_PlugIn(int NEflag, double a,
3651 bool hi_precision = true);
3652
3662extern "C" DECL_EXP wxString *GetpPrivateApplicationDataLocation();
3663
3671extern DECL_EXP wxString GetOCPN_ExePath(void);
3672
3681extern "C" DECL_EXP wxString *GetpPlugInLocation();
3682
3691extern DECL_EXP wxString GetPlugInPath(opencpn_plugin *pplugin);
3692
3702extern "C" DECL_EXP int AddChartToDBInPlace(wxString &full_path,
3703 bool b_RefreshCanvas);
3710extern "C" DECL_EXP int RemoveChartFromDBInPlace(wxString &full_path);
3711
3720extern DECL_EXP wxString GetLocaleCanonicalName();
3721
3736#define PLIB_CAPS_LINE_VBO 1
3740#define PLIB_CAPS_LINE_BUFFER 1 << 1
3741
3745#define PLIB_CAPS_SINGLEGEO_BUFFER 1 << 2
3746
3750#define PLIB_CAPS_OBJSEGLIST 1 << 3
3751
3755#define PLIB_CAPS_OBJCATMUTATE 1 << 4
3756
3757class PI_S57Obj;
3758
3759WX_DECLARE_LIST(PI_S57Obj, ListOfPI_S57Obj);
3760
3761// ----------------------------------------------------------------------------
3762// PlugInChartBaseGL
3763// Derived from PlugInChartBase, add OpenGL Vector chart support
3764// ----------------------------------------------------------------------------
3765
3778class DECL_EXP PlugInChartBaseGL : public PlugInChartBase {
3779public:
3781 virtual ~PlugInChartBaseGL();
3782
3797 virtual int RenderRegionViewOnGL(const wxGLContext &glc,
3798 const PlugIn_ViewPort &VPoint,
3799 const wxRegion &Region, bool b_use_stencil);
3800
3813 virtual ListOfPI_S57Obj *GetObjRuleListAtLatLon(float lat, float lon,
3814 float select_radius,
3815 PlugIn_ViewPort *VPoint);
3816
3826 virtual wxString CreateObjDescriptions(ListOfPI_S57Obj *obj_list);
3827
3833 virtual int GetNoCOVREntries();
3834
3841 virtual int GetNoCOVRTablePoints(int iTable);
3842
3849 virtual int GetNoCOVRTablenPoints(int iTable);
3850
3857 virtual float *GetNoCOVRTableHead(int iTable);
3858};
3859
3860// ----------------------------------------------------------------------------
3861// PlugInChartBaseGLPlus2
3862// Derived from PlugInChartBaseGL, add additional chart management methods
3863// ----------------------------------------------------------------------------
3864
3874public:
3876 virtual ~PlugInChartBaseGLPlus2();
3877
3894 virtual ListOfPI_S57Obj *GetLightsObjRuleListVisibleAtLatLon(
3895 float lat, float lon, PlugIn_ViewPort *VPoint);
3896};
3897
3898// ----------------------------------------------------------------------------
3899// PlugInChartBaseExtended
3900// Derived from PlugInChartBase, add extended chart support methods
3901// ----------------------------------------------------------------------------
3902
3911public:
3913 virtual ~PlugInChartBaseExtended();
3914
3927 virtual int RenderRegionViewOnGL(const wxGLContext &glc,
3928 const PlugIn_ViewPort &VPoint,
3929 const wxRegion &Region, bool b_use_stencil);
3930
3941 virtual wxBitmap &RenderRegionViewOnDCNoText(const PlugIn_ViewPort &VPoint,
3942 const wxRegion &Region);
3943
3954 virtual bool RenderRegionViewOnDCTextOnly(wxMemoryDC &dc,
3955 const PlugIn_ViewPort &VPoint,
3956 const wxRegion &Region);
3957
3969 virtual int RenderRegionViewOnGLNoText(const wxGLContext &glc,
3970 const PlugIn_ViewPort &VPoint,
3971 const wxRegion &Region,
3972 bool b_use_stencil);
3973
3985 virtual int RenderRegionViewOnGLTextOnly(const wxGLContext &glc,
3986 const PlugIn_ViewPort &VPoint,
3987 const wxRegion &Region,
3988 bool b_use_stencil);
3989
3990 virtual ListOfPI_S57Obj *GetObjRuleListAtLatLon(float lat, float lon,
3991 float select_radius,
3992 PlugIn_ViewPort *VPoint);
3993 virtual wxString CreateObjDescriptions(ListOfPI_S57Obj *obj_list);
3994
3995 virtual int GetNoCOVREntries();
3996 virtual int GetNoCOVRTablePoints(int iTable);
3997 virtual int GetNoCOVRTablenPoints(int iTable);
3998 virtual float *GetNoCOVRTableHead(int iTable);
3999
4006 virtual void ClearPLIBTextList();
4007};
4008
4009// ----------------------------------------------------------------------------
4010// PlugInChartBaseExtendedPlus2
4011// Derived from PlugInChartBaseExtended, add additional extended chart support
4012// methods
4013// ----------------------------------------------------------------------------
4014
4016public:
4019
4020 virtual ListOfPI_S57Obj *GetLightsObjRuleListVisibleAtLatLon(
4021 float lat, float lon, PlugIn_ViewPort *VPoint);
4022};
4023
4024class wxArrayOfS57attVal;
4025
4044
4068
4097
4111
4137
4145class DECL_EXP PI_S57Obj {
4146public:
4147 // Public Methods
4148 PI_S57Obj();
4149
4150public:
4151 // Instance Data
4152 char FeatureName[8];
4154
4156 wxArrayOfS57attVal *attVal;
4158
4159 int iOBJL;
4160 int Index;
4161
4162 double x;
4163 double y;
4164 double z;
4165 int npt;
4166 void *geoPt;
4167 double *geoPtz;
4168 double *geoPtMulti;
4169
4171
4172 double m_lat;
4173 double m_lon;
4174
4177
4178 double lat_min;
4179 double lat_max;
4180 double lon_min;
4181 double lon_max;
4182
4184
4186 int nRef;
4187
4188 bool bIsAton;
4190
4195
4197
4201
4202 // Coordinate transform coefficients
4203 double x_rate;
4204 double y_rate;
4205 double x_origin;
4206 double y_origin;
4207
4208 // OpenGL rendering parameters
4213
4217};
4218
4224wxString DECL_EXP PI_GetPLIBColorScheme();
4233int DECL_EXP PI_GetPLIBDepthUnitInt();
4234
4242int DECL_EXP PI_GetPLIBSymbolStyle();
4243
4251int DECL_EXP PI_GetPLIBBoundaryStyle();
4252
4259int DECL_EXP PI_GetPLIBStateHash();
4260
4266double DECL_EXP PI_GetPLIBMarinerSafetyContour();
4267
4278bool DECL_EXP PI_GetObjectRenderBox(PI_S57Obj *pObj, double *lat_min,
4279 double *lat_max, double *lon_min,
4280 double *lon_max);
4281
4287void DECL_EXP PI_UpdateContext(PI_S57Obj *pObj);
4288
4296bool DECL_EXP PI_PLIBObjectRenderCheck(PI_S57Obj *pObj, PlugIn_ViewPort *vp);
4297
4310
4318
4326
4333void DECL_EXP PI_PLIBSetLineFeaturePriority(PI_S57Obj *pObj, int prio);
4334
4339void DECL_EXP PI_PLIBPrepareForNewRender(void);
4340
4346void DECL_EXP PI_PLIBFreeContext(void *pContext);
4347
4357void DECL_EXP PI_PLIBSetRenderCaps(unsigned int flags);
4358
4368bool DECL_EXP PI_PLIBSetContext(PI_S57Obj *pObj);
4369
4384int DECL_EXP PI_PLIBRenderObjectToDC(wxDC *pdc, PI_S57Obj *pObj,
4385 PlugIn_ViewPort *vp);
4386
4403int DECL_EXP PI_PLIBRenderAreaToDC(wxDC *pdc, PI_S57Obj *pObj,
4404 PlugIn_ViewPort *vp, wxRect rect,
4405 unsigned char *pixbuf);
4406
4421int DECL_EXP PI_PLIBRenderAreaToGL(const wxGLContext &glcc, PI_S57Obj *pObj,
4422 PlugIn_ViewPort *vp, wxRect &render_rect);
4423
4440int DECL_EXP PI_PLIBRenderObjectToGL(const wxGLContext &glcc, PI_S57Obj *pObj,
4441 PlugIn_ViewPort *vp, wxRect &render_rect);
4442
4443/* API 1.11 OpenGL Display List and vertex buffer object routines
4444
4445 Effectively these two routines cancel each other so all
4446 of the translation, scaling and rotation can be done by opengl.
4447
4448 Display lists need only be built infrequently, but used in each frame
4449 greatly accelerates the speed of rendering. This avoids costly calculations,
4450 and also allows the vertexes to be stored in graphics memory.
4451
4452 static int dl = 0;
4453 glPushMatrix();
4454 PlugInMultMatrixViewport(current_viewport);
4455 if(dl)
4456 glCallList(dl);
4457 else {
4458 dl = glGenLists(1);
4459 PlugInViewPort norm_viewport = current_viewport;
4460 NormalizeViewPort(norm_viewport);
4461 glNewList(dl, GL_COMPILE_AND_EXECUTE);
4462 ... // use norm_viewport with GetCanvasLLPix here
4463 glEndList();
4464 }
4465 glPopMatrix();
4466 ... // use current_viewport with GetCanvasLLPix again
4467*/
4468
4478extern DECL_EXP bool PlugInHasNormalizedViewPort(PlugIn_ViewPort *vp);
4479
4494extern DECL_EXP void PlugInMultMatrixViewport(PlugIn_ViewPort *vp,
4495 float lat = 0, float lon = 0);
4496
4511extern DECL_EXP void PlugInNormalizeViewport(PlugIn_ViewPort *vp, float lat = 0,
4512 float lon = 0);
4513
4514class wxPoint2DDouble;
4515
4527extern "C" DECL_EXP void GetDoubleCanvasPixLL(PlugIn_ViewPort *vp,
4528 wxPoint2DDouble *pp, double lat,
4529 double lon);
4530
4531/* API 1.13 */
4532/* API 1.13 adds some more common functions to avoid unnecessary code
4533 * duplication */
4534
4543extern DECL_EXP double fromDMM_Plugin(wxString sdms);
4544
4555extern DECL_EXP void SetCanvasRotation(double rotation);
4556
4568extern DECL_EXP void SetCanvasProjection(int projection);
4569
4579extern DECL_EXP bool GetSingleWaypoint(wxString GUID,
4580 PlugIn_Waypoint *pwaypoint);
4581
4594extern DECL_EXP bool CheckEdgePan_PlugIn(int x, int y, bool dragging,
4595 int margin, int delta);
4596
4605extern DECL_EXP wxBitmap GetIcon_PlugIn(const wxString &name);
4606
4614extern DECL_EXP void SetCursor_PlugIn(wxCursor *pPlugin_Cursor = NULL);
4615
4651extern DECL_EXP wxFont *GetOCPNScaledFont_PlugIn(wxString TextElement,
4652 int default_size = 0);
4653
4667extern DECL_EXP wxFont GetOCPNGUIScaledFont_PlugIn(wxString item);
4668
4684extern DECL_EXP double GetOCPNGUIToolScaleFactor_PlugIn(int GUIScaledFactor);
4685
4700extern DECL_EXP double GetOCPNGUIToolScaleFactor_PlugIn();
4701
4716extern DECL_EXP float GetOCPNChartScaleFactor_Plugin();
4717
4725extern DECL_EXP wxColour GetFontColour_PlugIn(wxString TextElement);
4726
4737extern DECL_EXP double GetCanvasTilt();
4738
4749extern DECL_EXP void SetCanvasTilt(double tilt);
4750
4756extern DECL_EXP bool PlugInPlaySoundEx(wxString &sound_file,
4757 int deviceIndex = -1);
4758
4771extern DECL_EXP void AddChartDirectory(wxString &path);
4772
4783extern DECL_EXP void ForceChartDBUpdate();
4784
4796extern DECL_EXP void ForceChartDBRebuild();
4797
4803extern DECL_EXP wxString GetWritableDocumentsDir(void);
4804
4810extern DECL_EXP wxDialog *GetActiveOptionsDialog();
4811
4822extern DECL_EXP wxArrayString GetWaypointGUIDArray(void);
4823
4829extern DECL_EXP wxArrayString GetIconNameArray(void);
4830
4841extern DECL_EXP bool AddPersistentFontKey(wxString TextElement);
4842
4854extern DECL_EXP wxString GetActiveStyleName();
4855
4871extern DECL_EXP wxBitmap GetBitmapFromSVGFile(wxString filename,
4872 unsigned int width,
4873 unsigned int height);
4874
4887extern DECL_EXP bool IsTouchInterface_PlugIn(void);
4888
4889/* Platform optimized File/Dir selector dialogs */
4908extern DECL_EXP int PlatformDirSelectorDialog(wxWindow *parent,
4909 wxString *file_spec,
4910 wxString Title, wxString initDir);
4911
4933extern DECL_EXP int PlatformFileSelectorDialog(wxWindow *parent,
4934 wxString *file_spec,
4935 wxString Title, wxString initDir,
4936 wxString suggestedName,
4937 wxString wildcard);
4938
4939/* OpenCPN HTTP File Download PlugIn Interface */
4940
4941/* Various method Return Codes, etc */
4956
4969
4970// Style definitions for Synchronous file download modal dialogs, if
4971// desired. Abstracted from wxCURL package
4975 0x0002,
4978 OCPN_DLDS_SIZE = 0x0010,
4981 0x0020,
4982
4983 // styles related to the use of wxCurlConnectionSettingsDialog:
4984
4986 0x0040,
4991 0x0100,
4992
4993 OCPN_DLDS_CONN_SETTINGS_ALL = OCPN_DLDS_CONN_SETTINGS_AUTH |
4996
4997 OCPN_DLDS_SHOW_ALL = OCPN_DLDS_ELAPSED_TIME | OCPN_DLDS_ESTIMATED_TIME |
5000 OCPN_DLDS_CONN_SETTINGS_ALL,
5001
5003 OCPN_DLDS_CAN_START = 0x0400,
5006
5008 0x1000,
5009
5010 // by default all available features are enabled:
5011 OCPN_DLDS_DEFAULT_STYLE = OCPN_DLDS_CAN_START | OCPN_DLDS_CAN_PAUSE |
5012 OCPN_DLDS_CAN_ABORT | OCPN_DLDS_SHOW_ALL |
5014};
5015
5016#define ONLINE_CHECK_RETRY \
5017 30 // Recheck the Internet connection availability every ONLINE_CHECK_RETRY s
5018
5039extern DECL_EXP _OCPN_DLStatus OCPN_downloadFile(
5040 const wxString &url, const wxString &outputFile, const wxString &title,
5041 const wxString &message, const wxBitmap &bitmap, wxWindow *parent,
5042 long style, int timeout_secs);
5043
5061extern DECL_EXP _OCPN_DLStatus
5062OCPN_downloadFileBackground(const wxString &url, const wxString &outputFile,
5063 wxEvtHandler *handler, long *handle);
5064
5070extern DECL_EXP void OCPN_cancelDownloadFileBackground(long handle);
5071
5083extern DECL_EXP _OCPN_DLStatus OCPN_postDataHttp(const wxString &url,
5084 const wxString &parameters,
5085 wxString &result,
5086 int timeout_secs);
5087
5093extern DECL_EXP bool OCPN_isOnline();
5094
5095/* Supporting Event for Background downloading */
5096/* OCPN_downloadEvent Definition */
5097
5098/* PlugIn should be ready/able to handle this event after initiating a
5099 * background file transfer
5100 *
5101 * The event as received should be parsed primarily by the getDLEventCondition()
5102 * method. This will allow identification of download start, progress, and end
5103 * states.
5104 *
5105 * Other accessor methods contain status, byte counts, etc.
5106 *
5107 * A PlugIn may safely destroy its EvtHandler after receipt of an
5108 * OCPN_downloadEvent with getDLEventCondition == OCPN_DL_EVENT_TYPE_END
5109 */
5110class DECL_EXP OCPN_downloadEvent : public wxEvent {
5111public:
5112 OCPN_downloadEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
5114
5115 // accessors
5116 _OCPN_DLStatus getDLEventStatus() { return m_stat; }
5117 OCPN_DLCondition getDLEventCondition() { return m_condition; }
5118
5119 void setDLEventStatus(_OCPN_DLStatus stat) { m_stat = stat; }
5120 void setDLEventCondition(OCPN_DLCondition cond) { m_condition = cond; }
5121
5122 void setTotal(long bytes) { m_totalBytes = bytes; }
5123 void setTransferred(long bytes) { m_sofarBytes = bytes; }
5124 long getTotal() { return m_totalBytes; }
5125 long getTransferred() { return m_sofarBytes; }
5126
5127 void setComplete(bool b_complete) { m_b_complete = b_complete; }
5128 bool getComplete() { return m_b_complete; }
5129
5130 // required for sending with wxPostEvent()
5131 wxEvent *Clone() const;
5132
5133private:
5134 OCPN_DLStatus m_stat;
5135 OCPN_DLCondition m_condition;
5136
5137 long m_totalBytes;
5138 long m_sofarBytes;
5139 bool m_b_complete;
5140};
5141
5142// extern WXDLLIMPEXP_CORE const wxEventType wxEVT_DOWNLOAD_EVENT;
5143
5144#ifdef MAKING_PLUGIN
5145extern DECL_IMP wxEventType wxEVT_DOWNLOAD_EVENT;
5146#else
5147extern DECL_EXP wxEventType wxEVT_DOWNLOAD_EVENT;
5148#endif
5149
5150/* API 1.14 */
5151/* API 1.14 adds some more common functions to avoid unnecessary code
5152 * duplication */
5153
5154extern DECL_EXP bool LaunchDefaultBrowser_Plugin(wxString url);
5155
5156// API 1.14 Extra canvas Support
5157
5173extern DECL_EXP void PlugInAISDrawGL(wxGLCanvas *glcanvas,
5174 const PlugIn_ViewPort &vp);
5175
5185extern DECL_EXP bool PlugInSetFontColor(const wxString TextElement,
5186 const wxColour color);
5187
5188// API 1.15
5189
5204extern DECL_EXP double PlugInGetDisplaySizeMM();
5205
5218extern DECL_EXP wxFont *FindOrCreateFont_PlugIn(
5219 int point_size, wxFontFamily family, wxFontStyle style, wxFontWeight weight,
5220 bool underline = false, const wxString &facename = wxEmptyString,
5221 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
5222
5242
5255
5269extern DECL_EXP void PlugInHandleAutopilotRoute(bool enable);
5270
5271// API 1.16
5272//
5287extern DECL_EXP wxString GetPluginDataDir(const char *plugin_name);
5288
5294extern DECL_EXP bool ShuttingDown(void);
5295
5296// Support for MUI MultiCanvas model
5297
5320extern DECL_EXP wxWindow *PluginGetFocusCanvas();
5321
5330extern DECL_EXP wxWindow *PluginGetOverlayRenderCanvas();
5331
5340extern "C" DECL_EXP void CanvasJumpToPosition(wxWindow *canvas, double lat,
5341 double lon, double scale);
5353extern "C" DECL_EXP int AddCanvasMenuItem(wxMenuItem *pitem,
5354 opencpn_plugin *pplugin,
5355 const char *name = "");
5364extern "C" DECL_EXP void RemoveCanvasMenuItem(int item, const char *name = "");
5365
5375extern "C" DECL_EXP void SetCanvasMenuItemViz(int item, bool viz,
5376 const char *name = "");
5377
5387extern "C" DECL_EXP void SetCanvasMenuItemGrey(int item, bool grey,
5388 const char *name = "");
5389
5390// Extract waypoints, routes and tracks
5396extern DECL_EXP wxString GetSelectedWaypointGUID_Plugin();
5397
5403extern DECL_EXP wxString GetSelectedRouteGUID_Plugin();
5404
5410extern DECL_EXP wxString GetSelectedTrackGUID_Plugin();
5411
5418extern DECL_EXP std::unique_ptr<PlugIn_Waypoint> GetWaypoint_Plugin(
5419 const wxString &);
5420
5427extern DECL_EXP std::unique_ptr<PlugIn_Route> GetRoute_Plugin(const wxString &);
5428
5435extern DECL_EXP std::unique_ptr<PlugIn_Track> GetTrack_Plugin(const wxString &);
5436
5442extern DECL_EXP wxWindow *GetCanvasUnderMouse();
5443
5457extern DECL_EXP int GetCanvasIndexUnderMouse();
5458
5459// extern DECL_EXP std::vector<wxWindow *> GetCanvasArray();
5472extern DECL_EXP wxWindow *GetCanvasByIndex(int canvasIndex);
5473
5484extern DECL_EXP int GetCanvasCount();
5485
5500extern DECL_EXP bool CheckMUIEdgePan_PlugIn(int x, int y, bool dragging,
5501 int margin, int delta,
5502 int canvasIndex);
5503
5512extern DECL_EXP void SetMUICursor_PlugIn(wxCursor *pCursor, int canvasIndex);
5513
5514// API 1.17
5515//
5516
5525extern DECL_EXP wxRect GetMasterToolbarRect();
5526
5546
5554extern DECL_EXP int GetLatLonFormat(void);
5555
5556// API 1.17
5557
5568extern "C" DECL_EXP void ZeroXTE();
5569
5593class DECL_EXP PlugIn_Waypoint_Ex {
5594public:
5596 PlugIn_Waypoint_Ex(double lat, double lon, const wxString &icon_ident,
5597 const wxString &wp_name, const wxString &GUID = "",
5598 const double ScaMin = 1e9, const bool bNameVisible = false,
5599 const int nRanges = 0, const double RangeDistance = 1.0,
5600 const wxColor RangeColor = wxColor(255, 0, 0));
5612 void InitDefaults();
5613
5625 bool GetFSStatus();
5626
5635 int GetRouteMembershipCount();
5636
5637 double m_lat;
5638 double m_lon;
5639 wxString m_GUID;
5640 wxString m_MarkName;
5642 wxDateTime m_CreateTime;
5645
5646 double scamin;
5649
5653
5654 wxString IconName;
5656
5662 Plugin_HyperlinkList *m_HyperlinkList;
5663};
5664
5665WX_DECLARE_LIST(PlugIn_Waypoint_Ex, Plugin_WaypointExList);
5666
5667class DECL_EXP PlugIn_Waypoint_ExV2 {
5668public:
5670 PlugIn_Waypoint_ExV2(double lat, double lon, const wxString &icon_ident,
5671 const wxString &wp_name, const wxString &GUID = "",
5672 const double ScaMin = 1e9, const double ScaMax = 1e6,
5673 const bool bNameVisible = false,
5674 const int nRangeRings = 0,
5675 const double RangeDistance = 1.0,
5676 const int RangeRingSpaceUnits = 0, // 0:nm, 1:km
5677 const wxColor RangeColor = wxColor(255, 0, 0),
5678 const double WaypointArrivalRadius = 0.0,
5679 const bool ShowWaypointRangeRings = false,
5680 const double PlannedSpeed = 0.0,
5681 const wxString TideStation = wxEmptyString);
5682
5683 virtual ~PlugIn_Waypoint_ExV2();
5684
5696 bool GetFSStatus();
5697
5706 int GetRouteMembershipCount();
5707
5708 double m_lat;
5709 double m_lon;
5710 wxString m_GUID;
5711 wxString m_MarkName;
5713 wxDateTime m_CreateTime;
5716
5717 double scamin;
5720
5725
5726 wxString IconName;
5728
5734 Plugin_HyperlinkList *m_HyperlinkList;
5735
5736 // New fields that are not in PlugIn_Waypoint_Ex
5737 double scamax;
5742 wxDateTime m_ETD;
5745
5746protected:
5757 void InitDefaults();
5758};
5759
5760WX_DECLARE_LIST(PlugIn_Waypoint_ExV2, Plugin_WaypointExV2List);
5761
5784class DECL_EXP PlugIn_Route_Ex {
5785public:
5786 PlugIn_Route_Ex(void);
5787 ~PlugIn_Route_Ex(void);
5788
5789 wxString m_NameString;
5790 wxString m_StartString;
5791 wxString m_EndString;
5792 wxString m_GUID;
5795 wxString m_Description;
5796
5802 Plugin_WaypointExList *pWaypointList;
5803};
5804
5819class DECL_EXP PlugIn_Route_ExV2 {
5820public:
5822 virtual ~PlugIn_Route_ExV2();
5823
5824 wxString m_NameString;
5825 wxString m_StartString;
5826 wxString m_EndString;
5827 wxString m_GUID;
5830 wxString m_Description;
5831
5837 Plugin_WaypointExV2List *pWaypointList;
5838};
5839
5847extern DECL_EXP wxArrayString GetRouteGUIDArray(void);
5848
5856extern DECL_EXP wxArrayString GetTrackGUIDArray(void);
5857
5865extern DECL_EXP bool GetSingleWaypointEx(wxString GUID,
5866 PlugIn_Waypoint_Ex *pwaypoint);
5867
5875extern DECL_EXP bool GetSingleWaypointExV2(wxString GUID,
5876 PlugIn_Waypoint_ExV2 *pwaypoint);
5877
5885extern DECL_EXP bool AddSingleWaypointEx(PlugIn_Waypoint_Ex *pwaypoint,
5886 bool b_permanent = true);
5887
5895extern DECL_EXP bool AddSingleWaypointExV2(PlugIn_Waypoint_ExV2 *pwaypoint,
5896 bool b_permanent = true);
5897
5904extern DECL_EXP bool UpdateSingleWaypointEx(PlugIn_Waypoint_Ex *pwaypoint);
5905
5912extern DECL_EXP bool UpdateSingleWaypointExV2(PlugIn_Waypoint_ExV2 *pwaypoint);
5913
5921extern DECL_EXP bool AddPlugInRouteEx(PlugIn_Route_Ex *proute,
5922 bool b_permanent = true);
5923
5930extern DECL_EXP bool AddPlugInRouteExV2(PlugIn_Route_ExV2 *proute,
5931 bool b_permanent = true);
5932
5939extern DECL_EXP bool UpdatePlugInRouteEx(PlugIn_Route_Ex *proute);
5940
5949extern DECL_EXP bool UpdatePlugInRouteExV2(PlugIn_Route_ExV2 *proute);
5950
5959extern DECL_EXP std::unique_ptr<PlugIn_Waypoint_Ex> GetWaypointEx_Plugin(
5960 const wxString &GUID);
5961
5970extern DECL_EXP std::unique_ptr<PlugIn_Waypoint_ExV2> GetWaypointExV2_Plugin(
5971 const wxString &GUID);
5972
5981extern DECL_EXP std::unique_ptr<PlugIn_Route_Ex> GetRouteEx_Plugin(
5982 const wxString &GUID);
5983
5992extern DECL_EXP std::unique_ptr<PlugIn_Route_ExV2> GetRouteExV2_Plugin(
5993 const wxString &GUID);
5994
6000extern DECL_EXP wxString GetActiveWaypointGUID(void);
6001
6007extern DECL_EXP wxString GetActiveRouteGUID(void);
6008
6009// API 1.18
6010
6025extern DECL_EXP double OCPN_GetDisplayContentScaleFactor();
6026
6041extern DECL_EXP double OCPN_GetWinDIPScaleFactor();
6042
6050extern DECL_EXP std::vector<std::string> GetPriorityMaps();
6051
6056extern DECL_EXP void UpdateAndApplyPriorityMaps(std::vector<std::string> map);
6057
6065extern DECL_EXP std::vector<std::string> GetActivePriorityIdentifiers();
6066
6074extern DECL_EXP int GetGlobalWatchdogTimoutSeconds();
6075
6087
6088// FIXME (dave) Implement these
6105extern DECL_EXP wxArrayString GetRouteGUIDArray(OBJECT_LAYER_REQ req);
6106
6122extern DECL_EXP wxArrayString GetTrackGUIDArray(OBJECT_LAYER_REQ req);
6123
6141extern DECL_EXP wxArrayString GetWaypointGUIDArray(OBJECT_LAYER_REQ req);
6142
6145/* Listening to messages. */
6146class ObservableListener;
6147
6149class ObservedEvt;
6150
6151// This is a verbatim copy from observable_evt.h, don't define twice.
6152#ifndef OBSERVABLE_EVT_H
6153#define OBSERVABLE_EVT_H
6154
6155wxDECLARE_EVENT(obsNOTIFY, ObservedEvt);
6156
6171class ObservedEvt : public wxCommandEvent {
6172public:
6179 ObservedEvt(wxEventType commandType = obsNOTIFY, int id = 0)
6180 : wxCommandEvent(commandType, id) {}
6181 ObservedEvt(const ObservedEvt &event) : wxCommandEvent(event) {
6182 this->m_shared_ptr = event.m_shared_ptr;
6183 }
6184
6192 wxEvent *Clone() const { return new ObservedEvt(*this); }
6193
6199 std::shared_ptr<const void> GetSharedPtr() const { return m_shared_ptr; }
6200
6206 void SetSharedPtr(std::shared_ptr<const void> p) { m_shared_ptr = p; }
6207
6208private:
6209 std::shared_ptr<const void> m_shared_ptr;
6210};
6211
6212#endif // OBSERVABLE_EVT_H
6213
6214class ObservableListener;
6215
6223 const uint64_t id;
6228 NMEA2000Id(int value) : id(static_cast<uint64_t>(value)) {};
6229};
6230
6241extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
6242 NMEA2000Id id, wxEventType ev, wxEvtHandler *handler);
6243
6251 const std::string id;
6256 NMEA0183Id(const std::string &s) : id(s) {};
6257};
6258
6269extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
6270 NMEA0183Id id, wxEventType ev, wxEvtHandler *handler);
6271
6279 const std::string id;
6284 SignalkId(const std::string &s) : id(s) {};
6285};
6286
6297extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
6298 SignalkId id, wxEventType ev, wxEvtHandler *handler);
6299
6315extern DECL_EXP std::vector<uint8_t> GetN2000Payload(NMEA2000Id id,
6316 ObservedEvt ev);
6317
6334extern DECL_EXP std::shared_ptr<void> GetSignalkPayload(ObservedEvt ev);
6335
6340extern DECL_EXP std::string GetN2000Source(NMEA2000Id id, ObservedEvt ev);
6341
6343extern DECL_EXP std::string GetN0183Payload(NMEA0183Id id, ObservedEvt ev);
6344
6352 const int type;
6357 NavDataId() : type(0) {}
6358};
6359
6371extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
6372 NavDataId id, wxEventType ev, wxEvtHandler *handler);
6373
6381 double lat;
6382 double lon;
6383 double sog;
6384 double cog;
6385 double var;
6386 double hdt;
6387 time_t time;
6388};
6389
6391extern DECL_EXP PluginNavdata GetEventNavdata(ObservedEvt ev);
6392
6394/*
6395 * Plugins may access comm ports for direct output.
6396 * The general program flow for a plugin may look something like this
6397 * pseudo-code:
6398 * 1. Plugin will query OCPN core for a list of active comm drivers.
6399 * 2. Plugin will inspect the list, and query OCPN core for driver
6400 * attributes.
6401 * 3. Plugin will select a comm driver with appropriate attributes for output.
6402 * 4. Plugin will register a list of PGNs expected to be transmitted
6403 * (N2K specific)
6404 * 5. Plugin may then send a payload buffer to a specific comm driver for
6405 * output as soon as possible.
6406 *
6407 * The mechanism for specifying a particular comm driver uses the notion of
6408 * "handles". Each active comm driver has an associated opaque handle, managed
6409 * by OCPN core. All references by a plugin to a driver are by means of its
6410 * handle. Handles should be considered to be "opaque", meaning that the exact
6411 * contents of the handle are of no specific value to the plugin, and only
6412 * have meaning to the OCPN core management of drivers.
6413 */
6414
6416typedef std::string DriverHandle;
6417
6440
6442extern DECL_EXP std::vector<DriverHandle> GetActiveDrivers();
6443
6458extern DECL_EXP const std::unordered_map<std::string, std::string>
6460
6461/* Writing to a specific driver */
6481extern DECL_EXP CommDriverResult WriteCommDriver(
6482 DriverHandle handle, const std::shared_ptr<std::vector<uint8_t>> &payload);
6483
6485extern DECL_EXP CommDriverResult WriteCommDriverN2K(
6486 DriverHandle handle, int PGN, int destinationCANAddress, int priority,
6487 const std::shared_ptr<std::vector<uint8_t>> &payload);
6488
6531extern DECL_EXP CommDriverResult RegisterTXPGNs(DriverHandle handle,
6532 std::vector<int> &pgn_list);
6533
6534// API 1.20
6535//
6536
6573
6576 const std::string id;
6577 PluginMsgId(const std::string &s) : id(s) {};
6578};
6579
6584extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
6585 PluginMsgId id, wxEventType ev, wxEvtHandler *handler);
6586
6591extern DECL_EXP std::string GetPluginMsgPayload(PluginMsgId id, ObservedEvt ev);
6592
6598extern DECL_EXP void ExitOCPN();
6599
6608extern "C" DECL_EXP void RequestWindowRefresh(wxWindow *win,
6609 bool eraseBackground);
6610
6616extern DECL_EXP bool GetFullScreen();
6617
6623extern DECL_EXP void SetFullScreen(bool full_screen_on);
6624
6630extern DECL_EXP void EnableTouchMode(bool enable);
6631
6637extern DECL_EXP bool GetTouchMode();
6638
6646extern DECL_EXP void SetGlobalColor(std::string table, std::string name,
6647 wxColor color);
6648
6656extern DECL_EXP wxColor GetGlobalColorD(std::string map_name, std::string name);
6657
6663extern DECL_EXP void EnableStatusBar(bool enable);
6664
6670extern DECL_EXP void EnableMenu(bool enable);
6671
6677extern DECL_EXP bool GetEnableStatusBar();
6678
6684extern DECL_EXP bool GetEnableMenu();
6685
6695extern DECL_EXP void SetNavigationMode(PI_NavMode mode, int CanvasIndex);
6696
6703extern DECL_EXP PI_NavMode GetNavigationMode(int CanvasIndex);
6704
6712extern DECL_EXP void EnableLookaheadMode(bool enable, int CanvasIndex);
6713
6720extern DECL_EXP bool GetEnableLookaheadMode(int CanvasIndex);
6721
6728extern DECL_EXP void EnableMUIBar(bool enable, int CanvasIndex);
6729
6736extern DECL_EXP void EnableCompassGPSIcon(bool enable, int CanvasIndex);
6737
6744extern DECL_EXP void EnableChartBar(bool enable, int CanvasIndex);
6745
6752extern DECL_EXP bool GetEnableMUIBar(int CanvasIndex);
6753
6760extern DECL_EXP bool GetEnableCompassGPSIcon(int CanvasIndex);
6761
6768extern DECL_EXP bool GetEnableChartBar(int CanvasIndex);
6769
6777extern DECL_EXP void EnableCanvasFocusBar(bool enable, int CanvasIndex);
6778
6785extern DECL_EXP bool GetEnableCanvasFocusBar(int CanvasIndex);
6786
6787/*
6788 * Allow plugin control of "Chart Panel Options" dialog
6789 */
6790
6797extern DECL_EXP void EnableLatLonGrid(bool enable, int CanvasIndex);
6798
6805extern DECL_EXP void EnableChartOutlines(bool enable, int CanvasIndex);
6806
6813extern DECL_EXP void EnableDepthUnitDisplay(bool enable, int CanvasIndex);
6814
6821extern DECL_EXP void EnableAisTargetDisplay(bool enable, int CanvasIndex);
6822
6829extern DECL_EXP void EnableTideStationsDisplay(bool enable, int CanvasIndex);
6830
6837extern DECL_EXP void EnableCurrentStationsDisplay(bool enable, int CanvasIndex);
6838
6845extern DECL_EXP void EnableENCTextDisplay(bool enable, int CanvasIndex);
6846
6853extern DECL_EXP void EnableENCDepthSoundingsDisplay(bool enable,
6854 int CanvasIndex);
6855
6862extern DECL_EXP void EnableBuoyLightLabelsDisplay(bool enable, int CanvasIndex);
6863
6870extern DECL_EXP void EnableLightsDisplay(bool enable, int CanvasIndex);
6871
6878extern DECL_EXP void EnableLightDescriptionsDisplay(bool enable,
6879 int CanvasIndex);
6880
6887extern DECL_EXP void SetENCDisplayCategory(PI_DisCat cat, int CanvasIndex);
6888
6895extern DECL_EXP bool GetEnableLatLonGrid(int CanvasIndex);
6896
6903extern DECL_EXP bool GetEnableChartOutlines(int CanvasIndex);
6904
6911extern DECL_EXP bool GetEnableDepthUnitDisplay(int CanvasIndex);
6912
6919extern DECL_EXP bool GetEnableAisTargetDisplay(int CanvasIndex);
6920
6927extern DECL_EXP bool GetEnableTideStationsDisplay(int CanvasIndex);
6928
6935extern DECL_EXP bool GetEnableCurrentStationsDisplay(int CanvasIndex);
6936
6943extern DECL_EXP bool GetEnableENCTextDisplay(int CanvasIndex);
6944
6951extern DECL_EXP bool GetEnableENCDepthSoundingsDisplay(int CanvasIndex);
6952
6959extern DECL_EXP bool GetEnableBuoyLightLabelsDisplay(int CanvasIndex);
6960
6967extern DECL_EXP bool GetEnableLightsDisplay(int CanvasIndex);
6968
6975extern DECL_EXP bool GetEnableLightDescriptionsDisplay(int CanvasIndex);
6976
6987extern DECL_EXP PI_DisCat GetENCDisplayCategory(int CanvasIndex);
6988
6997extern DECL_EXP void PluginSetFollowMode(int CanvasIndex, bool enable_follow);
6998
7005extern DECL_EXP bool PluginGetFollowMode(int CanvasIndex);
7006
7014extern DECL_EXP void SetTrackingMode(bool enable);
7015
7021extern DECL_EXP bool GetTrackingMode();
7022
7030extern DECL_EXP void SetAppColorScheme(PI_ColorScheme cs);
7031
7037extern DECL_EXP PI_ColorScheme GetAppColorScheme();
7038
7047extern DECL_EXP void EnableSplitScreenLayout(bool enable = true);
7048
7049// ChartCanvas control utilities
7050
7058extern DECL_EXP void PluginZoomCanvas(int CanvasIndex, double factor);
7059
7065extern DECL_EXP bool GetEnableMainToolbar();
7066
7072extern DECL_EXP void SetEnableMainToolbar(bool enable);
7073
7078extern DECL_EXP void ShowGlobalSettingsDialog();
7079
7085extern DECL_EXP void PluginCenterOwnship(int CanvasIndex);
7086
7094extern DECL_EXP bool GetEnableTenHertzUpdate();
7095
7102extern DECL_EXP void EnableTenHertzUpdate(bool enable);
7103
7109extern DECL_EXP void ConfigFlushAndReload();
7110
7111/*
7112 * Reload and restore all connections by direct read of config file
7113 */
7114extern DECL_EXP void ReloadConfigConnections();
7115
7119enum class PI_NotificationSeverity : int {
7120 PI_kInformational = 0,
7121 PI_kWarning = 1,
7122 PI_kCritical = 2
7123};
7124
7126public:
7128 const std::string &_message, int _timeout_start,
7129 int _timeout_left, std::string _guid);
7130 virtual ~PI_Notification() {};
7131
7132 PI_NotificationSeverity severity;
7133 std::string message;
7134 int auto_timeout_left;
7135 int auto_timeout_start;
7136 std::string guid;
7137 std::string action_verb; // Either "ACK" or "POST", when set by a
7138 // PI_Notification message payload.
7139 // Empty otherwise
7140};
7141
7142extern DECL_EXP int GetActiveNotificationCount();
7143extern DECL_EXP PI_NotificationSeverity GetMaxActiveNotificationLevel();
7144extern DECL_EXP std::string RaiseNotification(
7145 const PI_NotificationSeverity _severity, const std::string &_message,
7146 int timeout_secs = -1);
7147extern DECL_EXP bool AcknowledgeNotification(const std::string &guid);
7148extern DECL_EXP std::vector<std::shared_ptr<PI_Notification>>
7149GetActiveNotifications();
7150extern DECL_EXP void EnableNotificationCanvasIcon(bool enable);
7151
7152/*
7153 * Messaging interface for Notification Framework
7154 *
7155 */
7156
7157/*
7158 * Typical use pattern
7159 *
7160 * 1) Establish listener
7161 wxDEFINE_EVENT(EVT_NOTIFICATION_FRAME, ObservedEvt);
7162 static std::shared_ptr<ObservableListener> listener_note;
7163 NotificationMsgId note_id = NotificationMsgId();
7164 listener_note = GetListener(note_id, EVT_NOTIFICATION_FRAME, this);
7165 Bind(EVT_NOTIFICATION_FRAME, [&](ObservedEvt ev) { HandleNotification(ev); });
7166 *
7167 *
7168 *
7169 * 2) Define actions on receipt
7170 static void HandleNotification(ObservedEvt &ev) {
7171 NotificationMsgId id;
7172 std::shared_ptr<PI_Notification>payload=GetNotificationMsgPayload(id, ev);
7173 if (payload->action_verb == "ACK"){
7174 // Do Acknowledge notification actions
7175 }
7176 else if (payload->action_verb == "POST") {
7177 // Do Add Notification actions
7178 }
7179 }
7180
7181*/
7184 const std::string id;
7185 NotificationMsgId(const std::string &s) : id(s) {};
7186 NotificationMsgId() {};
7187};
7188
7193extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
7194 NotificationMsgId id, wxEventType ev, wxEvtHandler *handler);
7195
7199extern DECL_EXP std::shared_ptr<PI_Notification> GetNotificationMsgPayload(
7201
7202// * Plugin polled Comm Status support
7203enum class PI_Conn_Bus : int { N0183 = 0, Signalk = 1, N2000 = 2 };
7204
7205enum class PI_Comm_State : int {
7206 Disabled = 0,
7207 NoStats = 1,
7208 NoData = 2,
7209 Unavailable = 3,
7210 Ok = 4
7211};
7212
7214public:
7215 PI_Comm_State state;
7216 unsigned rx_count;
7217 unsigned tx_count;
7218 unsigned error_count;
7219};
7220
7221extern DECL_EXP PI_Comm_Status GetConnState(const std::string &iface,
7222 PI_Conn_Bus _bus);
7223
7224extern "C" DECL_EXP int AddCanvasContextMenuItemExt(
7225 wxMenuItem *pitem, opencpn_plugin *pplugin, const std::string object_type);
7226
7228class HostApi {
7229public:
7230 virtual ~HostApi() = default;
7231};
7232
7237extern DECL_EXP std::unique_ptr<HostApi> GetHostApi();
7238
7239// To gain access to api121, do something like this:
7240// auto host_api = std::move(GetHostApi());
7241// auto api_121 = std::dynamic_pointer_cast<HostApi121>(host_api);
7242
7243class HostApi121 : public HostApi {
7244public:
7245 HostApi121()
7246 : HostApi(),
7247 kContextMenuDisableWaypoint(1),
7248 kContextMenuDisableRoute(2),
7249 kContextMenuDisableTrack(4),
7250 kContextMenuDisableAistarget(8) {}
7251 ~HostApi121() override = default;
7252
7253 const int kContextMenuDisableWaypoint;
7254 const int kContextMenuDisableRoute;
7255 const int kContextMenuDisableTrack;
7256 const int kContextMenuDisableAistarget;
7257
7258 enum class PiContextObjectType {
7259 kObjectChart = 0,
7260 kObjectRoutepoint,
7261 kObjectRoutesegment,
7262 kObjectTracksegment,
7263 kObjectAisTarget,
7264 kObjectUnknown
7265 };
7266
7268 PiContextObjectType object_type;
7269 std::string object_ident;
7270 };
7271
7272 // Extended plugin route
7273 class Route : public PlugIn_Route_ExV2 {
7274 public:
7275 Route()
7276 : m_PlannedSpeed(0),
7277 m_Colour(""),
7278 m_style(wxPENSTYLE_SOLID),
7279 m_PlannedDeparture(wxDateTime::Now()),
7280 m_TimeDisplayFormat("UTC") {}
7281
7282 ~Route() override {
7283 if (pWaypointList) {
7284 pWaypointList->DeleteContents(true);
7285 delete pWaypointList;
7286 pWaypointList = NULL;
7287 }
7288 }
7289
7290 double m_PlannedSpeed;
7291 wxString m_Colour;
7292 wxPenStyle m_style;
7293 wxDateTime m_PlannedDeparture;
7294 wxString m_TimeDisplayFormat;
7295 };
7296
7297 virtual wxString DropMarkPI(double lat, double lon);
7298 virtual wxString RouteCreatePI(int canvas_index, bool start);
7299 virtual wxString NavToHerePI(double lat, double lon);
7300 virtual bool ActivateRoutePI(wxString route_guid, bool activate);
7301
7302 virtual void EnableDefaultConsole(bool enable);
7303 virtual void EnableDefaultContextMenus(bool enable);
7304
7305 virtual void SetMinZoomScale(double min_scale);
7306 virtual void SetMaxZoomScale(double max_scale);
7307
7308 virtual wxBitmap GetObjectIcon_PlugIn(const wxString &name);
7309
7310 virtual void SetDepthUnitVisible(bool bviz);
7311 virtual void SetOverzoomFlagVisible(bool bviz);
7312
7313 virtual bool IsRouteActive(wxString route_guid);
7314 virtual void SetBoatPosition(double zlat, double zlon);
7315
7316 virtual void RouteInsertWaypoint(int canvas_index, wxString route_guid,
7317 double zlat, double zlon);
7318 virtual void RouteAppendWaypoint(int canvas_index, wxString route_guid);
7319 virtual void FinishRoute(int canvas_index);
7320 virtual bool IsRouteBeingCreated(int canvas_index);
7321 virtual bool AreRouteWaypointNamesVisible(wxString route_guid);
7322 virtual void ShowRouteWaypointNames(wxString route_guid, bool show);
7323 virtual void NavigateToWaypoint(wxString waypoint_guid);
7324 virtual bool DoMeasurePI(int canvas_index, bool start);
7325 virtual bool IsMeasureActive(int canvas_index);
7326 virtual void CancelMeasure(int canvas_index);
7327
7328 // AIS related
7329 // for Show/Hide Target Track
7330 virtual bool IsAISTrackVisible(const wxString &ais_mmsi) const;
7331 // for Show/Hide Target Track
7332 virtual void AISToggleShowTrack(const wxString &ais_mmsi);
7333 // for Show/Hide Target CPA
7334 virtual bool IsAIS_CPAVisible(const wxString &ais_mmsi) const;
7335 // for Show/Hide Target CPA
7336 virtual void AISToggleShowCPA(const wxString &ais_mmsi);
7337 // for Target Query
7338 virtual void ShowAISTargetQueryDialog(int canvas_index,
7339 const wxString &ais_mmsi);
7340 // for Target List
7341 virtual void ShowAISTargetList(int canvas_index);
7342 virtual std::shared_ptr<PiPointContext> GetContextAtPoint(int x, int y,
7343 int canvas_index);
7344
7345 // Extended Chart table management support
7346 virtual void AddNoShowDirectory(std::string chart_dir);
7347 virtual void RemoveNoShowDirectory(std::string chart_dir);
7348 virtual void ClearNoShowVector();
7349 virtual const std::vector<std::string> &GetNoShowVector();
7350 virtual bool SelectChartFamily(int CanvasIndex, ChartFamilyEnumPI Family);
7351
7352 // Enhanced AIS Target List support
7353 virtual void CenterToAisTarget(wxString ais_mmsi);
7354 virtual void AisTargetCreateWpt(wxString ais_mmsi);
7355 virtual void AisShowAllTracks(bool show);
7356 virtual void AisToggleTrack(wxString ais_mmsi);
7357
7358 virtual int GetContextMenuMask();
7359 virtual void SetContextMenuMask(int mask);
7360
7361 // Enhanced Track support
7362 virtual void SetTrackVisibiiity(const wxString &track_GUID, bool viz);
7363
7364 // Extended plugin route, V3
7366 virtual bool AddRoute(Route *route, bool permanent = true);
7367
7369 virtual bool UpdateRoute(Route *route);
7370
7372 virtual std::unique_ptr<HostApi121::Route> GetRoute(const wxString &guid);
7373
7374 // Enhanced Tide query support.
7375 virtual bool GetNearestTideStation(double lat, double lon,
7376 PlugIn_TideStation *station);
7377 virtual bool GetTideHeight(int stationIndex, time_t time, float *height);
7378};
7379
7380#endif //_PLUGIN_H_
virtual bool AddRoute(Route *route, bool permanent=true)
Add route to database, updated version of AddPlugInRouteExV2.
Definition api_121.cpp:869
virtual std::unique_ptr< HostApi121::Route > GetRoute(const wxString &guid)
Retrieve route from database.
Definition api_121.cpp:877
virtual bool UpdateRoute(Route *route)
Update database route, updated version of UpdatePlugInRouteExV2.
Definition api_121.cpp:873
Empty, virtual base class for HostApi versions.
Keeps listening over its lifespan, removes itself on destruction.
Definition observable.h:155
Custom event class for OpenCPN's notification system.
ObservedEvt(wxEventType commandType=obsNOTIFY, int id=0)
Constructor.
void SetSharedPtr(std::shared_ptr< const void > p)
Sets the event's payload data.
wxEvent * Clone() const
Creates a cloned copy of this event.
std::shared_ptr< const void > GetSharedPtr() const
Gets the event's payload data.
unsigned error_count
Number of detected errors since program start.
unsigned tx_count
Number of bytes sent since program start.
unsigned rx_count
Number of bytes received since program start.
Class representing an S-57 chart object.
int auxParm3
Auxiliary parameter 3.
PI_S57Obj * next
Linked list pointer.
PI_DisCat m_DisplayCat
Display category (base, standard, other)
double m_lon
Reference longitude.
double lon_max
Bounding box maximum longitude.
int Scamin
Minimum display scale.
int * m_lsindex_array
Array of line segment indices.
double x
X coordinate for point features.
int auxParm1
Auxiliary parameter 1.
void * m_chart_context
Parent chart context.
int m_n_lsindex
Number of line segments.
double lon_min
Bounding box minimum longitude.
PI_S57Obj * child
Child object list (for multipoint soundings)
double x_rate
X scale factor.
int npt
Number of points in geometry.
int auxParm2
Auxiliary parameter 2.
double lat_max
Bounding box maximum latitude.
int auxParm0
Auxiliary parameter 0.
int iOBJL
Object lookup index.
void * pPolyTessGeo
Tesselated polygon geometry.
double chart_ref_lon
Chart reference longitude.
bool bIsAssociable
True if object can have relationships.
int m_n_edge_max_points
Maximum points per edge.
void * geoPt
Geometry data for lines/areas.
double y
Y coordinate for point features.
int nRef
Reference count for memory management.
int n_attr
Number of attributes.
double * geoPtMulti
Lat/lon pairs for decomposed points.
double y_origin
Y origin offset.
PI_line_segment_element * m_ls_list
Line segment list.
int Index
Runtime object index.
void * S52_Context
S52 presentation data.
bool bIsClone
True if object is a clone.
char * att_array
Array of attribute types.
double * geoPtz
Z values for multipoint features.
double m_lat
Reference latitude.
int m_DPRI
Display priority.
bool m_bcategory_mutable
True if category can change.
bool bIsAton
True if object is an aid to navigation.
double chart_ref_lat
Chart reference latitude.
double z
Z coordinate (usually depth)
wxArrayOfS57attVal * attVal
Array of attribute values.
double y_rate
Y scale factor.
double lat_min
Bounding box minimum latitude.
double x_origin
X origin offset.
int Primitive_type
Geometry type (point, line, area)
Represents a line segment element for efficient vector chart rendering.
int priority
Drawing priority (higher draws on top)
int type
Line type identifier.
void * private0
Private data pointer for implementation use.
float lon_min
Minimum longitude of segment's bounding box.
float lat_min
Minimum latitude of segment's bounding box.
size_t vbo_offset
Offset into vertex buffer object for this segment.
float lat_max
Maximum latitude of segment's bounding box.
float lon_max
Maximum longitude of segment's bounding box.
PI_line_segment_element * next
Pointer to next segment in linked list.
size_t n_points
Number of points in this line segment.
Extended chart base class with separated text rendering.
Extended OpenGL-optimized chart base class with additional querying capabilities.
OpenGL-optimized chart base class for plugin chart types.
Base class for implementing custom chart types in OpenCPN plugins.
virtual ChartFamilyEnumPI GetChartFamily()
Returns the chart family classification.
virtual wxString GetID()
Returns a unique identifier for the chart.
virtual wxString GetDatumString()
Returns the horizontal geodetic datum of the chart.
virtual wxString GetName()
Returns the chart's name or title.
virtual wxDateTime GetEditionDate(void)
Returns the edition date of the chart.
virtual int GetCOVRTablenPoints(int iTable)
Alternative method to get the number of points in a coverage table entry.
virtual int GetCOVREntries()
Returns the number of coverage table entries for this chart.
virtual wxString GetSoundingsDatum()
Returns the vertical datum used for soundings in the chart.
virtual wxString GetExtraInfo()
Returns additional information about the chart.
virtual wxString GetDescription()
Returns a descriptive text about the chart.
virtual wxString GetFullPath() const
Returns the full file path of the chart.
virtual wxString GetSE()
Returns the chart's source edition identifier.
virtual bool IsReadyToRender()
Indicates whether the chart is ready for rendering.
virtual int GetNativeScale()
Returns the native scale of the chart.
virtual double GetChartSkew()
Returns the skew/rotation angle of the chart.
virtual wxString GetDepthUnits()
Returns the depth units used in the chart.
virtual float * GetCOVRTableHead(int iTable)
Returns a pointer to the coverage table data for a specific entry.
virtual double GetChartErrorFactor()
Returns the error factor for the chart.
virtual OcpnProjTypePI GetChartProjection()
Returns the projection type used by the chart.
virtual wxString GetPubDate()
Returns the publication date/year of the chart.
virtual ChartTypeEnumPI GetChartType()
Returns the chart type identifier.
virtual int GetCOVRTablePoints(int iTable)
Returns the number of points in a specific coverage table entry.
virtual ChartDepthUnitTypePI GetDepthUnitId()
Returns the depth unit type identifier.
AIS target information accessible to plugins.
char CallSign[8]
Call sign, includes NULL terminator.
double HDG
Heading in degrees true.
int ROTAIS
Rate of turn as indicated in AIS message.
unsigned char ShipType
Ship type as per ITU-R M.1371.
double Lat
Latitude in decimal degrees.
int MMSI
Maritime Mobile Service Identity number.
bool bCPA_Valid
True if CPA calculation is valid.
double Brg
Bearing to target in degrees true.
double Lon
Longitude in decimal degrees.
double CPA
Closest Point of Approach in nautical miles.
int Class
AIS class (Class A: 0, Class B: 1)
double SOG
Speed over ground in knots.
double Range_NM
Range to target in nautical miles.
int NavStatus
Navigational status (0-15 as per ITU-R M.1371)
int IMO
IMO ship identification number.
char ShipName[21]
Ship name, includes NULL terminator.
double TCPA
Time to Closest Point of Approach in minutes.
double COG
Course over ground in degrees.
plugin_ais_alarm_type alarm_state
Current alarm state for this target.
Extended position fix information.
int nSats
Number of satellites used in the fix.
double Var
Magnetic variation in degrees, typically from RMC message.
double Cog
Course over ground in degrees [0-360).
double Lat
Latitude in decimal degrees.
double Hdm
Heading magnetic in degrees [0-360).
time_t FixTime
UTC time of fix.
double Lon
Longitude in decimal degrees.
double Sog
Speed over ground in knots.
double Hdt
Heading true in degrees [0-360).
Basic position fix information.
double Cog
Course over ground in degrees [0-360).
double Sog
Speed over ground in knots.
time_t FixTime
UTC time of fix as time_t value.
double Lat
Latitude in decimal degrees.
int nSats
Number of satellites used in the fix.
double Var
Magnetic variation in degrees, typically from RMC message.
double Lon
Longitude in decimal degrees.
Enhanced route class for working with PlugIn_Waypoint_ExV2 waypoints.
bool m_isVisible
True if route should be displayed.
Plugin_WaypointExV2List * pWaypointList
List of waypoints making up this route in order.
wxString m_StartString
Description of route start point.
wxString m_Description
Optional route description/notes.
wxString m_NameString
User-visible name of the route.
bool m_isActive
True if this is the active route.
wxString m_GUID
Globally unique identifier.
wxString m_EndString
Description of route end point.
Extended route class for managing complex route features.
wxString m_Description
Optional route description/notes.
wxString m_EndString
Description of route end point.
Plugin_WaypointExList * pWaypointList
List of waypoints making up this route in order.
wxString m_NameString
User-visible name of the route.
bool m_isVisible
True if route should be displayed.
wxString m_GUID
Globally unique identifier.
bool m_isActive
True if this is the active route.
wxString m_StartString
Description of route start point.
Plugin route class for managing ordered waypoint collections.
wxString m_GUID
Globally unique identifier.
wxString m_EndString
Name/description of ending point.
wxString m_NameString
Route name.
Plugin_WaypointList * pWaypointList
List of waypoints making up this route in order.
wxString m_StartString
Name/description of starting point.
Plugin track class for managing recorded track data.
Plugin_WaypointList * pWaypointList
List of waypoints making up this track in chronological order.
wxString m_GUID
Globally unique identifier.
wxString m_EndString
Description of track end point/time.
wxString m_StartString
Description of track start point/time.
wxString m_NameString
Display name of the track.
Contains view parameters and status information for a chart display viewport.
double view_scale_ppm
Display scale in pixels per meter.
wxRect rv_rect
Rectangle defining the rendered view area.
int pix_width
Viewport width in pixels.
double lon_max
Maximum longitude of the viewport.
double clon
Center longitude of the viewport in decimal degrees.
double lat_max
Maximum latitude of the viewport.
int pix_height
Viewport height in pixels.
double clat
Center latitude of the viewport in decimal degrees.
double skew
Display skew angle in radians.
double rotation
Display rotation angle in radians.
bool bValid
True if this viewport is valid and can be used for rendering.
double lon_min
Minimum longitude of the viewport.
double lat_min
Minimum latitude of the viewport.
int m_projection_type
Chart projection type (PROJECTION_MERCATOR, etc.)
bool b_quilt
True if the viewport is in quilt mode (showing multiple charts)
float chart_scale
Conventional chart displayed scale (e.g., 1:50000)
wxDateTime m_ETD
Estimated departure time in UTC, or wxInvalidDateTime if not set.
wxString m_MarkDescription
Optional description text.
wxString m_GUID
Globally unique identifier.
wxString m_TideStation
Tide Station Identifier.
wxDateTime m_CreateTime
Creation timestamp in UTC.
bool m_bShowWaypointRangeRings
True to show range rings on chart.
wxString IconDescription
User-friendly description of icon.
double m_lat
Latitude in decimal degrees.
wxColour RangeRingColor
Color to draw range rings.
bool IsActive
Active state (e.g. destination)
Plugin_HyperlinkList * m_HyperlinkList
List of hyperlinks associated with this waypoint.
double scamin
Minimum display scale (1:X) for waypoint visibility.
double scamax
Maximum display scale (1:X) for waypoint visibility.
bool b_useScamin
True to enable scale-dependent visibility.
wxString IconName
Name of icon to use for waypoint symbol.
bool IsNameVisible
True to show waypoint name on chart.
double m_PlannedSpeed
Planned speed for next leg (knots)
double RangeRingSpace
Distance between range rings in preferred units.
double m_lon
Longitude in decimal degrees.
double m_WaypointArrivalRadius
Arrival radius in nautical miles.
int RangeRingSpaceUnits
Units for range ring spacing - 0:nm, 1:km.
wxString m_MarkName
Display name of waypoint.
bool IsVisible
Visibility state on chart.
int nrange_rings
Number of range rings to display around waypoint.
Extended waypoint class with additional navigation features.
wxDateTime m_CreateTime
Creation timestamp in UTC.
wxColour RangeRingColor
Color to draw range rings.
int nrange_rings
Number of range rings to display around waypoint.
wxString IconDescription
User-friendly description of icon.
bool b_useScamin
True to enable scale-dependent visibility.
double RangeRingSpace
Distance between range rings in preferred units.
Plugin_HyperlinkList * m_HyperlinkList
List of hyperlinks associated with this waypoint.
wxString m_MarkName
Display name of waypoint.
wxString m_GUID
Globally unique identifier.
double m_lon
Longitude in decimal degrees.
wxString IconName
Name of icon to use for waypoint symbol.
double scamin
Minimum display scale (1:X) for waypoint visibility.
bool IsNameVisible
True to show waypoint name on chart.
double m_lat
Latitude in decimal degrees.
wxString m_MarkDescription
Optional description text.
bool IsActive
Active state (e.g. destination)
bool IsVisible
Visibility state on chart.
Plugin waypoint class providing core waypoint/mark functionality.
double m_lon
Longitude in decimal degrees.
wxString m_IconName
Icon identifier.
wxString m_MarkDescription
Optional description.
wxString m_GUID
Globally unique identifier.
bool m_IsVisible
Visibility state.
wxDateTime m_CreateTime
Creation timestamp in UTC.
wxString m_MarkName
Display name.
double m_lat
Latitude in decimal degrees.
Plugin_HyperlinkList * m_HyperlinkList
List of associated hyperlinks.
Information about the currently active route leg.
double Dtw
Distance to waypoint in nautical miles.
wxString wp_name
Name of destination waypoint for the active leg.
double Xte
Cross track error in nautical miles, negative values indicate left side of track.
double Btw
Bearing to waypoint in degrees true.
bool arrival
True when vessel is within the arrival circle of the destination waypoint.
virtual bool RenderOverlayMultiCanvas(wxDC &dc, PlugIn_ViewPort *vp, int canvasIndex)
Renders plugin overlay graphics in standard DC mode for multi-canvas support.
virtual bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext, PlugIn_ViewPort *vp, int canvasIndex)
Renders plugin overlay graphics in OpenGL mode for multi-canvas support.
bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext, PlugIn_ViewPort *vp, int canvas_ix) override
Renders plugin overlay graphics in OpenGL mode for multi-canvas support.
bool RenderOverlayMultiCanvas(wxDC &dc, PlugIn_ViewPort *vp, int canvas_ix) override
Renders plugin overlay graphics in standard DC mode for multi-canvas support.
Base class for OpenCPN plugins.
virtual bool RenderOverlay(wxMemoryDC *pmdc, PlugIn_ViewPort *vp)
Render plugin overlay graphics using standard device context.
DECL_EXP void RemovePlugInTool(int tool_id)
Removes a tool from OpenCPN's toolbar.
DECL_EXP void EnableNotificationCanvasIcon(bool enable)
Plugin Notification Framework GUI support.
DECL_EXP void ForceChartDBUpdate()
Forces an update of the chart database.
DECL_EXP wxArrayString GetRouteGUIDArray(void)
Gets array of route GUIDs.
DECL_EXP std::unique_ptr< PlugIn_Route_Ex > GetRouteEx_Plugin(const wxString &GUID)
Gets extended route by GUID.
DECL_EXP CommDriverResult WriteCommDriverN2K(DriverHandle handle, int PGN, int destinationCANAddress, int priority, const std::shared_ptr< std::vector< uint8_t > > &payload)
Send a PGN message to an NMEA2000 address.
_OBJECT_LAYER_REQ
Filter options for object queries.
@ OBJECTS_ALL
Return all objects including those in layers.
@ OBJECTS_ONLY_LAYERS
Return only objects that are in layers.
@ OBJECTS_NO_LAYERS
Exclude objects that are in layers.
DECL_EXP void toSM_ECC_Plugin(double lat, double lon, double lat0, double lon0, double *x, double *y)
Converts geographic coordinates to Elliptical Simple Mercator projection.
DECL_EXP void EnableENCDepthSoundingsDisplay(bool enable, int CanvasIndex)
Controls ENC depth sounding display.
DECL_EXP void EnableChartBar(bool enable, int CanvasIndex)
Controls visibility of chart info bar.
DECL_EXP double fromDMM_Plugin(wxString sdms)
Converts degrees/decimal minutes string to decimal degrees.
DECL_EXP void SetCanvasMenuItemGrey(int item, bool grey, const char *name="")
Sets menu item enabled/disabled state.
DECL_EXP void EnableLatLonGrid(bool enable, int CanvasIndex)
Controls latitude/longitude grid display.
DECL_EXP void SetNavigationMode(PI_NavMode mode, int CanvasIndex)
Sets the navigation mode for a specific chart canvas.
DECL_EXP bool GetEnableENCDepthSoundingsDisplay(int CanvasIndex)
Gets ENC depth sounding visibility.
DECL_EXP void EnableENCTextDisplay(bool enable, int CanvasIndex)
Controls ENC text label display.
DECL_EXP wxXmlDocument GetChartDatabaseEntryXML(int dbIndex, bool b_getGeom)
Gets chart database entry as XML.
DECL_EXP void AddChartDirectory(wxString &path)
Adds a chart directory to OpenCPN's chart database.
DECL_EXP wxBitmap GetBitmapFromSVGFile(wxString filename, unsigned int width, unsigned int height)
Creates bitmap from SVG file.
DECL_EXP wxArrayString GetChartDBDirArrayString()
Gets chart database directory list.
DECL_EXP wxWindow * GetCanvasByIndex(int canvasIndex)
Gets chart canvas window by index.
DECL_EXP bool GetEnableCanvasFocusBar(int CanvasIndex)
Gets focus indicator visibility state.
DECL_EXP void UpdateAndApplyPriorityMaps(std::vector< std::string > map)
Sets and applies new priority mapping scheme.
DECL_EXP int GetCanvasIndexUnderMouse()
Gets index of chart canvas under mouse cursor.
DECL_EXP void DimeWindow(wxWindow *)
Applies system color scheme to window.
plugin_ais_alarm_type
Enumeration of AIS alarm states.
@ PI_AIS_ALARM_ACKNOWLEDGED
Alarm has been acknowledged by the user.
@ PI_AIS_NO_ALARM
No alarm condition exists.
@ PI_AIS_ALARM_SET
Alarm has been set but not acknowledged.
DECL_EXP bool GetSingleWaypointExV2(wxString GUID, PlugIn_Waypoint_ExV2 *pwaypoint)
Gets extended waypoint data by GUID.
enum ChartDepthUnitTypePI _ChartDepthUnitTypePI
Enumeration of depth unit types used in charts.
DECL_EXP std::unique_ptr< PlugIn_Waypoint_ExV2 > GetWaypointExV2_Plugin(const wxString &GUID)
Gets complete waypoint details by GUID.
DECL_EXP void EnableCanvasFocusBar(bool enable, int CanvasIndex)
Controls visibility of canvas focus indicator.
DECL_EXP void EnableTideStationsDisplay(bool enable, int CanvasIndex)
Controls tide station icon display.
enum _PI_DisCat PI_DisCat
Display categories for S52 chart features.
DECL_EXP void RemoveCanvasContextMenuItem(int item)
Removes a context menu item completely.
void DECL_EXP PI_PLIBSetRenderCaps(unsigned int flags)
Sets rendering capability flags.
DECL_EXP void fromSM_ECC_Plugin(double x, double y, double lat0, double lon0, double *lat, double *lon)
Converts Elliptical Simple Mercator coordinates to geographic.
DECL_EXP bool GetEnableChartBar(int CanvasIndex)
Gets chart bar visibility state.
DECL_EXP wxFont GetOCPNGUIScaledFont_PlugIn(wxString item)
Gets a uniquely scaled font copy for responsive UI elements.
DECL_EXP double DistGreatCircle_Plugin(double slat, double slon, double dlat, double dlon)
Calculates great circle distance between two points.
CommDriverResult
Error return values
@ RESULT_COMM_INVALID_PARMS
Invalid parameters provided to operation.
@ RESULT_COMM_REGISTER_GATEWAY_ERROR
Failed to register with gateway device.
@ RESULT_COMM_TX_ERROR
Error occurred during transmission.
@ RESULT_COMM_REGISTER_PGN_ERROR
Failed to register PGN parameters.
@ RESULT_COMM_NO_ERROR
Operation completed successfully.
@ RESULT_COMM_INVALID_HANDLE
Invalid or unknown driver handle specified.
DECL_EXP void RequestWindowRefresh(wxWindow *win, bool eraseBackground)
Requests window refresh.
DECL_EXP bool UpdateChartDBInplace(wxArrayString dir_array, bool b_force_update, bool b_ProgressDialog)
Updates chart database in place.
DECL_EXP wxString GetLocaleCanonicalName()
Gets system locale canonical name.
DECL_EXP bool GetEnableDepthUnitDisplay(int CanvasIndex)
Gets depth unit display state.
enum OptionsParentPI _OptionsParentPI
Enum defining parent pages in OpenCPN options dialog where plugins can add panels.
DECL_EXP void SetToolbarItemState(int item, bool toggle)
Sets toolbar item toggle state.
DECL_EXP bool UpdatePlugInRoute(PlugIn_Route *proute)
Updates an existing route.
DECL_EXP bool AddLocaleCatalog(wxString catalog)
Adds a locale catalog for translations.
int DECL_EXP PI_PLIBRenderObjectToDC(wxDC *pdc, PI_S57Obj *pObj, PlugIn_ViewPort *vp)
Renders an S57 object using standard device context.
DECL_EXP _OCPN_DLStatus OCPN_downloadFile(const wxString &url, const wxString &outputFile, const wxString &title, const wxString &message, const wxBitmap &bitmap, wxWindow *parent, long style, int timeout_secs)
Synchronously download a file with progress dialog.
void DECL_EXP PI_PLIBSetLineFeaturePriority(PI_S57Obj *pObj, int prio)
Sets rendering priority for line feature.
enum _PI_DisPrio PI_DisPrio
Display priority levels for S52 chart objects.
DECL_EXP void EnableCurrentStationsDisplay(bool enable, int CanvasIndex)
Controls current station icon display.
DECL_EXP wxArrayString GetIconNameArray(void)
Gets array of available waypoint icons.
DECL_EXP void toTM_Plugin(float lat, float lon, float lat0, float lon0, double *x, double *y)
Converts geographic coordinates to Transverse Mercator projection.
DECL_EXP bool GetGlobalColor(wxString colorName, wxColour *pcolour)
Gets a functionally-named color for a specific UI purpose.
DECL_EXP bool GetSingleWaypointEx(wxString GUID, PlugIn_Waypoint_Ex *pwaypoint)
Gets extended waypoint data by GUID.
DECL_EXP int PlatformFileSelectorDialog(wxWindow *parent, wxString *file_spec, wxString Title, wxString initDir, wxString suggestedName, wxString wildcard)
Shows platform-optimized file selector dialog.
DECL_EXP PI_DisCat GetENCDisplayCategory(int CanvasIndex)
Gets current ENC display category.
void DECL_EXP PI_UpdateContext(PI_S57Obj *pObj)
Updates rendering context for S57 object.
DECL_EXP int AddCanvasContextMenuItem(wxMenuItem *pitem, opencpn_plugin *pplugin)
Adds item to chart canvas context menu.
DECL_EXP double fromUsrSpeed_Plugin(double usr_speed, int unit=-1)
Converts from user's preferred speed unit to knots.
DECL_EXP _OCPN_DLStatus OCPN_postDataHttp(const wxString &url, const wxString &parameters, wxString &result, int timeout_secs)
Performs HTTP POST request.
DECL_EXP wxString GetActiveRouteGUID(void)
Gets GUID of currently active route.
DECL_EXP void RequestRefresh(wxWindow *)
Requests window refresh.
void DECL_EXP PI_PLIBPrepareForNewRender(void)
Prepares PLIB for new rendering pass.
DECL_EXP PI_NavMode GetNavigationMode(int CanvasIndex)
Gets current navigation mode for a canvas.
DECL_EXP void SetCanvasRotation(double rotation)
Sets chart display rotation angle.
DECL_EXP void PlugInMultMatrixViewport(PlugIn_ViewPort *vp, float lat=0, float lon=0)
Applies viewport transformation matrix.
DECL_EXP double toUsrDepth_Plugin(double m_depth, int unit=-1)
Converts meters to user's preferred depth unit.
DECL_EXP PI_Comm_Status GetConnState(const std::string &iface, PI_Conn_Bus _bus)
Plugin polled Comm Status support.
int DECL_EXP PI_GetPLIBDepthUnitInt()
Gets configured depth unit for S52 display.
DECL_EXP wxArrayString GetWaypointGUIDArray(void)
Gets array of all waypoint/marks GUIDs.
DECL_EXP double toUsrTemp_Plugin(double cel_temp, int unit=-1)
Converts Celsius to user's preferred temperature unit.
DECL_EXP bool CheckEdgePan_PlugIn(int x, int y, bool dragging, int margin, int delta)
Checks if chart should pan when cursor near edge.
DECL_EXP wxString * GetpSharedDataLocation()
Gets shared application data location.
DECL_EXP double toUsrSpeed_Plugin(double kts_speed, int unit=-1)
Converts knots to user's preferred speed unit.
DECL_EXP bool GetEnableBuoyLightLabelsDisplay(int CanvasIndex)
Gets buoy/light label visibility.
_OCPN_DLCondition
Event types for HTTP file download operations.
@ OCPN_DL_EVENT_TYPE_UNKNOWN
Unknown event type.
@ OCPN_DL_EVENT_TYPE_PROGRESS
Download progress update.
@ OCPN_DL_EVENT_TYPE_END
Download has completed.
@ OCPN_DL_EVENT_TYPE_START
Download is starting.
DECL_EXP bool DeleteOptionsPage(wxScrolledWindow *page)
Remove a previously added options page.
DECL_EXP void EnableTenHertzUpdate(bool enable)
Enable or disable 10 Hz update rate.
DECL_EXP void EnableLightDescriptionsDisplay(bool enable, int CanvasIndex)
Controls light description text display.
DECL_EXP bool AddPlugInRouteEx(PlugIn_Route_Ex *proute, bool b_permanent=true)
Adds a route with extended features.
bool DECL_EXP PI_PLIBObjectRenderCheck(PI_S57Obj *pObj, PlugIn_ViewPort *vp)
Checks if object should be rendered.
DECL_EXP void GetCanvasPixLL(PlugIn_ViewPort *vp, wxPoint *pp, double lat, double lon)
Converts lat/lon to canvas physical pixel coordinates.
DECL_EXP bool PlugIn_GSHHS_CrossesLand(double lat1, double lon1, double lat2, double lon2)
Checks if a great circle route crosses land.
ChartTypeEnumPI
Enumeration of chart types.
@ PI_CHART_TYPE_PLUGIN
Chart type provided by a plugin.
@ PI_CHART_TYPE_CM93COMP
CM93 Composite vector chart format.
@ PI_CHART_TYPE_CM93
CM93 vector chart format.
@ PI_CHART_TYPE_S57
S-57 vector chart format.
@ PI_CHART_TYPE_UNKNOWN
Chart type is unknown or undefined.
@ PI_CHART_TYPE_DONTCARE
Chart type is not important for the operation.
@ PI_CHART_TYPE_KAP
BSB/KAP raster chart format.
@ PI_CHART_TYPE_DUMMY
Dummy chart used when no actual chart is available.
@ PI_CHART_TYPE_GEO
GEO raster chart format.
DECL_EXP int GetChartbarHeight(void)
Gets height of chart bar in pixels.
DECL_EXP wxString GetNewGUID()
Generates a new globally unique identifier (GUID).
PI_ColorScheme
Color schemes for different lighting conditions.
@ PI_GLOBAL_COLOR_SCHEME_DAY
Day color scheme, optimized for bright ambient light.
@ PI_GLOBAL_COLOR_SCHEME_NIGHT
Night/dark color scheme, optimized for dark conditions with minimal impact on night vision.
@ PI_N_COLOR_SCHEMES
Number of color schemes, used for bounds checking.
@ PI_GLOBAL_COLOR_SCHEME_RGB
RGB color scheme, unmodified colors.
@ PI_GLOBAL_COLOR_SCHEME_DUSK
Dusk color scheme, optimized for low ambient light.
DECL_EXP wxString toSDMM_PlugIn(int NEflag, double a, bool hi_precision=true)
Convert decimal degrees to a formatted string.
DECL_EXP void SetEnableMainToolbar(bool enable)
Show or hide the main toolbar.
enum _OCPN_DLCondition OCPN_DLCondition
Event types for HTTP file download operations.
DECL_EXP wxString GetActiveStyleName()
Gets name of currently active style sheet.
DECL_EXP void EnableAisTargetDisplay(bool enable, int CanvasIndex)
Controls AIS target display.
DECL_EXP void ZeroXTE()
Resets cross track error to zero.
DECL_EXP void SetENCDisplayCategory(PI_DisCat cat, int CanvasIndex)
Sets ENC (Electronic Navigation Chart) feature display category.
DECL_EXP wxString GetOCPN_ExePath(void)
Gets OpenCPN executable path.
int DECL_EXP OCPNMessageBox_PlugIn(wxWindow *parent, const wxString &message, const wxString &caption=_T("Message"), int style=wxOK, int x=-1, int y=-1)
Shows a message box dialog.
DECL_EXP wxString * GetpPlugInLocation()
Gets plugins directory location.
DECL_EXP std::string GetN2000Source(NMEA2000Id id, ObservedEvt ev)
Return source identifier (iface) of a received n2000 message of type id in ev.
DECL_EXP int GetLatLonFormat(void)
Gets currently selected latitude/longitude display format.
PI_NotificationSeverity
Plugin Notification Framework support.
DECL_EXP std::shared_ptr< void > GetSignalkPayload(ObservedEvt ev)
Get SignalK status payload after receiving a message.
DECL_EXP double OCPN_GetWinDIPScaleFactor()
Gets Windows-specific DPI scaling factor.
DECL_EXP std::shared_ptr< ObservableListener > GetListener(NMEA2000Id id, wxEventType ev, wxEvtHandler *handler)
Gets listener for NMEA 2000 messages.
DECL_EXP wxWindow * GetCanvasUnderMouse()
Gets canvas window under mouse cursor.
DECL_EXP void EnableBuoyLightLabelsDisplay(bool enable, int CanvasIndex)
Controls buoy/light name label display.
int DECL_EXP PI_PLIBRenderAreaToDC(wxDC *pdc, PI_S57Obj *pObj, PlugIn_ViewPort *vp, wxRect rect, unsigned char *pixbuf)
Renders an S57 area object using standard device context.
DECL_EXP void SetGlobalColor(std::string table, std::string name, wxColor color)
Sets a color in the global color scheme.
DECL_EXP void PushNMEABuffer(wxString str)
Pushes NMEA sentence to the system.
DECL_EXP bool OCPN_isOnline()
Checks internet connectivity.
DECL_EXP void SetCanvasContextMenuItemGrey(int item, bool grey)
Sets menu item enabled/disabled state.
DECL_EXP wxString getUsrHeightUnit_Plugin(int unit=-1)
Gets display string for user's preferred height unit.
DECL_EXP std::unique_ptr< PlugIn_Waypoint > GetWaypoint_Plugin(const wxString &)
Gets waypoint details by GUID.
enum PI_InitReturn _PI_InitReturn
Return values for plugin initialization.
DECL_EXP void CanvasJumpToPosition(wxWindow *canvas, double lat, double lon, double scale)
Centers specified canvas on given position at given scale.
DECL_EXP double fromUsrTemp_Plugin(double usr_temp, int unit=-1)
Converts from user's preferred temperature unit to Celsius.
DECL_EXP bool GetEnableMenu()
Gets menu bar visibility state.
bool DECL_EXP PI_GetObjectRenderBox(PI_S57Obj *pObj, double *lat_min, double *lat_max, double *lon_min, double *lon_max)
Gets geographic bounding box of S57 object.
_OCPN_DLStatus
Status codes for HTTP file download operations.
@ OCPN_DL_NO_ERROR
Download completed successfully.
@ OCPN_DL_USER_TIMEOUT
Download timed out waiting for user action.
@ OCPN_DL_STARTED
Download has begun but not yet complete.
@ OCPN_DL_FAILED
Download failed (general error)
@ OCPN_DL_UNKNOWN
Unknown or uninitialized status.
@ OCPN_DL_ABORTED
Download was cancelled by user.
SDDMFORMAT
Coordinate format options for lat/lon display.
@ DEGREES_DECIMAL_MINUTES
Format like "50° 12.345' N".
@ DEGREES_MINUTES_SECONDS
Format like "50° 12' 34.5" N".
@ DECIMAL_DEGREES
Format like "50.12345° N".
@ END_SDDMFORMATS
Number of available formats.
DECL_EXP bool IsTouchInterface_PlugIn(void)
Checks if touch interface mode is enabled.
DECL_EXP wxString GetPlugInPath(opencpn_plugin *pplugin)
Gets the installation path for a specific plugin.
DECL_EXP double GetCanvasTilt()
Gets current canvas tilt angle.
DECL_EXP bool GetEnableAisTargetDisplay(int CanvasIndex)
Gets AIS target display state.
OCPN_DLDialogStyle
@ OCPN_DLDS_CONN_SETTINGS_AUTH
The dialog allows the user to change the authentication settings.
@ OCPN_DLDS_CAN_START
The transfer won't start automatically.
@ OCPN_DLDS_URL
The dialog shows the URL involved in the transfer.
@ OCPN_DLDS_AUTO_CLOSE
The dialog auto closes when transfer is complete.
@ OCPN_DLDS_CAN_ABORT
The transfer can be aborted by the user.
@ OCPN_DLDS_ESTIMATED_TIME
The dialog shows the estimated total time.
@ OCPN_DLDS_SIZE
The dialog shows the size of the resource to download/upload.
@ OCPN_DLDS_CONN_SETTINGS_PROXY
The dialog allows the user to change the proxy settings.
@ OCPN_DLDS_REMAINING_TIME
The dialog shows the remaining time.
@ OCPN_DLDS_SPEED
The dialog shows the transfer speed.
@ OCPN_DLDS_ELAPSED_TIME
The dialog shows the elapsed time.
@ OCPN_DLDS_CAN_PAUSE
The transfer can be paused.
@ OCPN_DLDS_CONN_SETTINGS_PORT
The dialog allows the user to change the port for the transfer.
DECL_EXP void RemoveCanvasMenuItem(int item, const char *name="")
Removes a context menu item completely.
DECL_EXP void EnableStatusBar(bool enable)
Shows/hides the status bar.
ChartFamilyEnumPI
Enumeration of chart families (broad categories).
@ PI_CHART_FAMILY_UNKNOWN
Chart family is unknown.
@ PI_CHART_FAMILY_VECTOR
Vector chart formats (S-57, CM93, etc.)
@ PI_CHART_FAMILY_RASTER
Raster chart formats (KAP, GEO, etc.)
@ PI_CHART_FAMILY_DONTCARE
Chart family is not important for the operation.
DECL_EXP void EnableChartOutlines(bool enable, int CanvasIndex)
Controls chart outline display.
DECL_EXP bool UpdatePlugInRouteExV2(PlugIn_Route_ExV2 *proute)
Updates existing route with V2 waypoints.
DECL_EXP wxString GetWritableDocumentsDir(void)
Returns the platform-specific default documents directory.
DECL_EXP wxString GetSelectedTrackGUID_Plugin()
Gets GUID of currently selected track.
DECL_EXP bool GetEnableTenHertzUpdate()
Check if 10 Hz update rate is enabled.
DECL_EXP std::unique_ptr< PlugIn_Route_ExV2 > GetRouteExV2_Plugin(const wxString &GUID)
Gets route details with V2 waypoints by GUID.
DECL_EXP bool DeletePlugInRoute(wxString &GUID)
Deletes a route.
DECL_EXP void GetDoubleCanvasPixLL(PlugIn_ViewPort *vp, wxPoint2DDouble *pp, double lat, double lon)
Converts lat/lon to canvas pixels with double precision.
DECL_EXP bool GetFullScreen()
Gets full screen state.
DECL_EXP bool PluginGetFollowMode(int CanvasIndex)
Get the current follow mode status for a specific canvas.
DECL_EXP bool GetSingleWaypoint(wxString GUID, PlugIn_Waypoint *pwaypoint)
Gets waypoint data by GUID.
enum _PI_LUPname PI_LUPname
Name identifiers for S57 lookup table sets.
DECL_EXP double OCPN_GetDisplayContentScaleFactor()
Gets content scaling factor for current display.
DECL_EXP double fromUsrDepth_Plugin(double usr_depth, int unit=-1)
Converts from user's preferred depth unit to meters.
DECL_EXP bool UpdatePlugInTrack(PlugIn_Track *ptrack)
Updates an existing track.
DECL_EXP wxArrayString GetTrackGUIDArray(void)
Gets array of track GUIDs.
DECL_EXP bool GetEnableLightsDisplay(int CanvasIndex)
Gets light icon visibility.
int DECL_EXP PI_GetPLIBStateHash()
Gets hash value representing current PLIB state.
DECL_EXP double toUsrDistance_Plugin(double nm_distance, int unit=-1)
Converts nautical miles to user's preferred distance unit.
DECL_EXP bool GetActiveRoutepointGPX(char *buffer, unsigned int buffer_length)
Gets GPX representation of active route waypoint.
DECL_EXP double toUsrHeight_Plugin(double m_height, int unit=-1)
Converts meters to user's preferred height unit.
DECL_EXP wxBitmap * FindSystemWaypointIcon(wxString &icon_name)
Finds built-in system waypoint icon.
DECL_EXP void ExitOCPN()
Exits OpenCPN application.
DECL_EXP int PlugInGetMinAvailableGshhgQuality()
Gets minimum available GSHHS coastline data quality.
DECL_EXP bool GetEnableLookaheadMode(int CanvasIndex)
Gets look-ahead mode state for a canvas.
DECL_EXP wxString getUsrTempUnit_Plugin(int unit=-1)
Gets display string for user's preferred temperature unit.
DECL_EXP double fromDMM_PlugIn(wxString sdms)
Parse a formatted coordinate string to get decimal degrees.
DECL_EXP int PlugInGetMaxAvailableGshhgQuality()
Gets maximum available GSHHS coastline data quality.
ChartDepthUnitTypePI
Enumeration of depth unit types used in charts.
@ PI_DEPTH_UNIT_METERS
Depths shown in meters.
@ PI_DEPTH_UNIT_UNKNOWN
Depth unit is unknown or not specified.
@ PI_DEPTH_UNIT_FATHOMS
Depths shown in fathoms.
@ PI_DEPTH_UNIT_FEET
Depths shown in feet.
DECL_EXP bool PlugInHasNormalizedViewPort(PlugIn_ViewPort *vp)
Checks if viewport has been normalized.
DECL_EXP bool AddSingleWaypoint(PlugIn_Waypoint *pwaypoint, bool b_permanent=true)
Adds a single waypoint.
DECL_EXP double fromUsrWindSpeed_Plugin(double usr_wspeed, int unit=-1)
Converts from user's preferred wind speed unit to knots.
DECL_EXP bool PlugInSetFontColor(const wxString TextElement, const wxColour color)
Sets text color for a UI element.
DECL_EXP wxString getUsrWindSpeedUnit_Plugin(int unit=-1)
Gets display string for user's preferred wind speed unit.
DECL_EXP bool DeleteSingleWaypoint(wxString &GUID)
Deletes a single waypoint.
DECL_EXP bool ShuttingDown(void)
Checks if OpenCPN is in shutdown process.
DECL_EXP void EnableDepthUnitDisplay(bool enable, int CanvasIndex)
Controls depth unit display.
DECL_EXP void PlugInAISDrawGL(wxGLCanvas *glcanvas, const PlugIn_ViewPort &vp)
Renders AIS targets on a secondary OpenGL canvas.
DECL_EXP void PlugInHandleAutopilotRoute(bool enable)
Controls autopilot route handling.
DECL_EXP void EnableMUIBar(bool enable, int CanvasIndex)
Controls visibility of MUI (Mobile/Touch User Interface) bar.
DECL_EXP void JumpToPosition(double lat, double lon, double scale)
Centers chart display on specified position at given scale.
DECL_EXP CommDriverResult WriteCommDriver(DriverHandle handle, const std::shared_ptr< std::vector< uint8_t > > &payload)
Send a non-NMEA2000 message.
DECL_EXP int PlatformDirSelectorDialog(wxWindow *parent, wxString *file_spec, wxString Title, wxString initDir)
Shows platform-optimized directory selector dialog.
DECL_EXP std::string GetN0183Payload(NMEA0183Id id, ObservedEvt ev)
Return payload in a received n0183 message of type id in ev.
wxString DECL_EXP PI_GetPLIBColorScheme()
Gets current color scheme used by S52 PLIB.
DECL_EXP void SetToolbarToolBitmaps(int item, wxBitmap *bitmap, wxBitmap *bmpRollover)
Updates toolbar tool bitmaps.
DECL_EXP bool GetTrackingMode()
Get the current tracking mode status.
std::string DriverHandle
Plugin API supporting direct access to comm drivers for output purposes.
PI_LUPname DECL_EXP PI_GetObjectLUPName(PI_S57Obj *pObj)
Gets Look-Up Table (LUP) name for object.
DECL_EXP bool AddPersistentFontKey(wxString TextElement)
Registers a new font configuration element.
enum _OCPN_DLStatus OCPN_DLStatus
Status codes for HTTP file download operations.
DECL_EXP bool AddPlugInRouteExV2(PlugIn_Route_ExV2 *proute, bool b_permanent=true)
Adds a new route with V2 waypoints.
DECL_EXP wxAuiManager * GetFrameAuiManager(void)
Gets main frame AUI manager.
DECL_EXP void PlugInNormalizeViewport(PlugIn_ViewPort *vp, float lat=0, float lon=0)
Normalizes viewport parameters.
DECL_EXP wxString getUsrDistanceUnit_Plugin(int unit=-1)
Gets display string for user's preferred distance unit.
struct _ExtentPI ExtentPI
Geographic extent structure defining a bounding box.
DECL_EXP wxFileConfig * GetOCPNConfigObject(void)
Gets OpenCPN's configuration object.
DECL_EXP bool AddCustomWaypointIcon(wxBitmap *pimage, wxString key, wxString description)
Adds a custom waypoint icon.
DECL_EXP wxString toUsrDateTimeFormat_Plugin(const wxDateTime date_time, const DateTimeFormatOptions &options=DateTimeFormatOptions())
Format a date/time to a localized string representation, conforming to the global date/time format an...
DECL_EXP wxRect GetMasterToolbarRect()
Gets bounding rectangle of master toolbar.
DECL_EXP wxWindow * PluginGetOverlayRenderCanvas()
Gets the canvas currently designated for overlay rendering.
DECL_EXP void EnableLookaheadMode(bool enable, int CanvasIndex)
Enables/disables look-ahead mode for a canvas.
DECL_EXP void OCPN_cancelDownloadFileBackground(long handle)
Cancels a background download.
DECL_EXP PI_ColorScheme GetAppColorScheme()
Get the current application color scheme.
DECL_EXP PluginNavdata GetEventNavdata(ObservedEvt ev)
Return BasicNavDataMsg decoded data available in ev.
DECL_EXP bool UpdateSingleWaypointExV2(PlugIn_Waypoint_ExV2 *pwaypoint)
Updates an existing extended V2 waypoint.
DECL_EXP int AddChartToDBInPlace(wxString &full_path, bool b_RefreshCanvas)
Adds a chart to the database without full rebuild.
DECL_EXP void toSM_Plugin(double lat, double lon, double lat0, double lon0, double *x, double *y)
Converts geographic coordinates to Simple Mercator projection.
DECL_EXP wxString getUsrDepthUnit_Plugin(int unit=-1)
Gets display string for user's preferred depth unit.
DECL_EXP void EnableMenu(bool enable)
Shows/hides the main menu bar.
DECL_EXP wxFont * OCPNGetFont(wxString TextElement, int default_size=0)
Gets a font for UI elements.
DECL_EXP int GetGlobalWatchdogTimoutSeconds()
Gets global watchdog timeout value.
DECL_EXP void SetTrackingMode(bool enable)
Enable or disable tracking mode.
enum ChartTypeEnumPI _ChartTypeEnumPI
Enumeration of chart types.
DECL_EXP std::shared_ptr< PI_Notification > GetNotificationMsgPayload(NotificationMsgId id, ObservedEvt ev)
Retrieve the Notification Event in a Notification message.
enum OcpnProjTypePI _OcpnProjTypePI
Enumeration of chart projection types.
DECL_EXP bool GetEnableStatusBar()
Gets status bar visibility state.
DECL_EXP float GetOCPNChartScaleFactor_Plugin()
Gets chart rendering scale factor.
void DECL_EXP PI_PLIBFreeContext(void *pContext)
Frees S52 PLIB context.
DECL_EXP bool GetEnableChartOutlines(int CanvasIndex)
Gets chart outline visibility state.
DECL_EXP std::unique_ptr< PlugIn_Track > GetTrack_Plugin(const wxString &)
Gets track details by GUID.
DECL_EXP bool AddPlugInRoute(PlugIn_Route *proute, bool b_permanent=true)
Adds a new route.
DECL_EXP std::vector< uint8_t > GetN2000Payload(NMEA2000Id id, ObservedEvt ev)
Return N2K payload for a received n2000 message of type id in ev.
DECL_EXP std::unique_ptr< HostApi > GetHostApi()
HostApi factory,.
Definition api_121.cpp:865
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.