All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
evd::Ortho3DView Class Reference

View of event shoing orthographic view of 3D objects. More...

#include <Ortho3DView.h>

Inheritance diagram for evd::Ortho3DView:

Public Member Functions

 Ortho3DView (TGMainFrame *mf)
 
virtual ~Ortho3DView ()
 
const char * Description () const
 
const char * PrintTag () const
 
void Draw (const char *opt="")
 

Private Attributes

std::vector< Ortho3DPad * > fOrtho3DPads
 Graphics pads. More...
 
TGCompositeFrame * fMetaFrame
 Frame holding root canvas and widget frame. More...
 
TGCompositeFrame * fWidgetFrame
 Frame holding widgets. More...
 
std::vector< TGCompositeFrame * > fWidgetSubFrames
 

Detailed Description

View of event shoing orthographic view of 3D objects.

Definition at line 21 of file Ortho3DView.h.

Constructor & Destructor Documentation

evd::Ortho3DView::Ortho3DView ( TGMainFrame *  mf)

Definition at line 22 of file Ortho3DView.cxx.

22  :
23  evdb::Canvas(mf)
24 {
25  // Remove everything that's in the main frame by default.
26 
27  mf->RemoveFrame(fEmbCanvas);
28  mf->RemoveFrame(fFrame);
29 
30  // Make meta frame to hold graphics pad and our widgets.
31 
32  fMetaFrame = new TGHorizontalFrame(mf);
33 
34  // Refill main frame, replacing root canvas with meta frame.
35 
36  mf->AddFrame(fMetaFrame, fLayout);
37  mf->AddFrame(fFrame);
38 
39  // Add two frames inside the meta frame.
40  // Add a vertical frame on the left to hold our widgets.
41  // Add root canvas on the right.
42 
43  fWidgetFrame = new TGVerticalFrame(fMetaFrame);
44  fEmbCanvas->ReparentWindow(fMetaFrame);
45  fMetaFrame->AddFrame(fWidgetFrame, new TGLayoutHints(kLHintsTop |
46  kLHintsLeft |
47  kLHintsExpandY));
48  fMetaFrame->AddFrame(fEmbCanvas, fLayout);
49 
50  // Make vertically stacked subpads and widget subframes.
51 
52  int npad = 2;
53  for(int ipad = 0; ipad < npad; ++ipad) {
54  evdb::Canvas::fCanvas->cd();
56  std::string projname;
57  switch (ipad) {
58  case 0:
59  proj = kXZ;
60  projname = "XZ";
61  break;
62  case 1:
63  proj = kYZ;
64  projname = "YZ";
65  break;
66  default:
67  throw cet::exception("Ortho3DView")
68  << __func__ << ": unknown projection pad " << ipad << "\n";
69  } // switch
70 
71  std::string padname = std::string("Ortho3DPad") + projname;
72  std::string padtitle = projname + std::string(" View");
73  double ylo = double(npad - ipad - 1) / double(npad);
74  double yhi = double(npad - ipad) / double(npad);
75  Ortho3DPad* pad = new Ortho3DPad(padname.c_str(), padtitle.c_str(),
76  proj, 0.0, ylo, 1.0, yhi);
77  fOrtho3DPads.push_back(pad);
78 
79  // Add subframe for this pad's widgets.
80 
81  TGCompositeFrame* wframe = new TGVerticalFrame(fWidgetFrame);
82  fWidgetSubFrames.push_back(wframe);
83  fWidgetFrame->AddFrame(wframe, new TGLayoutHints(kLHintsTop |
84  kLHintsLeft |
85  kLHintsExpandY));
86 
87  // Add widgets.
88 
89  // Label.
90 
91  TGLabel* label = new TGLabel(wframe, padtitle.c_str());
92  wframe->AddFrame(label, new TGLayoutHints(kLHintsTop | kLHintsLeft,
93  5, 5, 5, 1));
94 
95  // Unzoom button.
96 
97  TGTextButton* unzoom = new TGTextButton(wframe, "&Unzoom");
98  wframe->AddFrame(unzoom, new TGLayoutHints(kLHintsTop | kLHintsLeft,
99  5, 5, 5, 1));
100  unzoom->Connect("Clicked()", "evd::Ortho3DPad", pad,
101  "UnZoom(=true)");
102 
103  // Marker size entry.
104 
105  TGCompositeFrame* msize_frame = new TGHorizontalFrame(wframe);
106  wframe->AddFrame(msize_frame, new TGLayoutHints(kLHintsTop | kLHintsLeft,
107  5, 5, 5, 1));
108  int val = pad->GetMarkerSize();
109  TGNumberEntry* msize_entry = new TGNumberEntry(msize_frame, val, 3, -1,
110  TGNumberFormat::kNESInteger,
111  TGNumberFormat::kNEANonNegative,
112  TGNumberFormat::kNELLimitMin, 1.);
113  msize_frame->AddFrame(msize_entry);
114  pad->SetMSizeEntry(msize_entry);
115 
116  TGLabel* msize_label = new TGLabel(msize_frame, "Marker Size");
117  msize_frame->AddFrame(msize_label,
118  new TGLayoutHints(kLHintsTop | kLHintsLeft,
119  5, 0, 0, 1));
120  msize_entry->Connect("ValueSet(Long_t)", "evd::Ortho3DPad", pad,
121  "SetMSize()");
122  }
123 
124  // Draw everything and update canvas.
125 
126  Draw();
127  evdb::Canvas::fCanvas->Update();
128 }
OrthoProj_t
Definition: OrthoProj.h:12
void Draw(const char *opt="")
TGCompositeFrame * fMetaFrame
Frame holding root canvas and widget frame.
Definition: Ortho3DView.h:46
std::vector< TGCompositeFrame * > fWidgetSubFrames
Definition: Ortho3DView.h:48
TGCompositeFrame * fWidgetFrame
Frame holding widgets.
Definition: Ortho3DView.h:47
std::vector< Ortho3DPad * > fOrtho3DPads
Graphics pads.
Definition: Ortho3DView.h:42
evd::Ortho3DView::~Ortho3DView ( )
virtual

