CMS 3D CMS Logo

FWGLEventHandler.cc
Go to the documentation of this file.
6 
7 #include "KeySymbols.h"
8 #include "TGLViewer.h"
9 #include "TGLWidget.h"
10 #include "TGLPhysicalShape.h"
11 #include "TGLLogicalShape.h"
12 #include "TEveGedEditor.h"
13 #include "TEveViewer.h"
14 #include "FWGeoTopNodeScene.h"
15 #include "TVirtualX.h"
16 
17 FWGLEventHandler::FWGLEventHandler(TGWindow *w, TObject *obj, TEveCaloLego *l)
18  : TEveLegoEventHandler(w, obj, l), m_viewer(nullptr) {}
19 
20 //______________________________________________________________________________
21 void FWGLEventHandler::PopupContextMenu(TGLPhysicalShape *pshp, Event_t *event, Int_t gx, Int_t gy) {
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 }
43 
44 //______________________________________________________________________________
45 
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 }
65 
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 }
86 
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 }
96 
97 //______________________________________________________________________________
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 }
FWGLEventHandler::openSelectedModelContextMenu_
sigc::signal< void, Int_t, Int_t > openSelectedModelContextMenu_
Definition: FWGLEventHandler.h:25
DDAxes::y
FWGLEventHandler::HandleKey
Bool_t HandleKey(Event_t *event) override
Definition: FWGLEventHandler.cc:66
FWGLEventHandler.h
FWGLEventHandler::FWGLEventHandler
FWGLEventHandler(TGWindow *w, TObject *obj, TEveCaloLego *l=nullptr)
Definition: FWGLEventHandler.cc:17
FWGLEventHandler::PopupContextMenu
void PopupContextMenu(TGLPhysicalShape *pshp, Event_t *event, Int_t gx, Int_t gy) override
Definition: FWGLEventHandler.cc:21
FWGLEventHandler::HandleCrossing
Bool_t HandleCrossing(Event_t *event) override
Definition: FWGLEventHandler.cc:98
FWEveView.h
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
FW3DViewDistanceMeasureTool.h
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
FWGLEventHandler::HandleFocusChange
Bool_t HandleFocusChange(Event_t *event) override
Definition: FWGLEventHandler.cc:87
res
Definition: Electron.h:6
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:193
FW3DViewBase
Definition: FW3DViewBase.h:42
FWGLEventHandler::HandleButton
Bool_t HandleButton(Event_t *event) override
Definition: FWGLEventHandler.cc:46
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
FWGeoTopNodeScene.h
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
FWGUIManager.h
FW3DViewBase.h