CMS 3D CMS Logo

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

#include <FWViewContextMenuHandlerGL.h>

Inheritance diagram for FWViewContextMenuHandlerGL:
FWViewContextMenuHandlerBase

Public Types

enum  GLViewerAction {
  kAnnotate, kCameraCenter, kResetCameraCenter, kOrigin,
  kNone
}
 

Public Member Functions

 FWViewContextMenuHandlerGL (FWEveView *v)
 
void select (int iEntryIndex, const FWModelId &id, int iX, int iY) override
 
 ~FWViewContextMenuHandlerGL () override
 
- Public Member Functions inherited from FWViewContextMenuHandlerBase
void addTo (FWModelContextMenuHandler &, const FWModelId &id)
 
 FWViewContextMenuHandlerBase ()
 
virtual ~FWViewContextMenuHandlerBase ()
 

Private Member Functions

 FWViewContextMenuHandlerGL (const FWViewContextMenuHandlerGL &)=delete
 
void init (FWViewContextMenuHandlerBase::MenuEntryAdder &, const FWModelId &id) override
 Called when have to add entries to the context menu. More...
 
const FWViewContextMenuHandlerGLoperator= (const FWViewContextMenuHandlerGL &)=delete
 

Private Attributes

FWEveViewm_view
 

Detailed Description

Definition at line 9 of file FWViewContextMenuHandlerGL.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

FWViewContextMenuHandlerGL::FWViewContextMenuHandlerGL ( FWEveView v)

Definition at line 20 of file FWViewContextMenuHandlerGL.cc.

Referenced by ~FWViewContextMenuHandlerGL().

FWViewContextMenuHandlerGL::~FWViewContextMenuHandlerGL ( )
inlineoverride

Definition at line 14 of file FWViewContextMenuHandlerGL.h.

References FWViewContextMenuHandlerGL(), init(), operator=(), and select().

14 {}
FWViewContextMenuHandlerGL::FWViewContextMenuHandlerGL ( const FWViewContextMenuHandlerGL )
privatedelete

Member Function Documentation

void FWViewContextMenuHandlerGL::init ( FWViewContextMenuHandlerBase::MenuEntryAdder ,
const FWModelId id 
)
overrideprivatevirtual

Called when have to add entries to the context menu.

Implements FWViewContextMenuHandlerBase.

Definition at line 22 of file FWViewContextMenuHandlerGL.cc.

References FWViewContextMenuHandlerBase::MenuEntryAdder::addEntry(), pixel_dqm_sourceclient-live_cfg::enabled, FWViewType::isProjected(), kAnnotate, kCameraCenter, kResetCameraCenter, m_view, AlCaHLTBitMon_ParallelJobs::p, and FWViewBase::typeId().

Referenced by ~FWViewContextMenuHandlerGL().

22  {
23  adder.addEntry("Add Annotation", kAnnotate);
25  const char* p = id.item()->purpose().c_str();
26  bool enabled = (strstr(p, "Beam Spot") || strstr(p, "Vertices"));
27  adder.addEntry("Use As Projection Origin", kCameraCenter, enabled);
28  adder.addEntry("Reset Projection Origin", kResetCameraCenter, enabled);
29  } else {
30  adder.addEntry("Set Camera Center", kCameraCenter);
31  adder.addEntry("Reset Camera Center", kResetCameraCenter);
32  }
33 }
static bool isProjected(int)
Definition: FWViewType.cc:100
FWViewType::EType typeId() const
Definition: FWViewBase.h:42
const FWViewContextMenuHandlerGL& FWViewContextMenuHandlerGL::operator= ( const FWViewContextMenuHandlerGL )
privatedelete
void FWViewContextMenuHandlerGL::select ( int  iEntryIndex,
const FWModelId id,
int  iX,
int  iY 
)
overridevirtual

Called when a menu item was selected iEntryIndex: the index of the selected menu item. Same as returned from 'addEntry' iX, iY: Screen coordinates of where mouse was clicked

Implements FWViewContextMenuHandlerBase.

Definition at line 35 of file FWViewContextMenuHandlerGL.cc.

