SedSat3 1.1.6
Sediment Source Apportionment Tool - Advanced statistical methods for environmental pollution research
Loading...
Searching...
No Matches
Interface Class Reference

Abstract base class providing common serialization and visualization interface. More...

#include <interface.h>

Inheritance diagram for Interface:
Inheritance graph
Collaboration diagram for Interface:
Collaboration graph

Public Member Functions

 Interface ()
 Default constructor.
 
 Interface (const Interface &intf)
 Copy constructor.
 
Interfaceoperator= (const Interface &intf)
 Assignment operator.
 
virtual string ToString () const
 Convert object to string representation.
 
virtual QJsonObject toJsonObject () const
 Serialize object to JSON format.
 
virtual bool ReadFromJsonObject (const QJsonObject &jsonobject)
 Deserialize object from JSON format.
 
virtual bool writetofile (QFile *file)
 Write object data to a file.
 
virtual bool Read (const QStringList &strlist)
 Parse object data from a string list.
 
virtual QTableWidget * ToTable ()
 Create a Qt table widget representation of the data.
 
string GetNotes () const
 Get the notes/annotations associated with this object.
 
void SetNotes (const string &note)
 Set the notes for this object, replacing any existing notes.
 
void AppendtoNotes (const string &note)
 Append a note to existing notes.
 
void ClearNotes ()
 Clear all notes associated with this object.
 
void SetLimit (_range lowhigh, const double &value)
 Set upper or lower limit for value highlighting.
 
void SetOption (options_key opt, bool val)
 Set a configuration option.
 
bool Option (options_key opt)
 Get the current value of a configuration option.
 
optionsGetOptions ()
 Get reference to the options structure.
 
QString XAxisLabel () const
 Get the X-axis label.
 
QString YAxisLabel () const
 Get the Y-axis label.
 
bool SetXAxisLabel (const QString &label)
 Set the X-axis label.
 
bool SetYAxisLabel (const QString &label)
 Set the Y-axis label.
 

Public Attributes

double lowlimit
 Lower threshold for value highlighting (when enabled)
 
double highlimit
 Upper threshold for value highlighting (when enabled)
 
bool highlightoutsideoflimit = false
 Flag indicating whether to highlight values outside defined limits.
 

Private Attributes

string Notes
 Textual annotations and metadata about the data.
 
options Options
 Configuration options for serialization and display.
 
QString XAxis_Label = "Sample"
 Label for the X-axis in plots and table headers.
 
QString YAxis_Label = "Value"
 Label for the Y-axis in plots and table headers.
 

Detailed Description

Abstract base class providing common serialization and visualization interface.

Interface serves as an abstract base class for data structures that need to be:

  • Serialized to/from various formats (JSON, strings, files)
  • Displayed in Qt table widgets
  • Annotated with metadata (notes, axis labels)
  • Configured with display options (highlighting, limits)

This class provides a unified interface for data handling across the application, ensuring consistent behavior for file I/O, JSON serialization, and Qt integration.

Derived classes must implement the virtual methods to provide specific serialization and visualization behavior appropriate to their data structure.

Note
This is an abstract base class. Concrete implementations include:
See also
Elemental_Profile
Elemental_Profile_Set
CMBVector
CMBMatrix
Examples
/home/runner/work/SedSat3/SedSat3/src/elemental_profile.cpp.

Definition at line 64 of file interface.h.

Constructor & Destructor Documentation

◆ Interface() [1/2]

Interface::Interface ( )

Default constructor.

Initializes an Interface object with default settings:

  • Empty notes
  • Default axis labels ("Sample", "Value")
  • Highlight limits disabled
  • Default serialization options

Definition at line 3 of file interface.cpp.

◆ Interface() [2/2]

Interface::Interface ( const Interface intf)

Copy constructor.

Parameters
intfThe Interface object to copy from

Creates a deep copy of another Interface object, including all configuration options, axis labels, notes, and limit settings.

Definition at line 8 of file interface.cpp.

