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/"
99 void OnClose(wxCloseEvent &event)
override;
155 void SetRequestDialogSize();
156 void StopGraphicalZoneSelection();
157 void UpdateAreaSelectionState();
195 [[nodiscard]]
int GetBoundingBoxCanvasIndex()
const {
196 return m_boundingBoxCanvasIndex;
204 wxString m_RequestConfigBase;
205 wxString m_MailToAddresses;
239 void OnTopChange(wxCommandEvent &event)
override;
240 void OnMovingClick(wxCommandEvent &event)
override;
241 void OnAnyChange(wxCommandEvent &event)
override;
242 void OnAnySpinChange(wxSpinEvent &event)
override {
248 HighlightArea(0, 0, 0, 0);
250 void OnTimeRangeChange(wxCommandEvent &event)
override;
251 void OnSendMaiL(wxCommandEvent &event)
override;
252 void OnOK(wxCommandEvent &event)
override;
253 void OnZoneSelectionModeChange(wxCommandEvent &event)
override;
258 void OnWorldLengthChoice(wxCommandEvent &event)
override {
event.Skip(); }
259 void OnWorldResolutionChoice(wxCommandEvent &event)
override {
event.Skip(); }
260 void OnWorldDownload(wxCommandEvent &event)
override;
261 void OnLocalTreeItemExpanded(wxTreeEvent &event)
override {
event.Skip(); }
262 void OnLocalTreeSelChanged(wxTreeEvent &event)
override;
263 void OnUpdateLocalCatalog(wxCommandEvent &event)
override;
265 void OnXyGribDownloadButton(wxCommandEvent &event)
override;
269 void OnDownloadLocal(wxCommandEvent &event)
override;
270 void OnCoordinatesChange(wxSpinEvent &event)
override;
271 void SaveConfig()
override;
274 void HighlightArea(
double latmax,
double lonmax,
double latmin,
276 void ReadLocalCatalog();
278 void ApplyRequestConfig(
unsigned rs,
unsigned it,
unsigned tr);
279 wxString WriteMail();
280 int EstimateFileSize(
double *size);
282 template <
typename T>
283 static std::string FormatPerLocale(T value);
285 static wxString GetDownloadProgressText(
long bytesTransferred,
289 void InitRequestConfig();
290 void OnExit(wxCommandEvent &event) {
295 void OnMouseEventTimer(wxTimerEvent &event);
296 void SetCoordinatesText();
299 void EnableDownloadButtons();
302 void InitializeXygribDialog();
303 wxString BuildXyGribUrl();
304 wxString BuildGribFileName();
307 void ApplyXyGribConfiguration();
308 void MemorizeXyGribConfiguration();
310 void UpdateGribSizeEstimate();
313 int m_selectedAtmModelIndex;
315 int m_selectedWaveModelIndex;
317 int m_gribSizeEstimate;
324 wxTimer m_tMouseEventTimer;
325 wxTimer m_tMouseClickTimer;
326 wxMouseEvent m_SingleClickEvent;
334 double m_displayScale;
337 long m_download_handle;
338 bool m_bTransferSuccess;
340 bool m_bLocal_source_selected;
344 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.