CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/Fireworks/Core/src/FWGeoTopNodeGL.cc

Go to the documentation of this file.
00001 #include "Fireworks/Core/src/FWGeoTopNodeGL.h"
00002 #include "Fireworks/Core/interface/FWGeoTopNode.h"
00003 
00004 #include "TGLIncludes.h"
00005 #include "TGLRnrCtx.h"
00006 #include "TGLViewer.h"
00007 
00008 //______________________________________________________________________________
00009 FWGeoTopNodeGL::FWGeoTopNodeGL() :
00010    TGLObject()
00011 {
00012    // Constructor.
00013 }
00014 
00015 //______________________________________________________________________________
00016 void FWGeoTopNodeGL::SetBBox()
00017 {
00018    // Set bounding box.
00019 
00020    SetAxisAlignedBBox(((FWGeoTopNode*)fExternalObj)->AssertBBox());
00021 }
00022 
00023 //______________________________________________________________________________
00024 Bool_t FWGeoTopNodeGL::SetModel(TObject* obj, const Option_t* /*opt*/)
00025 {
00026    // Set model object.
00027 
00028    fM = SetModelDynCast<FWGeoTopNode>(obj);
00029    return kTRUE;
00030 }
00031 
00032 //______________________________________________________________________________
00033 void FWGeoTopNodeGL::DirectDraw(TGLRnrCtx & rnrCtx) const
00034 {
00035    // Draw quad-set with GL.
00036 
00037    static const TEveException eH("TEveQuadSetGL::DirectDraw ");
00038 
00039    // printf("FWGeoTopNodeGL::DirectDraw\n");
00040 
00041    // glPushAttrib(GL_POINT_BIT);
00042    // glPointSize(20);
00043    // glBegin(GL_POINTS);
00044    // glVertex3d(1,1,1);
00045    // glEnd();
00046    // glPopAttrib();
00047 }
00048 
00049 //______________________________________________________________________________
00050 void FWGeoTopNodeGL::ProcessSelection(TGLRnrCtx& rnrCtx, TGLSelectRecord& rec)
00051 {
00052    // Processes secondary selection from TGLViewer.
00053    // Calls DigitSelected(Int_t) in the model object with index of
00054    // selected point as the argument.
00055 
00056    // printf("FWGeoTopNodeGL::ProcessSelection who knows what we've got ...\n");
00057    // rec.Print();
00058 
00059    TGLViewer *v = dynamic_cast<TGLViewer*>(rnrCtx.GetViewer());
00060    /*
00061    if (v)
00062    {
00063       printf("  but we know the first selection was what we actually want!\n");
00064       printf("  and this is in rnrctx.viewer.selrec\n");
00065       printf("  log=%p, this=%p\n", v->GetSelRec().GetLogShape(), this);
00066    }
00067    */
00068    TGLPhysicalShape *p = v->GetSelRec().GetPhysShape();
00069 
00070    if (rec.GetHighlight())
00071    {
00072       fM->ProcessSelection(rec, fM->fHted, p);
00073    }
00074    else
00075    {
00076       fM->ProcessSelection(rec, fM->fSted, p);
00077    }
00078 
00079    // Also, do something in UnSelected / UnHighlighted XXXXX
00080 }