References Options, XAxis_Label, and YAxis_Label.

Member Function Documentation

◆ AppendtoNotes()

void Interface::AppendtoNotes ( const string note)
inline

Append a note to existing notes.

Parameters
noteThe note text to append

If notes are empty, sets the note directly. Otherwise, appends with semicolon separator ("; ") for readability.

Definition at line 196 of file interface.h.

References Notes.

Referenced by Elemental_Profile_Set::DetectOutliers().

◆ ClearNotes()

void Interface::ClearNotes ( )
inline

Clear all notes associated with this object.

Definition at line 207 of file interface.h.

References Notes.

◆ GetNotes()

string Interface::GetNotes ( ) const
inline

Get the notes/annotations associated with this object.

Returns
String containing all notes, semicolon-separated if multiple

Notes are used to store warnings, outlier information, QA/QC flags, or other metadata about the data.

Definition at line 177 of file interface.h.

References Notes.

Referenced by SelectSampleTableModel::data().

◆ GetOptions()

options & Interface::GetOptions ( )
inline

Get reference to the options structure.

Returns
Reference to the internal options object

Provides direct access to all configuration options for batch modification or inspection.

Definition at line 275 of file interface.h.

References Options.

Referenced by Conductor::ExecuteLevenbergMarquardtBatch(), Conductor::ExecuteSourceVerify(), Results::ReadFromJson(), and CMBTimeSeriesSet::ToTable().

◆ operator=()

Interface & Interface::operator= ( const Interface intf)

◆ Option()

bool Interface::Option ( options_key  opt)
inline

Get the current value of a configuration option.

Parameters
optThe option identifier to query
Returns
The current boolean value of the option, false if option not recognized

Definition at line 261 of file interface.h.

References Options, single_column_x, and options::single_column_x.

Referenced by CMBTimeSeriesSet::ToTable().

◆ Read()

bool Interface::Read ( const QStringList &  strlist)
virtual

Parse object data from a string list.

Parameters
strlistList of strings containing the data to parse
Returns
true if parsing was successful, false otherwise

Pure virtual method for text-based deserialization. Each string in the list typically represents one line of input data.

Note
Format and parsing rules are determined by the derived class

Reimplemented in Elemental_Profile, Contribution, Elemental_Profile_Set, Range, and RangeSet.

Definition at line 43 of file interface.cpp.

◆ ReadFromJsonObject()

bool Interface::ReadFromJsonObject ( const QJsonObject &  jsonobject)
virtual

Deserialize object from JSON format.

Parameters
jsonobjectThe JSON object to read from
Returns
true if deserialization was successful, false otherwise

Pure virtual method for JSON deserialization. Derived classes must implement this to reconstruct their data structure from a JSON object.

Warning
Implementations should validate JSON structure and handle missing fields gracefully

Reimplemented in Elemental_Profile, CMBMatrix, CMBTimeSeries, CMBTimeSeriesSet, CMBVector, CMBVectorSet, CMBVectorSetSet, Contribution, Elemental_Profile_Set, MultipleLinearRegression, MultipleLinearRegressionSet, Range, and RangeSet.

Definition at line 32 of file interface.cpp.

◆ SetLimit()

void Interface::SetLimit ( _range  lowhigh,
const double &  value 
)
inline

Set upper or lower limit for value highlighting.

Parameters
lowhighSpecifies whether setting high or low limit
valueThe threshold value

Sets the specified limit and automatically enables highlighting. Values outside [lowlimit, highlimit] will be highlighted when displayed.

See also
highlightoutsideoflimit

Definition at line 233 of file interface.h.

References high, highlightoutsideoflimit, highlimit, and lowlimit.

Referenced by Conductor::ExecuteANOVA(), Conductor::ExecuteCorrelationMatrix(), Conductor::ExecuteEDP(), Conductor::ExecuteEDPM(), Conductor::ExecuteOutlierAnalysis(), and Results::ReadFromJson().

◆ SetNotes()

void Interface::SetNotes ( const string note)
inline

