TEveProjectionManagerEditor.cxx

Go to the documentation of this file.
00001 // @(#)root/eve:$Id: TEveProjectionManagerEditor.cxx 30840 2009-10-23 09:03:14Z matevz $
00002 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #include "TEveProjectionManagerEditor.h"
00013 #include "TEveProjectionManager.h"
00014 #include "TEveGValuators.h"
00015 
00016 #include "TGNumberEntry.h"
00017 #include "TGComboBox.h"
00018 #include "TGLabel.h"
00019 
00020 //==============================================================================
00021 // TEveProjectionManagerEditor
00022 //==============================================================================
00023 
00024 //______________________________________________________________________________
00025 //
00026 // GUI editor for TEveProjectionManager class.
00027 //
00028 
00029 ClassImp(TEveProjectionManagerEditor);
00030 
00031 //______________________________________________________________________________
00032 TEveProjectionManagerEditor::TEveProjectionManagerEditor(const TGWindow *p,
00033                                                          Int_t width, Int_t height,
00034                                                          UInt_t options, Pixel_t back) :
00035    TGedFrame(p, width, height, options | kVerticalFrame, back),
00036    fM(0),
00037 
00038    fType(0),
00039    fDistortion(0),
00040    fFixR(0), fFixZ(0),
00041    fPastFixRFac(0), fPastFixZFac(0),
00042    fCurrentDepth(0),
00043    fMaxTrackStep(0),
00044 
00045    fCenterX(0),
00046    fCenterY(0),
00047    fCenterZ(0)
00048 {
00049    // Constructor.
00050 
00051    MakeTitle("TEveProjection");
00052    {
00053       TGHorizontalFrame* f = new TGHorizontalFrame(this);
00054       TGLabel* lab = new TGLabel(f, "Type");
00055       f->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 31, 1, 2));
00056       fType = new TGComboBox(f);
00057       fType->AddEntry("RPhi", TEveProjection::kPT_RPhi);
00058       fType->AddEntry("RhoZ", TEveProjection::kPT_RhoZ);
00059       fType->AddEntry("3D",   TEveProjection::kPT_3D);
00060       TGListBox* lb = fType->GetListBox();
00061       lb->Resize(lb->GetWidth(), 2*18);
00062       fType->Resize(80, 20);
00063       fType->Connect("Selected(Int_t)", "TEveProjectionManagerEditor",
00064                      this, "DoType(Int_t)");
00065       f->AddFrame(fType, new TGLayoutHints(kLHintsTop, 1, 1, 2, 4));
00066       AddFrame(f);
00067    }
00068 
00069    Int_t nel = 6;
00070    Int_t labelW = 60;
00071    fDistortion = new TEveGValuator(this, "Distortion:", 90, 0);
00072    fDistortion->SetNELength(nel);
00073    fDistortion->SetLabelWidth(labelW);
00074    fDistortion->Build();
00075    fDistortion->SetLimits(0, 50, 101, TGNumberFormat::kNESRealTwo);
00076    fDistortion->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
00077                         this, "DoDistortion()");
00078    AddFrame(fDistortion, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
00079 
00080 
00081    fFixR = new TEveGValuator(this, "FixedR:", 90, 0);
00082    fFixR->SetNELength(nel);
00083    fFixR->SetLabelWidth(labelW);
00084    fFixR->Build();
00085    fFixR->SetLimits(0, 1000, 101, TGNumberFormat::kNESRealOne);
00086    fFixR->SetToolTip("Radius after which scale is kept constant.");
00087    fFixR->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
00088                          this, "DoFixR()");
00089    AddFrame(fFixR, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
00090 
00091    fFixZ = new TEveGValuator(this, "FixedZ:", 90, 0);
00092    fFixZ->SetNELength(nel);
00093    fFixZ->SetLabelWidth(labelW);
00094    fFixZ->Build();
00095    fFixZ->SetLimits(0, 1000, 101, TGNumberFormat::kNESRealOne);
00096    fFixZ->SetToolTip("Z-coordinate after which scale is kept constant.");
00097    fFixZ->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
00098                          this, "DoFixZ()");
00099    AddFrame(fFixZ, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
00100 
00101    fPastFixRFac = new TEveGValuator(this, "ScaleR:", 90, 0);
00102    fPastFixRFac->SetNELength(nel);
00103    fPastFixRFac->SetLabelWidth(labelW);
00104    fPastFixRFac->Build();
00105    fPastFixRFac->SetLimits(-2, 2, 101, TGNumberFormat::kNESRealTwo);
00106    fPastFixRFac->SetToolTip("Relative R-scale beyond FixedR.\nExpressed as 10^x.");
00107    fPastFixRFac->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
00108                          this, "DoPastFixRFac()");
00109    AddFrame(fPastFixRFac, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
00110 
00111    fPastFixZFac = new TEveGValuator(this, "ScaleZ:", 90, 0);
00112    fPastFixZFac->SetNELength(nel);
00113    fPastFixZFac->SetLabelWidth(labelW);
00114    fPastFixZFac->Build();
00115    fPastFixZFac->SetLimits(-2, 2, 101, TGNumberFormat::kNESRealTwo);
00116    fPastFixZFac->SetToolTip("Relative Z-scale beyond FixedZ.\nExpressed as 10^x.");
00117    fPastFixZFac->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
00118                          this, "DoPastFixZFac()");
00119    AddFrame(fPastFixZFac, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
00120 
00121    fCurrentDepth = new TEveGValuator(this, "CurrentZ:", 90, 0);
00122    fCurrentDepth->SetNELength(nel);
00123    fCurrentDepth->SetLabelWidth(labelW);
00124    fCurrentDepth->Build();
00125    fCurrentDepth->SetLimits(-300, 300, 601, TGNumberFormat::kNESRealTwo);
00126    fCurrentDepth->SetToolTip("Z coordinate of incoming projected object.");
00127    fCurrentDepth->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
00128                           this, "DoCurrentDepth()");
00129    AddFrame(fCurrentDepth, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
00130 
00131    fMaxTrackStep = new TEveGValuator(this, "TrackStep:", 90, 0);
00132    fMaxTrackStep->SetNELength(nel);
00133    fMaxTrackStep->SetLabelWidth(labelW);
00134    fMaxTrackStep->Build();
00135    fMaxTrackStep->SetLimits(1, 100, 100, TGNumberFormat::kNESRealOne);
00136    fMaxTrackStep->SetToolTip("Maximum step between two consequtive track-points to avoid artefacts due to projective distortions.\nTaken into account automatically during projection procedure.");
00137    fMaxTrackStep->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
00138                          this, "DoMaxTrackStep()");
00139    AddFrame(fMaxTrackStep, new TGLayoutHints(kLHintsTop, 1, 1, 1, 3));
00140 
00141    // --------------------------------
00142 
00143    MakeTitle("Distortion centre");
00144    fCenterFrame = new TGVerticalFrame(this);
00145 
00146    fCenterX = new TEveGValuator(fCenterFrame, "CenterX:", 90, 0);
00147    fCenterX->SetNELength(nel);
00148    fCenterX->SetLabelWidth(labelW);
00149    fCenterX->Build();
00150    fCenterX->SetLimits(-5, 5, 501, TGNumberFormat::kNESRealThree);
00151    fCenterX->SetToolTip("Origin of the projection.");
00152    fCenterX->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
00153                      this, "DoCenter()");
00154    fCenterFrame->AddFrame(fCenterX, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
00155 
00156    fCenterY = new TEveGValuator(fCenterFrame, "CenterY:", 90, 0);
00157    fCenterY->SetNELength(nel);
00158    fCenterY->SetLabelWidth(labelW);
00159    fCenterY->Build();
00160    fCenterY->SetLimits(-5, 5, 501, TGNumberFormat::kNESRealThree);
00161    fCenterY->SetToolTip("Origin of the projection.");
00162    fCenterY->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
00163                      this, "DoCenter()");
00164    fCenterFrame->AddFrame(fCenterY, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
00165 
00166    fCenterZ = new TEveGValuator(fCenterFrame, "CenterZ:", 90, 0);
00167    fCenterZ->SetNELength(nel);
00168    fCenterZ->SetLabelWidth(labelW);
00169    fCenterZ->Build();
00170    fCenterZ->SetLimits(-25, 25, 501, TGNumberFormat::kNESRealThree);
00171    fCenterZ->SetToolTip("Origin of the projection.");
00172    fCenterZ->Connect("ValueSet(Double_t)", "TEveProjectionManagerEditor",
00173                      this, "DoCenter()");
00174    fCenterFrame->AddFrame(fCenterZ, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
00175 
00176    AddFrame(fCenterFrame, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
00177 }
00178 
00179 //______________________________________________________________________________
00180 void TEveProjectionManagerEditor::SetModel(TObject* obj)
00181 {
00182    // Set model object.
00183 
00184    fM = dynamic_cast<TEveProjectionManager*>(obj);
00185 
00186    fType->Select(fM->GetProjection()->GetType(), kFALSE);
00187    fDistortion->SetValue(1000.0f * fM->GetProjection()->GetDistortion());
00188    fFixR->SetValue(fM->GetProjection()->GetFixR());
00189    fFixZ->SetValue(fM->GetProjection()->GetFixZ());
00190    fPastFixRFac->SetValue(fM->GetProjection()->GetPastFixRFac());
00191    fPastFixZFac->SetValue(fM->GetProjection()->GetPastFixZFac());
00192    fCurrentDepth->SetValue(fM->GetCurrentDepth());
00193    fMaxTrackStep->SetValue(fM->GetProjection()->GetMaxTrackStep());
00194 
00195    fCenterX->SetValue(fM->GetCenter().fX);
00196    fCenterY->SetValue(fM->GetCenter().fY);
00197    fCenterZ->SetValue(fM->GetCenter().fZ);
00198 }
00199 
00200 //______________________________________________________________________________
00201 void TEveProjectionManagerEditor::DoType(Int_t type)
00202 {
00203    // Slot for setting of projection type.
00204 
00205    try
00206    {
00207       fM->SetProjection((TEveProjection::EPType_e)type);
00208       fM->ProjectChildren();
00209       Update();
00210    }
00211    catch (...)
00212    {
00213       SetModel(fM);
00214       throw;
00215    }
00216 }
00217 
00218 //______________________________________________________________________________
00219 void TEveProjectionManagerEditor::DoDistortion()
00220 {
00221    // Slot for setting distortion.
00222 
00223    fM->GetProjection()->SetDistortion(0.001f * fDistortion->GetValue());
00224    fM->UpdateName();
00225    fM->ProjectChildren();
00226    Update();
00227 }
00228 
00229 //______________________________________________________________________________
00230 void TEveProjectionManagerEditor::DoFixR()
00231 {
00232    // Slot for setting fixed radius.
00233 
00234    fM->GetProjection()->SetFixR(fFixR->GetValue());
00235    fM->ProjectChildren();
00236    Update();
00237 }
00238 
00239 //______________________________________________________________________________
00240 void TEveProjectionManagerEditor::DoFixZ()
00241 {
00242    // Slot for setting fixed z-coordinate.
00243 
00244    fM->GetProjection()->SetFixZ(fFixZ->GetValue());
00245    fM->ProjectChildren();
00246    Update();
00247 }
00248 
00249 //______________________________________________________________________________
00250 void TEveProjectionManagerEditor::DoPastFixRFac()
00251 {
00252    // Slot for setting fixed radius.
00253 
00254    fM->GetProjection()->SetPastFixRFac(fPastFixRFac->GetValue());
00255    fM->ProjectChildren();
00256    Update();
00257 }
00258 
00259 //______________________________________________________________________________
00260 void TEveProjectionManagerEditor::DoPastFixZFac()
00261 {
00262    // Slot for setting fixed z-coordinate.
00263 
00264    fM->GetProjection()->SetPastFixZFac(fPastFixZFac->GetValue());
00265    fM->ProjectChildren();
00266    Update();
00267 }
00268 
00269 //______________________________________________________________________________
00270 void TEveProjectionManagerEditor::DoCurrentDepth()
00271 {
00272    // Slot for setting current depth.
00273 
00274    fM->SetCurrentDepth(fCurrentDepth->GetValue());
00275    fM->ProjectChildren();
00276    Update();
00277 }
00278 
00279 //______________________________________________________________________________
00280 void TEveProjectionManagerEditor::DoMaxTrackStep()
00281 {
00282    // Slot for setting fixed z-coordinate.
00283 
00284    fM->GetProjection()->SetMaxTrackStep(fMaxTrackStep->GetValue());
00285    fM->ProjectChildren();
00286    Update();
00287 }
00288 
00289 //______________________________________________________________________________
00290 void TEveProjectionManagerEditor::DoCenter()
00291 {
00292    // Slot for setting center of distortion.
00293 
00294    fM->SetCenter(fCenterX->GetValue(), fCenterY->GetValue(), fCenterZ->GetValue());
00295    Update();
00296 }
00297 

Generated on Tue Jul 5 14:16:13 2011 for ROOT_528-00b_version by  doxygen 1.5.1