39#ifndef __GRIBUICTRLBAR_H__
40#define __GRIBUICTRLBAR_H__
47#include <wx/fileconf.h>
48#include <wx/glcanvas.h>
60#define PI 3.1415926535897931160E0
76class wxGraphicsContext;
163 void ClearCachedData();
182 GRIBUICtrlBar(wxWindow *parent, wxWindowID
id,
const wxString &title,
183 const wxPoint &pos,
const wxSize &size,
long style,
184 grib_pi *ppi,
double scale_factor);
187 void OpenFile(
bool newestFile =
false);
189 void ContextMenuItemCallback(
int id);
190 void SetFactoryOptions();
192 wxDateTime TimelineTime();
219 void TimelineChanged();
220 void CreateActiveFileFromNames(
const wxArrayString &filenames);
221 void PopulateComboDataList();
222 void ComputeBestForecastForNow();
227 void SetDataBackGroundColor();
228 void SetTimeLineMax(
bool SetValue);
229 void SetCursorLatLon(
double lat,
double lon);
242 void SetDialogsStyleSizePosition(
bool force_recompute =
false);
245 void OnMouseEvent(wxMouseEvent &event);
246 GRIBUICData *GetCDataDialog() {
return m_gGRIBUICData; }
247 bool InDataPlot(
int id) {
248 return id > wxID_ANY &&
id < (int)GribOverlaySettings::GEO_ALTITUDE;
250 void SetScaledBitmap(
double factor);
251 void OpenFileFromJSON(wxString json);
254 double getTimeInterpolatedValue(
int idx,
double lon,
double lat,
256 bool getTimeInterpolatedValues(
double &M,
double &A,
int idx1,
int idx2,
257 double lon,
double lat, wxDateTime t);
272 bool m_bDataPlot[GribOverlaySettings::GEO_ALTITUDE];
275 int m_ZoneSelAllowed;
276 int m_old_DialogStyle;
277 void DoZoomToCenter();
278 const wxString GetGribDir() {
281 ->Append(wxFileName::GetPathSeparator())
288 this, &dir_spec, _(
"Choose GRIB File Directory"),
m_grib_dir);
290 if (response == wxID_OK) {
315 bool ProjectionEnabled() {
316 if (m_ProjectBoatPanel)
317 return m_ProjectBoatPanel->ProjectionEnabled();
321 double m_highlight_latmax;
322 double m_highlight_lonmax;
323 double m_highlight_latmin;
324 double m_highlight_lonmin;
331 void OnClose(wxCloseEvent &event);
332 void OnSize(wxSizeEvent &event);
333 void OnPaint(wxPaintEvent &event);
334 void OnSettings(wxCommandEvent &event);
335 void OnPlayStop(wxCommandEvent &event);
336 void OnPlayStopTimer(wxTimerEvent &event);
337 void OnMove(wxMoveEvent &event);
338 void OnMenuEvent(wxMenuEvent &event);
339 void MenuAppend(wxMenu *menu,
int id, wxString label, wxItemKind kind,
340 wxBitmap bitmap = wxNullBitmap, wxMenu *submenu =
nullptr);
341 void OnZoomToCenterClick(wxCommandEvent &event);
342 void OnPrev(wxCommandEvent &event);
343 void OnRecordForecast(wxCommandEvent &event) {
345 m_InterpolateMode =
false;
349 void OnNext(wxCommandEvent &event);
350 void OnNow(wxCommandEvent &event) {
352 ComputeBestForecastForNow();
354 void OnAltitude(wxCommandEvent &event);
355 void OnOpenFile(wxCommandEvent &event);
357 void OnRequestForecastData(wxCommandEvent &event);
358 void createRequestDialog();
359 void OnCompositeDialog(wxCommandEvent &event);
361 void OnTimeline(wxScrollEvent &event);
362 void OnShowCursorData(wxCommandEvent &event);
364 wxDateTime MinTime();
365 wxArrayString GetFilesInDirectory();
367 int GetNearestIndex(wxDateTime time,
int model);
368 int GetNearestValue(wxDateTime time,
int model);
370 double *latmax,
double *lonmin,
double *lonmax);
372 void RestaureSelectionString();
373 void SaveSelectionString() {
374 m_SelectionIsSaved =
true;
375 m_Selection_index = m_cRecordForecast->GetSelection();
376 m_Selection_label = m_cRecordForecast->GetString(m_Selection_index);
388 int m_FileIntervalIndex;
389 bool m_InterpolateMode;
393 bool m_SelectionIsSaved;
394 int m_Selection_index;
395 wxString m_Selection_label;
396 wxSize m_DialogsOffset;
397 double m_projected_lat;
398 double m_projected_lon;
434 GRIBFile(
const wxArrayString &file_names,
bool CumRec,
bool WaveRec,
435 bool newestFile =
false);
442 bool IsOK(
void) {
return m_bOK; }
459 return &m_GribRecordSetArray;
471 const unsigned int GetCounter() {
return m_counter; }
473 WX_DEFINE_ARRAY_INT(
int, GribIdxArray);
474 GribIdxArray m_GribIdxArray;
477 static unsigned int ID;
479 const unsigned int m_counter;
481 wxString m_last_message;
482 wxArrayString m_FileNames;
484 time_t m_pRefDateTime;
487 ArrayOfGribRecordSets m_GribRecordSetArray;
505 void OnMove(wxMoveEvent &event);
GRIB Cursor Data Tracking and Display.
GRIB Dialog Grabber Control Interface.
GRIB (GRIdded Binary) file reader and parser.
GRIB Record Set Management.
@ Idx_COUNT
Number of supported GRIB record types.
GRIB Weather Data Request and Download Management.
GRIB Display Settings Configuration Interface.
Base User Interface Components for GRIB Plugin.
ZoneSelection
Defines the possible states for GRIB area selection.
@ AUTO_SELECTION
Area automatically set from current viewport bounds.
@ DRAW_SELECTION
Manual mode has been selected.
@ START_SELECTION
User has clicked Shift + Left click and is drawing the bounding box by dragging the mouse.
@ COMPLETE_SELECTION
Selection box completed in manual mode, coordinates have been captured after the user has released th...
@ SAVED_SELECTION
Area loaded from previously saved coordinates.
GRIB Isobar and Isoline Generation System.
Tracks and displays GRIB meteorological data at cursor position.
Manages multiple GRIB record sets from one or more GRIB files.
time_t GetRefDateTime(void)
Gets reference datetime of the GRIB data.
ArrayOfGribRecordSets * GetRecordSetArrayPtr(void)
Gets pointer to array of record sets organized by timestamp.
wxArrayString & GetFileNames(void)
Gets the list of source filenames being used.
wxString GetLastMessage(void)
Gets the last error message if file loading failed.
bool IsOK(void)
Checks if file loading and parsing was successful.
Factory class for creating and managing GRIB data visualizations.
void SetViewPortWithFocus(PlugIn_ViewPort *vp)
Set the ViewPort that has the focus.
void GetProjectedLatLon(int &x, int &y, PlugIn_ViewPort *vp)
Gets the projected position of vessel based on current course, speed and forecast time.
GribOverlaySettings m_OverlaySettings
Settings that control how GRIB data is displayed and overlaid.
void SetRequestButtonBitmap(int type)
Set the icon and tooltip for the download request button.
wxTimer m_tPlayStop
Timer for controlling GRIB animation playback.
void SetViewPortUnderMouse(PlugIn_ViewPort *vp)
Set the ViewPort under the mouse.
wxString m_grib_dir
Directory containing GRIB files.
grib_pi * pPlugIn
Plugin instance that owns this control bar.
GRIBFile * m_bGRIBActiveFile
Currently active GRIB file being displayed.
void UpdateTrackingControl()
Schedules an update of the GRIB data values display at current cursor position.
GribTimelineRecordSet * m_pTimelineSet
Current set of GRIB records for timeline playback.
wxArrayString m_file_names
List of GRIB filenames being displayed.
GribTimelineRecordSet * GetTimeLineRecordSet(wxDateTime time)
Retrieves or creates a temporally interpolated GRIB record set for a specific timestamp.
Manages a collection of GribRecord objects representing multiple meteorological parameters at a singl...
Manages GRIB file request configuration and downloads.
A specialized GribRecordSet that represents temporally interpolated weather data with isobar renderin...
wxArrayPtrVoid * m_IsobarArray[Idx_COUNT]
Array of cached isobar calculations for each data type (wind, pressure, etc).
Contains view parameters and status information for a chart display viewport.
int PlatformDirSelectorDialog(wxWindow *parent, wxString *file_spec, wxString Title, wxString initDir)
Shows platform-optimized directory selector dialog.
wxString * GetpPrivateApplicationDataLocation(void)
Gets private application data directory.
Structure used to store XyGrib configuration.