CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Attributes
FWGLEventHandler Class Reference

#include <FWGLEventHandler.h>

Inheritance diagram for FWGLEventHandler:

Public Member Functions

 FWGLEventHandler (TGWindow *w, TObject *obj, TEveCaloLego *l=nullptr)
 
 FWGLEventHandler (const FWGLEventHandler &)=delete
 
Bool_t HandleButton (Event_t *event) override
 
Bool_t HandleCrossing (Event_t *event) override
 
Bool_t HandleFocusChange (Event_t *event) override
 
Bool_t HandleKey (Event_t *event) override
 
const FWGLEventHandleroperator= (const FWGLEventHandler &)=delete
 
void PopupContextMenu (TGLPhysicalShape *pshp, Event_t *event, Int_t gx, Int_t gy) override
 
void setViewer (FWEveView *ev)
 
 ~FWGLEventHandler () override
 

Public Attributes

sigc::signal< void(Int_t, Int_t)> openSelectedModelContextMenu_
 

Private Attributes

FWEveViewm_viewer
 

Detailed Description

Definition at line 11 of file FWGLEventHandler.h.

Constructor & Destructor Documentation

◆ FWGLEventHandler() [1/2]

FWGLEventHandler::FWGLEventHandler ( TGWindow *  w,
TObject *  obj,
TEveCaloLego *  l = nullptr 
)

Definition at line 17 of file FWGLEventHandler.cc.

18  : TEveLegoEventHandler(w, obj, l), m_viewer(nullptr) {}
FWEveView * m_viewer
T w() const

◆ ~FWGLEventHandler()

FWGLEventHandler::~FWGLEventHandler ( )
inlineoverride

Definition at line 14 of file FWGLEventHandler.h.

14 {}

◆ FWGLEventHandler() [2/2]

FWGLEventHandler::FWGLEventHandler ( const FWGLEventHandler )
delete

Member Function Documentation

◆ HandleButton()

Bool_t FWGLEventHandler::HandleButton ( Event_t *  event)
override

Definition at line 46 of file FWGLEventHandler.cc.

References m_viewer, FWEveView::requestGLHandlerPick(), FW3DViewBase::setCurrentDMTVertex(), findQualityFiles::v, x, and y.

46  {
47  Bool_t res = TEveLegoEventHandler::HandleButton(event);
48  if (m_viewer && m_viewer->requestGLHandlerPick() && event->fType == kButtonPress) {
49  Int_t x, y;
50  Window_t childdum;
51  gVirtualX->TranslateCoordinates(
52  gClient->GetDefaultRoot()->GetId(), fGLViewer->GetGLWidget()->GetId(), event->fX, event->fY, x, y, childdum);
53  fGLViewer->RequestSelect(event->fX, event->fY);
54  if (fGLViewer->GetSelRec().GetN() > 0) {
55  TGLVector3 v(event->fX, event->fY, 0.5 * fGLViewer->GetSelRec().GetMinZ());
56  fGLViewer->CurrentCamera().WindowToViewport(v);
57  v = fGLViewer->CurrentCamera().ViewportToWorld(v);
58  FW3DViewBase *v3d = dynamic_cast<FW3DViewBase *>(m_viewer);
59  v3d->setCurrentDMTVertex(v.X(), v.Y(), v.Z());
60  }
61  }
62 
63  return res;
64 }
FWEveView * m_viewer
virtual bool requestGLHandlerPick() const
Definition: FWEveView.h:92
void setCurrentDMTVertex(double x, double y, double z)
Definition: Electron.h:6
Definition: event.py:1

◆ HandleCrossing()

Bool_t FWGLEventHandler::HandleCrossing ( Event_t *  event)
override

Definition at line 98 of file FWGLEventHandler.cc.

References m_viewer, and FWEveView::viewer().

98  {
99  // Handle generic Event_t type 'event' - provided to catch focus changes
100  // and terminate any interaction in viewer.
101 
102  if (m_viewer && m_viewer->viewer() && event->fType == kLeaveNotify)
103  TEveGedEditor::ElementChanged(m_viewer->viewer());
104 
105  return TGLEventHandler::HandleCrossing(event);
106 }
FWEveView * m_viewer
TEveViewer * viewer()
Definition: FWEveView.cc:179
Definition: event.py:1

