Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
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),
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) {
105 fMother->RemoveElementLocal(this);
106 fMother->fChildren.remove(this);
107 }
108
109 if (fScene) {
110 fScene->SceneElementRemoved( fElementId);
111 }
112
113 for (auto &au : fAunts)
114 {
115 au->RemoveNieceInternal(this);
116 }
117 }
118}
119
120// MIR execution variables and helper functions
121
122thread_local REveElement *REveElement::stlMirAlpha = nullptr;
123thread_local int REveElement::stlMirError = 0;
124thread_local std::string REveElement::stlMirErrorString;
125
127 stlMirAlpha = nullptr;
128 stlMirError = 0;
129 stlMirErrorString.clear();
130}
131
135
136void REveElement::SetMirError(int error, std::string_view err_str) {
137 stlMirError = error;
138 if ( ! err_str.empty()) {
139 AppendMirErrorString(err_str);
140 }
141}
142
143void REveElement::AppendMirErrorString(std::string_view err_str) {
144 if (stlMirErrorString.empty()) {
145 stlMirErrorString = err_str;
146 } else {
147 std::string s;
148 s.reserve(stlMirErrorString.size() + err_str.size() + 4);
149 s = err_str;
150 s += " :: ";
152 stlMirErrorString.swap(s);
153 }
154}
155
156// Element IDs etc
157
159{
160 return fMother ? fMother->GetElementId() : 0;
161}
162
164{
165 return fScene ? fScene->GetElementId() : 0;
166}
167
169{
170 assert(fElementId == 0);
171
172 REX::gEve->AssignElementId(this);
173 for (auto &c : fChildren)
174 c->assign_element_id_recurisvely();
175}
176
177std::string REveElement::GetHighlightTooltip(const std::set<int>& iSet) const
178{
179 std::string res = fTitle;
180 if (res.empty())
181 res = fName;
182
183 if (!iSet.empty())
184 res = TString::Format("%s idx=%d", res.c_str(), *iSet.begin());
185
186 return res;
187}
188
190{
191 assert(fScene == nullptr);
192
193 fScene = s;
194
195 // XXX MT -- Why do we have fDestructing here? Can this really happen?
196 // If yes, shouldn't we block it in AddElement() already?
197 if (fDestructing == kNone && fScene && fScene->IsAcceptingChanges())
198 {
200 }
201 for (auto &c : fChildren)
202 c->assign_scene_recursively(s);
203}
204
205////////////////////////////////////////////////////////////////////////////////
206/// Called before the element is deleted, thus offering the last chance
207/// to detach from acquired resources and from the framework itself.
208/// Here the request is just passed to REveManager.
209/// If you override it, make sure to call base-class version.
210
212{
213 if (fElementId != 0)
214 {
215 REX::gEve->PreDeleteElement(this);
216 }
217}
218
219////////////////////////////////////////////////////////////////////////////////
220/// Clone the element via copy constructor.
221/// Should be implemented for all classes that require cloning support.
222
224{
225 return new REveElement(*this);
226}
227
228////////////////////////////////////////////////////////////////////////////////
229/// Clone elements and recurse 'level' deep over children.
230/// - If level == 0, only the element itself is cloned (default).
231/// - If level == -1, all the hierarchy is cloned.
232
234{
236 if (level--)
237 {
238 CloneChildrenRecurse(el, level);
239 }
240 return el;
241}
242
243////////////////////////////////////////////////////////////////////////////////
244/// Clone children and attach them to the dest element.
245/// If level == 0, only the direct descendants are cloned (default).
246/// If level == -1, all the hierarchy is cloned.
247
249{
250 for (auto &c: fChildren)
251 dest->AddElement(c->CloneElementRecurse(level));
252}
253
254
255//==============================================================================
256
257////////////////////////////////////////////////////////////////////////////////
258/// Set name of an element.
259
260void REveElement::SetName(const std::string& name)
261{
262 fName = name;
264}
265
266////////////////////////////////////////////////////////////////////////////////
267/// Set title of an element.
268
269void REveElement::SetTitle(const std::string& title)
270{
271 fTitle = title;
273}
274
275////////////////////////////////////////////////////////////////////////////////
276/// Set name and title of an element.
277/// Here we attempt to cast the assigned object into TNamed and call
278/// SetNameTitle() there.
279/// If you override this call NameTitleChanged() from there.
280
281void REveElement::SetNameTitle(const std::string& name, const std::string& title)
282{
283 fName = name;
284 fTitle = title;
286}
287
288////////////////////////////////////////////////////////////////////////////////
289/// Virtual function called when a name or title of the element has
290/// been changed.
291/// If you override this, call also the version of your direct base-class.
292
294{
295 // Should send out some message. Need a new stamp type?
296}
297
298////////////////////////////////////////////////////////////////////////////////
299/// Set visualization-parameter model element.
300/// Calling of this function from outside of EVE should in principle
301/// be avoided as it can lead to dis-synchronization of viz-tag and
302/// viz-model.
303
305{
306 fVizModel = model;
307}
308
309////////////////////////////////////////////////////////////////////////////////
310/// Find model element in VizDB that corresponds to previously
311/// assigned fVizTag and set fVizModel accordingly.
312/// If the tag is not found in VizDB, the old model-element is kept
313/// and false is returned.
314
316{
317 REveElement* model = REX::gEve->FindVizDBEntry(fVizTag);
318 if (model)
319 {
320 SetVizModel(model);
321 return kTRUE;
322 }
323 else
324 {
325 return kFALSE;
326 }
327}
328
329////////////////////////////////////////////////////////////////////////////////
330/// Set the VizTag, find model-element from the VizDB and copy
331/// visualization-parameters from it. If the model is not found and
332/// fallback_tag is non-null, search for it is attempted as well.
333/// For example: ApplyVizTag("TPC Clusters", "Clusters");
334///
335/// If the model-element can not be found a warning is printed and
336/// false is returned.
337
338Bool_t REveElement::ApplyVizTag(const TString& tag, const TString& fallback_tag)
339{
340 REveElement* model;
341
342 if ((model = REX::gEve->FindVizDBEntry(tag)) != nullptr)
343 {
344 SetVizTag(tag);
345 }
346 else if ( ! fallback_tag.IsNull() && (model = REX::gEve->FindVizDBEntry(fallback_tag)) != nullptr)
347 {
348 SetVizTag(fallback_tag);
349 }
350
351 if (model)
352 {
353 SetVizModel(model);
355 return true;
356 }
357 Warning("REveElement::ApplyVizTag", "entry for tag '%s' not found in VizDB.", tag.Data());
358 return false;
359}
360
361////////////////////////////////////////////////////////////////////////////////
362/// Propagate visualization parameters to dependent elements.
363///
364/// MainColor is propagated independently in SetMainColor().
365/// In this case, as fMainColor is a pointer to Color_t, it should
366/// be set in TProperClass::CopyVizParams().
367///
368/// Render state is not propagated. Maybe it should be, at least optionally.
369
371{
372 REveProjectable* pable = dynamic_cast<REveProjectable*>(this);
373 if (pable && pable->HasProjecteds())
374 {
375 pable->PropagateVizParams();
376 }
377}
378
379////////////////////////////////////////////////////////////////////////////////
380/// Propagate visualization parameters from element el (defaulting
381/// to this) to all children.
382///
383/// The primary use of this is for model-elements from
384/// visualization-parameter database.
385
387{
388 if (!el) el = this;
389
390 for (auto &c : fChildren)
391 {
392 c->CopyVizParams(el);
393 }
394}
395
396////////////////////////////////////////////////////////////////////////////////
397/// Copy visualization parameters from element el.
398/// This method needs to be overriden by any class that introduces
399/// new parameters.
400
410
411////////////////////////////////////////////////////////////////////////////////
412/// Copy visualization parameters from the model-element fVizModel.
413/// A warning is printed if the model-element fVizModel is not set.
414
416{
417 if (fVizModel)
418 {
420 }
421 else
422 {
423 Warning("REveElement::CopyVizParamsFromDB", "VizModel has not been set.");
424 }
425}
426
427////////////////////////////////////////////////////////////////////////////////
428/// Save visualization parameters for this element with given tag.
429///
430/// This function creates the instantiation code, calls virtual
431/// WriteVizParams() and, at the end, writes out the code for
432/// registration of the model into the VizDB.
433
434void REveElement::SaveVizParams(std::ostream& out, const TString& tag, const TString& var)
435{
436 static const REveException eh("REveElement::GetObject ");
437
438 TString t = " ";
439 TString cls(IsA()->GetName());
440
441 out << "\n";
442
443 TString intro = " TAG='" + tag + "', CLASS='" + cls + "'";
444 out << " //" << intro << "\n";
445 out << " //" << TString('-', intro.Length()) << "\n";
446 out << t << cls << "* " << var <<" = new " << cls << ";\n";
447
448 WriteVizParams(out, var);
449
450 out << t << "REX::gEve->InsertVizDBEntry(\"" << tag << "\", "<< var <<");\n";
451}
452
453////////////////////////////////////////////////////////////////////////////////
454/// Write-out visual parameters for this object.
455/// This is a virtual function and all sub-classes are required to
456/// first call the base-element version.
457/// The name of the element pointer is 'x%03d', due to historical CINT limitations.
458/// Three spaces should be used for indentation, same as in
459/// SavePrimitive() methods.
460
461void REveElement::WriteVizParams(std::ostream& out, const TString& var)
462{
463 TString t = " " + var + "->";
464
465 out << t << "SetElementName(\"" << fName << "\");\n";
466 out << t << "SetElementTitle(\"" << fTitle << "\");\n";
467 out << t << "SetEditMainColor(" << fCanEditMainColor << ");\n";
468 out << t << "SetEditMainTransparency(" << fCanEditMainTransparency << ");\n";
469 out << t << "SetMainTransparency(" << fMainTransparency << ");\n";
470}
471
472////////////////////////////////////////////////////////////////////////////////
473/// Set visual parameters for this object for given tag.
474
475void REveElement::VizDB_Apply(const std::string& tag)
476{
477 if (ApplyVizTag(tag))
478 {
480 }
481}
482
483////////////////////////////////////////////////////////////////////////////////
484/// Reset visual parameters for this object from VizDB.
485/// The model object must be already set.
486
495
496////////////////////////////////////////////////////////////////////////////////
497/// Copy visual parameters from this element to viz-db model.
498/// If update is set, all clients of the model will be updated to
499/// the new value.
500/// A warning is printed if the model-element fVizModel is not set.
501
503{
504 if (fVizModel)
505 {
506 fVizModel->CopyVizParams(this);
507 if (update)
508 {
509 // XXX Back references from vizdb templates have been removed in Eve7.
510 // XXX We could traverse all scenes and elementes and reset those that
511 // XXX have a matching fVizModel. Or something.
512 Error("VizDB_UpdateModel", "update from vizdb -> elements not implemented.");
513 // fVizModel->PropagateVizParamsToElements(fVizModel);
514 }
515 }
516 else
517 {
518 Warning("VizDB_UpdateModel", "VizModel has not been set.");
519 }
520}
521
522////////////////////////////////////////////////////////////////////////////////
523/// Create a replica of element and insert it into VizDB with given tag.
524/// If replace is true an existing element with the same tag will be replaced.
525/// If update is true, existing client of tag will be updated.
526
527void REveElement::VizDB_Insert(const std::string& tag, Bool_t replace, Bool_t update)
528{
529 static const REveException eh("REveElement::GetObject ");
530
531 TClass* cls = IsA();
532 REveElement* el = reinterpret_cast<REveElement*>(cls->New());
533 if (!el) {
534 Error("VizDB_Insert", "Creation of replica failed.");
535 return;
536 }
537 el->CopyVizParams(this);
538 REX::gEve->InsertVizDBEntry(tag, el, replace, update);
539}
540
541////////////////////////////////////////////////////////////////////////////////
542/// Add el into the list aunts.
543///
544/// Adding aunt is subordinate to adding a niece.
545/// This is an internal function.
546
548{
549 assert(au != nullptr);
550
551 fAunts.emplace_back(au);
552}
553
554////////////////////////////////////////////////////////////////////////////////
555/// Remove el from the list of aunts.
556/// Removing aunt is subordinate to removing a niece.
557/// This is an internal function.
558
560{
561 assert(au != nullptr);
562
563 fAunts.remove(au);
564}
565
566/******************************************************************************/
567
568////////////////////////////////////////////////////////////////////////////////
569/// Check external references to this and eventually auto-destruct
570/// the render-element.
571
572void REveElement::CheckReferenceCount(const std::string& from)
573{
574 if (fDestructing != kNone)
575 return;
576
577 if (fMother == nullptr && fDestroyOnZeroRefCnt && fDenyDestroy <= 0)
578 {
579 if (gDebug > 0)
580 Info("REveElement::CheckReferenceCount", "(called from %s) auto-destructing '%s' on zero reference count.",
581 from.c_str(), GetCName());
582
584 delete this;
585 }
586}
587
588////////////////////////////////////////////////////////////////////////////////
589/// Return class for this element
590/// Return REveElement class in case dicitonary is not exisiting
591////////////////////////////////////////////////////////////////////////////////
592
594{
595 TClass* res = TClass::GetClass(typeid(*this), kTRUE, kTRUE);
596 if (!res) {
597 R__LOG_WARNING(REveLog()) << "REveElement::IsA() no dictionary found for " << typeid(*this).name();
598 res = TClass::GetClass("ROOT::Experimental::REveElement");
599 }
600 return res;
601}
602
603////////////////////////////////////////////////////////////////////////////////
604/// Export render-element to Cling with variable name var_name.
605
606void REveElement::ExportToInterpreter(const char *var_name)
607{
608 const char* cname = IsA()->GetName();
609 gROOT->ProcessLine(TString::Format("%s* %s = (%s*)0x%zx;", cname, var_name, cname, (size_t)this));
610}
611
612////////////////////////////////////////////////////////////////////////////////
613/// Set render state of this element, i.e. if it will be published
614/// on next scene update pass.
615/// Returns true if the state has changed.
616
618{
619 if (SingleRnrState())
620 {
621 return SetRnrState(rnr);
622 }
623
624 if (rnr != fRnrSelf)
625 {
626 fRnrSelf = rnr;
629
630 return kTRUE;
631 }
632 return kFALSE;
633}
634
635////////////////////////////////////////////////////////////////////////////////
636/// Set render state of this element's children, i.e. if they will
637/// be published on next scene update pass.
638/// Returns true if the state has changed.
639
641{
642 if (SingleRnrState())
643 {
644 return SetRnrState(rnr);
645 }
646
647 if (rnr != fRnrChildren)
648 {
649 fRnrChildren = rnr;
652 return kTRUE;
653 }
654 return kFALSE;
655}
656
657////////////////////////////////////////////////////////////////////////////////
658/// Set state for rendering of this element and its children.
659/// Returns true if the state has changed.
660
662{
663 if (SingleRnrState())
664 {
665 return SetRnrState(rnr_self);
666 }
667
668 if (fRnrSelf != rnr_self || fRnrChildren != rnr_children)
669 {
670 fRnrSelf = rnr_self;
671 fRnrChildren = rnr_children;
674 return kTRUE;
675 }
676 return kFALSE;
677}
678
679////////////////////////////////////////////////////////////////////////////////
680/// Set render state of this element and of its children to the same
681/// value.
682/// Returns true if the state has changed.
683
685{
686 if (fRnrSelf != rnr || fRnrChildren != rnr)
687 {
688 fRnrSelf = fRnrChildren = rnr;
691 return kTRUE;
692 }
693 return kFALSE;
694}
695
696////////////////////////////////////////////////////////////////////////////////
697/// Propagate render state to the projected replicas of this element.
698/// Maybe this should be optional on REX::gEve/element level.
699
701{
702 REveProjectable *pable = dynamic_cast<REveProjectable*>(this);
703 if (pable && pable->HasProjecteds())
704 {
706 }
707}
708
709////////////////////////////////////////////////////////////////////////////////
710/// Set up element to use built-in main color and set flags allowing editing
711/// of main color and transparency.
712
713void REveElement::SetupDefaultColorAndTransparency(Color_t col, Bool_t can_edit_color, Bool_t can_edit_transparency)
714{
716 fDefaultColor = col;
717 fCanEditMainColor = can_edit_color;
718 fCanEditMainTransparency = can_edit_transparency;
719}
720
721////////////////////////////////////////////////////////////////////////////////
722/// Set main color of the element.
723
725{
726 Color_t old_color = GetMainColor();
727
728 if (fMainColorPtr)
729 {
730 *fMainColorPtr = color;
732 }
733
734 PropagateMainColorToProjecteds(color, old_color);
735}
736
737////////////////////////////////////////////////////////////////////////////////
738/// Convert pixel to Color_t and call SetMainColor().
739
744
745////////////////////////////////////////////////////////////////////////////////
746/// Convert RGB values to Color_t and call SetMainColor.
747
752
753////////////////////////////////////////////////////////////////////////////////
754/// Convert RGB values to Color_t and call SetMainColor.
755
760
761////////////////////////////////////////////////////////////////////////////////
762/// Propagate color to projected elements.
763
765{
766 REveProjectable* pable = dynamic_cast<REveProjectable*>(this);
767 if (pable && pable->HasProjecteds())
768 {
769 pable->PropagateMainColor(color, old_color);
770 }
771}
772
773////////////////////////////////////////////////////////////////////////////////
774/// Set main-transparency.
775/// Transparency is clamped to [0, 100].
776
778{
779 Char_t old_t = GetMainTransparency();
780
781 if (t > 100) t = 100;
784
786}
787
788////////////////////////////////////////////////////////////////////////////////
789/// Set main-transparency via float alpha variable.
790/// Value of alpha is clamped t0 [0, 1].
791
793{
794 if (alpha < 0) alpha = 0;
795 if (alpha > 1) alpha = 1;
796 SetMainTransparency((Char_t) (100.0f*(1.0f - alpha)));
797}
798
799////////////////////////////////////////////////////////////////////////////////
800/// Propagate transparency to projected elements.
801
803{
804 REveProjectable* pable = dynamic_cast<REveProjectable*>(this);
805 if (pable && pable->HasProjecteds())
806 {
807 pable->PropagateMainTransparency(t, old_t);
808 }
809}
810
811////////////////////////////////////////////////////////////////////////////////
812/// Return pointer to main transformation. If 'create' flag is set (default)
813/// it is created if not yet existing.
814
816{
817 if (!fMainTrans && create)
819
820 return fMainTrans.get();
821}
822
823////////////////////////////////////////////////////////////////////////////////
824/// Return reference to main transformation. It is created if not yet
825/// existing.
826
828{
829 if (!fMainTrans)
831
832 return *fMainTrans.get();
833}
834
835////////////////////////////////////////////////////////////////////////////////
836/// Initialize the main transformation to identity matrix.
837/// If can_edit is true (default), the user will be able to edit the
838/// transformation parameters via GUI.
839
841{
842 if (fMainTrans)
843 fMainTrans->UnitTrans();
844 else
845 fMainTrans = std::make_unique<REveTrans>();
846 fCanEditMainTrans = can_edit;
847}
848
849////////////////////////////////////////////////////////////////////////////////
850/// Destroy the main transformation matrix, it will always be taken
851/// as identity. Editing of transformation parameters is disabled.
852
854{
855 fMainTrans.reset(nullptr);
857}
858
859////////////////////////////////////////////////////////////////////////////////
860/// Set transformation matrix from column-major array.
861
863{
864 RefMainTrans().SetFrom(carr);
865}
866
867////////////////////////////////////////////////////////////////////////////////
868/// Set transformation matrix from TGeo's matrix.
869
871{
872 RefMainTrans().SetFrom(mat);
873}
874
875////////////////////////////////////////////////////////////////////////////////
876/// Check if el can be added to this element.
877///
878/// Here we make sure the new child is not equal to this and, if fChildClass
879/// is set, that it is inherited from it.
880
882{
883 if (el == this)
884 return kFALSE;
885 if (fChildClass && ! el->IsA()->InheritsFrom(fChildClass))
886 return kFALSE;
887 return kTRUE;
888}
889
890////////////////////////////////////////////////////////////////////////////////
891/// Add el to the list of children.
892
894{
895 static const REveException eh("REveElement::AddElement ");
896
897 if (!el) throw eh + "called with nullptr argument.";
898 if ( ! AcceptElement(el)) throw eh + Form("parent '%s' rejects '%s'.", GetCName(), el->GetCName());
899 if (el->fElementId) throw eh + "element already has an id.";
900 // if (el->fScene) throw eh + "element already has a Scene.";
901 if (el->fMother) throw eh + "element already has a Mother.";
902
903 // XXX Implement reparent --> MoveElement() ????
904 // Actually, better to do new = old.Clone(), RemoveElement(old), AddElement(new);
905 // Or do magick with Inc/DecDenyDestroy().
906 // PITA with existing children !!!! Need to re-scene them.
907
909 if (fScene && ! el->fScene) el->assign_scene_recursively(fScene);
910
911 el->fMother = this;
912
913 fChildren.emplace_back(el);
914
915 // XXXX This should be element added. Also, should be different for
916 // "full (re)construction". Scenes should manage that and have
917 // state like: none - constructing - clearing - nominal - updating.
918 // I recon this means an element should have a ptr to its scene.
919 //
920 // ElementChanged();
921}
922
923////////////////////////////////////////////////////////////////////////////////
924/// Remove el from the list of children.
925
927{
928 static const REveException eh("REveElement::RemoveElement ");
929
930 if (!el) throw eh + "called with nullptr argument.";
931 if (el->fMother != this) throw eh + "this element is not mother of el.";
932
934
936 el->fMother = nullptr;
937 el->fScene = nullptr;
938
940
941 fChildren.remove(el);
942
943 // XXXX This should be ElementRemoved(). Also, think about recursion, deletion etc.
944 // Also, this seems to be done above, in the call to fScene.
945 //
946 // ElementChanged();
947}
948
949////////////////////////////////////////////////////////////////////////////////
950/// Perform additional local removal of el.
951/// Called from RemoveElement() which does whole untangling.
952/// Put into special function as framework-related handling of
953/// element removal should really be common to all classes and
954/// clearing of local structures happens in between removal
955/// of list-tree-items and final removal.
956/// If you override this, you should also override
957/// RemoveElementsLocal().
958
962
963////////////////////////////////////////////////////////////////////////////////
964/// Remove all elements. This assumes removing of all elements can
965/// be done more efficiently then looping over them and removing one
966/// by one. This protected function performs the removal on the
967/// level of REveElement.
968
970{
972
973 for (auto &c : fChildren)
974 {
975 c->fScene->SceneElementRemoved(c->fElementId);
976 c->fMother = nullptr;
977 c->fScene = nullptr;
978
979 c->CheckReferenceCount();
980 }
981
982 fChildren.clear();
983}
984
985////////////////////////////////////////////////////////////////////////////////
986/// Remove all elements. This assumes removing of all elements can
987/// be done more efficiently then looping over them and removing
988/// them one by one.
989
991{
992 if (HasChildren())
993 {
995 // ElementChanged();
996 }
997}
998
999////////////////////////////////////////////////////////////////////////////////
1000/// Perform additional local removal of all elements.
1001/// See comment to RemoveElementLocal(REveElement*).
1002
1006
1007////////////////////////////////////////////////////////////////////////////////
1008/// If this is a projectable, loop over all projected replicas and
1009/// add the projected image of child 'el' there. This is supposed to
1010/// be called after you add a child to a projectable after it has
1011/// already been projected.
1012/// You might also want to call RecheckImpliedSelections() on this
1013/// element or 'el'.
1014///
1015/// If 'same_depth' flag is true, the same depth as for parent object
1016/// is used in every projection. Otherwise current depth of each
1017/// relevant projection-manager is used.
1018
1020{
1021 REveProjectable* pable = dynamic_cast<REveProjectable*>(this);
1022 if (pable && HasChild(el))
1023 {
1024 for (auto &pp: pable->RefProjecteds())
1025 {
1026 auto pmgr = pp->GetManager();
1027 Float_t cd = pmgr->GetCurrentDepth();
1028 if (same_depth) pmgr->SetCurrentDepth(pp->GetDepth());
1029
1030 pmgr->SubImportElements(el, pp->GetProjectedAsElement());
1031
1032 if (same_depth) pmgr->SetCurrentDepth(cd);
1033 }
1034 }
1035}
1036
1037////////////////////////////////////////////////////////////////////////////////
1038/// If this is a projectable, loop over all projected replicas and
1039/// add the projected image of all children there. This is supposed
1040/// to be called after you destroy all children and then add new
1041/// ones after this element has already been projected.
1042/// You might also want to call RecheckImpliedSelections() on this
1043/// element.
1044///
1045/// If 'same_depth' flag is true, the same depth as for the
1046/// projected element is used in every projection. Otherwise current
1047/// depth of each relevant projection-manager is used.
1048
1050{
1051 REveProjectable* pable = dynamic_cast<REveProjectable*>(this);
1052 if (pable)
1053 {
1054 for (auto &pp: pable->RefProjecteds())
1055 {
1056 REveProjectionManager *pmgr = pp->GetManager();
1057 Float_t cd = pmgr->GetCurrentDepth();
1058 if (same_depth) pmgr->SetCurrentDepth(pp->GetDepth());
1059
1060 pmgr->SubImportChildren(this, pp->GetProjectedAsElement());
1061
1062 if (same_depth) pmgr->SetCurrentDepth(cd);
1063 }
1064 }
1065}
1066
1067////////////////////////////////////////////////////////////////////////////////
1068/// Check if element el is a child of this element.
1069
1071{
1072 return (std::find(fChildren.begin(), fChildren.end(), el) != fChildren.end());
1073}
1074
1075////////////////////////////////////////////////////////////////////////////////
1076/// Find the first child with given name. If cls is specified (non
1077/// 0), it is also checked.
1078///
1079/// Returns nullptr if not found.
1080
1082{
1083 for (auto &c: fChildren)
1084 {
1085 if (name.CompareTo(c->GetCName()) == 0)
1086 {
1087 if (!cls || c->IsA()->InheritsFrom(cls))
1088 return c;
1089 }
1090 }
1091 return nullptr;
1092}
1093
1094////////////////////////////////////////////////////////////////////////////////
1095/// Find the first child whose name matches regexp. If cls is
1096/// specified (non 0), it is also checked.
1097///
1098/// Returns nullptr if not found.
1099
1101{
1102 for (auto &c: fChildren)
1103 {
1104 if (regexp.MatchB(c->GetName()))
1105 {
1106 if (!cls || c->IsA()->InheritsFrom(cls))
1107 return c;
1108 }
1109 }
1110 return nullptr;
1111}
1112
1113////////////////////////////////////////////////////////////////////////////////
1114/// Find all children with given name and append them to matches
1115/// list. If class is specified (non 0), it is also checked.
1116///
1117/// Returns number of elements added to the list.
1118
1120 const TString& name, const TClass* cls)
1121{
1122 Int_t count = 0;
1123 for (auto &c: fChildren)
1124 {
1125 if (name.CompareTo(c->GetCName()) == 0)
1126 {
1127 if (!cls || c->IsA()->InheritsFrom(cls))
1128 {
1129 matches.push_back(c);
1130 ++count;
1131 }
1132 }
1133 }
1134 return count;
1135}
1136
1137////////////////////////////////////////////////////////////////////////////////
1138/// Find all children whose name matches regexp and append them to
1139/// matches list.
1140///
1141/// Returns number of elements added to the list.
1142
1144 TPRegexp &regexp, const TClass *cls)
1145{
1146 Int_t count = 0;
1147 for (auto &c : fChildren)
1148 {
1149 if (regexp.MatchB(c->GetCName()))
1150 {
1151 if (!cls || c->IsA()->InheritsFrom(cls))
1152 {
1153 matches.push_back(c);
1154 ++count;
1155 }
1156 }
1157 }
1158 return count;
1159}
1160
1161////////////////////////////////////////////////////////////////////////////////
1162/// Returns the first child element or 0 if the list is empty.
1163
1165{
1166 return HasChildren() ? fChildren.front() : nullptr;
1167}
1168
1169////////////////////////////////////////////////////////////////////////////////
1170/// Returns the last child element or 0 if the list is empty.
1171
1173{
1174 return HasChildren() ? fChildren.back() : nullptr;
1175}
1176
1177////////////////////////////////////////////////////////////////////////////////
1178/// Enable rendering of children and their list contents.
1179/// Arguments control how to set self/child rendering.
1180
1182{
1183 for (auto &c: fChildren)
1184 c->SetRnrSelfChildren(rnr_self, rnr_children);
1185}
1186
1187////////////////////////////////////////////////////////////////////////////////
1188/// Disable rendering of children and their list contents.
1189/// Arguments control how to set self/child rendering.
1190///
1191/// Same as above function, but default arguments are different. This
1192/// is convenient for calls via context menu.
1193
1195{
1196 for (auto &c: fChildren)
1197 c->SetRnrSelfChildren(rnr_self, rnr_children);
1198}
1199
1200////////////////////////////////////////////////////////////////////////////////
1201/// Protected member function called from REveElement::Annihilate().
1202
1204{
1205 // projected were already destroyed in REveElement::Anihilate(), now only clear its list
1206 REveProjectable* pable = dynamic_cast<REveProjectable*>(this);
1207 if (pable && pable->HasProjecteds())
1208 pable->ClearProjectedList();
1209
1210 // same as REveElement::RemoveElementsInternal(), except parents are ignored
1212 for (auto &c : fChildren)
1213 c->AnnihilateRecursively();
1214
1215 fChildren.clear();
1216
1219
1220 delete this;
1221}
1222
1223////////////////////////////////////////////////////////////////////////////////
1224/// Optimized destruction without check of reference-count.
1225/// Parents are not notified about child destruction.
1226/// The method should only be used when an element does not have
1227/// more than one parent -- otherwise an exception is thrown.
1228
1230{
1231 static const REveException eh("REveElement::Annihilate ");
1232
1234
1235 // recursive annihilation of projecteds
1236 REveProjectable* pable = dynamic_cast<REveProjectable*>(this);
1237 if (pable && pable->HasProjecteds())
1238 {
1239 pable->AnnihilateProjecteds();
1240 }
1241
1242 // detach from the parent
1243 if (fMother)
1244 {
1245 fMother->RemoveElement(this);
1246 }
1247
1248 // XXXX wont the above already start off the destruction cascade ?????
1249
1251
1252 // XXXX ????? Annihilate flag ???? Is it different than regular remove ????
1253}
1254
1255////////////////////////////////////////////////////////////////////////////////
1256/// Annihilate elements.
1257
1259{
1260 while (!fChildren.empty())
1261 {
1262 auto c = fChildren.front();
1263 c->Annihilate();
1264 }
1265}
1266
1267////////////////////////////////////////////////////////////////////////////////
1268/// Destroy this element. Throws an exception if deny-destroy is in force.
1269/// This method should be called instead of a destructor.
1270/// Note that an exception will be thrown if the element has been
1271/// protected against destruction with IncDenyDestroy().
1272
1274{
1275 static const REveException eh("REveElement::Destroy ");
1276
1277 if (fDenyDestroy > 0)
1278 throw eh + TString::Format("element '%s' (%s*) %p is protected against destruction.",
1279 GetCName(), IsA()->GetName(), this);
1280
1282 delete this;
1283}
1284
1285////////////////////////////////////////////////////////////////////////////////
1286/// Destroy this element. Prints a warning if deny-destroy is in force.
1287
1289{
1290 try
1291 {
1292 Destroy();
1293 }
1294 catch (REveException &exc)
1295 {
1296 ::Warning("REveElement::DestroyOrWarn", "Error while destroy element %p : %s", this, exc.what());
1297 }
1298}
1299
1300////////////////////////////////////////////////////////////////////////////////
1301/// Destroy all children of this element.
1302
1304{
1305 while (HasChildren())
1306 {
1307 auto c = fChildren.front();
1308 if (c->fDenyDestroy <= 0)
1309 {
1310 try {
1311 c->Destroy();
1312 }
1313 catch (REveException &exc) {
1314 ::Warning("REveElement::DestroyElements", "element destruction failed: '%s'.", exc.what());
1316 }
1317 }
1318 else
1319 {
1320 if (gDebug > 0)
1321 ::Info("REveElement::DestroyElements", "element '%s' is protected against destruction, removing locally.", c->GetCName());
1323 }
1324 }
1325}
1326
1327////////////////////////////////////////////////////////////////////////////////
1328/// Returns state of flag determining if the element will be
1329/// destroyed when reference count reaches zero.
1330/// This is true by default.
1331
1336
1337////////////////////////////////////////////////////////////////////////////////
1338/// Sets the state of flag determining if the element will be
1339/// destroyed when reference count reaches zero.
1340/// This is true by default.
1341
1346
1347////////////////////////////////////////////////////////////////////////////////
1348/// Returns the number of times deny-destroy has been requested on
1349/// the element.
1350
1352{
1353 return fDenyDestroy;
1354}
1355
1356////////////////////////////////////////////////////////////////////////////////
1357/// Increases the deny-destroy count of the element.
1358/// Call this if you store an external pointer to the element.
1359
1364
1365////////////////////////////////////////////////////////////////////////////////
1366/// Decreases the deny-destroy count of the element.
1367/// Call this after releasing an external pointer to the element.
1368
1370{
1371 if (--fDenyDestroy <= 0)
1372 CheckReferenceCount("REveElement::DecDenyDestroy ");
1373}
1374
1375////////////////////////////////////////////////////////////////////////////////
1376/// Set pickable state on the element and all its children.
1377
1379{
1380 fPickable = p;
1381 for (auto &c: fChildren)
1382 c->SetPickableRecursively(p);
1383}
1384
1385////////////////////////////////////////////////////////////////////////////////
1386/// Returns the master element - that is:
1387/// - master of projectable, if this is a projected;
1388/// - master of compound, if fCompound is set;
1389/// - master of mother, if kSCBTakeMotherAsMaster bit is set;
1390/// If non of the above is true, *this* is returned.
1391
1393{
1395
1396 REveProjected* proj = dynamic_cast<REveProjected*>(this);
1397 if (proj)
1398 {
1399 return dynamic_cast<REveElement*>(proj->GetProjectable())->GetSelectionMaster();
1400 }
1401 if (fCompound)
1402 {
1403 return fCompound->GetSelectionMaster();
1404 }
1406 {
1407 return fMother->GetSelectionMaster();
1408 }
1409 return this;
1410}
1411
1412////////////////////////////////////////////////////////////////////////////////
1413/// Populate set impSelSet with derived / dependant elements.
1414///
1415/// If this is a REveProjectable, the projected replicas are added
1416/// to the set. Thus it does not have to be reimplemented for each
1417/// sub-class of REveProjected.
1418///
1419/// Note that this also takes care of projections of REveCompound
1420/// class, which is also a projectable.
1421
1422void REveElement::FillImpliedSelectedSet(Set_t &impSelSet, const std::set<int>&)
1423{
1424 REveProjectable* p = dynamic_cast<REveProjectable*>(this);
1425 if (p)
1426 p->AddProjectedsToSet(impSelSet);
1427}
1428
1429////////////////////////////////////////////////////////////////////////////////
1430/// Call this if it is possible that implied-selection or highlight
1431/// has changed for this element or for implied-selection this
1432/// element is member of and you want to maintain consistent
1433/// selection state.
1434/// This can happen if you add elements into compounds in response
1435/// to user-interaction.
1436
1438{
1439 // XXXX MT 2019-01 --- RecheckImpliedSelections
1440 //
1441 // With removal of selection state from this class there might be some
1442 // corner cases requiring checking of implied-selected state in
1443 // selection/highlight objects.
1444 //
1445 // This could be done as part of begin / end changes on the EveManager level.
1446 //
1447 // See also those functions in TEveSelection.
1448
1449 // if (fSelected || fImpliedSelected)
1450 // REX::gEve->GetSelection()->RecheckImpliedSetForElement(this);
1451
1452 // if (fHighlighted || fImpliedHighlighted)
1453 // REX::gEve->GetHighlight()->RecheckImpliedSetForElement(this);
1454}
1455
1456////////////////////////////////////////////////////////////////////////////////
1457/// Add (bitwise or) given stamps to fChangeBits.
1458/// Register this element to REX::gEve as stamped.
1459/// This method is virtual so that sub-classes can add additional
1460/// actions. The base-class method should still be called (or replicated).
1461
1463{
1464 if (fDestructing == kNone && fScene && fScene->IsAcceptingChanges())
1465 {
1466 if (gDebug > 0)
1467 ::Info(Form("%s::AddStamp", GetCName()), "%d + (%d) -> %d", fChangeBits, bits, fChangeBits | bits);
1468
1469 if (fChangeBits == 0)
1470 {
1471 fScene->SceneElementChanged(this);
1472 }
1473
1474 fChangeBits |= bits;
1475 }
1476}
1477
1478////////////////////////////////////////////////////////////////////////////////
1479/// Write transformation Matrix to render data
1480////////////////////////////////////////////////////////////////////////////////
1481
1483{
1484 if (fMainTrans.get())
1485 {
1486 fRenderData->SetMatrix(fMainTrans->Array());
1487 }
1488}
1489
1490////////////////////////////////////////////////////////////////////////////////
1491/// Convert Bool_t to string - kTRUE or kFALSE.
1492/// Needed in WriteVizParams().
1493
1494const std::string& REveElement::ToString(Bool_t b)
1495{
1496 static const std::string true_str ("kTRUE");
1497 static const std::string false_str("kFALSE");
1498
1499 return b ? true_str : false_str;
1500}
1501
1502////////////////////////////////////////////////////////////////////////////////
1503/// Write core json. If rnr_offset is negative, render data shall not be
1504/// written.
1505/// Returns number of bytes written into binary render data.
1506
1507Int_t REveElement::WriteCoreJson(nlohmann::json &j, Int_t rnr_offset)
1508{
1509 j["_typename"] = IsA()->GetName();
1510 j["fName"] = fName;
1511 j["fTitle"] = fTitle;
1512 j["fElementId"] = GetElementId();
1513 j["fMotherId"] = get_mother_id();
1514 j["fSceneId"] = get_scene_id();
1515 j["fMasterId"] = GetSelectionMaster()->GetElementId();
1516
1517 j["fRnrSelf"] = GetRnrSelf();
1518 j["fRnrChildren"] = GetRnrChildren();
1519
1520 j["fMainColor"] = GetMainColor();
1521 j["fMainTransparency"] = GetMainTransparency();
1522 j["fPickable"] = fPickable;
1523
1524 Int_t ret = 0;
1525
1526 if (rnr_offset >= 0) {
1528
1529 if (fRenderData) {
1530 nlohmann::json rd = {};
1531
1532 rd["rnr_offset"] = rnr_offset;
1533 rd["rnr_func"] = fRenderData->GetRnrFunc();
1534 rd["vert_size"] = fRenderData->SizeV();
1535 rd["norm_size"] = fRenderData->SizeN();
1536 rd["index_size"] = fRenderData->SizeI();
1537 rd["trans_size"] = fRenderData->SizeT();
1538
1539 j["render_data"] = rd;
1540
1541 ret = fRenderData->GetBinarySize();
1542 }
1543 }
1544
1545 return ret;
1546}
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:41
ROOT::R::TRInterface & r
Definition Object.C:4
#define R__LOG_WARNING(...)
Definition RLogger.hxx:357
#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)
char * ret
Definition Rotated.cxx:221
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char).
Definition RtypesCore.h:52
char Char_t
Character 1 byte (char).
Definition RtypesCore.h:51
bool Bool_t
Boolean (0=false, 1=true) (bool).
Definition RtypesCore.h:77
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
short Color_t
Color number (short).
Definition RtypesCore.h:99
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
Definition TError.cxx:241
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:252
char name[80]
Definition TGX11.cxx:148
Int_t gDebug
Definition TROOT.cxx:777
#define gROOT
Definition TROOT.h:417
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2496
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.
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.
virtual void ExportToInterpreter(const char *var_name)
Export render-element to Cling with variable name var_name.
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 Return REveElement class in case dicitonary is not exisiting.
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.
Int_t fDenyDestroy
! Deny-destroy count.
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 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.
static std::string stlMirErrorString
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.
std::unique_ptr< REveRenderData > fRenderData
! Vertex / normal / triangle index information for rendering.
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)
static void SetMirContext(REveElement *el)
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.
REveElement * fVizModel
! Element used as model from VizDB.
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()
Called before the element is deleted, thus offering the last chance to detach from acquired resources...
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
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.
static void AppendMirErrorString(std::string_view err_str)
virtual void FillImpliedSelectedSet(Set_t &impSelSet, const std::set< int > &)
Populate set impSelSet with derived / dependant elements.
virtual ~REveElement()
Destructor.
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
virtual void NameTitleChanged()
Virtual function called when a name or title of the element has been changed.
std::unique_ptr< REveTrans > fMainTrans
Bool_t HasChild(REveElement *el)
Check if element el is a child of this element.
static void SetMirError(int error, std::string_view err_str="")
REveElement(const std::string &name="", const std::string &title="")
Default constructor.
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.
static REveElement * stlMirAlpha
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:42
const char * what() const noexcept override
Definition REveTypes.hxx:52
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.
void SceneElementRemoved(ElementId_t id)
void SetFrom(Double_t *carr)
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:84
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
Definition TClass.cxx:5048
Bool_t InheritsFrom(const char *cl) const override
Return kTRUE if this class inherits from a class with name "classname".
Definition TClass.cxx:4932
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:2994
static Int_t GetColor(const char *hexcolor)
Geometrical transformation package.
Definition TGeoMatrix.h:39
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
Bool_t MatchB(const TString &s, const TString &mods="", Int_t start=0, Int_t nMaxMatch=10)
Definition TPRegexp.h:78
Basic string class.
Definition TString.h:138
Ssiz_t Length() const
Definition TString.h:425
const char * Data() const
Definition TString.h:384
Bool_t IsNull() const
Definition TString.h:422
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:2385
Namespace for ROOT features in testing.
Definition TROOT.h:100
ROOT::RLogChannel & REveLog()
Log channel for Eve diagnostics.
Definition REveTypes.cxx:52
externREveManager * gEve
unsigned int ElementId_t
Definition REveTypes.hxx:28