TridPage Class Reference

#include <TridPage.h>

Inheritance diagram for TridPage:
PageABC TridCratePage TridHistoPage TridPageDetector TridPageSlice TridPmtPage TridUVPage TridTransHistoPage

List of all members.

Public Types

enum  ETridViewModes {
  kViewNone = 0, kView2D = 1, kView3D = 2, kViewStereo = 4,
  kViewCrossEyed = 8, kViewRedBlue = 16, kViewBlueRed = 32
}
typedef enum
TridPage::ETridViewModes 
ViewMode_t

Public Member Functions

 TridPage ()
 TridPage (TridPage &other)
virtual ~TridPage ()
virtual TObject * Init (Mint *mint, PageDisplay *pd, GuiBox &box)
virtual void Print ()
 Implement to print your display.
virtual void PrintToFile (const char *filename, const char *text="")
virtual void Update ()
 Implement to respond to a change in the data.
virtual void Clear ()
virtual void CreateModels ()
virtual void CreateSketches ()
virtual void CreateScenery ()
virtual void ModifySketches ()
virtual void Unzoom ()
virtual void Rezoom ()
virtual void FullZoom ()
virtual void AutoZoom ()
virtual void ViewMenuHandler (GuiMenu *menu, GuiMenu::GuiMenuList::iterator mit, TridPage::ViewMode_t mode)
virtual void SetupFrame (TridPage::ViewMode_t mode)
virtual TridGLFrameCreateNewGLFrame (TridPage::ViewMode_t mode)
virtual void SetPOV (TridPOV &newPOV)
virtual void MouseOver (int sketchname)
virtual void MouseClick (int sketchname)
virtual void ChangeColor ()
virtual void ChangeTrans ()
virtual void ChangePicked ()
virtual void ChangeSelected ()
virtual void AnimationRedraw ()
virtual void ChangeHistograms ()
void ChangeColorHook ()
void ChangeTransHook ()
void ChangePickedHook ()
void ChangeSelectedHook ()
void AnimationHook ()
void ChangeHistogramsHook ()
virtual double PlaceInBox (double boxwidth, double width, int i=0, int n=1)
virtual TVector3 GetColor (Float_t x)
virtual void SaveWindowGeometry (TEnv &env)
virtual void RestoreWindowGeometry (TEnv &env)

Protected Member Functions

virtual void operator= (const TridPage &)

Protected Attributes

TString fWindowName
SigC::Ptr< TridGLFramefGLFrame
SigC::Ptr< GuiBoxfGuiBox
SigC::Ptr< GuiBoxfSubBox
TGWindow * fMainWindow
SigC::Ptr< GuiMenufFileMenu
SigC::Ptr< GuiMenufOptionsMenu
SigC::Ptr< TridControlfTridControl
GuiMenuBarfMenuBar
TridPOV fAutoPOV
TridPOV fFullPOV
MintfMint
PageDisplayfPageDisplay
VldContext fContext
TridModelList fModels
TH1 * fColorHistogram
TH1 * fTransHistogram
ViewMode_t fViewMode
Bool_t fCreateHistograms
Int_t fViewModesSupported

Private Member Functions

void Clear (Option_t *)

Detailed Description

Definition at line 51 of file TridPage.h.


Member Typedef Documentation


Member Enumeration Documentation

Enumerator:
kViewNone 
kView2D 
kView3D 
kViewStereo 
kViewCrossEyed 
kViewRedBlue 
kViewBlueRed 

Definition at line 56 of file TridPage.h.

00056                                 {
00057       kViewNone = 0,
00058       kView2D = 1,
00059       kView3D = 2,
00060       kViewStereo = 4,
00061       kViewCrossEyed = 8,
00062       kViewRedBlue = 16,
00063       kViewBlueRed = 32
00064     } ViewMode_t;


Constructor & Destructor Documentation

TridPage::TridPage (  ) 

Definition at line 53 of file TridPage.cxx.

References fViewMode, and kView3D.

00054   : fWindowName("Unnamed"),
00055     fGLFrame(0),
00056     fGuiBox(0),
00057     fMainWindow(0),
00058     fFileMenu(0),
00059     fOptionsMenu(0),
00060     fTridControl(0),
00061     fAutoPOV(0,0,0,10,45,25),
00062     fFullPOV(0,0,0,10,45,25),
00063     fMint(0),
00064     fPageDisplay(0),
00065     fModels(),
00066     fColorHistogram(0),
00067     fTransHistogram(0),
00068     fViewMode(kViewNone),
00069     fCreateHistograms(true),
00070     fViewModesSupported( kView2D | kView3D | kViewStereo  | kViewCrossEyed | kViewRedBlue | kViewBlueRed )
00071 {
00072   // Set default view mode here.
00073   fViewMode = kView3D;
00074 }

TridPage::TridPage ( TridPage other  ) 

Definition at line 76 of file TridPage.cxx.

References Msg::kFatal, and MSG.

