OpenCPN Partial API docs
Loading...
Searching...
No Matches
grib_pi.h
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, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
36#ifndef _GRIBPI_H_
37#define _GRIBPI_H_
38
39#include "wx/wxprec.h"
40
41#ifndef WX_PRECOMP
42#include "wx/wx.h"
43#include <wx/glcanvas.h>
44#endif // precompiled headers
45
46#define PLUGIN_VERSION_MAJOR 5
47#define PLUGIN_VERSION_MINOR 0
48
49#define MY_API_VERSION_MAJOR 1
50#define MY_API_VERSION_MINOR 16
51
52#include "ocpn_plugin.h"
53
54#include "wx/jsonreader.h"
55#include "wx/jsonwriter.h"
56
57#include "GribSettingsDialog.h"
58#include "GribOverlayFactory.h"
59#include "GribUIDialog.h"
60
62
63//----------------------------------------------------------------------------------------------------------
64// The PlugIn Class Definition
65//----------------------------------------------------------------------------------------------------------
66
67#define GRIB_TOOL_POSITION -1 // Request default positioning of ToolBar tool
68#define STARTING_STATE_STYLE 9999 // style option undifined
69#define ATTACHED 0 // dialog are attached
70#define SEPARATED 1 // dialog are separated
71#define ATTACHED_HAS_CAPTION 0 // dialog attached has a caption
72#define ATTACHED_NO_CAPTION 1 // dialog attached don't have caption
73#define SEPARATED_HORIZONTAL 2 // dialog separated shown honrizontaly
74#define SEPARATED_VERTICAL 3 // dialog separated shown vaerticaly
75
76enum SettingsDisplay {
77 B_ARROWS,
78 ISO_LINE,
79 ISO_ABBR,
80 ISO_LINE_SHORT,
81 ISO_LINE_VISI,
82 D_ARROWS,
83 OVERLAY,
84 NUMBERS,
85 PARTICLES
86};
87
89public:
90 grib_pi(void *ppimgr);
91 ~grib_pi(void);
92
93 // The required PlugIn Methods
94 int Init(void);
95 bool DeInit(void);
96
97 int GetAPIVersionMajor();
98 int GetAPIVersionMinor();
99 int GetPlugInVersionMajor();
100 int GetPlugInVersionMinor();
101 wxBitmap *GetPlugInBitmap();
102 wxString GetCommonName();
103 wxString GetShortDescription();
104 wxString GetLongDescription();
105
106 // The override PlugIn Methods
107 bool MouseEventHook(wxMouseEvent &event);
108 bool RenderOverlay(wxDC &dc, PlugIn_ViewPort *vp);
109 bool RenderOverlayMultiCanvas(wxDC &dc, PlugIn_ViewPort *vp, int canvasIndex);
110 void SetCursorLatLon(double lat, double lon);
111 void OnContextMenuItemCallback(int id);
112 void SetPluginMessage(wxString &message_id, wxString &message_body);
113 bool RenderGLOverlay(wxGLContext *pcontext, PlugIn_ViewPort *vp);
114 bool RenderGLOverlayMultiCanvas(wxGLContext *pcontext, PlugIn_ViewPort *vp,
115 int canvasIndex);
116 void SendTimelineMessage(wxDateTime time);
117 void SetDefaults(void);
118 int GetToolBarToolCount(void);
119 void ShowPreferencesDialog(wxWindow *parent);
120 void OnToolbarToolCallback(int id);
121 bool QualifyCtrlBarPosition(wxPoint position, wxSize size);
122 void MoveDialog(wxDialog *dialog, wxPoint position);
123 void SetPositionFixEx(PlugIn_Position_Fix_Ex &pfix);
124
125 // Other public methods
126 void SetCtrlBarXY(wxPoint p) { m_CtrlBarxy = p; }
127 void SetCursorDataXY(wxPoint p) { m_CursorDataxy = p; }
128 void SetCtrlBarSizeXY(wxSize p) { m_CtrlBar_Sizexy = p; }
129 void SetColorScheme(PI_ColorScheme cs);
130 void SetDialogFont(wxWindow *window,
131 wxFont *font = OCPNGetFont(_("Dialog"), 0));
132 void SetCurrentViewPort(PlugIn_ViewPort &vp) { m_current_vp = vp; }
133 PlugIn_ViewPort &GetCurrentViewPort() { return m_current_vp; }
134
135 void OnGribCtrlBarClose();
136
137 wxPoint GetCtrlBarXY() { return m_CtrlBarxy; }
138 wxPoint GetCursorDataXY() { return m_CursorDataxy; }
139 int GetTimeZone() { return m_bTimeZone; }
140 void SetTimeZone(int tz);
141 int GetStartOptions() { return m_bStartOptions; }
148 bool GetCopyFirstCumRec() { return m_bCopyFirstCumRec; }
156 bool GetCopyMissWaveRec() { return m_bCopyMissWaveRec; }
157
158 GRIBOverlayFactory *m_pGRIBOverlayFactory;
159 GRIBOverlayFactory *GetGRIBOverlayFactory() { return m_pGRIBOverlayFactory; }
160
161 void UpdatePrefs(GribPreferencesDialog *Pref);
162
163 int m_MenuItem;
164 bool m_DialogStyleChanged;
165
166 wxSize m_coreToolbarSize;
167 wxPoint m_coreToolbarPosn;
168 bool m_bZoomToCenterAtInit;
169 wxString m_local_sources_catalog;
170 double m_boat_lat, m_boat_lon;
171 double m_boat_cog, m_boat_sog;
172 time_t m_boat_time;
173
174private:
175 bool LoadConfig(void);
176 bool SaveConfig(void);
177
178 bool DoRenderGLOverlay(wxGLContext *pcontext, PlugIn_ViewPort *vp,
179 int canvasIndex);
180 bool DoRenderOverlay(wxDC &dc, PlugIn_ViewPort *vp, int canvasIndex);
181
182 wxFileConfig *m_pconfig;
183 wxWindow *m_parent_window;
184
185 GRIBUICtrlBar *m_pGribCtrlBar;
186
187 int m_display_width, m_display_height;
188 int m_leftclick_tool_id;
189
190 wxPoint m_CtrlBarxy, m_CursorDataxy;
191 wxSize m_CtrlBar_Sizexy;
192
193 // Controls added to Preferences panel
194 wxCheckBox *m_pGRIBUseHiDef;
195 wxCheckBox *m_pGRIBUseGradualColors;
196
197 GribTimelineRecordSet *m_pLastTimelineSet;
198
199 // preference data
200 bool m_bGRIBUseHiDef;
201 bool m_bGRIBUseGradualColors;
202 bool m_bDrawBarbedArrowHead;
203 int m_bTimeZone;
208 bool m_bCopyFirstCumRec;
213 bool m_bCopyMissWaveRec;
214 int m_bLoadLastOpenFile;
215 int m_bStartOptions;
216 wxString m_RequestConfig;
217 wxString m_bMailToAddresses;
218 wxString m_bMailFromAddress;
219 wxString m_ZyGribLogin;
220 wxString m_ZyGribCode;
221 double m_GUIScaleFactor;
222#ifdef __WXMSW__
223 double m_GribIconsScaleFactor;
224#endif
225 bool m_bGRIBShowIcon;
226
227 bool m_bShowGrib;
228 PlugIn_ViewPort m_current_vp;
229 wxBitmap m_panelBitmap;
230};
231
232//----------------------------------------------------------------------------------------
233// Preference dialog definition
234//----------------------------------------------------------------------------------------
235
237public:
238 GribPreferencesDialog(wxWindow *pparent)
239 : GribPreferencesDialogBase(pparent) {}
241
242 void OnOKClick(wxCommandEvent &event);
243
244private:
245 void OnStartOptionChange(wxCommandEvent &event);
246};
247#endif
GRIB Data Visualization and Rendering Factory.
GRIB Display Settings Configuration Interface.
GRIB Weather Data Control Interface.
Factory class for creating and managing GRIB data visualizations.
Class GribPreferencesDialogBase.
A specialized GribRecordSet that represents temporally interpolated weather data with isobar renderin...
bool GetCopyFirstCumRec()
Returns true if cumulative parameters like precipitation and cloud cover should initialize their star...
Definition grib_pi.h:148
wxBitmap * GetPlugInBitmap()
FIXME static wxBitmap* LoadSVG(const wxString filename, unsigned int width, ...
Definition grib_pi.cpp:195
bool GetCopyMissWaveRec()
Returns true if wave data should be propagated across time periods where wave records are missing.
Definition grib_pi.h:156
PlugIn Object Definition/API.
wxFont * OCPNGetFont(wxString TextElement, int default_size)
Gets a font for UI elements.