OpenCPN Partial API docs
Loading...
Searching...
No Matches
ocpn_plugin.cpp
Go to the documentation of this file.
1/***************************************************************************
2 * Copyright (C) 2010 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, see <https://www.gnu.org/licenses/>. *
16 **************************************************************************/
17
25#include "config.h"
26
27#include <algorithm>
28#include <set>
29#include <typeinfo>
30#include <unordered_map>
31
32#include <wx/wx.h>
33#include <wx/arrstr.h>
34#include <wx/dc.h>
35#include <wx/dcmemory.h>
36#include <wx/event.h>
37#include <wx/glcanvas.h>
38#include <wx/notebook.h>
39#include <wx/string.h>
40#include <wx/window.h>
41
42#include "ocpn_plugin.h"
43
44//-----------------------------------------------------------------------------------------
45// The opencpn_plugin base class implementation
46//-----------------------------------------------------------------------------------------
47
74 static wxBitmap* bitmap = 0;
75 if (!bitmap) bitmap = new wxBitmap(1, 1);
76 return bitmap;
77}
78
79opencpn_plugin::~opencpn_plugin() {}
80
81int opencpn_plugin::Init() { return 0; }
82
83bool opencpn_plugin::DeInit() { return true; }
84
86
88
90
92
93wxString opencpn_plugin::GetCommonName() { return "BaseClassCommonName"; }
94
96 return "OpenCPN PlugIn Base Class";
97}
98
100 return "OpenCPN PlugIn Base Class\n\
101PlugInManager created this base class";
102}
103
105
106void opencpn_plugin::SetNMEASentence(wxString& sentence) {}
107
108void opencpn_plugin::SetAISSentence(wxString& sentence) {}
109
111
113
114void opencpn_plugin::SetupToolboxPanel(int page_sel, wxNotebook* pnotebook) {}
115
116void opencpn_plugin::OnCloseToolboxPanel(int page_sel, int ok_apply_cancel) {}
117
119
121
123
125 return false;
126}
127
128void opencpn_plugin::SetCursorLatLon(double lat, double lon) {}
129
131
133
135
137
139
141 wxArrayString array;
142 return array;
143}
144
145// Opencpn_Plugin_16 Implementation
146opencpn_plugin_16::opencpn_plugin_16(void* pmgr) : opencpn_plugin(pmgr) {}
147
148opencpn_plugin_16::~opencpn_plugin_16() {}
149
151 return false;
152}
153
154void opencpn_plugin_16::SetPluginMessage(wxString& message_id,
155 wxString& message_body) {}
156
157// Opencpn_Plugin_17 Implementation
158opencpn_plugin_17::opencpn_plugin_17(void* pmgr) : opencpn_plugin(pmgr) {}
159
160opencpn_plugin_17::~opencpn_plugin_17() {}
161
162bool opencpn_plugin_17::RenderOverlay(wxDC& dc, PlugIn_ViewPort* vp) {
163 return false;
164}
165
166bool opencpn_plugin_17::RenderGLOverlay(wxGLContext* pcontext,
167 PlugIn_ViewPort* vp) {
168 return false;
169}
170
171void opencpn_plugin_17::SetPluginMessage(wxString& message_id,
172 wxString& message_body) {}
173
174// Opencpn_Plugin_18 Implementation
175opencpn_plugin_18::opencpn_plugin_18(void* pmgr) : opencpn_plugin(pmgr) {}
176
177opencpn_plugin_18::~opencpn_plugin_18() {}
178
179bool opencpn_plugin_18::RenderOverlay(wxDC& dc, PlugIn_ViewPort* vp) {
180 return false;
181}
182
183bool opencpn_plugin_18::RenderGLOverlay(wxGLContext* pcontext,
184 PlugIn_ViewPort* vp) {
185 return false;
186}
187
188void opencpn_plugin_18::SetPluginMessage(wxString& message_id,
189 wxString& message_body) {}
190
192
193// Opencpn_Plugin_19 Implementation
194opencpn_plugin_19::opencpn_plugin_19(void* pmgr) : opencpn_plugin_18(pmgr) {}
195
196opencpn_plugin_19::~opencpn_plugin_19() {}
197
199
200// Opencpn_Plugin_110 Implementation
201opencpn_plugin_110::opencpn_plugin_110(void* pmgr) : opencpn_plugin_19(pmgr) {}
202
203opencpn_plugin_110::~opencpn_plugin_110() {}
204
205void opencpn_plugin_110::LateInit() {}
206
207// Opencpn_Plugin_111 Implementation
208opencpn_plugin_111::opencpn_plugin_111(void* pmgr) : opencpn_plugin_110(pmgr) {}
209
210opencpn_plugin_111::~opencpn_plugin_111() {}
211
212// Opencpn_Plugin_112 Implementation
213opencpn_plugin_112::opencpn_plugin_112(void* pmgr) : opencpn_plugin_111(pmgr) {}
214
215opencpn_plugin_112::~opencpn_plugin_112() {}
216
217bool opencpn_plugin_112::MouseEventHook(wxMouseEvent& event) { return false; }
218
220 wxString& chart, wxString& feature, wxString& objname, double lat,
221 double lon, double scale, int nativescale) {}
222
223// Opencpn_Plugin_113 Implementation
224opencpn_plugin_113::opencpn_plugin_113(void* pmgr) : opencpn_plugin_112(pmgr) {}
225
226opencpn_plugin_113::~opencpn_plugin_113() {}
227
228bool opencpn_plugin_113::KeyboardEventHook(wxKeyEvent& event) { return false; }
229
232
233// Opencpn_Plugin_114 Implementation
234opencpn_plugin_114::opencpn_plugin_114(void* pmgr) : opencpn_plugin_113(pmgr) {}
235
236opencpn_plugin_114::~opencpn_plugin_114() {}
237
238// Opencpn_Plugin_115 Implementation
239opencpn_plugin_115::opencpn_plugin_115(void* pmgr) : opencpn_plugin_114(pmgr) {}
240
241opencpn_plugin_115::~opencpn_plugin_115() {}
242
243// Opencpn_Plugin_116 Implementation
244opencpn_plugin_116::opencpn_plugin_116(void* pmgr) : opencpn_plugin_115(pmgr) {}
245
246opencpn_plugin_116::~opencpn_plugin_116() {}
247
249 PlugIn_ViewPort* vp,
250 int max_canvas) {
251 return false;
252}
253
255 int max_canvas) {
256 return false;
257}
258
259void opencpn_plugin_116::PrepareContextMenu(int canvasIndex) { return; }
260
261// Opencpn_Plugin_117 Implementation
262opencpn_plugin_117::opencpn_plugin_117(void* pmgr) : opencpn_plugin_116(pmgr) {}
263
265
267
268const char* opencpn_plugin_117::GetPlugInVersionPre() { return ""; };
269
270const char* opencpn_plugin_117::GetPlugInVersionBuild() { return ""; };
271
272void opencpn_plugin_117::SetActiveLegInfo(Plugin_Active_Leg_Info& leg_info) {}
273
274// Opencpn_Plugin_118 Implementation
275opencpn_plugin_118::opencpn_plugin_118(void* pmgr) : opencpn_plugin_117(pmgr) {}
276
278 PlugIn_ViewPort* vp,
279 int max_canvas,
280 int priority) {
281 return false;
282}
283
285 int max_canvas,
286 int priority) {
287 return false;
288}
289
290// Opencpn_Plugin_119 Implementation
291opencpn_plugin_119::opencpn_plugin_119(void* pmgr) : opencpn_plugin_118(pmgr) {}
292
294
295// Opencpn_Plugin_120 Implementation
296opencpn_plugin_120::opencpn_plugin_120(void* pmgr) : opencpn_plugin_119(pmgr) {}
297
298void opencpn_plugin_120::OnContextMenuItemCallbackExt(int id,
299 std::string obj_ident,
300 std::string obj_type,
301 double lat, double lon) {}
302
303// Opencpn_Plugin_121 Implementation
304opencpn_plugin_121::opencpn_plugin_121(void* pmgr) : opencpn_plugin_120(pmgr) {}
305
306void opencpn_plugin_121::UpdateFollowState(int canvas_index, bool state) {}
307
308DateTimeFormatOptions::DateTimeFormatOptions()
309 : format_string("$weekday_short_date_time"),
310 time_zone(""),
311 show_timezone(true),
312 longitude(NAN),
313 version(1) {}
314
315DateTimeFormatOptions::~DateTimeFormatOptions() {}
Extended position fix information.
Basic position fix information.
Contains view parameters and status information for a chart display viewport.
Information about the currently active route leg.
virtual void SendVectorChartObjectInfo(wxString &chart, wxString &feature, wxString &objname, double lat, double lon, double scale, int nativescale)
Receives vector chart object information.
virtual bool MouseEventHook(wxMouseEvent &event)
Handles mouse events from chart window.
virtual void OnToolbarToolDownCallback(int id)
Handles toolbar button press.
virtual void OnToolbarToolUpCallback(int id)
Handles toolbar button release.
virtual bool KeyboardEventHook(wxKeyEvent &event)
Handles keyboard events from main window.
virtual void PrepareContextMenu(int canvasIndex)
Prepares plugin context menu items.
virtual bool RenderOverlayMultiCanvas(wxDC &dc, PlugIn_ViewPort *vp, int canvasIndex)
Renders plugin overlay graphics in standard DC mode for multi-canvas support.
virtual bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext, PlugIn_ViewPort *vp, int canvasIndex)
Renders plugin overlay graphics in OpenGL mode for multi-canvas support.
virtual int GetPlugInVersionPatch()
Forms a semantic version together with GetPlugInVersionMajor() and GetPlugInVersionMinor().
virtual const char * GetPlugInVersionPre()
Pre-release tag version part, see GetPlugInVersionPatch()
virtual const char * GetPlugInVersionBuild()
Build version part see GetPlugInVersionPatch().
virtual int GetPlugInVersionPost()
Post-release version part, extends the semver spec.
virtual bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext, PlugIn_ViewPort *vp, int canvasIndex, int priority)
Renders plugin overlay graphics in OpenGL mode with priority control.
virtual bool RenderOverlayMultiCanvas(wxDC &dc, PlugIn_ViewPort *vp, int canvas_ix, int priority)
Renders plugin overlay graphics in standard DC mode with priority control.
virtual void PreShutdownHook()
Called just before OpenCPN exits.
virtual void SetPluginMessage(wxString &message_id, wxString &message_body)
Receives plugin-to-plugin messages.
virtual bool RenderOverlay(wxDC &dc, PlugIn_ViewPort *vp)
Renders plugin overlay graphics in standard DC mode for single canvas.
virtual bool RenderGLOverlay(wxGLContext *pcontext, PlugIn_ViewPort *vp)
Renders plugin overlay graphics in OpenGL mode for single canvas.
virtual void SetPositionFixEx(PlugIn_Position_Fix_Ex &pfix)
Updates plugin with extended position fix data at regular intervals.
virtual void OnSetupOptions(void)
Allows plugin to add pages to global Options dialog.
Base class for OpenCPN plugins.
virtual void OnCloseToolboxPanel(int page_sel, int ok_apply_cancel)
Handles preference page closure.
virtual void SetCurrentViewPort(PlugIn_ViewPort &vp)
Notifies plugin of viewport changes.
virtual void OnContextMenuItemCallback(int id)
Handles context menu item selection.
virtual void UpdateAuiStatus(void)
Updates AUI manager status.
virtual void ShowPreferencesDialog(wxWindow *parent)
Shows the plugin preferences dialog.
virtual void SetColorScheme(PI_ColorScheme cs)
Updates plugin color scheme.
virtual wxBitmap * GetPlugInBitmap()
Get the plugin's icon bitmap.
virtual int Init(void)
Initialize the plugin and declare its capabilities.
virtual wxArrayString GetDynamicChartClassNameArray(void)
Returns array of dynamically loaded chart class names.
virtual void SetupToolboxPanel(int page_sel, wxNotebook *pnotebook)
Creates a plugin preferences page.
virtual bool DeInit(void)
Clean up plugin resources.
virtual void SetDefaults(void)
Sets plugin default options.
virtual wxString GetShortDescription()
Get a brief description of the plugin.
virtual int GetToolbarToolCount(void)
Returns the number of toolbar tools this plugin provides.
virtual int GetToolboxPanelCount(void)
Returns the number of preference pages this plugin provides.
virtual wxString GetCommonName()
Get the plugin's common (short) name.
virtual int GetPlugInVersionMajor()
Returns the major version number of the plugin itself.
virtual void SetPositionFix(PlugIn_Position_Fix &pfix)
Updates plugin with current position fix data at regular intervals.
virtual int GetAPIVersionMinor()
Returns the minor version number of the plugin API that this plugin supports.
virtual int GetAPIVersionMajor()
Returns the major version number of the plugin API that this plugin supports.
virtual void SetNMEASentence(wxString &sentence)
Receive all NMEA 0183 sentences from OpenCPN.
virtual bool RenderOverlay(wxMemoryDC *pmdc, PlugIn_ViewPort *vp)
Render plugin overlay graphics using standard device context.
virtual void SetAISSentence(wxString &sentence)
Receive all AIS sentences from OpenCPN.
virtual void ProcessParentResize(int x, int y)
Handles parent window resize events.
virtual void SetCursorLatLon(double lat, double lon)
Receives cursor lat/lon position updates.
virtual wxString GetLongDescription()
Get detailed plugin information.
virtual void OnToolbarToolCallback(int id)
Handles toolbar tool clicks.
virtual int GetPlugInVersionMinor()
Returns the minor version number of the plugin itself.
PlugIn Object Definition/API.
PI_ColorScheme
Color schemes for different lighting conditions.