Logo ROOT  
Reference Guide
REveElement.cxx
Go to the documentation of this file.
1// @(#)root/eve7:$Id$
2// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007, 2018
3
4/*************************************************************************
5 * Copyright (C) 1995-2019, 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 <ROOT/REveElement.hxx>
13#include <ROOT/REveUtil.hxx>
14#include <ROOT/REveScene.hxx>
15#include <ROOT/REveCompound.hxx>
16#include <ROOT/REveTrans.hxx>
17#include <ROOT/REveManager.hxx>
22
23#include "TGeoMatrix.h"
24
25#include "TClass.h"
26#include "TPRegexp.h"
27#include "TROOT.h"
28#include "TColor.h"
29
30#include <cassert>
31#include <algorithm>
32
33#include <nlohmann/json.hpp>
34
35using namespace ROOT::Experimental;
36namespace REX = ROOT::Experimental;
37
38/** \class REveElement
39\ingroup REve
40Base class for REveUtil visualization elements, providing hierarchy
41management, rendering control and list-tree item management.
42
43Class of acceptable children can be limited by setting the
44fChildClass member.
45*/
46
47////////////////////////////////////////////////////////////////////////////////
48/// Default constructor.
49
50REveElement::REveElement(const std::string& name, const std::string& title) :
51 fName (name),
52 fTitle (title)
53{
54}
55
56////////////////////////////////////////////////////////////////////////////////
57/// Copy constructor. Does shallow copy.
58/// For deep-cloning and children-cloning, see:
59/// ~~~ {.cpp}
60/// REveElement* CloneElementRecurse(Int_t level)
61/// void CloneChildrenRecurse(REveElement* dest, Int_t level)
62/// ~~~
63/// 'void* UserData' is NOT copied.
64/// If the element is projectable, its projections are NOT copied.
65///
66/// Not implemented for most sub-classes, let us know.
67/// Note that sub-classes of REveProjected are NOT and will NOT be copyable.
68
70 fName (e.fName),
71 fTitle (e.fTitle),
72 fChildClass (e.fChildClass),
73 fVizTag (e.fVizTag),
74 fDestroyOnZeroRefCnt (e.fDestroyOnZeroRefCnt),
75 fRnrSelf (e.fRnrSelf),
76 fRnrChildren (e.fRnrChildren),
77 fCanEditMainColor (e.fCanEditMainColor),
78 fCanEditMainTransparency(e.fCanEditMainTransparency),
79 fCanEditMainTrans (e.fCanEditMainTrans),
80 fMainTransparency (e.fMainTransparency),
81 fPickable (e.fPickable),
82 fCSCBits (e.fCSCBits)
83{
84 SetVizModel(e.fVizModel);
85 // FIXME: from Sergey: one have to use other way to referencing main color
86 if (e.fMainColorPtr)
87 fMainColorPtr = (Color_t*)((const char*) this + ((const char*) e.fMainColorPtr - (const char*) &e));
88 if (e.fMainTrans)
89 fMainTrans = std::make_unique<REveTrans>(*e.fMainTrans.get());
90}
91
92////////////////////////////////////////////////////////////////////////////////
93/// Destructor. Do not call this method directly, either call Destroy() or
94/// Annihilate(). See also DestroyElements() and AnnihilateElements() if you
95/// need to delete all children of an element.
96
98{
100 {
103
104 if (fMother) {
106 fMother->fChildren.remove(this);
107 }
108
109 if (fScene) {
111 }
112
113 for (auto &au : fAunts)
114 {
115 au->RemoveNieceInternal(this);
116 }
117 }
118}
119
121{
122 return fMother ? fMother->GetElementId() : 0;
123}
124
126{
127 return fScene ? fScene->GetElementId() : 0;
128}
129
131{
132 assert(fElementId == 0);
133
134 REX::gEve->AssignElementId(this);
135 for (auto &c : fChildren)
136 c->assign_element_id_recurisvely();
137}
138
139std::string REveElement::GetHighlightTooltip(const std::set<int>& iSet) const
140{
141 std::string res = fTitle;
142 if (res.empty())
143 res = fName;
144
145 if (!iSet.empty())
146 res = TString::Format("%s idx=%d", res.c_str(), *iSet.begin());
147
148 return res;
149}
150
152{
153 assert(fScene == nullptr);
154
155 fScene = s;
156
157 // XXX MT -- Why do we have fDestructing here? Can this really happen?
158 // If yes, shouldn't we block it in AddElement() already?
160 {
162 }
163 for (auto &c : fChildren)
164 c->assign_scene_recursively(s);
165}
166
167////////////////////////////////////////////////////////////////////////////////
168/// Called before the element is deleted, thus offering the last chance
169/// to detach from acquired resources and from the framework itself.
170/// Here the request is just passed to REveManager.
171/// If you override it, make sure to call base-class version.
172
174{
175 if (fElementId != 0)
176 {
178 }
179}
180
181////////////////////////////////////////////////////////////////////////////////
182/// Clone the element via copy constructor.
183/// Should be implemented for all classes that require cloning support.
184
186{
187 return new REveElement(*this);
188}
189
190////////////////////////////////////////////////////////////////////////////////
191/// Clone elements and recurse 'level' deep over children.
192/// - If level == 0, only the element itself is cloned (default).
193/// - If level == -1, all the hierarchy is cloned.
194
196{
198 if (level--)
199 {
200 CloneChildrenRecurse(el, level);
201 }
202 return el;
203}
204
205////////////////////////////////////////////////////////////////////////////////
206/// Clone children and attach them to the dest element.
207/// If level == 0, only the direct descendants are cloned (default).
208/// If level == -1, all the hierarchy is cloned.
209
211{
212 for (auto &c: fChildren)
213 dest->AddElement(c->CloneElementRecurse(level));
214}
215
216
217//==============================================================================
218
219////////////////////////////////////////////////////////////////////////////////
220/// Set name of an element.
221
222void REveElement::SetName(const std::string& name)
223{
224 fName = name;
226}
227
228////////////////////////////////////////////////////////////////////////////////
229/// Set title of an element.
230
231void REveElement::SetTitle(const std::string& title)
232{
233 fTitle = title;
235}
236
237////////////////////////////////////////////////////////////////////////////////
238/// Set name and title of an element.
239/// Here we attempt to cast the assigned object into TNamed and call
240/// SetNameTitle() there.
241/// If you override this call NameTitleChanged() from there.
242
243void REveElement::SetNameTitle(const std::string& name, const std::string& title)
244{
245 fName = name;
246 fTitle = title;
248}
249
250////////////////////////////////////////////////////////////////////////////////
251/// Virtual function called when a name or title of the element has
252/// been changed.
253/// If you override this, call also the version of your direct base-class.
254
256{
257 // Should send out some message. Need a new stamp type?
258}
259
260////////////////////////////////////////////////////////////////////////////////
261/// Set visualization-parameter model element.
262/// Calling of this function from outside of EVE should in principle
263/// be avoided as it can lead to dis-synchronization of viz-tag and
264/// viz-model.
265
267{
268 fVizModel = model;
269}
270
271////////////////////////////////////////////////////////////////////////////////
272/// Find model element in VizDB that corresponds to previously
273/// assigned fVizTag and set fVizModel accordingly.
274/// If the tag is not found in VizDB, the old model-element is kept
275/// and false is returned.
276
278{
280 if (model)
281 {
282 SetVizModel(model);
283 return kTRUE;
284 }
285 else
286 {
287 return kFALSE;
288 }
289}
290
291////////////////////////////////////////////////////////////////////////////////
292/// Set the VizTag, find model-element from the VizDB and copy
293/// visualization-parameters from it. If the model is not found and
294/// fallback_tag is non-null, search for it is attempted as well.
295/// For example: ApplyVizTag("TPC Clusters", "Clusters");
296///
297/// If the model-element can not be found a warning is printed and
298/// false is returned.
299
300Bool_t REveElement::ApplyVizTag(const TString& tag, const TString& fallback_tag)
301{
302 REveElement* model;
303
304 if ((model = REX::gEve->FindVizDBEntry(tag)) != nullptr)
305 {
306 SetVizTag(tag);
307 }
308 else if ( ! fallback_tag.IsNull() && (model = REX::gEve->FindVizDBEntry(fallback_tag)) != nullptr)
309 {
310 SetVizTag(fallback_tag);
311 }
312
313 if (model)
314 {
315 SetVizModel(model);
317 return true;
318 }
319 Warning("REveElement::ApplyVizTag", "entry for tag '%s' not found in VizDB.", tag.Data());
320 return false;
321}
322
323////////////////////////////////////////////////////////////////////////////////
324/// Propagate visualization parameters to dependent elements.
325///
326/// MainColor is propagated independently in SetMainColor().
327/// In this case, as fMainColor is a pointer to Color_t, it should
328/// be set in TProperClass::CopyVizParams().
329///
330/// Render state is not propagated. Maybe it should be, at least optionally.
331
333{
334 REveProjectable* pable = dynamic_cast<REveProjectable*>(this);
335 if (pable && pable->HasProjecteds())
336 {
337 pable->PropagateVizParams();
338 }
339}
340
341////////////////////////////////////////////////////////////////////////////////
342/// Propagate visualization parameters from element el (defaulting
343/// to this) to all children.
344///
345/// The primary use of this is for model-elements from
346/// visualization-parameter database.
347
349{
350 if (!el) el = this;
351
352 for (auto &c : fChildren)
353 {
354 c->CopyVizParams(el);
355 }
356}
357
358////////////////////////////////////////////////////////////////////////////////
359/// Copy visualization parameters from element el.
360/// This method needs to be overriden by any class that introduces
361/// new parameters.
362
364{
369
371}
372
373////////////////////////////////////////////////////////////////////////////////
374/// Copy visualization parameters from the model-element fVizModel.
375/// A warning is printed if the model-element fVizModel is not set.
376
378{
379 if (fVizModel)
380 {
382 }
383 else
384 {
385 Warning("REveElement::CopyVizParamsFromDB", "VizModel has not been set.");
386 }
387}
388
389////////////////////////////////////////////////////////////////////////////////
390/// Save visualization parameters for this element with given tag.
391///
392/// This function creates the instantiation code, calls virtual
393/// WriteVizParams() and, at the end, writes out the code for
394/// registration of the model into the VizDB.
395
396void REveElement::SaveVizParams(std::ostream& out, const TString& tag, const TString& var)
397{
398 static const REveException eh("REveElement::GetObject ");
399
400 TString t = " ";
401 TString cls(IsA()->GetName());
402
403 out << "\n";
404
405 TString intro = " TAG='" + tag + "', CLASS='" + cls + "'";
406 out << " //" << intro << "\n";
407 out << " //" << TString('-', intro.Length()) << "\n";
408 out << t << cls << "* " << var <<" = new " << cls << ";\n";
409
410 WriteVizParams(out, var);
411
412 out << t << "REX::gEve->InsertVizDBEntry(\"" << tag << "\", "<< var <<");\n";
413}
414
415////////////////////////////////////////////////////////////////////////////////
416/// Write-out visual parameters for this object.
417/// This is a virtual function and all sub-classes are required to
418/// first call the base-element version.
419/// The name of the element pointer is 'x%03d', due to cint limitations.
420/// Three spaces should be used for indentation, same as in
421/// SavePrimitive() methods.
422
423void REveElement::WriteVizParams(std::ostream& out, const TString& var)
424{
425 TString t = " " + var + "->";
426
427 out << t << "SetElementName(\"" << fName << "\");\n";
428 out << t << "SetElementTitle(\"" << fTitle << "\");\n";
429 out << t << "SetEditMainColor(" << fCanEditMainColor << ");\n";
430 out << t << "SetEditMainTransparency(" << fCanEditMainTransparency << ");\n";
431 out << t << "SetMainTransparency(" << fMainTransparency << ");\n";
432}
433
434////////////////////////////////////////////////////////////////////////////////
435/// Set visual parameters for this object for given tag.
436
437void REveElement::VizDB_Apply(const std::string& tag)
438{
439 if (ApplyVizTag(tag))
440 {
442 }
443}
444
445////////////////////////////////////////////////////////////////////////////////
446/// Reset visual parameters for this object from VizDB.
447/// The model object must be already set.
448
450{
451 if (fVizModel)
452 {
455 }
456}
457
458////////////////////////////////////////////////////////////////////////////////
459/// Copy visual parameters from this element to viz-db model.
460/// If update is set, all clients of the model will be updated to
461/// the new value.
462/// A warning is printed if the model-element fVizModel is not set.
463
465{
466 if (fVizModel)
467 {
469 if (update)
470 {
471 // XXX Back references from vizdb templates have been removed in Eve7.
472 // XXX We could traverse all scenes and elementes and reset those that
473 // XXX have a matching fVizModel. Or something.
474 Error("VizDB_UpdateModel", "update from vizdb -> elements not implemented.");
475 // fVizModel->PropagateVizParamsToElements(fVizModel);
476 }
477 }
478 else
479 {
480 Warning("VizDB_UpdateModel", "VizModel has not been set.");
481 }
482}
483
484////////////////////////////////////////////////////////////////////////////////
485/// Create a replica of element and insert it into VizDB with given tag.
486/// If replace is true an existing element with the same tag will be replaced.
487/// If update is true, existing client of tag will be updated.
488
489void REveElement::VizDB_Insert(const std::string& tag, Bool_t replace, Bool_t update)
490{
491 static const REveException eh("REveElement::GetObject ");
492
493 TClass* cls = IsA();
494 REveElement* el = reinterpret_cast<REveElement*>(cls->New());
495 if (!el) {
496 Error("VizDB_Insert", "Creation of replica failed.");
497 return;
498 }
499 el->CopyVizParams(this);
500 REX::gEve->InsertVizDBEntry(tag, el, replace, update);
501}
502
503////////////////////////////////////////////////////////////////////////////////
504/// Add el into the list aunts.
505///
506/// Adding aunt is subordinate to adding a niece.
507/// This is an internal function.
508
510{
511 assert(au != nullptr);
512
513 fAunts.emplace_back(au);
514}
515
516////////////////////////////////////////////////////////////////////////////////
517/// Remove el from the list of aunts.
518/// Removing aunt is subordinate to removing a niece.
519/// This is an internal function.
520
522{
523 assert(au != nullptr);
524
525 fAunts.remove(au);
526}
527
528/******************************************************************************/
529
530////////////////////////////////////////////////////////////////////////////////
531/// Check external references to this and eventually auto-destruct
532/// the render-element.
533
534void REveElement::CheckReferenceCount(const std::string& from)
535{
536 if (fDestructing != kNone)
537 return;
538
539 if (fMother == nullptr && fDestroyOnZeroRefCnt && fDenyDestroy <= 0)
540 {
541 if (gDebug > 0)
542 Info("REveElement::CheckReferenceCount", "(called from %s) auto-destructing '%s' on zero reference count.",
543 from.c_str(), GetCName());
544
546 delete this;
547 }
548}
549
550////////////////////////////////////////////////////////////////////////////////
551/// Return class for this element
552
554{
555 return TClass::GetClass(typeid(*this), kTRUE, kTRUE);
556}
557
558////////////////////////////////////////////////////////////////////////////////
559/// Export render-element to CINT with variable name var_name.
560
561void REveElement::ExportToCINT(const char *var_name)
562{
563 const char* cname = IsA()->GetName();
564 gROOT->ProcessLine(TString::Format("%s* %s = (%s*)0x%zx;", cname, var_name, cname, (size_t)this));
565}
566
567////////////////////////////////////////////////////////////////////////////////
568/// Set render state of this element, i.e. if it will be published
569/// on next scene update pass.
570/// Returns true if the state has changed.
571
573{
574 if (SingleRnrState())
575 {
576 return SetRnrState(rnr);
577 }
578
579 if (rnr != fRnrSelf)
580 {
581 fRnrSelf = rnr;
584
585 return kTRUE;
586 }
587 return kFALSE;
588}
589
590////////////////////////////////////////////////////////////////////////////////
591/// Set render state of this element's children, i.e. if they will
592/// be published on next scene update pass.
593/// Returns true if the state has changed.
594
596{
597 if (SingleRnrState())
598 {
599 return SetRnrState(rnr);
600 }
601
602 if (rnr != fRnrChildren)
603 {
604 fRnrChildren = rnr;
607 return kTRUE;
608 }
609 return kFALSE;
610}
611
612////////////////////////////////////////////////////////////////////////////////
613/// Set state for rendering of this element and its children.
614/// Returns true if the state has changed.
615
617{
618 if (SingleRnrState())
619 {
620 return SetRnrState(rnr_self);
621 }
622
623 if (fRnrSelf != rnr_self || fRnrChildren != rnr_children)
624 {
625 fRnrSelf = rnr_self;
626 fRnrChildren = rnr_children;
629 return kTRUE;
630 }
631 return kFALSE;
632}
633
634////////////////////////////////////////////////////////////////////////////////
635/// Set render state of this element and of its children to the same
636/// value.
637/// Returns true if the state has changed.
638
640{
641 if (fRnrSelf != rnr || fRnrChildren != rnr)
642 {
643 fRnrSelf = fRnrChildren = rnr;
646 return kTRUE;
647 }
648 return kFALSE;
649}
650
651////////////////////////////////////////////////////////////////////////////////
652/// Propagate render state to the projected replicas of this element.
653/// Maybe this should be optional on REX::gEve/element level.
654
656{
657 REveProjectable *pable = dynamic_cast<REveProjectable*>(this);
658 if (pable && pable->HasProjecteds())
659 {
661 }
662}
663
664////////////////////////////////////////////////////////////////////////////////
665/// Set up element to use built-in main color and set flags allowing editing
666/// of main color and transparency.
667
668void REveElement::SetupDefaultColorAndTransparency(Color_t col, Bool_t can_edit_color, Bool_t can_edit_transparency)
669{
671 fDefaultColor = col;
672 fCanEditMainColor = can_edit_color;
673 fCanEditMainTransparency = can_edit_transparency;
674}
675
676////////////////////////////////////////////////////////////////////////////////
677/// Set main color of the element.
678
680{
681 Color_t old_color = GetMainColor();
682
683 if (fMainColorPtr)
684 {
685 *fMainColorPtr = color;
687 }
688
689 PropagateMainColorToProjecteds(color, old_color);
690}
691
692////////////////////////////////////////////////////////////////////////////////
693/// Convert pixel to Color_t and call SetMainColor().
694
696{
698}
699
700////////////////////////////////////////////////////////////////////////////////
701/// Convert RGB values to Color_t and call SetMainColor.
702
704{
706}
707
708////////////////////////////////////////////////////////////////////////////////
709/// Convert RGB values to Color_t and call SetMainColor.
710
712{
714}
715
716////////////////////////////////////////////////////////////////////////////////
717/// Propagate color to projected elements.
718
720{
721 REveProjectable* pable = dynamic_cast<REveProjectable*>(this);
722 if (pable && pable->HasProjecteds())
723 {
724 pable->PropagateMainColor(color, old_color);
725 }
726}
727
728////////////////////////////////////////////////////////////////////////////////
729/// Set main-transparency.
730/// Transparency is clamped to [0, 100].
731
733{
734 Char_t old_t = GetMainTransparency();
735
736 if (t > 100) t = 100;
739
741}
742
743////////////////////////////////////////////////////////////////////////////////
744/// Set main-transparency via float alpha variable.
745/// Value of alpha is clamped t0 [0, 1].
746
748{
749 if (alpha < 0) alpha = 0;
750 if (alpha > 1) alpha = 1;
751 SetMainTransparency((Char_t) (100.0f*(1.0f - alpha)));
752}
753
754////////////////////////////////////////////////////////////////////////////////
755/// Propagate transparency to projected elements.
756
758{
759 REveProjectable* pable = dynamic_cast<REveProjectable*>(this);
760 if (pable && pable->HasProjecteds())
761 {
762 pable->PropagateMainTransparency(t, old_t);
763 }
764}
765
766////////////////////////////////////////////////////////////////////////////////
767/// Return pointer to main transformation. If 'create' flag is set (default)
768/// it is created if not yet existing.
769
771{
772 if (!fMainTrans && create)
774
775 return fMainTrans.get();
776}
777
778////////////////////////////////////////////////////////////////////////////////
779/// Return reference to main transformation. It is created if not yet
780/// existing.
781
783{
784 if (!fMainTrans)
786
787 return *fMainTrans.get();
788}
789
790////////////////////////////////////////////////////////////////////////////////
791/// Initialize the main transformation to identity matrix.
792/// If can_edit is true (default), the user will be able to edit the
793/// transformation parameters via GUI.
794
796{
797 if (fMainTrans)
798 fMainTrans->UnitTrans();
799 else
800 fMainTrans = std::make_unique<REveTrans>();
801 fCanEditMainTrans = can_edit;
802}
803
804////////////////////////////////////////////////////////////////////////////////
805/// Destroy the main transformation matrix, it will always be taken
806/// as identity. Editing of transformation parameters is disabled.
807
809{
810 fMainTrans.reset(nullptr);
812}
813
814////////////////////////////////////////////////////////////////////////////////
815/// Set transformation matrix from column-major array.
816
818{
819 RefMainTrans().SetFrom(carr);
820}
821
822////////////////////////////////////////////////////////////////////////////////
823/// Set transformation matrix from TGeo's matrix.
824
826{
827 RefMainTrans().SetFrom(mat);
828}
829
830////////////////////////////////////////////////////////////////////////////////
831/// Check if el can be added to this element.
832///
833/// Here we make sure the new child is not equal to this and, if fChildClass
834/// is set, that it is inherited from it.
835
837{
838 if (el == this)
839 return kFALSE;
840 if (fChildClass && ! el->IsA()->InheritsFrom(fChildClass))
841 return kFALSE;
842 return kTRUE;
843}
844
845////////////////////////////////////////////////////////////////////////////////
846/// Add el to the list of children.
847
849{
850 static const REveException eh("REveElement::AddElement ");
851
852 if (!el) throw eh + "called with nullptr argument.";
853 if ( ! AcceptElement(el)) throw eh + Form("parent '%s' rejects '%s'.", GetCName(), el->GetCName());
854 if (el->fElementId) throw eh + "element already has an id.";
855 // if (el->fScene) throw eh + "element already has a Scene.";
856 if (el->fMother) throw eh + "element already has a Mother.";
857
858 // XXX Implement reparent --> MoveElement() ????
859 // Actually, better to do new = old.Clone(), RemoveElement(old), AddElement(new);
860 // Or do magick with Inc/DecDenyDestroy().
861 // PITA with existing children !!!! Need to re-scene them.
862
864 if (fScene && ! el->fScene) el->assign_scene_recursively(fScene);
865
866 el->fMother = this;
867
868 fChildren.emplace_back(el);
869
870 // XXXX This should be element added. Also, should be different for
871 // "full (re)construction". Scenes should manage that and have
872 // state like: none - constructing - clearing - nominal - updating.
873 // I recon this means an element should have a ptr to its scene.
874 //
875 // ElementChanged();
876}
877
878////////////////////////////////////////////////////////////////////////////////
879/// Remove el from the list of children.
880
882{
883 static const REveException eh("REveElement::RemoveElement ");
884
885 if (!el) throw eh + "called with nullptr argument.";
886 if (el->fMother != this) throw eh + "this element is not mother of el.";
887
889
891 el->fMother = nullptr;
892 el->fScene = nullptr;
893
895
896 fChildren.remove(el);
897
898 // XXXX This should be ElementRemoved(). Also, think about recursion, deletion etc.
899 // Also, this seems to be done above, in the call to fScene.
900 //
901 // ElementChanged();
902}
903
904////////////////////////////////////////////////////////////////////////////////
905/// Perform additional local removal of el.
906/// Called from RemoveElement() which does whole untangling.
907/// Put into special function as framework-related handling of
908/// element removal should really be common to all classes and
909/// clearing of local structures happens in between removal
910/// of list-tree-items and final removal.
911/// If you override this, you should also override
912/// RemoveElementsLocal().
913
915{
916}
917
918////////////////////////////////////////////////////////////////////////////////
919/// Remove all elements. This assumes removing of all elements can
920/// be done more efficiently then looping over them and removing one
921/// by one. This protected function performs the removal on the
922/// level of REveElement.
923
925{
927
928 for (auto &c : fChildren)
929 {
930 c->fScene->SceneElementRemoved(c->fElementId);
931 c->fMother = nullptr;
932 c->fScene = nullptr;
933
934 c->CheckReferenceCount();
935 }
936
937 fChildren.clear();
938}
939
940////////////////////////////////////////////////////////////////////////////////
941/// Remove all elements. This assumes removing of all elements can
942/// be done more efficiently then looping over them and removing
943/// them one by one.
944
946{
947 if (HasChildren())
948 {
950 // ElementChanged();
951 }
952}
953
954////////////////////////////////////////////////////////////////////////////////
955/// Perform additional local removal of all elements.
956/// See comment to RemoveElementLocal(REveElement*).
957
959{
960}
961
962////////////////////////////////////////////////////////////////////////////////
963/// If this is a projectable, loop over all projected replicas and
964/// add the projected image of child 'el' there. This is supposed to
965/// be called after you add a child to a projectable after it has
966/// already been projected.
967/// You might also want to call RecheckImpliedSelections() on this
968/// element or 'el'.
969///
970/// If 'same_depth' flag is true, the same depth as for parent object
971/// is used in every projection. Otherwise current depth of each
972/// relevant projection-manager is used.
973
975{
976 REveProjectable* pable = dynamic_cast<REveProjectable*>(this);
977 if (pable && HasChild(el))
978 {
979 for (auto &pp: pable->RefProjecteds())
980 {
981 auto pmgr = pp->GetManager();
982 Float_t cd = pmgr->GetCurrentDepth();
983 if (same_depth) pmgr->SetCurrentDepth(pp->GetDepth());
984
985 pmgr->SubImportElements(el, pp->GetProjectedAsElement());
986
987 if (same_depth) pmgr->SetCurrentDepth(cd);
988 }
989 }
990}
991
992////////////////////////////////////////////////////////////////////////////////
993/// If this is a projectable, loop over all projected replicas and
994/// add the projected image of all children there. This is supposed
995/// to be called after you destroy all children and then add new
996/// ones after this element has already been projected.
997/// You might also want to call RecheckImpliedSelections() on this
998/// element.
999///
1000/// If 'same_depth' flag is true, the same depth as for the
1001/// projected element is used in every projection. Otherwise current
1002/// depth of each relevant projection-manager is used.
1003
1005{
1006 REveProjectable* pable = dynamic_cast<REveProjectable*>(this);
1007 if (pable)
1008 {
1009 for (auto &pp: pable->RefProjecteds())
1010 {
1011 REveProjectionManager *pmgr = pp->GetManager();
1012 Float_t cd = pmgr->GetCurrentDepth();
1013 if (same_depth) pmgr->SetCurrentDepth(pp->GetDepth());
1014
1015 pmgr->SubImportChildren(this, pp->GetProjectedAsElement());
1016
1017 if (same_depth) pmgr->SetCurrentDepth(cd);
1018 }
1019 }
1020}
1021
1022////////////////////////////////////////////////////////////////////////////////
1023/// Check if element el is a child of this element.
1024
1026{
1027 return (std::find(fChildren.begin(), fChildren.end(), el) != fChildren.end());
1028}
1029
1030////////////////////////////////////////////////////////////////////////////////
1031/// Find the first child with given name. If cls is specified (non
1032/// 0), it is also checked.
1033///
1034/// Returns nullptr if not found.
1035
1037{
1038 for (auto &c: fChildren)
1039 {
1040 if (name.CompareTo(c->GetCName()) == 0)
1041 {
1042 if (!cls || c->IsA()->InheritsFrom(cls))
1043 return c;
1044 }
1045 }
1046 return nullptr;
1047}
1048
1049////////////////////////////////////////////////////////////////////////////////
1050/// Find the first child whose name matches regexp. If cls is
1051/// specified (non 0), it is also checked.
1052///
1053/// Returns nullptr if not found.
1054
1056{
1057 for (auto &c: fChildren)
1058 {
1059 if (regexp.MatchB(c->GetName()))
1060 {
1061 if (!cls || c->IsA()->InheritsFrom(cls))
1062 return c;
1063 }
1064 }
1065 return nullptr;
1066}
1067
1068////////////////////////////////////////////////////////////////////////////////
1069/// Find all children with given name and append them to matches
1070/// list. If class is specified (non 0), it is also checked.
1071///
1072/// Returns number of elements added to the list.
1073
1075 const TString& name, const TClass* cls)
1076{
1077 Int_t count = 0;
1078 for (auto &c: fChildren)
1079 {
1080 if (name.CompareTo(c->GetCName()) == 0)
1081 {
1082 if (!cls || c->IsA()->InheritsFrom(cls))
1083 {
1084 matches.push_back(c);
1085 ++count;
1086 }
1087 }
1088 }
1089 return count;
1090}
1091
1092////////////////////////////////////////////////////////////////////////////////
1093/// Find all children whose name matches regexp and append them to
1094/// matches list.
1095///
1096/// Returns number of elements added to the list.
1097
1099 TPRegexp &regexp, const TClass *cls)
1100{
1101 Int_t count = 0;
1102 for (auto &c : fChildren)
1103 {
1104 if (regexp.MatchB(c->GetCName()))
1105 {
1106 if (!cls || c->IsA()->InheritsFrom(cls))
1107 {
1108 matches.push_back(c);
1109 ++count;
1110 }
1111 }
1112 }
1113 return count;
1114}
1115
1116////////////////////////////////////////////////////////////////////////////////
1117/// Returns the first child element or 0 if the list is empty.
1118
1120{
1121 return HasChildren() ? fChildren.front() : nullptr;
1122}
1123
1124////////////////////////////////////////////////////////////////////////////////
1125/// Returns the last child element or 0 if the list is empty.
1126
1128{
1129 return HasChildren() ? fChildren.back() : nullptr;
1130}
1131
1132////////////////////////////////////////////////////////////////////////////////
1133/// Enable rendering of children and their list contents.
1134/// Arguments control how to set self/child rendering.
1135
1137{
1138 for (auto &c: fChildren)
1139 c->SetRnrSelfChildren(rnr_self, rnr_children);
1140}
1141
1142////////////////////////////////////////////////////////////////////////////////
1143/// Disable rendering of children and their list contents.
1144/// Arguments control how to set self/child rendering.
1145///
1146/// Same as above function, but default arguments are different. This
1147/// is convenient for calls via context menu.
1148
1150{
1151 for (auto &c: fChildren)
1152 c->SetRnrSelfChildren(rnr_self, rnr_children);
1153}
1154
1155////////////////////////////////////////////////////////////////////////////////
1156/// Protected member function called from REveElement::Annihilate().
1157
1159{
1160 // projected were already destroyed in REveElement::Anihilate(), now only clear its list
1161 REveProjectable* pable = dynamic_cast<REveProjectable*>(this);
1162 if (pable && pable->HasProjecteds())
1163 pable->ClearProjectedList();
1164
1165 // same as REveElement::RemoveElementsInternal(), except parents are ignored
1167 for (auto &c : fChildren)
1168 c->AnnihilateRecursively();
1169
1170 fChildren.clear();
1171
1174
1175 delete this;
1176}
1177
1178////////////////////////////////////////////////////////////////////////////////
1179/// Optimized destruction without check of reference-count.
1180/// Parents are not notified about child destruction.
1181/// The method should only be used when an element does not have
1182/// more than one parent -- otherwise an exception is thrown.
1183
1185{
1186 static const REveException eh("REveElement::Annihilate ");
1187
1189
1190 // recursive annihilation of projecteds
1191 REveProjectable* pable = dynamic_cast<REveProjectable*>(this);
1192 if (pable && pable->HasProjecteds())
1193 {
1194 pable->AnnihilateProjecteds();
1195 }
1196
1197 // detach from the parent
1198 if (fMother)
1199 {
1200 fMother->RemoveElement(this);
1201 }
1202
1203 // XXXX wont the above already start off the destruction cascade ?????
1204
1206
1207 // XXXX ????? Annihilate flag ???? Is it different than regular remove ????
1208}
1209
1210////////////////////////////////////////////////////////////////////////////////
1211/// Annihilate elements.
1212
1214{
1215 while (!fChildren.empty())
1216 {
1217 auto c = fChildren.front();
1218 c->Annihilate();
1219 }
1220}
1221
1222////////////////////////////////////////////////////////////////////////////////
1223/// Destroy this element. Throws an exception if deny-destroy is in force.
1224/// This method should be called instead of a destructor.
1225/// Note that an exception will be thrown if the element has been
1226/// protected against destruction with IncDenyDestroy().
1227
1229{
1230 static const REveException eh("REveElement::Destroy ");
1231
1232 if (fDenyDestroy > 0)
1233 throw eh + TString::Format("element '%s' (%s*) %p is protected against destruction.",
1234 GetCName(), IsA()->GetName(), this);
1235
1237 delete this;
1238}
1239
1240////////////////////////////////////////////////////////////////////////////////
1241/// Destroy this element. Prints a warning if deny-destroy is in force.
1242
1244{
1245 try
1246 {
1247 Destroy();
1248 }
1249 catch (REveException &exc)
1250 {
1251 ::Warning("REveElement::DestroyOrWarn", "Error while destroy element %p : %s", this, exc.what());
1252 }
1253}
1254
1255////////////////////////////////////////////////////////////////////////////////
1256/// Destroy all children of this element.
1257
1259{
1260 while (HasChildren())
1261 {
1262 auto c = fChildren.front();
1263 if (c->fDenyDestroy <= 0)
1264 {
1265 try {
1266 c->Destroy();
1267 }
1268 catch (REveException &exc) {
1269 ::Warning("REveElement::DestroyElements", "element destruction failed: '%s'.", exc.what());
1271 }
1272 }
1273 else
1274 {
1275 if (gDebug > 0)
1276 ::Info("REveElement::DestroyElements", "element '%s' is protected against destruction, removing locally.", c->GetCName());
1278 }
1279 }
1280}
1281
1282////////////////////////////////////////////////////////////////////////////////
1283/// Returns state of flag determining if the element will be
1284/// destroyed when reference count reaches zero.
1285/// This is true by default.
1286
1288{
1289 return fDestroyOnZeroRefCnt;
1290}
1291
1292////////////////////////////////////////////////////////////////////////////////
1293/// Sets the state of flag determining if the element will be
1294/// destroyed when reference count reaches zero.
1295/// This is true by default.
1296
1298{
1300}
1301
1302////////////////////////////////////////////////////////////////////////////////
1303/// Returns the number of times deny-destroy has been requested on
1304/// the element.
1305
1307{
1308 return fDenyDestroy;
1309}
1310
1311////////////////////////////////////////////////////////////////////////////////
1312/// Increases the deny-destroy count of the element.
1313/// Call this if you store an external pointer to the element.
1314
1316{
1317 ++fDenyDestroy;
1318}
1319
1320////////////////////////////////////////////////////////////////////////////////
1321/// Decreases the deny-destroy count of the element.
1322/// Call this after releasing an external pointer to the element.
1323
1325{
1326 if (--fDenyDestroy <= 0)
1327 CheckReferenceCount("REveElement::DecDenyDestroy ");
1328}
1329
1330////////////////////////////////////////////////////////////////////////////////
1331/// Set pickable state on the element and all its children.
1332
1334{
1335 fPickable = p;
1336 for (auto &c: fChildren)
1337 c->SetPickableRecursively(p);
1338}
1339
1340////////////////////////////////////////////////////////////////////////////////
1341/// Returns the master element - that is:
1342/// - master of projectable, if this is a projected;
1343/// - master of compound, if fCompound is set;
1344/// - master of mother, if kSCBTakeMotherAsMaster bit is set;
1345/// If non of the above is true, *this* is returned.
1346
1348{
1350
1351 REveProjected* proj = dynamic_cast<REveProjected*>(this);
1352 if (proj)
1353 {
1354 return dynamic_cast<REveElement*>(proj->GetProjectable())->GetSelectionMaster();
1355 }
1356 if (fCompound)
1357 {
1358 return fCompound->GetSelectionMaster();
1359 }
1361 {
1362 return fMother->GetSelectionMaster();
1363 }
1364 return this;
1365}
1366
1367////////////////////////////////////////////////////////////////////////////////
1368/// Populate set impSelSet with derived / dependant elements.
1369///
1370/// If this is a REveProjectable, the projected replicas are added
1371/// to the set. Thus it does not have to be reimplemented for each
1372/// sub-class of REveProjected.
1373///
1374/// Note that this also takes care of projections of REveCompound
1375/// class, which is also a projectable.
1376
1378{
1379 REveProjectable* p = dynamic_cast<REveProjectable*>(this);
1380 if (p)
1381 p->AddProjectedsToSet(impSelSet);
1382}
1383
1384////////////////////////////////////////////////////////////////////////////////
1385/// Call this if it is possible that implied-selection or highlight
1386/// has changed for this element or for implied-selection this
1387/// element is member of and you want to maintain consistent
1388/// selection state.
1389/// This can happen if you add elements into compounds in response
1390/// to user-interaction.
1391
1393{
1394 // XXXX MT 2019-01 --- RecheckImpliedSelections
1395 //
1396 // With removal of selection state from this class there might be some
1397 // corner cases requiring checking of implied-selected state in
1398 // selection/highlight objects.
1399 //
1400 // This could be done as part of begin / end changes on the EveManager level.
1401 //
1402 // See also those functions in TEveSelection.
1403
1404 // if (fSelected || fImpliedSelected)
1405 // REX::gEve->GetSelection()->RecheckImpliedSetForElement(this);
1406
1407 // if (fHighlighted || fImpliedHighlighted)
1408 // REX::gEve->GetHighlight()->RecheckImpliedSetForElement(this);
1409}
1410
1411////////////////////////////////////////////////////////////////////////////////
1412/// Add (bitwise or) given stamps to fChangeBits.
1413/// Register this element to REX::gEve as stamped.
1414/// This method is virtual so that sub-classes can add additional
1415/// actions. The base-class method should still be called (or replicated).
1416
1418{
1420 {
1421 if (gDebug > 0)
1422 ::Info(Form("%s::AddStamp", GetCName()), "%d + (%d) -> %d", fChangeBits, bits, fChangeBits | bits);
1423
1424 if (fChangeBits == 0)
1425 {
1427 }
1428
1429 fChangeBits |= bits;
1430 }
1431}
1432
1433////////////////////////////////////////////////////////////////////////////////
1434/// Write transformation Matrix to render data
1435////////////////////////////////////////////////////////////////////////////////
1436
1438{
1439 if (fMainTrans.get())
1440 {
1441 fRenderData->SetMatrix(fMainTrans->Array());
1442 }
1443}
1444
1445////////////////////////////////////////////////////////////////////////////////
1446/// Convert Bool_t to string - kTRUE or kFALSE.
1447/// Needed in WriteVizParams().
1448
1449const std::string& REveElement::ToString(Bool_t b)
1450{
1451 static const std::string true_str ("kTRUE");
1452 static const std::string false_str("kFALSE");
1453
1454 return b ? true_str : false_str;
1455}
1456
1457////////////////////////////////////////////////////////////////////////////////
1458/// Write core json. If rnr_offset is negative, render data shall not be
1459/// written.
1460/// Returns number of bytes written into binary render data.
1461
1462Int_t REveElement::WriteCoreJson(nlohmann::json &j, Int_t rnr_offset)
1463{
1464 j["_typename"] = IsA()->GetName();
1465 j["fName"] = fName;
1466 j["fTitle"] = fTitle;
1467 j["fElementId"] = GetElementId();
1468 j["fMotherId"] = get_mother_id();
1469 j["fSceneId"] = get_scene_id();
1470 j["fMasterId"] = GetSelectionMaster()->GetElementId();
1471
1472 j["fRnrSelf"] = GetRnrSelf();
1473 j["fRnrChildren"] = GetRnrChildren();
1474
1475 j["fMainColor"] = GetMainColor();
1476 j["fMainTransparency"] = GetMainTransparency();
1477 j["fPickable"] = fPickable;
1478
1479 Int_t ret = 0;
1480
1481 if (rnr_offset >= 0) {
1483
1484 if (fRenderData) {
1485 nlohmann::json rd = {};
1486
1487 rd["rnr_offset"] = rnr_offset;
1488 rd["rnr_func"] = fRenderData->GetRnrFunc();
1489 rd["vert_size"] = fRenderData->SizeV();
1490 rd["norm_size"] = fRenderData->SizeN();
1491 rd["index_size"] = fRenderData->SizeI();
1492 rd["trans_size"] = fRenderData->SizeT();
1493
1494 j["render_data"] = rd;
1495
1496 ret = fRenderData->GetBinarySize();
1497 }
1498 }
1499
1500 return ret;
1501}
ULong_t Pixel_t
Pixel value.
Definition: GuiTypes.h:40
ROOT::R::TRInterface & r
Definition: Object.C:4
#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)
int Int_t
Definition: RtypesCore.h:45
unsigned char UChar_t
Definition: RtypesCore.h:38
char Char_t
Definition: RtypesCore.h:33
const Bool_t kFALSE
Definition: RtypesCore.h:101
bool Bool_t
Definition: RtypesCore.h:63
double Double_t
Definition: RtypesCore.h:59
short Color_t
Definition: RtypesCore.h:92
float Float_t
Definition: RtypesCore.h:57
const Bool_t kTRUE
Definition: RtypesCore.h:100
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
Definition: TError.cxx:220
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition: TError.cxx:187
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition: TError.cxx:231
R__EXTERN TEveManager * gEve
Definition: TEveManager.h:243
char name[80]
Definition: TGX11.cxx:110
Int_t gDebug
Definition: TROOT.cxx:592
#define gROOT
Definition: TROOT.h:404
char * Form(const char *fmt,...)
virtual REveElement * CloneElement() const
Clone the element via copy constructor.
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.
void DecDenyDestroy()
Decreases the deny-destroy count of the element.
virtual void DestroyOrWarn()
Destroy this element. Prints a warning if deny-destroy is in force.
virtual void FillImpliedSelectedSet(Set_t &impSelSet)
Populate set impSelSet with derived / dependant elements.
const std::string & GetName() const
void SetNameTitle(const std::string &name, const std::string &title)
Set name and title of an element.
virtual void RemoveAunt(REveAunt *au)
Remove el from the list of aunts.
TString fVizTag
Element used as model from VizDB.
Definition: REveElement.hxx:80
void SaveVizParams(std::ostream &out, const TString &tag, const TString &var)
Save visualization parameters for this element with given tag.
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.
REveElement * FindChild(const TString &name, const TClass *cls=nullptr)
Find the first child with given name.
TClass * IsA() const
Return class for this element.
virtual void Destroy()
Destroy this element.
virtual void PropagateVizParamsToChildren(REveElement *el=nullptr)
Propagate visualization parameters from element el (defaulting to this) to all children.
REveElement * LastChild() const
Returns the last child element or 0 if the list is empty.
virtual REveElement * GetSelectionMaster()
Returns the master element - that is:
virtual void RemoveElementsLocal()
Perform additional local removal of all elements.
virtual void AnnihilateElements()
Annihilate elements.
virtual REveTrans & RefMainTrans()
Return reference to main transformation.
void SetMainColorRGB(UChar_t r, UChar_t g, UChar_t b)
Convert RGB values to Color_t and call SetMainColor.
virtual std::string GetHighlightTooltip(const std::set< int > &) const
virtual void SetMainTransparency(Char_t t)
Set main-transparency.
virtual Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset)
Write core json.
void SetVizTag(const TString &tag)
virtual void SetTransMatrix(Double_t *carr)
Set transformation matrix from column-major array.
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...
void SetMainAlpha(Float_t alpha)
Set main-transparency via float alpha variable.
virtual void Annihilate()
Optimized destruction without check of reference-count.
virtual void PropagateMainColorToProjecteds(Color_t color, Color_t old_color)
Propagate color to projected elements.
void VizDB_Apply(const std::string &tag)
Set visual parameters for this object for given tag.
void SetupDefaultColorAndTransparency(Color_t col, Bool_t can_edit_color, Bool_t can_edit_transparency)
Set up element to use built-in main color and set flags allowing editing of main color and transparen...
const char * GetCName() const
virtual void AddElement(REveElement *el)
Add el to the list of children.
virtual void WriteVizParams(std::ostream &out, const TString &var)
Write-out visual parameters for this object.
virtual void RemoveElementLocal(REveElement *el)
Perform additional local removal of el.
void DisableListElements(Bool_t rnr_self=kFALSE, Bool_t rnr_children=kFALSE)
Disable rendering of children and their list contents.
virtual Bool_t GetRnrSelf() const
virtual void ExportToCINT(const char *var_name)
Export render-element to CINT with variable name var_name.
virtual void DestroyMainTrans()
Destroy the main transformation matrix, it will always be taken as identity.
virtual Bool_t SetRnrChildren(Bool_t rnr)
Set render state of this element's children, i.e.
void SetTitle(const std::string &title)
Set title of an element.
virtual void AnnihilateRecursively()
Protected member function called from REveElement::Annihilate().
void SetMainColorPixel(Pixel_t pixel)
Convert pixel to Color_t and call SetMainColor().
Bool_t SetVizModelByTag()
Find model element in VizDB that corresponds to previously assigned fVizTag and set fVizModel accordi...
virtual void RemoveElementsInternal()
Remove all elements.
virtual void InitMainTrans(Bool_t can_edit=kTRUE)
Initialize the main transformation to identity matrix.
Bool_t fDestroyOnZeroRefCnt
Deny-destroy count.
Definition: REveElement.hxx:83
std::unique_ptr< REveRenderData > fRenderData
Externally assigned and controlled user data.
Definition: REveElement.hxx:98
void VizDB_Insert(const std::string &tag, Bool_t replace=kTRUE, Bool_t update=kTRUE)
Create a replica of element and insert it into VizDB with given tag.
virtual void DestroyElements()
Destroy all children of this element.
REveElement * FirstChild() const
Returns the first child element or 0 if the list is empty.
void EnableListElements(Bool_t rnr_self=kTRUE, Bool_t rnr_children=kTRUE)
Enable rendering of children and their list contents.
virtual REveTrans * PtrMainTrans(Bool_t create=kTRUE)
Return pointer to main transformation.
virtual Bool_t AcceptElement(REveElement *el)
Check if el can be added to this element.
virtual Char_t GetMainTransparency() const
static const std::string & ToString(Bool_t b)
Convert Bool_t to string - kTRUE or kFALSE.
virtual Bool_t SetRnrSelf(Bool_t rnr)
Set render state of this element, i.e.
virtual void AddAunt(REveAunt *au)
Add el into the list aunts.
virtual void PropagateMainTransparencyToProjecteds(Char_t t, Char_t old_t)
Propagate transparency to projected elements.
virtual Bool_t SetRnrState(Bool_t rnr)
Set render state of this element and of its children to the same value.
virtual void AddStamp(UChar_t bits)
Add (bitwise or) given stamps to fChangeBits.
void assign_scene_recursively(REveScene *s)
Bool_t TestCSCBits(UChar_t f) const
ElementId_t get_mother_id() const
Int_t GetDenyDestroy() const
Returns the number of times deny-destroy has been requested on the element.
virtual Bool_t SetRnrSelfChildren(Bool_t rnr_self, Bool_t rnr_children)
Set state for rendering of this element and its children.
void SetPickableRecursively(Bool_t p)
Set pickable state on the element and all its children.
virtual void PropagateRnrStateToProjecteds()
Propagate render state to the projected replicas of this element.
void IncDenyDestroy()
Increases the deny-destroy count of the element.
void VizDB_Reapply()
Reset visual parameters for this object from VizDB.
virtual Bool_t GetRnrChildren() const
virtual void CopyVizParams(const REveElement *el)
Copy visualization parameters from element el.
virtual void PreDeleteElement()
Vertex / normal / triangle index information for rendering.
virtual void CheckReferenceCount(const std::string &from="<unknown>")
Check external references to this and eventually auto-destruct the render-element.
virtual void CloneChildrenRecurse(REveElement *dest, Int_t level=0) const
Clone children and attach them to the dest element.
void SetVizModel(REveElement *model)
Set visualization-parameter model element.
std::set< REveElement * > Set_t
Definition: REveElement.hxx:54
ElementId_t GetElementId() const
virtual void RemoveElements()
Remove all elements.
Bool_t GetDestroyOnZeroRefCnt() const
Returns state of flag determining if the element will be destroyed when reference count reaches zero.
virtual Bool_t SingleRnrState() const
virtual void SetMainColor(Color_t color)
Set main color of the element.
virtual ~REveElement()
Destructor.
Definition: REveElement.cxx:97
void VizDB_UpdateModel(Bool_t update=kTRUE)
Copy visual parameters from this element to viz-db model.
virtual REveElement * CloneElementRecurse(Int_t level=0) const
Clone elements and recurse 'level' deep over children.
std::list< REveElement * > List_t
Definition: REveElement.hxx:52
virtual void NameTitleChanged()
Virtual function called when a name or title of the element has been changed.
std::unique_ptr< REveTrans > fMainTrans
Definition: REveElement.hxx:94
Bool_t HasChild(REveElement *el)
Check if element el is a child of this element.
REveElement(const std::string &name="", const std::string &title="")
Default constructor.
Definition: REveElement.cxx:50
virtual Color_t GetMainColor() const
void RecheckImpliedSelections()
Call this if it is possible that implied-selection or highlight has changed for this element or for i...
void SetName(const std::string &name)
Set name of an element.
virtual void RemoveElement(REveElement *el)
Remove el from the list of children.
ElementId_t get_scene_id() const
virtual void PropagateVizParamsToProjecteds()
Propagate visualization parameters to dependent elements.
virtual void BuildRenderData()
Write transformation Matrix to render data.
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 ProjectChild(REveElement *el, Bool_t same_depth=kTRUE)
If this is a projectable, loop over all projected replicas and add the projected image of child 'el' ...
REveException Exception-type thrown by Eve classes.
Definition: REveTypes.hxx:41
const char * what() const noexcept override
Definition: REveTypes.hxx:49
virtual void AddProjectedsToSet(std::set< REveElement * > &set)
Add the projected elements to the set, dyn-casting them to REveElement.
virtual void PropagateVizParams(REveElement *el=nullptr)
Set visualization parameters of projecteds.
virtual void PropagateMainColor(Color_t color, Color_t old_color)
Set main color of projecteds if their color is the same as old_color.
virtual void AnnihilateProjecteds()
Optimized destroy of projected elements with condition there is only one parent for projected element...
virtual void PropagateRenderState(Bool_t rnr_self, Bool_t rnr_children)
Set render state 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.
REveProjectable * GetProjectable() const
REveProjectionManager Manager class for steering of projections and managing projected objects.
virtual Int_t SubImportChildren(REveElement *el, REveElement *proj_parent)
Recursively import children elements of el and apply projection to the newly imported objects.
Bool_t IsAcceptingChanges() const
Definition: REveScene.hxx:97
void SceneElementRemoved(ElementId_t id)
Definition: REveScene.cxx:115
void SceneElementChanged(REveElement *element)
Definition: REveScene.cxx:108
void SetFrom(Double_t *carr)
Definition: REveTrans.cxx:979
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:80
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
Definition: TClass.cxx:4971
Bool_t InheritsFrom(const char *cl) const
Return kTRUE if this class inherits from a class with name "classname".
Definition: TClass.cxx:4867
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Definition: TClass.cxx:2955
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:1775
void PreDeleteElement(TEveElement *element)
Called from TEveElement prior to its destruction so the framework components (like object editor) can...
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.
Geometrical transformation package.
Definition: TGeoMatrix.h:41
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
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:136
Ssiz_t Length() const
Definition: TString.h:410
const char * Data() const
Definition: TString.h:369
Bool_t IsNull() const
Definition: TString.h:407
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:2336
unsigned int ElementId_t
Definition: REveTypes.hxx:25
static constexpr double s
#define dest(otri, vertexptr)
Definition: triangle.c:1041