#ifndef ROOT_TEveElement
#define ROOT_TEveElement
#include "TEveUtil.h"
#include "TNamed.h"
#include "TRef.h"
class TGListTree;
class TGListTreeItem;
class TGPicture;
class TEveCompound;
class TEveTrans;
class TGeoMatrix;
class TEveElement
{
friend class TEveManager;
TEveElement& operator=(const TEveElement&);
public:
class TEveListTreeInfo
{
public:
TGListTree* fTree;
TGListTreeItem* fItem;
TEveListTreeInfo() : fTree(0), fItem(0) {}
TEveListTreeInfo(TGListTree* lt, TGListTreeItem* lti) : fTree(lt), fItem(lti) {}
TEveListTreeInfo(const TEveListTreeInfo& l) : fTree(l.fTree), fItem(l.fItem) {}
virtual ~TEveListTreeInfo() {}
TEveListTreeInfo& operator=(const TEveListTreeInfo& l)
{ fTree = l.fTree; fItem = l.fItem; return *this; }
bool operator==(const TEveListTreeInfo& x) const
{ return fTree == x.fTree && fItem == x.fItem; }
bool operator<(const TEveListTreeInfo& x) const
{ return fTree == x.fTree ? fItem < x.fItem : fTree < x.fTree; }
ClassDef(TEveListTreeInfo, 0);
};
static const TGPicture* fgRnrIcons[4];
static const TGPicture* fgListTreeIcons[8];
typedef std::set<TEveListTreeInfo> sLTI_t;
typedef sLTI_t::iterator sLTI_i;
typedef sLTI_t::reverse_iterator sLTI_ri;
typedef std::list<TEveElement*> List_t;
typedef List_t::iterator List_i;
typedef List_t::const_iterator List_ci;
typedef std::set<TEveElement*> Set_t;
typedef Set_t::iterator Set_i;
typedef Set_t::const_iterator Set_ci;
protected:
List_t fParents;
List_t fChildren;
TEveCompound *fCompound;
TEveElement *fVizModel;
TString fVizTag;
Int_t fParentIgnoreCnt;
Int_t fTopItemCnt;
Int_t fDenyDestroy;
Bool_t fDestroyOnZeroRefCnt;
Bool_t fRnrSelf;
Bool_t fRnrChildren;
Bool_t fCanEditMainTrans;
UChar_t fMainTransparency;
Color_t *fMainColorPtr;
TEveTrans *fMainTrans;
sLTI_t fItems;
TRef fSource;
void *fUserData;
virtual void PreDeleteElement();
virtual void RemoveElementsInternal();
public:
TEveElement();
TEveElement(Color_t& main_color);
TEveElement(const TEveElement& e);
virtual ~TEveElement();
virtual TEveElement* CloneElement() const { return new TEveElement(*this); }
virtual TEveElement* CloneElementRecurse(Int_t level=0) const;
virtual void CloneChildrenRecurse(TEveElement* dest, Int_t level=0) const;
virtual const Text_t* GetElementName() const;
virtual const Text_t* GetElementTitle() const;
virtual void SetElementName (const Text_t* name);
virtual void SetElementTitle(const Text_t* title);
virtual void SetElementNameTitle(const Text_t* name, const Text_t* title);
virtual void NameTitleChanged();
const TString& GetVizTag() const { return fVizTag; }
void SetVizTag(const TString& tag) { fVizTag = tag; }
TEveElement* GetVizModel() const { return fVizModel; }
void SetVizModel(TEveElement* model);
Bool_t FindVizModel();
Bool_t ApplyVizTag(const TString& tag, const TString& fallback_tag="");
virtual void PropagateVizParamsToProjecteds();
virtual void PropagateVizParamsToElements(TEveElement* el=0);
virtual void CopyVizParams(const TEveElement* el);
virtual void CopyVizParamsFromDB();
void SaveVizParams (ostream& out, const TString& tag, const TString& var);
virtual void WriteVizParams(ostream& out, const TString& var);
TEveElement* GetMaster();
TEveCompound* GetCompound() { return fCompound; }
void SetCompound(TEveCompound* c) { fCompound = c; }
virtual void AddParent(TEveElement* re);
virtual void RemoveParent(TEveElement* re);
virtual void CheckReferenceCount(const TEveException& eh="TEveElement::CheckReferenceCount ");
virtual void CollectSceneParents(List_t& scenes);
virtual void CollectSceneParentsFromChildren(List_t& scenes,
TEveElement* parent);
List_i BeginParents() { return fParents.begin(); }
List_i EndParents() { return fParents.end(); }
List_ci BeginParents() const { return fParents.begin(); }
List_ci EndParents() const { return fParents.end(); }
Int_t NumParents() const { return fParents.size(); }
Bool_t HasParents() const { return !fParents.empty(); }
List_i BeginChildren() { return fChildren.begin(); }
List_i EndChildren() { return fChildren.end(); }
List_ci BeginChildren() const { return fChildren.begin(); }
List_ci EndChildren() const { return fChildren.end(); }
Int_t NumChildren() const { return fChildren.size(); }
Bool_t HasChildren() const { return !fChildren.empty(); }
Bool_t HasChild(TEveElement* el);
TEveElement* FindChild(const TString& name, const TClass* cls=0);
TEveElement* FindChild(TPRegexp& regexp, const TClass* cls=0);
Int_t FindChildren(List_t& matches, const TString& name, const TClass* cls=0);
Int_t FindChildren(List_t& matches, TPRegexp& regexp, const TClass* cls=0);
TEveElement* FirstChild() const { return fChildren.front(); }
TEveElement* LastChild () const { return fChildren.back(); }
void EnableListElements (Bool_t rnr_self=kTRUE, Bool_t rnr_children=kTRUE);
void DisableListElements(Bool_t rnr_self=kFALSE, Bool_t rnr_children=kFALSE);
Bool_t GetDestroyOnZeroRefCnt() const { return fDestroyOnZeroRefCnt; }
void SetDestroyOnZeroRefCnt(Bool_t d) { fDestroyOnZeroRefCnt = d; }
Int_t GetDenyDestroy() const { return fDenyDestroy; }
void IncDenyDestroy() { ++fDenyDestroy; }
void DecDenyDestroy() { if (--fDenyDestroy <= 0) CheckReferenceCount("TEveElement::DecDenyDestroy "); }
virtual void PadPaint(Option_t* option);
virtual TObject* GetObject (const TEveException& eh="TEveElement::GetObject ") const;
virtual TObject* GetEditorObject(const TEveException& eh="TEveElement::GetEditorObject ") const { return GetObject(eh); }
virtual TObject* GetRenderObject(const TEveException& eh="TEveElement::GetRenderObject ") const { return GetObject(eh); }
virtual void ExpandIntoListTree(TGListTree* ltree, TGListTreeItem* parent);
virtual void DestroyListSubTree(TGListTree* ltree, TGListTreeItem* parent);
virtual TGListTreeItem* AddIntoListTree(TGListTree* ltree,
TGListTreeItem* parent_lti);
virtual TGListTreeItem* AddIntoListTree(TGListTree* ltree,
TEveElement* parent);
virtual TGListTreeItem* AddIntoListTrees(TEveElement* parent);
virtual Bool_t RemoveFromListTree(TGListTree* ltree,
TGListTreeItem* parent_lti);
virtual Int_t RemoveFromListTrees(TEveElement* parent);
virtual sLTI_i FindItem(TGListTree* ltree);
virtual sLTI_i FindItem(TGListTree* ltree,
TGListTreeItem* parent_lti);
virtual TGListTreeItem* FindListTreeItem(TGListTree* ltree);
virtual TGListTreeItem* FindListTreeItem(TGListTree* ltree,
TGListTreeItem* parent_lti);
virtual Int_t GetNItems() const { return fItems.size(); }
void SpawnEditor();
virtual void ExportToCINT(Text_t* var_name);
virtual Bool_t AcceptElement(TEveElement* el);
virtual void AddElement(TEveElement* el);
virtual void RemoveElement(TEveElement* el);
virtual void RemoveElementLocal(TEveElement* el);
virtual void RemoveElements();
virtual void RemoveElementsLocal();
virtual void Destroy();
virtual void DestroyOrWarn();
virtual void DestroyElements();
virtual Bool_t HandleElementPaste(TEveElement* el);
virtual void ElementChanged(Bool_t update_scenes=kTRUE, Bool_t redraw=kFALSE);
virtual Bool_t CanEditElement() const { return kTRUE; }
virtual Bool_t SingleRnrState() const { return kFALSE; }
virtual Bool_t GetRnrSelf() const { return fRnrSelf; }
virtual Bool_t GetRnrChildren() const { return fRnrChildren; }
virtual Bool_t GetRnrState() const { return fRnrSelf && fRnrChildren; }
virtual Bool_t SetRnrSelf(Bool_t rnr);
virtual Bool_t SetRnrChildren(Bool_t rnr);
virtual Bool_t SetRnrSelfChildren(Bool_t rnr_self, Bool_t rnr_children);
virtual Bool_t SetRnrState(Bool_t rnr);
virtual void PropagateRnrStateToProjecteds();
virtual Bool_t CanEditMainColor() const { return kFALSE; }
Color_t* GetMainColorPtr() const { return fMainColorPtr; }
void SetMainColorPtr(Color_t* color) { fMainColorPtr = color; }
virtual Bool_t HasMainColor() const { return fMainColorPtr != 0; }
virtual Color_t GetMainColor() const { return fMainColorPtr ? *fMainColorPtr : 0; }
virtual void SetMainColor(Color_t color);
void SetMainColorPixel(Pixel_t pixel);
void SetMainColorRGB(UChar_t r, UChar_t g, UChar_t b);
void SetMainColorRGB(Float_t r, Float_t g, Float_t b);
virtual void PropagateMainColorToProjecteds(Color_t color, Color_t old_color);
virtual Bool_t CanEditMainTransparency() const { return kFALSE; }
virtual UChar_t GetMainTransparency() const { return fMainTransparency; }
virtual void SetMainTransparency(UChar_t t);
void SetMainAlpha(Float_t alpha);
virtual Bool_t CanEditMainTrans() const { return fCanEditMainTrans; }
virtual Bool_t HasMainTrans() const { return fMainTrans != 0; }
virtual TEveTrans* PtrMainTrans();
virtual TEveTrans& RefMainTrans();
virtual void InitMainTrans(Bool_t can_edit=kTRUE);
virtual void DestroyMainTrans();
virtual void SetTransMatrix(Double_t* carr);
virtual void SetTransMatrix(const TGeoMatrix& mat);
TRef& GetSource() { return fSource; }
TObject* GetSourceObject() const { return fSource.GetObject(); }
void SetSourceObject(TObject* o) { fSource = o; }
void* GetUserData() const { return fUserData; }
void SetUserData(void* ud) { fUserData = ud; }
protected:
Bool_t fPickable;
Bool_t fSelected;
Bool_t fHighlighted;
Short_t fImpliedSelected;
Short_t fImpliedHighlighted;
public:
typedef void (TEveElement::* Select_foo) (Bool_t);
typedef void (TEveElement::* ImplySelect_foo) ();
Bool_t IsPickable() const { return fPickable; }
void SetPickable(Bool_t p) { fPickable = p; }
void SelectElement(Bool_t state);
void IncImpliedSelected();
void DecImpliedSelected();
void HighlightElement(Bool_t state);
void IncImpliedHighlighted();
void DecImpliedHighlighted();
virtual void FillImpliedSelectedSet(Set_t& impSelSet);
virtual UChar_t GetSelectedLevel() const;
enum EChangeBits
{
kCBColorSelection = BIT(0),
kCBTransBBox = BIT(1),
kCBObjProps = BIT(2),
kCBVisibility = BIT(3)
};
protected:
UChar_t fChangeBits;
Bool_t fDestructing;
public:
void StampColorSelection() { AddStamp(kCBColorSelection); }
void StampTransBBox() { AddStamp(kCBTransBBox); }
void StampObjProps() { AddStamp(kCBObjProps); }
void StampVisibility() { AddStamp(kCBVisibility); }
virtual void AddStamp(UChar_t bits);
virtual void ClearStamps() { fChangeBits = 0; }
UChar_t GetChangeBits() const { return fChangeBits; }
virtual const TGPicture* GetListTreeIcon(Bool_t open=kFALSE);
virtual const TGPicture* GetListTreeCheckBoxIcon();
void VizDB_Apply(const char* tag);
void VizDB_Reapply();
void VizDB_UpdateModel(Bool_t update=kTRUE);
void VizDB_Insert(const char* tag, Bool_t replace=kTRUE, Bool_t update=kTRUE);
ClassDef(TEveElement, 0);
};
class TEveElementObjectPtr : public TEveElement,
public TObject
{
TEveElementObjectPtr& operator=(const TEveElementObjectPtr&);
protected:
TObject* fObject;
Bool_t fOwnObject;
public:
TEveElementObjectPtr(TObject* obj, Bool_t own=kTRUE);
TEveElementObjectPtr(TObject* obj, Color_t& mainColor, Bool_t own=kTRUE);
TEveElementObjectPtr(const TEveElementObjectPtr& e);
virtual ~TEveElementObjectPtr();
virtual TEveElementObjectPtr* CloneElement() const { return new TEveElementObjectPtr(*this); }
virtual TObject* GetObject(const TEveException& eh="TEveElementObjectPtr::GetObject ") const;
virtual void ExportToCINT(Text_t* var_name);
Bool_t GetOwnObject() const { return fOwnObject; }
void SetOwnObject(Bool_t o) { fOwnObject = o; }
ClassDef(TEveElementObjectPtr, 0);
};
class TEveElementList : public TEveElement,
public TNamed
{
private:
TEveElementList& operator=(const TEveElementList&);
protected:
Color_t fColor;
Bool_t fDoColor;
TClass *fChildClass;
public:
TEveElementList(const Text_t* n="TEveElementList", const Text_t* t="",
Bool_t doColor=kFALSE);
TEveElementList(const TEveElementList& e);
virtual ~TEveElementList() {}
virtual TEveElementList* CloneElement() const { return new TEveElementList(*this); }
virtual const Text_t* GetElementName() const { return GetName(); }
virtual const Text_t* GetElementTitle() const { return GetTitle(); }
virtual void SetElementName (const Text_t* name)
{ TNamed::SetName(name); NameTitleChanged(); }
virtual void SetElementTitle(const Text_t* title)
{ TNamed::SetTitle(title); NameTitleChanged(); }
virtual void SetElementNameTitle(const Text_t* name, const Text_t* title)
{ TNamed::SetNameTitle(name, title); NameTitleChanged(); }
virtual Bool_t CanEditMainColor() const { return fDoColor; }
TClass* GetChildClass() const { return fChildClass; }
void SetChildClass(TClass* c) { fChildClass = c; }
virtual Bool_t AcceptElement(TEveElement* el);
ClassDef(TEveElementList, 0);
};
#endif
Last change: Fri Dec 5 09:52:39 2008
Last generated: 2008-12-05 09:52
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.