Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TEveElement.cxx
Go to the documentation of this file.
1// @(#)root/eve:$Id$
2// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2007, 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#include "TEveElement.h"
13#include "TEveCompound.h"
14#include "TEveTrans.h"
15#include "TEveManager.h"
16#include "TEveSelection.h"
17#include "TEveProjectionBases.h"
19
20#include "TBuffer3D.h"
21#include "TBuffer3DTypes.h"
22#include "TVirtualPad.h"
23#include "TVirtualViewer3D.h"
24
25#include "TGeoMatrix.h"
26
27#include "TClass.h"
28#include "TPRegexp.h"
29#include "TROOT.h"
30#include "TColor.h"
31#include "TVirtualX.h"
32#include "TEveBrowser.h"
33#include "TGListTree.h"
34#include "TGPicture.h"
35
36#include <algorithm>
37
38/** \class TEveElement::TEveListTreeInfo
39\ingroup TEve
40Structure holding information about TGListTree and TGListTreeItem
41that represents given TEveElement. This needed because each element
42can appear in several list-trees as well as several times in the
43same list-tree.
44*/
45
46
47/** \class TEveElement
48\ingroup TEve
49Base class for TEveUtil visualization elements, providing hierarchy
50management, rendering control and list-tree item management.
51*/
52
53
54const TGPicture* TEveElement::fgRnrIcons[4] = { nullptr };
55const TGPicture* TEveElement::fgListTreeIcons[9] = { nullptr };
56
57////////////////////////////////////////////////////////////////////////////////
58/// Default constructor.
59
61 fParents (),
62 fChildren (),
63 fCompound (nullptr),
64 fVizModel (nullptr),
65 fVizTag (),
66 fNumChildren (0),
67 fParentIgnoreCnt (0),
68 fTopItemCnt (0),
69 fDenyDestroy (0),
70 fDestroyOnZeroRefCnt (kTRUE),
71 fRnrSelf (kTRUE),
72 fRnrChildren (kTRUE),
73 fCanEditMainColor (kFALSE),
74 fCanEditMainTransparency(kFALSE),
75 fCanEditMainTrans (kFALSE),
76 fMainTransparency (0),
77 fMainColorPtr (nullptr),
78 fMainTrans (nullptr),
79 fItems (),
80 fSource (),
81 fUserData (nullptr),
82 fPickable (kFALSE),
83 fSelected (kFALSE),
84 fHighlighted (kFALSE),
85 fImpliedSelected (0),
86 fImpliedHighlighted (0),
87 fCSCBits (0),
88 fChangeBits (0),
89 fDestructing (kNone)
90{
91}
92
93////////////////////////////////////////////////////////////////////////////////
94/// Constructor.
95
97 fParents (),
98 fChildren (),
99 fCompound (nullptr),
100 fVizModel (nullptr),
101 fVizTag (),
102 fNumChildren (0),
103 fParentIgnoreCnt (0),
104 fTopItemCnt (0),
105 fDenyDestroy (0),
106 fDestroyOnZeroRefCnt (kTRUE),
107 fRnrSelf (kTRUE),
108 fRnrChildren (kTRUE),
109 fCanEditMainColor (kFALSE),
110 fCanEditMainTransparency(kFALSE),
111 fCanEditMainTrans (kFALSE),
112 fMainTransparency (0),
113 fMainColorPtr (&main_color),
114 fMainTrans (nullptr),
115 fItems (),
116 fSource (),
117 fUserData (nullptr),
118 fPickable (kFALSE),
119 fSelected (kFALSE),
120 fHighlighted (kFALSE),
121 fImpliedSelected (0),
122 fImpliedHighlighted (0),
123 fCSCBits (0),
124 fChangeBits (0),
125 fDestructing (kNone)
126{
127}
128
129////////////////////////////////////////////////////////////////////////////////
130/// Copy constructor. Does shallow copy.
131/// For deep-cloning and children-cloning, see:
132/// ~~~ {.cpp}
133/// TEveElement* CloneElementRecurse(Int_t level)
134/// void CloneChildrenRecurse(TEveElement* dest, Int_t level)
135/// ~~~
136/// 'TRef fSource' is copied but 'void* UserData' is NOT.
137/// If the element is projectable, its projections are NOT copied.
138///
139/// Not implemented for most sub-classes, let us know.
140/// Note that sub-classes of TEveProjected are NOT and will NOT be copyable.
141
143 fParents (),
144 fChildren (),
145 fCompound (nullptr),
146 fVizModel (nullptr),
147 fVizTag (e.fVizTag),
148 fNumChildren (0),
149 fParentIgnoreCnt (0),
150 fTopItemCnt (0),
151 fDenyDestroy (0),
152 fDestroyOnZeroRefCnt (e.fDestroyOnZeroRefCnt),
153 fRnrSelf (e.fRnrSelf),
154 fRnrChildren (e.fRnrChildren),
155 fCanEditMainColor (e.fCanEditMainColor),
156 fCanEditMainTransparency(e.fCanEditMainTransparency),
157 fCanEditMainTrans (e.fCanEditMainTrans),
158 fMainTransparency (e.fMainTransparency),
159 fMainColorPtr (nullptr),
160 fMainTrans (nullptr),
161 fItems (),
162 fSource (e.fSource),
163 fUserData (nullptr),
164 fPickable (e.fPickable),
165 fSelected (kFALSE),
166 fHighlighted (kFALSE),
167 fImpliedSelected (0),
168 fImpliedHighlighted (0),
169 fCSCBits (e.fCSCBits),
170 fChangeBits (0),
171 fDestructing (kNone)
172{
173 SetVizModel(e.fVizModel);
174 if (e.fMainColorPtr)
175 fMainColorPtr = (Color_t*)((const char*) this + ((const char*) e.fMainColorPtr - (const char*) &e));
176 if (e.fMainTrans)
177 fMainTrans = new TEveTrans(*e.fMainTrans);
178}
179
180////////////////////////////////////////////////////////////////////////////////
181/// Destructor. Do not call this method directly, either call Destroy() or
182/// Annihilate(). See also DestroyElements() and AnnihilateElements() if you
183/// need to delete all children of an element.
184
186{
188 {
191
192 for (List_i p=fParents.begin(); p!=fParents.end(); ++p)
193 {
194 (*p)->RemoveElementLocal(this);
195 (*p)->fChildren.remove(this);
196 --((*p)->fNumChildren);
197 }
198 }
199
200 fParents.clear();
201
202 for (sLTI_i i=fItems.begin(); i!=fItems.end(); ++i)
203 i->fTree->DeleteItem(i->fItem);
204
205 delete fMainTrans;
206}
207
208////////////////////////////////////////////////////////////////////////////////
209/// Called before the element is deleted, thus offering the last chance
210/// to detach from acquired resources and from the framework itself.
211/// Here the request is just passed to TEveManager.
212/// If you override it, make sure to call base-class version.
213
218
219////////////////////////////////////////////////////////////////////////////////
220/// Clone the element via copy constructor.
221/// Should be implemented for all classes that require cloning support.
222
224{
225 return new TEveElement(*this);
226}
227
228////////////////////////////////////////////////////////////////////////////////
229/// Clone elements and recurse 'level' deep over children.
230/// - If level == 0, only the element itself is cloned (default).
231/// - If level == -1, all the hierarchy is cloned.
232
234{
236 if (level--)
237 {
238 CloneChildrenRecurse(el, level);
239 }
240 return el;
241}
242
243////////////////////////////////////////////////////////////////////////////////
244/// Clone children and attach them to the dest element.
245/// If level == 0, only the direct descendants are cloned (default).
246/// If level == -1, all the hierarchy is cloned.
247
249{
250 for (List_ci i=fChildren.begin(); i!=fChildren.end(); ++i)
251 {
252 dest->AddElement((*i)->CloneElementRecurse(level));
253 }
254}
255
256
257//==============================================================================
258
259////////////////////////////////////////////////////////////////////////////////
260/// Virtual function for retrieving name of the element.
261/// Here we attempt to cast the assigned object into TNamed and call
262/// GetName() there.
263
265{
266 static const TEveException eh("TEveElement::GetElementName ");
267
268 TNamed* named = dynamic_cast<TNamed*>(GetObject(eh));
269 return named ? named->GetName() : "<no-name>";
270}
271
272////////////////////////////////////////////////////////////////////////////////
273/// Virtual function for retrieving title of the render-element.
274/// Here we attempt to cast the assigned object into TNamed and call
275/// GetTitle() there.
276
278{
279 static const TEveException eh("TEveElement::GetElementTitle ");
280
281 TNamed* named = dynamic_cast<TNamed*>(GetObject(eh));
282 return named ? named->GetTitle() : "<no-title>";
283}
284
285////////////////////////////////////////////////////////////////////////////////
286/// Virtual function for setting of name of an element.
287/// Here we attempt to cast the assigned object into TNamed and call
288/// SetName() there.
289/// If you override this call NameTitleChanged() from there.
290
292{
293 static const TEveException eh("TEveElement::SetElementName ");
294
295 TNamed* named = dynamic_cast<TNamed*>(GetObject(eh));
296 if (named) {
297 named->SetName(name);
299 }
300}
301
302////////////////////////////////////////////////////////////////////////////////
303/// Virtual function for setting of title of an element.
304/// Here we attempt to cast the assigned object into TNamed and call
305/// SetTitle() there.
306/// If you override this call NameTitleChanged() from there.
307
308void TEveElement::SetElementTitle(const char* title)
309{
310 static const TEveException eh("TEveElement::SetElementTitle ");
311
312 TNamed* named = dynamic_cast<TNamed*>(GetObject(eh));
313 if (named) {
314 named->SetTitle(title);
316 }
317}
318
319////////////////////////////////////////////////////////////////////////////////
320/// Virtual function for setting of name and title of render element.
321/// Here we attempt to cast the assigned object into TNamed and call
322/// SetNameTitle() there.
323/// If you override this call NameTitleChanged() from there.
324
325void TEveElement::SetElementNameTitle(const char* name, const char* title)
326{
327 static const TEveException eh("TEveElement::SetElementNameTitle ");
328
329 TNamed* named = dynamic_cast<TNamed*>(GetObject(eh));
330 if (named) {
331 named->SetNameTitle(name, title);
333 }
334}
335
336////////////////////////////////////////////////////////////////////////////////
337/// Virtual function called when a name or title of the element has
338/// been changed.
339/// If you override this, call also the version of your direct base-class.
340
342{
343 // Nothing to do - list-tree-items take this info directly.
344}
345
346//******************************************************************************
347
348////////////////////////////////////////////////////////////////////////////////
349/// Set visualization-parameter model element.
350/// Calling of this function from outside of EVE should in principle
351/// be avoided as it can lead to dis-synchronization of viz-tag and
352/// viz-model.
353
355{
356 if (fVizModel) {
359 }
360 fVizModel = model;
361 if (fVizModel) {
362 fVizModel->AddElement(this);
364 }
365}
366
367////////////////////////////////////////////////////////////////////////////////
368/// Find model element in VizDB that corresponds to previously
369/// assigned fVizTag and set fVizModel accordingly.
370/// If the tag is not found in VizDB, the old model-element is kept
371/// and false is returned.
372
374{
376 if (model)
377 {
378 SetVizModel(model);
379 return kTRUE;
380 }
381 else
382 {
383 return kFALSE;
384 }
385}
386
387////////////////////////////////////////////////////////////////////////////////
388/// Set the VizTag, find model-element from the VizDB and copy
389/// visualization-parameters from it. If the model is not found and
390/// fallback_tag is non-null, its search is attempted as well.
391/// For example: ApplyVizTag("TPC Clusters", "Clusters");
392///
393/// If the model-element can not be found a warning is printed and
394/// false is returned.
395
396Bool_t TEveElement::ApplyVizTag(const TString& tag, const TString& fallback_tag)
397{
398 SetVizTag(tag);
399 if (FindVizModel())
400 {
402 return kTRUE;
403 }
404 if ( ! fallback_tag.IsNull())
405 {
406 SetVizTag(fallback_tag);
407 if (FindVizModel())
408 {
410 return kTRUE;
411 }
412 }
413 Warning("TEveElement::ApplyVizTag", "entry for tag '%s' not found in VizDB.", tag.Data());
414 return kFALSE;
415}
416
417////////////////////////////////////////////////////////////////////////////////
418/// Propagate visualization parameters to dependent elements.
419///
420/// MainColor is propagated independently in SetMainColor().
421/// In this case, as fMainColor is a pointer to Color_t, it should
422/// be set in TProperClass::CopyVizParams().
423///
424/// Render state is not propagated. Maybe it should be, at least optionally.
425
427{
428 TEveProjectable* pable = dynamic_cast<TEveProjectable*>(this);
429 if (pable && pable->HasProjecteds())
430 {
431 pable->PropagateVizParams();
432 }
433}
434
435////////////////////////////////////////////////////////////////////////////////
436/// Propagate visualization parameters from element el (defaulting
437/// to this) to all elements (children).
438///
439/// The primary use of this is for model-elements from
440/// visualization-parameter database.
441
443{
444 if (el == nullptr)
445 el = this;
446
447 for (List_i i=fChildren.begin(); i!=fChildren.end(); ++i)
448 {
449 (*i)->CopyVizParams(el);
450 }
451}
452
453////////////////////////////////////////////////////////////////////////////////
454/// Copy visualization parameters from element el.
455/// This method needs to be overriden by any class that introduces
456/// new parameters.
457/// Color is copied in sub-classes which define it.
458/// See, for example, TEvePointSet::CopyVizParams(),
459/// TEveLine::CopyVizParams() and TEveTrack::CopyVizParams().
460
469
470////////////////////////////////////////////////////////////////////////////////
471/// Copy visualization parameters from the model-element fVizModel.
472/// A warning is printed if the model-element fVizModel is not set.
473
475{
476 if (fVizModel)
477 {
479 }
480 else
481 {
482 Warning("TEveElement::CopyVizParamsFromDB", "VizModel has not been set.");
483 }
484}
485
486////////////////////////////////////////////////////////////////////////////////
487/// Save visualization parameters for this element with given tag.
488///
489/// This function creates the instantiation code, calls virtual
490/// WriteVizParams() and, at the end, writes out the code for
491/// registration of the model into the VizDB.
492
493void TEveElement::SaveVizParams(std::ostream& out, const TString& tag, const TString& var)
494{
495 static const TEveException eh("TEveElement::GetObject ");
496
497 TString t = " ";
498 TString cls(GetObject(eh)->ClassName());
499
500 out << "\n";
501
502 TString intro = " TAG='" + tag + "', CLASS='" + cls + "'";
503 out << " //" << intro << "\n";
504 out << " //" << TString('-', intro.Length()) << "\n";
505 out << t << cls << "* " << var <<" = new " << cls << ";\n";
506
507 WriteVizParams(out, var);
508
509 out << t << "gEve->InsertVizDBEntry(\"" << tag << "\", "<< var <<");\n";
510}
511
512////////////////////////////////////////////////////////////////////////////////
513/// Write-out visual parameters for this object.
514/// This is a virtual function and all sub-classes are required to
515/// first call the base-element version.
516/// The name of the element pointer is 'x%03d', due to historical CINT limitations.
517/// Three spaces should be used for indentation, same as in
518/// SavePrimitive() methods.
519
520void TEveElement::WriteVizParams(std::ostream& out, const TString& var)
521{
522 TString t = " " + var + "->";
523
524 out << t << "SetElementName(\"" << GetElementName() << "\");\n";
525 out << t << "SetElementTitle(\"" << GetElementTitle() << "\");\n";
526 out << t << "SetEditMainColor(" << fCanEditMainColor << ");\n";
527 out << t << "SetEditMainTransparency(" << fCanEditMainTransparency << ");\n";
528 out << t << "SetMainTransparency(" << fMainTransparency << ");\n";
529}
530
531////////////////////////////////////////////////////////////////////////////////
532/// Set visual parameters for this object for given tag.
533
534void TEveElement::VizDB_Apply(const char* tag)
535{
536 if (ApplyVizTag(tag))
537 {
539 gEve->Redraw3D();
540 }
541}
542
543////////////////////////////////////////////////////////////////////////////////
544/// Reset visual parameters for this object from VizDB.
545/// The model object must be already set.
546
556
557////////////////////////////////////////////////////////////////////////////////
558/// Copy visual parameters from this element to viz-db model.
559/// If update is set, all clients of the model will be updated to
560/// the new value.
561/// A warning is printed if the model-element fVizModel is not set.
562
564{
565 if (fVizModel)
566 {
568 if (update)
569 {
571 gEve->Redraw3D();
572 }
573 }
574 else
575 {
576 Warning("VizDB_UpdateModel", "VizModel has not been set.");
577 }
578}
579
580////////////////////////////////////////////////////////////////////////////////
581/// Create a replica of element and insert it into VizDB with given tag.
582/// If replace is true an existing element with the same tag will be replaced.
583/// If update is true, existing client of tag will be updated.
584
585void TEveElement::VizDB_Insert(const char* tag, Bool_t replace, Bool_t update)
586{
587 static const TEveException eh("TEveElement::GetObject ");
588
589 TClass* cls = GetObject(eh)->IsA();
590 TEveElement* el = reinterpret_cast<TEveElement*>(cls->New());
591 if (el == nullptr) {
592 Error("VizDB_Insert", "Creation of replica failed.");
593 return;
594 }
595 el->CopyVizParams(this);
596 Bool_t succ = gEve->InsertVizDBEntry(tag, el, replace, update);
597 if (succ && update)
598 gEve->Redraw3D();
599}
600
601////////////////////////////////////////////////////////////////////////////////
602/// Returns the master element - that is:
603/// - master of projectable, if this is a projected;
604/// - master of compound, if fCompound is set;
605/// - master of first compound parent, if kSCBTakeAnyParentAsMaster bit is set;
606/// If non of the above is true, *this* is returned.
607
609{
610 TEveProjected* proj = dynamic_cast<TEveProjected*>(this);
611 if (proj)
612 {
613 return dynamic_cast<TEveElement*>(proj->GetProjectable())->GetMaster();
614 }
615 if (fCompound)
616 {
617 return fCompound->GetMaster();
618 }
620 {
621 for (List_i i = fParents.begin(); i != fParents.end(); ++i)
622 if (dynamic_cast<TEveCompound*>(*i))
623 return (*i)->GetMaster();
624 }
625 return this;
626}
627
628////////////////////////////////////////////////////////////////////////////////
629/// Add re into the list parents.
630///
631/// Adding parent is subordinate to adding an element.
632/// This is an internal function.
633
635{
636 fParents.push_back(re);
637}
638
639////////////////////////////////////////////////////////////////////////////////
640/// Remove re from the list of parents.
641/// Removing parent is subordinate to removing an element.
642/// This is an internal function.
643
645{
646 static const TEveException eh("TEveElement::RemoveParent ");
647
648 fParents.remove(re);
650}
651
652/******************************************************************************/
653
654////////////////////////////////////////////////////////////////////////////////
655/// Check external references to this and eventually auto-destruct
656/// the render-element.
657
659{
660 if (fDestructing != kNone)
661 return;
662
663 if (NumParents() <= fParentIgnoreCnt && fTopItemCnt <= 0 &&
665 {
666 if (gEve->GetUseOrphanage())
667 {
668 if (gDebug > 0)
669 Info(eh, "moving to orphanage '%s' on zero reference count.", GetElementName());
670
672 gEve->GetOrphanage()->AddElement(this);
673 }
674 else
675 {
676 if (gDebug > 0)
677 Info(eh, "auto-destructing '%s' on zero reference count.", GetElementName());
678
680 delete this;
681 }
682 }
683}
684
685////////////////////////////////////////////////////////////////////////////////
686/// Collect all parents of class TEveScene. This is needed to
687/// automatically detect which scenes need to be updated.
688///
689/// Overriden in TEveScene to include itself and return.
690
692{
693 for (List_i p=fParents.begin(); p!=fParents.end(); ++p)
694 (*p)->CollectSceneParents(scenes);
695}
696
697////////////////////////////////////////////////////////////////////////////////
698/// Collect scene-parents from all children. This is needed to
699/// automatically detect which scenes need to be updated during/after
700/// a full sub-tree update.
701/// Argument parent specifies parent in traversed hierarchy for which we can
702/// skip the upwards search.
703
705 TEveElement* parent)
706{
707 for (List_i p=fParents.begin(); p!=fParents.end(); ++p)
708 {
709 if (*p != parent) (*p)->CollectSceneParents(scenes);
710 }
711
712 for (List_i c=fChildren.begin(); c!=fChildren.end(); ++c)
713 {
714 (*c)->CollectSceneParentsFromChildren(scenes, this);
715 }
716}
717
718////////////////////////////////////////////////////////////////////////////////
719/// Populates parent with elements.
720/// parent must be an already existing representation of *this*.
721/// Returns number of inserted elements.
722/// If parent already has children, it does nothing.
723///
724/// Element can be inserted in a list-tree several times, thus we can not
725/// search through fItems to get parent here.
726/// Anyhow, it is probably known as it must have been selected by the user.
727
729 TGListTreeItem* parent)
730{
731 if (parent->GetFirstChild() != nullptr)
732 return;
733 for (List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
734 (*i)->AddIntoListTree(ltree, parent);
735 }
736}
737
738////////////////////////////////////////////////////////////////////////////////
739/// Destroy sub-tree under item 'parent' in list-tree 'ltree'.
740
742 TGListTreeItem* parent)
743{
744 TGListTreeItem* i = parent->GetFirstChild();
745 while (i != nullptr)
746 {
747 TEveElement* re = (TEveElement*) i->GetUserData();
748 i = i->GetNextSibling();
749 re->RemoveFromListTree(ltree, parent);
750 }
751}
752
753////////////////////////////////////////////////////////////////////////////////
754/// Add this element into ltree to an already existing item
755/// parent_lti. Children, if any, are added as below the newly created item.
756/// Returns the newly created list-tree-item.
757
759 TGListTreeItem* parent_lti)
760{
761 static const TEveException eh("TEveElement::AddIntoListTree ");
762
763 TGListTreeItem* item = new TEveListTreeItem(this);
764 ltree->AddItem(parent_lti, item);
765 fItems.insert(TEveListTreeInfo(ltree, item));
766
767 if (parent_lti == nullptr)
768 ++fTopItemCnt;
769
770 for (List_i i=fChildren.begin(); i!=fChildren.end(); ++i)
771 {
772 (*i)->AddIntoListTree(ltree, item);
773 }
774
775 ltree->ClearViewPort();
776
777 return item;
778}
779
780////////////////////////////////////////////////////////////////////////////////
781/// Add this render element into ltree to all items belonging to
782/// parent. Returns list-tree-item from the first register entry (but
783/// we use a set for that so it can be anything).
784
786 TEveElement* parent)
787{
788 TGListTreeItem* lti = nullptr;
789 if (parent == nullptr) {
790 lti = AddIntoListTree(ltree, (TGListTreeItem*) nullptr);
791 } else {
792 for (sLTI_ri i = parent->fItems.rbegin(); i != parent->fItems.rend(); ++i)
793 {
794 if (i->fTree == ltree)
795 lti = AddIntoListTree(ltree, i->fItem);
796 }
797 }
798 return lti;
799}
800
801////////////////////////////////////////////////////////////////////////////////
802/// Add this render element into all list-trees and all items
803/// belonging to parent. Returns list-tree-item from the first
804/// register entry (but we use a set for that so it can be anything).
805
807{
808 TGListTreeItem* lti = nullptr;
809 for (sLTI_ri i = parent->fItems.rbegin(); i != parent->fItems.rend(); ++i)
810 {
811 lti = AddIntoListTree(i->fTree, i->fItem);
812 }
813 return lti;
814}
815
816////////////////////////////////////////////////////////////////////////////////
817/// Remove element from list-tree 'ltree' where its parent item is
818/// 'parent_lti'.
819/// Returns kTRUE if the item was found and removed, kFALSE
820/// otherwise.
821
823 TGListTreeItem* parent_lti)
824{
825 static const TEveException eh("TEveElement::RemoveFromListTree ");
826
827 sLTI_i i = FindItem(ltree, parent_lti);
828 if (i != fItems.end()) {
829 DestroyListSubTree(ltree, i->fItem);
830 ltree->DeleteItem(i->fItem);
831 ltree->ClearViewPort();
832 fItems.erase(i);
833 if (parent_lti == nullptr) {
834 --fTopItemCnt;
836 }
837 return kTRUE;
838 } else {
839 return kFALSE;
840 }
841}
842
843////////////////////////////////////////////////////////////////////////////////
844/// Remove element from all list-trees where 'parent' is the
845/// user-data of the parent list-tree-item.
846
848{
849 static const TEveException eh("TEveElement::RemoveFromListTrees ");
850
851 Int_t count = 0;
852
853 sLTI_i i = fItems.begin();
854 while (i != fItems.end())
855 {
856 sLTI_i j = i++;
857 TGListTreeItem *plti = j->fItem->GetParent();
858 if ((plti != nullptr && (TEveElement*) plti->GetUserData() == parent) ||
859 (plti == nullptr && parent == nullptr))
860 {
861 DestroyListSubTree(j->fTree, j->fItem);
862 j->fTree->DeleteItem(j->fItem);
863 j->fTree->ClearViewPort();
864 fItems.erase(j);
865 if (parent == nullptr)
866 --fTopItemCnt;
867 ++count;
868 }
869 }
870
871 if (parent == nullptr && count > 0)
873
874 return count;
875}
876
877////////////////////////////////////////////////////////////////////////////////
878/// Find any list-tree-item of this element in list-tree 'ltree'.
879/// Note that each element can be placed into the same list-tree on
880/// several postions.
881
883{
884 for (sLTI_i i = fItems.begin(); i != fItems.end(); ++i)
885 if (i->fTree == ltree)
886 return i;
887 return fItems.end();
888}
889
890////////////////////////////////////////////////////////////////////////////////
891/// Find list-tree-item of this element with given parent
892/// list-tree-item.
893
895 TGListTreeItem* parent_lti)
896{
897 for (sLTI_i i = fItems.begin(); i != fItems.end(); ++i)
898 if (i->fTree == ltree && i->fItem->GetParent() == parent_lti)
899 return i;
900 return fItems.end();
901}
902
903////////////////////////////////////////////////////////////////////////////////
904/// Find any list-tree-item of this element in list-tree 'ltree'.
905/// Note that each element can be placed into the same list-tree on
906/// several postions.
907
909{
910 for (sLTI_i i = fItems.begin(); i != fItems.end(); ++i)
911 if (i->fTree == ltree)
912 return i->fItem;
913 return nullptr;
914}
915
916////////////////////////////////////////////////////////////////////////////////
917/// Find list-tree-item of this element with given parent
918/// list-tree-item.
919
921 TGListTreeItem* parent_lti)
922{
923 for (sLTI_i i = fItems.begin(); i != fItems.end(); ++i)
924 if (i->fTree == ltree && i->fItem->GetParent() == parent_lti)
925 return i->fItem;
926 return nullptr;
927}
928
929////////////////////////////////////////////////////////////////////////////////
930/// Get a TObject associated with this render-element.
931/// Most cases uses double-inheritance from TEveElement and TObject
932/// so we just do a dynamic cast here.
933/// If some TEveElement descendant implements a different scheme,
934/// this virtual method should be overriden accordingly.
935
937{
938 const TObject* obj = dynamic_cast<const TObject*>(this);
939 if (obj == nullptr)
940 throw(eh + "not a TObject.");
941 return const_cast<TObject*>(obj);
942}
943
944////////////////////////////////////////////////////////////////////////////////
945/// Show GUI editor for this object.
946/// This is forwarded to TEveManager::EditElement().
947
949{
950 gEve->EditElement(this);
951}
952
953////////////////////////////////////////////////////////////////////////////////
954/// Export render-element to Cling with variable name var_name.
955
956void TEveElement::ExportToCINT(char* var_name)
957{
958 const char* cname = IsA()->GetName();
959 gROOT->ProcessLine(TString::Format("%s* %s = (%s*)0x%zx;", cname, var_name, cname, (size_t)this));
960}
961
962////////////////////////////////////////////////////////////////////////////////
963/// Call Dump() on source object.
964/// Throws an exception if it is not set.
965
967{
968 static const TEveException eh("TEveElement::DumpSourceObject ");
969
970 TObject *so = GetSourceObject();
971 if (!so)
972 throw eh + "source-object not set.";
973
974 so->Dump();
975}
976
977////////////////////////////////////////////////////////////////////////////////
978/// Call Print() on source object.
979/// Throws an exception if it is not set.
980
982{
983 static const TEveException eh("TEveElement::PrintSourceObject ");
984
985 TObject *so = GetSourceObject();
986 if (!so)
987 throw eh + "source-object not set.";
988
989 so->Print();
990}
991
992////////////////////////////////////////////////////////////////////////////////
993/// Export source object to Cling with given name for the variable.
994/// Throws an exception if it is not set.
995
997{
998 static const TEveException eh("TEveElement::ExportSourceObjectToCINT ");
999
1000 TObject *so = GetSourceObject();
1001 if (!so)
1002 throw eh + "source-object not set.";
1003
1004 const char* cname = so->IsA()->GetName();
1005 gROOT->ProcessLine(TString::Format("%s* %s = (%s*)0x%zx;", cname, var_name, cname, (size_t)so));
1006}
1007
1008////////////////////////////////////////////////////////////////////////////////
1009/// Paint self and/or children into currently active pad.
1010
1012{
1013 static const TEveException eh("TEveElement::PadPaint ");
1014
1015 TObject* obj = nullptr;
1016 if (GetRnrSelf() && (obj = GetRenderObject(eh)))
1017 obj->Paint(option);
1018
1019
1020 if (GetRnrChildren()) {
1021 for (List_i i=BeginChildren(); i!=EndChildren(); ++i) {
1022 (*i)->PadPaint(option);
1023 }
1024 }
1025}
1026
1027////////////////////////////////////////////////////////////////////////////////
1028/// Paint object -- a generic implementation for EVE elements.
1029/// This supports direct rendering using a dedicated GL class.
1030/// Override TObject::Paint() in sub-classes if different behaviour
1031/// is required.
1032
1034{
1035 static const TEveException eh("TEveElement::PaintStandard ");
1036
1038
1039 // Section kCore
1040 buff.fID = id;
1041 buff.fColor = GetMainColor();
1043 if (HasMainTrans()) RefMainTrans().SetBuffer3D(buff);
1044
1046
1047 Int_t reqSections = gPad->GetViewer3D()->AddObject(buff);
1048 if (reqSections != TBuffer3D::kNone)
1049 {
1050 Warning(eh, "IsA='%s'. Viewer3D requires more sections (%d). Only direct-rendering supported.",
1051 id->ClassName(), reqSections);
1052 }
1053}
1054
1055////////////////////////////////////////////////////////////////////////////////
1056/// Set render state of this element, i.e. if it will be published
1057/// on next scene update pass.
1058/// Returns true if the state has changed.
1059
1061{
1062 if (SingleRnrState())
1063 {
1064 return SetRnrState(rnr);
1065 }
1066
1067 if (rnr != fRnrSelf)
1068 {
1069 fRnrSelf = rnr;
1072 return kTRUE;
1073 }
1074 return kFALSE;
1075}
1076
1077////////////////////////////////////////////////////////////////////////////////
1078/// Set render state of this element's children, i.e. if they will
1079/// be published on next scene update pass.
1080/// Returns true if the state has changed.
1081
1083{
1084 if (SingleRnrState())
1085 {
1086 return SetRnrState(rnr);
1087 }
1088
1089 if (rnr != fRnrChildren)
1090 {
1091 fRnrChildren = rnr;
1094 return kTRUE;
1095 }
1096 return kFALSE;
1097}
1098
1099////////////////////////////////////////////////////////////////////////////////
1100/// Set state for rendering of this element and its children.
1101/// Returns true if the state has changed.
1102
1104{
1105 if (SingleRnrState())
1106 {
1107 return SetRnrState(rnr_self);
1108 }
1109
1110 if (fRnrSelf != rnr_self || fRnrChildren != rnr_children)
1111 {
1112 fRnrSelf = rnr_self;
1113 fRnrChildren = rnr_children;
1116 return kTRUE;
1117 }
1118 return kFALSE;
1119}
1120
1121////////////////////////////////////////////////////////////////////////////////
1122/// Set render state of this element and of its children to the same
1123/// value.
1124/// Returns true if the state has changed.
1125
1127{
1128 if (fRnrSelf != rnr || fRnrChildren != rnr)
1129 {
1130 fRnrSelf = fRnrChildren = rnr;
1133 return kTRUE;
1134 }
1135 return kFALSE;
1136}
1137
1138////////////////////////////////////////////////////////////////////////////////
1139/// Propagate render state to the projected replicas of this element.
1140/// Maybe this should be optional on gEve/element level.
1141
1143{
1144 TEveProjectable *pable = dynamic_cast<TEveProjectable*>(this);
1145 if (pable && pable->HasProjecteds())
1146 {
1148 }
1149}
1150
1151////////////////////////////////////////////////////////////////////////////////
1152/// Set main color of the element.
1153///
1154///
1155/// List-tree-items are updated.
1156
1158{
1159 Color_t old_color = GetMainColor();
1160
1161 if (fMainColorPtr)
1162 {
1163 *fMainColorPtr = color;
1165 }
1166
1167 PropagateMainColorToProjecteds(color, old_color);
1168}
1169
1170////////////////////////////////////////////////////////////////////////////////
1171/// Convert pixel to Color_t and call SetMainColor().
1172
1177
1178////////////////////////////////////////////////////////////////////////////////
1179/// Convert RGB values to Color_t and call SetMainColor.
1180
1185
1186////////////////////////////////////////////////////////////////////////////////
1187/// Convert RGB values to Color_t and call SetMainColor.
1188
1193
1194////////////////////////////////////////////////////////////////////////////////
1195/// Propagate color to projected elements.
1196
1198{
1199 TEveProjectable* pable = dynamic_cast<TEveProjectable*>(this);
1200 if (pable && pable->HasProjecteds())
1201 {
1202 pable->PropagateMainColor(color, old_color);
1203 }
1204}
1205
1206////////////////////////////////////////////////////////////////////////////////
1207/// Set main-transparency.
1208/// Transparency is clamped to [0, 100].
1209
1211{
1212 Char_t old_t = GetMainTransparency();
1213
1214 if (t > 100) t = 100;
1217
1219}
1220
1221////////////////////////////////////////////////////////////////////////////////
1222/// Set main-transparency via float alpha variable.
1223/// Value of alpha is clamped t0 [0, 1].
1224
1226{
1227 if (alpha < 0) alpha = 0;
1228 if (alpha > 1) alpha = 1;
1229 SetMainTransparency((Char_t) (100.0f*(1.0f - alpha)));
1230}
1231
1232////////////////////////////////////////////////////////////////////////////////
1233/// Propagate transparency to projected elements.
1234
1236{
1237 TEveProjectable* pable = dynamic_cast<TEveProjectable*>(this);
1238 if (pable && pable->HasProjecteds())
1239 {
1240 pable->PropagateMainTransparency(t, old_t);
1241 }
1242}
1243
1244////////////////////////////////////////////////////////////////////////////////
1245/// Return pointer to main transformation. If 'create' flag is set (default)
1246/// it is created if not yet existing.
1247
1249{
1250 if (!fMainTrans && create)
1251 InitMainTrans();
1252
1253 return fMainTrans;
1254}
1255
1256////////////////////////////////////////////////////////////////////////////////
1257/// Return reference to main transformation. It is created if not yet
1258/// existing.
1259
1261{
1262 if (!fMainTrans)
1263 InitMainTrans();
1264
1265 return *fMainTrans;
1266}
1267
1268////////////////////////////////////////////////////////////////////////////////
1269/// Initialize the main transformation to identity matrix.
1270/// If can_edit is true (default), the user will be able to edit the
1271/// transformation parameters via TEveElementEditor.
1272
1274{
1275 if (fMainTrans)
1277 else
1278 fMainTrans = new TEveTrans;
1279 fCanEditMainTrans = can_edit;
1280}
1281
1282////////////////////////////////////////////////////////////////////////////////
1283/// Destroy the main transformation matrix, it will always be taken
1284/// as identity. Editing of transformation parameters is disabled.
1285
1287{
1288 delete fMainTrans;
1289 fMainTrans = nullptr;
1291}
1292
1293////////////////////////////////////////////////////////////////////////////////
1294/// Set transformation matrix from column-major array.
1295
1297{
1298 RefMainTrans().SetFrom(carr);
1299}
1300
1301////////////////////////////////////////////////////////////////////////////////
1302/// Set transformation matrix from TGeo's matrix.
1303
1305{
1306 RefMainTrans().SetFrom(mat);
1307}
1308
1309////////////////////////////////////////////////////////////////////////////////
1310/// Check if el can be added to this element.
1311///
1312/// In the base-class version we only make sure the new child is not
1313/// equal to this.
1314
1316{
1317 return el != this;
1318}
1319
1320////////////////////////////////////////////////////////////////////////////////
1321/// Add el to the list of children.
1322
1324{
1325 static const TEveException eh("TEveElement::AddElement ");
1326
1327 if ( ! AcceptElement(el))
1328 throw(eh + Form("parent '%s' rejects '%s'.",
1329 GetElementName(), el->GetElementName()));
1330
1331 el->AddParent(this);
1332 fChildren.push_back(el); ++fNumChildren;
1333 el->AddIntoListTrees(this);
1335}
1336
1337////////////////////////////////////////////////////////////////////////////////
1338/// Remove el from the list of children.
1339
1341{
1342 el->RemoveFromListTrees(this);
1344 el->RemoveParent(this);
1345 fChildren.remove(el); --fNumChildren;
1347}
1348
1349////////////////////////////////////////////////////////////////////////////////
1350/// Perform additional local removal of el.
1351/// Called from RemoveElement() which does whole untangling.
1352/// Put into special function as framework-related handling of
1353/// element removal should really be common to all classes and
1354/// clearing of local structures happens in between removal
1355/// of list-tree-items and final removal.
1356/// If you override this, you should also override
1357/// RemoveElementsLocal().
1358
1362
1363////////////////////////////////////////////////////////////////////////////////
1364/// Remove all elements. This assumes removing of all elements can
1365/// be done more efficiently then looping over them and removing one
1366/// by one. This protected function performs the removal on the
1367/// level of TEveElement.
1368
1370{
1371 for (sLTI_i i=fItems.begin(); i!=fItems.end(); ++i)
1372 {
1373 DestroyListSubTree(i->fTree, i->fItem);
1374 }
1376 for (List_i i=fChildren.begin(); i!=fChildren.end(); ++i)
1377 {
1378 (*i)->RemoveParent(this);
1379 }
1380 fChildren.clear(); fNumChildren = 0;
1381}
1382
1383////////////////////////////////////////////////////////////////////////////////
1384/// Remove all elements. This assumes removing of all elements can
1385/// be done more efficiently then looping over them and removing
1386/// them one by one.
1387
1389{
1390 if (HasChildren())
1391 {
1394 }
1395}
1396
1397////////////////////////////////////////////////////////////////////////////////
1398/// Perform additional local removal of all elements.
1399/// See comment to RemoveElementlocal(TEveElement*).
1400
1404
1405////////////////////////////////////////////////////////////////////////////////
1406/// If this is a projectable, loop over all projected replicas and
1407/// add the projected image of child 'el' there. This is supposed to
1408/// be called after you add a child to a projectable after it has
1409/// already been projected.
1410/// You might also want to call RecheckImpliedSelections() on this
1411/// element or 'el'.
1412///
1413/// If 'same_depth' flag is true, the same depth as for parent object
1414/// is used in every projection. Otherwise current depth of each
1415/// relevant projection-manager is used.
1416
1418{
1419 TEveProjectable* pable = dynamic_cast<TEveProjectable*>(this);
1420 if (pable && HasChild(el))
1421 {
1422 for (TEveProjectable::ProjList_i i = pable->BeginProjecteds(); i != pable->EndProjecteds(); ++i)
1423 {
1424 TEveProjectionManager *pmgr = (*i)->GetManager();
1425 Float_t cd = pmgr->GetCurrentDepth();
1426 if (same_depth) pmgr->SetCurrentDepth((*i)->GetDepth());
1427
1428 pmgr->SubImportElements(el, (*i)->GetProjectedAsElement());
1429
1430 if (same_depth) pmgr->SetCurrentDepth(cd);
1431 }
1432 }
1433}
1434
1435////////////////////////////////////////////////////////////////////////////////
1436/// If this is a projectable, loop over all projected replicas and
1437/// add the projected image of all children there. This is supposed
1438/// to be called after you destroy all children and then add new
1439/// ones after this element has already been projected.
1440/// You might also want to call RecheckImpliedSelections() on this
1441/// element.
1442///
1443/// If 'same_depth' flag is true, the same depth as for the
1444/// projected element is used in every projection. Otherwise current
1445/// depth of each relevant projection-manager is used.
1446
1448{
1449 TEveProjectable* pable = dynamic_cast<TEveProjectable*>(this);
1450 if (pable)
1451 {
1452 for (TEveProjectable::ProjList_i i = pable->BeginProjecteds(); i != pable->EndProjecteds(); ++i)
1453 {
1454 TEveProjectionManager *pmgr = (*i)->GetManager();
1455 Float_t cd = pmgr->GetCurrentDepth();
1456 if (same_depth) pmgr->SetCurrentDepth((*i)->GetDepth());
1457
1458 pmgr->SubImportChildren(this, (*i)->GetProjectedAsElement());
1459
1460 if (same_depth) pmgr->SetCurrentDepth(cd);
1461 }
1462 }
1463}
1464
1465////////////////////////////////////////////////////////////////////////////////
1466/// Check if element el is a child of this element.
1467
1469{
1470 return (std::find(fChildren.begin(), fChildren.end(), el) != fChildren.end());
1471}
1472
1473////////////////////////////////////////////////////////////////////////////////
1474/// Find the first child with given name. If cls is specified (non
1475/// 0), it is also checked.
1476///
1477/// Returns 0 if not found.
1478
1480{
1481 for (List_i i=fChildren.begin(); i!=fChildren.end(); ++i)
1482 {
1483 if (name.CompareTo((*i)->GetElementName()) == 0)
1484 {
1485 if (!cls || (cls && (*i)->IsA()->InheritsFrom(cls)))
1486 return *i;
1487 }
1488 }
1489 return nullptr;
1490}
1491
1492////////////////////////////////////////////////////////////////////////////////
1493/// Find the first child whose name matches regexp. If cls is
1494/// specified (non 0), it is also checked.
1495///
1496/// Returns 0 if not found.
1497
1499{
1500 for (List_i i=fChildren.begin(); i!=fChildren.end(); ++i)
1501 {
1502 if (regexp.MatchB((*i)->GetElementName()))
1503 {
1504 if (!cls || (cls && (*i)->IsA()->InheritsFrom(cls)))
1505 return *i;
1506 }
1507 }
1508 return nullptr;
1509}
1510
1511////////////////////////////////////////////////////////////////////////////////
1512/// Find all children with given name and append them to matches
1513/// list. If class is specified (non 0), it is also checked.
1514///
1515/// Returns number of elements added to the list.
1516
1518 const TString& name, const TClass* cls)
1519{
1520 Int_t count = 0;
1521 for (List_i i=fChildren.begin(); i!=fChildren.end(); ++i)
1522 {
1523 if (name.CompareTo((*i)->GetElementName()) == 0)
1524 {
1525 if (!cls || (cls && (*i)->IsA()->InheritsFrom(cls)))
1526 {
1527 matches.push_back(*i);
1528 ++count;
1529 }
1530 }
1531 }
1532 return count;
1533}
1534
1535////////////////////////////////////////////////////////////////////////////////
1536/// Find all children whose name matches regexp and append them to
1537/// matches list.
1538///
1539/// Returns number of elements added to the list.
1540
1542 TPRegexp& regexp, const TClass* cls)
1543{
1544 Int_t count = 0;
1545 for (List_i i=fChildren.begin(); i!=fChildren.end(); ++i)
1546 {
1547 if (regexp.MatchB((*i)->GetElementName()))
1548 {
1549 if (!cls || (cls && (*i)->IsA()->InheritsFrom(cls)))
1550 {
1551 matches.push_back(*i);
1552 ++count;
1553 }
1554 }
1555 }
1556 return count;
1557}
1558
1559////////////////////////////////////////////////////////////////////////////////
1560/// Returns the first child element or 0 if the list is empty.
1561
1563{
1564 return HasChildren() ? fChildren.front() : nullptr;
1565}
1566
1567////////////////////////////////////////////////////////////////////////////////
1568/// Returns the last child element or 0 if the list is empty.
1569
1571{
1572 return HasChildren() ? fChildren.back() : nullptr;
1573}
1574
1575////////////////////////////////////////////////////////////////////////////////
1576/// Enable rendering of children and their list contents.
1577/// Arguments control how to set self/child rendering.
1578
1580{
1581 for (List_i i=fChildren.begin(); i!=fChildren.end(); ++i)
1582 {
1583 (*i)->SetRnrSelf(rnr_self);
1584 (*i)->SetRnrChildren(rnr_children);
1585 }
1586
1588}
1589
1590////////////////////////////////////////////////////////////////////////////////
1591/// Disable rendering of children and their list contents.
1592/// Arguments control how to set self/child rendering.
1593///
1594/// Same as above function, but default arguments are different. This
1595/// is convenient for calls via context menu.
1596
1598{
1599 for (List_i i=fChildren.begin(); i!=fChildren.end(); ++i)
1600 {
1601 (*i)->SetRnrSelf(rnr_self);
1602 (*i)->SetRnrChildren(rnr_children);
1603 }
1604
1606}
1607
1608////////////////////////////////////////////////////////////////////////////////
1609/// Protected member function called from TEveElement::Annihilate().
1610
1612{
1613 static const TEveException eh("TEveElement::AnnihilateRecursively ");
1614
1615 // projected were already destroyed in TEveElement::Anihilate(), now only clear its list
1616 TEveProjectable* pable = dynamic_cast<TEveProjectable*>(this);
1617 if (pable && pable->HasProjecteds())
1618 {
1619 pable->ClearProjectedList();
1620 }
1621
1622 // same as TEveElements::RemoveElementsInternal(), except parents are ignored
1623 for (sLTI_i i=fItems.begin(); i!=fItems.end(); ++i)
1624 {
1625 DestroyListSubTree(i->fTree, i->fItem);
1626 }
1628 for (List_i i=fChildren.begin(); i!=fChildren.end(); ++i)
1629 {
1630 (*i)->AnnihilateRecursively();
1631 }
1632
1633 fChildren.clear();
1634 fNumChildren = 0;
1635
1638
1639 delete this;
1640}
1641
1642////////////////////////////////////////////////////////////////////////////////
1643/// Optimized destruction without check of reference-count.
1644/// Parents are not notified about child destruction.
1645/// The method should only be used when an element does not have
1646/// more than one parent -- otherwise an exception is thrown.
1647
1649{
1650 static const TEveException eh("TEveElement::Annihilate ");
1651
1652 if (fParents.size() > 1)
1653 {
1654 Warning(eh, "More than one parent for '%s': %d. Refusing to delete.",
1655 GetElementName(), (Int_t) fParents.size());
1656 return;
1657 }
1658
1660
1661 // recursive annihilation of projecteds
1662 TEveProjectable* pable = dynamic_cast<TEveProjectable*>(this);
1663 if (pable && pable->HasProjecteds())
1664 {
1665 pable->AnnihilateProjecteds();
1666 }
1667
1668 // detach from the parent
1669 while (!fParents.empty())
1670 {
1671 fParents.front()->RemoveElement(this);
1672 }
1673
1675
1676 gEve->Redraw3D();
1677}
1678
1679////////////////////////////////////////////////////////////////////////////////
1680/// Annihilate elements.
1681
1683{
1684 while (!fChildren.empty())
1685 {
1686 TEveElement* c = fChildren.front();
1687 c->Annihilate();
1688 }
1689
1690 fNumChildren = 0;
1691}
1692
1693////////////////////////////////////////////////////////////////////////////////
1694/// Destroy this element. Throws an exception if deny-destroy is in force.
1695/// This method should be called instead of a destructor.
1696/// Note that an exception will be thrown if the element has been
1697/// protected against destruction with IncDenyDestroy().
1698
1700{
1701 static const TEveException eh("TEveElement::Destroy ");
1702
1703 if (fDenyDestroy > 0)
1704 throw eh + TString::Format("element '%s' (%s*) 0x%zx is protected against destruction.",
1705 GetElementName(), IsA()->GetName(), (size_t)this);
1706
1708 delete this;
1709 gEve->Redraw3D();
1710}
1711
1712////////////////////////////////////////////////////////////////////////////////
1713/// Destroy this element. Prints a warning if deny-destroy is in force.
1714
1716{
1717 static const TEveException eh("TEveElement::DestroyOrWarn ");
1718
1719 try
1720 {
1721 Destroy();
1722 }
1723 catch (TEveException& exc)
1724 {
1725 Warning(eh, "%s", exc.Data());
1726 }
1727}
1728
1729////////////////////////////////////////////////////////////////////////////////
1730/// Destroy all children of this element.
1731
1733{
1734 static const TEveException eh("TEveElement::DestroyElements ");
1735
1736 while (HasChildren())
1737 {
1738 TEveElement* c = fChildren.front();
1739 if (c->fDenyDestroy <= 0)
1740 {
1741 try {
1742 c->Destroy();
1743 }
1744 catch (const TEveException &exc) {
1745 Warning(eh, "element destruction failed: '%s'.", exc.Data());
1747 }
1748 }
1749 else
1750 {
1751 if (gDebug > 0)
1752 Info(eh, "element '%s' is protected agains destruction, removing locally.", c->GetElementName());
1754 }
1755 }
1756
1757 gEve->Redraw3D();
1758}
1759
1760////////////////////////////////////////////////////////////////////////////////
1761/// Returns state of flag determining if the element will be
1762/// destroyed when reference count reaches zero.
1763/// This is true by default.
1764
1769
1770////////////////////////////////////////////////////////////////////////////////
1771/// Sets the state of flag determining if the element will be
1772/// destroyed when reference count reaches zero.
1773/// This is true by default.
1774
1779
1780////////////////////////////////////////////////////////////////////////////////
1781/// Returns the number of times deny-destroy has been requested on
1782/// the element.
1783
1785{
1786 return fDenyDestroy;
1787}
1788
1789////////////////////////////////////////////////////////////////////////////////
1790/// Increases the deny-destroy count of the element.
1791/// Call this if you store an external pointer to the element.
1792
1797
1798////////////////////////////////////////////////////////////////////////////////
1799/// Decreases the deny-destroy count of the element.
1800/// Call this after releasing an external pointer to the element.
1801
1803{
1804 if (--fDenyDestroy <= 0)
1805 CheckReferenceCount("TEveElement::DecDenyDestroy ");
1806}
1807
1808////////////////////////////////////////////////////////////////////////////////
1809/// Get number of parents that should be ignored in doing
1810/// reference-counting.
1811///
1812/// For example, this is used when subscribing an element to a
1813/// visualization-database model object.
1814
1819
1820////////////////////////////////////////////////////////////////////////////////
1821/// Increase number of parents ignored in reference-counting.
1822
1827
1828////////////////////////////////////////////////////////////////////////////////
1829/// Decrease number of parents ignored in reference-counting.
1830
1832{
1833 if (--fParentIgnoreCnt <= 0)
1834 CheckReferenceCount("TEveElement::DecParentIgnoreCnt ");
1835}
1836
1837////////////////////////////////////////////////////////////////////////////////
1838/// React to element being pasted or dnd-ed.
1839/// Return true if redraw is needed.
1840
1842{
1843 gEve->AddElement(el, this);
1844 return kTRUE;
1845}
1846
1847////////////////////////////////////////////////////////////////////////////////
1848/// Call this after an element has been changed so that the state
1849/// can be propagated around the framework.
1850
1851void TEveElement::ElementChanged(Bool_t update_scenes, Bool_t redraw)
1852{
1853 gEve->ElementChanged(this, update_scenes, redraw);
1854}
1855
1856////////////////////////////////////////////////////////////////////////////////
1857/// Set pickable state on the element and all its children.
1858
1860{
1861 fPickable = p;
1862 for (List_i i=fChildren.begin(); i!=fChildren.end(); ++i)
1863 {
1864 (*i)->SetPickableRecursively(p);
1865 }
1866}
1867
1868////////////////////////////////////////////////////////////////////////////////
1869/// Returns element to be selected on click.
1870/// If value is zero the selected object will follow rules in
1871/// TEveSelection.
1872
1874{
1875 return nullptr;
1876}
1877
1878////////////////////////////////////////////////////////////////////////////////
1879/// Returns element to be displayed in GUI editor on click.
1880/// If value is zero the displayed object will follow rules in
1881/// TEveSelection.
1882
1884{
1885 return nullptr;
1886}
1887
1888////////////////////////////////////////////////////////////////////////////////
1889/// Set element's selection state. Stamp appropriately.
1890
1892{
1893 if (fSelected != state) {
1894 fSelected = state;
1895 if (!fSelected && fImpliedSelected == 0)
1896 UnSelected();
1897 fParentIgnoreCnt += (fSelected) ? 1 : -1;
1899 }
1900}
1901
1902////////////////////////////////////////////////////////////////////////////////
1903/// Increase element's implied-selection count. Stamp appropriately.
1904
1910
1911////////////////////////////////////////////////////////////////////////////////
1912/// Decrease element's implied-selection count. Stamp appropriately.
1913
1915{
1916 if (--fImpliedSelected == 0)
1917 {
1918 if (!fSelected)
1919 UnSelected();
1921 }
1922}
1923
1924////////////////////////////////////////////////////////////////////////////////
1925/// Virtual function called when both fSelected is false and
1926/// fImpliedSelected is 0.
1927/// Nothing is done in this base-class version
1928
1930{
1931}
1932
1933////////////////////////////////////////////////////////////////////////////////
1934/// Set element's highlight state. Stamp appropriately.
1935
1937{
1938 if (fHighlighted != state) {
1939 fHighlighted = state;
1940 if (!fHighlighted && fImpliedHighlighted == 0)
1941 UnHighlighted();
1942 fParentIgnoreCnt += (fHighlighted) ? 1 : -1;
1944 }
1945}
1946
1947////////////////////////////////////////////////////////////////////////////////
1948/// Increase element's implied-highlight count. Stamp appropriately.
1949
1955
1956////////////////////////////////////////////////////////////////////////////////
1957/// Decrease element's implied-highlight count. Stamp appropriately.
1958
1960{
1961 if (--fImpliedHighlighted == 0)
1962 {
1963 if (!fHighlighted)
1964 UnHighlighted();
1966 }
1967}
1968
1969////////////////////////////////////////////////////////////////////////////////
1970/// Virtual function called when both fHighlighted is false and
1971/// fImpliedHighlighted is 0.
1972/// Nothing is done in this base-class version
1973
1977
1978////////////////////////////////////////////////////////////////////////////////
1979/// Populate set impSelSet with derived / dependant elements.
1980///
1981/// If this is a TEveProjectable, the projected replicas are added
1982/// to the set. Thus it does not have to be reimplemented for each
1983/// sub-class of TEveProjected.
1984///
1985/// Note that this also takes care of projections of TEveCompound
1986/// class, which is also a projectable.
1987
1989{
1990 TEveProjectable* p = dynamic_cast<TEveProjectable*>(this);
1991 if (p)
1992 {
1993 p->AddProjectedsToSet(impSelSet);
1994 }
1995}
1996
1997////////////////////////////////////////////////////////////////////////////////
1998/// Get selection level, needed for rendering selection and
1999/// highlight feedback.
2000/// This should go to TAtt3D.
2001
2003{
2004 if (fSelected) return 1;
2005 if (fImpliedSelected > 0) return 2;
2006 if (fHighlighted) return 3;
2007 if (fImpliedHighlighted > 0) return 4;
2008 return 0;
2009}
2010
2011////////////////////////////////////////////////////////////////////////////////
2012/// Call this if it is possible that implied-selection or highlight
2013/// has changed for this element or for implied-selection this
2014/// element is member of and you want to maintain consistent
2015/// selection state.
2016/// This can happen if you add elements into compounds in response
2017/// to user-interaction.
2018
2027
2028////////////////////////////////////////////////////////////////////////////////
2029/// Add (bitwise or) given stamps to fChangeBits.
2030/// Register this element to gEve as stamped.
2031/// This method is virtual so that sub-classes can add additional
2032/// actions. The base-class method should still be called (or replicated).
2033
2035{
2036 fChangeBits |= bits;
2037 if (fDestructing == kNone) gEve->ElementStamped(this);
2038}
2039
2040////////////////////////////////////////////////////////////////////////////////
2041/// Returns pointer to first listtreeicon
2042
2044{
2045 // Need better solution for icon-loading/ids !!!!
2046 return fgListTreeIcons[open ? 7 : 0];
2047}
2048
2049////////////////////////////////////////////////////////////////////////////////
2050/// Returns list-tree-item check-box picture appropriate for given
2051/// rendering state.
2052
2054{
2055 Int_t idx = 0;
2056 if (fRnrSelf) idx = 2;
2057 if (fRnrChildren ) idx++;
2058
2059 return fgRnrIcons[idx];
2060}
2061
2062////////////////////////////////////////////////////////////////////////////////
2063/// Convert Bool_t to string - kTRUE or kFALSE.
2064/// Needed in WriteVizParams().
2065
2067{
2068 return b ? "kTRUE" : "kFALSE";
2069}
2070
2071
2072/** \class TEveElementList
2073\ingroup TEve
2074A list of TEveElements.
2075
2076Class of acceptable children can be limited by setting the
2077fChildClass member.
2078
2079!!! should have two ctors (like in TEveElement), one with Color_t&
2080and set fDoColor automatically, based on which ctor is called.
2081*/
2082
2083
2084////////////////////////////////////////////////////////////////////////////////
2085/// Constructor.
2086
2087TEveElementList::TEveElementList(const char* n, const char* t, Bool_t doColor, Bool_t doTransparency) :
2088 TEveElement(),
2089 TNamed(n, t),
2091 fColor(0),
2092 fChildClass(nullptr)
2093{
2094 if (doColor) {
2097 }
2098 if (doTransparency)
2099 {
2101 }
2102}
2103
2104////////////////////////////////////////////////////////////////////////////////
2105/// Copy constructor.
2106
2108 TEveElement (e),
2109 TNamed (e),
2111 fColor (e.fColor),
2112 fChildClass (e.fChildClass)
2113{
2114}
2115
2116////////////////////////////////////////////////////////////////////////////////
2117/// Clone the element via copy constructor.
2118/// Virtual from TEveElement.
2119
2121{
2122 return new TEveElementList(*this);
2123}
2124
2125////////////////////////////////////////////////////////////////////////////////
2126/// Check if TEveElement el is inherited from fChildClass.
2127/// Virtual from TEveElement.
2128
2130{
2131 if (fChildClass && ! el->IsA()->InheritsFrom(fChildClass))
2132 return kFALSE;
2133 return kTRUE;
2134}
2135
2136////////////////////////////////////////////////////////////////////////////////
2137/// Virtual from TEveProjectable, returns TEveCompoundProjected class.
2138
2143
2144/** \class TEveElementListProjected
2145\ingroup TEve
2146A projected element list -- required for proper propagation
2147of render state to projected views.
2148*/
2149
2150
2151////////////////////////////////////////////////////////////////////////////////
2152/// Constructor.
2153
2155 TEveElementList("TEveElementListProjected")
2156{
2157}
2158
2159////////////////////////////////////////////////////////////////////////////////
2160/// This is abstract method from base-class TEveProjected.
2161/// No implementation.
2162
const Handle_t kNone
Definition GuiTypes.h:89
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:41
#define d(i)
Definition RSha256.hxx:102
#define b(i)
Definition RSha256.hxx:100
#define c(i)
Definition RSha256.hxx:101
#define g(i)
Definition RSha256.hxx:105
#define e(i)
Definition RSha256.hxx:103
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
short Color_t
Color number (short)
Definition RtypesCore.h:100
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char)
Definition RtypesCore.h:53
char Char_t
Character 1 byte (char)
Definition RtypesCore.h:52
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:72
constexpr Bool_t kFALSE
Definition RtypesCore.h:109
constexpr Bool_t kTRUE
Definition RtypesCore.h:108
const char Option_t
Option string (const char)
Definition RtypesCore.h:81
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
Definition TError.cxx:241
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:208
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:252
R__EXTERN TEveManager * gEve
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t dest
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void pixel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char cname
char name[80]
Definition TGX11.cxx:142
Int_t gDebug
Global variable setting the debug level. Set to 0 to disable, increase it in steps of 1 to increase t...
Definition TROOT.cxx:792
#define gROOT
Definition TROOT.h:417
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2571
#define gPad
Generic 3D primitive description class.
Definition TBuffer3D.h:18
void SetSectionsValid(UInt_t mask)
Definition TBuffer3D.h:74
Int_t fColor
Definition TBuffer3D.h:97
Short_t fTransparency
Definition TBuffer3D.h:98
TObject * fID
Definition TBuffer3D.h:96
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:84
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
Definition TClass.cxx:5107
Bool_t InheritsFrom(const char *cl) const override
Return kTRUE if this class inherits from a class with name "classname".
Definition TClass.cxx:4991
TClass * IsA() const override
Definition TClass.h:638
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
Definition TColor.cxx:1941
Description of TEveCompound.
void UpdateProjection() override
This is abstract method from base-class TEveProjected.
static TClass * Class()
TEveElementListProjected()
Constructor.
A list of TEveElements.
TEveElementList(const char *n="TEveElementList", const char *t="", Bool_t doColor=kFALSE, Bool_t doTransparency=kFALSE)
Constructor.
TClass * ProjectedClass(const TEveProjection *p) const override
Virtual from TEveProjectable, returns TEveCompoundProjected class.
Bool_t AcceptElement(TEveElement *el) override
Check if TEveElement el is inherited from fChildClass.
TClass * fChildClass
TEveElementList * CloneElement() const override
Clone the element via copy constructor.
Structure holding information about TGListTree and TGListTreeItem that represents given TEveElement.
Definition TEveElement.h:43
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition TEveElement.h:36
virtual void AnnihilateRecursively()
Protected member function called from TEveElement::Annihilate().
virtual void ExportToCINT(char *var_name)
Export render-element to Cling with variable name var_name.
virtual void AddStamp(UChar_t bits)
Add (bitwise or) given stamps to fChangeBits.
virtual TEveTrans * PtrMainTrans(Bool_t create=kTRUE)
Return pointer to main transformation.
virtual Bool_t SingleRnrState() const
void SaveVizParams(std::ostream &out, const TString &tag, const TString &var)
Save visualization parameters for this element with given tag.
virtual void SelectElement(Bool_t state)
Set element's selection state. Stamp appropriately.
virtual void InitMainTrans(Bool_t can_edit=kTRUE)
Initialize the main transformation to identity matrix.
virtual void AddElement(TEveElement *el)
Add el to the list of children.
void SetMainColorPixel(Pixel_t pixel)
Convert pixel to Color_t and call SetMainColor().
virtual Bool_t SetRnrSelfChildren(Bool_t rnr_self, Bool_t rnr_children)
Set state for rendering of this element and its children.
virtual void FillImpliedSelectedSet(Set_t &impSelSet)
Populate set impSelSet with derived / dependant elements.
void DumpSourceObject() const
Call Dump() on source object.
Bool_t TestCSCBits(UChar_t f) const
Char_t fDestructing
!
virtual void CloneChildrenRecurse(TEveElement *dest, Int_t level=0) const
Clone children and attach them to the dest element.
Int_t fNumChildren
!
Definition TEveElement.h:86
virtual void ProjectAllChildren(Bool_t same_depth=kTRUE)
If this is a projectable, loop over all projected replicas and add the projected image of all childre...
virtual void SetElementNameTitle(const char *name, const char *title)
Virtual function for setting of name and title of render element.
virtual TEveElement * ForwardSelection()
Returns element to be selected on click.
virtual TGListTreeItem * AddIntoListTrees(TEveElement *parent)
Add this render element into all list-trees and all items belonging to parent.
virtual void SetMainTransparency(Char_t t)
Set main-transparency.
virtual void PropagateVizParamsToElements(TEveElement *el=nullptr)
Propagate visualization parameters from element el (defaulting to this) to all elements (children).
Bool_t fRnrChildren
Definition TEveElement.h:93
List_t fChildren
Definition TEveElement.h:81
Bool_t fDestroyOnZeroRefCnt
Definition TEveElement.h:90
void StampColorSelection()
void SpawnEditor()
Show GUI editor for this object.
static const TGPicture * fgRnrIcons[4]
Definition TEveElement.h:54
virtual UChar_t GetSelectedLevel() const
Get selection level, needed for rendering selection and highlight feedback.
virtual sLTI_i FindItem(TGListTree *ltree)
Find any list-tree-item of this element in list-tree 'ltree'.
virtual void HighlightElement(Bool_t state)
Set element's highlight state. Stamp appropriately.
virtual void NameTitleChanged()
Virtual function called when a name or title of the element has been changed.
virtual void DestroyMainTrans()
Destroy the main transformation matrix, it will always be taken as identity.
virtual void DestroyListSubTree(TGListTree *ltree, TGListTreeItem *parent)
Destroy sub-tree under item 'parent' in list-tree 'ltree'.
Bool_t fHighlighted
!
Int_t fParentIgnoreCnt
! Counter for parents that are ignored in ref-counting.
Definition TEveElement.h:87
Char_t fMainTransparency
Definition TEveElement.h:98
virtual TClass * IsA() const
void VizDB_UpdateModel(Bool_t update=kTRUE)
Copy visual parameters from this element to viz-db model.
virtual void ProjectChild(TEveElement *el, Bool_t same_depth=kTRUE)
If this is a projectable, loop over all projected replicas and add the projected image of child 'el' ...
UChar_t fChangeBits
!
sLTI_t fItems
! Set of list-tree-items.
void VizDB_Insert(const char *tag, Bool_t replace=kTRUE, Bool_t update=kTRUE)
Create a replica of element and insert it into VizDB with given tag.
virtual void CheckReferenceCount(const TEveException &eh="TEveElement::CheckReferenceCount ")
Check external references to this and eventually auto-destruct the render-element.
TEveElement * FirstChild() const
Returns the first child element or 0 if the list is empty.
void DecDenyDestroy()
Decreases the deny-destroy count of the element.
Bool_t fRnrSelf
Definition TEveElement.h:92
Bool_t GetDestroyOnZeroRefCnt() const
Returns state of flag determining if the element will be destroyed when reference count reaches zero.
virtual TEveTrans & RefMainTrans()
Return reference to main transformation.
void VizDB_Reapply()
Reset visual parameters for this object from VizDB.
virtual void RemoveElements()
Remove all elements.
Int_t NumParents() const
void PrintSourceObject() const
Call Print() on source object.
void ExportSourceObjectToCINT(char *var_name) const
Export source object to Cling with given name for the variable.
TEveTrans * fMainTrans
Bool_t fCanEditMainTransparency
Definition TEveElement.h:95
virtual void RemoveParent(TEveElement *re)
Remove re from the list of parents.
virtual TEveElement * CloneElement() const
Clone the element via copy constructor.
List_i EndChildren()
virtual void IncImpliedHighlighted()
Increase element's implied-highlight count. Stamp appropriately.
Bool_t HasChildren() const
List_t fParents
Definition TEveElement.h:80
Short_t fImpliedHighlighted
!
Bool_t ApplyVizTag(const TString &tag, const TString &fallback_tag="")
Set the VizTag, find model-element from the VizDB and copy visualization-parameters from it.
virtual void ExpandIntoListTree(TGListTree *ltree, TGListTreeItem *parent)
Populates parent with elements.
virtual void PropagateVizParamsToProjecteds()
Propagate visualization parameters to dependent elements.
virtual TGListTreeItem * FindListTreeItem(TGListTree *ltree)
Find any list-tree-item of this element in list-tree 'ltree'.
virtual void CollectSceneParents(List_t &scenes)
Collect all parents of class TEveScene.
std::list< TEveElement * > List_t
Definition TEveElement.h:71
virtual void SetMainColor(Color_t color)
Set main color of the element.
void IncDenyDestroy()
Increases the deny-destroy count of the element.
TEveElement * GetMaster()
Returns the master element - that is:
@ kCSCBTakeAnyParentAsMaster
virtual const char * GetElementTitle() const
Virtual function for retrieving title of the render-element.
virtual TEveElement * CloneElementRecurse(Int_t level=0) const
Clone elements and recurse 'level' deep over children.
virtual void SetElementTitle(const char *title)
Virtual function for setting of title of an element.
void DecParentIgnoreCnt()
Decrease number of parents ignored in reference-counting.
virtual void DecImpliedHighlighted()
Decrease element's implied-highlight count. Stamp appropriately.
virtual Int_t RemoveFromListTrees(TEveElement *parent)
Remove element from all list-trees where 'parent' is the user-data of the parent list-tree-item.
virtual Bool_t SetRnrChildren(Bool_t rnr)
Set render state of this element's children, i.e.
void SetMainColorRGB(UChar_t r, UChar_t g, UChar_t b)
Convert RGB values to Color_t and call SetMainColor.
Bool_t FindVizModel()
Find model element in VizDB that corresponds to previously assigned fVizTag and set fVizModel accordi...
TEveElement * FindChild(const TString &name, const TClass *cls=nullptr)
Find the first child with given name.
Color_t * fMainColorPtr
Definition TEveElement.h:99
virtual ~TEveElement()
Destructor.
void SetPickableRecursively(Bool_t p)
Set pickable state on the element and all its children.
virtual void RemoveElementsInternal()
Remove all elements.
Bool_t fSelected
!
Short_t fImpliedSelected
!
void DisableListElements(Bool_t rnr_self=kFALSE, Bool_t rnr_children=kFALSE)
Disable rendering of children and their list contents.
void VizDB_Apply(const char *tag)
Set visual parameters for this object for given tag.
virtual void Destroy()
Destroy this element.
virtual void PreDeleteElement()
Called before the element is deleted, thus offering the last chance to detach from acquired resources...
virtual void SetElementName(const char *name)
Virtual function for setting of name of an element.
Int_t GetDenyDestroy() const
Returns the number of times deny-destroy has been requested on the element.
void RecheckImpliedSelections()
Call this if it is possible that implied-selection or highlight has changed for this element or for i...
virtual void DestroyElements()
Destroy all children of this element.
TString fVizTag
Definition TEveElement.h:84
std::set< TEveElement * > Set_t
Definition TEveElement.h:75
void StampVisibility()
void SetVizTag(const TString &tag)
virtual void PropagateMainColorToProjecteds(Color_t color, Color_t old_color)
Propagate color to projected elements.
virtual void UnHighlighted()
Virtual function called when both fHighlighted is false and fImpliedHighlighted is 0.
void SetMainAlpha(Float_t alpha)
Set main-transparency via float alpha variable.
virtual Color_t GetMainColor() const
virtual void SetTransMatrix(Double_t *carr)
Set transformation matrix from column-major array.
void SetMainColorPtr(Color_t *color)
TEveElement * fVizModel
! Element used as model from VizDB.
Definition TEveElement.h:83
Int_t fTopItemCnt
! Counter for top-level list-tree items that prevent automatic destruction.
Definition TEveElement.h:88
virtual TObject * GetRenderObject(const TEveException &eh) const
virtual Bool_t SetRnrState(Bool_t rnr)
Set render state of this element and of its children to the same value.
virtual void ElementChanged(Bool_t update_scenes=kTRUE, Bool_t redraw=kFALSE)
Call this after an element has been changed so that the state can be propagated around the framework.
List_t::const_iterator List_ci
Definition TEveElement.h:73
virtual TGListTreeItem * AddIntoListTree(TGListTree *ltree, TGListTreeItem *parent_lti)
Add this element into ltree to an already existing item parent_lti.
virtual void Annihilate()
Optimized destruction without check of reference-count.
TObject * GetSourceObject() const
void SetVizModel(TEveElement *model)
Set visualization-parameter model element.
virtual void RemoveElement(TEveElement *el)
Remove el from the list of children.
virtual Bool_t GetRnrChildren() const
virtual Bool_t HandleElementPaste(TEveElement *el)
React to element being pasted or dnd-ed.
virtual void DecImpliedSelected()
Decrease element's implied-selection count. Stamp appropriately.
virtual void CollectSceneParentsFromChildren(List_t &scenes, TEveElement *parent)
Collect scene-parents from all children.
virtual const char * GetElementName() const
Virtual function for retrieving name of the element.
TEveElement()
Default constructor.
Int_t GetParentIgnoreCnt() const
Get number of parents that should be ignored in doing reference-counting.
virtual Bool_t AcceptElement(TEveElement *el)
Check if el can be added to this element.
Bool_t HasChild(TEveElement *el)
Check if element el is a child of this element.
virtual void CopyVizParams(const TEveElement *el)
Copy visualization parameters from element el.
static const char * ToString(Bool_t b)
Convert Bool_t to string - kTRUE or kFALSE.
virtual void PropagateRnrStateToProjecteds()
Propagate render state to the projected replicas of this element.
virtual void PadPaint(Option_t *option)
Paint self and/or children into currently active pad.
Bool_t fCanEditMainColor
Definition TEveElement.h:94
virtual void RemoveElementLocal(TEveElement *el)
Perform additional local removal of el.
virtual void PropagateMainTransparencyToProjecteds(Char_t t, Char_t old_t)
Propagate transparency to projected elements.
static const TGPicture * fgListTreeIcons[9]
Definition TEveElement.h:55
TEveCompound * fCompound
Definition TEveElement.h:82
virtual Char_t GetMainTransparency() const
virtual void DestroyOrWarn()
Destroy this element. Prints a warning if deny-destroy is in force.
virtual void IncImpliedSelected()
Increase element's implied-selection count. Stamp appropriately.
virtual void AnnihilateElements()
Annihilate elements.
virtual Bool_t GetRnrSelf() const
Int_t FindChildren(List_t &matches, const TString &name, const TClass *cls=nullptr)
Find all children with given name and append them to matches list.
virtual const TGPicture * GetListTreeCheckBoxIcon()
Returns list-tree-item check-box picture appropriate for given rendering state.
virtual void WriteVizParams(std::ostream &out, const TString &var)
Write-out visual parameters for this object.
virtual void CopyVizParamsFromDB()
Copy visualization parameters from the model-element fVizModel.
void SetDestroyOnZeroRefCnt(Bool_t d)
Sets the state of flag determining if the element will be destroyed when reference count reaches zero...
List_i BeginChildren()
sLTI_t::reverse_iterator sLTI_ri
Definition TEveElement.h:69
List_t::iterator List_i
Definition TEveElement.h:72
virtual TObject * GetObject(const TEveException &eh) const
Get a TObject associated with this render-element.
virtual const TGPicture * GetListTreeIcon(Bool_t open=kFALSE)
Returns pointer to first listtreeicon.
Int_t fDenyDestroy
! Deny-destroy count.
Definition TEveElement.h:89
virtual Bool_t RemoveFromListTree(TGListTree *ltree, TGListTreeItem *parent_lti)
Remove element from list-tree 'ltree' where its parent item is 'parent_lti'.
TEveElement * LastChild() const
Returns the last child element or 0 if the list is empty.
virtual void RemoveElementsLocal()
Perform additional local removal of all elements.
void IncParentIgnoreCnt()
Increase number of parents ignored in reference-counting.
virtual TEveElement * ForwardEdit()
Returns element to be displayed in GUI editor on click.
Bool_t fCanEditMainTrans
Definition TEveElement.h:96
virtual void PaintStandard(TObject *id)
Paint object – a generic implementation for EVE elements.
virtual Bool_t SetRnrSelf(Bool_t rnr)
Set render state of this element, i.e.
void EnableListElements(Bool_t rnr_self=kTRUE, Bool_t rnr_children=kTRUE)
Enable rendering of children and their list contents.
Bool_t fPickable
sLTI_t::iterator sLTI_i
Definition TEveElement.h:68
virtual void AddParent(TEveElement *re)
Add re into the list parents.
virtual void UnSelected()
Virtual function called when both fSelected is false and fImpliedSelected is 0.
virtual Bool_t HasMainTrans() const
Exception class thrown by TEve classes and macros.
Definition TEveUtil.h:102
Special list-tree-item for Eve.
Definition TEveBrowser.h:30
void AddElement(TEveElement *element, TEveElement *parent=nullptr)
Add an element.
TEveSelection * GetSelection() const
void PreDeleteElement(TEveElement *element)
Called from TEveElement prior to its destruction so the framework components (like object editor) can...
void ElementChanged(TEveElement *element, Bool_t update_scenes=kTRUE, Bool_t redraw=kFALSE)
Element was changed, perform framework side action.
void EditElement(TEveElement *element)
Show element in default editor.
Bool_t InsertVizDBEntry(const TString &tag, TEveElement *model, Bool_t replace, Bool_t update)
Insert a new visualization-parameter database entry.
TEveElement * FindVizDBEntry(const TString &tag)
Find a visualization-parameter database entry corresponding to tag.
Bool_t GetUseOrphanage() const
void Redraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
TEveSelection * GetHighlight() const
void ElementStamped(TEveElement *element)
Mark element as changed – it will be processed on next redraw.
TEveElementList * GetOrphanage() const
Abstract base-class for non-linear projectable objects.
virtual void ClearProjectedList()
virtual void PropagateVizParams(TEveElement *el=nullptr)
Set visualization parameters of projecteds.
virtual void PropagateMainTransparency(Char_t t, Char_t old_t)
Set main transparency of projecteds if their transparency is the same as the old one.
virtual void PropagateRenderState(Bool_t rnr_self, Bool_t rnr_children)
Set render state of projecteds.
ProjList_i EndProjecteds()
ProjList_i BeginProjecteds()
virtual Bool_t HasProjecteds() const
virtual void AnnihilateProjecteds()
Optimized destroy of projected elements with condition there is only one parent for projected element...
virtual void PropagateMainColor(Color_t color, Color_t old_color)
Set main color of projecteds if their color is the same as old_color.
std::list< TEveProjected * >::iterator ProjList_i
Abstract base class for classes that hold results of a non-linear projection transformation.
TEveProjectable * GetProjectable() const
Manager class for steering of projections and managing projected objects.
virtual Int_t SubImportChildren(TEveElement *el, TEveElement *proj_parent)
Recursively import children elements of el and apply projection to the newly imported objects.
virtual TEveElement * SubImportElements(TEveElement *el, TEveElement *proj_parent)
Recursively import elements and apply projection to the newly imported objects.
Base-class for non-linear projections.
void RecheckImpliedSetForElement(TEveElement *el)
If given element is selected or implied-selected with this selection and recheck implied-set for give...
TEveTrans is a 4x4 transformation matrix for homogeneous coordinates stored internally in a column-ma...
Definition TEveTrans.h:27
void UnitTrans()
Reset matrix to unity.
void SetBuffer3D(TBuffer3D &buff)
Fill transformation part TBuffer3D core section.
void SetFrom(Double_t *carr)
virtual void ClearViewPort()
Clear view port and redraw full content.
Definition TGCanvas.cxx:888
TGListTreeItem * GetFirstChild() const
Definition TGListTree.h:61
TGListTreeItem * GetNextSibling() const
Definition TGListTree.h:64
virtual void * GetUserData() const =0
A list tree is a widget that can contain a number of items arranged in a tree structure.
Definition TGListTree.h:197
void AddItem(TGListTreeItem *parent, TGListTreeItem *item)
Add given item to list tree.
Int_t DeleteItem(TGListTreeItem *item)
Delete item from list tree.
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition TGPicture.h:25
const TGWindow * GetParent() const
Definition TGWindow.h:83
Geometrical transformation package.
Definition TGeoMatrix.h:39
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition TNamed.cxx:173
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:50
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition TNamed.cxx:149
virtual void SetNameTitle(const char *name, const char *title)
Set all the TNamed parameters (name and title).
Definition TNamed.cxx:163
Mother of all ROOT objects.
Definition TObject.h:42
virtual void Dump() const
Dump contents of object on stdout.
Definition TObject.cxx:366
virtual TClass * IsA() const
Definition TObject.h:248
virtual void Paint(Option_t *option="")
This method must be overridden if a class wants to paint itself.
Definition TObject.cxx:630
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
Definition TObject.cxx:660
Bool_t MatchB(const TString &s, const TString &mods="", Int_t start=0, Int_t nMaxMatch=10)
Definition TPRegexp.h:78
Basic string class.
Definition TString.h:137
Ssiz_t Length() const
Definition TString.h:426
const char * Data() const
Definition TString.h:385
Bool_t IsNull() const
Definition TString.h:423
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2460
static Int_t Pixel2Number(ULong_t pixel)
Static method returning color number for color specified by system dependent pixel value.
const Int_t n
Definition legend1.C:16