CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends
FW3DViewDistanceMeasureTool Class Reference

#include <FW3DViewDistanceMeasureTool.h>

Public Types

enum  EPickAction { kPnt1, kPnt2, kNone }
 

Public Member Functions

TGCompositeFrame * buildGUI (TGCompositeFrame *p)
 
 FW3DViewDistanceMeasureTool ()
 
void Print () const
 
TGLVector3 & refCurrentVertex ()
 
void resetAction ()
 
void setActionPnt1 ()
 
void setActionPnt2 ()
 
virtual ~FW3DViewDistanceMeasureTool ()
 

Protected Attributes

EPickAction m_action
 
TGLVector3 m_pnt1
 
TGLVector3 m_pnt2
 

Private Member Functions

 ClassDef (FW3DViewDistanceMeasureTool, 0)
 

Private Attributes

TGTextButton * m_bp1
 
TGTextButton * m_bp2
 
TGLabel * m_ldist
 
TGLabel * m_lp1
 
TGLabel * m_lp2
 

Friends

class FW3DViewBase
 

Detailed Description

Definition at line 10 of file FW3DViewDistanceMeasureTool.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

FW3DViewDistanceMeasureTool::FW3DViewDistanceMeasureTool ( )
virtual FW3DViewDistanceMeasureTool::~FW3DViewDistanceMeasureTool ( )
inlinevirtual

Definition at line 17 of file FW3DViewDistanceMeasureTool.h.

17 {};

Member Function Documentation

TGCompositeFrame * FW3DViewDistanceMeasureTool::buildGUI ( TGCompositeFrame *  p)

Definition at line 70 of file FW3DViewDistanceMeasureTool.cc.

References b, m_bp1, m_bp2, m_ldist, m_lp1, m_lp2, m_pnt1, and m_pnt2.

Referenced by FW3DViewBase::populateController().

70  {
71  TGVerticalFrame* vf = new TGVerticalFrame(p);
72 
73  {
74  TGHorizontalFrame* hf = new TGHorizontalFrame(vf);
75  TGLabel* lb = new TGLabel(hf, "Distance: ");
76  hf->AddFrame(lb);
77  m_ldist = new TGLabel(hf, " --- ");
78  hf->AddFrame(m_ldist);
79  vf->AddFrame(hf);
80  }
81  {
82  TGHorizontalFrame* hf = new TGHorizontalFrame(vf);
83 
84  m_bp1 = new TGTextButton(hf, "Pick Point1");
85  m_bp1->Connect("Clicked()", "FW3DViewDistanceMeasureTool", this, "setActionPnt1()");
86  m_bp1->SetToolTipText("Click on the butto to pick the first point in viewer.");
87  hf->AddFrame(m_bp1, new TGLayoutHints(kLHintsNormal, 0, 5, 4, 4));
88 
89  m_lp1 = new TGLabel(hf, Form(lbpformat, m_pnt1.X(), m_pnt1.Y(), m_pnt1.Z()));
90  hf->AddFrame(m_lp1, new TGLayoutHints(kLHintsNormal, 0, 1, 4, 4));
91 
92  vf->AddFrame(hf);
93  }
94 
95  {
96  TGHorizontalFrame* hf = new TGHorizontalFrame(vf);
97 
98  m_bp2 = new TGTextButton(hf, "Pick Point2");
99  m_bp2->Connect("Clicked()", "FW3DViewDistanceMeasureTool", this, "setActionPnt2()");
100  m_bp2->SetToolTipText("Click on the butto to pick the secoond point in viewer.");
101  hf->AddFrame(m_bp2, new TGLayoutHints(kLHintsExpandX, 0, 5, 4, 4));
102 
103  m_lp2 = new TGLabel(hf, Form(lbpformat, m_pnt2.X(), m_pnt2.Y(), m_pnt2.Z()));
104  hf->AddFrame(m_lp2, new TGLayoutHints(kLHintsNormal, 0, 1, 4, 4));
105 
106  vf->AddFrame(hf);
107  }
108 
109  {
110  TGHorizontalFrame* hf = new TGHorizontalFrame(vf);
111  TGTextButton* b = new TGTextButton(hf, "Print distance to terminal");
112  b->Connect("Clicked()", "FW3DViewDistanceMeasureTool", this, "Print()");
113  hf->AddFrame(b, new TGLayoutHints(kLHintsNormal, 0, 5, 4, 4));
114  vf->AddFrame(hf);
115  }
116  return vf;
117 }
double b
Definition: hdecay.h:118
FW3DViewDistanceMeasureTool::ClassDef ( FW3DViewDistanceMeasureTool  ,
 
)
private
void FW3DViewDistanceMeasureTool::Print ( void  ) const

Definition at line 14 of file FW3DViewDistanceMeasureTool.cc.

References a, m_pnt1, m_pnt2, and gpuVertexFinder::printf().

