NAPISD
PAHdb website C++ backend
Loading...
Searching...
No Matches
Text.h
1#ifndef _TEXT_H_
2#define _TEXT_H_
3
4#include <string>
5#include <string_view>
6
7#include <array>
8
9#include <sstream>
10
11#include "CanvasItem.h"
12
13class Text : public CanvasItem {
14
15public:
16 enum class CoordinateSystem : char { DATA, NORMAL };
17
18 static constexpr double LeftJustification = 0.0;
19
20 static constexpr double CenterJustification = 0.5;
21
22 static constexpr double RightJustification = 1.0;
23
24 static std::string formatChemicalFormula(std::string_view formula);
25
26 Text();
27 Text(std::string_view text);
28 virtual Text *clone() const;
29
30 void setCoordinates(const std::array<double, 3> &coordinates,
31 CoordinateSystem system = CoordinateSystem::DATA);
32
33 void setCoordinates(double x, double y, double z,
34 CoordinateSystem system = CoordinateSystem::DATA);
35
36 std::array<double, 3> const &getCoordinates() const;
37
38 const CoordinateSystem &getSystem() const;
39
40 void setText(std::string_view text);
41
42 std::string_view getText() const;
43
44 void setColor(std::string_view color);
45
46 std::string_view getColor() const;
47
48 void setSize(double size);
49
50 const double &getSize() const;
51
52 void setAngle(double angle);
53
54 const double &getAngle() const;
55
56 void setJustification(double justification);
57
58 const double &getJustification() const;
59
60private:
61 std::array<double, 3> _coordinates;
62
63 std::string _text;
64
65 std::string _color;
66
67 double _size;
68
69 double _angle;
70
71 double _justification;
72
73 CoordinateSystem _system;
74};
75
76inline void Text::setCoordinates(const std::array<double, 3> &coordinates,
77 CoordinateSystem system) {
78 _coordinates = coordinates;
79 _system = system;
80}
81
82inline const std::array<double, 3> &Text::getCoordinates() const {
83 return (_coordinates);
84}
85
86inline const Text::CoordinateSystem &Text::getSystem() const {
87 return (_system);
88}
89
90inline void Text::setColor(std::string_view color) { _color = color; }
91
92inline std::string_view Text::getColor() const { return (_color); }
93
94inline void Text::setText(std::string_view text) { _text = text; }
95
96inline std::string_view Text::getText() const { return (_text); }
97
98inline void Text::setAngle(double angle) { _angle = angle; }
99
100inline const double &Text::getAngle() const { return (_angle); }
101
102inline void Text::setSize(double size) { _size = size; }
103
104inline const double &Text::getSize() const { return (_size); }
105
106inline void Text::setJustification(double justification) {
107 _justification = justification;
108}
109
110inline const double &Text::getJustification() const { return (_justification); }
111
112#endif /* _TEXT_H_ */
Definition Text.h:13

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-2025, Christiaan Boersma