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