00077   : PageABC( otherPage ),    
00078     TObject( otherPage ),
00079     fWindowName("Unnamed"),
00080     fGLFrame(0),
00081     fGuiBox(0),
00082     fMainWindow(0),
00083     fFileMenu(0),
00084     fOptionsMenu(0),
00085     fTridControl(0),
00086     fAutoPOV(0,0,0,10,45,25),
00087     fFullPOV(0,0,0,10,45,25),
00088     fMint(0),
00089     fPageDisplay(0),
00090     fModels(),
00091     fColorHistogram(0),
00092     fTransHistogram(0),
00093     fViewMode(kViewNone),
00094     fCreateHistograms(true),
00095     fViewModesSupported( kView2D | kView3D  | kViewStereo  | kViewCrossEyed )
00096 {
00097   MSG("TriD",Msg::kFatal) << "Trid Copy Constructor used.. please don't." << endl;
00098 }

TridPage::~TridPage (  )  [virtual]

Definition at line 100 of file TridPage.cxx.

References TridModelList::Clear(), fModels, fTridControl, Msg::kDebug, and MSG.

00101 {
00102   MSG("TriD",Msg::kDebug) << "Destructor called" << endl;
00103 
00104   fModels.Clear();
00105   // This is now taken care of by the SigC::Ptr stuff.
00106   // if(fGLFrame) delete fGLFrame;
00107 
00108   //Unregister all the slot stuff.
00109   fTridControl->DisconnectTridPage(this);
00110 }


Member Function Documentation

void TridPage::AnimationHook (  )  [inline]

Definition at line 126 of file TridPage.h.

References AnimationRedraw().

Referenced by TridControl::ConnectTridPage().

00126 { this->AnimationRedraw(); };

void TridPage::AnimationRedraw (  )  [virtual]

Reimplemented in TridHistoPage.

Definition at line 529 of file TridPage.cxx.

References TridAnimator::AnimatingModels(), TridAnimator::AnimatingViews(), fGLFrame, Form(), fTridControl, fViewMode, fWindowName, TridAnimator::GetAnimTimeMax(), TridAnimator::GetAnimTimeMin(), TridAnimator::GetFrame(), TridAnimator::GetRangeMin(), TridAnimator::GetViewIncrement(), Msg::kDebug, kView2D, MSG, TridAnimator::Printing(), and PrintToFile().

Referenced by AnimationHook().

00530 {
00531   MSG("TriD",Msg::kDebug) << "TridPage::AnimationRedraw()" << endl;
00532 
00533   TridAnimator& ani = fTridControl->GetAnimator();
00534 
00535   // Animate view and objects in the view.
00536   // View animation takes the form of rotation in phi.
00537   fGLFrame->SetAnimTime(ani.GetAnimTimeMin(), 
00538                         ani.GetAnimTimeMax());
00539 
00540   if(ani.AnimatingViews()) {
00541     MSG("TriD",Msg::kDebug) << "Rotating from " << fGLFrame->fPOV.GetPhi() 
00542                             << "to " << fGLFrame->fPOV.GetPhi() + ani.GetViewIncrement()*360.
00543                             << endl;
00544     if(fViewMode != kView2D) {
00545       fGLFrame->fPOV.fPhi = (180. + ani.GetFrame()*ani.GetViewIncrement()*360.);
00546       fGLFrame->fPOV.Push();    
00547     }
00548   }
00549 
00550   if(ani.AnimatingModels()) {
00551     fGLFrame->SetHUDText(Form("Time: %.1f ns to %.1f ns",
00552                             1e9*(ani.GetAnimTimeMin()-ani.GetRangeMin()),
00553                             1e9*(ani.GetAnimTimeMax()-ani.GetRangeMin())));
00554   }
00555   
00556   fGLFrame->Update();
00557 
00558   if(ani.Printing()) {
00559     PrintToFile(Form("anim_%s_%04d.png",fWindowName.Data(),ani.GetFrame()),
00560                 Form("Time: %.1f ns to %.1f ns",
00561                      1e9*(ani.GetAnimTimeMin()-ani.GetRangeMin()),
00562                      1e9*(ani.GetAnimTimeMax()-ani.GetRangeMin()))
00563                 );
00564   }
00565 }

void TridPage::AutoZoom (  )  [virtual]

Reimplemented from PageABC.

Definition at line 476 of file TridPage.cxx.

References fAutoPOV, and SetPOV().

00477 {
00478   SetPOV(fAutoPOV);
00479 }

void TridPage::ChangeColor (  )  [virtual]

Reimplemented in TridTransHistoPage.

Definition at line 501 of file TridPage.cxx.

References fGLFrame, and ModifySketches().

Referenced by ChangeColorHook().

00502 {
00503   ModifySketches();
00504   fGLFrame->Update();
00505 }

void TridPage::ChangeColorHook (  )  [inline]

Definition at line 122 of file TridPage.h.

References ChangeColor().

