Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGLSelectRecord.cxx
Go to the documentation of this file.
1// @(#)root/gl:$Id$
2// Author: Matevz Tadel, Jun 2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#include "TGLSelectRecord.h"
13#include <TObject.h>
14
15#include <string.h>
16
17/** \class TGLSelectRecordBase
18\ingroup opengl TGLSelectRecordBase
19Base class for select records.
20Supports initialization from a raw GL record (UInt_t*) and
21copies the name-data into internal array.
22*/
23
25
26////////////////////////////////////////////////////////////////////////////////
27/// Default constructor.
28
30 fN (0),
31 fItems (0),
32 fMinZ (0),
33 fMaxZ (0),
34 fPos (0)
35{
36}
37
38////////////////////////////////////////////////////////////////////////////////
39/// Constructor from raw GL-select record.
40
42 fN (data[0]),
43 fItems (0),
44 fMinZ ((Float_t)data[1] / (Float_t)0x7fffffff),
45 fMaxZ ((Float_t)data[2] / (Float_t)0x7fffffff),
46 fPos (0)
47{
48 CopyItems(&data[3]);
49}
50
51////////////////////////////////////////////////////////////////////////////////
52/// Copy constructor.
53
55 fN (rec.fN),
56 fItems (0),
57 fMinZ (rec.fMinZ),
58 fMaxZ (rec.fMaxZ),
59 fPos (rec.fPos)
60{
61 CopyItems(rec.fItems);
62}
63
64////////////////////////////////////////////////////////////////////////////////
65/// Destructor.
66
68{
69 delete [] fItems;
70}
71
72////////////////////////////////////////////////////////////////////////////////
73/// Copy operator.
74
76{
77 if (this != &rec)
78 {
79 fN = rec.fN;
80 fMinZ = rec.fMinZ;
81 fMaxZ = rec.fMaxZ;
82 fPos = rec.fPos;
83 CopyItems(rec.fItems);
84 }
85 return *this;
86}
87
88////////////////////////////////////////////////////////////////////////////////
89/// Copy data from names. fN must already be set.
90
92{
93 delete [] fItems;
94 if (fN > 0) {
95 fItems = new UInt_t[fN];
96 memcpy(fItems, items, fN*sizeof(UInt_t));
97 } else {
98 fItems = 0;
99 }
100}
101
102////////////////////////////////////////////////////////////////////////////////
103/// Setup the record from raw buffer.
104
106{
107 fN = data[0];
108 fMinZ = (Float_t)data[1] / (Float_t)0x7fffffff;
109 fMaxZ = (Float_t)data[2] / (Float_t)0x7fffffff;
110 CopyItems(&data[3]);
111}
112
113////////////////////////////////////////////////////////////////////////////////
114/// Setup the record from raw buffer.
115
117{
118 fN = data[0];
119 fMinZ = (Float_t)data[1] / (Float_t)0x7fffffff;
120 fMaxZ = (Float_t)data[2] / (Float_t)0x7fffffff;
121 fPos = 0;
122 CopyItems(&data[3]);
123}
124
125////////////////////////////////////////////////////////////////////////////////
126/// Reinitialise all data to null values.
127
129{
130 delete [] fItems;
131 fN = 0;
132 fItems = 0;
133 fMinZ = 0;
134 fMaxZ = 0;
135 fPos = 0;
136}
137
138
139/** \class TGLSelectRecord
140\ingroup opengl
141Standard selection record including information about containing
142scene and details ob out selected object (TGLPhysicalShape*,
143TObject* or simply a void* for foreign scenes).
144*/
145
147
148////////////////////////////////////////////////////////////////////////////////
149/// Default constructor.
150
153 fTransparent (kFALSE),
154 fSceneInfo (0),
155 fPhysShape (0),
156 fLogShape (0),
157 fObject (0),
158 fSpecific (0),
159 fMultiple (kFALSE),
160 fHighlight (kFALSE),
161 fSecSelRes (kNone)
162{
163}
164
165////////////////////////////////////////////////////////////////////////////////
166/// Constructor from raw GL-select record.
167
170 fTransparent (kFALSE),
171 fSceneInfo (0),
172 fPhysShape (0),
173 fLogShape (0),
174 fObject (0),
175 fSpecific (0),
176 fMultiple (kFALSE),
177 fHighlight (kFALSE),
178 fSecSelRes (kNone)
179{
180}
181
182////////////////////////////////////////////////////////////////////////////////
183/// Copy constructor.
184
187 fTransparent (rec.fTransparent),
188 fSceneInfo (rec.fSceneInfo),
189 fPhysShape (rec.fPhysShape),
190 fLogShape (rec.fLogShape),
191 fObject (rec.fObject),
192 fSpecific (rec.fSpecific),
193 fMultiple (rec.fMultiple),
194 fHighlight (rec.fHighlight),
195 fSecSelRes (kNone)
196{
197}
198
199////////////////////////////////////////////////////////////////////////////////
200/// Destructor.
201
203{
204}
205
206////////////////////////////////////////////////////////////////////////////////
207/// Copy operator.
208
210{
211 if (this != &rec)
212 {
217 fLogShape = rec.fLogShape;
218 fObject = rec.fObject;
219 fSpecific = rec.fSpecific;
220 fMultiple = rec.fMultiple;
223 }
224 return *this;
225}
226
227////////////////////////////////////////////////////////////////////////////////
228/// Setup the record from raw buffer.
229/// Non-core members are reset.
230
232{
235 fSceneInfo = 0;
236 fPhysShape = 0;
237 fLogShape = 0;
238 fObject = 0;
239 fSpecific = 0;
243}
244
245////////////////////////////////////////////////////////////////////////////////
246/// Reinitialise all data to null values.
247
249{
252 fSceneInfo = 0;
253 fPhysShape = 0;
254 fLogShape = 0;
255 fObject = 0;
256 fSpecific = 0;
260}
261
262////////////////////////////////////////////////////////////////////////////////
263/// Print contents of the select record to stdout.
264
266{
267 printf("SelectRecord N=%d, miZ=%.4f, maxZ=%.4f\n"
268 " sceneinfo=%p, pshp=%p, transp=%d, mult=%d, hilite=%d\n"
269 " tobj=%p (name='%s'), spec=%p\n",
270 fN, fMinZ, fMaxZ,
272 fObject, fObject ? fObject->GetName() : "",
273 fSpecific);
274}
275
276////////////////////////////////////////////////////////////////////////////////
277/// Check if the records imply the same selection result, that is,
278/// their secondary members are all equal.
279
281 const TGLSelectRecord& r2)
282{
283 return r1.fSceneInfo == r2.fSceneInfo && r1.fPhysShape == r2.fPhysShape &&
284 r1.fObject == r2.fObject && r1.fSpecific == r2.fSpecific;
285}
286
287
288/** \class TGLOvlSelectRecord
289\ingroup opengl
290Selection record for overlay objects.
291*/
292
294
295////////////////////////////////////////////////////////////////////////////////
296/// Default constructor.
297
300 fOvlElement (0)
301{
302}
303
304////////////////////////////////////////////////////////////////////////////////
305/// Constructor from raw GL-select record.
306
309 fOvlElement (0)
310{
311}
312
313////////////////////////////////////////////////////////////////////////////////
314/// Copy constructor.
315
318 fOvlElement (rec.fOvlElement)
319{
320}
321
322////////////////////////////////////////////////////////////////////////////////
323/// Destructor.
324
326{
327}
328
329////////////////////////////////////////////////////////////////////////////////
330/// Copy operator.
331
333{
334 if (this != &rec)
335 {
338 }
339 return *this;
340}
341
342////////////////////////////////////////////////////////////////////////////////
343/// Setup the record from raw buffer.
344/// Non-core members are reset.
345
347{
349 fOvlElement = 0;
350}
351
352////////////////////////////////////////////////////////////////////////////////
353/// Reinitialise all data to null values.
354
356{
358 fOvlElement = 0;
359}
360
const Handle_t kNone
Definition GuiTypes.h:88
const Bool_t kFALSE
Definition RtypesCore.h:101
float Float_t
Definition RtypesCore.h:57
#define ClassImp(name)
Definition Rtypes.h:364
Selection record for overlay objects.
TGLOverlayElement * fOvlElement
TGLOvlSelectRecord()
Default constructor.
virtual ~TGLOvlSelectRecord()
Destructor.
virtual void Set(UInt_t *data)
Setup the record from raw buffer.
TGLOvlSelectRecord & operator=(const TGLOvlSelectRecord &rec)
Copy operator.
virtual void Reset()
Reinitialise all data to null values.
Base class for select records.
TGLSelectRecordBase & operator=(const TGLSelectRecordBase &rec)
Copy operator.
void SetRawOnly(UInt_t *data)
Setup the record from raw buffer.
void CopyItems(UInt_t *items)
Copy data from names. fN must already be set.
virtual void Set(UInt_t *data)
Setup the record from raw buffer.
virtual ~TGLSelectRecordBase()
Destructor.
TGLSelectRecordBase()
Default constructor.
virtual void Reset()
Reinitialise all data to null values.
Standard selection record including information about containing scene and details ob out selected ob...
TGLSelectRecord()
Default constructor.
virtual void Set(UInt_t *data)
Setup the record from raw buffer.
virtual ~TGLSelectRecord()
Destructor.
static Bool_t AreSameSelectionWise(const TGLSelectRecord &r1, const TGLSelectRecord &r2)
Check if the records imply the same selection result, that is, their secondary members are all equal.
TGLSelectRecord & operator=(const TGLSelectRecord &rec)
Copy operator.
ESecSelResult fSecSelRes
TGLSceneInfo * fSceneInfo
TGLLogicalShape * fLogShape
TGLPhysicalShape * fPhysShape
virtual void Reset()
Reinitialise all data to null values.
void Print()
Print contents of the select record to stdout.
virtual const char * GetName() const
Returns name of object.
Definition TObject.cxx:429