References FWEveView::context(), f, FWModelId::index(), FWViewType::isProjected(), FWModelId::item(), B2GTnPMonitor_cfi::item, kAnnotate, kCameraCenter, kResetCameraCenter, m_view, FWEventItem::modelData(), Skims_PA_cff::name, MetAnalyzer::pv(), FWRPZView::resetOrigin(), FWSelectionManager::selected(), fireworks::Context::selectionManager(), FWRPZView::shiftOrigin(), AlCaHLTBitMon_QueryRunRegistry::string, FWViewBase::typeId(), findQualityFiles::v, FWItemValueGetter::valueFor(), FWEventItem::valueGetter(), FWEveView::viewerGL(), x, and y.

Referenced by Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Views.LineDecayView.LineDecayContainer::mousePressEvent(), Vispa.Gui.PortConnection.PointToPointConnection::mousePressEvent(), Vispa.Gui.VispaWidget.VispaWidget::mousePressEvent(), Vispa.Views.AbstractView.AbstractView::restoreSelection(), and ~FWViewContextMenuHandlerGL().

35  {
36  TGLViewer* v = m_view->viewerGL();
37 
38  Window_t wdummy;
39  Int_t x, y;
40  gVirtualX->TranslateCoordinates(gClient->GetDefaultRoot()->GetId(), v->GetGLWidget()->GetId(), iX, iY, x, y, wdummy);
41 
42  TGLVector3 pnt(x, y, 0.5 * v->GetSelRec().GetMinZ());
43  v->CurrentCamera().WindowToViewport(pnt);
44  pnt = v->CurrentCamera().ViewportToWorld(pnt);
45 
46  switch (iEntryIndex) {
47  case kAnnotate: {
48  TGFrame* f = v->GetGLWidget();
49  gVirtualX->TranslateCoordinates(gClient->GetDefaultRoot()->GetId(), f->GetId(), iX, iY, x, y, wdummy);
50 
51  std::string name = id.item()->modelName(id.index());
52  if (id.item()->haveInterestingValue())
53  name += ", " + id.item()->modelInterestingValueAsString(id.index());
54 
55  TGLAnnotation* an =
56  new TGLAnnotation(v, name.c_str(), x * 1.f / f->GetWidth(), 1 - y * 1.f / f->GetHeight(), pnt);
57  an->SetUseColorSet(true);
58  an->SetTextSize(0.03);
59  break;
60  }
61  case kCameraCenter: {
63  FWModelId mId = *(m_view->context().selectionManager()->selected().begin());
64  const FWItemValueGetter& valueGetter = mId.item()->valueGetter();
65  TEveVector center;
66  center.fX = valueGetter.valueFor(mId.item()->modelData(mId.index()), 0);
67  center.fY = valueGetter.valueFor(mId.item()->modelData(mId.index()), 1);
68  center.fZ = valueGetter.valueFor(mId.item()->modelData(mId.index()), 2);
69 
70  FWRPZView* pv = static_cast<FWRPZView*>(m_view);
71  pv->shiftOrigin(center);
72  } else {
73  v->CurrentCamera().SetExternalCenter(true);
74  v->CurrentCamera().SetCenterVec(pnt.X(), pnt.Y(), pnt.Z());
75  v->SetDrawCameraCenter(true);
76  }
77  break;
78  }
79  case kResetCameraCenter: {
81  FWRPZView* pv = static_cast<FWRPZView*>(m_view);
82  pv->resetOrigin();
83  }
84 
85  v->CurrentCamera().SetExternalCenter(false);
86  v->SetDrawCameraCenter(false);
87  break;
88  }
89  }
90 }
const std::set< FWModelId > & selected() const
const FWItemValueGetter & valueGetter() const
one value from the model which is normally used for the popup
Definition: FWEventItem.h:112
TGLViewer * viewerGL() const
Definition: FWEveView.cc:177
void resetOrigin()
Definition: FWRPZView.cc:235
static bool isProjected(int)
Definition: FWViewType.cc:100
int index() const
Definition: FWModelId.h:41
def pv(vc)
Definition: MetAnalyzer.py:7
double f[11][100]
FWSelectionManager * selectionManager() const
Definition: Context.h:54
void shiftOrigin(TEveVector &center)
Definition: FWRPZView.cc:219
const fireworks::Context & context()
Definition: FWEveView.h:64
double valueFor(const void *, int idx) const
const void * modelData(int iIndex) const
Definition: FWEventItem.cc:466
const FWEventItem * item() const
Definition: FWModelId.h:39
FWViewType::EType typeId() const
Definition: FWViewBase.h:42

Member Data Documentation

FWEveView* FWViewContextMenuHandlerGL::m_view
private

Definition at line 23 of file FWViewContextMenuHandlerGL.h.

Referenced by init(), and select().