OpenCPN Partial API docs
Loading...
Searching...
No Matches
GribSettingsDialog.h
Go to the documentation of this file.
1/***************************************************************************
2 * Copyright (C) 2014 by Sean D'Epagnier *
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 ***************************************************************************/
44#ifndef __GRIBSETTINGSDIALOG_H__
45#define __GRIBSETTINGSDIALOG_H__
46
47#include "GribUIDialogBase.h"
48
49#include "jsonval.h"
50
51//----------------------------------------------------------------------------------------------------------
52// Grib OverlaySettings Specification
53//----------------------------------------------------------------------------------------------------------
55 static wxString NameFromIndex(int index);
56
57 void Read();
58 void Write();
59 void SaveSettingGroups(wxFileConfig* pConf, int settings, int group);
60
61 wxString SettingsToJSON(wxString json);
62 bool JSONToSettings(wxString json);
63 bool UpdateJSONval(wxJSONValue& v, int settings, int group);
64
65 double CalibrationOffset(int settings);
66 double CalibrationFactor(int settings, double input, bool reverse = false);
67 double CalibrateValue(int settings, double input) {
68 return (input + CalibrationOffset(settings)) *
69 CalibrationFactor(settings, input);
70 }
71 int GetMinFromIndex(int index);
72 wxString GetAltitudeFromIndex(int index, int unit);
73 double GetmstobfFactor(double input);
74 double GetbftomsFactor(double input);
75 wxString GetUnitSymbol(int settings);
76 double GetMin(int settings);
77 double GetMax(int settings);
78 // playback options
79 bool m_bInterpolate;
80 bool m_bLoopMode;
81 int m_LoopStartPoint;
82 int m_SlicesPerUpdate;
83 int m_UpdatesPerSecond;
84 // display
85 int m_iOverlayTransparency;
86 // gui
87 int m_iCtrlandDataStyle;
88 wxString m_iCtrlBarCtrlVisible[2];
89
90 enum SettingsType {
91 WIND,
92 WIND_GUST,
93 PRESSURE,
94 WAVE,
95 CURRENT,
96 PRECIPITATION,
97 CLOUD,
98 AIR_TEMPERATURE,
99 SEA_TEMPERATURE,
100 CAPE,
101 COMP_REFL,
102 GEO_ALTITUDE,
103 REL_HUMIDITY,
104 SETTINGS_COUNT
105 };
106 enum Units0 { KNOTS, M_S, MPH, KPH, BFS };
107 enum Units1 { MILLIBARS, MMHG, INHG };
108 enum Units2 { METERS, FEET };
109 enum Units3 { CELCIUS, FAHRENHEIT };
110 enum Units4 { MILLIMETERS, INCHES };
111 enum Units5 { PERCENTAGE };
112 enum Units6 { JPKG };
113 enum Units7 { DBZ };
114
116 int m_Units;
117 bool m_bBarbedArrows;
118 bool m_iBarbedVisibility;
119 int m_iBarbedColour;
120 bool m_bBarbArrFixSpac;
121 int m_iBarbArrSpacing;
122 bool m_bIsoBars;
123 bool m_bAbbrIsoBarsNumbers;
124 bool m_iIsoBarVisibility;
125 double m_iIsoBarSpacing;
126 bool m_bDirectionArrows;
127 int m_iDirectionArrowForm;
128 bool m_bDirArrFixSpac;
129 int m_iDirectionArrowSize;
130 int m_iDirArrSpacing;
131 bool m_bOverlayMap;
132 int m_iOverlayMapColors;
133 bool m_bNumbers;
134 bool m_bNumFixSpac;
135 int m_iNumbersSpacing;
136 bool m_bParticles;
137 double m_dParticleDensity;
138
139 } Settings[SETTINGS_COUNT];
140};
141
142class GRIBUICtrlBar;
143
145public:
147 int& lastdatatype, int fileIntervalIndex);
148 void WriteSettings();
149
150 void SetSettingsDialogSize();
151 void SaveLastPage();
152 int GetPageIndex() { return m_SetBookpageIndex; }
153
154private:
155 void SetDataTypeSettings(int settings);
156 void ReadDataTypeSettings(int settings);
157 void PopulateUnits(int settings);
158 void ShowFittingSettings(int settings);
159 void ShowSettings(int params, bool show = true);
160 void OnDataTypeChoice(wxCommandEvent& event);
161 void OnUnitChange(wxCommandEvent& event);
162 void OnTransparencyChange(wxScrollEvent& event);
163 void OnApply(wxCommandEvent& event);
164 void OnIntepolateChange(wxCommandEvent& event);
165 void OnSpacingModeChange(wxCommandEvent& event);
166 void OnPageChange(wxNotebookEvent& event);
167 void OnCtrlandDataStyleChanged(wxCommandEvent& event);
168
169 GRIBUICtrlBar& m_parent;
170
171 GribOverlaySettings m_Settings, &m_extSettings;
172 int& m_lastdatatype;
173 int m_SetBookpageIndex;
174};
175
176#endif
Base User Interface Components for GRIB Plugin.
Class GribSettingsDialogBase.
The JSON value class implementation.
Definition jsonval.h:84