CalcMySky  v0.3.1
Spectrum.hpp
1 #ifndef INCLUDE_ONCE_4E1E8582_D44B_47A5_BAC2_3D8D4B0DE5A4
2 #define INCLUDE_ONCE_4E1E8582_D44B_47A5_BAC2_3D8D4B0DE5A4
3 
4 #include <vector>
5 #include <stdexcept>
6 #include <QString>
7 #include "../common/util.hpp"
8 
9 class Spectrum
10 {
11 public:
13  {
14  QString message;
15  public:
16  ResamplingError(QString const& message) : message(message) {}
17  QString errorType() const override { return QObject::tr("Resampling error"); }
18  QString what() const override { return message; }
19  };
20 public:
21  std::vector<double> wavelengths;
22  std::vector<double> values;
23 
24 public:
25  double minWL() const { return wavelengths.front(); }
26  double maxWL() const { return wavelengths.back(); }
27  bool empty() const { return wavelengths.empty(); }
28  auto size() const { return wavelengths.size(); }
29  void append(const double wl, const double v);
30  double value(const double wl) const;
31  Spectrum resample(const double wlMin, const double wlMax, const int pointCount) const;
32  static Spectrum parseFromCSV(QByteArray const& data, QString const& filename, int firstLineNum);
33 };
34 
35 #endif
An error that ShowMySky classes may throw.
Definition: Exception.hpp:25
QString errorType() const override
A string suitable for use as a title of a message box.
Definition: Spectrum.hpp:17
Definition: Spectrum.hpp:9
QString what() const override
A description of the error.
Definition: Spectrum.hpp:18
Definition: Spectrum.hpp:12