Referenced by TridControl::ConnectTridPage().

00122 { this->ChangeColor(); };

void TridPage::ChangeHistograms (  )  [virtual]

Reimplemented in TridHistoPage.

Definition at line 525 of file TridPage.cxx.

Referenced by ChangeHistogramsHook().

00526 {
00527 }

void TridPage::ChangeHistogramsHook (  )  [inline]

Definition at line 127 of file TridPage.h.

References ChangeHistograms().

Referenced by TridControl::ConnectTridPage().

00127 { this->ChangeHistograms(); };

void TridPage::ChangePicked (  )  [virtual]

Reimplemented in TridHistoPage.

Definition at line 513 of file TridPage.cxx.

References fGLFrame, and ModifySketches().

Referenced by ChangePickedHook().

00514 {
00515   ModifySketches();
00516   fGLFrame->Update();
00517 }

void TridPage::ChangePickedHook (  )  [inline]

Definition at line 124 of file TridPage.h.

References ChangePicked().

Referenced by TridControl::ConnectTridPage().

00124 { this->ChangePicked(); };

void TridPage::ChangeSelected (  )  [virtual]

Definition at line 519 of file TridPage.cxx.

References fGLFrame, and ModifySketches().

Referenced by ChangeSelectedHook().

00520 {
00521   ModifySketches();
00522   fGLFrame->Update();
00523 }

void TridPage::ChangeSelectedHook (  )  [inline]

Definition at line 125 of file TridPage.h.

References ChangeSelected().

Referenced by TridControl::ConnectTridPage().

00125 { this->ChangeSelected(); };

void TridPage::ChangeTrans (  )  [virtual]

Reimplemented in TridTransHistoPage.

Definition at line 507 of file TridPage.cxx.

References fGLFrame, and ModifySketches().

Referenced by ChangeTransHook().

00508 {
00509   ModifySketches();
00510   fGLFrame->Update();
00511 }

void TridPage::ChangeTransHook (  )  [inline]

Definition at line 123 of file TridPage.h.

References ChangeTrans().

Referenced by TridControl::ConnectTridPage().

00123 { this->ChangeTrans(); };

void TridPage::Clear ( Option_t *   )  [inline, private]

Definition at line 180 of file TridPage.h.

00180 {};

void TridPage::Clear ( void   )  [virtual]

Implement to respond to a new record read in, the actual record is accessible in the subsequent Update() call.

Reimplemented from PageABC.

Definition at line 342 of file TridPage.cxx.

References TridModelList::Clear(), fGLFrame, fModels, Msg::kDebug, and MSG.

00343 {
00344   MSG("TriD",Msg::kDebug) << "TridPage::Clear()" << endl;
00345   fModels.Clear();
00346   if(fGLFrame) fGLFrame->DeleteSketches();
00347 }

void TridPage::CreateModels (  )  [virtual]

Reimplemented in TridCratePage, TridHistoPage, TridTransHistoPage, TridPageDetector, TridPageSlice, TridPmtPage, and TridUVPage.

Definition at line 349 of file TridPage.cxx.

Referenced by Update().

00350 {
00351 }

TridGLFrame * TridPage::CreateNewGLFrame ( TridPage::ViewMode_t  mode  )  [virtual]

Reimplemented in TridCratePage, TridHistoPage, TridTransHistoPage, TridPageSlice, TridPmtPage, and TridUVPage.

Definition at line 262 of file TridPage.cxx.

References fGuiBox, fTridControl, Msg::kDebug, kView2D, kViewBlueRed, kViewCrossEyed, kViewRedBlue, kViewStereo, and MSG.

Referenced by SetupFrame().

00263 {
00264   if(mode==kView2D) {
00265     MSG("TriD",Msg::kDebug) << "Changing to 2D" << endl;
00266     return new TridFlatGLFrame(this,*fGuiBox,fTridControl);
00267   } 
00268   if ( mode == kViewStereo) {
00269     MSG("TriD",Msg::kDebug)  << "Changing to Stereoscopic" << endl;
00270     return new TridStereoGLFrame(this,*fGuiBox,fTridControl,-1);   
00271   }
00272   if ( mode == kViewCrossEyed) {
00273     MSG("TriD",Msg::kDebug) << "Changing to Crosseyed" << endl;
00274     return new TridStereoGLFrame(this,*fGuiBox,fTridControl,1);   
00275   }
00276   if ( mode == kViewRedBlue) {
00277     MSG("TriD",Msg::kDebug) << "Changing to Red/Blue glasses mode" << endl;
00278     return new TridAnaglyphGLFrame(this,*fGuiBox,fTridControl,-1);   
00279   }
00280   if ( mode == kViewBlueRed) {
00281     MSG("TriD",Msg::kDebug) << "Changing to Blue/Red glasses mode" << endl;
00282     return new TridAnaglyphGLFrame(this,*fGuiBox,fTridControl,1);   
00283   }
00284 
00285   
00286   MSG("TriD",Msg::kDebug)  << "Changing to 3D" << endl;
00287   return new TridGLFrame(this,*fGuiBox,fTridControl);
00288 }

