Logo ROOT   6.10/09
Reference Guide
TGLSelectRecord.h
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 #ifndef ROOT_TGLSelectRecord
13 #define ROOT_TGLSelectRecord
14 
15 #include <Rtypes.h>
16 
17 class TObject;
18 class TGLSceneInfo;
19 class TGLPhysicalShape;
20 class TGLLogicalShape;
21 class TGLOverlayElement;
22 
23 /**************************************************************************/
24 // TGLSelectRecordBase
25 /**************************************************************************/
26 
28 {
29 protected:
30  // Primary data - coming from GL.
35 
36  // Current position (for name resolutin in hierachies of unknown depth).
38 
39  void CopyItems(UInt_t* items);
40 
41 public:
45  virtual ~TGLSelectRecordBase();
46 
48 
49  void SetRawOnly(UInt_t* data);
50 
51  virtual void Set(UInt_t* data);
52  virtual void Reset();
53 
54  Int_t GetN() const { return fN; }
55  UInt_t* GetItems() const { return fItems; }
56  UInt_t GetItem(Int_t i) const { return fItems[i]; }
57  Float_t GetMinZ() const { return fMinZ; }
58  Float_t GetMaxZ() const { return fMaxZ; }
59 
60  UInt_t GetCurrItem() const { return fPos < fN ? fItems[fPos] : 0; }
61  Int_t GetNLeft() const { return fN - fPos; }
62  void NextPos() { ++fPos; }
63  void PrevPos() { --fPos; }
64  void ResetPos() { fPos = 0; }
65 
66  ClassDef(TGLSelectRecordBase, 0) // Base class for GL selection records.
67 };
68 
69 
70 /**************************************************************************/
71 // TGLSelectRecord
72 /**************************************************************************/
73 
75 {
76 public:
77  enum ESecSelResult { kNone, kEnteringSelection, kLeavingSelection, kModifyingInternalSelection };
78 
79 protected:
80  // Secondary data (scene dependent) - use
81  // TGLSceneBase::ResolveSelectRecord() to fill.
83  TGLSceneInfo *fSceneInfo; // SceneInfo
84  TGLPhysicalShape *fPhysShape; // PhysicalShape, if applicable
85  TGLLogicalShape *fLogShape; // LogicalShape, if applicable
86  TObject *fObject; // Master TObject, if applicable
87  void *fSpecific; // Scene specific, if applicable
88  Bool_t fMultiple; // Mutliple selection requested (set by event-handler).
89  Bool_t fHighlight; // Requested for highlight (set by event-handler).
90 
91  ESecSelResult fSecSelRes; // Result of ProcessSelection;
92 
93 public:
96  TGLSelectRecord(const TGLSelectRecord& rec);
97  virtual ~TGLSelectRecord();
98 
100 
101  virtual void Set(UInt_t* data);
102  virtual void Reset();
103 
104  Bool_t GetTransparent() const { return fTransparent; }
105  TGLSceneInfo * GetSceneInfo() const { return fSceneInfo; }
106  TGLPhysicalShape * GetPhysShape() const { return fPhysShape; }
107  TGLLogicalShape * GetLogShape() const { return fLogShape; }
108  TObject * GetObject() const { return fObject; }
109  void * GetSpecific() const { return fSpecific; }
110  Bool_t GetMultiple() const { return fMultiple; }
111  Bool_t GetHighlight() const { return fHighlight; }
112 
113  ESecSelResult GetSecSelResult() const { return fSecSelRes; }
114 
115  void SetTransparent(Bool_t t) { fTransparent = t; }
116  void SetSceneInfo (TGLSceneInfo* si) { fSceneInfo = si; }
117  void SetPhysShape (TGLPhysicalShape* pshp) { fPhysShape = pshp; }
118  void SetLogShape (TGLLogicalShape* lshp) { fLogShape = lshp; }
119  void SetObject (TObject* obj) { fObject = obj; }
120  void SetSpecific (void* spec) { fSpecific = spec; }
121  void SetMultiple (Bool_t multi) { fMultiple = multi; }
122  void SetHighlight (Bool_t hlt) { fHighlight = hlt; }
123 
124  void SetSecSelResult(ESecSelResult r) { fSecSelRes = r; }
125 
126  void Print();
127 
128  static Bool_t AreSameSelectionWise(const TGLSelectRecord& r1,
129  const TGLSelectRecord& r2);
130 
131  ClassDef(TGLSelectRecord, 0) // Standard GL selection record.
132 };
133 
134 
135 /**************************************************************************/
136 // TGLOvlSelectRecord
137 /**************************************************************************/
138 
140 {
141 protected:
142  // Secondary data (overlay dependent).
144 
145 public:
149  virtual ~TGLOvlSelectRecord();
150 
152 
153  virtual void Set(UInt_t* data);
154  virtual void Reset();
155 
156  TGLOverlayElement* GetOvlElement() const { return fOvlElement; }
157  void SetOvlElement(TGLOverlayElement* e) { fOvlElement = e; }
158 
159  ClassDef(TGLOvlSelectRecord, 0) // Standard GL overlay-selection record.
160 };
161 
162 #endif
void * GetSpecific() const
void SetSecSelResult(ESecSelResult r)
void SetOvlElement(TGLOverlayElement *e)
float Float_t
Definition: RtypesCore.h:53
Bool_t GetMultiple() const
Int_t GetNLeft() const
void SetPhysShape(TGLPhysicalShape *pshp)
TGLLogicalShape * GetLogShape() const
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
void SetRawOnly(UInt_t *data)
Setup the record from raw buffer.
UInt_t * GetItems() const
An overlay element.
Definition: TGLOverlay.h:22
Concrete physical shape - a GL drawable.
TGLPhysicalShape * GetPhysShape() const
void SetTransparent(Bool_t t)
Base class for select records.
#define ClassDef(name, id)
Definition: Rtypes.h:297
virtual void Reset()
Reinitialise all data to null values.
Float_t GetMaxZ() const
void SetMultiple(Bool_t multi)
virtual void Set(UInt_t *data)
Setup the record from raw buffer.
virtual ~TGLSelectRecordBase()
Destructor.
TGLOverlayElement * fOvlElement
Bool_t GetHighlight() const
TRandom2 r(17)
UInt_t GetCurrItem() const
Standard selection record including information about containing scene and details ob out selected ob...
unsigned int r1[N_CITIES]
Definition: simanTSP.cxx:321
unsigned int UInt_t
Definition: RtypesCore.h:42
void SetObject(TObject *obj)
ESecSelResult GetSecSelResult() const
Abstract logical shape - a GL &#39;drawable&#39; - base for all shapes - faceset sphere etc.
void Print(std::ostream &os, const OptionType &opt)
TObject * GetObject() const
TGLSceneInfo * GetSceneInfo() const
UInt_t GetItem(Int_t i) const
TGLSelectRecordBase & operator=(const TGLSelectRecordBase &rec)
Copy operator.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630
ESecSelResult fSecSelRes
TGLLogicalShape * fLogShape
void SetLogShape(TGLLogicalShape *lshp)
void SetHighlight(Bool_t hlt)
Mother of all ROOT objects.
Definition: TObject.h:37
void CopyItems(UInt_t *items)
Copy data from names. fN must already be set.
Bool_t GetTransparent() const
TGLPhysicalShape * fPhysShape
Float_t GetMinZ() const
Int_t GetN() const
Base class for extended scene context.
Definition: TGLSceneInfo.h:26
Selection record for overlay objects.
void SetSpecific(void *spec)
TGLSceneInfo * fSceneInfo
unsigned int r2[N_CITIES]
Definition: simanTSP.cxx:322
TGLOverlayElement * GetOvlElement() const
TGLSelectRecordBase()
Default constructor.
void SetSceneInfo(TGLSceneInfo *si)