12 #ifndef ROOT_TEveElement
13 #define ROOT_TEveElement
35 friend class TEveManager;
37 TEveElement& operator=(
const TEveElement&);
40 class TEveListTreeInfo
44 TGListTreeItem* fItem;
46 TEveListTreeInfo() : fTree(0), fItem(0) {}
47 TEveListTreeInfo(TGListTree* lt, TGListTreeItem* lti) : fTree(lt), fItem(lti) {}
48 TEveListTreeInfo(
const TEveListTreeInfo& l) : fTree(l.fTree), fItem(l.fItem) {}
49 virtual ~TEveListTreeInfo() {}
51 TEveListTreeInfo& operator=(
const TEveListTreeInfo& l)
52 { fTree = l.fTree; fItem = l.fItem;
return *
this; }
54 bool operator==(
const TEveListTreeInfo& x)
const
55 {
return fTree == x.fTree && fItem == x.fItem; }
56 bool operator<(
const TEveListTreeInfo& x)
const
57 {
return fTree == x.fTree ? fItem < x.fItem : fTree < x.fTree; }
59 ClassDef(TEveListTreeInfo, 0);
62 static const TGPicture* fgRnrIcons[4];
63 static const TGPicture* fgListTreeIcons[9];
65 typedef std::set<TEveListTreeInfo> sLTI_t;
66 typedef sLTI_t::iterator sLTI_i;
67 typedef sLTI_t::reverse_iterator sLTI_ri;
69 typedef std::list<TEveElement*> List_t;
70 typedef List_t::iterator List_i;
71 typedef List_t::const_iterator List_ci;
73 typedef std::set<TEveElement*> Set_t;
74 typedef Set_t::iterator Set_i;
75 typedef Set_t::const_iterator Set_ci;
80 TEveCompound *fCompound;
81 TEveElement *fVizModel;
85 Int_t fParentIgnoreCnt;
88 Bool_t fDestroyOnZeroRefCnt;
92 Bool_t fCanEditMainColor;
93 Bool_t fCanEditMainTransparency;
94 Bool_t fCanEditMainTrans;
96 Char_t fMainTransparency;
97 Color_t *fMainColorPtr;
98 TEveTrans *fMainTrans;
105 virtual void PreDeleteElement();
106 virtual void RemoveElementsInternal();
107 virtual void AnnihilateRecursively();
109 static const char* ToString(Bool_t b);
113 TEveElement(Color_t& main_color);
114 TEveElement(
const TEveElement& e);
115 virtual ~TEveElement();
117 virtual TEveElement* CloneElement()
const;
118 virtual TEveElement* CloneElementRecurse(Int_t level=0)
const;
119 virtual void CloneChildrenRecurse(TEveElement* dest, Int_t level=0)
const;
121 virtual const char* GetElementName()
const;
122 virtual const char* GetElementTitle()
const;
123 virtual TString GetHighlightTooltip() {
return TString(GetElementTitle()); }
124 virtual void SetElementName (
const char* name);
125 virtual void SetElementTitle(
const char* title);
126 virtual void SetElementNameTitle(
const char* name,
const char* title);
127 virtual void NameTitleChanged();
129 const TString& GetVizTag()
const {
return fVizTag; }
130 void SetVizTag(
const TString& tag) { fVizTag = tag; }
132 TEveElement* GetVizModel()
const {
return fVizModel; }
133 void SetVizModel(TEveElement* model);
134 Bool_t FindVizModel();
136 Bool_t ApplyVizTag(
const TString& tag,
const TString& fallback_tag=
"");
138 virtual void PropagateVizParamsToProjecteds();
139 virtual void PropagateVizParamsToElements(TEveElement* el=0);
140 virtual void CopyVizParams(
const TEveElement* el);
141 virtual void CopyVizParamsFromDB();
142 void SaveVizParams (std::ostream& out,
const TString& tag,
const TString& var);
143 virtual void WriteVizParams(std::ostream& out,
const TString& var);
145 TEveElement* GetMaster();
146 TEveCompound* GetCompound() {
return fCompound; }
147 void SetCompound(TEveCompound* c) { fCompound = c; }
149 virtual void AddParent(TEveElement* re);
150 virtual void RemoveParent(TEveElement* re);
151 virtual void CheckReferenceCount(
const TEveException& eh=
"TEveElement::CheckReferenceCount ");
152 virtual void CollectSceneParents(List_t& scenes);
153 virtual void CollectSceneParentsFromChildren(List_t& scenes,
154 TEveElement* parent);
156 List_i BeginParents() {
return fParents.begin(); }
157 List_i EndParents() {
return fParents.end(); }
158 List_ci BeginParents()
const {
return fParents.begin(); }
159 List_ci EndParents()
const {
return fParents.end(); }
160 Int_t NumParents()
const {
return fParents.size(); }
161 Bool_t HasParents()
const {
return !fParents.empty(); }
163 const List_t& RefChildren()
const {
return fChildren; }
164 List_i BeginChildren() {
return fChildren.begin(); }
165 List_i EndChildren() {
return fChildren.end(); }
166 List_ci BeginChildren()
const {
return fChildren.begin(); }
167 List_ci EndChildren()
const {
return fChildren.end(); }
168 Int_t NumChildren()
const {
return fNumChildren; }
169 Bool_t HasChildren()
const {
return fNumChildren != 0; }
171 Bool_t HasChild(TEveElement* el);
172 TEveElement* FindChild(
const TString& name,
const TClass* cls=0);
173 TEveElement* FindChild(TPRegexp& regexp,
const TClass* cls=0);
174 Int_t FindChildren(List_t& matches,
const TString& name,
const TClass* cls=0);
175 Int_t FindChildren(List_t& matches, TPRegexp& regexp,
const TClass* cls=0);
176 TEveElement* FirstChild()
const;
177 TEveElement* LastChild ()
const;
179 void EnableListElements (Bool_t rnr_self=kTRUE, Bool_t rnr_children=kTRUE);
180 void DisableListElements(Bool_t rnr_self=kFALSE, Bool_t rnr_children=kFALSE);
182 Bool_t GetDestroyOnZeroRefCnt()
const;
183 void SetDestroyOnZeroRefCnt(Bool_t d);
185 Int_t GetDenyDestroy()
const;
186 void IncDenyDestroy();
187 void DecDenyDestroy();
189 Int_t GetParentIgnoreCnt()
const;
190 void IncParentIgnoreCnt();
191 void DecParentIgnoreCnt();
193 virtual void PadPaint(Option_t* option);
194 virtual void PaintStandard(TObject*
id);
196 virtual TObject* GetObject (
const TEveException& eh)
const;
197 virtual TObject* GetEditorObject(
const TEveException& eh)
const {
return GetObject(eh); }
198 virtual TObject* GetRenderObject(
const TEveException& eh)
const {
return GetObject(eh); }
202 virtual void ExpandIntoListTree(TGListTree* ltree, TGListTreeItem* parent);
203 virtual void DestroyListSubTree(TGListTree* ltree, TGListTreeItem* parent);
205 virtual TGListTreeItem* AddIntoListTree(TGListTree* ltree,
206 TGListTreeItem* parent_lti);
207 virtual TGListTreeItem* AddIntoListTree(TGListTree* ltree,
208 TEveElement* parent);
209 virtual TGListTreeItem* AddIntoListTrees(TEveElement* parent);
211 virtual Bool_t RemoveFromListTree(TGListTree* ltree,
212 TGListTreeItem* parent_lti);
213 virtual Int_t RemoveFromListTrees(TEveElement* parent);
215 virtual sLTI_i FindItem(TGListTree* ltree);
216 virtual sLTI_i FindItem(TGListTree* ltree,
217 TGListTreeItem* parent_lti);
218 virtual TGListTreeItem* FindListTreeItem(TGListTree* ltree);
219 virtual TGListTreeItem* FindListTreeItem(TGListTree* ltree,
220 TGListTreeItem* parent_lti);
222 virtual Int_t GetNItems()
const {
return fItems.size(); }
225 virtual void ExportToCINT(
char* var_name);
227 void DumpSourceObject()
const;
228 void PrintSourceObject()
const;
229 void ExportSourceObjectToCINT(
char* var_name)
const;
231 virtual Bool_t AcceptElement(TEveElement* el);
233 virtual void AddElement(TEveElement* el);
234 virtual void RemoveElement(TEveElement* el);
235 virtual void RemoveElementLocal(TEveElement* el);
236 virtual void RemoveElements();
237 virtual void RemoveElementsLocal();
239 virtual void AnnihilateElements();
240 virtual void Annihilate();
242 virtual void ProjectChild(TEveElement* el, Bool_t same_depth=kTRUE);
243 virtual void ProjectAllChildren(Bool_t same_depth=kTRUE);
245 virtual void Destroy();
246 virtual void DestroyOrWarn();
247 virtual void DestroyElements();
249 virtual Bool_t HandleElementPaste(TEveElement* el);
250 virtual void ElementChanged(Bool_t update_scenes=kTRUE, Bool_t redraw=kFALSE);
252 virtual Bool_t CanEditElement()
const {
return kTRUE; }
253 virtual Bool_t SingleRnrState()
const {
return kFALSE; }
254 virtual Bool_t GetRnrSelf()
const {
return fRnrSelf; }
255 virtual Bool_t GetRnrChildren()
const {
return fRnrChildren; }
256 virtual Bool_t GetRnrState()
const {
return fRnrSelf && fRnrChildren; }
257 virtual Bool_t GetRnrAnything()
const {
return fRnrSelf || (fRnrChildren && HasChildren()); }
258 virtual Bool_t SetRnrSelf(Bool_t rnr);
259 virtual Bool_t SetRnrChildren(Bool_t rnr);
260 virtual Bool_t SetRnrSelfChildren(Bool_t rnr_self, Bool_t rnr_children);
261 virtual Bool_t SetRnrState(Bool_t rnr);
262 virtual void PropagateRnrStateToProjecteds();
264 virtual Bool_t CanEditMainColor()
const {
return fCanEditMainColor; }
265 void SetEditMainColor(Bool_t x) { fCanEditMainColor = x; }
266 Color_t* GetMainColorPtr()
const {
return fMainColorPtr; }
267 void SetMainColorPtr(Color_t* color) { fMainColorPtr = color; }
269 virtual Bool_t HasMainColor()
const {
return fMainColorPtr != 0; }
270 virtual Color_t GetMainColor()
const {
return fMainColorPtr ? *fMainColorPtr : 0; }
271 virtual void SetMainColor(Color_t color);
272 void SetMainColorPixel(Pixel_t pixel);
273 void SetMainColorRGB(UChar_t r, UChar_t g, UChar_t b);
274 void SetMainColorRGB(Float_t r, Float_t g, Float_t b);
275 virtual void PropagateMainColorToProjecteds(Color_t color, Color_t old_color);
277 virtual Bool_t CanEditMainTransparency()
const {
return fCanEditMainTransparency; }
278 void SetEditMainTransparency(Bool_t x) { fCanEditMainTransparency = x; }
279 virtual Char_t GetMainTransparency()
const {
return fMainTransparency; }
280 virtual void SetMainTransparency(Char_t t);
281 void SetMainAlpha(Float_t alpha);
282 virtual void PropagateMainTransparencyToProjecteds(Char_t t, Char_t old_t);
284 virtual Bool_t CanEditMainTrans()
const {
return fCanEditMainTrans; }
285 virtual Bool_t HasMainTrans()
const {
return fMainTrans != 0; }
286 virtual TEveTrans* PtrMainTrans(Bool_t create=kTRUE);
287 virtual TEveTrans& RefMainTrans();
288 virtual void InitMainTrans(Bool_t can_edit=kTRUE);
289 virtual void DestroyMainTrans();
291 virtual void SetTransMatrix(Double_t* carr);
292 virtual void SetTransMatrix(
const TGeoMatrix& mat);
294 TRef& GetSource() {
return fSource; }
295 TObject* GetSourceObject()
const {
return fSource.GetObject(); }
296 void SetSourceObject(TObject* o) { fSource = o; }
302 void* GetUserData()
const {
return fUserData; }
303 void SetUserData(
void* ud) { fUserData = ud; }
313 Short_t fImpliedSelected;
314 Short_t fImpliedHighlighted;
316 enum ECompoundSelectionColorBits
318 kCSCBImplySelectAllChildren = BIT(0),
319 kCSCBTakeAnyParentAsMaster = BIT(1),
320 kCSCBApplyMainColorToAllChildren = BIT(2),
321 kCSCBApplyMainColorToMatchingChildren = BIT(3),
322 kCSCBApplyMainTransparencyToAllChildren = BIT(4),
323 kCSCBApplyMainTransparencyToMatchingChildren = BIT(5)
336 typedef void (TEveElement::* Select_foo) (Bool_t);
337 typedef void (TEveElement::* ImplySelect_foo) ();
339 Bool_t IsPickable()
const {
return fPickable; }
340 void SetPickable(Bool_t p) { fPickable = p; }
341 void SetPickableRecursively(Bool_t p);
343 virtual TEveElement* ForwardSelection();
344 virtual TEveElement* ForwardEdit();
346 virtual void SelectElement(Bool_t state);
347 virtual void IncImpliedSelected();
348 virtual void DecImpliedSelected();
349 virtual void UnSelected();
351 virtual void HighlightElement(Bool_t state);
352 virtual void IncImpliedHighlighted();
353 virtual void DecImpliedHighlighted();
354 virtual void UnHighlighted();
356 virtual void FillImpliedSelectedSet(Set_t& impSelSet);
358 virtual UChar_t GetSelectedLevel()
const;
360 void RecheckImpliedSelections();
362 void SetCSCBits(UChar_t f) { fCSCBits |= f; }
363 void ResetCSCBits(UChar_t f) { fCSCBits &= ~f; }
364 Bool_t TestCSCBits(UChar_t f)
const {
return (fCSCBits & f) != 0; }
366 void ResetAllCSCBits() { fCSCBits = 0; }
367 void CSCImplySelectAllChildren() { fCSCBits |= kCSCBImplySelectAllChildren; }
368 void CSCTakeAnyParentAsMaster() { fCSCBits |= kCSCBTakeAnyParentAsMaster; }
369 void CSCApplyMainColorToAllChildren() { fCSCBits |= kCSCBApplyMainColorToAllChildren; }
370 void CSCApplyMainColorToMatchingChildren() { fCSCBits |= kCSCBApplyMainColorToMatchingChildren; }
371 void CSCApplyMainTransparencyToAllChildren() { fCSCBits |= kCSCBApplyMainTransparencyToAllChildren; }
372 void CSCApplyMainTransparencyToMatchingChildren() { fCSCBits |= kCSCBApplyMainTransparencyToMatchingChildren; }
380 kCBColorSelection = BIT(0),
381 kCBTransBBox = BIT(1),
382 kCBObjProps = BIT(2),
383 kCBVisibility = BIT(3)
395 void StampColorSelection() { AddStamp(kCBColorSelection); }
396 void StampTransBBox() { AddStamp(kCBTransBBox); }
397 void StampObjProps() { AddStamp(kCBObjProps); }
398 void StampVisibility() { AddStamp(kCBVisibility); }
401 virtual void AddStamp(UChar_t bits);
402 virtual void ClearStamps() { fChangeBits = 0; }
404 UChar_t GetChangeBits()
const {
return fChangeBits; }
410 virtual const TGPicture* GetListTreeIcon(Bool_t open=kFALSE);
411 virtual const TGPicture* GetListTreeCheckBoxIcon();
415 void VizDB_Apply(
const char* tag);
416 void VizDB_Reapply();
417 void VizDB_UpdateModel(Bool_t update=kTRUE);
418 void VizDB_Insert(
const char* tag, Bool_t replace=kTRUE, Bool_t update=kTRUE);
420 ClassDef(TEveElement, 0);
428 class TEveElementList :
public TEveElement,
430 public TEveProjectable
433 TEveElementList& operator=(
const TEveElementList&);
440 TEveElementList(
const char* n=
"TEveElementList",
const char* t=
"",
441 Bool_t doColor=kFALSE, Bool_t doTransparency=kFALSE);
442 TEveElementList(
const TEveElementList& e);
443 virtual ~TEveElementList() {}
445 virtual TObject* GetObject(
const TEveException& =
"TEveElementList::GetObject ")
const
446 {
const TObject* obj =
this;
return const_cast<TObject*
>(obj); }
448 virtual TEveElementList* CloneElement()
const;
450 virtual const char* GetElementName()
const {
return GetName(); }
451 virtual const char* GetElementTitle()
const {
return GetTitle(); }
453 virtual void SetElementName (
const char* name)
454 { TNamed::SetName(name); NameTitleChanged(); }
456 virtual void SetElementTitle(
const char* title)
457 { TNamed::SetTitle(title); NameTitleChanged(); }
459 virtual void SetElementNameTitle(
const char* name,
const char* title)
460 { TNamed::SetNameTitle(name, title); NameTitleChanged(); }
462 TClass* GetChildClass()
const {
return fChildClass; }
463 void SetChildClass(TClass* c) { fChildClass = c; }
465 virtual Bool_t AcceptElement(TEveElement* el);
467 virtual TClass* ProjectedClass(
const TEveProjection* p)
const;
469 ClassDef(TEveElementList, 0);
477 class TEveElementListProjected :
public TEveElementList,
481 TEveElementListProjected(
const TEveElementListProjected&);
482 TEveElementListProjected& operator=(
const TEveElementListProjected&);
485 TEveElementListProjected();
486 virtual ~TEveElementListProjected() {}
488 virtual void UpdateProjection();
489 virtual TEveElement* GetProjectedAsElement() {
return this; }
491 ClassDef(TEveElementListProjected, 0);