void TridPage::CreateScenery (  )  [virtual]

Reimplemented in TridCratePage, TridHistoPage, TridPageDetector, TridPageSlice, TridPmtPage, and TridUVPage.

Definition at line 358 of file TridPage.cxx.

Referenced by Update().

00359 {
00360 }

void TridPage::CreateSketches (  )  [virtual]

Reimplemented in TridCratePage, TridHistoPage, TridPageDetector, TridPageSlice, TridPmtPage, and TridUVPage.

Definition at line 353 of file TridPage.cxx.

Referenced by Update().

00354 {
00355 }

void TridPage::FullZoom ( void   )  [virtual]

Reimplemented from PageABC.

Definition at line 471 of file TridPage.cxx.

References fFullPOV, and SetPOV().

Referenced by TridPageDetector::SnapToEndOnOrthoView().

00472 {
00473   SetPOV(fFullPOV);
00474 }

TVector3 TridPage::GetColor ( Float_t  x  )  [virtual]

Definition at line 292 of file TridPage.cxx.

References n.

Referenced by TridPageSlice::SliceColor().

00293 {
00294   // Map a fractional number x to a place in the current pallete.
00295   int n = gStyle->GetNumberOfColors();
00296   int index = (int)(x*(float)n);
00297   if(index>=n) index = n-1;
00298   if(index<0) index = 0;
00299   int colNum = gStyle->GetColorPalette(index);
00300   TColor* colref = gROOT->GetColor(colNum);
00301   TVector3 rgb(colref->GetRed(),colref->GetGreen(),colref->GetBlue());
00302   return rgb;
00303 }

TObject * TridPage::Init ( Mint mint,
PageDisplay pd,
GuiBox box 
) [virtual]

Implement to fill box with whatever your page displays. If the page wishes to return a class to the initializer, then return an object which inherits from TObject, o.w. just return 0.

Implements PageABC.

Reimplemented in TridCratePage, TridHistoPage, TridTransHistoPage, TridPageDetector, TridPageSlice, TridPmtPage, and TridUVPage.

Definition at line 112 of file TridPage.cxx.

References GuiCompositeFrameBase::Add(), GuiMenu::Add(), GuiMenuBar::AddMenu(), GuiMenu::CheckEntry(), fColorHistogram, fCreateHistograms, fFileMenu, fGuiBox, fMainWindow, fMenuBar, fMint, fOptionsMenu, fPageDisplay, fTransHistogram, fTridControl, fViewMode, fViewModesSupported, fWindowName, TridControl::Instance(), Msg::kDebug, kView2D, kView3D, kViewBlueRed, kViewCrossEyed, kViewRedBlue, kViewStereo, MSG, Print(), SetupFrame(), GuiCompositeFrameBase::Show(), and ViewMenuHandler().

