Hello Developers and Testers...
The OpenCPN PlugIn Architecture, API Version 1.0 has been released for Beta discussion and test.
Design and Release Notes:
1. PlugIns are dynamically loaded libraries;
{name}_pi.dll for Windows
lib{name}_pi.so for
linux.
2. Plugins are automatically detected when placed in the correct directory.
Windows: {Where OpenCPN is}\plugins ex: C:\Program Files\OpenCPN\plugins
linux: {prefix}/share/opencpn/plugins ex: /usr/local/share/opencpn/plugins
3. All detected, compatible PlugIns are loaded and initialized on application startup. We may want to develop a "PlugInManagerDialog" to allow selective loading...
4. Plugins are written in C++ and use the wxWidgets toolset. Interested developers are invited to consider other, more generic, toolsets and propose useful API extensions thereto. It should be possible to integrate with wxPython, for example...
5. The API is roughly defined in include/ocpn_plugin.h, found in the source tree. More verbage needed here.
I have created two PlugIns:
1. grib_pi
This is a PlugIn implementing the
current GRIB overlay functionality. My alpha testing indicates that the functionality of GRIB in 2.1.0 is (almost) exactly duplicated. Full testing is required. Some developer(s) may wish to consider improved performance of this PlugIn. The code is fairly brutish in some places. Better caching and rendering are indicated.
I plan to release this PlugIn as part of opencpn Version 2.2.
This PlugIn does a lot of interesting stuff at the API level.
a. Toolbar Tool addition/management.
b. Toolbox Tab page addition.
c. Config file read/write.
d. Chart overlay rendering.
e. Private dialog management.
f. Mouse
tracking.
Observant readers will note that this is exactly the functionality required for many chart overlay applications.
Google KML file support is one. Some kind of Active
Captain PlugIn is another candidate. Satallite
radio weather....BlackBox
radar...Others???
We could probably move
AIS out to a PlugIn if we wanted to.
2. demo_pi
Demo_pi is, well, a demonstration. It can be used as the skeleton of a more advanced PlugIn development effort. I do not plan to release demo_pi in the next official 2.2 Release. It is for developer discussion and use only. It doesn't really do much, anyway.
Demo_pi exercises and demonstrates at least the following:
a. Private window creation.
b.
NMEA data stream interception.
c. Context Menu item addition/management.
I expect demo_pi will be the basis wrapper for the much anticipated "dashboard" function that is our most popular request.
So, this is a start.
I am not smart enough to have anticipated all possible API requirements of a PlugIn. I expect as developers begin to actually consider writing PlugIns, we will have to add new methods, functions, and data types to the API specification. No problem with that. I hope we can stabilize the API for Version 2.2 release. We will make every effort to preserve backward compatibility where possible.
The PlugIn build process is a work-in-progress. Developer comments and improvements regarding the cmake scripts are encouraged.
I welcome spirited discussion of PlugIn development efforts here.
We will want separate threads for discussion of each PlugIn as each is ready for testing.
Good Luck
Dave