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