OpenCPN Partial API docs
Loading...
Searching...
No Matches
ocpn_plugin.h
Go to the documentation of this file.
1/**************************************************************************
2 * Copyright (C) 2010 - 2024 by David S. Register *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 **************************************************************************/
19
25#ifndef _PLUGIN_H_
26#define _PLUGIN_H_
27
28#ifndef DECL_EXP
29#if defined(__WXMSW__) || defined(__CYGWIN__)
30#define DECL_EXP __declspec(dllexport)
31#elif defined __GNUC__ && __GNUC__ >= 4
32#define DECL_EXP __attribute__((visibility("default")))
33#elif defined __WXOSX__
34#define DECL_EXP __attribute__((visibility("default")))
35#else
36#define DECL_EXP
37#endif
38#endif
39
40#if defined(__WXMSW__) && defined(MAKING_PLUGIN)
41#define DECL_IMP __declspec(dllimport)
42#else
43#define DECL_IMP
44#endif
45
46#include <wx/xml/xml.h>
47#include <wx/dcmemory.h>
48#include <wx/dialog.h>
49#include <wx/event.h>
50#include <wx/menuitem.h>
51#include <wx/gdicmn.h>
52
53#ifdef ocpnUSE_SVG
54#include <wx/bitmap.h>
55#endif // ocpnUSE_SVG
56
57#include <memory>
58#include <vector>
59#include <unordered_map>
60
61class wxGLContext;
62
63// This is the most modern API Version number
64// It is expected that the API will remain downward compatible, meaning that
65// PlugIns conforming to API Version less than the most modern will also
66// be correctly supported.
67#define API_VERSION_MAJOR 1
68#define API_VERSION_MINOR 19
69
70// Fwd Definitions
71class wxFileConfig;
72class wxNotebook;
73class wxFont;
74class wxAuiManager;
75class wxScrolledWindow;
76class wxGLCanvas;
77
78//---------------------------------------------------------------------------------------------------------
79//
80// Bitfield PlugIn Capabilites flag definition
81//
82//---------------------------------------------------------------------------------------------------------
86#define WANTS_OVERLAY_CALLBACK 0x00000001
90#define WANTS_CURSOR_LATLON 0x00000002
100#define WANTS_TOOLBAR_CALLBACK 0x00000004
106#define INSTALLS_TOOLBAR_TOOL 0x00000008
109#define WANTS_CONFIG 0x00000010
112#define INSTALLS_TOOLBOX_PAGE 0x00000020
115#define INSTALLS_CONTEXTMENU_ITEMS 0x00000040
118#define WANTS_NMEA_SENTENCES 0x00000080
122#define WANTS_NMEA_EVENTS 0x00000100
125#define WANTS_AIS_SENTENCES 0x00000200
128#define USES_AUI_MANAGER 0x00000400
131#define WANTS_PREFERENCES 0x00000800
134#define INSTALLS_PLUGIN_CHART 0x00001000
137#define WANTS_ONPAINT_VIEWPORT 0x00002000
140#define WANTS_PLUGIN_MESSAGING 0x00004000
141#define WANTS_OPENGL_OVERLAY_CALLBACK 0x00008000
142#define WANTS_DYNAMIC_OPENGL_OVERLAY_CALLBACK 0x00010000
145#define WANTS_LATE_INIT 0x00020000
148#define INSTALLS_PLUGIN_CHART_GL 0x00040000
151#define WANTS_MOUSE_EVENTS 0x00080000
154#define WANTS_VECTOR_CHART_OBJECT_INFO 0x00100000
157#define WANTS_KEYBOARD_EVENTS 0x00200000
160#define WANTS_PRESHUTDOWN_HOOK 0x00400000
161
162//---------------------------------------------------------------------------------------------------------
163//
164// Overlay priorities
165//
166//---------------------------------------------------------------------------------------------------------
167#define OVERLAY_LEGACY 0
168#define OVERLAY_OVER_SHIPS 64
169#define OVERLAY_OVER_EMBOSS 96
170#define OVERLAY_OVER_UI 128
171
172//----------------------------------------------------------------------------------------------------------
173// Some PlugIn API interface object class definitions
174//----------------------------------------------------------------------------------------------------------
175enum PI_ColorScheme {
176 PI_GLOBAL_COLOR_SCHEME_RGB,
177 PI_GLOBAL_COLOR_SCHEME_DAY,
178 PI_GLOBAL_COLOR_SCHEME_DUSK,
179 PI_GLOBAL_COLOR_SCHEME_NIGHT,
180 PI_N_COLOR_SCHEMES
181};
182
184public:
185 double clat; // center point
186 double clon;
187 double view_scale_ppm;
188 double skew;
189 double rotation;
190
191 float chart_scale; // conventional chart displayed scale
192
193 int pix_width;
194 int pix_height;
195 wxRect rv_rect;
196 bool b_quilt;
197 int m_projection_type;
198
199 double lat_min, lat_max, lon_min, lon_max;
200
201 bool bValid; // This VP is valid
202};
203
205public:
206 double Lat;
207 double Lon;
208 double Cog;
209 double Sog;
210 double Var; // Variation, typically from RMC message
211 time_t FixTime;
212 int nSats;
213};
214
216public:
217 double Lat;
218 double Lon;
219 double Cog;
220 double Sog;
221 double Var; // Variation, typically from RMC message
222 double Hdm;
223 double Hdt;
224 // The time obtained from the most recent GNSS message, or the system time if
225 // the GNSS watchdog has expired.
226 time_t FixTime;
227 int nSats;
228};
229
231public:
232 double Xte; // Left side of the track -> negative XTE
233 double Btw;
234 double Dtw;
235 wxString wp_name; // Name of destination waypoint for active leg
236 bool arrival; // True when within arrival circle
237};
238
239// Describe AIS Alarm state
240enum plugin_ais_alarm_type {
241 PI_AIS_NO_ALARM = 0,
242 PI_AIS_ALARM_SET,
243 PI_AIS_ALARM_ACKNOWLEDGED
244
245};
246
248public:
249 int MMSI;
250 int Class;
251 int NavStatus;
252 double SOG;
253 double COG;
254 double HDG;
255 double Lon;
256 double Lat;
257 int ROTAIS;
258 char CallSign[8]; // includes terminator
259 char ShipName[21];
260 unsigned char ShipType;
261 int IMO;
262
263 double Range_NM;
264 double Brg;
265
266 // Per target collision parameters
267 bool bCPA_Valid;
268 double TCPA; // Minutes
269 double CPA; // Nautical Miles
270
271 plugin_ais_alarm_type alarm_state;
272};
273
274// ChartType constants
275typedef enum ChartTypeEnumPI {
276 PI_CHART_TYPE_UNKNOWN = 0,
277 PI_CHART_TYPE_DUMMY,
278 PI_CHART_TYPE_DONTCARE,
279 PI_CHART_TYPE_KAP,
280 PI_CHART_TYPE_GEO,
281 PI_CHART_TYPE_S57,
282 PI_CHART_TYPE_CM93,
283 PI_CHART_TYPE_CM93COMP,
284 PI_CHART_TYPE_PLUGIN
285} _ChartTypeEnumPI;
286
287// ChartFamily constants
288typedef enum ChartFamilyEnumPI {
289 PI_CHART_FAMILY_UNKNOWN = 0,
290 PI_CHART_FAMILY_RASTER,
291 PI_CHART_FAMILY_VECTOR,
292 PI_CHART_FAMILY_DONTCARE
293} _ChartFamilyEnumPI;
294
295// Depth unit type enum
296typedef enum ChartDepthUnitTypePI {
297 PI_DEPTH_UNIT_UNKNOWN,
298 PI_DEPTH_UNIT_FEET,
299 PI_DEPTH_UNIT_METERS,
300 PI_DEPTH_UNIT_FATHOMS
301} _ChartDepthUnitTypePI;
302
303// Projection type enum
304typedef enum OcpnProjTypePI {
305 PI_PROJECTION_UNKNOWN,
306 PI_PROJECTION_MERCATOR,
307 PI_PROJECTION_TRANSVERSE_MERCATOR,
308 PI_PROJECTION_POLYCONIC,
309
310 PI_PROJECTION_ORTHOGRAPHIC,
311 PI_PROJECTION_POLAR,
312 PI_PROJECTION_STEREOGRAPHIC,
313 PI_PROJECTION_GNOMONIC,
314 PI_PROJECTION_EQUIRECTANGULAR
315} _OcpnProjTypePI;
316
317typedef struct _ExtentPI {
318 double SLAT;
319 double WLON;
320 double NLAT;
321 double ELON;
322} ExtentPI;
323
324// PlugInChartBase::Init() init_flags constants
325#define PI_FULL_INIT 0
326#define PI_HEADER_ONLY 1
327#define PI_THUMB_ONLY 2
328
329// ----------------------------------------------------------------------------
330// PlugInChartBase
331// This class is the base class for Plug-able chart types
332// ----------------------------------------------------------------------------
333
334class DECL_EXP PlugInChartBase : public wxObject {
335public:
336 // These methods Must be overriden in any derived class
338 virtual ~PlugInChartBase();
339
340 virtual wxString GetFileSearchMask(void);
341
342 virtual int Init(const wxString &full_path, int init_flags);
343 virtual void SetColorScheme(int cs, bool bApplyImmediate);
344
345 virtual double GetNormalScaleMin(double canvas_scale_factor,
346 bool b_allow_overzoom);
347 virtual double GetNormalScaleMax(double canvas_scale_factor,
348 int canvas_width);
349 virtual double GetNearestPreferredScalePPM(double target_scale_ppm);
350
351 virtual bool GetChartExtent(ExtentPI *pext);
352
353 virtual wxBitmap &RenderRegionView(const PlugIn_ViewPort &VPoint,
354 const wxRegion &Region);
355
356 virtual bool AdjustVP(PlugIn_ViewPort &vp_last, PlugIn_ViewPort &vp_proposed);
357
358 virtual void GetValidCanvasRegion(const PlugIn_ViewPort &VPoint,
359 wxRegion *pValidRegion);
360
361 virtual int GetCOVREntries() { return 0; }
362 virtual int GetCOVRTablePoints(int iTable) { return 0; }
363 virtual int GetCOVRTablenPoints(int iTable) { return 0; }
364 virtual float *GetCOVRTableHead(int iTable) { return (float *)NULL; }
365
366 virtual wxBitmap *GetThumbnail(int tnx, int tny, int cs);
367
368 // Accessors, need not be overridden in derived class if the member
369 // variables are maintained
370 virtual wxString GetFullPath() const { return m_FullPath; }
371 virtual ChartTypeEnumPI GetChartType() { return m_ChartType; }
372 virtual ChartFamilyEnumPI GetChartFamily() { return m_ChartFamily; }
373 virtual OcpnProjTypePI GetChartProjection() { return m_projection; }
374 virtual wxString GetName() { return m_Name; }
375 virtual wxString GetDescription() { return m_Description; }
376 virtual wxString GetID() { return m_ID; }
377 virtual wxString GetSE() { return m_SE; }
378 virtual wxString GetDepthUnits() { return m_DepthUnits; }
379 virtual wxString GetSoundingsDatum() { return m_SoundingsDatum; }
380 virtual wxString GetDatumString() { return m_datum_str; }
381 virtual wxString GetExtraInfo() { return m_ExtraInfo; }
382 virtual wxString GetPubDate() { return m_PubYear; }
383 virtual double GetChartErrorFactor() { return m_Chart_Error_Factor; }
384 virtual ChartDepthUnitTypePI GetDepthUnitId() { return m_depth_unit_id; }
385 virtual bool IsReadyToRender() { return m_bReadyToRender; }
386 virtual int GetNativeScale() { return m_Chart_Scale; };
387 virtual double GetChartSkew() { return m_Chart_Skew; }
388 virtual wxDateTime GetEditionDate(void) { return m_EdDate; }
389
390 // Methods pertaining to CHART_FAMILY_RASTER type PlugIn charts only
391 virtual void ComputeSourceRectangle(const PlugIn_ViewPort &vp,
392 wxRect *pSourceRect);
393 virtual double GetRasterScaleFactor();
394 virtual bool GetChartBits(wxRect &source, unsigned char *pPix, int sub_samp);
395 virtual int GetSize_X();
396 virtual int GetSize_Y();
397 virtual void latlong_to_chartpix(double lat, double lon, double &pixx,
398 double &pixy);
399 virtual void chartpix_to_latlong(double pixx, double pixy, double *plat,
400 double *plon);
401
402protected:
403 ChartTypeEnumPI m_ChartType;
404 ChartFamilyEnumPI m_ChartFamily;
405
406 wxString m_FullPath;
407 OcpnProjTypePI m_projection;
408 int m_Chart_Scale;
409 double m_Chart_Skew;
410
411 wxDateTime m_EdDate;
412 bool m_bReadyToRender;
413
414 wxString m_Name;
415 wxString m_Description;
416 wxString m_ID;
417 wxString m_SE;
418 wxString m_SoundingsDatum;
419 wxString m_datum_str;
420 wxString m_PubYear;
421 wxString m_DepthUnits;
422 wxString m_ExtraInfo;
423
424 ChartDepthUnitTypePI m_depth_unit_id;
425
426 double m_Chart_Error_Factor;
427};
428
429// Declare an array of PlugIn_AIS_Targets
430WX_DEFINE_ARRAY_PTR(PlugIn_AIS_Target *, ArrayOfPlugIn_AIS_Targets);
431
432//----------------------------------------------------------------------------------------------------------
433// The Generic PlugIn Interface Class Definition
434//
435// This is a virtual class.
436// opencpn PlugIns must derive from this class.
437// There are two types of methods in this class
438// a. Required...must be overridden and implemented by PlugIns
439// b. Optional..may be overridden by PlugIns
440
441// PlugIns must implement optional method overrides consistent with their
442// declared capabilities flag as returned by Init().
443//----------------------------------------------------------------------------------------------------------
444class DECL_EXP opencpn_plugin {
445public:
446 opencpn_plugin(void *pmgr) {}
447 virtual ~opencpn_plugin();
448
449 // Public API to the PlugIn class
450
451 // This group of methods is required, and will be called by the opencpn
452 // host opencpn PlugIns must implement this group
453 virtual int Init(void); // Return the PlugIn Capabilites flag
454 virtual bool DeInit(void);
455
456 virtual int GetAPIVersionMajor();
457 virtual int GetAPIVersionMinor();
458 virtual int GetPlugInVersionMajor();
459 virtual int GetPlugInVersionMinor();
460 virtual wxBitmap *GetPlugInBitmap();
461
462 // These three methods should produce valid, meaningful strings always
463 // ---EVEN IF--- the PlugIn has not (yet) been initialized.
464 // They are used by the PlugInManager GUI
465 virtual wxString GetCommonName();
466 virtual wxString GetShortDescription();
467 virtual wxString GetLongDescription();
468
469 // This group is optional.
470 // PlugIns may override any of these methods as required
471
472 virtual void SetDefaults(
473 void); // This will be called upon enabling a PlugIn via the user Dialog
474 // It gives a chance to setup any default options and behavior
475
476 virtual int GetToolbarToolCount(void);
477
478 virtual int GetToolboxPanelCount(void);
479 virtual void SetupToolboxPanel(int page_sel, wxNotebook *pnotebook);
480 virtual void OnCloseToolboxPanel(int page_sel, int ok_apply_cancel);
481
482 virtual void ShowPreferencesDialog(wxWindow *parent);
483
484 virtual bool RenderOverlay(wxMemoryDC *pmdc, PlugIn_ViewPort *vp);
485 virtual void SetCursorLatLon(double lat, double lon);
486 virtual void SetCurrentViewPort(PlugIn_ViewPort &vp);
487
488 virtual void SetPositionFix(PlugIn_Position_Fix &pfix);
502 virtual void SetNMEASentence(wxString &sentence);
519 virtual void SetAISSentence(wxString &sentence);
520
521 virtual void ProcessParentResize(int x, int y);
522 virtual void SetColorScheme(PI_ColorScheme cs);
523
524 virtual void OnToolbarToolCallback(int id);
525 virtual void OnContextMenuItemCallback(int id);
526
527 virtual void UpdateAuiStatus(void);
528
529 virtual wxArrayString GetDynamicChartClassNameArray(void);
530};
531
532// the types of the class factories used to create PlugIn instances
533typedef opencpn_plugin *create_t(void *);
534typedef void destroy_t(opencpn_plugin *);
535
536#ifdef __clang__
537#pragma clang diagnostic push
538#pragma clang diagnostic ignored "-Woverloaded-virtual"
539#endif
540
541class DECL_EXP opencpn_plugin_16 : public opencpn_plugin {
542public:
543 opencpn_plugin_16(void *pmgr);
544 virtual ~opencpn_plugin_16();
545
546 using opencpn_plugin::RenderOverlay;
547
548 virtual bool RenderOverlay(wxDC &dc, PlugIn_ViewPort *vp);
549
550 virtual void SetPluginMessage(wxString &message_id, wxString &message_body);
551};
552
553class DECL_EXP opencpn_plugin_17 : public opencpn_plugin {
554public:
555 opencpn_plugin_17(void *pmgr);
556 virtual ~opencpn_plugin_17();
557
558 using opencpn_plugin::RenderOverlay;
559
560 virtual bool RenderOverlay(wxDC &dc, PlugIn_ViewPort *vp);
561 virtual bool RenderGLOverlay(wxGLContext *pcontext, PlugIn_ViewPort *vp);
562
563 virtual void SetPluginMessage(wxString &message_id, wxString &message_body);
564};
565
566class DECL_EXP opencpn_plugin_18 : public opencpn_plugin {
567public:
568 opencpn_plugin_18(void *pmgr);
569 virtual ~opencpn_plugin_18();
570
571 using opencpn_plugin::RenderOverlay;
572
573 virtual bool RenderOverlay(wxDC &dc, PlugIn_ViewPort *vp);
574 virtual bool RenderGLOverlay(wxGLContext *pcontext, PlugIn_ViewPort *vp);
575 virtual void SetPluginMessage(wxString &message_id, wxString &message_body);
576 virtual void SetPositionFixEx(PlugIn_Position_Fix_Ex &pfix);
577};
578
579#ifdef __clang__
580#pragma clang diagnostic pop
581#endif
582
583class DECL_EXP opencpn_plugin_19 : public opencpn_plugin_18 {
584public:
585 opencpn_plugin_19(void *pmgr);
586 virtual ~opencpn_plugin_19();
587
588 virtual void OnSetupOptions(void);
589};
590
591class DECL_EXP opencpn_plugin_110 : public opencpn_plugin_19 {
592public:
593 opencpn_plugin_110(void *pmgr);
594 virtual ~opencpn_plugin_110();
595
596 virtual void LateInit(void); // If WANTS_LATE_INIT is returned by Init()
597};
598
599class DECL_EXP opencpn_plugin_111 : public opencpn_plugin_110 {
600public:
601 opencpn_plugin_111(void *pmgr);
602 virtual ~opencpn_plugin_111();
603};
604
605class DECL_EXP opencpn_plugin_112 : public opencpn_plugin_111 {
606public:
607 opencpn_plugin_112(void *pmgr);
608 virtual ~opencpn_plugin_112();
609
610 virtual bool MouseEventHook(wxMouseEvent &event);
611 virtual void SendVectorChartObjectInfo(wxString &chart, wxString &feature,
612 wxString &objname, double lat,
613 double lon, double scale,
614 int nativescale);
615};
616
617class DECL_EXP opencpn_plugin_113 : public opencpn_plugin_112 {
618public:
619 opencpn_plugin_113(void *pmgr);
620 virtual ~opencpn_plugin_113();
621
622 virtual bool KeyboardEventHook(wxKeyEvent &event);
623 virtual void OnToolbarToolDownCallback(int id);
624 virtual void OnToolbarToolUpCallback(int id);
625};
626
627class DECL_EXP opencpn_plugin_114 : public opencpn_plugin_113 {
628public:
629 opencpn_plugin_114(void *pmgr);
630 virtual ~opencpn_plugin_114();
631};
632
633class DECL_EXP opencpn_plugin_115 : public opencpn_plugin_114 {
634public:
635 opencpn_plugin_115(void *pmgr);
636 virtual ~opencpn_plugin_115();
637};
638
639class DECL_EXP opencpn_plugin_116 : public opencpn_plugin_115 {
640public:
641 opencpn_plugin_116(void *pmgr);
642 virtual ~opencpn_plugin_116();
643 virtual bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext,
644 PlugIn_ViewPort *vp, int canvasIndex);
645 virtual bool RenderOverlayMultiCanvas(wxDC &dc, PlugIn_ViewPort *vp,
646 int canvasIndex);
647 virtual void PrepareContextMenu(int canvasIndex);
648};
649
650class DECL_EXP opencpn_plugin_117 : public opencpn_plugin_116 {
651public:
652 opencpn_plugin_117(void *pmgr);
653 /*
654 * Forms a semantic version together with GetPlugInVersionMajor() and
655 * GetPlugInVersionMinor(), see https://semver.org/
656 */
657 virtual int GetPlugInVersionPatch();
658
660 virtual int GetPlugInVersionPost();
661
663 virtual const char *GetPlugInVersionPre();
664
666 virtual const char *GetPlugInVersionBuild();
667
668 /*Provide active leg data to plugins*/
669 virtual void SetActiveLegInfo(Plugin_Active_Leg_Info &leg_info);
670};
671
672class DECL_EXP opencpn_plugin_118 : public opencpn_plugin_117 {
673public:
674 opencpn_plugin_118(void *pmgr);
675
676 using opencpn_plugin_116::RenderGLOverlayMultiCanvas;
677 using opencpn_plugin_116::RenderOverlayMultiCanvas;
678
687#ifdef _MSC_VER
688 virtual bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext,
689 PlugIn_ViewPort *vp, int canvasIndex,
690 int priority = -1);
691#else
692 virtual bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext,
693 PlugIn_ViewPort *vp, int canvasIndex,
694 int priority);
695
696 bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext, PlugIn_ViewPort *vp,
697 int canvas_ix) override {
698 return RenderGLOverlayMultiCanvas(pcontext, vp, canvas_ix, -1);
699 }
700#endif
701
710#ifdef _MSC_VER
711 virtual bool RenderOverlayMultiCanvas(wxDC &dc, PlugIn_ViewPort *vp,
712 int canvasIndex, int priority = -1);
713#else
714 virtual bool RenderOverlayMultiCanvas(wxDC &dc, PlugIn_ViewPort *vp,
715 int canvas_ix, int priority);
716 bool RenderOverlayMultiCanvas(wxDC &dc, PlugIn_ViewPort *vp,
717 int canvas_ix) override {
718 return RenderOverlayMultiCanvas(dc, vp, canvas_ix, -1);
719 }
720#endif
721};
722
723class DECL_EXP opencpn_plugin_119 : public opencpn_plugin_118 {
724public:
725 opencpn_plugin_119(void *pmgr);
726
727 virtual void PreShutdownHook();
728};
729
730//------------------------------------------------------------------
731// Route and Waypoint PlugIn support
732//
733//------------------------------------------------------------------
734
735class DECL_EXP Plugin_Hyperlink {
736public:
737 wxString DescrText;
738 wxString Link;
739 wxString Type;
740};
741
742WX_DECLARE_LIST(Plugin_Hyperlink, Plugin_HyperlinkList);
743
744class DECL_EXP PlugIn_Waypoint {
745public:
747 PlugIn_Waypoint(double lat, double lon, const wxString &icon_ident,
748 const wxString &wp_name, const wxString &GUID = _T(""));
750
751 double m_lat;
752 double m_lon;
753
754 wxString m_GUID;
755
756 wxString m_MarkName;
757 wxString m_MarkDescription;
758 wxDateTime m_CreateTime;
759 bool m_IsVisible;
760
761 wxString m_IconName;
762
763 Plugin_HyperlinkList *m_HyperlinkList;
764};
765
766WX_DECLARE_LIST(PlugIn_Waypoint, Plugin_WaypointList);
767
768class DECL_EXP PlugIn_Route {
769public:
770 PlugIn_Route(void);
771 ~PlugIn_Route(void);
772
773 wxString m_NameString;
774 wxString m_StartString;
775 wxString m_EndString;
776 wxString m_GUID;
777
778 Plugin_WaypointList *pWaypointList;
779};
780
781class DECL_EXP PlugIn_Track {
782public:
783 PlugIn_Track(void);
784 ~PlugIn_Track(void);
785
786 wxString m_NameString;
787 wxString m_StartString;
788 wxString m_EndString;
789 wxString m_GUID;
790
791 Plugin_WaypointList *pWaypointList;
792};
793
794//----------------------------------------------------------------------------------------------------------
795// The PlugIn CallBack API Definition
796//
797// The API back up to the PlugIn Manager
798// PlugIns may call these static functions as necessary for system services
799//
800//----------------------------------------------------------------------------------------------------------
801
802extern "C" DECL_EXP int InsertPlugInTool(wxString label, wxBitmap *bitmap,
803 wxBitmap *bmpRollover, wxItemKind kind,
804 wxString shortHelp, wxString longHelp,
805 wxObject *clientData, int position,
806 int tool_sel, opencpn_plugin *pplugin);
807extern "C" DECL_EXP void RemovePlugInTool(int tool_id);
808extern "C" DECL_EXP void SetToolbarToolViz(
809 int item, bool viz); // Temporarily change toolbar tool viz
810extern "C" DECL_EXP void SetToolbarItemState(int item, bool toggle);
811extern "C" DECL_EXP void SetToolbarToolBitmaps(int item, wxBitmap *bitmap,
812 wxBitmap *bmpRollover);
813
814extern "C" DECL_EXP int InsertPlugInToolSVG(
815 wxString label, wxString SVGfile, wxString SVGfileRollover,
816 wxString SVGfileToggled, wxItemKind kind, wxString shortHelp,
817 wxString longHelp, wxObject *clientData, int position, int tool_sel,
818 opencpn_plugin *pplugin);
819extern "C" DECL_EXP void SetToolbarToolBitmapsSVG(int item, wxString SVGfile,
820 wxString SVGfileRollover,
821 wxString SVGfileToggled);
822
823extern "C" DECL_EXP int AddCanvasContextMenuItem(wxMenuItem *pitem,
824 opencpn_plugin *pplugin);
825extern "C" DECL_EXP void RemoveCanvasContextMenuItem(
826 int item); // Fully remove this item
827extern "C" DECL_EXP void SetCanvasContextMenuItemViz(
828 int item, bool viz); // Temporarily change context menu ptions
829extern "C" DECL_EXP void SetCanvasContextMenuItemGrey(int item, bool grey);
830
831extern "C" DECL_EXP wxFileConfig *GetOCPNConfigObject(void);
832
833extern "C" DECL_EXP void RequestRefresh(wxWindow *);
834extern "C" DECL_EXP bool GetGlobalColor(wxString colorName, wxColour *pcolour);
835
836extern "C" DECL_EXP void GetCanvasPixLL(PlugIn_ViewPort *vp, wxPoint *pp,
837 double lat, double lon);
838extern "C" DECL_EXP void GetCanvasLLPix(PlugIn_ViewPort *vp, wxPoint p,
839 double *plat, double *plon);
840
841extern "C" DECL_EXP wxWindow *GetOCPNCanvasWindow();
842
881extern "C" DECL_EXP wxFont *OCPNGetFont(wxString TextElement, int default_size);
882
883extern "C" DECL_EXP wxString *GetpSharedDataLocation();
884
885extern "C" DECL_EXP ArrayOfPlugIn_AIS_Targets *GetAISTargetArray(void);
886
887extern "C" DECL_EXP wxAuiManager *GetFrameAuiManager(void);
888
889extern "C" DECL_EXP bool AddLocaleCatalog(wxString catalog);
890
891extern "C" DECL_EXP void PushNMEABuffer(wxString str);
892
893extern DECL_EXP wxXmlDocument GetChartDatabaseEntryXML(int dbIndex,
894 bool b_getGeom);
895
896extern DECL_EXP bool UpdateChartDBInplace(wxArrayString dir_array,
897 bool b_force_update,
898 bool b_ProgressDialog);
899extern DECL_EXP wxArrayString GetChartDBDirArrayString();
900
901extern "C" DECL_EXP void SendPluginMessage(wxString message_id,
902 wxString message_body);
903
904extern "C" DECL_EXP void DimeWindow(wxWindow *);
905
906extern "C" DECL_EXP void JumpToPosition(double lat, double lon, double scale);
907
908/* API 1.9 adds some common cartographic functions to avoid unnecessary code
909 * duplication */
910/* Study the original OpenCPN source (georef.c) for functional definitions */
911
912extern "C" DECL_EXP void PositionBearingDistanceMercator_Plugin(
913 double lat, double lon, double brg, double dist, double *dlat,
914 double *dlon);
915extern "C" DECL_EXP void DistanceBearingMercator_Plugin(
916 double lat0, double lon0, double lat1, double lon1, double *brg,
917 double *dist);
918extern "C" DECL_EXP double DistGreatCircle_Plugin(double slat, double slon,
919 double dlat, double dlon);
920
921extern "C" DECL_EXP void toTM_Plugin(float lat, float lon, float lat0,
922 float lon0, double *x, double *y);
923extern "C" DECL_EXP void fromTM_Plugin(double x, double y, double lat0,
924 double lon0, double *lat, double *lon);
925extern "C" DECL_EXP void toSM_Plugin(double lat, double lon, double lat0,
926 double lon0, double *x, double *y);
927extern "C" DECL_EXP void fromSM_Plugin(double x, double y, double lat0,
928 double lon0, double *lat, double *lon);
929extern "C" DECL_EXP void toSM_ECC_Plugin(double lat, double lon, double lat0,
930 double lon0, double *x, double *y);
931extern "C" DECL_EXP void fromSM_ECC_Plugin(double x, double y, double lat0,
932 double lon0, double *lat,
933 double *lon);
934
935extern "C" DECL_EXP bool DecodeSingleVDOMessage(const wxString &str,
937 wxString *acc);
938extern "C" DECL_EXP int GetChartbarHeight(void);
939extern "C" DECL_EXP bool GetActiveRoutepointGPX(char *buffer,
940 unsigned int buffer_length);
941
942/* API 1.9 */
943typedef enum OptionsParentPI {
944 PI_OPTIONS_PARENT_DISPLAY,
945 PI_OPTIONS_PARENT_CONNECTIONS,
946 PI_OPTIONS_PARENT_CHARTS,
947 PI_OPTIONS_PARENT_SHIPS,
948 PI_OPTIONS_PARENT_UI,
949 PI_OPTIONS_PARENT_PLUGINS
950} _OptionsParentPI;
951extern DECL_EXP wxScrolledWindow *AddOptionsPage(OptionsParentPI parent,
952 wxString title);
953extern DECL_EXP bool DeleteOptionsPage(wxScrolledWindow *page);
954
955/* API 1.10 */
956
957/* API 1.10 adds some common functions to avoid unnecessary code duplication */
958/* Study the original OpenCPN source for functional definitions */
959extern "C" DECL_EXP double toUsrDistance_Plugin(double nm_distance,
960 int unit = -1);
961extern "C" DECL_EXP double fromUsrDistance_Plugin(double usr_distance,
962 int unit = -1);
963extern "C" DECL_EXP double toUsrSpeed_Plugin(double kts_speed, int unit = -1);
964extern "C" DECL_EXP double fromUsrSpeed_Plugin(double usr_speed, int unit = -1);
965extern "C" DECL_EXP double toUsrTemp_Plugin(double cel_temp, int unit = -1);
966extern "C" DECL_EXP double fromUsrTemp_Plugin(double usr_temp, int unit = -1);
967extern DECL_EXP wxString getUsrDistanceUnit_Plugin(int unit = -1);
968extern DECL_EXP wxString getUsrSpeedUnit_Plugin(int unit = -1);
969extern DECL_EXP wxString getUsrTempUnit_Plugin(int unit = -1);
970extern DECL_EXP wxString GetNewGUID();
971extern "C" DECL_EXP bool PlugIn_GSHHS_CrossesLand(double lat1, double lon1,
972 double lat2, double lon2);
977extern DECL_EXP void PlugInPlaySound(wxString &sound_file);
978
979// API 1.10 Route and Waypoint Support
980extern DECL_EXP wxBitmap *FindSystemWaypointIcon(wxString &icon_name);
981extern DECL_EXP bool AddCustomWaypointIcon(wxBitmap *pimage, wxString key,
982 wxString description);
983
984extern DECL_EXP bool AddSingleWaypoint(PlugIn_Waypoint *pwaypoint,
985 bool b_permanent = true);
986extern DECL_EXP bool DeleteSingleWaypoint(wxString &GUID);
987extern DECL_EXP bool UpdateSingleWaypoint(PlugIn_Waypoint *pwaypoint);
988
989extern DECL_EXP bool AddPlugInRoute(PlugIn_Route *proute,
990 bool b_permanent = true);
991extern DECL_EXP bool DeletePlugInRoute(wxString &GUID);
992extern DECL_EXP bool UpdatePlugInRoute(PlugIn_Route *proute);
993
994extern DECL_EXP bool AddPlugInTrack(PlugIn_Track *ptrack,
995 bool b_permanent = true);
996extern DECL_EXP bool DeletePlugInTrack(wxString &GUID);
997extern DECL_EXP bool UpdatePlugInTrack(PlugIn_Track *ptrack);
998
999/* API 1.11 */
1000
1001/* API 1.11 adds some more common functions to avoid unnecessary code
1002 * duplication */
1003wxColour DECL_EXP GetBaseGlobalColor(wxString colorName);
1004int DECL_EXP OCPNMessageBox_PlugIn(wxWindow *parent, const wxString &message,
1005 const wxString &caption = _T("Message"),
1006 int style = wxOK, int x = -1, int y = -1);
1007
1008extern DECL_EXP wxString toSDMM_PlugIn(int NEflag, double a,
1009 bool hi_precision = true);
1010
1011extern "C" DECL_EXP wxString *GetpPrivateApplicationDataLocation();
1012extern DECL_EXP wxString GetOCPN_ExePath(void);
1013extern "C" DECL_EXP wxString *GetpPlugInLocation();
1014extern DECL_EXP wxString GetPlugInPath(opencpn_plugin *pplugin);
1015
1016extern "C" DECL_EXP int AddChartToDBInPlace(wxString &full_path,
1017 bool b_RefreshCanvas);
1018extern "C" DECL_EXP int RemoveChartFromDBInPlace(wxString &full_path);
1019extern DECL_EXP wxString GetLocaleCanonicalName();
1020
1021// API 1.11 adds access to S52 Presentation library
1022// Types
1023
1024// A flag field that defines the object capabilities passed by a chart to
1025// the S52 PLIB
1026
1027#define PLIB_CAPS_LINE_VBO 1
1028#define PLIB_CAPS_LINE_BUFFER 1 << 1
1029#define PLIB_CAPS_SINGLEGEO_BUFFER 1 << 2
1030#define PLIB_CAPS_OBJSEGLIST 1 << 3
1031#define PLIB_CAPS_OBJCATMUTATE 1 << 4
1032
1033class PI_S57Obj;
1034
1035WX_DECLARE_LIST(PI_S57Obj, ListOfPI_S57Obj);
1036
1037// ----------------------------------------------------------------------------
1038// PlugInChartBaseGL
1039// Derived from PlugInChartBase, add OpenGL Vector chart support
1040// ----------------------------------------------------------------------------
1041
1042class DECL_EXP PlugInChartBaseGL : public PlugInChartBase {
1043public:
1045 virtual ~PlugInChartBaseGL();
1046
1047 virtual int RenderRegionViewOnGL(const wxGLContext &glc,
1048 const PlugIn_ViewPort &VPoint,
1049 const wxRegion &Region, bool b_use_stencil);
1050
1051 virtual ListOfPI_S57Obj *GetObjRuleListAtLatLon(float lat, float lon,
1052 float select_radius,
1053 PlugIn_ViewPort *VPoint);
1054 virtual wxString CreateObjDescriptions(ListOfPI_S57Obj *obj_list);
1055
1056 virtual int GetNoCOVREntries();
1057 virtual int GetNoCOVRTablePoints(int iTable);
1058 virtual int GetNoCOVRTablenPoints(int iTable);
1059 virtual float *GetNoCOVRTableHead(int iTable);
1060};
1061
1062// ----------------------------------------------------------------------------
1063// PlugInChartBaseGLPlus2
1064// Derived from PlugInChartBaseGL, add additional chart management methods
1065// ----------------------------------------------------------------------------
1066
1068public:
1070 virtual ~PlugInChartBaseGLPlus2();
1071
1072 virtual ListOfPI_S57Obj *GetLightsObjRuleListVisibleAtLatLon(
1073 float lat, float lon, PlugIn_ViewPort *VPoint);
1074};
1075
1076// ----------------------------------------------------------------------------
1077// PlugInChartBaseExtended
1078// Derived from PlugInChartBase, add extended chart support methods
1079// ----------------------------------------------------------------------------
1080
1082public:
1084 virtual ~PlugInChartBaseExtended();
1085
1086 virtual int RenderRegionViewOnGL(const wxGLContext &glc,
1087 const PlugIn_ViewPort &VPoint,
1088 const wxRegion &Region, bool b_use_stencil);
1089
1090 virtual wxBitmap &RenderRegionViewOnDCNoText(const PlugIn_ViewPort &VPoint,
1091 const wxRegion &Region);
1092 virtual bool RenderRegionViewOnDCTextOnly(wxMemoryDC &dc,
1093 const PlugIn_ViewPort &VPoint,
1094 const wxRegion &Region);
1095
1096 virtual int RenderRegionViewOnGLNoText(const wxGLContext &glc,
1097 const PlugIn_ViewPort &VPoint,
1098 const wxRegion &Region,
1099 bool b_use_stencil);
1100
1101 virtual int RenderRegionViewOnGLTextOnly(const wxGLContext &glc,
1102 const PlugIn_ViewPort &VPoint,
1103 const wxRegion &Region,
1104 bool b_use_stencil);
1105
1106 virtual ListOfPI_S57Obj *GetObjRuleListAtLatLon(float lat, float lon,
1107 float select_radius,
1108 PlugIn_ViewPort *VPoint);
1109 virtual wxString CreateObjDescriptions(ListOfPI_S57Obj *obj_list);
1110
1111 virtual int GetNoCOVREntries();
1112 virtual int GetNoCOVRTablePoints(int iTable);
1113 virtual int GetNoCOVRTablenPoints(int iTable);
1114 virtual float *GetNoCOVRTableHead(int iTable);
1115
1116 virtual void ClearPLIBTextList();
1117};
1118
1119// ----------------------------------------------------------------------------
1120// PlugInChartBaseExtendedPlus2
1121// Derived from PlugInChartBaseExtended, add additional extended chart support
1122// methods
1123// ----------------------------------------------------------------------------
1124
1126public:
1129
1130 virtual ListOfPI_S57Obj *GetLightsObjRuleListVisibleAtLatLon(
1131 float lat, float lon, PlugIn_ViewPort *VPoint);
1132};
1133
1134class wxArrayOfS57attVal;
1135
1136// name of the addressed look up table set (fifth letter)
1137typedef enum _PI_LUPname {
1138 PI_SIMPLIFIED = 'L', // points
1139 PI_PAPER_CHART = 'R', // points
1140 PI_LINES = 'S', // lines
1141 PI_PLAIN_BOUNDARIES = 'N', // areas
1142 PI_SYMBOLIZED_BOUNDARIES = 'O', // areas
1143 PI_LUPNAME_NUM = 5
1144} PI_LUPname;
1145
1146// display category type
1147typedef enum _PI_DisCat {
1148 PI_DISPLAYBASE = 'D', //
1149 PI_STANDARD = 'S', //
1150 PI_OTHER = 'O', // O for OTHER
1151 PI_MARINERS_STANDARD = 'M', // Mariner specified
1152 PI_MARINERS_OTHER, // value not defined
1153 PI_DISP_CAT_NUM, // value not defined
1154} PI_DisCat;
1155
1156// Display Priority
1157typedef enum _PI_DisPrio {
1158 PI_PRIO_NODATA = '0', // no data fill area pattern
1159 PI_PRIO_GROUP1 = '1', // S57 group 1 filled areas
1160 PI_PRIO_AREA_1 = '2', // superimposed areas
1161 PI_PRIO_AREA_2 = '3', // superimposed areas also water features
1162 PI_PRIO_SYMB_POINT = '4', // point symbol also land features
1163 PI_PRIO_SYMB_LINE = '5', // line symbol also restricted areas
1164 PI_PRIO_SYMB_AREA = '6', // area symbol also traffic areas
1165 PI_PRIO_ROUTEING = '7', // routeing lines
1166 PI_PRIO_HAZARDS = '8', // hazards
1167 PI_PRIO_MARINERS = '9', // VRM, EBL, own ship
1168 PI_PRIO_NUM = 10 // number of priority levels
1169
1170} PI_DisPrio;
1171
1172typedef enum PI_InitReturn {
1173 PI_INIT_OK = 0,
1174 PI_INIT_FAIL_RETRY, // Init failed, retry suggested
1175 PI_INIT_FAIL_REMOVE, // Init failed, suggest remove from further use
1176 PI_INIT_FAIL_NOERROR // Init failed, request no explicit error message
1177} _PI_InitReturn;
1178
1180public:
1181 size_t vbo_offset;
1182 size_t n_points;
1183 int priority;
1184 float lat_max; // segment bounding box
1185 float lat_min;
1186 float lon_max;
1187 float lon_min;
1188 int type;
1189 void *private0;
1190
1192};
1193
1194class DECL_EXP PI_S57Obj {
1195public:
1196 // Public Methods
1197 PI_S57Obj();
1198
1199public:
1200 // Instance Data
1201 char FeatureName[8];
1202 int Primitive_type;
1203
1204 char *att_array;
1205 wxArrayOfS57attVal *attVal;
1206 int n_attr;
1207
1208 int iOBJL;
1209 int Index;
1210
1211 double x; // for POINT
1212 double y;
1213 double z;
1214 int npt; // number of points as needed by arrays
1215 void *geoPt; // for LINE & AREA not described by PolyTessGeo
1216 double *geoPtz; // an array[3] for MultiPoint, SM with Z, i.e. depth
1217 double *geoPtMulti; // an array[2] for MultiPoint, lat/lon to make bbox
1218 // of decomposed points
1219
1220 void *pPolyTessGeo;
1221
1222 double m_lat; // The lat/lon of the object's "reference" point
1223 double m_lon;
1224
1225 double chart_ref_lat;
1226 double chart_ref_lon;
1227
1228 double lat_min;
1229 double lat_max;
1230 double lon_min;
1231 double lon_max;
1232
1233 int Scamin; // SCAMIN attribute decoded during load
1234
1235 bool bIsClone;
1236 int nRef; // Reference counter, to signal OK for deletion
1237
1238 bool bIsAton; // This object is an aid-to-navigation
1239 bool bIsAssociable; // This object is DRGARE or DEPARE
1240
1241 int m_n_lsindex;
1242 int *m_lsindex_array;
1243 int m_n_edge_max_points;
1244 void *m_chart_context;
1245
1246 PI_DisCat m_DisplayCat;
1247
1248 void *S52_Context;
1249 PI_S57Obj *child; // child list, used only for MultiPoint Soundings
1250
1251 PI_S57Obj *next; // List linkage
1252
1253 // This transform converts from object geometry
1254 // to SM coordinates.
1255 double x_rate; // These auxiliary transform coefficients are
1256 double y_rate; // to be used in GetPointPix() and friends
1257 double x_origin; // on a per-object basis if necessary
1258 double y_origin;
1259
1260 int auxParm0; // some per-object auxiliary parameters, used for OpenGL
1261 int auxParm1;
1262 int auxParm2;
1263 int auxParm3;
1264
1265 PI_line_segment_element *m_ls_list;
1266 bool m_bcategory_mutable;
1267 int m_DPRI;
1268};
1269
1270wxString DECL_EXP PI_GetPLIBColorScheme();
1271int DECL_EXP PI_GetPLIBDepthUnitInt();
1272int DECL_EXP PI_GetPLIBSymbolStyle();
1273int DECL_EXP PI_GetPLIBBoundaryStyle();
1274int DECL_EXP PI_GetPLIBStateHash();
1275double DECL_EXP PI_GetPLIBMarinerSafetyContour();
1276bool DECL_EXP PI_GetObjectRenderBox(PI_S57Obj *pObj, double *lat_min,
1277 double *lat_max, double *lon_min,
1278 double *lon_max);
1279void DECL_EXP PI_UpdateContext(PI_S57Obj *pObj);
1280
1281bool DECL_EXP PI_PLIBObjectRenderCheck(PI_S57Obj *pObj, PlugIn_ViewPort *vp);
1282PI_LUPname DECL_EXP PI_GetObjectLUPName(PI_S57Obj *pObj);
1283PI_DisPrio DECL_EXP PI_GetObjectDisplayPriority(PI_S57Obj *pObj);
1284PI_DisCat DECL_EXP PI_GetObjectDisplayCategory(PI_S57Obj *pObj);
1285void DECL_EXP PI_PLIBSetLineFeaturePriority(PI_S57Obj *pObj, int prio);
1286void DECL_EXP PI_PLIBPrepareForNewRender(void);
1287void DECL_EXP PI_PLIBFreeContext(void *pContext);
1288void DECL_EXP PI_PLIBSetRenderCaps(unsigned int flags);
1289
1290bool DECL_EXP PI_PLIBSetContext(PI_S57Obj *pObj);
1291
1292int DECL_EXP PI_PLIBRenderObjectToDC(wxDC *pdc, PI_S57Obj *pObj,
1293 PlugIn_ViewPort *vp);
1294int DECL_EXP PI_PLIBRenderAreaToDC(wxDC *pdc, PI_S57Obj *pObj,
1295 PlugIn_ViewPort *vp, wxRect rect,
1296 unsigned char *pixbuf);
1297
1298int DECL_EXP PI_PLIBRenderAreaToGL(const wxGLContext &glcc, PI_S57Obj *pObj,
1299 PlugIn_ViewPort *vp, wxRect &render_rect);
1300
1301int DECL_EXP PI_PLIBRenderObjectToGL(const wxGLContext &glcc, PI_S57Obj *pObj,
1302 PlugIn_ViewPort *vp, wxRect &render_rect);
1303
1304/* API 1.11 OpenGL Display List and vertex buffer object routines
1305
1306 Effectively these two routines cancel each other so all
1307 of the translation, scaling and rotation can be done by opengl.
1308
1309 Display lists need only be built infrequently, but used in each frame
1310 greatly accelerates the speed of rendering. This avoids costly calculations,
1311 and also allows the vertexes to be stored in graphics memory.
1312
1313 static int dl = 0;
1314 glPushMatrix();
1315 PlugInMultMatrixViewport(current_viewport);
1316 if(dl)
1317 glCallList(dl);
1318 else {
1319 dl = glGenLists(1);
1320 PlugInViewPort norm_viewport = current_viewport;
1321 NormalizeViewPort(norm_viewport);
1322 glNewList(dl, GL_COMPILE_AND_EXECUTE);
1323 ... // use norm_viewport with GetCanvasLLPix here
1324 glEndList();
1325 }
1326 glPopMatrix();
1327 ... // use current_viewport with GetCanvasLLPix again
1328*/
1329
1330extern DECL_EXP bool PlugInHasNormalizedViewPort(PlugIn_ViewPort *vp);
1331extern DECL_EXP void PlugInMultMatrixViewport(PlugIn_ViewPort *vp,
1332 float lat = 0, float lon = 0);
1333extern DECL_EXP void PlugInNormalizeViewport(PlugIn_ViewPort *vp, float lat = 0,
1334 float lon = 0);
1335
1336class wxPoint2DDouble;
1337extern "C" DECL_EXP void GetDoubleCanvasPixLL(PlugIn_ViewPort *vp,
1338 wxPoint2DDouble *pp, double lat,
1339 double lon);
1340
1341/* API 1.13 */
1342/* API 1.13 adds some more common functions to avoid unnecessary code
1343 * duplication */
1344
1345extern DECL_EXP double fromDMM_Plugin(wxString sdms);
1346extern DECL_EXP void SetCanvasRotation(double rotation);
1347extern DECL_EXP void SetCanvasProjection(int projection);
1348extern DECL_EXP bool GetSingleWaypoint(wxString GUID,
1349 PlugIn_Waypoint *pwaypoint);
1350extern DECL_EXP bool CheckEdgePan_PlugIn(int x, int y, bool dragging,
1351 int margin, int delta);
1352extern DECL_EXP wxBitmap GetIcon_PlugIn(const wxString &name);
1353extern DECL_EXP void SetCursor_PlugIn(wxCursor *pPlugin_Cursor = NULL);
1389extern DECL_EXP wxFont *GetOCPNScaledFont_PlugIn(wxString TextElement,
1390 int default_size = 0);
1404extern DECL_EXP wxFont GetOCPNGUIScaledFont_PlugIn(wxString item);
1405extern DECL_EXP double GetOCPNGUIToolScaleFactor_PlugIn(int GUIScaledFactor);
1406extern DECL_EXP double GetOCPNGUIToolScaleFactor_PlugIn();
1407extern DECL_EXP float GetOCPNChartScaleFactor_Plugin();
1415extern DECL_EXP wxColour GetFontColour_PlugIn(wxString TextElement);
1416
1417extern DECL_EXP double GetCanvasTilt();
1418extern DECL_EXP void SetCanvasTilt(double tilt);
1419
1425extern DECL_EXP bool PlugInPlaySoundEx(wxString &sound_file,
1426 int deviceIndex = -1);
1427extern DECL_EXP void AddChartDirectory(wxString &path);
1428extern DECL_EXP void ForceChartDBUpdate();
1429extern DECL_EXP void ForceChartDBRebuild();
1430
1431extern DECL_EXP wxString GetWritableDocumentsDir(void);
1432extern DECL_EXP wxDialog *GetActiveOptionsDialog();
1433extern DECL_EXP wxArrayString GetWaypointGUIDArray(void);
1434extern DECL_EXP wxArrayString GetIconNameArray(void);
1435
1446extern DECL_EXP bool AddPersistentFontKey(wxString TextElement);
1447extern DECL_EXP wxString GetActiveStyleName();
1448
1449extern DECL_EXP wxBitmap GetBitmapFromSVGFile(wxString filename,
1450 unsigned int width,
1451 unsigned int height);
1452extern DECL_EXP bool IsTouchInterface_PlugIn(void);
1453
1454/* Platform optimized File/Dir selector dialogs */
1455extern DECL_EXP int PlatformDirSelectorDialog(wxWindow *parent,
1456 wxString *file_spec,
1457 wxString Title, wxString initDir);
1458
1459extern DECL_EXP int PlatformFileSelectorDialog(wxWindow *parent,
1460 wxString *file_spec,
1461 wxString Title, wxString initDir,
1462 wxString suggestedName,
1463 wxString wildcard);
1464
1465/* OpenCPN HTTP File Download PlugIn Interface */
1466
1467/* Various method Return Codes, etc */
1468typedef enum _OCPN_DLStatus {
1469 OCPN_DL_UNKNOWN = -1,
1470 OCPN_DL_NO_ERROR = 0,
1471 OCPN_DL_FAILED = 1,
1472 OCPN_DL_ABORTED = 2,
1473 OCPN_DL_USER_TIMEOUT = 4,
1474 OCPN_DL_STARTED = 8
1475} OCPN_DLStatus;
1476
1477typedef enum _OCPN_DLCondition {
1478 OCPN_DL_EVENT_TYPE_UNKNOWN = -1,
1479 OCPN_DL_EVENT_TYPE_START = 80,
1480 OCPN_DL_EVENT_TYPE_PROGRESS = 81,
1481 OCPN_DL_EVENT_TYPE_END = 82
1482} OCPN_DLCondition;
1483
1484// Style definitions for Synchronous file download modal dialogs, if
1485// desired. Abstracted from wxCURL package
1489 0x0002,
1492 OCPN_DLDS_SIZE = 0x0010,
1495 0x0020,
1496
1497 // styles related to the use of wxCurlConnectionSettingsDialog:
1498
1500 0x0040,
1505 0x0100,
1506
1507 OCPN_DLDS_CONN_SETTINGS_ALL = OCPN_DLDS_CONN_SETTINGS_AUTH |
1510
1511 OCPN_DLDS_SHOW_ALL = OCPN_DLDS_ELAPSED_TIME | OCPN_DLDS_ESTIMATED_TIME |
1514 OCPN_DLDS_CONN_SETTINGS_ALL,
1515
1517 OCPN_DLDS_CAN_START = 0x0400,
1520
1522 0x1000,
1523
1524 // by default all available features are enabled:
1525 OCPN_DLDS_DEFAULT_STYLE = OCPN_DLDS_CAN_START | OCPN_DLDS_CAN_PAUSE |
1526 OCPN_DLDS_CAN_ABORT | OCPN_DLDS_SHOW_ALL |
1528};
1529
1530#define ONLINE_CHECK_RETRY \
1531 30 // Recheck the Internet connection availability every ONLINE_CHECK_RETRY s
1532
1533/* Synchronous (Blocking) download of a single file */
1534
1535extern DECL_EXP _OCPN_DLStatus OCPN_downloadFile(
1536 const wxString &url, const wxString &outputFile, const wxString &title,
1537 const wxString &message, const wxBitmap &bitmap, wxWindow *parent,
1538 long style, int timeout_secs);
1539
1540/* Asynchronous (Background) download of a single file */
1541
1542extern DECL_EXP _OCPN_DLStatus
1543OCPN_downloadFileBackground(const wxString &url, const wxString &outputFile,
1544 wxEvtHandler *handler, long *handle);
1545
1546extern DECL_EXP void OCPN_cancelDownloadFileBackground(long handle);
1547
1548/* Synchronous (Blocking) HTTP POST operation for small amounts of data */
1549
1550extern DECL_EXP _OCPN_DLStatus OCPN_postDataHttp(const wxString &url,
1551 const wxString &parameters,
1552 wxString &result,
1553 int timeout_secs);
1554
1555/* Check whether connection to the Internet is working */
1556
1557extern DECL_EXP bool OCPN_isOnline();
1558
1559/* Supporting Event for Background downloading */
1560/* OCPN_downloadEvent Definition */
1561
1562/* PlugIn should be ready/able to handle this event after initiating a
1563 * background file transfer
1564 *
1565 * The event as received should be parsed primarily by the getDLEventCondition()
1566 * method. This will allow identification of download start, progress, and end
1567 * states.
1568 *
1569 * Other accessor methods contain status, byte counts, etc.
1570 *
1571 * A PlugIn may safely destroy its EvtHandler after receipt of an
1572 * OCPN_downloadEvent with getDLEventCondition == OCPN_DL_EVENT_TYPE_END
1573 */
1574
1575class DECL_EXP OCPN_downloadEvent : public wxEvent {
1576public:
1577 OCPN_downloadEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
1579
1580 // accessors
1581 _OCPN_DLStatus getDLEventStatus() { return m_stat; }
1582 OCPN_DLCondition getDLEventCondition() { return m_condition; }
1583
1584 void setDLEventStatus(_OCPN_DLStatus stat) { m_stat = stat; }
1585 void setDLEventCondition(OCPN_DLCondition cond) { m_condition = cond; }
1586
1587 void setTotal(long bytes) { m_totalBytes = bytes; }
1588 void setTransferred(long bytes) { m_sofarBytes = bytes; }
1589 long getTotal() { return m_totalBytes; }
1590 long getTransferred() { return m_sofarBytes; }
1591
1592 void setComplete(bool b_complete) { m_b_complete = b_complete; }
1593 bool getComplete() { return m_b_complete; }
1594
1595 // required for sending with wxPostEvent()
1596 wxEvent *Clone() const;
1597
1598private:
1599 OCPN_DLStatus m_stat;
1600 OCPN_DLCondition m_condition;
1601
1602 long m_totalBytes;
1603 long m_sofarBytes;
1604 bool m_b_complete;
1605};
1606
1607// extern WXDLLIMPEXP_CORE const wxEventType wxEVT_DOWNLOAD_EVENT;
1608
1609#ifdef MAKING_PLUGIN
1610extern DECL_IMP wxEventType wxEVT_DOWNLOAD_EVENT;
1611#else
1612extern DECL_EXP wxEventType wxEVT_DOWNLOAD_EVENT;
1613#endif
1614
1615/* API 1.14 */
1616/* API 1.14 adds some more common functions to avoid unnecessary code
1617 * duplication */
1618
1619bool LaunchDefaultBrowser_Plugin(wxString url);
1620
1621// API 1.14 Extra canvas Support
1622
1623/* Allow drawing of objects onto other OpenGL canvases */
1624extern DECL_EXP void PlugInAISDrawGL(wxGLCanvas *glcanvas,
1625 const PlugIn_ViewPort &vp);
1635extern DECL_EXP bool PlugInSetFontColor(const wxString TextElement,
1636 const wxColour color);
1637
1638// API 1.15
1639extern DECL_EXP double PlugInGetDisplaySizeMM();
1640
1653extern DECL_EXP wxFont *FindOrCreateFont_PlugIn(
1654 int point_size, wxFontFamily family, wxFontStyle style, wxFontWeight weight,
1655 bool underline = false, const wxString &facename = wxEmptyString,
1656 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
1657
1658extern DECL_EXP int PlugInGetMinAvailableGshhgQuality();
1659extern DECL_EXP int PlugInGetMaxAvailableGshhgQuality();
1660
1661extern DECL_EXP void PlugInHandleAutopilotRoute(bool enable);
1662
1663// API 1.16
1664//
1680extern DECL_EXP wxString GetPluginDataDir(const char *plugin_name);
1681
1682extern DECL_EXP bool ShuttingDown(void);
1683
1684// Support for MUI MultiCanvas model
1685
1686extern DECL_EXP wxWindow *PluginGetFocusCanvas();
1687extern DECL_EXP wxWindow *PluginGetOverlayRenderCanvas();
1688
1689extern "C" DECL_EXP void CanvasJumpToPosition(wxWindow *canvas, double lat,
1690 double lon, double scale);
1691extern "C" DECL_EXP int AddCanvasMenuItem(wxMenuItem *pitem,
1692 opencpn_plugin *pplugin,
1693 const char *name = "");
1694extern "C" DECL_EXP void RemoveCanvasMenuItem(
1695 int item, const char *name = ""); // Fully remove this item
1696extern "C" DECL_EXP void SetCanvasMenuItemViz(
1697 int item, bool viz,
1698 const char *name = ""); // Temporarily change context menu options
1699extern "C" DECL_EXP void SetCanvasMenuItemGrey(int item, bool grey,
1700 const char *name = "");
1701
1702// Extract waypoints, routes and tracks
1703extern DECL_EXP wxString GetSelectedWaypointGUID_Plugin();
1704extern DECL_EXP wxString GetSelectedRouteGUID_Plugin();
1705extern DECL_EXP wxString GetSelectedTrackGUID_Plugin();
1706
1707extern DECL_EXP std::unique_ptr<PlugIn_Waypoint> GetWaypoint_Plugin(
1708 const wxString &); // doublon with GetSingleWaypoint
1709extern DECL_EXP std::unique_ptr<PlugIn_Route> GetRoute_Plugin(const wxString &);
1710extern DECL_EXP std::unique_ptr<PlugIn_Track> GetTrack_Plugin(const wxString &);
1711
1712extern DECL_EXP wxWindow *GetCanvasUnderMouse();
1713extern DECL_EXP int GetCanvasIndexUnderMouse();
1714// extern DECL_EXP std::vector<wxWindow *> GetCanvasArray();
1715extern DECL_EXP wxWindow *GetCanvasByIndex(int canvasIndex);
1716extern DECL_EXP int GetCanvasCount();
1717extern DECL_EXP bool CheckMUIEdgePan_PlugIn(int x, int y, bool dragging,
1718 int margin, int delta,
1719 int canvasIndex);
1720extern DECL_EXP void SetMUICursor_PlugIn(wxCursor *pCursor, int canvasIndex);
1721
1722// API 1.17
1723//
1724extern DECL_EXP wxRect GetMasterToolbarRect();
1725
1726enum SDDMFORMAT {
1727 DEGREES_DECIMAL_MINUTES = 0,
1728 DECIMAL_DEGREES,
1729 DEGREES_MINUTES_SECONDS,
1730 END_SDDMFORMATS
1731};
1732
1733extern DECL_EXP int GetLatLonFormat(void);
1734
1735// API 1.17
1736extern "C" DECL_EXP void ZeroXTE();
1737
1738// Extended Waypoint manipulation API
1739class DECL_EXP PlugIn_Waypoint_Ex {
1740public:
1742 PlugIn_Waypoint_Ex(double lat, double lon, const wxString &icon_ident,
1743 const wxString &wp_name, const wxString &GUID = "",
1744 const double ScaMin = 1e9, const bool bNameVisible = false,
1745 const int nRanges = 0, const double RangeDistance = 1.0,
1746 const wxColor RangeColor = wxColor(255, 0, 0));
1748 void InitDefaults();
1749
1750 bool GetFSStatus(); // return "free standing" status
1751 // To be a "free standing waypoint"(FSWP),
1752 // the RoutePoint will have been created by GUI dropping
1753 // a point; by importing a waypoint in a GPX file or by
1754 // the AddSingleWaypoint API.
1755
1756 int GetRouteMembershipCount(); // Return the number of routes to which this
1757 // WP belongs
1758
1759 double m_lat;
1760 double m_lon;
1761
1762 wxString m_GUID;
1763
1764 wxString m_MarkName;
1765 wxString m_MarkDescription;
1766 wxDateTime m_CreateTime;
1767 bool IsVisible;
1768 bool IsActive;
1769
1770 double scamin;
1771 bool b_useScamin;
1772 bool IsNameVisible;
1773 int nrange_rings;
1774 double RangeRingSpace;
1775 wxColour RangeRingColor;
1776
1777 wxString IconName;
1778 wxString IconDescription;
1779
1780 Plugin_HyperlinkList *m_HyperlinkList;
1781};
1782
1783WX_DECLARE_LIST(PlugIn_Waypoint_Ex, Plugin_WaypointExList);
1784
1785class DECL_EXP PlugIn_Route_Ex {
1786public:
1787 PlugIn_Route_Ex(void);
1788 ~PlugIn_Route_Ex(void);
1789
1790 wxString m_NameString;
1791 wxString m_StartString;
1792 wxString m_EndString;
1793 wxString m_GUID;
1794 bool m_isActive;
1795 bool m_isVisible;
1796 wxString m_Description;
1797
1798 Plugin_WaypointExList *pWaypointList;
1799};
1800
1801extern DECL_EXP wxArrayString GetRouteGUIDArray(void);
1802extern DECL_EXP wxArrayString GetTrackGUIDArray(void);
1803
1804extern DECL_EXP bool GetSingleWaypointEx(wxString GUID,
1805 PlugIn_Waypoint_Ex *pwaypoint);
1806
1807extern DECL_EXP bool AddSingleWaypointEx(PlugIn_Waypoint_Ex *pwaypoint,
1808 bool b_permanent = true);
1809extern DECL_EXP bool UpdateSingleWaypointEx(PlugIn_Waypoint_Ex *pwaypoint);
1810
1811extern DECL_EXP bool AddPlugInRouteEx(PlugIn_Route_Ex *proute,
1812 bool b_permanent = true);
1813extern DECL_EXP bool UpdatePlugInRouteEx(PlugIn_Route_Ex *proute);
1814
1815extern DECL_EXP std::unique_ptr<PlugIn_Waypoint_Ex> GetWaypointEx_Plugin(
1816 const wxString &);
1817extern DECL_EXP std::unique_ptr<PlugIn_Route_Ex> GetRouteEx_Plugin(
1818 const wxString &);
1819
1820extern DECL_EXP wxString
1821GetActiveWaypointGUID(void); // if no active waypoint, returns wxEmptyString
1822extern DECL_EXP wxString
1823GetActiveRouteGUID(void); // if no active route, returns wxEmptyString
1824
1825// API 1.18
1826
1827// Scaled display support, as on some GTK3 and Mac Retina devices
1828extern DECL_EXP double OCPN_GetDisplayContentScaleFactor();
1829
1830// Scaled display support, on Windows devices
1831extern DECL_EXP double OCPN_GetWinDIPScaleFactor();
1832
1833// Comm Priority query support
1834extern DECL_EXP std::vector<std::string> GetPriorityMaps();
1835extern DECL_EXP std::vector<std::string> GetActivePriorityIdentifiers();
1836
1837extern DECL_EXP int GetGlobalWatchdogTimoutSeconds();
1838
1839typedef enum _OBJECT_LAYER_REQ {
1840 OBJECTS_ALL = 0,
1841 OBJECTS_NO_LAYERS,
1842 OBJECTS_ONLY_LAYERS
1843} OBJECT_LAYER_REQ;
1844
1845// FIXME (dave) Implement these
1846extern DECL_EXP wxArrayString GetRouteGUIDArray(OBJECT_LAYER_REQ req);
1847extern DECL_EXP wxArrayString GetTrackGUIDArray(OBJECT_LAYER_REQ req);
1848extern DECL_EXP wxArrayString GetWaypointGUIDArray(OBJECT_LAYER_REQ req);
1849
1852/* Listening to messages. */
1853class ObservableListener;
1854
1856class ObservedEvt;
1857
1858// This is a verbatim copy from observable_evt.h, don't define twice.
1859#ifndef OBSERVABLE_EVT_H
1860#define OBSERVABLE_EVT_H
1861
1862wxDECLARE_EVENT(obsNOTIFY, ObservedEvt);
1863
1865class ObservedEvt : public wxCommandEvent {
1866public:
1867 ObservedEvt(wxEventType commandType = obsNOTIFY, int id = 0)
1868 : wxCommandEvent(commandType, id) {}
1869 ObservedEvt(const ObservedEvt &event) : wxCommandEvent(event) {
1870 this->m_shared_ptr = event.m_shared_ptr;
1871 }
1872
1873 wxEvent *Clone() const { return new ObservedEvt(*this); }
1874
1875 std::shared_ptr<const void> GetSharedPtr() const { return m_shared_ptr; }
1876
1877 void SetSharedPtr(std::shared_ptr<const void> p) { m_shared_ptr = p; }
1878
1879private:
1880 std::shared_ptr<const void> m_shared_ptr;
1881};
1882
1883#endif // OBSERVABLE_EVT_H
1884
1885class ObservableListener;
1886
1889 const uint64_t id;
1890 NMEA2000Id(int value) : id(static_cast<uint64_t>(value)) {};
1891};
1892
1893extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
1894 NMEA2000Id id, wxEventType ev, wxEvtHandler *handler);
1895
1898 const std::string id;
1899 NMEA0183Id(const std::string &s) : id(s) {};
1900};
1901
1902extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
1903 NMEA0183Id id, wxEventType ev, wxEvtHandler *handler);
1904
1907 const std::string id;
1908 SignalkId(const std::string &s) : id(s) {};
1909};
1910
1911extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
1912 SignalkId id, wxEventType ev, wxEvtHandler *handler);
1913
1929extern DECL_EXP std::vector<uint8_t> GetN2000Payload(NMEA2000Id id,
1930 ObservedEvt ev);
1931
1948extern DECL_EXP std::shared_ptr<void> GetSignalkPayload(ObservedEvt ev);
1949
1954extern DECL_EXP std::string GetN2000Source(NMEA2000Id id, ObservedEvt ev);
1955
1957extern DECL_EXP std::string GetN0183Payload(NMEA0183Id id, ObservedEvt ev);
1958
1961 const int type;
1962 NavDataId() : type(0) {}
1963};
1964
1965extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
1966 NavDataId id, wxEventType ev, wxEvtHandler *handler);
1967
1970 double lat;
1971 double lon;
1972 double sog;
1973 double cog;
1974 double var;
1975 double hdt;
1976 time_t time;
1977};
1978
1980extern DECL_EXP PluginNavdata GetEventNavdata(ObservedEvt ev);
1981
1983/*
1984 * Plugins may access comm ports for direct output.
1985 * The general program flow for a plugin may look something like this
1986 * pseudo-code:
1987 * 1. Plugin will query OCPN core for a list of active comm drivers.
1988 * 2. Plugin will inspect the list, and query OCPN core for driver
1989 * attributes.
1990 * 3. Plugin will select a comm driver with appropriate attributes for output.
1991 * 4. Plugin will register a list of PGNs expected to be transmitted
1992 * (N2K specific)
1993 * 5. Plugin may then send a payload buffer to a specific comm driver for
1994 * output as soon as possible.
1995 *
1996 * The mechanism for specifying a particular comm driver uses the notion of
1997 * "handles". Each active comm driver has an associated opaque handle, managed
1998 * by OCPN core. All references by a plugin to a driver are by means of its
1999 * handle. Handles should be considered to be "opaque", meaning that the exact
2000 * contents of the handle are of no specific value to the plugin, and only
2001 * have meaning to the OCPN core management of drivers.
2002 */
2003
2005typedef std::string DriverHandle;
2006
2009typedef enum CommDriverResult {
2010 RESULT_COMM_NO_ERROR = 0,
2011 RESULT_COMM_INVALID_HANDLE,
2012 RESULT_COMM_INVALID_PARMS,
2013 RESULT_COMM_TX_ERROR,
2014 RESULT_COMM_REGISTER_GATEWAY_ERROR,
2015 RESULT_COMM_REGISTER_PGN_ERROR
2017
2019extern DECL_EXP std::vector<DriverHandle> GetActiveDrivers();
2020
2022/* Driver attributes are available from OCPN core as a hash map of
2023 * tag->attribute pairs. There is a defined set of common tags guaranteed
2024 * for every driver. Both tags and attributes are defined as std::string.
2025 * Here is the list of common tag-attribute pairs.
2026 *
2027 * Tag Attribute definition
2028 * ---------- --------------------
2029 * "protocol" Comm bus device protocol, such as "NMEA0183", "NMEA2000"
2030 *
2031 *
2032 */
2033
2035extern DECL_EXP const std::unordered_map<std::string, std::string>
2037
2038/* Writing to a specific driver */
2048extern DECL_EXP CommDriverResult WriteCommDriver(
2049 DriverHandle handle, const std::shared_ptr<std::vector<uint8_t>> &payload);
2050
2052extern DECL_EXP CommDriverResult WriteCommDriverN2K(
2053 DriverHandle handle, int PGN, int destinationCANAddress, int priority,
2054 const std::shared_ptr<std::vector<uint8_t>> &payload);
2055
2098extern DECL_EXP CommDriverResult RegisterTXPGNs(DriverHandle handle,
2099 std::vector<int> &pgn_list);
2100
2101// API 1.19
2102//
2103
2104// Navigation mode
2105typedef enum _PI_NavMode {
2106 PI_NORTH_UP_MODE = 0,
2107 PI_COURSE_UP_MODE,
2108 PI_HEAD_UP_MODE,
2109} PI_NavMode;
2110
2113 const std::string id;
2114 PluginMsgId(const std::string &s) : id(s) {};
2115};
2116
2121extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
2122 PluginMsgId id, wxEventType ev, wxEvtHandler *handler);
2123
2128extern DECL_EXP std::string GetPluginMsgPayload(PluginMsgId id, ObservedEvt ev);
2129
2130// Assorted GUI utility functions
2131extern DECL_EXP void ExitOCPN();
2132
2133extern "C" DECL_EXP void RequestWindowRefresh(wxWindow *win,
2134 bool eraseBackground);
2135
2136extern DECL_EXP bool GetFullScreen();
2137extern DECL_EXP void SetFullScreen(bool full_screen_on);
2138
2139extern DECL_EXP void EnableTouchMode(bool enable);
2140extern DECL_EXP bool GetTouchMode();
2141
2142extern DECL_EXP void SetGlobalColor(std::string table, std::string name,
2143 wxColor color);
2144extern DECL_EXP wxColor GetGlobalColorD(std::string map_name, std::string name);
2145
2146extern DECL_EXP void EnableStatusBar(bool enable);
2147extern DECL_EXP void EnableMenu(bool enable);
2148extern DECL_EXP bool GetEnableStatusBar();
2149extern DECL_EXP bool GetEnableMenu();
2150
2151extern DECL_EXP void SetNavigationMode(PI_NavMode mode, int CanvasIndex);
2152extern DECL_EXP PI_NavMode GetNavigationMode(int CanvasIndex);
2153extern DECL_EXP void EnableLookaheadMode(bool enable, int CanvasIndex);
2154extern DECL_EXP bool GetEnableLookaheadMode(int CanvasIndex);
2155
2156extern DECL_EXP void EnableMUIBar(bool enable, int CanvasIndex);
2157extern DECL_EXP void EnableCompassGPSIcon(bool enable, int CanvasIndex);
2158extern DECL_EXP void EnableChartBar(bool enable, int CanvasIndex);
2159extern DECL_EXP bool GetEnableMUIBar(int CanvasIndex);
2160extern DECL_EXP bool GetEnableCompassGPSIcon(int CanvasIndex);
2161extern DECL_EXP bool GetEnableChartBar(int CanvasIndex);
2162
2163extern DECL_EXP void EnableCanvasFocusBar(bool enable, int CanvasIndex);
2164extern DECL_EXP bool GetEnableCanvasFocusBar(int CanvasIndex);
2165
2166/*
2167 * Allow plugin control of "Chart Panel Options" dialog
2168 */
2169
2170extern DECL_EXP void EnableLatLonGrid(bool enable, int CanvasIndex);
2171extern DECL_EXP void EnableChartOutlines(bool enable, int CanvasIndex);
2172extern DECL_EXP void EnableDepthUnitDisplay(bool enable, int CanvasIndex);
2173extern DECL_EXP void EnableAisTargetDisplay(bool enable, int CanvasIndex);
2174extern DECL_EXP void EnableTideStationsDisplay(bool enable, int CanvasIndex);
2175extern DECL_EXP void EnableCurrentStationsDisplay(bool enable, int CanvasIndex);
2176extern DECL_EXP void EnableENCTextDisplay(bool enable, int CanvasIndex);
2177extern DECL_EXP void EnableENCDepthSoundingsDisplay(bool enable,
2178 int CanvasIndex);
2179extern DECL_EXP void EnableBuoyLightLabelsDisplay(bool enable, int CanvasIndex);
2180extern DECL_EXP void EnableLightsDisplay(bool enable, int CanvasIndex);
2181extern DECL_EXP void EnableLightDescriptionsDisplay(bool enable,
2182 int CanvasIndex);
2183extern DECL_EXP void SetENCDisplayCategory(PI_DisCat cat, int CanvasIndex);
2184
2185extern DECL_EXP bool GetEnableLatLonGrid(int CanvasIndex);
2186extern DECL_EXP bool GetEnableChartOutlines(int CanvasIndex);
2187extern DECL_EXP bool GetEnableDepthUnitDisplay(int CanvasIndex);
2188extern DECL_EXP bool GetEnableAisTargetDisplay(int CanvasIndex);
2189extern DECL_EXP bool GetEnableTideStationsDisplay(int CanvasIndex);
2190extern DECL_EXP bool GetEnableCurrentStationsDisplay(int CanvasIndex);
2191extern DECL_EXP bool GetEnableENCTextDisplay(int CanvasIndex);
2192extern DECL_EXP bool GetEnableENCDepthSoundingsDisplay(int CanvasIndex);
2193extern DECL_EXP bool GetEnableBuoyLightLabelsDisplay(int CanvasIndex);
2194extern DECL_EXP bool GetEnableLightsDisplay(int CanvasIndex);
2195extern DECL_EXP bool GetEnableLightDescriptionsDisplay(int CanvasIndex);
2196extern DECL_EXP PI_DisCat GetENCDisplayCategory(int CanvasIndex);
2197
2198extern DECL_EXP void PluginSetFollowMode(int CanvasIndex, bool enable_follow);
2199extern DECL_EXP bool PluginGetFollowMode(int CanvasIndex);
2200
2201extern DECL_EXP void SetTrackingMode(bool enable);
2202extern DECL_EXP bool GetTrackingMode();
2203
2204extern DECL_EXP void SetAppColorScheme(PI_ColorScheme cs);
2205extern DECL_EXP PI_ColorScheme GetAppColorScheme();
2206
2207// Control core split-screen mode
2208extern DECL_EXP void EnableSplitScreenLayout(bool enable = true);
2209
2210// ChartCanvas control utilities
2211
2212extern DECL_EXP void PluginZoomCanvas(int CanvasIndex, double factor);
2213
2214extern DECL_EXP bool GetEnableMainToolbar();
2215extern DECL_EXP void SetEnableMainToolbar(bool enable);
2216
2217extern DECL_EXP void ShowGlobalSettingsDialog();
2218
2219extern DECL_EXP void PluginCenterOwnship(int CanvasIndex);
2220
2221extern DECL_EXP bool GetEnableTenHertzUpdate();
2222extern DECL_EXP void EnableTenHertzUpdate(bool enable);
2223
2224extern DECL_EXP void ConfigFlushAndReload();
2225
2226#endif //_PLUGIN_H_
Keeps listening over it's lifespan, removes itself on destruction.
Definition observable.h:131
Adds a std::shared<void> element to wxCommandEvent.
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.
DECL_EXP wxFont GetOCPNGUIScaledFont_PlugIn(wxString item)
Gets a uniquely scaled font copy for responsive UI elements.
CommDriverResult
Error return values
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 std::shared_ptr< void > GetSignalkPayload(ObservedEvt ev)
Get SignalK status payload after receiving a message.
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 bool PlugInSetFontColor(const wxString TextElement, const wxColour color)
Sets text color for a UI element.
DECL_EXP CommDriverResult WriteCommDriver(DriverHandle handle, const std::shared_ptr< std::vector< uint8_t > > &payload)
Send a non-NMEA2000 message.
DECL_EXP std::string GetN0183Payload(NMEA0183Id id, ObservedEvt ev)
Return payload in a received n0183 message of type id in ev.
std::string DriverHandle
Plugin API supporting direct access to comm drivers for output purposes.
DECL_EXP bool AddPersistentFontKey(wxString TextElement)
Registers a new font configuration element.
DECL_EXP PluginNavdata GetEventNavdata(ObservedEvt ev)
Return BasicNavDataMsg decoded data available in ev.
DECL_EXP int GetGlobalWatchdogTimoutSeconds()
Comm Global Watchdog Query
DECL_EXP std::vector< uint8_t > GetN2000Payload(NMEA2000Id id, ObservedEvt ev)
Return N2K payload for a received n2000 message of type id in ev.
DECL_EXP wxColour GetFontColour_PlugIn(wxString TextElement)
Gets color configured for a UI text element.
DECL_EXP 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 bool PlugInPlaySoundEx(wxString &sound_file, int deviceIndex=-1)
Start playing a sound file asynchronously.
DECL_EXP const std::unordered_map< std::string, std::string > GetAttributes(DriverHandle handle)
Query a specific driver for attributes
DECL_EXP std::vector< DriverHandle > GetActiveDrivers()
Query OCPN core for a list of active drivers
enum CommDriverResult _CommDriverResult
Error return values
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 void PlugInPlaySound(wxString &sound_file)
Start playing a sound file asynchronously.
DECL_EXP std::vector< std::string > GetPriorityMaps()
Comm Priority query support methods
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 wxString GetPluginDataDir(const char *plugin_name)
Return the plugin data directory for a given directory name.
DECL_EXP wxFont * OCPNGetFont(wxString TextElement, int default_size)
Gets a font for UI elements.
Facade for NavAddr0183.
Facade for NavAddr2000.
Facade for BasicNavDataMsg.
Facade for NavAddrPluginMsg.
Available decoded data for plugins.
Facade for NavAddrSignalK.