SedSat3 1.1.6
Sediment Source Apportionment Tool - Advanced statistical methods for environmental pollution research
Loading...
Searching...
No Matches
interface.h
Go to the documentation of this file.
1// SedSAT3 – Sediment Source Assessment Tool, version 3
2// U.S. Geological Survey. See LICENSE.md and DISCLAIMER.md in the repository root.
3
4#ifndef INTERFACE_H
5#define INTERFACE_H
6
7#include <string>
8#include <QStringList>
9#include <qjsonobject.h>
10#include <qtablewidget.h>
11#include "parameter.h"
12
13class QFile;
14
24
33struct options
34{
35 bool single_column_x = false;
36 QString X_suffix = "x-value";
37 QString Y_suffix = "y-value";
38};
39
68{
69public:
79 Interface();
80
88 Interface(const Interface &intf);
89
98
109 virtual string ToString() const;
110
121 virtual QJsonObject toJsonObject() const;
122
133 virtual bool ReadFromJsonObject(const QJsonObject &jsonobject);
134
146 virtual bool writetofile(QFile* file);
147
158 virtual bool Read(const QStringList &strlist);
159
171 virtual QTableWidget *ToTable();
172
180 string GetNotes() const {
181 return Notes;
182 }
183
188 void SetNotes(const string &note) {
189 Notes = note;
190 }
191
199 void AppendtoNotes(const string &note)
200 {
201 if (Notes == "")
202 Notes += note;
203 else
204 Notes += "; " + note;
205 }
206
210 void ClearNotes() {
211 Notes = "";
212 }
213
214 double lowlimit{};
215 double highlimit{};
216
225
236 void SetLimit(_range lowhigh, const double &value)
237 {
238 if (lowhigh == _range::high)
239 highlimit = value;
240 else
241 lowlimit = value;
243 }
244
253 void SetOption(options_key opt, bool val)
254 {
256 Options.single_column_x = val;
257 }
258
265 {
267 return Options.single_column_x;
268 return false;
269 }
270
279 {
280 return Options;
281 }
282
290 QString XAxisLabel() const {
291 return XAxis_Label;
292 }
293
301 QString YAxisLabel() const {
302 return YAxis_Label;
303 }
304
310 bool SetXAxisLabel(const QString &label) {
311 XAxis_Label = label;
312 return true;
313 }
314
320 bool SetYAxisLabel(const QString &label)
321 {
322 YAxis_Label = label;
323 return true;
324 }
325
326private:
333 string Notes;
334
342
349 QString XAxis_Label = "Sample";
350
357 QString YAxis_Label = "Value";
358};
359
360#endif // INTERFACE_H
string GetNotes() const
Get the notes/annotations associated with this object.
Definition interface.h:180
Interface(const Interface &intf)
Copy constructor.
double lowlimit
Lower threshold for value highlighting (when enabled).
Definition interface.h:214
void SetNotes(const string &note)
Set the notes for this object, replacing any existing notes.
Definition interface.h:188
QString XAxis_Label
Label for the X-axis in plots and table headers.
Definition interface.h:349
options Options
Configuration options for serialization and display.
Definition interface.h:341
Interface()
Default constructor.
Definition interface.cpp:6
Interface & operator=(const Interface &intf)
Assignment operator.
virtual bool ReadFromJsonObject(const QJsonObject &jsonobject)
Deserialize object from JSON format.
Definition interface.cpp:27
options & GetOptions()
Get reference to the options structure.
Definition interface.h:278
void SetOption(options_key opt, bool val)
Set a configuration option.
Definition interface.h:253
virtual string ToString() const
Convert object to string representation.
Definition interface.cpp:17
QString XAxisLabel() const
Get the X-axis label.
Definition interface.h:290
virtual QTableWidget * ToTable()
Create a Qt table widget representation of the data.
Definition interface.cpp:43
bool SetXAxisLabel(const QString &label)
Set the X-axis label.
Definition interface.h:310
string Notes
Textual annotations and metadata about the data.
Definition interface.h:333
void SetLimit(_range lowhigh, const double &value)
Set upper or lower limit for value highlighting.
Definition interface.h:236
virtual bool writetofile(QFile *file)
Write object data to a file.
Definition interface.cpp:33
virtual QJsonObject toJsonObject() const
Serialize object to JSON format.
Definition interface.cpp:22
QString YAxisLabel() const
Get the Y-axis label.
Definition interface.h:301
void AppendtoNotes(const string &note)
Append a note to existing notes.
Definition interface.h:199
bool highlightoutsideoflimit
Flag indicating whether to highlight values outside defined limits.
Definition interface.h:224
QString YAxis_Label
Label for the Y-axis in plots and table headers.
Definition interface.h:357
virtual bool Read(const QStringList &strlist)
Parse object data from a string list.
Definition interface.cpp:38
void ClearNotes()
Clear all notes associated with this object.
Definition interface.h:210
bool Option(options_key opt)
Get the current value of a configuration option.
Definition interface.h:264
bool SetYAxisLabel(const QString &label)
Set the Y-axis label.
Definition interface.h:320
double highlimit
Upper threshold for value highlighting (when enabled).
Definition interface.h:215
options_key
Configuration option identifiers for Interface-derived classes.
Definition interface.h:21
@ single_column_x
Enable single-column mode for X-axis data representation.
Definition interface.h:22
_range
Enumeration for specifying parameter range bounds.
Definition parameter.h:16
@ high
Upper bound of the parameter range.
Definition parameter.h:18
Configuration options for data presentation and serialization.
Definition interface.h:34
QString X_suffix
Suffix appended to X-axis field names in serialization.
Definition interface.h:36
bool single_column_x
If true, X values are stored in a single column during serialization.
Definition interface.h:35
QString Y_suffix
Suffix appended to Y-axis field names in serialization.
Definition interface.h:37