forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TGLSelectRecord.h
162 lines (123 loc) · 5.59 KB
/
TGLSelectRecord.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
// @(#)root/gl:$Id$
// Author: Matevz Tadel, Jun 2007
/*************************************************************************
* Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TGLSelectRecord
#define ROOT_TGLSelectRecord
#include <Rtypes.h>
class TObject;
class TGLSceneInfo;
class TGLPhysicalShape;
class TGLLogicalShape;
class TGLOverlayElement;
/**************************************************************************/
// TGLSelectRecordBase
/**************************************************************************/
class TGLSelectRecordBase
{
protected:
// Primary data - coming from GL.
Int_t fN;
UInt_t *fItems;
Float_t fMinZ;
Float_t fMaxZ;
// Current position (for name resolutin in hierachies of unknown depth).
Int_t fPos;
void CopyItems(UInt_t* items);
public:
TGLSelectRecordBase();
TGLSelectRecordBase(UInt_t* data);
TGLSelectRecordBase(const TGLSelectRecordBase& rec);
virtual ~TGLSelectRecordBase();
TGLSelectRecordBase& operator=(const TGLSelectRecordBase& rec);
void SetRawOnly(UInt_t* data);
virtual void Set(UInt_t* data);
virtual void Reset();
Int_t GetN() const { return fN; }
UInt_t* GetItems() const { return fItems; }
UInt_t GetItem(Int_t i) const { return fItems[i]; }
Float_t GetMinZ() const { return fMinZ; }
Float_t GetMaxZ() const { return fMaxZ; }
UInt_t GetCurrItem() const { return fPos < fN ? fItems[fPos] : 0; }
Int_t GetNLeft() const { return fN - fPos; }
void NextPos() { ++fPos; }
void PrevPos() { --fPos; }
void ResetPos() { fPos = 0; }
ClassDef(TGLSelectRecordBase, 0) // Base class for GL selection records.
};
/**************************************************************************/
// TGLSelectRecord
/**************************************************************************/
class TGLSelectRecord : public TGLSelectRecordBase
{
public:
enum ESecSelResult { kNone, kEnteringSelection, kLeavingSelection, kModifyingInternalSelection };
protected:
// Secondary data (scene dependent) - use
// TGLSceneBase::ResolveSelectRecord() to fill.
Bool_t fTransparent;
TGLSceneInfo *fSceneInfo; // SceneInfo
TGLPhysicalShape *fPhysShape; // PhysicalShape, if applicable
TGLLogicalShape *fLogShape; // LogicalShape, if applicable
TObject *fObject; // Master TObject, if applicable
void *fSpecific; // Scene specific, if applicable
Bool_t fMultiple; // Mutliple selection requested (set by event-handler).
Bool_t fHighlight; // Requested for highlight (set by event-handler).
ESecSelResult fSecSelRes; // Result of ProcessSelection;
public:
TGLSelectRecord();
TGLSelectRecord(UInt_t* data);
TGLSelectRecord(const TGLSelectRecord& rec);
virtual ~TGLSelectRecord();
TGLSelectRecord& operator=(const TGLSelectRecord& rec);
virtual void Set(UInt_t* data);
virtual void Reset();
Bool_t GetTransparent() const { return fTransparent; }
TGLSceneInfo * GetSceneInfo() const { return fSceneInfo; }
TGLPhysicalShape * GetPhysShape() const { return fPhysShape; }
TGLLogicalShape * GetLogShape() const { return fLogShape; }
TObject * GetObject() const { return fObject; }
void * GetSpecific() const { return fSpecific; }
Bool_t GetMultiple() const { return fMultiple; }
Bool_t GetHighlight() const { return fHighlight; }
ESecSelResult GetSecSelResult() const { return fSecSelRes; }
void SetTransparent(Bool_t t) { fTransparent = t; }
void SetSceneInfo (TGLSceneInfo* si) { fSceneInfo = si; }
void SetPhysShape (TGLPhysicalShape* pshp) { fPhysShape = pshp; }
void SetLogShape (TGLLogicalShape* lshp) { fLogShape = lshp; }
void SetObject (TObject* obj) { fObject = obj; }
void SetSpecific (void* spec) { fSpecific = spec; }
void SetMultiple (Bool_t multi) { fMultiple = multi; }
void SetHighlight (Bool_t hlt) { fHighlight = hlt; }
void SetSecSelResult(ESecSelResult r) { fSecSelRes = r; }
void Print();
static Bool_t AreSameSelectionWise(const TGLSelectRecord& r1,
const TGLSelectRecord& r2);
ClassDef(TGLSelectRecord, 0) // Standard GL selection record.
};
/**************************************************************************/
// TGLOvlSelectRecord
/**************************************************************************/
class TGLOvlSelectRecord : public TGLSelectRecordBase
{
protected:
// Secondary data (overlay dependent).
TGLOverlayElement* fOvlElement;
public:
TGLOvlSelectRecord();
TGLOvlSelectRecord(UInt_t* data);
TGLOvlSelectRecord(const TGLOvlSelectRecord& rec);
virtual ~TGLOvlSelectRecord();
TGLOvlSelectRecord& operator=(const TGLOvlSelectRecord& rec);
virtual void Set(UInt_t* data);
virtual void Reset();
TGLOverlayElement* GetOvlElement() const { return fOvlElement; }
void SetOvlElement(TGLOverlayElement* e) { fOvlElement = e; }
ClassDef(TGLOvlSelectRecord, 0) // Standard GL overlay-selection record.
};
#endif