00113 {
00114   //MsgService::Instance()->GetStream("TriD")->SetLogLevel(Msg::kDebug);
00115   MSG("TriD",Msg::kDebug) << "TridPage: Init()" << endl;
00116 
00117   fMint = mint;
00118   fPageDisplay = pd;
00119  
00120   fMenuBar = manage(new GuiMenuBar(box));
00121   box.Add(*fMenuBar);
00122 
00123   fFileMenu = manage(new GuiMenu);
00124   fMenuBar->AddMenu(*fFileMenu,"File");
00125 
00126   fOptionsMenu = manage(new GuiMenu);
00127   fMenuBar->AddMenu(*fOptionsMenu,"Options");
00128   
00129   fGuiBox = manage(new GuiBox(box,kVerticalFrame,100,100));
00130   box.Add(*fGuiBox);
00131   box.Show(*fGuiBox);
00132   fMainWindow = dynamic_cast<TGWindow*>(&box);
00133   assert(fMainWindow);
00134 
00135 
00136   // Get the master Control object. Register with it.
00137   fTridControl = TridControl::Instance(pd);
00138   assert(fTridControl);
00139   fTridControl->ConnectTridPage(this);
00140 
00141   // Create and register histograms.
00142   if(fCreateHistograms) {
00143     char buff[100];
00144     sprintf(buff,"%s_Color",fWindowName.Data());
00145     fColorHistogram = new TH1F(buff,buff,50,0,1);
00146     sprintf(buff,"%s_Trans",fWindowName.Data());
00147     fTransHistogram = new TH1F(buff,buff,50,0,1);
00148     fTridControl->AddHistograms(fWindowName.Data(),fColorHistogram,fTransHistogram);
00149   }
00150 
00151   // Add stuff to File menu.
00152 
00153   GuiMenu::GuiMenuList::iterator mit;
00154   mit = fFileMenu->Add("Print");
00155   (*mit)->Connect(slot_class(*this,&TridPage::Print));
00156   
00157 
00158   // Views submenu in the Options menu
00159   MSG("TriD",Msg::kDebug)<< "Supported modes: " << fViewModesSupported << endl;
00160   if(fViewModesSupported >0) {
00161     GuiMenu* viewmenu = manage(new GuiMenu);
00162     fOptionsMenu->Add("View",*viewmenu);
00163     
00164     if(fViewModesSupported & kView2D) {
00165       mit = viewmenu->Add("2D View (Orthographic)");
00166       (*mit)->Connect(bind(bind(bind(slot_class(*this,&TridPage::ViewMenuHandler),
00167                                      kView2D) ,mit) ,viewmenu));
00168       if(fViewMode == kView2D) viewmenu->CheckEntry(mit);
00169     }
00170 
00171     if(fViewModesSupported & kView3D) {
00172       mit = viewmenu->Add("3D View");
00173       (*mit)->Connect(bind(bind(bind(slot_class(*this,&TridPage::ViewMenuHandler),
00174                                      kView3D) ,mit) ,viewmenu));
00175       if(fViewMode == kView3D) viewmenu->CheckEntry(mit);
00176     }
00177 
00178     if(fViewModesSupported & kViewStereo) {
00179       mit = viewmenu->Add("Stereoscopic");
00180       (*mit)->Connect(bind(bind(bind(slot_class(*this,&TridPage::ViewMenuHandler),
00181                                      kViewStereo) ,mit) ,viewmenu));
00182       if(fViewMode == kViewStereo) viewmenu->CheckEntry(mit);
00183     }
00184     
00185     if(fViewModesSupported & kViewCrossEyed) {
00186       mit = viewmenu->Add("Cross-Eyed");
00187       (*mit)->Connect(bind(bind(bind(slot_class(*this,&TridPage::ViewMenuHandler),
00188                                      kViewCrossEyed) ,mit) ,viewmenu));
00189       if(fViewMode == kViewCrossEyed) viewmenu->CheckEntry(mit);
00190     }
00191   
00192     if(fViewModesSupported & kViewRedBlue) {
00193       mit = viewmenu->Add("Red-Blue Glasses");
00194       (*mit)->Connect(bind(bind(bind(slot_class(*this,&TridPage::ViewMenuHandler),
00195                                      kViewRedBlue) ,mit) ,viewmenu));
00196       if(fViewMode == kViewRedBlue) viewmenu->CheckEntry(mit);
00197     }
00198 
00199     if(fViewModesSupported & kViewBlueRed) {
00200       mit = viewmenu->Add("Blue-Red Glasses");
00201       (*mit)->Connect(bind(bind(bind(slot_class(*this,&TridPage::ViewMenuHandler),
00202                                      kViewBlueRed) ,mit) ,viewmenu));
00203       if(fViewMode == kViewBlueRed) viewmenu->CheckEntry(mit);
00204     }
00205   }
00206 
00207   SetupFrame( fViewMode );  
00208   return this;
00209 }

void TridPage::ModifySketches (  )  [virtual]

Reimplemented in TridHistoPage, TridPageDetector, TridPageSlice, TridPmtPage, and TridUVPage.

Definition at line 362 of file TridPage.cxx.

References fColorHistogram, fGLFrame, fModels, fTransHistogram, fTridControl, TridModelList::GetModelFromSketch(), Msg::kError, MSG, and TridSketchListItr::Next().

Referenced by ChangeColor(), ChangePicked(), ChangeSelected(), ChangeTrans(), and TridCratePage::CreateSketches().

00363 {
00364   // Go through all models. Modify they sketches to match the current
00365   // transparency and color maps.
00366 
00367   fColorHistogram->Reset();
00368   fTransHistogram->Reset();
00369 
00370   int nsketches =0;
00371 
00372   TridSketchListItr itr = fGLFrame->GetIterator();
00373   while( TridSketch* sketch = itr.Next() ) {
00374     int sketchnum = sketch->GetId();
00375     TridModel* model = fModels.GetModelFromSketch(sketchnum);
00376     
00377     if((sketch)&&(model)) {
00378       nsketches++;
00379       // Get color and trans as number between 0 and 1,
00380       // interpolated in our current scale.
00381       Double_t color_x = fTridControl->GetRangedModelColor(model);
00382       Double_t trans_x = fTridControl->GetRangedModelTrans(model);
00383 
00384       // Modify the sketch.
00385       sketch->SetColor(fTridControl->GetColor(color_x));
00386       sketch->SetTransparency(trans_x);
00387 
00388       // Turn on/off the sketch.
00389       sketch->SetDrawn(true);
00390       if(color_x<0)
00391         if(!fTridControl->ShowColorUnderScale())
00392            sketch->SetDrawn(false);
00393 
00394       if(color_x>1)
00395         if(!fTridControl->ShowColorOverScale())
00396            sketch->SetDrawn(false);
00397 
00398       // If picked, shine as white.
00399       if(fTridControl->IsPicked(model))
00400         sketch->SetColor(1,1,1);
00401 
00402       // Ditto selected.
00403       if(fTridControl->IsSelected(model))
00404         sketch->SetColor(1,1,1);
00405 
00406       // Fill our histograms.
00407       fColorHistogram->Fill(color_x);
00408       fTransHistogram->Fill(trans_x);
00409     } else {
00410       MSG("TriD",Msg::kError) << "Cannot find sketch or model, model number " << model
00411                               << "  ModelAdd: "     << model 
00412                               << "  SketchNumber: " << sketchnum
00413                               << "  SketchAddr:   " << sketch << endl;
00414     }
00415   }
00416 }

