32 #if defined(__WXMSW__) || defined(__CYGWIN__)
33 #define DECL_EXP __declspec(dllexport)
34 #elif defined __GNUC__ && __GNUC__ >= 4
35 #define DECL_EXP __attribute__((visibility("default")))
36 #elif defined __WXOSX__
37 #define DECL_EXP __attribute__((visibility("default")))
43 #if defined(__WXMSW__) && defined(MAKING_PLUGIN)
44 #define DECL_IMP __declspec(dllimport)
49 #include <wx/xml/xml.h>
50 #include <wx/dcmemory.h>
51 #include <wx/dialog.h>
53 #include <wx/menuitem.h>
54 #include <wx/gdicmn.h>
57 #include <wx/bitmap.h>
62 #include <unordered_map>
70 #define API_VERSION_MAJOR 1
71 #define API_VERSION_MINOR 18
78 class wxScrolledWindow;
86 #define WANTS_OVERLAY_CALLBACK 0x00000001
87 #define WANTS_CURSOR_LATLON 0x00000002
88 #define WANTS_TOOLBAR_CALLBACK 0x00000004
89 #define INSTALLS_TOOLBAR_TOOL 0x00000008
90 #define WANTS_CONFIG 0x00000010
91 #define INSTALLS_TOOLBOX_PAGE 0x00000020
92 #define INSTALLS_CONTEXTMENU_ITEMS 0x00000040
93 #define WANTS_NMEA_SENTENCES 0x00000080
94 #define WANTS_NMEA_EVENTS 0x00000100
95 #define WANTS_AIS_SENTENCES 0x00000200
96 #define USES_AUI_MANAGER 0x00000400
97 #define WANTS_PREFERENCES 0x00000800
98 #define INSTALLS_PLUGIN_CHART 0x00001000
99 #define WANTS_ONPAINT_VIEWPORT 0x00002000
100 #define WANTS_PLUGIN_MESSAGING 0x00004000
101 #define WANTS_OPENGL_OVERLAY_CALLBACK 0x00008000
102 #define WANTS_DYNAMIC_OPENGL_OVERLAY_CALLBACK 0x00010000
103 #define WANTS_LATE_INIT 0x00020000
104 #define INSTALLS_PLUGIN_CHART_GL 0x00040000
105 #define WANTS_MOUSE_EVENTS 0x00080000
106 #define WANTS_VECTOR_CHART_OBJECT_INFO 0x00100000
107 #define WANTS_KEYBOARD_EVENTS 0x00200000
114 #define OVERLAY_LEGACY 0
115 #define OVERLAY_OVER_SHIPS 64
116 #define OVERLAY_OVER_EMBOSS 96
117 #define OVERLAY_OVER_UI 128
122 enum PI_ColorScheme {
123 PI_GLOBAL_COLOR_SCHEME_RGB,
124 PI_GLOBAL_COLOR_SCHEME_DAY,
125 PI_GLOBAL_COLOR_SCHEME_DUSK,
126 PI_GLOBAL_COLOR_SCHEME_NIGHT,
134 double view_scale_ppm;
144 int m_projection_type;
146 double lat_min, lat_max, lon_min, lon_max;
185 enum plugin_ais_alarm_type {
188 PI_AIS_ALARM_ACKNOWLEDGED
205 unsigned char ShipType;
216 plugin_ais_alarm_type alarm_state;
220 typedef enum ChartTypeEnumPI {
221 PI_CHART_TYPE_UNKNOWN = 0,
223 PI_CHART_TYPE_DONTCARE,
228 PI_CHART_TYPE_CM93COMP,
233 typedef enum ChartFamilyEnumPI {
234 PI_CHART_FAMILY_UNKNOWN = 0,
235 PI_CHART_FAMILY_RASTER,
236 PI_CHART_FAMILY_VECTOR,
237 PI_CHART_FAMILY_DONTCARE
238 } _ChartFamilyEnumPI;
241 typedef enum ChartDepthUnitTypePI {
242 PI_DEPTH_UNIT_UNKNOWN,
244 PI_DEPTH_UNIT_METERS,
245 PI_DEPTH_UNIT_FATHOMS
246 } _ChartDepthUnitTypePI;
249 typedef enum OcpnProjTypePI {
250 PI_PROJECTION_UNKNOWN,
251 PI_PROJECTION_MERCATOR,
252 PI_PROJECTION_TRANSVERSE_MERCATOR,
253 PI_PROJECTION_POLYCONIC,
255 PI_PROJECTION_ORTHOGRAPHIC,
257 PI_PROJECTION_STEREOGRAPHIC,
258 PI_PROJECTION_GNOMONIC,
259 PI_PROJECTION_EQUIRECTANGULAR
270 #define PI_FULL_INIT 0
271 #define PI_HEADER_ONLY 1
272 #define PI_THUMB_ONLY 2
285 virtual wxString GetFileSearchMask(
void);
287 virtual int Init(
const wxString &full_path,
int init_flags);
288 virtual void SetColorScheme(
int cs,
bool bApplyImmediate);
290 virtual double GetNormalScaleMin(
double canvas_scale_factor,
291 bool b_allow_overzoom);
292 virtual double GetNormalScaleMax(
double canvas_scale_factor,
294 virtual double GetNearestPreferredScalePPM(
double target_scale_ppm);
296 virtual bool GetChartExtent(
ExtentPI *pext);
299 const wxRegion &Region);
304 wxRegion *pValidRegion);
306 virtual int GetCOVREntries() {
return 0; }
307 virtual int GetCOVRTablePoints(
int iTable) {
return 0; }
308 virtual int GetCOVRTablenPoints(
int iTable) {
return 0; }
309 virtual float *GetCOVRTableHead(
int iTable) {
return (
float *)NULL; }
311 virtual wxBitmap *GetThumbnail(
int tnx,
int tny,
int cs);
315 virtual wxString GetFullPath()
const {
return m_FullPath; }
316 virtual ChartTypeEnumPI GetChartType() {
return m_ChartType; }
317 virtual ChartFamilyEnumPI GetChartFamily() {
return m_ChartFamily; }
318 virtual OcpnProjTypePI GetChartProjection() {
return m_projection; }
319 virtual wxString GetName() {
return m_Name; }
320 virtual wxString GetDescription() {
return m_Description; }
321 virtual wxString GetID() {
return m_ID; }
322 virtual wxString GetSE() {
return m_SE; }
323 virtual wxString GetDepthUnits() {
return m_DepthUnits; }
324 virtual wxString GetSoundingsDatum() {
return m_SoundingsDatum; }
325 virtual wxString GetDatumString() {
return m_datum_str; }
326 virtual wxString GetExtraInfo() {
return m_ExtraInfo; }
327 virtual wxString GetPubDate() {
return m_PubYear; }
328 virtual double GetChartErrorFactor() {
return m_Chart_Error_Factor; }
329 virtual ChartDepthUnitTypePI GetDepthUnitId() {
return m_depth_unit_id; }
330 virtual bool IsReadyToRender() {
return m_bReadyToRender; }
331 virtual int GetNativeScale() {
return m_Chart_Scale; };
332 virtual double GetChartSkew() {
return m_Chart_Skew; }
333 virtual wxDateTime GetEditionDate(
void) {
return m_EdDate; }
337 wxRect *pSourceRect);
338 virtual double GetRasterScaleFactor();
339 virtual bool GetChartBits(wxRect &source,
unsigned char *pPix,
int sub_samp);
340 virtual int GetSize_X();
341 virtual int GetSize_Y();
342 virtual void latlong_to_chartpix(
double lat,
double lon,
double &pixx,
344 virtual void chartpix_to_latlong(
double pixx,
double pixy,
double *plat,
348 ChartTypeEnumPI m_ChartType;
349 ChartFamilyEnumPI m_ChartFamily;
352 OcpnProjTypePI m_projection;
357 bool m_bReadyToRender;
360 wxString m_Description;
363 wxString m_SoundingsDatum;
364 wxString m_datum_str;
366 wxString m_DepthUnits;
367 wxString m_ExtraInfo;
369 ChartDepthUnitTypePI m_depth_unit_id;
371 double m_Chart_Error_Factor;
398 virtual int Init(
void);
399 virtual bool DeInit(
void);
401 virtual int GetAPIVersionMajor();
402 virtual int GetAPIVersionMinor();
403 virtual int GetPlugInVersionMajor();
404 virtual int GetPlugInVersionMinor();
405 virtual wxBitmap *GetPlugInBitmap();
410 virtual wxString GetCommonName();
411 virtual wxString GetShortDescription();
412 virtual wxString GetLongDescription();
417 virtual void SetDefaults(
421 virtual int GetToolbarToolCount(
void);
423 virtual int GetToolboxPanelCount(
void);
424 virtual void SetupToolboxPanel(
int page_sel, wxNotebook *pnotebook);
425 virtual void OnCloseToolboxPanel(
int page_sel,
int ok_apply_cancel);
427 virtual void ShowPreferencesDialog(wxWindow *parent);
430 virtual void SetCursorLatLon(
double lat,
double lon);
434 virtual void SetNMEASentence(wxString &sentence);
435 virtual void SetAISSentence(wxString &sentence);
437 virtual void ProcessParentResize(
int x,
int y);
438 virtual void SetColorScheme(PI_ColorScheme cs);
440 virtual void OnToolbarToolCallback(
int id);
441 virtual void OnContextMenuItemCallback(
int id);
443 virtual void UpdateAuiStatus(
void);
445 virtual wxArrayString GetDynamicChartClassNameArray(
void);
453 #pragma clang diagnostic push
454 #pragma clang diagnostic ignored "-Woverloaded-virtual"
462 using opencpn_plugin::RenderOverlay;
466 virtual void SetPluginMessage(wxString &message_id, wxString &message_body);
474 using opencpn_plugin::RenderOverlay;
477 virtual bool RenderGLOverlay(wxGLContext *pcontext,
PlugIn_ViewPort *vp);
479 virtual void SetPluginMessage(wxString &message_id, wxString &message_body);
487 using opencpn_plugin::RenderOverlay;
490 virtual bool RenderGLOverlay(wxGLContext *pcontext,
PlugIn_ViewPort *vp);
491 virtual void SetPluginMessage(wxString &message_id, wxString &message_body);
496 #pragma clang diagnostic pop
504 virtual void OnSetupOptions(
void);
512 virtual void LateInit(
void);
526 virtual bool MouseEventHook(wxMouseEvent &event);
527 virtual void SendVectorChartObjectInfo(wxString &chart, wxString &feature,
528 wxString &objname,
double lat,
529 double lon,
double scale,
538 virtual bool KeyboardEventHook(wxKeyEvent &event);
539 virtual void OnToolbarToolDownCallback(
int id);
540 virtual void OnToolbarToolUpCallback(
int id);
559 virtual bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext,
563 virtual void PrepareContextMenu(
int canvasIndex);
573 virtual int GetPlugInVersionPatch();
576 virtual int GetPlugInVersionPost();
579 virtual const char *GetPlugInVersionPre();
582 virtual const char *GetPlugInVersionBuild();
592 using opencpn_plugin_116::RenderGLOverlayMultiCanvas;
593 using opencpn_plugin_116::RenderOverlayMultiCanvas;
604 virtual bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext,
PlugIn_ViewPort *vp,
605 int canvasIndex,
int priority = -1);
607 virtual bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext,
PlugIn_ViewPort *vp,
608 int canvasIndex,
int priority);
610 bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext,
PlugIn_ViewPort *vp,
611 int canvas_ix)
override {
612 return RenderGLOverlayMultiCanvas(pcontext, vp, canvas_ix, -1);
628 int canvasIndex,
int priority = -1);
630 virtual bool RenderOverlayMultiCanvas(wxDC &dc,
PlugIn_ViewPort *vp,
int canvas_ix,
633 int canvas_ix)
override {
634 return RenderOverlayMultiCanvas(dc, vp, canvas_ix, -1);
657 const wxString &wp_name,
const wxString &GUID = _T(
""));
666 wxString m_MarkDescription;
667 wxDateTime m_CreateTime;
672 Plugin_HyperlinkList *m_HyperlinkList;
682 wxString m_NameString;
683 wxString m_StartString;
684 wxString m_EndString;
687 Plugin_WaypointList *pWaypointList;
695 wxString m_NameString;
696 wxString m_StartString;
697 wxString m_EndString;
700 Plugin_WaypointList *pWaypointList;
711 extern "C" DECL_EXP
int InsertPlugInTool(wxString label, wxBitmap *bitmap,
712 wxBitmap *bmpRollover, wxItemKind kind,
713 wxString shortHelp, wxString longHelp,
714 wxObject *clientData,
int position,
716 extern "C" DECL_EXP
void RemovePlugInTool(
int tool_id);
717 extern "C" DECL_EXP
void SetToolbarToolViz(
719 extern "C" DECL_EXP
void SetToolbarItemState(
int item,
bool toggle);
720 extern "C" DECL_EXP
void SetToolbarToolBitmaps(
int item, wxBitmap *bitmap,
721 wxBitmap *bmpRollover);
723 extern "C" DECL_EXP
int InsertPlugInToolSVG(
724 wxString label, wxString SVGfile, wxString SVGfileRollover,
725 wxString SVGfileToggled, wxItemKind kind, wxString shortHelp,
726 wxString longHelp, wxObject *clientData,
int position,
int tool_sel,
728 extern "C" DECL_EXP
void SetToolbarToolBitmapsSVG(
int item, wxString SVGfile,
729 wxString SVGfileRollover,
730 wxString SVGfileToggled);
732 extern "C" DECL_EXP
int AddCanvasContextMenuItem(wxMenuItem *pitem,
734 extern "C" DECL_EXP
void RemoveCanvasContextMenuItem(
736 extern "C" DECL_EXP
void SetCanvasContextMenuItemViz(
738 extern "C" DECL_EXP
void SetCanvasContextMenuItemGrey(
int item,
bool grey);
740 extern "C" DECL_EXP wxFileConfig *GetOCPNConfigObject(
void);
742 extern "C" DECL_EXP
void RequestRefresh(wxWindow *);
743 extern "C" DECL_EXP
bool GetGlobalColor(wxString colorName, wxColour *pcolour);
745 extern "C" DECL_EXP
void GetCanvasPixLL(
PlugIn_ViewPort *vp, wxPoint *pp,
746 double lat,
double lon);
747 extern "C" DECL_EXP
void GetCanvasLLPix(
PlugIn_ViewPort *vp, wxPoint p,
748 double *plat,
double *plon);
750 extern "C" DECL_EXP wxWindow *GetOCPNCanvasWindow();
752 extern "C" DECL_EXP wxFont *OCPNGetFont(wxString TextElement,
int default_size);
754 extern "C" DECL_EXP wxString *GetpSharedDataLocation();
756 extern "C" DECL_EXP ArrayOfPlugIn_AIS_Targets *GetAISTargetArray(
void);
758 extern "C" DECL_EXP wxAuiManager *GetFrameAuiManager(
void);
760 extern "C" DECL_EXP
bool AddLocaleCatalog(wxString catalog);
762 extern "C" DECL_EXP
void PushNMEABuffer(wxString str);
764 extern DECL_EXP wxXmlDocument GetChartDatabaseEntryXML(
int dbIndex,
767 extern DECL_EXP
bool UpdateChartDBInplace(wxArrayString dir_array,
769 bool b_ProgressDialog);
770 extern DECL_EXP wxArrayString GetChartDBDirArrayString();
772 extern "C" DECL_EXP
void SendPluginMessage(wxString message_id,
773 wxString message_body);
775 extern "C" DECL_EXP
void DimeWindow(wxWindow *);
777 extern "C" DECL_EXP
void JumpToPosition(
double lat,
double lon,
double scale);
783 extern "C" DECL_EXP
void PositionBearingDistanceMercator_Plugin(
784 double lat,
double lon,
double brg,
double dist,
double *dlat,
786 extern "C" DECL_EXP
void DistanceBearingMercator_Plugin(
787 double lat0,
double lon0,
double lat1,
double lon1,
double *brg,
789 extern "C" DECL_EXP
double DistGreatCircle_Plugin(
double slat,
double slon,
790 double dlat,
double dlon);
792 extern "C" DECL_EXP
void toTM_Plugin(
float lat,
float lon,
float lat0,
793 float lon0,
double *x,
double *y);
794 extern "C" DECL_EXP
void fromTM_Plugin(
double x,
double y,
double lat0,
795 double lon0,
double *lat,
double *lon);
796 extern "C" DECL_EXP
void toSM_Plugin(
double lat,
double lon,
double lat0,
797 double lon0,
double *x,
double *y);
798 extern "C" DECL_EXP
void fromSM_Plugin(
double x,
double y,
double lat0,
799 double lon0,
double *lat,
double *lon);
800 extern "C" DECL_EXP
void toSM_ECC_Plugin(
double lat,
double lon,
double lat0,
801 double lon0,
double *x,
double *y);
802 extern "C" DECL_EXP
void fromSM_ECC_Plugin(
double x,
double y,
double lat0,
803 double lon0,
double *lat,
806 extern "C" DECL_EXP
bool DecodeSingleVDOMessage(
const wxString &str,
809 extern "C" DECL_EXP
int GetChartbarHeight(
void);
810 extern "C" DECL_EXP
bool GetActiveRoutepointGPX(
char *buffer,
811 unsigned int buffer_length);
814 typedef enum OptionsParentPI {
815 PI_OPTIONS_PARENT_DISPLAY,
816 PI_OPTIONS_PARENT_CONNECTIONS,
817 PI_OPTIONS_PARENT_CHARTS,
818 PI_OPTIONS_PARENT_SHIPS,
819 PI_OPTIONS_PARENT_UI,
820 PI_OPTIONS_PARENT_PLUGINS
822 extern DECL_EXP wxScrolledWindow *AddOptionsPage(OptionsParentPI parent,
824 extern DECL_EXP
bool DeleteOptionsPage(wxScrolledWindow *page);
830 extern "C" DECL_EXP
double toUsrDistance_Plugin(
double nm_distance,
832 extern "C" DECL_EXP
double fromUsrDistance_Plugin(
double usr_distance,
834 extern "C" DECL_EXP
double toUsrSpeed_Plugin(
double kts_speed,
int unit = -1);
835 extern "C" DECL_EXP
double fromUsrSpeed_Plugin(
double usr_speed,
int unit = -1);
836 extern "C" DECL_EXP
double toUsrTemp_Plugin(
double cel_temp,
int unit = -1);
837 extern "C" DECL_EXP
double fromUsrTemp_Plugin(
double usr_temp,
int unit = -1);
838 extern DECL_EXP wxString getUsrDistanceUnit_Plugin(
int unit = -1);
839 extern DECL_EXP wxString getUsrSpeedUnit_Plugin(
int unit = -1);
840 extern DECL_EXP wxString getUsrTempUnit_Plugin(
int unit = -1);
841 extern DECL_EXP wxString GetNewGUID();
842 extern "C" DECL_EXP
bool PlugIn_GSHHS_CrossesLand(
double lat1,
double lon1,
843 double lat2,
double lon2);
851 extern DECL_EXP wxBitmap *FindSystemWaypointIcon(wxString &icon_name);
852 extern DECL_EXP
bool AddCustomWaypointIcon(wxBitmap *pimage, wxString key,
853 wxString description);
856 bool b_permanent =
true);
857 extern DECL_EXP
bool DeleteSingleWaypoint(wxString &GUID);
860 extern DECL_EXP
bool AddPlugInRoute(
PlugIn_Route *proute,
861 bool b_permanent =
true);
862 extern DECL_EXP
bool DeletePlugInRoute(wxString &GUID);
863 extern DECL_EXP
bool UpdatePlugInRoute(
PlugIn_Route *proute);
865 extern DECL_EXP
bool AddPlugInTrack(
PlugIn_Track *ptrack,
866 bool b_permanent =
true);
867 extern DECL_EXP
bool DeletePlugInTrack(wxString &GUID);
868 extern DECL_EXP
bool UpdatePlugInTrack(
PlugIn_Track *ptrack);
874 wxColour DECL_EXP GetBaseGlobalColor(wxString colorName);
875 int DECL_EXP OCPNMessageBox_PlugIn(wxWindow *parent,
const wxString &message,
876 const wxString &caption = _T(
"Message"),
877 int style = wxOK,
int x = -1,
int y = -1);
879 extern DECL_EXP wxString toSDMM_PlugIn(
int NEflag,
double a,
880 bool hi_precision =
true);
882 extern "C" DECL_EXP wxString *GetpPrivateApplicationDataLocation();
883 extern DECL_EXP wxString GetOCPN_ExePath(
void);
884 extern "C" DECL_EXP wxString *GetpPlugInLocation();
887 extern "C" DECL_EXP
int AddChartToDBInPlace(wxString &full_path,
888 bool b_RefreshCanvas);
889 extern "C" DECL_EXP
int RemoveChartFromDBInPlace(wxString &full_path);
890 extern DECL_EXP wxString GetLocaleCanonicalName();
898 #define PLIB_CAPS_LINE_VBO 1
899 #define PLIB_CAPS_LINE_BUFFER 1 << 1
900 #define PLIB_CAPS_SINGLEGEO_BUFFER 1 << 2
901 #define PLIB_CAPS_OBJSEGLIST 1 << 3
902 #define PLIB_CAPS_OBJCATMUTATE 1 << 4
906 WX_DECLARE_LIST(
PI_S57Obj, ListOfPI_S57Obj);
918 virtual int RenderRegionViewOnGL(
const wxGLContext &glc,
920 const wxRegion &Region,
bool b_use_stencil);
922 virtual ListOfPI_S57Obj *GetObjRuleListAtLatLon(
float lat,
float lon,
925 virtual wxString CreateObjDescriptions(ListOfPI_S57Obj *obj_list);
927 virtual int GetNoCOVREntries();
928 virtual int GetNoCOVRTablePoints(
int iTable);
929 virtual int GetNoCOVRTablenPoints(
int iTable);
930 virtual float *GetNoCOVRTableHead(
int iTable);
943 virtual ListOfPI_S57Obj *GetLightsObjRuleListVisibleAtLatLon(
957 virtual int RenderRegionViewOnGL(
const wxGLContext &glc,
959 const wxRegion &Region,
bool b_use_stencil);
961 virtual wxBitmap &RenderRegionViewOnDCNoText(
const PlugIn_ViewPort &VPoint,
962 const wxRegion &Region);
963 virtual bool RenderRegionViewOnDCTextOnly(wxMemoryDC &dc,
965 const wxRegion &Region);
967 virtual int RenderRegionViewOnGLNoText(
const wxGLContext &glc,
969 const wxRegion &Region,
972 virtual int RenderRegionViewOnGLTextOnly(
const wxGLContext &glc,
974 const wxRegion &Region,
977 virtual ListOfPI_S57Obj *GetObjRuleListAtLatLon(
float lat,
float lon,
980 virtual wxString CreateObjDescriptions(ListOfPI_S57Obj *obj_list);
982 virtual int GetNoCOVREntries();
983 virtual int GetNoCOVRTablePoints(
int iTable);
984 virtual int GetNoCOVRTablenPoints(
int iTable);
985 virtual float *GetNoCOVRTableHead(
int iTable);
987 virtual void ClearPLIBTextList();
1001 virtual ListOfPI_S57Obj *GetLightsObjRuleListVisibleAtLatLon(
1005 class wxArrayOfS57attVal;
1008 typedef enum _PI_LUPname {
1009 PI_SIMPLIFIED =
'L',
1010 PI_PAPER_CHART =
'R',
1012 PI_PLAIN_BOUNDARIES =
'N',
1013 PI_SYMBOLIZED_BOUNDARIES =
'O',
1018 typedef enum _PI_DisCat {
1019 PI_DISPLAYBASE =
'D',
1022 PI_MARINERS_STANDARD =
'M',
1028 typedef enum _PI_DisPrio {
1029 PI_PRIO_NODATA =
'0',
1030 PI_PRIO_GROUP1 =
'1',
1031 PI_PRIO_AREA_1 =
'2',
1032 PI_PRIO_AREA_2 =
'3',
1033 PI_PRIO_SYMB_POINT =
'4',
1034 PI_PRIO_SYMB_LINE =
'5',
1035 PI_PRIO_SYMB_AREA =
'6',
1036 PI_PRIO_ROUTEING =
'7',
1037 PI_PRIO_HAZARDS =
'8',
1038 PI_PRIO_MARINERS =
'9',
1043 typedef enum PI_InitReturn {
1046 PI_INIT_FAIL_REMOVE,
1047 PI_INIT_FAIL_NOERROR
1072 char FeatureName[8];
1076 wxArrayOfS57attVal *attVal;
1096 double chart_ref_lat;
1097 double chart_ref_lon;
1113 int *m_lsindex_array;
1114 int m_n_edge_max_points;
1115 void *m_chart_context;
1117 PI_DisCat m_DisplayCat;
1137 bool m_bcategory_mutable;
1141 wxString DECL_EXP PI_GetPLIBColorScheme();
1142 int DECL_EXP PI_GetPLIBDepthUnitInt();
1143 int DECL_EXP PI_GetPLIBSymbolStyle();
1144 int DECL_EXP PI_GetPLIBBoundaryStyle();
1145 int DECL_EXP PI_GetPLIBStateHash();
1146 double DECL_EXP PI_GetPLIBMarinerSafetyContour();
1147 bool DECL_EXP PI_GetObjectRenderBox(
PI_S57Obj *pObj,
double *lat_min,
1148 double *lat_max,
double *lon_min,
1150 void DECL_EXP PI_UpdateContext(
PI_S57Obj *pObj);
1153 PI_LUPname DECL_EXP PI_GetObjectLUPName(
PI_S57Obj *pObj);
1154 PI_DisPrio DECL_EXP PI_GetObjectDisplayPriority(
PI_S57Obj *pObj);
1155 PI_DisCat DECL_EXP PI_GetObjectDisplayCategory(
PI_S57Obj *pObj);
1156 void DECL_EXP PI_PLIBSetLineFeaturePriority(
PI_S57Obj *pObj,
int prio);
1157 void DECL_EXP PI_PLIBPrepareForNewRender(
void);
1158 void DECL_EXP PI_PLIBFreeContext(
void *pContext);
1159 void DECL_EXP PI_PLIBSetRenderCaps(
unsigned int flags);
1161 bool DECL_EXP PI_PLIBSetContext(
PI_S57Obj *pObj);
1163 int DECL_EXP PI_PLIBRenderObjectToDC(wxDC *pdc,
PI_S57Obj *pObj,
1165 int DECL_EXP PI_PLIBRenderAreaToDC(wxDC *pdc,
PI_S57Obj *pObj,
1167 unsigned char *pixbuf);
1169 int DECL_EXP PI_PLIBRenderAreaToGL(
const wxGLContext &glcc,
PI_S57Obj *pObj,
1172 int DECL_EXP PI_PLIBRenderObjectToGL(
const wxGLContext &glcc,
PI_S57Obj *pObj,
1201 extern DECL_EXP
bool PlugInHasNormalizedViewPort(
PlugIn_ViewPort *vp);
1203 float lat = 0,
float lon = 0);
1204 extern DECL_EXP
void PlugInNormalizeViewport(
PlugIn_ViewPort *vp,
float lat = 0,
1207 class wxPoint2DDouble;
1209 wxPoint2DDouble *pp,
double lat,
1216 extern DECL_EXP
double fromDMM_Plugin(wxString sdms);
1217 extern DECL_EXP
void SetCanvasRotation(
double rotation);
1218 extern DECL_EXP
void SetCanvasProjection(
int projection);
1219 extern DECL_EXP
bool GetSingleWaypoint(wxString GUID,
1221 extern DECL_EXP
bool CheckEdgePan_PlugIn(
int x,
int y,
bool dragging,
1222 int margin,
int delta);
1223 extern DECL_EXP wxBitmap GetIcon_PlugIn(
const wxString &name);
1224 extern DECL_EXP
void SetCursor_PlugIn(wxCursor *pPlugin_Cursor = NULL);
1225 extern DECL_EXP wxFont *GetOCPNScaledFont_PlugIn(wxString TextElement,
1226 int default_size = 0);
1227 extern DECL_EXP wxFont GetOCPNGUIScaledFont_PlugIn(wxString item);
1228 extern DECL_EXP
double GetOCPNGUIToolScaleFactor_PlugIn(
int GUIScaledFactor);
1229 extern DECL_EXP
double GetOCPNGUIToolScaleFactor_PlugIn();
1230 extern DECL_EXP
float GetOCPNChartScaleFactor_Plugin();
1231 extern DECL_EXP wxColour GetFontColour_PlugIn(wxString TextElement);
1233 extern DECL_EXP
double GetCanvasTilt();
1234 extern DECL_EXP
void SetCanvasTilt(
double tilt);
1242 int deviceIndex = -1);
1243 extern DECL_EXP
void AddChartDirectory(wxString &path);
1244 extern DECL_EXP
void ForceChartDBUpdate();
1245 extern DECL_EXP
void ForceChartDBRebuild();
1247 extern DECL_EXP wxString GetWritableDocumentsDir(
void);
1248 extern DECL_EXP wxDialog *GetActiveOptionsDialog();
1249 extern DECL_EXP wxArrayString GetWaypointGUIDArray(
void);
1250 extern DECL_EXP wxArrayString GetIconNameArray(
void);
1252 extern DECL_EXP
bool AddPersistentFontKey(wxString TextElement);
1253 extern DECL_EXP wxString GetActiveStyleName();
1255 extern DECL_EXP wxBitmap GetBitmapFromSVGFile(wxString filename,
1257 unsigned int height);
1258 extern DECL_EXP
bool IsTouchInterface_PlugIn(
void);
1261 extern DECL_EXP
int PlatformDirSelectorDialog(wxWindow *parent,
1262 wxString *file_spec,
1263 wxString Title, wxString initDir);
1265 extern DECL_EXP
int PlatformFileSelectorDialog(wxWindow *parent,
1266 wxString *file_spec,
1267 wxString Title, wxString initDir,
1268 wxString suggestedName,
1274 typedef enum _OCPN_DLStatus {
1275 OCPN_DL_UNKNOWN = -1,
1276 OCPN_DL_NO_ERROR = 0,
1278 OCPN_DL_ABORTED = 2,
1279 OCPN_DL_USER_TIMEOUT = 4,
1283 typedef enum _OCPN_DLCondition {
1284 OCPN_DL_EVENT_TYPE_UNKNOWN = -1,
1285 OCPN_DL_EVENT_TYPE_START = 80,
1286 OCPN_DL_EVENT_TYPE_PROGRESS = 81,
1287 OCPN_DL_EVENT_TYPE_END = 82
1320 OCPN_DLDS_CONN_SETTINGS_ALL,
1336 #define ONLINE_CHECK_RETRY \
1341 extern DECL_EXP _OCPN_DLStatus OCPN_downloadFile(
1342 const wxString &url,
const wxString &outputFile,
const wxString &title,
1343 const wxString &message,
const wxBitmap &bitmap, wxWindow *parent,
1344 long style,
int timeout_secs);
1348 extern DECL_EXP _OCPN_DLStatus
1349 OCPN_downloadFileBackground(
const wxString &url,
const wxString &outputFile,
1350 wxEvtHandler *handler,
long *handle);
1352 extern DECL_EXP
void OCPN_cancelDownloadFileBackground(
long handle);
1356 extern DECL_EXP _OCPN_DLStatus OCPN_postDataHttp(
const wxString &url,
1357 const wxString ¶meters,
1363 extern DECL_EXP
bool OCPN_isOnline();
1387 _OCPN_DLStatus getDLEventStatus() {
return m_stat; }
1388 OCPN_DLCondition getDLEventCondition() {
return m_condition; }
1390 void setDLEventStatus(_OCPN_DLStatus stat) { m_stat = stat; }
1391 void setDLEventCondition(OCPN_DLCondition cond) { m_condition = cond; }
1393 void setTotal(
long bytes) { m_totalBytes = bytes; }
1394 void setTransferred(
long bytes) { m_sofarBytes = bytes; }
1395 long getTotal() {
return m_totalBytes; }
1396 long getTransferred() {
return m_sofarBytes; }
1398 void setComplete(
bool b_complete) { m_b_complete = b_complete; }
1399 bool getComplete() {
return m_b_complete; }
1402 wxEvent *Clone()
const;
1405 OCPN_DLStatus m_stat;
1406 OCPN_DLCondition m_condition;
1415 #ifdef MAKING_PLUGIN
1416 extern DECL_IMP wxEventType wxEVT_DOWNLOAD_EVENT;
1418 extern DECL_EXP wxEventType wxEVT_DOWNLOAD_EVENT;
1425 bool LaunchDefaultBrowser_Plugin(wxString url);
1430 extern DECL_EXP
void PlugInAISDrawGL(wxGLCanvas *glcanvas,
1432 extern DECL_EXP
bool PlugInSetFontColor(
const wxString TextElement,
1433 const wxColour color);
1436 extern DECL_EXP
double PlugInGetDisplaySizeMM();
1439 extern DECL_EXP wxFont *FindOrCreateFont_PlugIn(
1440 int point_size, wxFontFamily family, wxFontStyle style, wxFontWeight weight,
1441 bool underline =
false,
const wxString &facename = wxEmptyString,
1442 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
1444 extern DECL_EXP
int PlugInGetMinAvailableGshhgQuality();
1445 extern DECL_EXP
int PlugInGetMaxAvailableGshhgQuality();
1447 extern DECL_EXP
void PlugInHandleAutopilotRoute(
bool enable);
1468 extern DECL_EXP
bool ShuttingDown(
void);
1472 extern DECL_EXP wxWindow *PluginGetFocusCanvas();
1473 extern DECL_EXP wxWindow *PluginGetOverlayRenderCanvas();
1475 extern "C" DECL_EXP
void CanvasJumpToPosition(wxWindow *canvas,
double lat,
1476 double lon,
double scale);
1477 extern "C" DECL_EXP
int AddCanvasMenuItem(wxMenuItem *pitem,
1479 const char *name =
"");
1480 extern "C" DECL_EXP
void RemoveCanvasMenuItem(
1481 int item,
const char *name =
"");
1482 extern "C" DECL_EXP
void SetCanvasMenuItemViz(
1484 const char *name =
"");
1485 extern "C" DECL_EXP
void SetCanvasMenuItemGrey(
int item,
bool grey,
1486 const char *name =
"");
1489 extern DECL_EXP wxString GetSelectedWaypointGUID_Plugin();
1490 extern DECL_EXP wxString GetSelectedRouteGUID_Plugin();
1491 extern DECL_EXP wxString GetSelectedTrackGUID_Plugin();
1493 extern DECL_EXP std::unique_ptr<PlugIn_Waypoint> GetWaypoint_Plugin(
1495 extern DECL_EXP std::unique_ptr<PlugIn_Route> GetRoute_Plugin(
const wxString &);
1496 extern DECL_EXP std::unique_ptr<PlugIn_Track> GetTrack_Plugin(
const wxString &);
1498 extern DECL_EXP wxWindow *GetCanvasUnderMouse();
1499 extern DECL_EXP
int GetCanvasIndexUnderMouse();
1501 extern DECL_EXP wxWindow *GetCanvasByIndex(
int canvasIndex);
1502 extern DECL_EXP
int GetCanvasCount();
1503 extern DECL_EXP
bool CheckMUIEdgePan_PlugIn(
int x,
int y,
bool dragging,
1504 int margin,
int delta,
1506 extern DECL_EXP
void SetMUICursor_PlugIn(wxCursor *pCursor,
int canvasIndex);
1510 extern DECL_EXP wxRect GetMasterToolbarRect();
1513 DEGREES_DECIMAL_MINUTES = 0,
1515 DEGREES_MINUTES_SECONDS,
1519 extern DECL_EXP
int GetLatLonFormat(
void);
1522 extern "C" DECL_EXP
void ZeroXTE();
1529 const wxString &wp_name,
const wxString &GUID =
"",
1530 const double ScaMin = 1e9,
const bool bNameVisible =
false,
1531 const int nRanges = 0,
const double RangeDistance = 1.0,
1532 const wxColor RangeColor = wxColor(255, 0, 0));
1534 void InitDefaults();
1542 int GetRouteMembershipCount();
1550 wxString m_MarkName;
1551 wxString m_MarkDescription;
1552 wxDateTime m_CreateTime;
1560 double RangeRingSpace;
1561 wxColour RangeRingColor;
1564 wxString IconDescription;
1566 Plugin_HyperlinkList *m_HyperlinkList;
1576 wxString m_NameString;
1577 wxString m_StartString;
1578 wxString m_EndString;
1582 wxString m_Description;
1585 Plugin_WaypointExList *pWaypointList;
1588 extern DECL_EXP wxArrayString GetRouteGUIDArray(
void);
1589 extern DECL_EXP wxArrayString GetTrackGUIDArray(
void);
1591 extern DECL_EXP
bool GetSingleWaypointEx(wxString GUID,
1595 bool b_permanent =
true);
1599 bool b_permanent =
true);
1602 extern DECL_EXP std::unique_ptr<PlugIn_Waypoint_Ex> GetWaypointEx_Plugin(
1604 extern DECL_EXP std::unique_ptr<PlugIn_Route_Ex> GetRouteEx_Plugin(
1607 extern DECL_EXP wxString
1608 GetActiveWaypointGUID(
void);
1609 extern DECL_EXP wxString
1610 GetActiveRouteGUID(
void);
1615 extern DECL_EXP
double OCPN_GetDisplayContentScaleFactor();
1618 extern DECL_EXP
double OCPN_GetWinDIPScaleFactor();
1622 extern DECL_EXP std::vector<std::string> GetActivePriorityIdentifiers();
1626 typedef enum _OBJECT_LAYER_REQ {
1633 extern DECL_EXP wxArrayString GetRouteGUIDArray(OBJECT_LAYER_REQ req);
1634 extern DECL_EXP wxArrayString GetTrackGUIDArray(OBJECT_LAYER_REQ req);
1635 extern DECL_EXP wxArrayString GetWaypointGUIDArray(OBJECT_LAYER_REQ req);
1646 #ifndef OBSERVABLE_EVT_H
1647 #define OBSERVABLE_EVT_H
1654 ObservedEvt(wxEventType commandType = obsNOTIFY,
int id = 0)
1655 : wxCommandEvent(commandType,
id) {}
1657 this->m_shared_ptr =
event.m_shared_ptr;
1660 wxEvent *Clone()
const {
return new ObservedEvt(*
this); }
1662 std::shared_ptr<const void> GetSharedPtr()
const {
return m_shared_ptr; }
1664 void SetSharedPtr(std::shared_ptr<const void> p) { m_shared_ptr = p; }
1667 std::shared_ptr<const void> m_shared_ptr;
1677 NMEA2000Id(
int value) : id(
static_cast<uint64_t
>(value)){};
1680 extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
1681 NMEA2000Id id, wxEventType ev, wxEvtHandler *handler);
1685 const std::string id;
1689 extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
1690 NMEA0183Id id, wxEventType ev, wxEvtHandler *handler);
1694 const std::string id;
1695 SignalkId(
const std::string &s) : id(s){};
1698 extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
1699 SignalkId id, wxEventType ev, wxEvtHandler *handler);
1752 extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
1753 NavDataId id, wxEventType ev, wxEvtHandler *handler);
1797 RESULT_COMM_NO_ERROR = 0,
1798 RESULT_COMM_INVALID_HANDLE,
1799 RESULT_COMM_INVALID_PARMS,
1800 RESULT_COMM_TX_ERROR,
1801 RESULT_COMM_REGISTER_GATEWAY_ERROR,
1802 RESULT_COMM_REGISTER_PGN_ERROR
1822 extern DECL_EXP
const std::unordered_map<std::string, std::string>
1834 const std::shared_ptr <std::vector<uint8_t>> &payload);
1838 DriverHandle handle,
int PGN,
int destinationCANAddress,
int priority,
1839 const std::shared_ptr <std::vector<uint8_t>> &payload);
1851 std::vector<int> &pgn_list);
1859 const std::string id;
1863 extern DECL_EXP std::shared_ptr<ObservableListener> GetListener(
1864 PluginMsgId id, wxEventType ev, wxEvtHandler *handler);
Keeps listening over it's lifespan, removes itself on destruction.
Adds a std::shared<void> element to wxCommandEvent.
CommDriverResult
Error return values
std::shared_ptr< void > GetSignalkPayload(ObservedEvt ev)
Get SignalK status payload after receiving a message.
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 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 const std::unordered_map< std::string, std::string > GetAttributes(DriverHandle handle)
Query a specific driver for attributes
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::vector< std::string > GetPriorityMaps()
Comm Priority query support methods
@ 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 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 PluginNavdata GetEventNavdata(ObservedEvt ev)
Return BasicNavDataMsg decoded data available in ev.
DECL_EXP int GetGlobalWatchdogTimoutSeconds()
Comm Global Watchdog Query
DECL_EXP bool PlugInPlaySoundEx(wxString &sound_file, int deviceIndex=-1)
Start playing a sound file asynchronously.
enum CommDriverResult _CommDriverResult
Error return values
DECL_EXP void PlugInPlaySound(wxString &sound_file)
Start playing a sound file asynchronously.
DECL_EXP std::vector< DriverHandle > GetActiveDrivers()
Query OCPN core for a list of active drivers
DECL_EXP CommDriverResult RegisterTXPGNs(DriverHandle handle, std::vector< int > &pgn_list)
Special NMEA2000 requirements NMEA2000 bus protocol device management requires that devices writing o...
DECL_EXP wxString GetPluginDataDir(const char *plugin_name)
Return the plugin data directory for a given directory name.
Facade for BasicNavDataMsg.
Facade for NavAddrPluginMsg.
Available decoded data for plugins.
Facade for NavAddrSignalK.