CMS 3D CMS Logo

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

#include <FWGLEventHandler.h>

Inheritance diagram for FWGLEventHandler:

Public Member Functions

 FWGLEventHandler (TGWindow *w, TObject *obj, TEveCaloLego *l=nullptr)
 
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
 
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 Member Functions

 FWGLEventHandler (const FWGLEventHandler &)=delete
 
const FWGLEventHandleroperator= (const FWGLEventHandler &)=delete
 

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) {}

◆ ~FWGLEventHandler()

FWGLEventHandler::~FWGLEventHandler ( )
inlineoverride

Definition at line 14 of file FWGLEventHandler.h.

14 {}

◆ FWGLEventHandler() [2/2]

FWGLEventHandler::FWGLEventHandler ( const FWGLEventHandler )
privatedelete

Member Function Documentation

◆ HandleButton()

Bool_t FWGLEventHandler::HandleButton ( Event_t *  event)
override

Definition at line 46 of file FWGLEventHandler.cc.

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 }

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

◆ HandleCrossing()

Bool_t FWGLEventHandler::HandleCrossing ( Event_t *  event)
override

Definition at line 98 of file FWGLEventHandler.cc.

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 }

References m_viewer, and FWEveView::viewer().

◆ HandleFocusChange()

Bool_t FWGLEventHandler::HandleFocusChange ( Event_t *  event)
override

Definition at line 87 of file FWGLEventHandler.cc.

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 }

References m_viewer, and FWEveView::viewer().

◆ HandleKey()

Bool_t FWGLEventHandler::HandleKey ( Event_t *  event)
override

Definition at line 66 of file FWGLEventHandler.cc.

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 }

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

◆ operator=()

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

◆ PopupContextMenu()

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

Definition at line 21 of file FWGLEventHandler.cc.

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 }

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

Referenced by HandleKey().

◆ setViewer()

void FWGLEventHandler::setViewer ( FWEveView ev)
inline

Definition at line 27 of file FWGLEventHandler.h.

27 { m_viewer = ev; }

References 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().

FWGLEventHandler::openSelectedModelContextMenu_
sigc::signal< void, Int_t, Int_t > openSelectedModelContextMenu_
Definition: FWGLEventHandler.h:25
DDAxes::y
FWGLEventHandler::PopupContextMenu
void PopupContextMenu(TGLPhysicalShape *pshp, Event_t *event, Int_t gx, Int_t gy) override
Definition: FWGLEventHandler.cc:21
DDAxes::x
findQualityFiles.v
v
Definition: findQualityFiles.py:179
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
FWEveView::requestGLHandlerPick
virtual bool requestGLHandlerPick() const
Definition: FWEveView.h:92
w
const double w
Definition: UKUtility.cc:23
FWEveView::viewer
TEveViewer * viewer()
Definition: FWEveView.cc:179
FW3DViewBase::setCurrentDMTVertex
void setCurrentDMTVertex(double x, double y, double z)
Definition: FW3DViewBase.cc:458
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
res
Definition: Electron.h:6
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:193
FW3DViewBase
Definition: FW3DViewBase.h:42
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
FWGeoTopNodeGLScene::GeoPopupMenu
void GeoPopupMenu(Int_t gx, Int_t gy, TGLViewer *)
Definition: FWGeoTopNodeScene.cc:112
FWGeoTopNodeGLScene
Definition: FWGeoTopNodeScene.h:9
FWGLEventHandler::m_viewer
FWEveView * m_viewer
Definition: FWGLEventHandler.h:33
event
Definition: event.py:1
event
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of "!*" before the partial wildcard feature was incorporated). The per-event "cost" of each negative criterion with multiple relevant triggers is about the same as ! *was in the past