void TridPage::MouseClick ( int  sketchname  )  [virtual]

Definition at line 440 of file TridPage.cxx.

References fModels, fTridControl, and TridModelList::GetModelFromSketch().

Referenced by TridGLFrame::HandleButton().

00441 {
00442   TridModel* model = fModels.GetModelFromSketch(sketchname);
00443   if(model) {
00444     fTridControl->ToggleSelected(model);
00445     fTridControl->ChangeSelected();
00446   }
00447 }

void TridPage::MouseOver ( int  sketchname  )  [virtual]

Definition at line 418 of file TridPage.cxx.

References fModels, fTridControl, TridModelList::GetModelFromSketch(), TridModel::Print(), and SelectionInfoPage::SetText().

Referenced by TridGLFrame::HandleMotion(), and TridFlatGLFrame::HandleMotion().

00419 {
00420   static int lastmouseover;
00421   if(sketchname!=lastmouseover) {
00422     //DigitText* dt = fPageDisplay->GetDigitText();
00423     SelectionInfoPage* selInfo = fTridControl->GetSelectionInfoPage();
00424     TridModel* model = fModels.GetModelFromSketch(sketchname);
00425     
00426     fTridControl->ClearPicked();
00427     if(model) {
00428       //if(dt) model->PrintToDigitText(dt);
00429       fTridControl->SetPicked(model);
00430       stringstream oss;
00431       model->Print(oss);
00432       std::string s = oss.str();
00433       if(selInfo) selInfo->SetText(s);
00434     }
00435     fTridControl->ChangePicked();
00436   }
00437   lastmouseover = sketchname;
00438 }

virtual void TridPage::operator= ( const TridPage  )  [inline, protected, virtual]

Definition at line 184 of file TridPage.h.

00184 {}; // Hide compiler/CINT problems.

double TridPage::PlaceInBox ( double  boxwidth,
double  width,
int  i = 0,
int  n = 1 
) [virtual]

Definition at line 488 of file TridPage.cxx.

Referenced by TridCratePage::ChannelToCoords(), TridPmtPage::OffsetPmtIntoRack_FD(), and TridPmtPage::OffsetPmtIntoRack_ND().

00489 {
00490   // Utility function for placing things.
00491   // Find the left most edge of a box of width
00492   // placed in a larger box of boxwidth
00493   // if there are n such boxes to go in evenly
00494   // and this is the ith such box.
00495 
00496   double d = (boxwidth - (double)(n)*width)/(double)(n+1);
00497   return d+ (double)(i)*(d+width);
00498 }

void TridPage::Print (  )  [virtual]

Implement to print your display.

Implements PageABC.

Definition at line 449 of file TridPage.cxx.

References Form(), fWindowName, and PrintToFile().

Referenced by Init().

00450 {
00451   this->PrintToFile(Form("snapshot_%s.png",fWindowName.Data()));
00452 }

void TridPage::PrintToFile ( const char *  filename,
const char *  text = "" 
) [virtual]

Definition at line 454 of file TridPage.cxx.

References fGLFrame.

Referenced by AnimationRedraw(), and Print().

00455 {
00456   fGLFrame->Print(filename, text);
00457 }

void TridPage::RestoreWindowGeometry ( TEnv &  env  )  [virtual]

Definition at line 613 of file TridPage.cxx.

References fGuiBox, Form(), fWindowName, Msg::kDebug, MSG, and root().

Referenced by TridControl::ConnectTridPage().

00614 {
00615   if(fGuiBox!=0) {
00616     Window_t wind = (Window_t)(gVirtualX->GetParent(fGuiBox->GetId()));
00617     Window_t root = (Window_t)gClient->GetRoot()->GetId();
00618     Window_t frame = wind;
00619     Window_t parent = wind;
00620     while( (parent != root) && (parent) ) {
00621       frame = parent;
00622       parent = gVirtualX->GetParent(parent);
00623     }
00624 
00625     Int_t x,y;
00626     UInt_t w,h;
00627     WindowAttributes_t attr;
00628     gVirtualX->GetWindowAttributes(frame,attr);
00629     x = attr.fX;
00630     y = attr.fY;
00631     w = attr.fWidth;
00632     h = attr.fHeight;
00633     
00634     TString newname(fWindowName);
00635     newname.ReplaceAll(" ","_");
00636     const char* value = env.GetValue(Form("Trid.WindowGeom.%s",newname.Data()),
00637                                        "");
00638     
00639     MSG("TriD",Msg::kDebug) << "Restoring geometry " << Form("Trid.WindowGeom.%s",newname.Data())
00640                             << endl;
00641 
00642     if(strlen(value)>0) {
00643       sscanf(value,"%ux%u+%d+%d",&w,&h,&x,&y);      
00644       MSG("TriD",Msg::kDebug) << "----> Got Value " << value << endl;
00645       
00646       gVirtualX->MoveResizeWindow(frame,x,y,w,h);
00647     }
00648   }
00649 }

