NAPISD
PAHdb website C++ backend
Curve.h
1 #ifndef _CURVE_H_
2 #define _CURVE_H_
3 
4 #include "CanvasItem.h"
5 #include "LineProperties.h"
6 
7 #include <string>
8 #include <string_view>
9 #include <vector>
10 
11 class Curve : public CanvasItem, public LineProperties {
12 
13 public:
14  typedef std::vector<double>::iterator iterator;
15 
16  typedef const std::vector<double>::const_iterator const_iterator;
17 
18  Curve();
19  Curve *clone() const;
20 
21  void setXAndY(const std::vector<double> &x, const std::vector<double> &y);
22 
23  void setXAndY(const double x, const double y);
24 
25  void setXErr(const double xerr);
26 
27  void setXErr(const std::vector<double> &xerr);
28 
29  void setYErr(const double yerr);
30 
31  void setYErr(const std::vector<double> &yerr);
32 
33  std::vector<double> const &getX() const;
34 
35  std::vector<double> const &getXErr() const;
36 
37  std::vector<double> const &getY() const;
38 
39  std::vector<double> const &getYErr() const;
40 
41  void clear();
42 
43  void setFillColor(std::string_view color);
44 
45  std::string_view getFillColor() const;
46 
47  void setFill(bool on);
48 
49  bool isFill();
50 
51  void setSymbol(char symbol);
52 
53  const char &getSymbol() const;
54 
55  void setSymbolSize(int size);
56 
57  const int &getSymbolSize() const;
58 
59 private:
60  std::vector<double> _x;
61 
62  std::vector<double> _xerr;
63 
64  std::vector<double> _y;
65 
66  std::vector<double> _yerr;
67 
68  std::string_view _fillcolor;
69 
70  int _symbolsize;
71 
72  bool _fill;
73 
74  char _symbol;
75 };
76 
77 inline void Curve::setXAndY(const std::vector<double> &x,
78  const std::vector<double> &y) {
79  _x = x;
80  _y = y;
81 }
82 
83 inline void Curve::setXErr(const std::vector<double> &xerr) { _xerr = xerr; }
84 
85 inline void Curve::setYErr(const std::vector<double> &yerr) { _yerr = yerr; }
86 
87 inline std::vector<double> const &Curve::getX() const { return (_x); }
88 
89 inline std::vector<double> const &Curve::getXErr() const { return (_xerr); }
90 
91 inline std::vector<double> const &Curve::getY() const { return (_y); }
92 
93 inline std::vector<double> const &Curve::getYErr() const { return (_yerr); }
94 
95 inline void Curve::clear() {
96 
97  _x.clear();
98 
99  _xerr.clear();
100 
101  _y.clear();
102 
103  _yerr.clear();
104 }
105 
106 inline void Curve::setFill(bool on = true) { _fill = on; }
107 
108 inline bool Curve::isFill() { return (_fill); }
109 
110 inline void Curve::setFillColor(std::string_view color) { _fillcolor = color; }
111 
112 inline std::string_view Curve::getFillColor() const { return (_fillcolor); }
113 
114 inline void Curve::setSymbol(char symbol) { _symbol = symbol; }
115 
116 inline const char &Curve::getSymbol() const { return (_symbol); }
117 
118 inline void Curve::setSymbolSize(int size) { _symbolsize = size; }
119 
120 inline const int &Curve::getSymbolSize() const { return (_symbolsize); }
121 
122 #endif /* _CURVE_H_ */
Definition: CanvasItem.h:4
Definition: Curve.h:11
Definition: LineProperties.h:7

Since FY2019 the NASA Ames PAH IR Spectroscopic Database is being supported through a directed Work Package at NASA Ames titled: "Laboratory Astrophysics - The NASA Ames PAH IR Spectroscopic Database".
Since FY2023 the NASA Ames PAH IR Spectroscopic Database is being supported through the Laboratory Astrophysics Rd 2 directed Work Package at NASA Ames.
© Copyright 2021-2023, Christiaan Boersma