Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-20 09:27:14

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 {
0078 // clang++ <v20 (-Wshadow) complains about shadowing GuiTypes.h global variable kNone. Let's silence warning:
0079 #if defined(__clang__) && __clang_major__ < 20
0080 #pragma clang diagnostic push
0081 #pragma clang diagnostic ignored "-Wshadow"
0082 #endif
0083       kNone,
0084 #if defined(__clang__) && __clang_major__ < 20
0085 #pragma clang diagnostic pop
0086 #endif
0087       kEnteringSelection, kLeavingSelection, kModifyingInternalSelection };
0088 
0089 protected:
0090    // Secondary data (scene dependent) - use
0091    // TGLSceneBase::ResolveSelectRecord() to fill.
0092    Bool_t            fTransparent;
0093    TGLSceneInfo     *fSceneInfo; // SceneInfo
0094    TGLPhysicalShape *fPhysShape; // PhysicalShape, if applicable
0095    TGLLogicalShape  *fLogShape;  // LogicalShape, if applicable
0096    TObject          *fObject;    // Master TObject, if applicable
0097    void             *fSpecific;  // Scene specific, if applicable
0098    Bool_t            fMultiple;  // Mutliple selection requested (set by event-handler).
0099    Bool_t            fHighlight; // Requested for highlight (set by event-handler).
0100 
0101    ESecSelResult     fSecSelRes; // Result of ProcessSelection;
0102 
0103 public:
0104    TGLSelectRecord();
0105    TGLSelectRecord(UInt_t* data);
0106    TGLSelectRecord(const TGLSelectRecord& rec);
0107    ~TGLSelectRecord() override;
0108 
0109    TGLSelectRecord& operator=(const TGLSelectRecord& rec);
0110 
0111    void Set(UInt_t* data) override;
0112    void Reset() override;
0113 
0114    Bool_t             GetTransparent() const { return fTransparent; }
0115    TGLSceneInfo     * GetSceneInfo()   const { return fSceneInfo; }
0116    TGLPhysicalShape * GetPhysShape()   const { return fPhysShape; }
0117    TGLLogicalShape  * GetLogShape()    const { return fLogShape; }
0118    TObject          * GetObject()      const { return fObject; }
0119    void             * GetSpecific()    const { return fSpecific; }
0120    Bool_t             GetMultiple()    const { return fMultiple; }
0121    Bool_t             GetHighlight()   const { return fHighlight; }
0122 
0123    ESecSelResult      GetSecSelResult() const { return fSecSelRes; }
0124 
0125    void SetTransparent(Bool_t t)               { fTransparent = t; }
0126    void SetSceneInfo  (TGLSceneInfo* si)       { fSceneInfo = si; }
0127    void SetPhysShape  (TGLPhysicalShape* pshp) { fPhysShape = pshp; }
0128    void SetLogShape   (TGLLogicalShape* lshp)  { fLogShape = lshp; }
0129    void SetObject     (TObject* obj)           { fObject = obj; }
0130    void SetSpecific   (void* spec)             { fSpecific = spec; }
0131    void SetMultiple   (Bool_t multi)           { fMultiple = multi; }
0132    void SetHighlight  (Bool_t hlt)             { fHighlight = hlt; }
0133 
0134    void SetSecSelResult(ESecSelResult r)       { fSecSelRes = r; }
0135 
0136    void Print();
0137 
0138    static Bool_t AreSameSelectionWise(const TGLSelectRecord& r1,
0139                                       const TGLSelectRecord& r2);
0140 
0141    ClassDefOverride(TGLSelectRecord, 0) // Standard GL selection record.
0142 };
0143 
0144 
0145 /**************************************************************************/
0146 // TGLOvlSelectRecord
0147 /**************************************************************************/
0148 
0149 class TGLOvlSelectRecord : public TGLSelectRecordBase
0150 {
0151 protected:
0152    // Secondary data (overlay dependent).
0153    TGLOverlayElement* fOvlElement;
0154 
0155 public:
0156    TGLOvlSelectRecord();
0157    TGLOvlSelectRecord(UInt_t* data);
0158    TGLOvlSelectRecord(const TGLOvlSelectRecord& rec);
0159    ~TGLOvlSelectRecord() override;
0160 
0161    TGLOvlSelectRecord& operator=(const TGLOvlSelectRecord& rec);
0162 
0163    void Set(UInt_t* data) override;
0164    void Reset() override;
0165 
0166    TGLOverlayElement* GetOvlElement() const { return fOvlElement; }
0167    void SetOvlElement(TGLOverlayElement* e) { fOvlElement = e; }
0168 
0169    ClassDefOverride(TGLOvlSelectRecord, 0) // Standard GL overlay-selection record.
0170 };
0171 
0172 #endif