◆ HandleFocusChange()

Bool_t FWGLEventHandler::HandleFocusChange ( Event_t *  event)
override

Definition at line 87 of file FWGLEventHandler.cc.

References m_viewer, and FWEveView::viewer().

87  {
88  // Handle generic Event_t type 'event' - provided to catch focus changes
89  // and terminate any interaction in viewer.
90 
91  if (m_viewer && m_viewer->viewer() && event->fType == kFocusOut)
92  TEveGedEditor::ElementChanged(m_viewer->viewer());
93 
94  return TGLEventHandler::HandleFocusChange(event);
95 }
FWEveView * m_viewer
TEveViewer * viewer()
Definition: FWEveView.cc:179
Definition: event.py:1

◆ HandleKey()

Bool_t FWGLEventHandler::HandleKey ( Event_t *  event)
override

Definition at line 66 of file FWGLEventHandler.cc.

References edmPickEvents::event, m_viewer, PopupContextMenu(), createJobs::tmp, x, and y.

66  {
67  UInt_t keysym;
68  char tmp[2];
69  gVirtualX->LookupString(event, tmp, sizeof(tmp), keysym);
70 
71  if (m_viewer && (keysym == kKey_Enter || keysym == kKey_Return || keysym == kKey_Space)) {
72  if (event->fType == kGKeyPress) {
73  Int_t x, y;
74  Window_t childdum;
75  gVirtualX->TranslateCoordinates(
76  fGLViewer->GetGLWidget()->GetId(), gClient->GetDefaultRoot()->GetId(), event->fX, event->fY, x, y, childdum);
77 
78  fGLViewer->RequestSelect(event->fX, event->fY);
79  PopupContextMenu(fGLViewer->GetSelRec().GetPhysShape(), event, x, y);
80  }
81  return kTRUE;
82  } else {
83  return TEveLegoEventHandler::HandleKey(event);
84  }
85 }
void PopupContextMenu(TGLPhysicalShape *pshp, Event_t *event, Int_t gx, Int_t gy) override
FWEveView * m_viewer
tmp
align.sh
Definition: createJobs.py:716
Definition: event.py:1

◆ operator=()

const FWGLEventHandler& FWGLEventHandler::operator= ( const FWGLEventHandler )
delete

◆ PopupContextMenu()

void FWGLEventHandler::PopupContextMenu ( TGLPhysicalShape *  pshp,
Event_t *  event,
Int_t  gx,
Int_t  gy 
)
override

Definition at line 21 of file FWGLEventHandler.cc.

References FWGeoTopNodeGLScene::GeoPopupMenu(), m_viewer, and openSelectedModelContextMenu_.

Referenced by HandleKey().

21  {
22  // Popup context menu.
23 
24  if (event->fState & kKeyShiftMask && event->fState & kKeyControlMask) {
25  TGLEventHandler::PopupContextMenu(pshp, event, gx, gy);
26  return;
27  }
28 
29  if (m_viewer && pshp) {
30  SelectForClicked(event);
31 
32  if (pshp->GetLogical()) {
33  FWGeoTopNodeGLScene *js = dynamic_cast<FWGeoTopNodeGLScene *>(pshp->GetLogical()->GetScene());
34  if (js) {
35  js->GeoPopupMenu(gx, gy, fGLViewer);
36  return;
37  }
38  }
39 
41  }
42 }
void GeoPopupMenu(Int_t gx, Int_t gy, TGLViewer *)
FWEveView * m_viewer
sigc::signal< void(Int_t, Int_t)> openSelectedModelContextMenu_
Definition: event.py:1

◆ setViewer()

void FWGLEventHandler::setViewer ( FWEveView ev)
inline

Definition at line 27 of file FWGLEventHandler.h.

References makeMEIFBenchmarkPlots::ev, and m_viewer.

Referenced by FWEveView::FWEveView().

Member Data Documentation

◆ m_viewer

FWEveView* FWGLEventHandler::m_viewer
private

◆ openSelectedModelContextMenu_

sigc::signal<void(Int_t, Int_t)> FWGLEventHandler::openSelectedModelContextMenu_

Definition at line 25 of file FWGLEventHandler.h.

Referenced by FWEveView::FWEveView(), and PopupContextMenu().