Logo ROOT   6.10/09
Reference Guide
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 
13 #include "TEveProjectionManager.h"
14 #include "TEveGValuators.h"
15 
16 #include "TGNumberEntry.h"
17 #include "TGComboBox.h"
18 #include "TGLabel.h"
19 
20 /** \class TEveProjectionManagerEditor
21 \ingroup TEve
22 GUI editor for TEveProjectionManager class.
23 */
24 
26 
27 ////////////////////////////////////////////////////////////////////////////////
28 /// Constructor.
29 
31  Int_t width, Int_t height,
32  UInt_t options, Pixel_t back) :
33  TGedFrame(p, width, height, options | kVerticalFrame, back),
34  fM(0),
35 
36  fType(0),
37  fDistortion(0),
38  fFixR(0), fFixZ(0),
39  fPastFixRFac(0), fPastFixZFac(0),
40  fCurrentDepth(0),
41  fMaxTrackStep(0),
42 
43  fCenterX(0),
44  fCenterY(0),
45  fCenterZ(0)
46 {
47  MakeTitle("TEveProjection");
48  {
50  TGLabel* lab = new TGLabel(f, "Type");
51  f->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 31, 1, 2));
52  fType = new TGComboBox(f);
56  TGListBox* lb = fType->GetListBox();
57  lb->Resize(lb->GetWidth(), 2*18);
58  fType->Resize(80, 20);
59  fType->Connect("Selected(Int_t)", "TEveProjectionManagerEditor",
60  this, "DoType(Int_t)");
61  f->AddFrame(fType, new TGLayoutHints(kLHintsTop, 1, 1, 2, 4));
62  AddFrame(f);
63  }
64 
65  Int_t nel = 6;
66  Int_t labelW = 60;
67  fDistortion = new TEveGValuator(this, "Distortion:", 90, 0);
69  fDistortion->SetLabelWidth(labelW);
70  fDistortion->Build();
72  fDistortion->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
73  this, "DoDistortion()");
74  AddFrame(fDistortion, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
75 
76 
77  fFixR = new TEveGValuator(this, "FixedR:", 90, 0);
78  fFixR->SetNELength(nel);
79  fFixR->SetLabelWidth(labelW);
80  fFixR->Build();
82  fFixR->SetToolTip("Radius after which scale is kept constant.");
83  fFixR->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
84  this, "DoFixR()");
85  AddFrame(fFixR, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
86 
87  fFixZ = new TEveGValuator(this, "FixedZ:", 90, 0);
88  fFixZ->SetNELength(nel);
89  fFixZ->SetLabelWidth(labelW);
90  fFixZ->Build();
92  fFixZ->SetToolTip("Z-coordinate after which scale is kept constant.");
93  fFixZ->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
94  this, "DoFixZ()");
95  AddFrame(fFixZ, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
96 
97  fPastFixRFac = new TEveGValuator(this, "ScaleR:", 90, 0);
99  fPastFixRFac->SetLabelWidth(labelW);
100  fPastFixRFac->Build();
102  fPastFixRFac->SetToolTip("Relative R-scale beyond FixedR.\nExpressed as 10^x.");
103  fPastFixRFac->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
104  this, "DoPastFixRFac()");
105  AddFrame(fPastFixRFac, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
106 
107  fPastFixZFac = new TEveGValuator(this, "ScaleZ:", 90, 0);
109  fPastFixZFac->SetLabelWidth(labelW);
110  fPastFixZFac->Build();
112  fPastFixZFac->SetToolTip("Relative Z-scale beyond FixedZ.\nExpressed as 10^x.");
113  fPastFixZFac->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
114  this, "DoPastFixZFac()");
115  AddFrame(fPastFixZFac, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
116 
117  fCurrentDepth = new TEveGValuator(this, "CurrentZ:", 90, 0);
119  fCurrentDepth->SetLabelWidth(labelW);
120  fCurrentDepth->Build();
122  fCurrentDepth->SetToolTip("Z coordinate of incoming projected object.");
123  fCurrentDepth->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
124  this, "DoCurrentDepth()");
125  AddFrame(fCurrentDepth, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
126 
127  fMaxTrackStep = new TEveGValuator(this, "TrackStep:", 90, 0);
129  fMaxTrackStep->SetLabelWidth(labelW);
130  fMaxTrackStep->Build();
132  fMaxTrackStep->SetToolTip("Maximum step between two consecutive track-points to avoid artefacts due to projective distortions.\nTaken into account automatically during projection procedure.");
133  fMaxTrackStep->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
134  this, "DoMaxTrackStep()");
135  AddFrame(fMaxTrackStep, new TGLayoutHints(kLHintsTop, 1, 1, 1, 3));
136 
137  // --------------------------------
138 
139  MakeTitle("Distortion centre");
140  fCenterFrame = new TGVerticalFrame(this);
141 
142  fCenterX = new TEveGValuator(fCenterFrame, "CenterX:", 90, 0);
143  fCenterX->SetNELength(nel);
144  fCenterX->SetLabelWidth(labelW);
145  fCenterX->Build();
147  fCenterX->SetToolTip("Origin of the projection.");
148  fCenterX->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
149  this, "DoCenter()");
151 
152  fCenterY = new TEveGValuator(fCenterFrame, "CenterY:", 90, 0);
153  fCenterY->SetNELength(nel);
154  fCenterY->SetLabelWidth(labelW);
155  fCenterY->Build();
157  fCenterY->SetToolTip("Origin of the projection.");
158  fCenterY->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
159  this, "DoCenter()");
161 
162  fCenterZ = new TEveGValuator(fCenterFrame, "CenterZ:", 90, 0);
163  fCenterZ->SetNELength(nel);
164  fCenterZ->SetLabelWidth(labelW);
165  fCenterZ->Build();
167  fCenterZ->SetToolTip("Origin of the projection.");
168  fCenterZ->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
169  this, "DoCenter()");
171 
172  AddFrame(fCenterFrame, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
173 }
174 
175 ////////////////////////////////////////////////////////////////////////////////
176 /// Set model object.
177 
179 {
180  fM = dynamic_cast<TEveProjectionManager*>(obj);
181 
190 
194 }
195 
196 ////////////////////////////////////////////////////////////////////////////////
197 /// Slot for setting of projection type.
198 
200 {
201  try
202  {
204  fM->ProjectChildren();
205  Update();
206  }
207  catch (...)
208  {
209  SetModel(fM);
210  throw;
211  }
212 }
213 
214 ////////////////////////////////////////////////////////////////////////////////
215 /// Slot for setting distortion.
216 
218 {
220  fM->UpdateName();
221  fM->ProjectChildren();
222  Update();
223 }
224 
225 ////////////////////////////////////////////////////////////////////////////////
226 /// Slot for setting fixed radius.
227 
229 {
231  fM->ProjectChildren();
232  Update();
233 }
234 
235 ////////////////////////////////////////////////////////////////////////////////
236 /// Slot for setting fixed z-coordinate.
237 
239 {
241  fM->ProjectChildren();
242  Update();
243 }
244 
245 ////////////////////////////////////////////////////////////////////////////////
246 /// Slot for setting fixed radius.
247 
249 {
251  fM->ProjectChildren();
252  Update();
253 }
254 
255 ////////////////////////////////////////////////////////////////////////////////
256 /// Slot for setting fixed z-coordinate.
257 
259 {
261  fM->ProjectChildren();
262  Update();
263 }
264 
265 ////////////////////////////////////////////////////////////////////////////////
266 /// Slot for setting current depth.
267 
269 {
271  fM->ProjectChildren();
272  Update();
273 }
274 
275 ////////////////////////////////////////////////////////////////////////////////
276 /// Slot for setting fixed z-coordinate.
277 
279 {
281  fM->ProjectChildren();
282  Update();
283 }
284 
285 ////////////////////////////////////////////////////////////////////////////////
286 /// Slot for setting center of distortion.
287 
289 {
291  Update();
292 }
293 
EPType_e GetType() const
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:587
void DoCurrentDepth()
Slot for setting current depth.
virtual void Resize(UInt_t w, UInt_t h)
Resize the listbox widget.
Definition: TGListBox.cxx:1419
virtual void SetValue(Float_t v, Bool_t emit=kFALSE)
Set value, optionally emit signal.
void SetCenter(Float_t x, Float_t y, Float_t z)
Set projection center and rebuild projected scene.
Float_t GetFixR() const
void DoCenter()
Slot for setting center of distortion.
virtual void ProjectChildren()
Project all children recursively, update bounding-box and notify TEveManger about the scenes that hav...
void DoType(Int_t type)
Slot for setting of projection type.
int Int_t
Definition: RtypesCore.h:41
void SetToolTip(const char *tip)
Set the tooltip of the number-entry.
UInt_t GetWidth() const
Definition: TGFrame.h:271
Composite GUI element for single value selection (supports label, number-entry and slider)...
ULong_t Pixel_t
Definition: GuiTypes.h:39
Float_t GetDistortion() const
Float_t GetFixZ() const
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition: TGedFrame.cxx:73
virtual void Select(Int_t id, Bool_t emit=kTRUE)
Make the selected item visible in the combo box window and emit signals according to the second param...
Definition: TGComboBox.cxx:443
void SetMaxTrackStep(Float_t x)
virtual void SetModel(TObject *obj)
Set model object.
void SetFixR(Float_t x)
Set fixed radius.
Manager class for steering of projections and managing projected objects.
Float_t GetPastFixZFac() const
virtual TGListBox * GetListBox() const
Definition: TGComboBox.h:130
void SetFixZ(Float_t x)
Set fixed radius.
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot...
Definition: TQObject.cxx:867
Float_t GetPastFixRFac() const
GUI editor for TEveProjectionManager class.
void SetNELength(Int_t l)
void SetPastFixRFac(Float_t x)
Set 2&#39;s-exponent for relative scaling beyond FixR.
unsigned int UInt_t
Definition: RtypesCore.h:42
void DoMaxTrackStep()
Slot for setting fixed z-coordinate.
void DoPastFixRFac()
Slot for setting fixed radius.
const Bool_t kFALSE
Definition: RtypesCore.h:92
PyObject * fType
void DoPastFixZFac()
Slot for setting fixed z-coordinate.
TEveProjection * GetProjection()
void SetCurrentDepth(Float_t d)
void DoFixR()
Slot for setting fixed radius.
virtual void Build(Bool_t connect=kTRUE)
Create sub-components (label, number entry, slider).
#define ClassImp(name)
Definition: Rtypes.h:336
double f(double x)
virtual void AddEntry(TGString *s, Int_t id)
Definition: TGComboBox.h:106
int type
Definition: TGX11.cxx:120
void SetDistortion(Float_t d)
Set distortion.
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
TEveProjectionManagerEditor(const TEveProjectionManagerEditor &)
Mother of all ROOT objects.
Definition: TObject.h:37
void SetProjection(TEveProjection::EPType_e type)
Set projection type and distortion.
void DoDistortion()
Slot for setting distortion.
void SetLabelWidth(Int_t w)
Float_t GetMaxTrackStep() const
void SetLimits(Int_t min, Int_t max)
Set limits of the represented value for integer values.
virtual void UpdateName()
Updates name to have consistent information with projection.
void DoFixZ()
Slot for setting fixed z-coordinate.
void SetPastFixZFac(Float_t x)
Set 2&#39;s-exponent for relative scaling beyond FixZ.
Float_t GetCurrentDepth() const
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition: TGedFrame.cxx:96
Float_t GetValue() const