Definition at line 132 of file Ortho3DView.cxx.

133 {
134 }

Member Function Documentation

const char* evd::Ortho3DView::Description ( ) const
inline

Definition at line 32 of file Ortho3DView.h.

32 { return "Orthographic 3D Detector Display"; }
void evd::Ortho3DView::Draw ( const char *  opt = "")

Definition at line 138 of file Ortho3DView.cxx.

139 {
140  for(std::vector<Ortho3DPad*>::const_iterator i = fOrtho3DPads.begin();
141  i != fOrtho3DPads.end(); ++i) {
142  Ortho3DPad* pad = *i;
143  pad->Draw();
144  }
145 }
std::vector< Ortho3DPad * > fOrtho3DPads
Graphics pads.
Definition: Ortho3DView.h:42
const char* evd::Ortho3DView::PrintTag ( ) const
inline

Definition at line 33 of file Ortho3DView.h.

33 { return "larortho3d"; }

Member Data Documentation

TGCompositeFrame* evd::Ortho3DView::fMetaFrame
private

Frame holding root canvas and widget frame.

Definition at line 46 of file Ortho3DView.h.

std::vector<Ortho3DPad*> evd::Ortho3DView::fOrtho3DPads
private

Graphics pads.

Definition at line 42 of file Ortho3DView.h.

TGCompositeFrame* evd::Ortho3DView::fWidgetFrame
private

Frame holding widgets.

Definition at line 47 of file Ortho3DView.h.

std::vector<TGCompositeFrame*> evd::Ortho3DView::fWidgetSubFrames
private

Definition at line 48 of file Ortho3DView.h.


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