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),
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
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
162
164{
165 return fScene ? fScene->GetElementId() : 0;
166}
167
169{
170 assert(fElementId == 0);
171
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?
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 {
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{
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 {
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
867
868////////////////////////////////////////////////////////////////////////////////
869/// Set transformation matrix from TGeo's matrix.
870
872{
873 RefMainTrans().SetFrom(mat);
875}
876
877////////////////////////////////////////////////////////////////////////////////
878/// Check if el can be added to this element.
879///
880/// Here we make sure the new child is not equal to this and, if fChildClass
881/// is set, that it is inherited from it.
882
884{
885 if (el == this)
886 return kFALSE;
887 if (fChildClass && ! el->IsA()->InheritsFrom(fChildClass))
888 return kFALSE;
889 return kTRUE;
890}
891
892////////////////////////////////////////////////////////////////////////////////
893/// Add el to the list of children.
894
896{
897 static const REveException eh("REveElement::AddElement ");
898
899 if (!el) throw eh + "called with nullptr argument.";
900 if ( ! AcceptElement(el)) throw eh + Form("parent '%s' rejects '%s'.", GetCName(), el->GetCName());
901 if (el->fElementId) throw eh + "element already has an id.";
902 // if (el->fScene) throw eh + "element already has a Scene.";
903 if (el->fMother) throw eh + "element already has a Mother.";
904
905 // XXX Implement reparent --> MoveElement() ????
906 // Actually, better to do new = old.Clone(), RemoveElement(old), AddElement(new);
907 // Or do magick with Inc/DecDenyDestroy().
908 // PITA with existing children !!!! Need to re-scene them.
909
911 if (fScene && ! el->fScene) el->assign_scene_recursively(fScene);
912
913 el->fMother = this;
914
915 fChildren.emplace_back(el);
916
917 // XXXX This should be element added. Also, should be different for
918 // "full (re)construction". Scenes should manage that and have
919 // state like: none - constructing - clearing - nominal - updating.
920 // I recon this means an element should have a ptr to its scene.
921 //
922 // ElementChanged();
923}
924
925////////////////////////////////////////////////////////////////////////////////
926/// Remove el from the list of children.
927
929{
930 static const REveException eh("REveElement::RemoveElement ");
931
932 if (!el) throw eh + "called with nullptr argument.";
933 if (el->fMother != this) throw eh + "this element is not mother of el.";
934
936
938 el->fMother = nullptr;
939 el->fScene = nullptr;
940
942
943 fChildren.remove(el);
944
945 // XXXX This should be ElementRemoved(). Also, think about recursion, deletion etc.
946 // Also, this seems to be done above, in the call to fScene.
947 //
948 // ElementChanged();
949}
950
951////////////////////////////////////////////////////////////////////////////////
952/// Perform additional local removal of el.
953/// Called from RemoveElement() which does whole untangling.
954/// Put into special function as framework-related handling of
955/// element removal should really be common to all classes and
956/// clearing of local structures happens in between removal
957/// of list-tree-items and final removal.
958/// If you override this, you should also override
959/// RemoveElementsLocal().
960
964
965////////////////////////////////////////////////////////////////////////////////
966/// Remove all elements. This assumes removing of all elements can
967/// be done more efficiently then looping over them and removing one
968/// by one. This protected function performs the removal on the
969/// level of REveElement.
970
972{
974
975 for (auto &c : fChildren)
976 {
977 c->fScene->SceneElementRemoved(c->fElementId);
978 c->fMother = nullptr;
979 c->fScene = nullptr;
980
981 c->CheckReferenceCount();
982 }
983
984 fChildren.clear();
985}
986
987////////////////////////////////////////////////////////////////////////////////
988/// Remove all elements. This assumes removing of all elements can
989/// be done more efficiently then looping over them and removing
990/// them one by one.
991
993{
994 if (HasChildren())
995 {
997 // ElementChanged();
998 }
999}
1000
1001////////////////////////////////////////////////////////////////////////////////
1002/// Perform additional local removal of all elements.
1003/// See comment to RemoveElementLocal(REveElement*).
1004
1008
1009////////////////////////////////////////////////////////////////////////////////
1010/// If this is a projectable, loop over all projected replicas and
1011/// add the projected image of child 'el' there. This is supposed to
1012/// be called after you add a child to a projectable after it has
1013/// already been projected.
1014/// You might also want to call RecheckImpliedSelections() on this
1015/// element or 'el'.
1016///
1017/// If 'same_depth' flag is true, the same depth as for parent object
1018/// is used in every projection. Otherwise current depth of each
1019/// relevant projection-manager is used.
1020
1022{
1023 REveProjectable* pable = dynamic_cast<REveProjectable*>(this);
1024 if (pable && HasChild(el))
1025 {
1026 for (auto &pp: pable->RefProjecteds())
1027 {
1028 auto pmgr = pp->GetManager();
1029 Float_t cd = pmgr->GetCurrentDepth();
1030 if (same_depth) pmgr->SetCurrentDepth(pp->GetDepth());
1031
1032 pmgr->SubImportElements(el, pp->GetProjectedAsElement());
1033
1034 if (same_depth) pmgr->SetCurrentDepth(cd);
1035 }
1036 }
1037}
1038
1039////////////////////////////////////////////////////////////////////////////////
1040/// If this is a projectable, loop over all projected replicas and
1041/// add the projected image of all children there. This is supposed
1042/// to be called after you destroy all children and then add new
1043/// ones after this element has already been projected.
1044/// You might also want to call RecheckImpliedSelections() on this
1045/// element.
1046///
1047/// If 'same_depth' flag is true, the same depth as for the
1048/// projected element is used in every projection. Otherwise current
1049/// depth of each relevant projection-manager is used.
1050
1052{
1053 REveProjectable* pable = dynamic_cast<REveProjectable*>(this);
1054 if (pable)
1055 {
1056 for (auto &pp: pable->RefProjecteds())
1057 {
1058 REveProjectionManager *pmgr = pp->GetManager();
1059 Float_t cd = pmgr->GetCurrentDepth();
1060 if (same_depth) pmgr->SetCurrentDepth(pp->GetDepth());
1061
1062 pmgr->SubImportChildren(this, pp->GetProjectedAsElement());
1063
1064 if (same_depth) pmgr->SetCurrentDepth(cd);
1065 }
1066 }
1067}
1068
1069////////////////////////////////////////////////////////////////////////////////
1070/// Check if element el is a child of this element.
1071
1073{
1074 return (std::find(fChildren.begin(), fChildren.end(), el) != fChildren.end());
1075}
1076
1077////////////////////////////////////////////////////////////////////////////////
1078/// Find the first child with given name. If cls is specified (non
1079/// 0), it is also checked.
1080///
1081/// Returns nullptr if not found.
1082
1084{
1085 for (auto &c: fChildren)
1086 {
1087 if (name.CompareTo(c->GetCName()) == 0)
1088 {
1089 if (!cls || c->IsA()->InheritsFrom(cls))
1090 return c;
1091 }
1092 }
1093 return nullptr;
1094}
1095
1096////////////////////////////////////////////////////////////////////////////////
1097/// Find the first child whose name matches regexp. If cls is
1098/// specified (non 0), it is also checked.
1099///
1100/// Returns nullptr if not found.
1101
1103{
1104 for (auto &c: fChildren)
1105 {
1106 if (regexp.MatchB(c->GetName()))
1107 {
1108 if (!cls || c->IsA()->InheritsFrom(cls))
1109 return c;
1110 }
1111 }
1112 return nullptr;
1113}
1114
1115////////////////////////////////////////////////////////////////////////////////
1116/// Find all children with given name and append them to matches
1117/// list. If class is specified (non 0), it is also checked.
1118///
1119/// Returns number of elements added to the list.
1120
1122 const TString& name, const TClass* cls)
1123{
1124 Int_t count = 0;
1125 for (auto &c: fChildren)
1126 {
1127 if (name.CompareTo(c->GetCName()) == 0)
1128 {
1129 if (!cls || c->IsA()->InheritsFrom(cls))
1130 {
1131 matches.push_back(c);
1132 ++count;
1133 }
1134 }
1135 }
1136 return count;
1137}
1138
1139////////////////////////////////////////////////////////////////////////////////
1140/// Find all children whose name matches regexp and append them to
1141/// matches list.
1142///
1143/// Returns number of elements added to the list.
1144
1146 TPRegexp &regexp, const TClass *cls)
1147{
1148 Int_t count = 0;
1149 for (auto &c : fChildren)
1150 {
1151 if (regexp.MatchB(c->GetCName()))
1152 {
1153 if (!cls || c->IsA()->InheritsFrom(cls))
1154 {
1155 matches.push_back(c);
1156 ++count;
1157 }
1158 }
1159 }
1160 return count;
1161}
1162
1163////////////////////////////////////////////////////////////////////////////////
1164/// Returns the first child element or 0 if the list is empty.
1165
1167{
1168 return HasChildren() ? fChildren.front() : nullptr;
1169}
1170
1171////////////////////////////////////////////////////////////////////////////////
1172/// Returns the last child element or 0 if the list is empty.
1173
1175{
1176 return HasChildren() ? fChildren.back() : nullptr;
1177}
1178
1179////////////////////////////////////////////////////////////////////////////////
1180/// Enable rendering of children and their list contents.
1181/// Arguments control how to set self/child rendering.
1182
1184{
1185 for (auto &c: fChildren)
1186 c->SetRnrSelfChildren(rnr_self, rnr_children);
1187}
1188
1189////////////////////////////////////////////////////////////////////////////////
1190/// Disable rendering of children and their list contents.
1191/// Arguments control how to set self/child rendering.
1192///
1193/// Same as above function, but default arguments are different. This
1194/// is convenient for calls via context menu.
1195
1197{
1198 for (auto &c: fChildren)
1199 c->SetRnrSelfChildren(rnr_self, rnr_children);
1200}
1201
1202////////////////////////////////////////////////////////////////////////////////
1203/// Protected member function called from REveElement::Annihilate().
1204
1206{
1207 // projected were already destroyed in REveElement::Anihilate(), now only clear its list
1208 REveProjectable* pable = dynamic_cast<REveProjectable*>(this);
1209 if (pable && pable->HasProjecteds())
1210 pable->ClearProjectedList();
1211
1212 // same as REveElement::RemoveElementsInternal(), except parents are ignored
1214 for (auto &c : fChildren)
1215 c->AnnihilateRecursively();
1216
1217 fChildren.clear();
1218
1221
1222 delete this;
1223}
1224
1225////////////////////////////////////////////////////////////////////////////////
1226/// Optimized destruction without check of reference-count.
1227/// Parents are not notified about child destruction.
1228/// The method should only be used when an element does not have
1229/// more than one parent -- otherwise an exception is thrown.
1230
1232{
1233 static const REveException eh("REveElement::Annihilate ");
1234
1236
1237 // recursive annihilation of projecteds
1238 REveProjectable* pable = dynamic_cast<REveProjectable*>(this);
1239 if (pable && pable->HasProjecteds())
1240 {
1241 pable->AnnihilateProjecteds();
1242 }
1243
1244 // detach from the parent
1245 if (fMother)
1246 {
1247 fMother->RemoveElement(this);
1248 }
1249
1250 // XXXX wont the above already start off the destruction cascade ?????
1251
1253
1254 // XXXX ????? Annihilate flag ???? Is it different than regular remove ????
1255}
1256
1257////////////////////////////////////////////////////////////////////////////////
1258/// Annihilate elements.
1259
1261{
1262 while (!fChildren.empty())
1263 {
1264 auto c = fChildren.front();
1265 c->Annihilate();
1266 }
1267}
1268
1269////////////////////////////////////////////////////////////////////////////////
1270/// Destroy this element. Throws an exception if deny-destroy is in force.
1271/// This method should be called instead of a destructor.
1272/// Note that an exception will be thrown if the element has been
1273/// protected against destruction with IncDenyDestroy().
1274
1276{
1277 static const REveException eh("REveElement::Destroy ");
1278
1279 if (fDenyDestroy > 0)
1280 throw eh + TString::Format("element '%s' (%s*) %p is protected against destruction.",
1281 GetCName(), IsA()->GetName(), this);
1282
1284 delete this;
1285}
1286
1287////////////////////////////////////////////////////////////////////////////////
1288/// Destroy this element. Prints a warning if deny-destroy is in force.
1289
1291{
1292 try
1293 {
1294 Destroy();
1295 }
1296 catch (REveException &exc)
1297 {
1298 ::Warning("REveElement::DestroyOrWarn", "Error while destroy element %p : %s", this, exc.what());
1299 }
1300}
1301
1302////////////////////////////////////////////////////////////////////////////////
1303/// Destroy all children of this element.
1304
1306{
1307 while (HasChildren())
1308 {
1309 auto c = fChildren.front();
1310 if (c->fDenyDestroy <= 0)
1311 {
1312 try {
1313 c->Destroy();
1314 }
1315 catch (REveException &exc) {
1316 ::Warning("REveElement::DestroyElements", "element destruction failed: '%s'.", exc.what());
1318 }
1319 }
1320 else
1321 {
1322 if (gDebug > 0)
1323 ::Info("REveElement::DestroyElements", "element '%s' is protected against destruction, removing locally.", c->GetCName());
1325 }
1326 }
1327}
1328
1329////////////////////////////////////////////////////////////////////////////////
1330/// Returns state of flag determining if the element will be
1331/// destroyed when reference count reaches zero.
1332/// This is true by default.
1333
1338
1339////////////////////////////////////////////////////////////////////////////////
1340/// Sets the state of flag determining if the element will be
1341/// destroyed when reference count reaches zero.
1342/// This is true by default.
1343
1348
1349////////////////////////////////////////////////////////////////////////////////
1350/// Returns the number of times deny-destroy has been requested on
1351/// the element.
1352
1354{
1355 return fDenyDestroy;
1356}
1357
1358////////////////////////////////////////////////////////////////////////////////
1359/// Increases the deny-destroy count of the element.
1360/// Call this if you store an external pointer to the element.
1361
1366
1367////////////////////////////////////////////////////////////////////////////////
1368/// Decreases the deny-destroy count of the element.
1369/// Call this after releasing an external pointer to the element.
1370
1372{
1373 if (--fDenyDestroy <= 0)
1374 CheckReferenceCount("REveElement::DecDenyDestroy ");
1375}
1376
1377////////////////////////////////////////////////////////////////////////////////
1378/// Set pickable state on the element and all its children.
1379
1381{
1382 fPickable = p;
1383 for (auto &c: fChildren)
1384 c->SetPickableRecursively(p);
1385}
1386
1387////////////////////////////////////////////////////////////////////////////////
1388/// Returns the master element - that is:
1389/// - master of projectable, if this is a projected;
1390/// - master of compound, if fCompound is set;
1391/// - master of mother, if kSCBTakeMotherAsMaster bit is set;
1392/// If non of the above is true, *this* is returned.
1393
1395{
1397
1398 REveProjected* proj = dynamic_cast<REveProjected*>(this);
1399 if (proj)
1400 {
1401 return dynamic_cast<REveElement*>(proj->GetProjectable())->GetSelectionMaster();
1402 }
1403 if (fCompound)
1404 {
1405 return fCompound->GetSelectionMaster();
1406 }
1408 {
1409 return fMother->GetSelectionMaster();
1410 }
1411 return this;
1412}
1413
1414////////////////////////////////////////////////////////////////////////////////
1415/// Populate set impSelSet with derived / dependant elements.
1416///
1417/// If this is a REveProjectable, the projected replicas are added
1418/// to the set. Thus it does not have to be reimplemented for each
1419/// sub-class of REveProjected.
1420///
1421/// Note that this also takes care of projections of REveCompound
1422/// class, which is also a projectable.
1423
1424void REveElement::FillImpliedSelectedSet(Set_t &impSelSet, const std::set<int>&)
1425{
1426 REveProjectable* p = dynamic_cast<REveProjectable*>(this);
1427 if (p)
1428 p->AddProjectedsToSet(impSelSet);
1429}
1430
1431////////////////////////////////////////////////////////////////////////////////
1432/// Call this if it is possible that implied-selection or highlight
1433/// has changed for this element or for implied-selection this
1434/// element is member of and you want to maintain consistent
1435/// selection state.
1436/// This can happen if you add elements into compounds in response
1437/// to user-interaction.
1438
1440{
1441 // XXXX MT 2019-01 --- RecheckImpliedSelections
1442 //
1443 // With removal of selection state from this class there might be some
1444 // corner cases requiring checking of implied-selected state in
1445 // selection/highlight objects.
1446 //
1447 // This could be done as part of begin / end changes on the EveManager level.
1448 //
1449 // See also those functions in TEveSelection.
1450
1451 // if (fSelected || fImpliedSelected)
1452 // REX::gEve->GetSelection()->RecheckImpliedSetForElement(this);
1453
1454 // if (fHighlighted || fImpliedHighlighted)
1455 // REX::gEve->GetHighlight()->RecheckImpliedSetForElement(this);
1456}
1457
1458////////////////////////////////////////////////////////////////////////////////
1459/// Add (bitwise or) given stamps to fChangeBits.
1460/// Register this element to REX::gEve as stamped.
1461/// This method is virtual so that sub-classes can add additional
1462/// actions. The base-class method should still be called (or replicated).
1463
1465{
1467 {
1468 if (gDebug > 0)
1469 ::Info(Form("%s::AddStamp", GetCName()), "%d + (%d) -> %d", fChangeBits, bits, fChangeBits | bits);
1470
1471 if (fChangeBits == 0)
1472 {
1474 }
1475
1476 fChangeBits |= bits;
1477 }
1478}
1479
1480////////////////////////////////////////////////////////////////////////////////
1481/// Write transformation Matrix to render data
1482////////////////////////////////////////////////////////////////////////////////
1483
1485{
1486 if (fMainTrans && fRenderData) {
1487 fRenderData->SetMatrix(fMainTrans->Array());
1488 }
1489}
1490
1491////////////////////////////////////////////////////////////////////////////////
1492/// Write the main transformation and its motion for a kCBTransBBox update.
1493/// No render data is written; the client applies it to the object it already
1494/// has. It goes out as JSON, so no offset is reserved in the binary blob for a
1495/// message that carries no geometry.
1496
1497void REveElement::WriteTransJson(nlohmann::json &cj)
1498{
1499 if (fMainTrans.get()) {
1500 const Double_t *m = fMainTrans->Array();
1501 cj["matrix"] = std::vector<double>(m, m + 16);
1502 }
1503
1504 if (fMainTrans && fMainTrans->HasMotion()) {
1505 const REveDeltaTrans &d = *fMainTrans->GetDeltaTrans();
1506 const REveVectorD &v = d.fVel, &a = d.fAcc, &s = d.fSpinAxis;
1507 // clang-format off
1508 cj["mot"] = { {"t0", d.fMotionT0},
1509 {"vel", {v.fX, v.fY, v.fZ}},
1510 {"acc", {a.fX, a.fY, a.fZ}},
1511 {"axis", {s.fX, s.fY, s.fZ}},
1512 {"rate", d.fSpinRate},
1513 {"max_dt", d.fMaxDt} };
1514 // clang-format on
1515 } else {
1516 // Sent explicitly so that a stopped element cancels the client's
1517 // trajectory: a missing field in a partial update means unchanged.
1518 cj["mot"] = nullptr;
1519 }
1520}
1521
1522////////////////////////////////////////////////////////////////////////////////
1523/// Convert Bool_t to string - kTRUE or kFALSE.
1524/// Needed in WriteVizParams().
1525
1526const std::string& REveElement::ToString(Bool_t b)
1527{
1528 static const std::string true_str ("kTRUE");
1529 static const std::string false_str("kFALSE");
1530
1531 return b ? true_str : false_str;
1532}
1533
1534////////////////////////////////////////////////////////////////////////////////
1535/// Write core json. If rnr_offset is negative, render data shall not be
1536/// written.
1537/// Returns number of bytes written into binary render data.
1538
1539Int_t REveElement::WriteCoreJson(nlohmann::json &j, Int_t rnr_offset)
1540{
1541 j["_typename"] = IsA()->GetName();
1542 j["fName"] = fName;
1543 j["fTitle"] = fTitle;
1544 j["fElementId"] = GetElementId();
1545 j["fMotherId"] = get_mother_id();
1546 j["fSceneId"] = get_scene_id();
1547 j["fMasterId"] = GetSelectionMaster()->GetElementId();
1548
1549 j["fRnrSelf"] = GetRnrSelf();
1550 j["fRnrChildren"] = GetRnrChildren();
1551
1552 j["fMainColor"] = GetMainColor();
1553 j["fMainTransparency"] = GetMainTransparency();
1554 j["fPickable"] = fPickable;
1555
1556 Int_t ret = 0;
1557
1558 if (rnr_offset >= 0) {
1560
1561 if (fRenderData) {
1562 nlohmann::json rd = {};
1563
1564 rd["rnr_offset"] = rnr_offset;
1565 rd["rnr_func"] = fRenderData->GetRnrFunc();
1566 rd["vert_size"] = fRenderData->SizeV();
1567 rd["norm_size"] = fRenderData->SizeN();
1568 rd["index_size"] = fRenderData->SizeI();
1569 rd["trans_size"] = fRenderData->SizeT();
1570
1571 j["render_data"] = rd;
1572
1573 ret = fRenderData->GetBinarySize();
1574 }
1575 }
1576
1577 return ret;
1578}
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:41
#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 a(i)
Definition RSha256.hxx:99
#define e(i)
Definition RSha256.hxx:103
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
short Color_t
Color number (short)
Definition RtypesCore.h:100
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char)
Definition RtypesCore.h:53
char Char_t
Character 1 byte (char)
Definition RtypesCore.h:52
constexpr Bool_t kFALSE
Definition RtypesCore.h:109
constexpr Bool_t kTRUE
Definition RtypesCore.h:108
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
Definition TError.cxx:241
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:208
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:252
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t dest
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void pixel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char cname
char name[80]
Definition TGX11.cxx:142
Int_t gDebug
Global variable setting the debug level. Set to 0 to disable, increase it in steps of 1 to increase t...
Definition TROOT.cxx:792
#define gROOT
Definition TROOT.h:417
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2571
virtual REveElement * CloneElement() const
Clone the element via copy constructor.
static thread_local REveElement * stlMirAlpha
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 void WriteTransJson(nlohmann::json &cj)
Write the main transformation and its motion for a kCBTransBBox update.
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.
static thread_local int stlMirError
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.
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
static thread_local std::string stlMirErrorString
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.
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
void PreDeleteElement(REveElement *element)
Called from REveElement prior to its destruction so the framework components (like object editor) can...
void AssignElementId(REveElement *element)
Assign a unique ElementId to given element.
REveElement * FindVizDBEntry(const TString &tag)
Find a visualization-parameter database entry corresponding to tag.
Bool_t InsertVizDBEntry(const TString &tag, REveElement *model, Bool_t replace, Bool_t update)
Insert a new visualization-parameter database entry.
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)
void SceneElementChanged(REveElement *element)
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:5111
Bool_t InheritsFrom(const char *cl) const override
Return kTRUE if this class inherits from a class with name "classname".
Definition TClass.cxx:4995
TClass * IsA() const override
Definition TClass.h:638
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:2999
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:1939
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:137
Ssiz_t Length() const
Definition TString.h:426
const char * Data() const
Definition TString.h:385
Bool_t IsNull() const
Definition TString.h:423
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2460
Namespace for ROOT features in testing.
Definition TROOT.h:100
ROOT::RLogChannel & REveLog()
Log channel for Eve diagnostics.
Definition REveTypes.cxx:52
R__EXTERN REveManager * gEve
How a transformation is changing: the state REveTrans::SetMotion() records.
Definition REveTrans.hxx:32
TMarker m
Definition textangle.C:8