14  {
15  printf("==============================================\n");
16  m_pnt1.Dump();
17  m_pnt2.Dump();
18  TGLVector3 a = m_pnt1 - m_pnt2;
19  printf("Distance:\n%f \n", a.Mag());
20 }
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
double a
Definition: hdecay.h:119
TGLVector3 & FW3DViewDistanceMeasureTool::refCurrentVertex ( )

Definition at line 58 of file FW3DViewDistanceMeasureTool.cc.

References kNone, kPnt1, m_action, m_pnt1, m_pnt2, and gpuVertexFinder::printf().

Referenced by FW3DViewBase::setCurrentDMTVertex().

58  {
59  //assert (m_action != kNone);
60  if (m_action == kNone) {
61  printf("ERROR refCurrentVertex m_action == kNone \n");
62  return m_pnt1;
63  }
64  if (m_action == kPnt1)
65  return m_pnt1;
66  else
67  return m_pnt2;
68 }
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
void FW3DViewDistanceMeasureTool::resetAction ( )

Definition at line 22 of file FW3DViewDistanceMeasureTool.cc.

References ztail::d, kNone, m_action, m_bp1, m_bp2, m_ldist, m_lp1, m_lp2, m_pnt1, m_pnt2, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by FW3DViewBase::setCurrentDMTVertex().

22  {
23  // printf("Reset ACTION !!!! \n");
24  m_action = kNone;
25  m_bp1->SetState(kButtonUp);
26  m_lp1->SetText(Form(lbpformat, m_pnt1.X(), m_pnt1.Y(), m_pnt1.Z()));
27 
28  m_bp2->SetState(kButtonUp);
29  m_lp2->SetText(Form(lbpformat, m_pnt2.X(), m_pnt2.Y(), m_pnt2.Z()));
30 
31  TGLVector3 d = m_pnt2 - m_pnt1;
32  m_ldist->SetText(Form("%.2f", d.Mag()));
33 
34  {
35  TGCompositeFrame* p = (TGCompositeFrame*)(m_ldist->GetParent());
36  p->Resize(p->GetDefaultSize());
37  }
38  {
39  TGCompositeFrame* p = (TGCompositeFrame*)(m_ldist->GetParent()->GetParent());
40  p->Layout();
41  }
42 }
tuple d
Definition: ztail.py:151
void FW3DViewDistanceMeasureTool::setActionPnt1 ( )

Definition at line 44 of file FW3DViewDistanceMeasureTool.cc.

References kPnt1, m_action, m_bp1, and m_bp2.

44  {
45  // printf("Action ! 1111 \n");
46  m_action = kPnt1;
47  m_bp1->SetState(kButtonEngaged);
48  m_bp2->SetState(kButtonUp);
49 }
void FW3DViewDistanceMeasureTool::setActionPnt2 ( )

Definition at line 51 of file FW3DViewDistanceMeasureTool.cc.

References kPnt2, m_action, m_bp1, and m_bp2.

51  {
52  // printf("Action ! 222 \n");
53  m_action = kPnt2;
54  m_bp2->SetState(kButtonEngaged);
55  m_bp1->SetState(kButtonUp);
56 }

Friends And Related Function Documentation

friend class FW3DViewBase
friend

Definition at line 11 of file FW3DViewDistanceMeasureTool.h.

Member Data Documentation

EPickAction FW3DViewDistanceMeasureTool::m_action
protected
TGTextButton* FW3DViewDistanceMeasureTool::m_bp1
private

Definition at line 35 of file FW3DViewDistanceMeasureTool.h.

Referenced by buildGUI(), resetAction(), setActionPnt1(), and setActionPnt2().

TGTextButton* FW3DViewDistanceMeasureTool::m_bp2
private

Definition at line 36 of file FW3DViewDistanceMeasureTool.h.

Referenced by buildGUI(), resetAction(), setActionPnt1(), and setActionPnt2().

TGLabel* FW3DViewDistanceMeasureTool::m_ldist
private

Definition at line 39 of file FW3DViewDistanceMeasureTool.h.

Referenced by buildGUI(), and resetAction().

TGLabel* FW3DViewDistanceMeasureTool::m_lp1
private

Definition at line 37 of file FW3DViewDistanceMeasureTool.h.

Referenced by buildGUI(), and resetAction().

TGLabel* FW3DViewDistanceMeasureTool::m_lp2
private

Definition at line 38 of file FW3DViewDistanceMeasureTool.h.

Referenced by buildGUI(), and resetAction().

TGLVector3 FW3DViewDistanceMeasureTool::m_pnt1
protected

Definition at line 30 of file FW3DViewDistanceMeasureTool.h.

Referenced by buildGUI(), Print(), refCurrentVertex(), and resetAction().

TGLVector3 FW3DViewDistanceMeasureTool::m_pnt2
protected

Definition at line 31 of file FW3DViewDistanceMeasureTool.h.

Referenced by buildGUI(), Print(), refCurrentVertex(), and resetAction().