OpenCPN Partial API docs
Loading...
Searching...
No Matches
GribRequestDialog.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 ***************************************************************************
19 */
47#ifndef __GRIBREQUESTDIALOG_H__
48#define __GRIBREQUESTDIALOG_H__
49
50#ifndef WX_PRECOMP
51#include "wx/wx.h"
52#endif // precompiled headers
53
54#include "GribUIDialogBase.h"
55#include "GribUIDialog.h"
56#include "pi_ocpndc.h"
57#include "wx/jsonreader.h"
58
66
67const std::string CATALOG_URL =
68 "https://raw.githubusercontent.com/chartcatalogs/gribcatalog/main/"
69 "sources.json";
70
71#define XYGRIB_MAX_DOWNLOADABLE_GRIB_SIZE_MB 10
72
85public:
87
89
90 void OnClose(wxCloseEvent &event) override;
91 void SetVpSize(PlugIn_ViewPort *vp);
92 void OnVpChange(PlugIn_ViewPort *vp);
93 bool MouseEventHook(wxMouseEvent &event);
94 bool RenderZoneOverlay(wxDC &dc);
95 bool RenderGlZoneOverlay();
96 bool DoRenderZoneOverlay();
97 void SetRequestDialogSize();
98 void StopGraphicalZoneSelection();
99 void Save() {
100 wxCommandEvent evt;
101 OnSaveMail(evt);
102 }
103
104 wxString m_RequestConfigBase;
105 wxString m_MailToAddresses;
106 int m_RenderZoneOverlay;
107
108 wxPoint m_StartPoint;
109 PlugIn_ViewPort *m_Vp;
110 double m_Lat;
111 double m_Lon;
112
113private:
114 void HighlightArea(double latmax, double lonmax, double latmin,
115 double lonmin);
116 void ReadLocalCatalog();
117 void FillTreeCtrl(wxJSONValue &data);
118 void ApplyRequestConfig(unsigned rs, unsigned it, unsigned tr);
119 wxString WriteMail();
120 int EstimateFileSize(double *size);
121
122 void InitRequestConfig();
123 void OnExit(wxCommandEvent &event) {
124 wxCloseEvent evt;
125 OnClose(evt);
126 }
127 void OnTopChange(wxCommandEvent &event) override;
128 void OnMovingClick(wxCommandEvent &event) override;
129 void OnAnyChange(wxCommandEvent &event) override;
130 void OnAnySpinChange(wxSpinEvent &event) override {
131 wxCommandEvent evt;
132 OnAnyChange(evt);
133 }
134 void OnNotebookPageChanged(wxNotebookEvent &event) override {
135 HighlightArea(0, 0, 0, 0);
136 }
137 void OnTimeRangeChange(wxCommandEvent &event) override;
138 void OnSendMaiL(wxCommandEvent &event) override;
139 void OnSaveMail(wxCommandEvent &event) override;
140 void OnZoneSelectionModeChange(wxCommandEvent &event) override;
141 void OnCancel(wxCommandEvent &event) override {
142 wxCloseEvent evt;
143 OnClose(evt);
144 }
145 void OnCoordinatesChange(wxSpinEvent &event) override;
146 void OnMouseEventTimer(wxTimerEvent &event);
147 void SetCoordinatesText();
148 void OnWorldLengthChoice(wxCommandEvent &event) override { event.Skip(); }
149 void OnWorldResolutionChoice(wxCommandEvent &event) override { event.Skip(); }
150 void OnWorldDownload(wxCommandEvent &event) override;
151 void OnLocalTreeItemExpanded(wxTreeEvent &event) override { event.Skip(); }
152 void OnLocalTreeSelChanged(wxTreeEvent &event) override;
153 void OnUpdateLocalCatalog(wxCommandEvent &event) override;
154 void OnDownloadLocal(wxCommandEvent &event) override;
155 void onDLEvent(OCPN_downloadEvent &ev);
156 void EnableDownloadButtons();
157
158 // Xygrib internal methods
159 void InitializeXygribDialog();
160 wxString BuildXyGribUrl();
161 wxString BuildGribFileName();
162 // XyGrib GUI callbacks
163 void OnXyGribDownloadButton(wxCommandEvent &event) override;
164 void OnXyGribAtmModelChoice(wxCommandEvent &event) override;
165 void OnXyGribWaveModelChoice(wxCommandEvent &event) override;
166 void OnXyGribConfigChange(wxCommandEvent &event) override;
167 // Manage XyGrib UI Configuration
168 void ApplyXyGribConfiguration();
169 void MemorizeXyGribConfiguration();
170 // Calculate estimated size of GRIB file
171 void UpdateGribSizeEstimate();
172
173 // Index of currently selected XyGrib atmospheric model
174 int m_selectedAtmModelIndex;
175 // Index of currently selected XyGrib wave model
176 int m_selectedWaveModelIndex;
177 // Last size estimation of the GRIB file
178 int m_gribSizeEstimate;
179
180 GRIBUICtrlBar &m_parent;
181
182 wxDC *m_pdc;
183 pi_ocpnDC *m_oDC; // Used for selection overlay on GL
184
185 wxTimer m_tMouseEventTimer;
186 wxTimer m_tMouseClickTimer;
187 wxMouseEvent m_SingleClickEvent;
188
189 bool IsZYGRIB;
190 bool IsGFS;
191 int m_MailError_Nb;
192 int m_SendMethod;
193 bool m_AllowSend;
194 bool m_IsMaxLong;
195 double m_displayScale;
196 bool m_connected;
197 bool m_downloading;
198 long m_download_handle;
199 bool m_bTransferSuccess;
200 bool m_canceled;
201 bool m_bLocal_source_selected;
202 GribDownloadType m_downloadType;
203};
204
205#endif
GribDownloadType
@ WORLD
Global forecast downloads (e.g., GFS)
@ XYGRIB
Downloads from XyGrib service.
@ NONE
No download source selected.
@ LOCAL_CATALOG
Downloads from configured catalogs.
@ LOCAL
Downloads from local sources.
Base User Interface Components for GRIB Plugin.
GRIB Weather Data Control Interface.
Class GribRequestSettingBase.
Manages GRIB file request configuration and downloads.
The JSON value class implementation.
Definition jsonval.h:84