Set the notes for this object, replacing any existing notes.

Parameters
noteThe new note text

Definition at line 185 of file interface.h.

References Notes.

◆ SetOption()

void Interface::SetOption ( options_key  opt,
bool  val 
)
inline

Set a configuration option.

Parameters
optThe option identifier to set
valThe boolean value to set

Currently supports:

Definition at line 250 of file interface.h.

References Options, single_column_x, and options::single_column_x.

Referenced by Conductor::ExecuteLevenbergMarquardtBatch(), Conductor::ExecuteSourceVerify(), and Results::ReadFromJson().

◆ SetXAxisLabel()

bool Interface::SetXAxisLabel ( const QString &  label)
inline

Set the X-axis label.

Parameters
labelThe new X-axis label
Returns
true (always succeeds)
Examples
/home/runner/work/SedSat3/SedSat3/src/elemental_profile.cpp.

Definition at line 307 of file interface.h.

References XAxis_Label.

Referenced by Elemental_Profile::ReadFromJsonObject(), CMBVector::ReadFromJsonObject(), and ResultItem::setXAxisTitle().

◆ SetYAxisLabel()

bool Interface::SetYAxisLabel ( const QString &  label)
inline

Set the Y-axis label.

Parameters
labelThe new Y-axis label
Returns
true (always succeeds)
Examples
/home/runner/work/SedSat3/SedSat3/src/elemental_profile.cpp.

Definition at line 317 of file interface.h.

References YAxis_Label.

Referenced by Elemental_Profile::ReadFromJsonObject(), and ResultItem::setYAxisTitle().

◆ toJsonObject()

QJsonObject Interface::toJsonObject ( ) const
virtual

Serialize object to JSON format.

Returns
QJsonObject containing the serialized data

Pure virtual method for JSON serialization. Derived classes must implement this to convert their data structure to a JSON object suitable for saving to .json files or transmitting over network.

Note
The JSON structure is determined by the derived class

Reimplemented in CMBMatrix, CMBTimeSeries, CMBTimeSeriesSet, CMBVector, CMBVectorSet, CMBVectorSetSet, Contribution, Elemental_Profile, Elemental_Profile_Set, MultipleLinearRegression, MultipleLinearRegressionSet, Range, and RangeSet.

Definition at line 27 of file interface.cpp.

Referenced by Results::toJsonObject().

◆ ToString()

string Interface::ToString ( ) const
virtual

Convert object to string representation.

Returns
String representation of the object's data

Pure virtual method that must be implemented by derived classes to provide a human-readable string representation of their data. Typically used for text file export or debugging.

Note
Format is determined by the derived class implementation

Reimplemented in CMBMatrix, CMBTimeSeries, CMBTimeSeriesSet, CMBVector, CMBVectorSet, CMBVectorSetSet, Contribution, Elemental_Profile, Elemental_Profile_Set, MultipleLinearRegression, MultipleLinearRegressionSet, Range, and RangeSet.

Definition at line 22 of file interface.cpp.

Referenced by ResultsWindow::AppendResult().

◆ ToTable()

QTableWidget * Interface::ToTable ( )
virtual

Create a Qt table widget representation of the data.

Returns
Pointer to a newly allocated QTableWidget displaying the data

Pure virtual method that creates a visual table representation of the object's data suitable for display in the Qt GUI. The returned widget is dynamically allocated and should be managed by Qt's parent-child ownership system.

Note
Caller does not need to delete the returned widget if added to a parent
Highlighting based on limit settings is applied if enabled

Reimplemented in CMBMatrix, CMBTimeSeries, CMBTimeSeriesSet, CMBVector, CMBVectorSet, CMBVectorSetSet, Contribution, Elemental_Profile, Elemental_Profile_Set, MultipleLinearRegressionSet, and RangeSet.

Definition at line 48 of file interface.cpp.

◆ writetofile()

bool Interface::writetofile ( QFile *  file)
virtual

Write object data to a file.

