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#ifndef INTERFACE_H
2#define INTERFACE_H
3
4#include <string>
5#include <QStringList>
6#include <qjsonobject.h>
7#include <qtablewidget.h>
8#include "parameter.h"
9
10class QFile;
11
18enum class options_key {
20};
21
30struct options
31{
32 bool single_column_x = false;
33 QString X_suffix = "x-value";
34 QString Y_suffix = "y-value";
35};
36
65{
66public:
76 Interface();
77
85 Interface(const Interface &intf);
86
94 Interface& operator=(const Interface &intf);
95
106 virtual string ToString() const;
107
118 virtual QJsonObject toJsonObject() const;
119
130 virtual bool ReadFromJsonObject(const QJsonObject &jsonobject);
131
143 virtual bool writetofile(QFile* file);
144
155 virtual bool Read(const QStringList &strlist);
156
168 virtual QTableWidget *ToTable();
169
177 string GetNotes() const {
178 return Notes;
179 }
180
185 void SetNotes(const string &note) {
186 Notes = note;
187 }
188
196 void AppendtoNotes(const string &note)
197 {
198 if (Notes == "")
199 Notes += note;
200 else
201 Notes += "; " + note;
202 }
203
207 void ClearNotes() {
208 Notes = "";
209 }
210
211 double lowlimit;
212 double highlimit;
213
222
233 void SetLimit(_range lowhigh, const double &value)
234 {
235 if (lowhigh == _range::high)
236 highlimit = value;
237 else
238 lowlimit = value;
240 }
241
250 void SetOption(options_key opt, bool val)
251 {
254 }
255
262 {
265 return false;
266 }
267
276 {
277 return Options;
278 }
279
287 QString XAxisLabel() const {
288 return XAxis_Label;
289 }
290
298 QString YAxisLabel() const {
299 return YAxis_Label;
300 }
301
307 bool SetXAxisLabel(const QString &label) {
308 XAxis_Label = label;
309 return true;
310 }
311
317 bool SetYAxisLabel(const QString &label)
318 {
319 YAxis_Label = label;
320 return true;
321 }
322
323private:
330 string Notes;
331
339
346 QString XAxis_Label = "Sample";
347
354 QString YAxis_Label = "Value";
355};
356
357#endif // INTERFACE_H
Abstract base class providing common serialization and visualization interface.
Definition interface.h:65
string GetNotes() const
Get the notes/annotations associated with this object.
Definition interface.h:177
double lowlimit
Lower threshold for value highlighting (when enabled)
Definition interface.h:211
void SetNotes(const string &note)
Set the notes for this object, replacing any existing notes.
Definition interface.h:185
QString XAxis_Label
Label for the X-axis in plots and table headers.
Definition interface.h:346
options Options
Configuration options for serialization and display.
Definition interface.h:338
Interface()
Default constructor.
Definition interface.cpp:3
Interface & operator=(const Interface &intf)
Assignment operator.
Definition interface.cpp:14
virtual bool ReadFromJsonObject(const QJsonObject &jsonobject)
Deserialize object from JSON format.
Definition interface.cpp:32
options & GetOptions()
Get reference to the options structure.
Definition interface.h:275
void SetOption(options_key opt, bool val)
Set a configuration option.
Definition interface.h:250
virtual string ToString() const
Convert object to string representation.
Definition interface.cpp:22
QString XAxisLabel() const
Get the X-axis label.
Definition interface.h:287
virtual QTableWidget * ToTable()
Create a Qt table widget representation of the data.
Definition interface.cpp:48
bool SetXAxisLabel(const QString &label)
Set the X-axis label.
Definition interface.h:307
string Notes
Textual annotations and metadata about the data.
Definition interface.h:330
void SetLimit(_range lowhigh, const double &value)
Set upper or lower limit for value highlighting.
Definition interface.h:233
virtual bool writetofile(QFile *file)
Write object data to a file.
Definition interface.cpp:38
virtual QJsonObject toJsonObject() const
Serialize object to JSON format.
Definition interface.cpp:27
QString YAxisLabel() const
Get the Y-axis label.
Definition interface.h:298
void AppendtoNotes(const string &note)
Append a note to existing notes.
Definition interface.h:196
bool highlightoutsideoflimit
Flag indicating whether to highlight values outside defined limits.
Definition interface.h:221
QString YAxis_Label
Label for the Y-axis in plots and table headers.
Definition interface.h:354
virtual bool Read(const QStringList &strlist)
Parse object data from a string list.
Definition interface.cpp:43
void ClearNotes()
Clear all notes associated with this object.
Definition interface.h:207
bool Option(options_key opt)
Get the current value of a configuration option.
Definition interface.h:261
bool SetYAxisLabel(const QString &label)
Set the Y-axis label.
Definition interface.h:317
double highlimit
Upper threshold for value highlighting (when enabled)
Definition interface.h:212
options_key
Configuration option identifiers for Interface-derived classes.
Definition interface.h:18
@ single_column_x
Enable single-column mode for X-axis data representation.
_range
Enumeration for specifying parameter range bounds.
Definition parameter.h:13
@ high
Upper bound of the parameter range.
Configuration options for data presentation and serialization.
Definition interface.h:31
QString X_suffix
Suffix appended to X-axis field names in serialization.
Definition interface.h:33
bool single_column_x
If true, X values are stored in a single column during serialization.
Definition interface.h:32
QString Y_suffix
Suffix appended to Y-axis field names in serialization.
Definition interface.h:34