void TridPage::Rezoom ( void   )  [virtual]

Reimplemented from PageABC.

Definition at line 465 of file TridPage.cxx.

References fGLFrame.

00466 {
00467   fGLFrame->fPOV.Redo();
00468   fGLFrame->Update();
00469 }

void TridPage::SaveWindowGeometry ( TEnv &  env  )  [virtual]

Definition at line 567 of file TridPage.cxx.

References fGuiBox, Form(), fWindowName, Msg::kDebug, MSG, and root().

Referenced by TridControl::ConnectTridPage().

00568 {
00569   // Save the window geometry info into the given TEnv.
00570 
00571   TString newname(fWindowName);
00572   newname.ReplaceAll(" ","_");
00573 
00574   // First, just save the fact that the window exists.
00575   // That is, prepend it to the DefaultWindows variable.
00576   env.SetValue("Trid.DefaultWindows",
00577                Form("%s %s",newname.Data(),env.GetValue("Trid.DefaultWindows",""))
00578                ,kEnvChange); // Set up null string.
00579  
00580   
00581   Int_t x,y;
00582   UInt_t w,h;
00583   if(fGuiBox!=0) {
00584     Window_t wind = (Window_t)(gVirtualX->GetParent(fGuiBox->GetId()));
00585     Window_t root = (Window_t)gClient->GetRoot()->GetId();
00586     Window_t frame = wind;
00587     Window_t parent = wind;
00588     while( (parent != root) && (parent) ) {
00589       frame = parent;
00590       parent = gVirtualX->GetParent(parent);
00591      }
00592     WindowAttributes_t attr;
00593     gVirtualX->GetWindowAttributes(frame,attr);
00594     x = attr.fX;
00595     y = attr.fY;
00596     w = attr.fWidth;
00597     h = attr.fHeight;
00598     //cout << "XWinAttributes (frame)" << attr.fX << " " << attr.fY << endl;
00599     
00600     env.SetValue(
00601                  Form("Trid.WindowGeom.%s",newname.Data()),
00602                  Form("%dx%d+%d+%d",w,h,x,y),
00603                  kEnvChange);
00604     MSG("TriD",Msg::kDebug)
00605       << "Setting env variable: " 
00606       << Form("Trid.WindowGeom.%s",newname.Data())
00607       << "\t=\t" 
00608       << Form("%dx%d+%d+%d",w,h,x,y) 
00609       << endl;
00610   }
00611 }

void TridPage::SetPOV ( TridPOV newPOV  )  [virtual]

Definition at line 482 of file TridPage.cxx.

References fGLFrame.

Referenced by AutoZoom(), FullZoom(), and TridPageDetector::SnapToEndOnOrthoView().

00483 {
00484   fGLFrame->SetPOV(pov);
00485   fGLFrame->Update();
00486 }

void TridPage::SetupFrame ( TridPage::ViewMode_t  mode  )  [virtual]

Definition at line 224 of file TridPage.cxx.

References TridSketchList::AddSketchList(), TridPOV::Copy(), CreateNewGLFrame(), fFullPOV, fGLFrame, fGuiBox, fPageDisplay, fViewMode, TridSketchList::GetIterator(), TridSketchListItr::Next(), TridSketch::SetDirty(), and PageDisplay::UpdateGui().

Referenced by Init(), TridPageDetector::SnapToEndOnOrthoView(), and ViewMenuHandler().

00225 {
00226   // Make a copy of the sketch list to save.
00227   TridSketchList oldList;
00228   TridPOV oldPOV;
00229 
00230   if(fGLFrame) {
00231     oldList.AddSketchList(*fGLFrame);
00232     TridSketchListItr itr = oldList.GetIterator();
00233     TridSketch* sketch;
00234     while( (sketch = itr.Next()) ){
00235       sketch->SetDirty();
00236     }
00237 
00238     oldPOV.Copy(fGLFrame->fPOV);
00239     fGLFrame->ClearSketches();
00240     fGuiBox->Remove(*fGLFrame);  
00241     fGLFrame = 0;              // This should delete it.
00242  
00243     // Ensure the list is now drawn correctly.
00244   }
00245 
00246   fViewMode = mode;  
00247   fGLFrame = SigC::manage(CreateNewGLFrame(fViewMode));    
00248   fGuiBox->Add(*fGLFrame); 
00249   fGuiBox->Show(*fGLFrame); 
00250   fPageDisplay->UpdateGui();
00251 
00252   fGLFrame->AddSketchList(oldList);
00253   fGLFrame->fPOV.Copy(oldPOV);
00254 
00255   
00256   fGLFrame->SetupProjection();
00257   fGLFrame->SetPOV(fFullPOV);
00258   fGLFrame->Update();      
00259   
00260 }

