Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
LineStyle.cxx
1/*
2 * LineStyle.cxx
3 *
4 * Created on: 30 lip 2024
5 * Author: daniel
6 */
7
8#include "LineStyle.h"
9
10#include <RtypesCore.h>
11#include <TString.h>
12
13#include "XMLNode.h"
14
15namespace Hal {
16 const unsigned short int LineStyle::kColor = 0;
17 const unsigned short int LineStyle::kWidth = 1;
18 const unsigned short int LineStyle::kStyle = 2;
19
20 void LineStyle::SetColor(Int_t val) { SetI(kColor, val); }
21
22 void LineStyle::SetWidth(Int_t val) { SetI(kWidth, val); }
23
24 void LineStyle::SetStyle(Int_t val) { SetI(kStyle, val); }
25
26 Int_t LineStyle::GetColor() const { return GetI(kColor); }
27
28 Int_t LineStyle::GetWidth() const { return GetI(kWidth); }
29
30 Int_t LineStyle::GetStyle() const { return GetI(kStyle); }
31
32 void LineStyle::ExportToXML(XMLNode* node) const {
33
34 if (Find(kColor)) node->AddAttrib(new Hal::XMLAttrib("Color", Form("%i", GetI(kColor))));
35 if (Find(kWidth)) node->AddAttrib(new Hal::XMLAttrib("Width", Form("%i", GetI(kWidth))));
36 if (Find(kStyle)) node->AddAttrib(new Hal::XMLAttrib("Style", Form("%i", GetI(kStyle))));
37 }
38
39 void LineStyle::ImportFromXML(XMLNode* node) {
40
41 if (auto atr = node->GetAttrib("Color")) {
42 int x = atr->GetValue().Atoi();
43 SetColor(x);
44 }
45 if (auto atr = node->GetAttrib("Width")) {
46 int x = atr->GetValue().Atoi();
47 SetWidth(x);
48 }
49 if (auto atr = node->GetAttrib("Style")) {
50 int x = atr->GetValue().Atoi();
51 SetStyle(x);
52 }
53 }
54} /* namespace Hal */
Bool_t Find(Int_t bit) const
Definition Style.h:55