CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 19 of file FW3DViewDistanceMeasureTool.h.

19 {};

Member Function Documentation

TGCompositeFrame * FW3DViewDistanceMeasureTool::buildGUI ( TGCompositeFrame *  p)

Definition at line 79 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().

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

Definition at line 17 of file FW3DViewDistanceMeasureTool.cc.

References a, m_pnt1, and m_pnt2.

18 {
19  printf("==============================================\n");
20  m_pnt1.Dump();
21  m_pnt2.Dump();
22  TGLVector3 a = m_pnt1 - m_pnt2;
23  printf("Distance:\n%f \n", a.Mag());
24 }
double a
Definition: hdecay.h:121
TGLVector3 & FW3DViewDistanceMeasureTool::refCurrentVertex ( )

Definition at line 65 of file FW3DViewDistanceMeasureTool.cc.

References kNone, kPnt1, m_action, m_pnt1, and m_pnt2.

Referenced by FW3DViewBase::setCurrentDMTVertex().

66 {
67  //assert (m_action != kNone);
68  if (m_action == kNone) {
69  printf("ERROR refCurrentVertex m_action == kNone \n");
70  return m_pnt1 ;
71  }
72  if (m_action == kPnt1)
73  return m_pnt1;
74  else
75  return m_pnt2;
76 
77 }
void FW3DViewDistanceMeasureTool::resetAction ( )

Definition at line 26 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().

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

Definition at line 49 of file FW3DViewDistanceMeasureTool.cc.

References kPnt1, m_action, m_bp1, and m_bp2.

50 {
51  // printf("Action ! 1111 \n");
52  m_action = kPnt1;
53  m_bp1->SetState(kButtonEngaged);
54  m_bp2->SetState(kButtonUp);
55 }
void FW3DViewDistanceMeasureTool::setActionPnt2 ( )

Definition at line 57 of file FW3DViewDistanceMeasureTool.cc.

References kPnt2, m_action, m_bp1, and m_bp2.

58 {
59  // printf("Action ! 222 \n");
60  m_action = kPnt2;
61  m_bp2->SetState(kButtonEngaged);
62  m_bp1->SetState(kButtonUp);
63 }

Friends And Related Function Documentation

friend class FW3DViewBase
friend

Definition at line 12 of file FW3DViewDistanceMeasureTool.h.

Member Data Documentation

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

Definition at line 37 of file FW3DViewDistanceMeasureTool.h.

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

TGTextButton* FW3DViewDistanceMeasureTool::m_bp2
private

Definition at line 38 of file FW3DViewDistanceMeasureTool.h.

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

TGLabel* FW3DViewDistanceMeasureTool::m_ldist
private

Definition at line 41 of file FW3DViewDistanceMeasureTool.h.

Referenced by buildGUI(), and resetAction().

TGLabel* FW3DViewDistanceMeasureTool::m_lp1
private

Definition at line 39 of file FW3DViewDistanceMeasureTool.h.

Referenced by buildGUI(), and resetAction().

TGLabel* FW3DViewDistanceMeasureTool::m_lp2
private

Definition at line 40 of file FW3DViewDistanceMeasureTool.h.

Referenced by buildGUI(), and resetAction().

TGLVector3 FW3DViewDistanceMeasureTool::m_pnt1
protected

Definition at line 32 of file FW3DViewDistanceMeasureTool.h.

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

TGLVector3 FW3DViewDistanceMeasureTool::m_pnt2
protected

Definition at line 33 of file FW3DViewDistanceMeasureTool.h.

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