void TridPage::Unzoom ( void   )  [virtual]

Reimplemented from PageABC.

Definition at line 459 of file TridPage.cxx.

References fGLFrame.

00460 {
00461   fGLFrame->fPOV.Undo();
00462   fGLFrame->Update();
00463 }

void TridPage::Update ( void   )  [virtual]

Implement to respond to a change in the data.

Reimplemented from PageABC.

Definition at line 306 of file TridPage.cxx.

References TridModelList::Clear(), CreateModels(), CreateScenery(), CreateSketches(), fContext, fGLFrame, fMint, fModels, fTridControl, VldContext::GetDetector(), Mint::GetJobC(), GetVldContext(), Msg::kDebug, Msg::kError, Detector::kFar, Munits::microsecond, JobC::Mom, and MSG.

Referenced by TridUVPage::Init().

00307 {
00308   MSG("TriD",Msg::kDebug) << "TridPage::Update()" << endl;
00309   assert(fMint);
00310   
00311    // Get detector type.
00312   std::vector<VldContext> contexts =  DataUtil::GetVldContext(&(fMint->GetJobC().Mom));
00313   if(contexts.size() ==0 ) {
00314     MSG("TriD",Msg::kError) << "No VldContext of any kind in Mom. Have you loaded a valid data file?" << std:: endl;
00315     return;
00316   }
00317   fContext = contexts[0];
00318 
00319   fTridControl->ClearPicked(); // Make sure it's all clear before rebuilding.
00320   fTridControl->ClearSelected();
00321 
00322   // Set the suggested time range.
00323   double tmin = -2*Munits::microsecond; //fContext.GetTimeStamp().GetNanoSec()*Munits::ns;
00324   double tmax = tmin + 15*Munits::microsecond;
00325 
00326   if(fContext.GetDetector()==Detector::kFar) {
00327     tmin = 0;//50*Munits::microsecond;
00328     tmax = 100*Munits::microsecond;
00329   }
00330   fTridControl->GetAnimator().SetTimeRange(tmin,tmax);
00331 
00332   fModels.Clear();
00333   CreateModels();
00334 
00335   fGLFrame->DeleteSketches();
00336   CreateSketches();
00337   CreateScenery();
00338   
00339   fGLFrame->Update();
00340 }

void TridPage::ViewMenuHandler ( GuiMenu menu,
GuiMenu::GuiMenuList::iterator  mit,
TridPage::ViewMode_t  mode 
) [virtual]

Definition at line 211 of file TridPage.cxx.

References GuiMenu::CheckEntry(), done(), fViewMode, GuiMenu::GetMenuList(), it, and SetupFrame().

Referenced by Init().

00213 {
00214   GuiMenu::GuiMenuList& mlist = menu->GetMenuList();
00215   GuiMenu::GuiMenuList::iterator it, done = mlist.end();
00216   for (it = mlist.begin(); it != done; ++it)
00217     menu->CheckEntry(it,false);
00218   menu->CheckEntry(mit,true);
00219   if(fViewMode!=mode)
00220     SetupFrame(mode);
00221 }


Member Data Documentation

TH1* TridPage::fColorHistogram [protected]
Bool_t TridPage::fCreateHistograms [protected]

Definition at line 175 of file TridPage.h.

Referenced by Init(), and TridHistoPage::TridHistoPage().

SigC::Ptr<GuiMenu> TridPage::fFileMenu [protected]

Definition at line 146 of file TridPage.h.

Referenced by Init().

SigC::Ptr<TridGLFrame> TridPage::fGLFrame [protected]
SigC::Ptr<GuiBox> TridPage::fGuiBox [protected]
TGWindow* TridPage::fMainWindow [protected]

Definition at line 145 of file TridPage.h.

Referenced by Init().

Definition at line 151 of file TridPage.h.

Referenced by Init().

Mint* TridPage::fMint [protected]
SigC::Ptr<GuiMenu> TridPage::fOptionsMenu [protected]

Definition at line 161 of file TridPage.h.

Referenced by TridTransHistoPage::Init(), TridHistoPage::Init(), Init(), and SetupFrame().

SigC::Ptr<GuiBox> TridPage::fSubBox [protected]

Definition at line 144 of file TridPage.h.

TH1* TridPage::fTransHistogram [protected]
SigC::Ptr<TridControl> TridPage::fTridControl [protected]
Int_t TridPage::fViewModesSupported [protected]
TString TridPage::fWindowName [protected]

The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1