CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWGeoTopNodeGL.cc
Go to the documentation of this file.
3 
4 #include "TGLIncludes.h"
5 #include "TGLRnrCtx.h"
6 #include "TGLViewer.h"
7 
8 //______________________________________________________________________________
10  TGLObject()
11 {
12  // Constructor.
13 }
14 
15 //______________________________________________________________________________
17 {
18  // Set bounding box.
19 
20  SetAxisAlignedBBox(((FWGeoTopNode*)fExternalObj)->AssertBBox());
21 }
22 
23 //______________________________________________________________________________
24 Bool_t FWGeoTopNodeGL::SetModel(TObject* obj, const Option_t* /*opt*/)
25 {
26  // Set model object.
27 
28  fM = SetModelDynCast<FWGeoTopNode>(obj);
29  return kTRUE;
30 }
31 
32 //______________________________________________________________________________
33 void FWGeoTopNodeGL::DirectDraw(TGLRnrCtx & rnrCtx) const
34 {
35  // Draw quad-set with GL.
36 
37  static const TEveException eH("TEveQuadSetGL::DirectDraw ");
38 
39  // printf("FWGeoTopNodeGL::DirectDraw\n");
40 
41  // glPushAttrib(GL_POINT_BIT);
42  // glPointSize(20);
43  // glBegin(GL_POINTS);
44  // glVertex3d(1,1,1);
45  // glEnd();
46  // glPopAttrib();
47 }
48 
49 //______________________________________________________________________________
50 void FWGeoTopNodeGL::ProcessSelection(TGLRnrCtx& rnrCtx, TGLSelectRecord& rec)
51 {
52  // Processes secondary selection from TGLViewer.
53  // Calls DigitSelected(Int_t) in the model object with index of
54  // selected point as the argument.
55 
56  // printf("FWGeoTopNodeGL::ProcessSelection who knows what we've got ...\n");
57  // rec.Print();
58 
59  TGLViewer *v = dynamic_cast<TGLViewer*>(rnrCtx.GetViewer());
60  /*
61  if (v)
62  {
63  printf(" but we know the first selection was what we actually want!\n");
64  printf(" and this is in rnrctx.viewer.selrec\n");
65  printf(" log=%p, this=%p\n", v->GetSelRec().GetLogShape(), this);
66  }
67  */
68  TGLPhysicalShape *p = v->GetSelRec().GetPhysShape();
69 
70  if (rec.GetHighlight())
71  {
72  fM->ProcessSelection(rec, fM->fHted, p);
73  }
74  else
75  {
76  fM->ProcessSelection(rec, fM->fSted, p);
77  }
78 
79  // Also, do something in UnSelected / UnHighlighted XXXXX
80 }
virtual void DirectDraw(TGLRnrCtx &rnrCtx) const
std::set< TGLPhysicalShape * > fSted
Definition: FWGeoTopNode.h:72
FWGeoTopNode * fM
virtual Bool_t SetModel(TObject *obj, const Option_t *opt=0)
virtual void ProcessSelection(TGLRnrCtx &rnrCtx, TGLSelectRecord &rec)
std::set< TGLPhysicalShape * > fHted
Definition: FWGeoTopNode.h:71
virtual void SetBBox()
void ProcessSelection(TGLSelectRecord &rec, std::set< TGLPhysicalShape * > &sset, TGLPhysicalShape *id)