47#ifndef GRIBREQUESTDIALOG_H_
48#define GRIBREQUESTDIALOG_H_
56#include "jsonreader.h"
59#define XYGRIB_MAX_DOWNLOADABLE_GRIB_SIZE_MB 10
69const std::string CATALOG_URL =
70 "https://raw.githubusercontent.com/chartcatalogs/gribcatalog/main/"
73const std::string WORLD_MODELS_URL =
"https://grib.bosun.io/models";
101 void OnClose(wxCloseEvent &event)
override;
157 void SetRequestDialogSize();
158 void StopGraphicalZoneSelection();
159 void UpdateAreaSelectionState();
197 [[nodiscard]]
int GetBoundingBoxCanvasIndex()
const {
198 return m_boundingBoxCanvasIndex;
206 wxString m_RequestConfigBase;
207 wxString m_MailToAddresses;
241 void OnTopChange(wxCommandEvent &event)
override;
242 void OnMovingClick(wxCommandEvent &event)
override;
243 void OnAnyChange(wxCommandEvent &event)
override;
244 void OnAnySpinChange(wxSpinEvent &event)
override {
250 HighlightArea(0, 0, 0, 0);
252 void OnTimeRangeChange(wxCommandEvent &event)
override;
253 void OnSendMaiL(wxCommandEvent &event)
override;
254 void OnOK(wxCommandEvent &event)
override;
255 void OnZoneSelectionModeChange(wxCommandEvent &event)
override;
260 void OnWorldModelChoice(wxCommandEvent &event)
override;
261 void OnUpdateWorldModels(wxCommandEvent &event)
override;
262 void OnWorldDownload(wxCommandEvent &event)
override;
263 void OnLocalTreeItemExpanded(wxTreeEvent &event)
override {
event.Skip(); }
264 void OnLocalTreeSelChanged(wxTreeEvent &event)
override;
265 void OnUpdateLocalCatalog(wxCommandEvent &event)
override;
267 void OnXyGribDownloadButton(wxCommandEvent &event)
override;
271 void OnDownloadLocal(wxCommandEvent &event)
override;
272 void OnCoordinatesChange(wxSpinEvent &event)
override;
273 void SaveConfig()
override;
276 void HighlightArea(
double latmax,
double lonmax,
double latmin,
278 void ReadLocalCatalog();
279 void ReadWorldModels();
280 int FindWorldModel(
const wxString &name);
283 void ApplyRequestConfig(
unsigned rs,
unsigned it,
unsigned tr);
284 wxString WriteMail();
285 int EstimateFileSize(
double *size);
287 template <
typename T>
288 static std::string FormatPerLocale(T value);
290 static wxString GetDownloadProgressText(
long bytesTransferred,
294 void InitRequestConfig();
295 void OnExit(wxCommandEvent &event) {
300 void OnMouseEventTimer(wxTimerEvent &event);
301 void SetCoordinatesText();
304 void EnableDownloadButtons();
307 void InitializeXygribDialog();
308 wxString BuildXyGribUrl();
309 wxString BuildGribFileName();
312 void ApplyXyGribConfiguration();
313 void MemorizeXyGribConfiguration();
315 void UpdateGribSizeEstimate();
318 int m_selectedAtmModelIndex;
320 int m_selectedWaveModelIndex;
322 int m_gribSizeEstimate;
329 wxTimer m_tMouseEventTimer;
330 wxTimer m_tMouseClickTimer;
331 wxMouseEvent m_SingleClickEvent;
339 double m_displayScale;
342 long m_download_handle;
343 bool m_bTransferSuccess;
345 bool m_bLocal_source_selected;
349 int m_boundingBoxCanvasIndex;
Class GribRequestSettingBase.
Manages GRIB file request configuration and downloads.
double m_StartLat
The latitude at the starting point of the bounding box.
void OnXyGribWaveModelChoice(wxCommandEvent &event) override
Handle action of changing wave model selection.
void OnSendMaiL(wxCommandEvent &event) override
Callback invoked when the user clicks the "Send" button in the "e-mail" tab.
double GetMinLat() const
Get the minimum latitude of the bounding box for the download request.
double GetMaxLat() const
Get the maximum latitude of the bounding box for the download request.
double m_Lat
The latitude at the mouse cursor while drawing a bounding box.
void OnCancel(wxCommandEvent &event) override
Callback invoked when the user clicks the "Cancel" button in the "download" dialog.
void OnVpUnderMouseChange(PlugIn_ViewPort *vp)
Callback invoked when the view port under mouse has changed.
bool RenderGlZoneOverlay()
Renders the GRIB area selection overlay using OpenGL.
bool RenderZoneOverlay(wxDC &dc)
Renders the GRIB area selection overlay using standard device context.
double m_Lon
The longitude at the mouse cursor while drawing a bounding box.
void OnXyGribAtmModelChoice(wxCommandEvent &event) override
Handle action of changing atmospheric model selection.
wxPoint m_StartPoint
Starting point of the bounding box in physical pixels.
bool DoRenderZoneOverlay()
Draws the GRIB area selection overlay on the chart.
void OnNotebookPageChanged(wxNotebookEvent &event) override
Save the "download" configuration to disk.
bool MouseEventHook(wxMouseEvent &event)
Intercepts mouse events to handle GRIB area selection.
void OnVpWithFocusChange(PlugIn_ViewPort *vp)
Callback invoked when the focused view port has changed, such as in multi-chart mode when user switch...
PlugIn_ViewPort * m_VpMouse
The viewport under the mouse.
ZoneSelectionRenderState m_RenderSelectionZoneState
Current state of the bounding box overlay rendering.
void OnXyGribConfigChange(wxCommandEvent &event) override
Handle action of changing a GRIB configuration parameter.
double GetMaxLon() const
Get the maximum longitude of the bounding box for the download request.
PlugIn_ViewPort * m_VpFocus
The viewport currently in focus.
double m_StartLon
The longitude at the starting point of the bounding box.
double GetMinLon() const
Get the minimum longitude of the bounding box for the download request.
void OnOK(wxCommandEvent &event) override
Callback invoked when the user clicks the "OK" button in the "download" dialog.
Contains view parameters and status information for a chart display viewport.
The JSON value class implementation.
ZoneSelectionRenderState
Enumeration defining the states of the GRIB zone selection overlay rendering.
@ 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.
GRIB Weather Data Control Interface.
Base User Interface Components for GRIB Plugin.
Graphics abstraction layer on top of wxDC or OpenGL.