]>
Commit | Line | Data |
---|---|---|
31eaa632 | 1 | // $Header$ |
2 | ||
3 | #include "TrackGL.h" | |
4 | #include <Reve/Track.h> | |
32e219c2 | 5 | #include <Reve/GLUtilNS.h> |
31eaa632 | 6 | |
19208112 | 7 | #include <TGLSelectRecord.h> |
31eaa632 | 8 | |
19208112 | 9 | #include <TGLIncludes.h> |
31eaa632 | 10 | |
11 | using namespace Reve; | |
12 | ||
13 | //______________________________________________________________________ | |
14 | // TrackGL | |
15 | // | |
16 | ||
17 | ClassImp(TrackGL) | |
18 | ||
19 | TrackGL::TrackGL() : LineGL() | |
20 | { | |
19208112 | 21 | // fDLCache = false; // Disable display list. |
31eaa632 | 22 | } |
23 | ||
24 | TrackGL::~TrackGL() | |
25 | {} | |
26 | ||
27 | /**************************************************************************/ | |
28 | ||
19208112 | 29 | Bool_t TrackGL::SetModel(TObject* obj, const Option_t* /*opt*/) |
5d470a90 | 30 | { |
31 | if(LineGL::SetModel(obj) == kFALSE) return kFALSE; | |
32 | if(SetModelCheckClass(obj, Track::Class())) { | |
33 | fTrack = dynamic_cast<Track*>(obj); | |
34 | return kTRUE; | |
35 | } | |
36 | return kFALSE; | |
37 | } | |
38 | /**************************************************************************/ | |
39 | ||
19208112 | 40 | void TrackGL::ProcessSelection(TGLRnrCtx & /*rnrCtx*/, TGLSelectRecord & rec) |
31eaa632 | 41 | { |
495f908e | 42 | // Processes secondary selection from TGLViewer. |
43 | // Calls TPointSet3D::PointSelected(Int_t) with index of selected | |
44 | // point as an argument. | |
45 | ||
495f908e | 46 | printf("TrackGL::ProcessSelection %d names on the stack (z1=%g, z2=%g).\n", |
19208112 | 47 | rec.GetN(), rec.GetMinZ(), rec.GetMaxZ()); |
495f908e | 48 | printf(" Names: "); |
19208112 | 49 | for (Int_t j=0; j<rec.GetN(); ++j) printf ("%d ", rec.GetItem(j)); |
495f908e | 50 | printf("\n"); |
51 | ||
52 | ((Track*)fM)->CtrlClicked((Track*)fM); | |
5d470a90 | 53 | } |
54 | ||
55 | /**************************************************************************/ | |
19208112 | 56 | void TrackGL::DirectDraw(TGLRnrCtx & rnrCtx) const |
5d470a90 | 57 | { |
32e219c2 | 58 | LineGL::DirectDraw(rnrCtx); |
85b3ce77 | 59 | |
32e219c2 | 60 | // path-marks |
61 | std::vector<PathMark*>& pm = fTrack->fPathMarks; | |
62 | TrackRnrStyle& RS = *fTrack->GetRnrStyle(); | |
63 | if(pm.size()) | |
dd2b04ce | 64 | { |
32e219c2 | 65 | Float_t* pnts = new Float_t[3*pm.size()]; // maximum |
66 | Int_t N = 0; | |
67 | Bool_t accept; | |
68 | for(std::vector<PathMark*>::iterator i=pm.begin(); i!=pm.end(); ++i) | |
85b3ce77 | 69 | { |
32e219c2 | 70 | accept = kFALSE; |
71 | switch((*i)->type) | |
85b3ce77 | 72 | { |
32e219c2 | 73 | case(PathMark::Daughter): |
74 | if(RS.fRnrDaughters) accept = kTRUE; | |
75 | break; | |
76 | case(PathMark::Reference): | |
77 | if(RS.fRnrReferences) accept = kTRUE; | |
78 | break; | |
79 | case(PathMark::Decay): | |
80 | if(RS.fRnrDecay) accept = kTRUE; | |
81 | break; | |
85b3ce77 | 82 | } |
32e219c2 | 83 | if(accept) |
5d470a90 | 84 | { |
32e219c2 | 85 | if((TMath::Abs((*i)->V.z) < RS.fMaxZ) && ((*i)->V.Perp() < RS.fMaxR)) |
85b3ce77 | 86 | { |
32e219c2 | 87 | pnts[3*N ] =(*i)->V.x; |
88 | pnts[3*N+1] =(*i)->V.y; | |
89 | pnts[3*N+2] =(*i)->V.z; | |
90 | N++; | |
5d470a90 | 91 | } |
5d470a90 | 92 | } |
32e219c2 | 93 | } |
94 | GLUtilNS::RenderPolyMarkers(RS.fPMAtt, pnts, N); | |
95 | delete [] pnts; | |
96 | } | |
5d470a90 | 97 | |
32e219c2 | 98 | // fist vertex |
99 | if(RS.fRnrFV && fTrack->GetLastPoint()) | |
100 | GLUtilNS::RenderPolyMarkers(RS.fFVAtt, fTrack->GetP(), 1); | |
31eaa632 | 101 | } |