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();
220 void TimelineChanged();
221 void CreateActiveFileFromNames(
const wxArrayString &filenames);
222 void PopulateComboDataList();
223 void ComputeBestForecastForNow();
228 void SetDataBackGroundColor();
229 void SetTimeLineMax(
bool SetValue);
230 void SetCursorLatLon(
double lat,
double lon);
243 void SetDialogsStyleSizePosition(
bool force_recompute =
false);
246 void OnMouseEvent(wxMouseEvent &event);
247 GRIBUICData *GetCDataDialog() {
return m_gGRIBUICData; }
248 bool InDataPlot(
int id) {
249 return id > wxID_ANY &&
id < (int)GribOverlaySettings::GEO_ALTITUDE;
251 void SetScaledBitmap(
double factor);
252 void OpenFileFromJSON(wxString json);
255 double getTimeInterpolatedValue(
int idx,
double lon,
double lat,
257 bool getTimeInterpolatedValues(
double &M,
double &A,
int idx1,
int idx2,
258 double lon,
double lat, wxDateTime t);
273 bool m_bDataPlot[GribOverlaySettings::GEO_ALTITUDE];
276 int m_ZoneSelAllowed;
277 int m_old_DialogStyle;
278 void DoZoomToCenter();
279 const wxString GetGribDir() {
282 ->Append(wxFileName::GetPathSeparator())
289 this, &dir_spec, _(
"Choose GRIB File Directory"),
m_grib_dir);
291 if (response == wxID_OK) {
316 bool ProjectionEnabled() {
317 if (m_ProjectBoatPanel)
318 return m_ProjectBoatPanel->ProjectionEnabled();
322 double m_highlight_latmax;
323 double m_highlight_lonmax;
324 double m_highlight_latmin;
325 double m_highlight_lonmin;
332 void OnClose(wxCloseEvent &event);
333 void OnSize(wxSizeEvent &event);
334 void OnPaint(wxPaintEvent &event);
335 void OnSettings(wxCommandEvent &event);
336 void OnPlayStop(wxCommandEvent &event);
337 void OnPlayStopTimer(wxTimerEvent &event);
338 void OnMove(wxMoveEvent &event);
339 void OnMenuEvent(wxMenuEvent &event);
340 void MenuAppend(wxMenu *menu,
int id, wxString label, wxItemKind kind,
341 wxBitmap bitmap = wxNullBitmap, wxMenu *submenu =
nullptr);
342 void OnZoomToCenterClick(wxCommandEvent &event);
343 void OnPrev(wxCommandEvent &event);
344 void OnRecordForecast(wxCommandEvent &event) {
346 m_InterpolateMode =
false;
350 void OnNext(wxCommandEvent &event);
351 void OnNow(wxCommandEvent &event) {
353 ComputeBestForecastForNow();
355 void OnAltitude(wxCommandEvent &event);
356 void OnOpenFile(wxCommandEvent &event);
358 void OnRequestForecastData(wxCommandEvent &event);
359 void createRequestDialog();
360 void OnCompositeDialog(wxCommandEvent &event);
362 void OnTimeline(wxScrollEvent &event);
363 void OnShowCursorData(wxCommandEvent &event);
365 wxDateTime MinTime();
366 wxArrayString GetFilesInDirectory();
368 int GetNearestIndex(wxDateTime time,
int model);
369 int GetNearestValue(wxDateTime time,
int model);
371 double *latmax,
double *lonmin,
double *lonmax);
373 void RestaureSelectionString();
374 void SaveSelectionString() {
375 m_SelectionIsSaved =
true;
376 m_Selection_index = m_cRecordForecast->GetSelection();
377 m_Selection_label = m_cRecordForecast->GetString(m_Selection_index);
389 int m_FileIntervalIndex;
390 bool m_InterpolateMode;
394 bool m_SelectionIsSaved;
395 int m_Selection_index;
396 wxString m_Selection_label;
397 wxSize m_DialogsOffset;
398 double m_projected_lat;
399 double m_projected_lon;
435 GRIBFile(
const wxArrayString &file_names,
bool CumRec,
bool WaveRec,
436 bool newestFile =
false);
443 bool IsOK(
void) {
return m_bOK; }
460 return &m_GribRecordSetArray;
473 const unsigned int GetCounter() {
return m_counter; }
475 WX_DEFINE_ARRAY_INT(
int, GribIdxArray);
476 GribIdxArray m_GribIdxArray;
479 static unsigned int ID;
481 const unsigned int m_counter;
483 wxString m_last_message;
484 wxArrayString m_FileNames;
486 time_t m_pRefDateTime;
489 ArrayOfGribRecordSets m_GribRecordSetArray;
507 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)
Returns the reference datetime of the GRIB data, as the number of seconds since the epoch.
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.
wxDateTime TimelineTime()
Returns the selected time in the GRIB timeline widget.
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.