Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TGLSelectRecord.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/gl:$Id$
0002 // Author:  Matevz Tadel, Jun 2007
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TGLSelectRecord
0013 #define ROOT_TGLSelectRecord
0014 
0015 #include <Rtypes.h>
0016 
0017 class TObject;
0018 class TGLSceneInfo;
0019 class TGLPhysicalShape;
0020 class TGLLogicalShape;
0021 class TGLOverlayElement;
0022 
0023 /**************************************************************************/
0024 // TGLSelectRecordBase
0025 /**************************************************************************/
0026 
0027 class TGLSelectRecordBase
0028 {
0029 protected:
0030    // Primary data - coming from GL.
0031    Int_t    fN;
0032    UInt_t  *fItems;
0033    Float_t  fMinZ;
0034    Float_t  fMaxZ;
0035 
0036    // Current position (for name resolutin in hierachies of unknown depth).
0037    Int_t    fPos;
0038 
0039    void CopyItems(UInt_t* items);
0040 
0041 public:
0042    TGLSelectRecordBase();
0043    TGLSelectRecordBase(UInt_t* data);
0044    TGLSelectRecordBase(const TGLSelectRecordBase& rec);
0045    virtual ~TGLSelectRecordBase();
0046 
0047    TGLSelectRecordBase& operator=(const TGLSelectRecordBase& rec);
0048 
0049    void SetRawOnly(UInt_t* data);
0050 
0051    virtual void Set(UInt_t* data);
0052    virtual void Reset();
0053 
0054    Int_t   GetN()           const { return fN; }
0055    UInt_t* GetItems()       const { return fItems; }
0056    UInt_t  GetItem(Int_t i) const { return fItems[i]; }
0057    Float_t GetMinZ()        const { return fMinZ; }
0058    Float_t GetMaxZ()        const { return fMaxZ; }
0059 
0060    UInt_t  GetCurrItem() const { return fPos < fN ? fItems[fPos] : 0; }
0061    Int_t   GetNLeft()    const { return fN - fPos; }
0062    void    NextPos()           { ++fPos; }
0063    void    PrevPos()           { --fPos; }
0064    void    ResetPos()          { fPos = 0; }
0065 
0066    ClassDef(TGLSelectRecordBase, 0) // Base class for GL selection records.
0067 };
0068 
0069 
0070 /**************************************************************************/
0071 // TGLSelectRecord
0072 /**************************************************************************/
0073 
0074 class TGLSelectRecord : public TGLSelectRecordBase
0075 {
0076 public:
0077    enum ESecSelResult { kNone, kEnteringSelection, kLeavingSelection, kModifyingInternalSelection };
0078 
0079 protected:
0080    // Secondary data (scene dependent) - use
0081    // TGLSceneBase::ResolveSelectRecord() to fill.
0082    Bool_t            fTransparent;
0083    TGLSceneInfo     *fSceneInfo; // SceneInfo
0084    TGLPhysicalShape *fPhysShape; // PhysicalShape, if applicable
0085    TGLLogicalShape  *fLogShape;  // LogicalShape, if applicable
0086    TObject          *fObject;    // Master TObject, if applicable
0087    void             *fSpecific;  // Scene specific, if applicable
0088    Bool_t            fMultiple;  // Mutliple selection requested (set by event-handler).
0089    Bool_t            fHighlight; // Requested for highlight (set by event-handler).
0090 
0091    ESecSelResult     fSecSelRes; // Result of ProcessSelection;
0092 
0093 public:
0094    TGLSelectRecord();
0095    TGLSelectRecord(UInt_t* data);
0096    TGLSelectRecord(const TGLSelectRecord& rec);
0097    ~TGLSelectRecord() override;
0098 
0099    TGLSelectRecord& operator=(const TGLSelectRecord& rec);
0100 
0101    void Set(UInt_t* data) override;
0102    void Reset() override;
0103 
0104    Bool_t             GetTransparent() const { return fTransparent; }
0105    TGLSceneInfo     * GetSceneInfo()   const { return fSceneInfo; }
0106    TGLPhysicalShape * GetPhysShape()   const { return fPhysShape; }
0107    TGLLogicalShape  * GetLogShape()    const { return fLogShape; }
0108    TObject          * GetObject()      const { return fObject; }
0109    void             * GetSpecific()    const { return fSpecific; }
0110    Bool_t             GetMultiple()    const { return fMultiple; }
0111    Bool_t             GetHighlight()   const { return fHighlight; }
0112 
0113    ESecSelResult      GetSecSelResult() const { return fSecSelRes; }
0114 
0115    void SetTransparent(Bool_t t)               { fTransparent = t; }
0116    void SetSceneInfo  (TGLSceneInfo* si)       { fSceneInfo = si; }
0117    void SetPhysShape  (TGLPhysicalShape* pshp) { fPhysShape = pshp; }
0118    void SetLogShape   (TGLLogicalShape* lshp)  { fLogShape = lshp; }
0119    void SetObject     (TObject* obj)           { fObject = obj; }
0120    void SetSpecific   (void* spec)             { fSpecific = spec; }
0121    void SetMultiple   (Bool_t multi)           { fMultiple = multi; }
0122    void SetHighlight  (Bool_t hlt)             { fHighlight = hlt; }
0123 
0124    void SetSecSelResult(ESecSelResult r)       { fSecSelRes = r; }
0125 
0126    void Print();
0127 
0128    static Bool_t AreSameSelectionWise(const TGLSelectRecord& r1,
0129                                       const TGLSelectRecord& r2);
0130 
0131    ClassDefOverride(TGLSelectRecord, 0) // Standard GL selection record.
0132 };
0133 
0134 
0135 /**************************************************************************/
0136 // TGLOvlSelectRecord
0137 /**************************************************************************/
0138 
0139 class TGLOvlSelectRecord : public TGLSelectRecordBase
0140 {
0141 protected:
0142    // Secondary data (overlay dependent).
0143    TGLOverlayElement* fOvlElement;
0144 
0145 public:
0146    TGLOvlSelectRecord();
0147    TGLOvlSelectRecord(UInt_t* data);
0148    TGLOvlSelectRecord(const TGLOvlSelectRecord& rec);
0149    ~TGLOvlSelectRecord() override;
0150 
0151    TGLOvlSelectRecord& operator=(const TGLOvlSelectRecord& rec);
0152 
0153    void Set(UInt_t* data) override;
0154    void Reset() override;
0155 
0156    TGLOverlayElement* GetOvlElement() const { return fOvlElement; }
0157    void SetOvlElement(TGLOverlayElement* e) { fOvlElement = e; }
0158 
0159    ClassDefOverride(TGLOvlSelectRecord, 0) // Standard GL overlay-selection record.
0160 };
0161 
0162 #endif