Diana Software
QGGraphicalCutBase.cc
Go to the documentation of this file.
1 #include "QGGraphicalCutBase.hh"
2 #include "QGTextFileKeys.hh"
3 #include <TString.h>
4 
6 
7 using std::string;
8 
10  : TCutG("", 3), fPoints(0)
11 {
12 }
13 
15  : TCutG(graphicalCut), fPoints(graphicalCut.fPoints)
16 {
17 }
18 
20 {
21 }
22 
23 void QGGraphicalCutBase::SetProperty(const string& key, const string& value)
24 {
25  if (key == NAME_KEY) {
26  SetName(value.c_str());
27  }
28  else if (key == VERTEX_KEY) {
29  string::size_type delimiter = value.find_first_of(",");
30  if (delimiter != string::npos) {
31  TString xTString(value.substr(0, delimiter));
32  TString yTString(value.substr(delimiter + 1));
33  if (xTString.IsFloat() && yTString.IsFloat()) {
34  Double_t x = xTString.Atof();
35  Double_t y = yTString.Atof();
36  if (fPoints == 0) {
37  fX0 = x;
38  fY0 = y;
39  SetPoint(0, x, y);
40  SetPoint(1, x, y);
41  SetPoint(2, x, y);
42  }
43  else if (fPoints > 0) {
44  SetPoint(fPoints, x, y);
45  SetPoint(fPoints + 1, fX0, fY0);
46  }
47  ++fPoints;
48  }
49  }
50  }
51  else if (key == X_VARIABLE_KEY) {
52  SetVarX(value.c_str());
53  }
54  else if (key == Y_VARIABLE_KEY) {
55  SetVarY(value.c_str());
56  }
57 }
#define VERTEX_KEY
#define Y_VARIABLE_KEY
#define NAME_KEY
#define X_VARIABLE_KEY
ClassImp(QObject)
Base class for GUI graphical cuts. This class has minimal dependencies on other GUI classes so it is ...
void SetProperty(const std::string &key, const std::string &value)
Set property (used for opening a session)
Double_t fX0
X-coordinate of first point.
Int_t fPoints
Number of points selected by the mouse.
virtual ~QGGraphicalCutBase()
Destructor.
Double_t fY0
Y-coordinate of first point.
QGGraphicalCutBase()
Default constructor.