FACT++  1.0
TPointGui::TPointGui ( const std::string  fname,
const std::string  mod 
)

Definition at line 35 of file TPointGui.cc.

References AddCheckButton(), AddLabel(), AddResetButton(), AddTextButton(), DisplayBending(), DisplayData(), fAzMax, fAzMin, fBending, fCoordinates, fFont, FindWidget(), fLabel, fLimit, fList, fMagMax, fOriginal, Tools::Form(), fZdMax, fZdMin, MPointing::GetDescription(), MPointing::GetNumPar(), MPointing::GetVarName(), i, kIdAzMax, kIdAzMin, kIdLimit, kIdMagMax, kIdZdMax, kIdZdMin, kTbFit, kTbLoad, kTbLoadStars, kTbReloadStars, kTbReset, kTbResetStars, kTbSave, MPointing::Load(), and LoadStars().

35  : TGMainFrame(gClient->GetRoot(), 650, 435, kHorizontalFrame), fExitLoopOnClose(kFALSE),
36  fAzMin(0), fAzMax(360), fZdMin(0), fZdMax(90), fMagMax(10), fLimit(0.05)
37 {
38  fCoordinates.SetOwner();
39  fOriginal.SetOwner();
40 
41  fList = new TList;
42  fList->SetOwner();
43 
44  gROOT->GetListOfCleanups()->Add(fList);
45  fList->SetBit(kMustCleanup);
46 
47  fFont = gVirtualX->LoadQueryFont("7x13bold");
48 
49  TGLayoutHints *hints0 = new TGLayoutHints(kLHintsExpandY, 7, 5, 5, 0);
50  TGLayoutHints *hints1 = new TGLayoutHints(kLHintsExpandX|kLHintsExpandY, 5, 7, 5, 6);
51  fList->Add(hints0);
52  fList->Add(hints1);
53 
54  TGGroupFrame *grp1 = new TGGroupFrame(this, "Control", kVerticalFrame);
55  AddFrame(grp1, hints0);
56  fList->Add(grp1);
57 
58  TGGroupFrame *grp2 = new TGGroupFrame(this, "Parameters", kHorizontalFrame);
59  AddFrame(grp2, hints1);
60  fList->Add(grp2);
61 
62 
63  TGLayoutHints *hints4 = new TGLayoutHints(kLHintsExpandX, 5, 5, 3);
64  TGLayoutHints *hints5 = new TGLayoutHints(kLHintsExpandX, 5, 5, 10);
65  AddTextButton(grp1, "Load Pointing Model", kTbLoad, hints5);
66  AddTextButton(grp1, "Save Pointing Model", kTbSave, hints4);
67  AddTextButton(grp1, "Fit Parameters", kTbFit, hints5);
68  AddTextButton(grp1, "Reset Parameters", kTbReset, hints4);
69  AddTextButton(grp1, "Load Stars", kTbLoadStars, hints5);
70  AddTextButton(grp1, "Reset Stars", kTbResetStars, hints4);
71  AddTextButton(grp1, "Reload Stars", kTbReloadStars, hints4);
72  fList->Add(hints4);
73  fList->Add(hints5);
74 
75 
76 
77 
78 
79 
80 
81  TGHorizontalFrame *comp = new TGHorizontalFrame(grp2, 1, 1);
82  grp2->AddFrame(comp);
83  fList->Add(comp);
84 
85  TGLayoutHints *hints3 = new TGLayoutHints(kLHintsLeft|kLHintsTop, 0, 10, 5, 0);
86  fList->Add(hints3);
87 
88  TGVerticalFrame *vframe = new TGVerticalFrame(comp, 1, 1);
89 
90  for (int i=0; i<MPointing::GetNumPar(); i++)
92 
93  TGButton *but = (TGButton*)FindWidget(0);
94 
95  comp->AddFrame(vframe, hints3);
96  fList->Add(vframe);
97 
98  vframe = new TGVerticalFrame(comp, 1, 1);
99  comp->AddFrame(vframe, hints3);
100  fList->Add(vframe);
101 
102  hints3 = new TGLayoutHints(kLHintsLeft|kLHintsTop, 0, 10, 5, 0);
103  fList->Add(hints3);
104 
105  TGLabel *l = new TGLabel(vframe, "+000.0000");
106  l->SetTextJustify(kTextRight);
107  fList->Add(l);
108  fLabel.Add(l);
109 
110  TGLayoutHints *h = new TGLayoutHints(kLHintsCenterY, 0, 0, but->GetHeight()-l->GetHeight());
111  fList->Add(h);
112 
113  vframe->AddFrame(l,h);
114 
115  for (int i=1; i<MPointing::GetNumPar(); i++)
116  AddLabel(vframe, "+000.0000", h)->SetTextJustify(kTextRight);
117 
118  vframe = new TGVerticalFrame(comp, 1, 1);
119  comp->AddFrame(vframe, hints3);
120  fList->Add(vframe);
121 
122  for (int i=0; i<MPointing::GetNumPar(); i++)
123  AddLabel(vframe, "\xb1 00.0000\xb0", h)->SetTextJustify(kTextRight);
124 
125  hints3 = new TGLayoutHints(kLHintsLeft|kLHintsTop, 0, 20, 5, 0);
126  fList->Add(hints3);
127 
128  TGLayoutHints *hreset = new TGLayoutHints(kLHintsLeft|kLHintsTop, 0, 0, 3, 1);
129  fList->Add(hreset);
130 
131  TGVerticalFrame *vframe2 = new TGVerticalFrame(comp, 1, 1);
132  comp->AddFrame(vframe2, hints3);
133  fList->Add(vframe2);
134  for (int i=0; i<MPointing::GetNumPar(); i++)
135  AddResetButton(vframe2, i+2*MPointing::GetNumPar(), hreset,
136  but->GetHeight()-4);
137 
138  vframe = new TGVerticalFrame(comp, 1, 1);
139  comp->AddFrame(vframe, hints3);
140  fList->Add(vframe);
141 
142  for (int i=0; i<MPointing::GetNumPar(); i++)
143  AddLabel(vframe, fBending.GetDescription(i), h);
144 
145  TGLayoutHints *hints6 = new TGLayoutHints(kLHintsExpandX, 5, 5, 4, 6);
146  fList->Add(hints6);
147 
148  l = new TGLabel(grp1, "0000000 Data Sets loaded.");
149  grp1->AddFrame(l, hints6);
150  fList->Add(l);
151  fLabel.Add(l);
152 
153  l = new TGLabel(grp1, "");
154  l->SetTextJustify(kTextLeft);
155  grp1->AddFrame(l, hints6);
156  fList->Add(l);
157  fLabel.Add(l);
158 
159  l = new TGLabel(grp1, "");
160  l->SetTextJustify(kTextLeft);
161  grp1->AddFrame(l, hints6);
162  fList->Add(l);
163  fLabel.Add(l);
164 
165  l = new TGLabel(grp1, "");
166  l->SetTextJustify(kTextLeft);
167  grp1->AddFrame(l, hints6);
168  fList->Add(l);
169  fLabel.Add(l);
170 
171  // ------------------------------------------------------------------
172 
173  TGLayoutHints *hintse1 = new TGLayoutHints(kLHintsExpandX|kLHintsBottom);
174  TGLayoutHints *hintse2 = new TGLayoutHints(kLHintsExpandX, 2, 2);
175  TGLayoutHints *hintse3 = new TGLayoutHints(kLHintsExpandX);
176  TGLayoutHints *hintsl = new TGLayoutHints(kLHintsExpandX, 1, 0, 5);
177  fList->Add(hintse1);
178  fList->Add(hintse2);
179  fList->Add(hintse3);
180 
181  TGHorizontalFrame *entries = new TGHorizontalFrame(grp1, 1, 1);
182  grp1->AddFrame(entries, hintse1);
183  fList->Add(entries);
184 
185  TGVerticalFrame *v1 = new TGVerticalFrame(entries);
186  TGVerticalFrame *v2 = new TGVerticalFrame(entries);
187  TGVerticalFrame *v3 = new TGVerticalFrame(entries);
188  entries->AddFrame(v1, hintse2);
189  entries->AddFrame(v2, hintse2);
190  entries->AddFrame(v3, hintse2);
191  fList->Add(v1);
192  fList->Add(v2);
193  fList->Add(v3);
194 
195  TGLabel *label1 = new TGLabel(v1, "Az min/°");
196  TGLabel *label2 = new TGLabel(v2, "Az max/°");
197  TGLabel *label3 = new TGLabel(v3, "Mag min");
198  TGLabel *label4 = new TGLabel(v1, "Zd min/°");
199  TGLabel *label5 = new TGLabel(v2, "Zd max/°");
200  TGLabel *label6 = new TGLabel(v3, "Limit/°");
201  label1->SetTextJustify(kTextLeft);
202  label2->SetTextJustify(kTextLeft);
203  label3->SetTextJustify(kTextLeft);
204  label4->SetTextJustify(kTextLeft);
205  label5->SetTextJustify(kTextLeft);
206  label6->SetTextJustify(kTextLeft);
207  fList->Add(label1);
208  fList->Add(label2);
209  fList->Add(label3);
210  fList->Add(label4);
211  fList->Add(label5);
212  fList->Add(label6);
213 
214  TGTextEntry *entry1 = new TGTextEntry(v1, Form("%.1f", fAzMin), kIdAzMin);
215  TGTextEntry *entry2 = new TGTextEntry(v2, Form("%.1f", fAzMax), kIdAzMax);
216  TGTextEntry *entry3 = new TGTextEntry(v3, Form("%.1f", fMagMax), kIdMagMax);
217  TGTextEntry *entry4 = new TGTextEntry(v1, Form("%.1f", fZdMin), kIdZdMin);
218  TGTextEntry *entry5 = new TGTextEntry(v2, Form("%.1f", fZdMax), kIdZdMax);
219  TGTextEntry *entry6 = new TGTextEntry(v3, Form("%.3f", fLimit), kIdLimit);
220  entry1->SetToolTipText("TPoints with a real star located at Az<Az min are ignored in the fit.");
221  entry2->SetToolTipText("TPoints with a real star located at Az>Az max are ignored in the fit.");
222  entry2->SetToolTipText("TPoints with a artifiical magnitude Mag<Mag min are ignored in the fit.");
223  entry4->SetToolTipText("TPoints with a real star located at Zd<Zd min are ignored in the fit.");
224  entry5->SetToolTipText("TPoints with a real star located at Zd>Zd max are ignored in the fit.");
225  entry6->SetToolTipText("TPoints with an residual after the fit > Limit are output.");
226  entry1->Associate(this);
227  entry2->Associate(this);
228  entry3->Associate(this);
229  entry4->Associate(this);
230  entry5->Associate(this);
231  entry6->Associate(this);
232  v1->AddFrame(label1, hintsl);
233  v1->AddFrame(entry1, hintse3);
234  v1->AddFrame(label4, hintsl);
235  v1->AddFrame(entry4, hintse3);
236  v2->AddFrame(label2, hintsl);
237  v2->AddFrame(entry2, hintse3);
238  v2->AddFrame(label5, hintsl);
239  v2->AddFrame(entry5, hintse3);
240  v3->AddFrame(label3, hintsl);
241  v3->AddFrame(entry3, hintse3);
242  v3->AddFrame(label6, hintsl);
243  v3->AddFrame(entry6, hintse3);
244  fList->Add(entry1);
245  fList->Add(entry2);
246  fList->Add(entry3);
247  fList->Add(entry4);
248  fList->Add(entry5);
249  fList->Add(entry6);
250 
251  // ------------------------------------------------------------------
252 
253  // FIXME: Move this to the rc-file.
254  ((TGCheckButton*)FindWidget(0))->SetState(kButtonDown);
255  ((TGCheckButton*)FindWidget(1))->SetState(kButtonDown);
256  ((TGCheckButton*)FindWidget(3))->SetState(kButtonDown);
257  ((TGCheckButton*)FindWidget(4))->SetState(kButtonDown);
258  ((TGCheckButton*)FindWidget(5))->SetState(kButtonDown);
259  ((TGCheckButton*)FindWidget(6))->SetState(kButtonDown);
260  ((TGCheckButton*)FindWidget(7))->SetState(kButtonDown);
261  ((TGCheckButton*)FindWidget(8))->SetState(kButtonDown);
262  ((TGCheckButton*)FindWidget(11))->SetState(kButtonDown);
263  ((TGCheckButton*)FindWidget(12))->SetState(kButtonDown);
264  ((TGCheckButton*)FindWidget(13))->SetState(kButtonDown);
265  ((TGCheckButton*)FindWidget(14))->SetState(kButtonDown);
266 /*
267  ((TGCheckButton*)FindWidget(19))->SetState(kButtonDisabled);
268  ((TGCheckButton*)FindWidget(20))->SetState(kButtonDisabled);
269  ((TGCheckButton*)FindWidget(21))->SetState(kButtonDisabled);
270  ((TGCheckButton*)FindWidget(22))->SetState(kButtonDisabled);
271 
272  ((TGCheckButton*)FindWidget(19+2*MPointing::GetNumPar()))->SetState(kButtonDisabled);
273  ((TGCheckButton*)FindWidget(20+2*MPointing::GetNumPar()))->SetState(kButtonDisabled);
274  ((TGCheckButton*)FindWidget(21+2*MPointing::GetNumPar()))->SetState(kButtonDisabled);
275  ((TGCheckButton*)FindWidget(22+2*MPointing::GetNumPar()))->SetState(kButtonDisabled);
276 */
277  SetWindowName("Telesto");
278  SetIconName("Telesto");
279 
280  Layout();
281 
282  MapSubwindows();
283  MapWindow();
284 
285  if (!fname.empty())
286  LoadStars(fname.c_str());
287  if (!mod.empty())
288  fBending.Load(mod.c_str());
289 
290  DisplayBending();
291  DisplayData();
292 }
const TString & GetDescription(int i) const
Definition: MPointing.h:281
void AddCheckButton(TGCompositeFrame *f, TString txt, Int_t id=-1, TGLayoutHints *h=0)
Definition: TPointGui.cc:349
void LoadStars(TString fname="tpoint.txt")
Definition: TPointGui.cc:656
Bool_t fExitLoopOnClose
Definition: TPointGui.h:51
int i
Definition: db_dim_client.c:21
Float_t fAzMax
Definition: TPointGui.h:54
static const Int_t GetNumPar()
Definition: MPointing.h:308
TList fLabel
Definition: TPointGui.h:43
TObject * FindWidget(Int_t id) const
Definition: TPointGui.cc:1343
TList fCoordinates
Definition: TPointGui.h:42
Bool_t Load(const char *name)
Definition: MPointing.cc:178
TList * fList
Definition: TPointGui.h:39
Float_t fMagMax
Definition: TPointGui.h:57
FontStruct_t fFont
Definition: TPointGui.h:49
Float_t fAzMin
Definition: TPointGui.h:53
void DisplayBending()
Definition: TPointGui.cc:376
TList fOriginal
Definition: TPointGui.h:41
std::string Form(const char *fmt,...)
Definition: tools.cc:45
const TString & GetVarName(int i) const
Definition: MPointing.h:280
void AddTextButton(TGCompositeFrame *f, TString txt, Int_t id=-1, TGLayoutHints *h=0)
Definition: TPointGui.cc:340
void AddResetButton(TGCompositeFrame *f, Int_t id, TGLayoutHints *h, Int_t height)
Definition: TPointGui.cc:357
MPointing fBending
Definition: TPointGui.h:45
Float_t fLimit
Definition: TPointGui.h:59
Float_t fZdMax
Definition: TPointGui.h:56
void DisplayData()
Definition: TPointGui.cc:394
TGLabel * AddLabel(TGCompositeFrame *f, TString txt, TGLayoutHints *h=0)
Definition: TPointGui.cc:367
Float_t fZdMin
Definition: TPointGui.h:55

+ Here is the call graph for this function: