CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

FWViewContextMenuHandlerGL Class Reference

#include <FWViewContextMenuHandlerGL.h>

List of all members.

Public Types

enum  GLViewerAction { kAnnotate, kCameraCenter, kResetCameraCenter, kNone }

Public Member Functions

 FWViewContextMenuHandlerGL (TEveViewer *v)
virtual void select (int iEntryIndex, const FWModelId &id, int iX, int iY)
void setPickCameraCenter (bool x)
virtual ~FWViewContextMenuHandlerGL ()

Private Member Functions

 FWViewContextMenuHandlerGL (const FWViewContextMenuHandlerGL &)
virtual void init (FWViewContextMenuHandlerBase::MenuEntryAdder &)
const FWViewContextMenuHandlerGLoperator= (const FWViewContextMenuHandlerGL &)

Private Attributes

bool m_pickCameraCenter
TEveViewer * m_viewer

Detailed Description

Definition at line 9 of file FWViewContextMenuHandlerGL.h.


Member Enumeration Documentation

Enumerator:
kAnnotate 
kCameraCenter 
kResetCameraCenter 
kNone 

Definition at line 12 of file FWViewContextMenuHandlerGL.h.


Constructor & Destructor Documentation

FWViewContextMenuHandlerGL::FWViewContextMenuHandlerGL ( TEveViewer *  v)

Definition at line 11 of file FWViewContextMenuHandlerGL.cc.

                                                                   :
m_viewer(v),
m_pickCameraCenter(false)
{
}
virtual FWViewContextMenuHandlerGL::~FWViewContextMenuHandlerGL ( ) [inline, virtual]

Definition at line 15 of file FWViewContextMenuHandlerGL.h.

{}
FWViewContextMenuHandlerGL::FWViewContextMenuHandlerGL ( const FWViewContextMenuHandlerGL ) [private]

Member Function Documentation

void FWViewContextMenuHandlerGL::init ( FWViewContextMenuHandlerBase::MenuEntryAdder adder) [private, virtual]

Definition at line 18 of file FWViewContextMenuHandlerGL.cc.

References FWViewContextMenuHandlerBase::MenuEntryAdder::addEntry(), and m_pickCameraCenter.

{
   adder.addEntry("Add Annotation");
   if (m_pickCameraCenter)
   {
      adder.addEntry("Set Camera Center");
      adder.addEntry("Reset Camera Center");
   }
}
const FWViewContextMenuHandlerGL& FWViewContextMenuHandlerGL::operator= ( const FWViewContextMenuHandlerGL ) [private]
void FWViewContextMenuHandlerGL::select ( int  iEntryIndex,
const FWModelId id,
int  iX,
int  iY 
) [virtual]

Definition at line 29 of file FWViewContextMenuHandlerGL.cc.

References f, getHLTprescales::index, kAnnotate, kCameraCenter, kResetCameraCenter, m_viewer, AlCaRecoCosmics_cfg::name, v, ExpressReco_HICollisions_FallBack::x, and ExpressReco_HICollisions_FallBack::y.

{
   TGLViewer* v = m_viewer->GetGLViewer();

   Window_t wdummy;
   Int_t x,y;
   gVirtualX->TranslateCoordinates(gClient->GetDefaultRoot()->GetId(), v->GetGLWidget()->GetId(), iX, iY, x, y, wdummy);   
   TGLVector3 pnt(x, y, 0.5*v->GetSelRec().GetMinZ());
   v->CurrentCamera().WindowToViewport(pnt);
   pnt = v->CurrentCamera().ViewportToWorld(pnt);

   switch (iEntryIndex)
   {
      case kAnnotate:
      {
         TGFrame* f = v->GetGLWidget();
         gVirtualX->TranslateCoordinates(gClient->GetDefaultRoot()->GetId(), f->GetId(), iX, iY, x, y, wdummy);

         std::string name = id.item()->modelName(id.index());
         if (id.item()->haveInterestingValue())
            name += ", " + id.item()->modelInterestingValueAsString(id.index());

         TGLAnnotation* an = new TGLAnnotation(v, name.c_str(),  x*1.f/f->GetWidth(), 1 - y*1.f/f->GetHeight(), pnt);
         an->SetUseColorSet(true);
         an->SetTextSize(0.03);
         break;
      }
      case kCameraCenter:
      {
         v->CurrentCamera().SetExternalCenter(true);
         v->SetDrawCameraCenter(true);
         v->CurrentCamera().SetCenterVec(pnt.X(), pnt.Y(), pnt.Z());
         break;
      }
      case kResetCameraCenter:
      {
         v->CurrentCamera().SetExternalCenter(false);
         v->SetDrawCameraCenter(false);
         break;
      }
   }
}
void FWViewContextMenuHandlerGL::setPickCameraCenter ( bool  x) [inline]

Member Data Documentation

Definition at line 27 of file FWViewContextMenuHandlerGL.h.

Referenced by init(), and setPickCameraCenter().

TEveViewer* FWViewContextMenuHandlerGL::m_viewer [private]

Definition at line 26 of file FWViewContextMenuHandlerGL.h.

Referenced by select().