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