SedSat3 1.1.6
Sediment Source Apportionment Tool - Advanced statistical methods for environmental pollution research
Loading...
Searching...
No Matches
cmbtimeseriesset.h
Go to the documentation of this file.
1#ifndef CMBTimeSeriesSet_H
2#define CMBTimeSeriesSet_H
3
4#include "TimeSeriesSet.h"
5#include "interface.h"
6
16class CMBTimeSeriesSet : public TimeSeriesSet<double>, public Interface
17{
18public:
23
28 CMBTimeSeriesSet(int n);
29
35 CMBTimeSeriesSet(int n, int m);
36
42
49
55 CMBTimeSeriesSet& operator=(const TimeSeriesSet<double>& mp);
56
61 CMBTimeSeriesSet(const TimeSeriesSet<double>& mp);
62
67 QJsonObject toJsonObject() const override;
68
74 bool ReadFromJsonObject(const QJsonObject& jsonobject) override;
75
80 string ToString() const override;
81
87 bool writetofile(QFile*) override;
88
98 QTableWidget* ToTable() override;
99
109 void AppendLastContribution(int colnumber, const string& name);
110
116 void SetObservedValue(int i, const double& value)
117 {
118 if (i < size())
119 observed_value[i] = value;
120 }
121
127 double ObservedValue(int i)
128 {
129 if (i < size())
130 return observed_value[i];
131 else
132 return 0;
133 }
134
140 double ObservedValue(string variable_name)
141 {
142 for (int i = 0; i < size(); i++)
143 {
144 if (getSeriesName(i) == variable_name)
145 return observed_value[i];
146 }
147 return 0;
148 }
149
155 string Label(unsigned int i) const
156 {
157 if (i < labels.size())
158 return labels[i];
159 else if (i < maxnumpoints())
160 return aquiutils::numbertostring(at(0).getTime(i));
161 else
162 return "";
163 }
164
171 string Label(unsigned int i, unsigned int j) const
172 {
173 if (i < labels.size())
174 return labels[i];
175 else if (i < maxnumpoints())
176 return aquiutils::numbertostring(at(j).getTime(i));
177 else
178 return "";
179 }
180
186 void SetLabel(unsigned int i, const string& label)
187 {
188 if (i < maxnumpoints())
189 {
190 labels.resize(maxnumpoints());
191 labels[i] = label;
192 }
193 else
194 return;
195 }
196
197private:
198 vector<double> observed_value;
199 vector<string> labels;
200};
201
202#endif // CMBTimeSeriesSet_H
Collection of time series with labels and observed values.
string Label(unsigned int i, unsigned int j) const
Gets label for time point in specific series.
CMBTimeSeriesSet & operator=(const CMBTimeSeriesSet &mp)
Assignment operator from CMBTimeSeriesSet.
void SetLabel(unsigned int i, const string &label)
Sets custom label for time point.
CMBTimeSeriesSet()
Default constructor - creates an empty time series set.
bool writetofile(QFile *) override
Writes time series set to file.
vector< string > labels
Custom labels for time points.
bool ReadFromJsonObject(const QJsonObject &jsonobject) override
Deserializes time series set from JSON format.
vector< double > observed_value
Observed values for comparison with modeled series.
QJsonObject toJsonObject() const override
Serializes time series set to JSON format.
string Label(unsigned int i) const
Gets label for time point (uses custom labels if set)
double ObservedValue(string variable_name)
Gets observed value for named series.
CMBTimeSeriesSet(int n, int m)
Constructs with specified number of series and points.
void AppendLastContribution(int colnumber, const string &name)
Appends a final contribution series calculated from existing series.
QTableWidget * ToTable() override
Creates a QTableWidget for displaying time series set data.
void SetObservedValue(int i, const double &value)
Sets observed value for comparison at specified index.
string ToString() const override
Converts time series set to CSV-formatted string.
double ObservedValue(int i)
Gets observed value at specified index.
Abstract base class providing common serialization and visualization interface.
Definition interface.h:65