Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TEveProjectionManagerEditor.cxx
Go to the documentation of this file.
1// @(#)root/eve:$Id$
2// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
14#include "TEveGValuators.h"
15
16#include "TGComboBox.h"
17#include "TGLabel.h"
18
19/** \class TEveProjectionManagerEditor
20\ingroup TEve
21GUI editor for TEveProjectionManager class.
22*/
23
25
26////////////////////////////////////////////////////////////////////////////////
27/// Constructor.
28
31 UInt_t options, Pixel_t back) :
32 TGedFrame(p, width, height, options | kVerticalFrame, back),
33 fM(nullptr),
34
35 fType(nullptr),
36 fDistortion(nullptr),
37 fFixR(nullptr), fFixZ(nullptr),
38 fPastFixRFac(nullptr), fPastFixZFac(nullptr),
39 fCurrentDepth(nullptr),
40 fMaxTrackStep(nullptr),
41
42 fCenterX(nullptr),
43 fCenterY(nullptr),
44 fCenterZ(nullptr)
45{
46 MakeTitle("TEveProjection");
47 {
49 TGLabel* lab = new TGLabel(f, "Type");
50 f->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 31, 1, 2));
51 fType = new TGComboBox(f);
52 fType->AddEntry("RhoZ", TEveProjection::kPT_RhoZ);
53 fType->AddEntry("RPhi", TEveProjection::kPT_RPhi);
54 fType->AddEntry("XZ", TEveProjection::kPT_XZ);
55 fType->AddEntry("YZ", TEveProjection::kPT_YZ);
56 fType->AddEntry("ZX", TEveProjection::kPT_ZX);
57 fType->AddEntry("ZY", TEveProjection::kPT_ZY);
58 fType->AddEntry("3D", TEveProjection::kPT_3D);
59 TGListBox* lb = fType->GetListBox();
60 lb->Resize(lb->GetWidth(), 2*18);
61 fType->Resize(80, 20);
62 fType->Connect("Selected(Int_t)", "TEveProjectionManagerEditor",
63 this, "DoType(Int_t)");
64 f->AddFrame(fType, new TGLayoutHints(kLHintsTop, 1, 1, 2, 4));
65 AddFrame(f);
66 }
67
68 Int_t nel = 6;
69 Int_t labelW = 60;
70 fDistortion = new TEveGValuator(this, "Distortion:", 90, 0);
71 fDistortion->SetNELength(nel);
72 fDistortion->SetLabelWidth(labelW);
73 fDistortion->Build();
74 fDistortion->SetLimits(0, 50, 101, TGNumberFormat::kNESRealTwo);
75 fDistortion->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
76 this, "DoDistortion()");
78
79
80 fFixR = new TEveGValuator(this, "FixedR:", 90, 0);
81 fFixR->SetNELength(nel);
82 fFixR->SetLabelWidth(labelW);
83 fFixR->Build();
84 fFixR->SetLimits(0, 1000, 101, TGNumberFormat::kNESRealOne);
85 fFixR->SetToolTip("Radius after which scale is kept constant.");
86 fFixR->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
87 this, "DoFixR()");
88 AddFrame(fFixR, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
89
90 fFixZ = new TEveGValuator(this, "FixedZ:", 90, 0);
91 fFixZ->SetNELength(nel);
92 fFixZ->SetLabelWidth(labelW);
93 fFixZ->Build();
94 fFixZ->SetLimits(0, 1000, 101, TGNumberFormat::kNESRealOne);
95 fFixZ->SetToolTip("Z-coordinate after which scale is kept constant.");
96 fFixZ->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
97 this, "DoFixZ()");
98 AddFrame(fFixZ, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
99
100 fPastFixRFac = new TEveGValuator(this, "ScaleR:", 90, 0);
101 fPastFixRFac->SetNELength(nel);
102 fPastFixRFac->SetLabelWidth(labelW);
103 fPastFixRFac->Build();
104 fPastFixRFac->SetLimits(-2, 2, 101, TGNumberFormat::kNESRealTwo);
105 fPastFixRFac->SetToolTip("Relative R-scale beyond FixedR.\nExpressed as 10^x.");
106 fPastFixRFac->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
107 this, "DoPastFixRFac()");
109
110 fPastFixZFac = new TEveGValuator(this, "ScaleZ:", 90, 0);
111 fPastFixZFac->SetNELength(nel);
112 fPastFixZFac->SetLabelWidth(labelW);
113 fPastFixZFac->Build();
114 fPastFixZFac->SetLimits(-2, 2, 101, TGNumberFormat::kNESRealTwo);
115 fPastFixZFac->SetToolTip("Relative Z-scale beyond FixedZ.\nExpressed as 10^x.");
116 fPastFixZFac->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
117 this, "DoPastFixZFac()");
119
120 fCurrentDepth = new TEveGValuator(this, "CurrentZ:", 90, 0);
121 fCurrentDepth->SetNELength(nel);
122 fCurrentDepth->SetLabelWidth(labelW);
123 fCurrentDepth->Build();
124 fCurrentDepth->SetLimits(-300, 300, 601, TGNumberFormat::kNESRealTwo);
125 fCurrentDepth->SetToolTip("Z coordinate of incoming projected object.");
126 fCurrentDepth->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
127 this, "DoCurrentDepth()");
129
130 fMaxTrackStep = new TEveGValuator(this, "TrackStep:", 90, 0);
131 fMaxTrackStep->SetNELength(nel);
132 fMaxTrackStep->SetLabelWidth(labelW);
133 fMaxTrackStep->Build();
134 fMaxTrackStep->SetLimits(1, 100, 100, TGNumberFormat::kNESRealOne);
135 fMaxTrackStep->SetToolTip("Maximum step between two consecutive track-points to avoid artefacts due to projective distortions.\nTaken into account automatically during projection procedure.");
136 fMaxTrackStep->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
137 this, "DoMaxTrackStep()");
139
140 // --------------------------------
141
142 MakeTitle("Distortion centre");
143 fCenterFrame = new TGVerticalFrame(this);
144
145 fCenterX = new TEveGValuator(fCenterFrame, "CenterX:", 90, 0);
146 fCenterX->SetNELength(nel);
147 fCenterX->SetLabelWidth(labelW);
148 fCenterX->Build();
149 fCenterX->SetLimits(-5, 5, 501, TGNumberFormat::kNESRealThree);
150 fCenterX->SetToolTip("Origin of the projection.");
151 fCenterX->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
152 this, "DoCenter()");
153 fCenterFrame->AddFrame(fCenterX, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
154
155 fCenterY = new TEveGValuator(fCenterFrame, "CenterY:", 90, 0);
156 fCenterY->SetNELength(nel);
157 fCenterY->SetLabelWidth(labelW);
158 fCenterY->Build();
159 fCenterY->SetLimits(-5, 5, 501, TGNumberFormat::kNESRealThree);
160 fCenterY->SetToolTip("Origin of the projection.");
161 fCenterY->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
162 this, "DoCenter()");
163 fCenterFrame->AddFrame(fCenterY, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
164
165 fCenterZ = new TEveGValuator(fCenterFrame, "CenterZ:", 90, 0);
166 fCenterZ->SetNELength(nel);
167 fCenterZ->SetLabelWidth(labelW);
168 fCenterZ->Build();
169 fCenterZ->SetLimits(-25, 25, 501, TGNumberFormat::kNESRealThree);
170 fCenterZ->SetToolTip("Origin of the projection.");
171 fCenterZ->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
172 this, "DoCenter()");
173 fCenterFrame->AddFrame(fCenterZ, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
174
176}
177
178////////////////////////////////////////////////////////////////////////////////
179/// Set model object.
180
182{
183 fM = dynamic_cast<TEveProjectionManager*>(obj);
184
185 fType->Select(fM->GetProjection()->GetType(), kFALSE);
186 fDistortion->SetValue(1000.0f * fM->GetProjection()->GetDistortion());
187 fFixR->SetValue(fM->GetProjection()->GetFixR());
188 fFixZ->SetValue(fM->GetProjection()->GetFixZ());
189 fPastFixRFac->SetValue(fM->GetProjection()->GetPastFixRFac());
190 fPastFixZFac->SetValue(fM->GetProjection()->GetPastFixZFac());
191 fCurrentDepth->SetValue(fM->GetCurrentDepth());
192 fMaxTrackStep->SetValue(fM->GetProjection()->GetMaxTrackStep());
193
194 fCenterX->SetValue(fM->GetCenter().fX);
195 fCenterY->SetValue(fM->GetCenter().fY);
196 fCenterZ->SetValue(fM->GetCenter().fZ);
197}
198
199////////////////////////////////////////////////////////////////////////////////
200/// Slot for setting of projection type.
201
203{
204 try
205 {
206 fM->SetProjection((TEveProjection::EPType_e)type);
207 fM->ProjectChildren();
208 Update();
209 }
210 catch (...)
211 {
212 SetModel(fM);
213 throw;
214 }
215}
216
217////////////////////////////////////////////////////////////////////////////////
218/// Slot for setting distortion.
219
221{
222 fM->GetProjection()->SetDistortion(0.001f * fDistortion->GetValue());
223 fM->UpdateName();
224 fM->ProjectChildren();
225 Update();
226}
227
228////////////////////////////////////////////////////////////////////////////////
229/// Slot for setting fixed radius.
230
232{
233 fM->GetProjection()->SetFixR(fFixR->GetValue());
234 fM->ProjectChildren();
235 Update();
236}
237
238////////////////////////////////////////////////////////////////////////////////
239/// Slot for setting fixed z-coordinate.
240
242{
243 fM->GetProjection()->SetFixZ(fFixZ->GetValue());
244 fM->ProjectChildren();
245 Update();
246}
247
248////////////////////////////////////////////////////////////////////////////////
249/// Slot for setting fixed radius.
250
252{
253 fM->GetProjection()->SetPastFixRFac(fPastFixRFac->GetValue());
254 fM->ProjectChildren();
255 Update();
256}
257
258////////////////////////////////////////////////////////////////////////////////
259/// Slot for setting fixed z-coordinate.
260
262{
263 fM->GetProjection()->SetPastFixZFac(fPastFixZFac->GetValue());
264 fM->ProjectChildren();
265 Update();
266}
267
268////////////////////////////////////////////////////////////////////////////////
269/// Slot for setting current depth.
270
272{
273 fM->SetCurrentDepth(fCurrentDepth->GetValue());
274 fM->ProjectChildren();
275 Update();
276}
277
278////////////////////////////////////////////////////////////////////////////////
279/// Slot for setting fixed z-coordinate.
280
282{
283 fM->GetProjection()->SetMaxTrackStep(fMaxTrackStep->GetValue());
284 fM->ProjectChildren();
285 Update();
286}
287
288////////////////////////////////////////////////////////////////////////////////
289/// Slot for setting center of distortion.
290
292{
293 fM->SetCenter(fCenterX->GetValue(), fCenterY->GetValue(), fCenterZ->GetValue());
294 Update();
295}
296
@ kVerticalFrame
Definition GuiTypes.h:381
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
#define f(i)
Definition RSha256.hxx:104
int Int_t
Definition RtypesCore.h:45
unsigned int UInt_t
Definition RtypesCore.h:46
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
#define ClassImp(name)
Definition Rtypes.h:377
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsBottom
Definition TGLayout.h:29
@ kLHintsTop
Definition TGLayout.h:27
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
Composite GUI element for single value selection (supports label, number-entry and slider).
GUI editor for TEveProjectionManager class.
void DoPastFixZFac()
Slot for setting fixed z-coordinate.
void SetModel(TObject *obj) override
Set model object.
void DoCurrentDepth()
Slot for setting current depth.
void DoType(Int_t type)
Slot for setting of projection type.
TEveProjectionManagerEditor(const TEveProjectionManagerEditor &)
void DoMaxTrackStep()
Slot for setting fixed z-coordinate.
void DoCenter()
Slot for setting center of distortion.
void DoDistortion()
Slot for setting distortion.
void DoFixZ()
Slot for setting fixed z-coordinate.
void DoFixR()
Slot for setting fixed radius.
void DoPastFixRFac()
Slot for setting fixed radius.
Manager class for steering of projections and managing projected objects.
A combobox (also known as a drop down listbox) allows the selection of one item out of a list of item...
Definition TGComboBox.h:47
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
UInt_t GetWidth() const
Definition TGFrame.h:224
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:385
This class handles GUI labels.
Definition TGLabel.h:24
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
A listbox is a box, possibly with scrollbar, containing entries.
Definition TGListBox.h:221
void Resize(UInt_t w, UInt_t h) override
Resize the listbox widget.
@ kNESRealOne
Fixed fraction real, one digit.
@ kNESRealThree
Fixed fraction real, three digit.
@ kNESRealTwo
Fixed fraction real, two digit.
A composite frame that layout their children in vertical way.
Definition TGFrame.h:374
ROOT GUI Window base class.
Definition TGWindow.h:23
TGedFrame(const TGedFrame &)=delete
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition TGedFrame.cxx:95
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition TGedFrame.cxx:72
Mother of all ROOT objects.
Definition TObject.h:41