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

Source contribution container for Chemical Mass Balance results. More...

#include </home/runner/work/SedSat3/SedSat3/contribution.h>

Inheritance diagram for Contribution:
Inheritance graph
Collaboration diagram for Contribution:
Collaboration graph

Public Member Functions

 Contribution ()
 Default constructor - creates an empty contribution set.
 
 Contribution (const Contribution &rhs)
 Copy constructor.
 
Contributionoperator= (const Contribution &rhs)
 Assignment operator.
 
QJsonObject toJsonObject () const override
 Serializes contributions to JSON format.
 
bool ReadFromJsonObject (const QJsonObject &jsonobject) override
 Deserializes contributions from JSON format.
 
string ToString () const override
 Converts contributions to colon-separated string format.
 
bool writetofile (QFile *) override
 Writes contributions to file.
 
bool Read (const QStringList &strlist) override
 Reads contributions from string list.
 
QTableWidget * ToTable () override
 Creates a QTableWidget for displaying contributions.
 
- Public Member Functions inherited from Interface
 Interface ()
 Default constructor.
 
 Interface (const Interface &intf)
 Copy constructor.
 
Interfaceoperator= (const Interface &intf)
 Assignment operator.
 
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.
 

Additional Inherited Members

- Public Attributes inherited from Interface
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.
 

Detailed Description

Source contribution container for Chemical Mass Balance results.

Stores source contributions as name-value pairs (map<string, double>). Provides JSON serialization, file I/O, and table widget generation. Used to represent the fractional or absolute contribution of each identified pollution source to a receptor site.

Definition at line 21 of file contribution.h.

Constructor & Destructor Documentation

◆ Contribution() [1/2]

Contribution::Contribution ( )

Default constructor - creates an empty contribution set.

Definition at line 5 of file contribution.cpp.

◆ Contribution() [2/2]

Contribution::Contribution ( const Contribution rhs)

Copy constructor.

Parameters
rhsContribution object to copy from

Definition at line 10 of file contribution.cpp.

Member Function Documentation

◆ operator=()

Contribution & Contribution::operator= ( const Contribution rhs)

Assignment operator.

Parameters
rhsContribution object to assign from
Returns
Reference to this contribution object

Definition at line 14 of file contribution.cpp.

References Interface::operator=().

◆ Read()

bool Contribution::Read ( const QStringList &  strlist)
overridevirtual

Reads contributions from string list.

Expected format: Each string is "source_name:contribution_value"

Parameters
strlistList of colon-separated source:value strings
Returns
true if successful

Reimplemented from Interface.

Definition at line 37 of file contribution.cpp.

◆ ReadFromJsonObject()

bool Contribution::ReadFromJsonObject ( const QJsonObject &  jsonobject)
overridevirtual

Deserializes contributions from JSON format.

Parameters
jsonobjectJSON object to read from
Returns
true if successful, false otherwise

Reimplemented from Interface.

Definition at line 60 of file contribution.cpp.

◆ toJsonObject()

QJsonObject Contribution::toJsonObject ( ) const
overridevirtual

Serializes contributions to JSON format.

Returns
JSON object with source names as keys and contributions as values

Reimplemented from Interface.

Definition at line 50 of file contribution.cpp.

◆ ToString()

string Contribution::ToString ( ) const
overridevirtual

Converts contributions to colon-separated string format.

Format: "source_name:contribution_value\n" for each source

Returns
String representation with one source per line

Reimplemented from Interface.

Definition at line 21 of file contribution.cpp.

Referenced by writetofile().

◆ ToTable()

QTableWidget * Contribution::ToTable ( )
overridevirtual

Creates a QTableWidget for displaying contributions.

Generates a read-only single-column table with source names as row labels and contribution values in the column.

Returns
Pointer to newly created QTableWidget (caller takes ownership)

Reimplemented from Interface.

Definition at line 70 of file contribution.cpp.

◆ writetofile()

bool Contribution::writetofile ( QFile *  file)
overridevirtual

Writes contributions to file.

Parameters
fileFile pointer to write to
Returns
true if successful

Reimplemented from Interface.

Definition at line 31 of file contribution.cpp.

References ToString().


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