4 : _coordinates({0.0, 0.0, 0.0}), _text(
""), _color(
"000000"), _size(1.0),
5 _angle(0.0), _justification(CenterJustification),
6 _system(CoordinateSystem::DATA) {
10Text::Text(std::string_view text)
11 : _coordinates({2.0, 0.0}), _text(text), _color(
"000000"), _size(1.0),
12 _angle(0.0), _justification(LeftJustification) {
16Text *Text::clone()
const {
return new Text(*
this); }
18void Text::setCoordinates(
double x,
double y,
double z,
19 CoordinateSystem system) {
21 _coordinates = {x, y, z};
26std::string Text::formatChemicalFormula(std::string_view formula) {
28 std::ostringstream ostr;
30 bool subscript =
false;
32 bool superscript =
false;
36 for (
const auto &c : formula) {
38 if (isdigit(c) && !charge) {
53 }
else if (isalpha(c)) {
68 }
else if (!superscript) {
79 superscript = charge =
true;