OpenCPN Partial API docs
Loading...
Searching...
No Matches
ocpn_plugin.cpp
1/***************************************************************************
2 *
3 * Project: OpenCPN
4 * Purpose: PlugIn Manager Object
5 * Author: David Register
6 *
7 ***************************************************************************
8 * Copyright (C) 2010 by David S. Register *
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 * This program is distributed in the hope that it will be useful, *
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 * GNU General Public License for more details. *
19 * *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program; if not, write to the *
22 * Free Software Foundation, Inc., *
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
24 **************************************************************************/
25
26#include "config.h"
27
28#include <algorithm>
29#include <set>
30#include <typeinfo>
31#include <unordered_map>
32
33#include <wx/wx.h>
34#include <wx/arrstr.h>
35#include <wx/dc.h>
36#include <wx/dcmemory.h>
37#include <wx/event.h>
38#include <wx/glcanvas.h>
39#include <wx/notebook.h>
40#include <wx/string.h>
41#include <wx/window.h>
42
43#include "ocpn_plugin.h"
44
45extern wxWindow* gFrame;
46
47//-----------------------------------------------------------------------------------------
48// The opencpn_plugin base class implementation
49//-----------------------------------------------------------------------------------------
50
77 static wxBitmap* bitmap = 0;
78 if (!bitmap) bitmap = new wxBitmap(1, 1);
79 return bitmap;
80}
81
82opencpn_plugin::~opencpn_plugin() {}
83
84int opencpn_plugin::Init(void) { return 0; }
85
86bool opencpn_plugin::DeInit(void) { return true; }
87
88int opencpn_plugin::GetAPIVersionMajor() { return 1; }
89
90int opencpn_plugin::GetAPIVersionMinor() { return 2; }
91
92int opencpn_plugin::GetPlugInVersionMajor() { return 1; }
93
94int opencpn_plugin::GetPlugInVersionMinor() { return 0; }
95
96wxString opencpn_plugin::GetCommonName() { return "BaseClassCommonName"; }
97
98wxString opencpn_plugin::GetShortDescription() {
99 return "OpenCPN PlugIn Base Class";
100}
101
102wxString opencpn_plugin::GetLongDescription() {
103 return "OpenCPN PlugIn Base Class\n\
104PlugInManager created this base class";
105}
106
107void opencpn_plugin::SetPositionFix(PlugIn_Position_Fix& pfix) {}
108
109void opencpn_plugin::SetNMEASentence(wxString& sentence) {}
110
111void opencpn_plugin::SetAISSentence(wxString& sentence) {}
112
113int opencpn_plugin::GetToolbarToolCount(void) { return 0; }
114
115int opencpn_plugin::GetToolboxPanelCount(void) { return 0; }
116
117void opencpn_plugin::SetupToolboxPanel(int page_sel, wxNotebook* pnotebook) {}
118
119void opencpn_plugin::OnCloseToolboxPanel(int page_sel, int ok_apply_cancel) {}
120
121void opencpn_plugin::ShowPreferencesDialog(wxWindow* parent) {}
122
123void opencpn_plugin::OnToolbarToolCallback(int id) {}
124
125void opencpn_plugin::OnContextMenuItemCallback(int id) {}
126
127bool opencpn_plugin::RenderOverlay(wxMemoryDC* dc, PlugIn_ViewPort* vp) {
128 return false;
129}
130
131void opencpn_plugin::SetCursorLatLon(double lat, double lon) {}
132
133void opencpn_plugin::SetCurrentViewPort(PlugIn_ViewPort& vp) {}
134
135void opencpn_plugin::SetDefaults(void) {}
136
137void opencpn_plugin::ProcessParentResize(int x, int y) {}
138
139void opencpn_plugin::SetColorScheme(PI_ColorScheme cs) {}
140
141void opencpn_plugin::UpdateAuiStatus(void) {}
142
143wxArrayString opencpn_plugin::GetDynamicChartClassNameArray() {
144 wxArrayString array;
145 return array;
146}
147
148// Opencpn_Plugin_16 Implementation
149opencpn_plugin_16::opencpn_plugin_16(void* pmgr) : opencpn_plugin(pmgr) {}
150
151opencpn_plugin_16::~opencpn_plugin_16(void) {}
152
153bool opencpn_plugin_16::RenderOverlay(wxDC& dc, PlugIn_ViewPort* vp) {
154 return false;
155}
156
157void opencpn_plugin_16::SetPluginMessage(wxString& message_id,
158 wxString& message_body) {}
159
160// Opencpn_Plugin_17 Implementation
161opencpn_plugin_17::opencpn_plugin_17(void* pmgr) : opencpn_plugin(pmgr) {}
162
163opencpn_plugin_17::~opencpn_plugin_17(void) {}
164
165bool opencpn_plugin_17::RenderOverlay(wxDC& dc, PlugIn_ViewPort* vp) {
166 return false;
167}
168
169bool opencpn_plugin_17::RenderGLOverlay(wxGLContext* pcontext,
170 PlugIn_ViewPort* vp) {
171 return false;
172}
173
174void opencpn_plugin_17::SetPluginMessage(wxString& message_id,
175 wxString& message_body) {}
176
177// Opencpn_Plugin_18 Implementation
178opencpn_plugin_18::opencpn_plugin_18(void* pmgr) : opencpn_plugin(pmgr) {}
179
180opencpn_plugin_18::~opencpn_plugin_18(void) {}
181
182bool opencpn_plugin_18::RenderOverlay(wxDC& dc, PlugIn_ViewPort* vp) {
183 return false;
184}
185
186bool opencpn_plugin_18::RenderGLOverlay(wxGLContext* pcontext,
187 PlugIn_ViewPort* vp) {
188 return false;
189}
190
191void opencpn_plugin_18::SetPluginMessage(wxString& message_id,
192 wxString& message_body) {}
193
194void opencpn_plugin_18::SetPositionFixEx(PlugIn_Position_Fix_Ex& pfix) {}
195
196// Opencpn_Plugin_19 Implementation
197opencpn_plugin_19::opencpn_plugin_19(void* pmgr) : opencpn_plugin_18(pmgr) {}
198
199opencpn_plugin_19::~opencpn_plugin_19(void) {}
200
201void opencpn_plugin_19::OnSetupOptions(void) {}
202
203// Opencpn_Plugin_110 Implementation
204opencpn_plugin_110::opencpn_plugin_110(void* pmgr) : opencpn_plugin_19(pmgr) {}
205
206opencpn_plugin_110::~opencpn_plugin_110(void) {}
207
208void opencpn_plugin_110::LateInit(void) {}
209
210// Opencpn_Plugin_111 Implementation
211opencpn_plugin_111::opencpn_plugin_111(void* pmgr) : opencpn_plugin_110(pmgr) {}
212
213opencpn_plugin_111::~opencpn_plugin_111(void) {}
214
215// Opencpn_Plugin_112 Implementation
216opencpn_plugin_112::opencpn_plugin_112(void* pmgr) : opencpn_plugin_111(pmgr) {}
217
218opencpn_plugin_112::~opencpn_plugin_112(void) {}
219
220bool opencpn_plugin_112::MouseEventHook(wxMouseEvent& event) { return false; }
221
222void opencpn_plugin_112::SendVectorChartObjectInfo(
223 wxString& chart, wxString& feature, wxString& objname, double lat,
224 double lon, double scale, int nativescale) {}
225
226// Opencpn_Plugin_113 Implementation
227opencpn_plugin_113::opencpn_plugin_113(void* pmgr) : opencpn_plugin_112(pmgr) {}
228
229opencpn_plugin_113::~opencpn_plugin_113(void) {}
230
231bool opencpn_plugin_113::KeyboardEventHook(wxKeyEvent& event) { return false; }
232
233void opencpn_plugin_113::OnToolbarToolDownCallback(int id) {}
234void opencpn_plugin_113::OnToolbarToolUpCallback(int id) {}
235
236// Opencpn_Plugin_114 Implementation
237opencpn_plugin_114::opencpn_plugin_114(void* pmgr) : opencpn_plugin_113(pmgr) {}
238
239opencpn_plugin_114::~opencpn_plugin_114(void) {}
240
241// Opencpn_Plugin_115 Implementation
242opencpn_plugin_115::opencpn_plugin_115(void* pmgr) : opencpn_plugin_114(pmgr) {}
243
244opencpn_plugin_115::~opencpn_plugin_115(void) {}
245
246// Opencpn_Plugin_116 Implementation
247opencpn_plugin_116::opencpn_plugin_116(void* pmgr) : opencpn_plugin_115(pmgr) {}
248
249opencpn_plugin_116::~opencpn_plugin_116(void) {}
250
251bool opencpn_plugin_116::RenderGLOverlayMultiCanvas(wxGLContext* pcontext,
252 PlugIn_ViewPort* vp,
253 int max_canvas) {
254 return false;
255}
256
257bool opencpn_plugin_116::RenderOverlayMultiCanvas(wxDC& dc, PlugIn_ViewPort* vp,
258 int max_canvas) {
259 return false;
260}
261
262void opencpn_plugin_116::PrepareContextMenu(int canvasIndex) { return; }
263
264// Opencpn_Plugin_117 Implementation
265opencpn_plugin_117::opencpn_plugin_117(void* pmgr) : opencpn_plugin_116(pmgr) {}
266
267int opencpn_plugin_117::GetPlugInVersionPatch() { return 0; };
268
270
271const char* opencpn_plugin_117::GetPlugInVersionPre() { return ""; };
272
273const char* opencpn_plugin_117::GetPlugInVersionBuild() { return ""; };
274
275void opencpn_plugin_117::SetActiveLegInfo(Plugin_Active_Leg_Info& leg_info) {}
276
277// Opencpn_Plugin_118 Implementation
278opencpn_plugin_118::opencpn_plugin_118(void* pmgr) : opencpn_plugin_117(pmgr) {}
279
281 PlugIn_ViewPort* vp,
282 int max_canvas,
283 int priority) {
284 return false;
285}
286
288 int max_canvas,
289 int priority) {
290 return false;
291}
292
293// Opencpn_Plugin_119 Implementation
294opencpn_plugin_119::opencpn_plugin_119(void* pmgr) : opencpn_plugin_118(pmgr) {}
295
296void opencpn_plugin_119::PreShutdownHook() { return; }
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)
Render plugin overlay over chart canvas in OpenGL mode.
virtual bool RenderOverlayMultiCanvas(wxDC &dc, PlugIn_ViewPort *vp, int canvas_ix, int priority)
Render plugin overlay over chart canvas in non-OpenGL mode.
virtual wxBitmap * GetPlugInBitmap()
FIXME static wxBitmap* LoadSVG(const wxString filename, unsigned int width, ...
virtual void SetNMEASentence(wxString &sentence)
Receive all NMEA 0183 sentences from OpenCPN.
virtual void SetAISSentence(wxString &sentence)
Receive all AIS sentences from OpenCPN.
PlugIn Object Definition/API.