Parameters
filePointer to an open QFile object for writing
Returns
true if write was successful, false otherwise

Pure virtual method for file output. Derived classes implement this to write their data to an open file stream in their preferred text format.

Precondition
file must be opened in write mode
Note
File is not closed by this method

Reimplemented in CMBTimeSeries, CMBTimeSeriesSet, Contribution, Range, RangeSet, CMBMatrix, CMBVector, CMBVectorSet, CMBVectorSetSet, Elemental_Profile, and Elemental_Profile_Set.

Definition at line 38 of file interface.cpp.

◆ XAxisLabel()

QString Interface::XAxisLabel ( ) const
inline

Get the X-axis label.

Returns
The current X-axis label string

X-axis labels are used in plots and table headers to identify the independent variable or sample identifier.

Examples
/home/runner/work/SedSat3/SedSat3/src/elemental_profile.cpp.

Definition at line 287 of file interface.h.

References XAxis_Label.

Referenced by CMBVector::toJsonObject(), Elemental_Profile::toJsonObject(), CMBVector::ToString(), and ResultItem::XAxisTitle().

◆ YAxisLabel()

QString Interface::YAxisLabel ( ) const
inline

Get the Y-axis label.

Returns
The current Y-axis label string

Y-axis labels are used in plots and table headers to identify the dependent variable or measurement type (e.g., "Concentration (mg/kg)").

Examples
/home/runner/work/SedSat3/SedSat3/src/elemental_profile.cpp.

Definition at line 298 of file interface.h.

References YAxis_Label.

Referenced by CMBVector::toJsonObject(), Elemental_Profile::toJsonObject(), CMBVector::ToString(), CMBVector::ToTable(), Elemental_Profile::ToTable(), and ResultItem::YAxisTitle().

Member Data Documentation

◆ highlightoutsideoflimit

bool Interface::highlightoutsideoflimit = false

Flag indicating whether to highlight values outside defined limits.

When true, the ToTable() method will highlight cells with values outside the range [lowlimit, highlimit] in red, useful for identifying outliers or quality control issues.

Examples
/home/runner/work/SedSat3/SedSat3/src/elemental_profile.cpp.

Definition at line 221 of file interface.h.

Referenced by CMBMatrix::CMBMatrix(), CMBVector::CMBVector(), CMBMatrix::operator=(), CMBVector::operator=(), SetLimit(), CMBMatrix::ToTable(), CMBTimeSeries::ToTable(), CMBVector::ToTable(), Elemental_Profile::ToTable(), and Elemental_Profile_Set::ToTable().

◆ highlimit

◆ lowlimit

◆ Notes

string Interface::Notes
private

Textual annotations and metadata about the data.

Stores semicolon-separated notes such as outlier warnings, QA/QC flags, or processing history. Can be displayed to users or included in reports.

Definition at line 330 of file interface.h.

Referenced by AppendtoNotes(), ClearNotes(), GetNotes(), and SetNotes().

◆ Options

options Interface::Options
private

Configuration options for serialization and display.

Contains settings that control how data is formatted during export and how it should be interpreted during import.

Definition at line 338 of file interface.h.

Referenced by Interface(), GetOptions(), operator=(), Option(), and SetOption().

◆ XAxis_Label

QString Interface::XAxis_Label = "Sample"
private

Label for the X-axis in plots and table headers.

Default is "Sample" but can be customized to reflect the actual independent variable (e.g., "Time", "Distance", "Sample ID").

Definition at line 346 of file interface.h.

Referenced by Interface(), operator=(), SetXAxisLabel(), and XAxisLabel().

◆ YAxis_Label

QString Interface::YAxis_Label = "Value"
private

Label for the Y-axis in plots and table headers.

Default is "Value" but should be customized to reflect the measurement type and units (e.g., "Lead Concentration (mg/kg)", "δ15N (‰)").

Definition at line 354 of file interface.h.

Referenced by Interface(), operator=(), SetYAxisLabel(), and YAxisLabel().


The documentation for this class was generated from the following files: