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
32
33#include <algorithm>
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 }
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 {
443 }
444}
445
446////////////////////////////////////////////////////////////////////////////////
447/// Reset visual parameters for this object from VizDB.
448/// The model object must be already set.
449
451{
452 if (fVizModel)
453 {
457 }
458}
459
460////////////////////////////////////////////////////////////////////////////////
461/// Copy visual parameters from this element to viz-db model.
462/// If update is set, all clients of the model will be updated to
463/// the new value.
464/// A warning is printed if the model-element fVizModel is not set.
465
467{
468 if (fVizModel)
469 {
471 if (update)
472 {
473 // XXX Back references from vizdb templates have been removed in Eve7.
474 // XXX We could traverse all scenes and elementes and reset those that
475 // XXX have a matching fVizModel. Or something.
476 Error("VizDB_UpdateModel", "update from vizdb -> elements not implemented.");
477 // fVizModel->PropagateVizParamsToElements(fVizModel);
478 // REX::gEve->Redraw3D();
479 }
480 }
481 else
482 {
483 Warning("VizDB_UpdateModel", "VizModel has not been set.");
484 }
485}
486
487////////////////////////////////////////////////////////////////////////////////
488/// Create a replica of element and insert it into VizDB with given tag.
489/// If replace is true an existing element with the same tag will be replaced.
490/// If update is true, existing client of tag will be updated.
491
492void REveElement::VizDB_Insert(const std::string& tag, Bool_t replace, Bool_t update)
493{
494 static const REveException eh("REveElement::GetObject ");
495
496 TClass* cls = IsA();
497 REveElement* el = reinterpret_cast<REveElement*>(cls->New());
498 if (!el) {
499 Error("VizDB_Insert", "Creation of replica failed.");
500 return;
501 }
502 el->CopyVizParams(this);
503 Bool_t succ = REX::gEve->InsertVizDBEntry(tag, el, replace, update);
504 if (succ && update)
506}
507
508////////////////////////////////////////////////////////////////////////////////
509/// Add el into the list aunts.
510///
511/// Adding aunt is subordinate to adding a niece.
512/// This is an internal function.
513
515{
516 assert(au != nullptr);
517
518 fAunts.emplace_back(au);
519}
520
521////////////////////////////////////////////////////////////////////////////////
522/// Remove el from the list of aunts.
523/// Removing aunt is subordinate to removing a niece.
524/// This is an internal function.
525
527{
528 assert(au != nullptr);
529
530 fAunts.remove(au);
531}
532
533/******************************************************************************/
534
535////////////////////////////////////////////////////////////////////////////////
536/// Check external references to this and eventually auto-destruct
537/// the render-element.
538
539void REveElement::CheckReferenceCount(const std::string& from)
540{
541 if (fDestructing != kNone)
542 return;
543
544 if (fMother == nullptr && fDestroyOnZeroRefCnt && fDenyDestroy <= 0)
545 {
546 if (gDebug > 0)
547 Info("REveElement::CheckReferenceCount", "(called from %s) auto-destructing '%s' on zero reference count.",
548 from.c_str(), GetCName());
549
551 delete this;
552 }
553}
554
555////////////////////////////////////////////////////////////////////////////////
556/// Return class for this element
557
559{
560 return TClass::GetClass(typeid(*this), kTRUE, kTRUE);
561}
562
563////////////////////////////////////////////////////////////////////////////////
564/// Export render-element to CINT with variable name var_name.
565
566void REveElement::ExportToCINT(const char *var_name)
567{
568 const char* cname = IsA()->GetName();
569 gROOT->ProcessLine(TString::Format("%s* %s = (%s*)0x%lx;", cname, var_name, cname, (ULong_t)this));
570}
571
572////////////////////////////////////////////////////////////////////////////////
573/// Set render state of this element, i.e. if it will be published
574/// on next scene update pass.
575/// Returns true if the state has changed.
576
578{
579 if (SingleRnrState())
580 {
581 return SetRnrState(rnr);
582 }
583
584 if (rnr != fRnrSelf)
585 {
586 fRnrSelf = rnr;
589
590 return kTRUE;
591 }
592 return kFALSE;
593}
594
595////////////////////////////////////////////////////////////////////////////////
596/// Set render state of this element's children, i.e. if they will
597/// be published on next scene update pass.
598/// Returns true if the state has changed.
599
601{
602 if (SingleRnrState())
603 {
604 return SetRnrState(rnr);
605 }
606
607 if (rnr != fRnrChildren)
608 {
609 fRnrChildren = rnr;
612 return kTRUE;
613 }
614 return kFALSE;
615}
616
617////////////////////////////////////////////////////////////////////////////////
618/// Set state for rendering of this element and its children.
619/// Returns true if the state has changed.
620
622{
623 if (SingleRnrState())
624 {
625 return SetRnrState(rnr_self);
626 }
627
628 if (fRnrSelf != rnr_self || fRnrChildren != rnr_children)
629 {
630 fRnrSelf = rnr_self;
631 fRnrChildren = rnr_children;
634 return kTRUE;
635 }
636 return kFALSE;
637}
638
639////////////////////////////////////////////////////////////////////////////////
640/// Set render state of this element and of its children to the same
641/// value.
642/// Returns true if the state has changed.
643
645{
646 if (fRnrSelf != rnr || fRnrChildren != rnr)
647 {
648 fRnrSelf = fRnrChildren = rnr;
651 return kTRUE;
652 }
653 return kFALSE;
654}
655
656////////////////////////////////////////////////////////////////////////////////
657/// Propagate render state to the projected replicas of this element.
658/// Maybe this should be optional on REX::gEve/element level.
659
661{
662 REveProjectable *pable = dynamic_cast<REveProjectable*>(this);
663 if (pable && pable->HasProjecteds())
664 {
666 }
667}
668
669////////////////////////////////////////////////////////////////////////////////
670/// Set up element to use built-in main color and set flags allowing editing
671/// of main color and transparency.
672
673void REveElement::SetupDefaultColorAndTransparency(Color_t col, Bool_t can_edit_color, Bool_t can_edit_transparency)
674{
676 fDefaultColor = col;
677 fCanEditMainColor = can_edit_color;
678 fCanEditMainTransparency = can_edit_transparency;
679}
680
681////////////////////////////////////////////////////////////////////////////////
682/// Set main color of the element.
683
685{
686 Color_t old_color = GetMainColor();
687
688 if (fMainColorPtr)
689 {
690 *fMainColorPtr = color;
692 }
693
694 PropagateMainColorToProjecteds(color, old_color);
695}
696
697////////////////////////////////////////////////////////////////////////////////
698/// Convert pixel to Color_t and call SetMainColor().
699
701{
703}
704
705////////////////////////////////////////////////////////////////////////////////
706/// Convert RGB values to Color_t and call SetMainColor.
707
709{
711}
712
713////////////////////////////////////////////////////////////////////////////////
714/// Convert RGB values to Color_t and call SetMainColor.
715
717{
719}
720
721////////////////////////////////////////////////////////////////////////////////
722/// Propagate color to projected elements.
723
725{
726 REveProjectable* pable = dynamic_cast<REveProjectable*>(this);
727 if (pable && pable->HasProjecteds())
728 {
729 pable->PropagateMainColor(color, old_color);
730 }
731}
732
733////////////////////////////////////////////////////////////////////////////////
734/// Set main-transparency.
735/// Transparency is clamped to [0, 100].
736
738{
739 Char_t old_t = GetMainTransparency();
740
741 if (t > 100) t = 100;
744
746}
747
748////////////////////////////////////////////////////////////////////////////////
749/// Set main-transparency via float alpha variable.
750/// Value of alpha is clamped t0 [0, 1].
751
753{
754 if (alpha < 0) alpha = 0;
755 if (alpha > 1) alpha = 1;
756 SetMainTransparency((Char_t) (100.0f*(1.0f - alpha)));
757}
758
759////////////////////////////////////////////////////////////////////////////////
760/// Propagate transparency to projected elements.
761
763{
764 REveProjectable* pable = dynamic_cast<REveProjectable*>(this);
765 if (pable && pable->HasProjecteds())
766 {
767 pable->PropagateMainTransparency(t, old_t);
768 }
769}
770
771////////////////////////////////////////////////////////////////////////////////
772/// Return pointer to main transformation. If 'create' flag is set (default)
773/// it is created if not yet existing.
774
776{
777 if (!fMainTrans && create)
779
780 return fMainTrans.get();
781}
782
783////////////////////////////////////////////////////////////////////////////////
784/// Return reference to main transformation. It is created if not yet
785/// existing.
786
788{
789 if (!fMainTrans)
791
792 return *fMainTrans.get();
793}
794
795////////////////////////////////////////////////////////////////////////////////
796/// Initialize the main transformation to identity matrix.
797/// If can_edit is true (default), the user will be able to edit the
798/// transformation parameters via GUI.
799
801{
802 if (fMainTrans)
803 fMainTrans->UnitTrans();
804 else
805 fMainTrans = std::make_unique<REveTrans>();
806 fCanEditMainTrans = can_edit;
807}
808
809////////////////////////////////////////////////////////////////////////////////
810/// Destroy the main transformation matrix, it will always be taken
811/// as identity. Editing of transformation parameters is disabled.
812
814{
815 fMainTrans.reset(nullptr);
817}
818
819////////////////////////////////////////////////////////////////////////////////
820/// Set transformation matrix from column-major array.
821
823{
824 RefMainTrans().SetFrom(carr);
825}
826
827////////////////////////////////////////////////////////////////////////////////
828/// Set transformation matrix from TGeo's matrix.
829
831{
832 RefMainTrans().SetFrom(mat);
833}
834
835////////////////////////////////////////////////////////////////////////////////
836/// Check if el can be added to this element.
837///
838/// Here we make sure the new child is not equal to this and, if fChildClass
839/// is set, that it is inherited from it.
840
842{
843 if (el == this)
844 return kFALSE;
845 if (fChildClass && ! el->IsA()->InheritsFrom(fChildClass))
846 return kFALSE;
847 return kTRUE;
848}
849
850////////////////////////////////////////////////////////////////////////////////
851/// Add el to the list of children.
852
854{
855 static const REveException eh("REveElement::AddElement ");
856
857 if (!el) throw eh + "called with nullptr argument.";
858 if ( ! AcceptElement(el)) throw eh + Form("parent '%s' rejects '%s'.", GetCName(), el->GetCName());
859 if (el->fElementId) throw eh + "element already has an id.";
860 // if (el->fScene) throw eh + "element already has a Scene.";
861 if (el->fMother) throw eh + "element already has a Mother.";
862
863 // XXX Implement reparent --> MoveElement() ????
864 // Actually, better to do new = old.Clone(), RemoveElement(old), AddElement(new);
865 // Or do magick with Inc/DecDenyDestroy().
866 // PITA with existing children !!!! Need to re-scene them.
867
869 if (fScene && ! el->fScene) el->assign_scene_recursively(fScene);
870
871 el->fMother = this;
872
873 fChildren.emplace_back(el);
874
875 // XXXX This should be element added. Also, should be different for
876 // "full (re)construction". Scenes should manage that and have
877 // state like: none - constructing - clearing - nominal - updating.
878 // I recon this means an element should have a ptr to its scene.
879 //
880 // ElementChanged();
881}
882
883////////////////////////////////////////////////////////////////////////////////
884/// Remove el from the list of children.
885
887{
888 static const REveException eh("REveElement::RemoveElement ");
889
890 if (!el) throw eh + "called with nullptr argument.";
891 if (el->fMother != this) throw eh + "this element is not mother of el.";
892
894
896 el->fMother = nullptr;
897 el->fScene = nullptr;
898
900
901 fChildren.remove(el);
902
903 // XXXX This should be ElementRemoved(). Also, think about recursion, deletion etc.
904 // Also, this seems to be done above, in the call to fScene.
905 //
906 // ElementChanged();
907}
908
909////////////////////////////////////////////////////////////////////////////////
910/// Perform additional local removal of el.
911/// Called from RemoveElement() which does whole untangling.
912/// Put into special function as framework-related handling of
913/// element removal should really be common to all classes and
914/// clearing of local structures happens in between removal
915/// of list-tree-items and final removal.
916/// If you override this, you should also override
917/// RemoveElementsLocal().
918
920{
921}
922
923////////////////////////////////////////////////////////////////////////////////
924/// Remove all elements. This assumes removing of all elements can
925/// be done more efficiently then looping over them and removing one
926/// by one. This protected function performs the removal on the
927/// level of REveElement.
928
930{
932
933 for (auto &c : fChildren)
934 {
935 c->fScene->SceneElementRemoved(c->fElementId);
936 c->fMother = nullptr;
937 c->fScene = nullptr;
938
939 c->CheckReferenceCount();
940 }
941
942 fChildren.clear();
943}
944
945////////////////////////////////////////////////////////////////////////////////
946/// Remove all elements. This assumes removing of all elements can
947/// be done more efficiently then looping over them and removing
948/// them one by one.
949
951{
952 if (HasChildren())
953 {
955 // ElementChanged();
956 }
957}
958
959////////////////////////////////////////////////////////////////////////////////
960/// Perform additional local removal of all elements.
961/// See comment to RemoveElementLocal(REveElement*).
962
964{
965}
966
967////////////////////////////////////////////////////////////////////////////////
968/// If this is a projectable, loop over all projected replicas and
969/// add the projected image of child 'el' there. This is supposed to
970/// be called after you add a child to a projectable after it has
971/// already been projected.
972/// You might also want to call RecheckImpliedSelections() on this
973/// element or 'el'.
974///
975/// If 'same_depth' flag is true, the same depth as for parent object
976/// is used in every projection. Otherwise current depth of each
977/// relevant projection-manager is used.
978
980{
981 REveProjectable* pable = dynamic_cast<REveProjectable*>(this);
982 if (pable && HasChild(el))
983 {
984 for (auto &pp: pable->RefProjecteds())
985 {
986 auto pmgr = pp->GetManager();
987 Float_t cd = pmgr->GetCurrentDepth();
988 if (same_depth) pmgr->SetCurrentDepth(pp->GetDepth());
989
990 pmgr->SubImportElements(el, pp->GetProjectedAsElement());
991
992 if (same_depth) pmgr->SetCurrentDepth(cd);
993 }
994 }
995}
996
997////////////////////////////////////////////////////////////////////////////////
998/// If this is a projectable, loop over all projected replicas and
999/// add the projected image of all children there. This is supposed
1000/// to be called after you destroy all children and then add new
1001/// ones after this element has already been projected.
1002/// You might also want to call RecheckImpliedSelections() on this
1003/// element.
1004///
1005/// If 'same_depth' flag is true, the same depth as for the
1006/// projected element is used in every projection. Otherwise current
1007/// depth of each relevant projection-manager is used.
1008
1010{
1011 REveProjectable* pable = dynamic_cast<REveProjectable*>(this);
1012 if (pable)
1013 {
1014 for (auto &pp: pable->RefProjecteds())
1015 {
1016 REveProjectionManager *pmgr = pp->GetManager();
1017 Float_t cd = pmgr->GetCurrentDepth();
1018 if (same_depth) pmgr->SetCurrentDepth(pp->GetDepth());
1019
1020 pmgr->SubImportChildren(this, pp->GetProjectedAsElement());
1021
1022 if (same_depth) pmgr->SetCurrentDepth(cd);
1023 }
1024 }
1025}
1026
1027////////////////////////////////////////////////////////////////////////////////
1028/// Check if element el is a child of this element.
1029
1031{
1032 return (std::find(fChildren.begin(), fChildren.end(), el) != fChildren.end());
1033}
1034
1035////////////////////////////////////////////////////////////////////////////////
1036/// Find the first child with given name. If cls is specified (non
1037/// 0), it is also checked.
1038///
1039/// Returns nullptr if not found.
1040
1042{
1043 for (auto &c: fChildren)
1044 {
1045 if (name.CompareTo(c->GetCName()) == 0)
1046 {
1047 if (!cls || c->IsA()->InheritsFrom(cls))
1048 return c;
1049 }
1050 }
1051 return nullptr;
1052}
1053
1054////////////////////////////////////////////////////////////////////////////////
1055/// Find the first child whose name matches regexp. If cls is
1056/// specified (non 0), it is also checked.
1057///
1058/// Returns nullptr if not found.
1059
1061{
1062 for (auto &c: fChildren)
1063 {
1064 if (regexp.MatchB(c->GetName()))
1065 {
1066 if (!cls || c->IsA()->InheritsFrom(cls))
1067 return c;
1068 }
1069 }
1070 return nullptr;
1071}
1072
1073////////////////////////////////////////////////////////////////////////////////
1074/// Find all children with given name and append them to matches
1075/// list. If class is specified (non 0), it is also checked.
1076///
1077/// Returns number of elements added to the list.
1078
1080 const TString& name, const TClass* cls)
1081{
1082 Int_t count = 0;
1083 for (auto &c: fChildren)
1084 {
1085 if (name.CompareTo(c->GetCName()) == 0)
1086 {
1087 if (!cls || c->IsA()->InheritsFrom(cls))
1088 {
1089 matches.push_back(c);
1090 ++count;
1091 }
1092 }
1093 }
1094 return count;
1095}
1096
1097////////////////////////////////////////////////////////////////////////////////
1098/// Find all children whose name matches regexp and append them to
1099/// matches list.
1100///
1101/// Returns number of elements added to the list.
1102
1104 TPRegexp &regexp, const TClass *cls)
1105{
1106 Int_t count = 0;
1107 for (auto &c : fChildren)
1108 {
1109 if (regexp.MatchB(c->GetCName()))
1110 {
1111 if (!cls || c->IsA()->InheritsFrom(cls))
1112 {
1113 matches.push_back(c);
1114 ++count;
1115 }
1116 }
1117 }
1118 return count;
1119}
1120
1121////////////////////////////////////////////////////////////////////////////////
1122/// Returns the first child element or 0 if the list is empty.
1123
1125{
1126 return HasChildren() ? fChildren.front() : nullptr;
1127}
1128
1129////////////////////////////////////////////////////////////////////////////////
1130/// Returns the last child element or 0 if the list is empty.
1131
1133{
1134 return HasChildren() ? fChildren.back() : nullptr;
1135}
1136
1137////////////////////////////////////////////////////////////////////////////////
1138/// Enable rendering of children and their list contents.
1139/// Arguments control how to set self/child rendering.
1140
1142{
1143 for (auto &c: fChildren)
1144 c->SetRnrSelfChildren(rnr_self, rnr_children);
1145}
1146
1147////////////////////////////////////////////////////////////////////////////////
1148/// Disable rendering of children and their list contents.
1149/// Arguments control how to set self/child rendering.
1150///
1151/// Same as above function, but default arguments are different. This
1152/// is convenient for calls via context menu.
1153
1155{
1156 for (auto &c: fChildren)
1157 c->SetRnrSelfChildren(rnr_self, rnr_children);
1158}
1159
1160////////////////////////////////////////////////////////////////////////////////
1161/// Protected member function called from REveElement::Annihilate().
1162
1164{
1165 // projected were already destroyed in REveElement::Anihilate(), now only clear its list
1166 REveProjectable* pable = dynamic_cast<REveProjectable*>(this);
1167 if (pable && pable->HasProjecteds())
1168 pable->ClearProjectedList();
1169
1170 // same as REveElement::RemoveElementsInternal(), except parents are ignored
1172 for (auto &c : fChildren)
1173 c->AnnihilateRecursively();
1174
1175 fChildren.clear();
1176
1179
1180 delete this;
1181}
1182
1183////////////////////////////////////////////////////////////////////////////////
1184/// Optimized destruction without check of reference-count.
1185/// Parents are not notified about child destruction.
1186/// The method should only be used when an element does not have
1187/// more than one parent -- otherwise an exception is thrown.
1188
1190{
1191 static const REveException eh("REveElement::Annihilate ");
1192
1194
1195 // recursive annihilation of projecteds
1196 REveProjectable* pable = dynamic_cast<REveProjectable*>(this);
1197 if (pable && pable->HasProjecteds())
1198 {
1199 pable->AnnihilateProjecteds();
1200 }
1201
1202 // detach from the parent
1203 if (fMother)
1204 {
1205 fMother->RemoveElement(this);
1206 }
1207
1208 // XXXX wont the above already start off the destruction cascade ?????
1209
1211
1212 // XXXX ????? Annihilate flag ???? Is it different than regular remove ????
1213 // REX::gEve->Redraw3D();
1214}
1215
1216////////////////////////////////////////////////////////////////////////////////
1217/// Annihilate elements.
1218
1220{
1221 while (!fChildren.empty())
1222 {
1223 auto c = fChildren.front();
1224 c->Annihilate();
1225 }
1226}
1227
1228////////////////////////////////////////////////////////////////////////////////
1229/// Destroy this element. Throws an exception if deny-destroy is in force.
1230/// This method should be called instead of a destructor.
1231/// Note that an exception will be thrown if the element has been
1232/// protected against destruction with IncDenyDestroy().
1233
1235{
1236 static const REveException eh("REveElement::Destroy ");
1237
1238 if (fDenyDestroy > 0)
1239 throw eh + TString::Format("element '%s' (%s*) %p is protected against destruction.",
1240 GetCName(), IsA()->GetName(), this);
1241
1243 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
1289}
1290
1291////////////////////////////////////////////////////////////////////////////////
1292/// Returns state of flag determining if the element will be
1293/// destroyed when reference count reaches zero.
1294/// This is true by default.
1295
1297{
1298 return fDestroyOnZeroRefCnt;
1299}
1300
1301////////////////////////////////////////////////////////////////////////////////
1302/// Sets the state of flag determining if the element will be
1303/// destroyed when reference count reaches zero.
1304/// This is true by default.
1305
1307{
1309}
1310
1311////////////////////////////////////////////////////////////////////////////////
1312/// Returns the number of times deny-destroy has been requested on
1313/// the element.
1314
1316{
1317 return fDenyDestroy;
1318}
1319
1320////////////////////////////////////////////////////////////////////////////////
1321/// Increases the deny-destroy count of the element.
1322/// Call this if you store an external pointer to the element.
1323
1325{
1326 ++fDenyDestroy;
1327}
1328
1329////////////////////////////////////////////////////////////////////////////////
1330/// Decreases the deny-destroy count of the element.
1331/// Call this after releasing an external pointer to the element.
1332
1334{
1335 if (--fDenyDestroy <= 0)
1336 CheckReferenceCount("REveElement::DecDenyDestroy ");
1337}
1338
1339////////////////////////////////////////////////////////////////////////////////
1340/// Set pickable state on the element and all its children.
1341
1343{
1344 fPickable = p;
1345 for (auto &c: fChildren)
1346 c->SetPickableRecursively(p);
1347}
1348
1349////////////////////////////////////////////////////////////////////////////////
1350/// Returns the master element - that is:
1351/// - master of projectable, if this is a projected;
1352/// - master of compound, if fCompound is set;
1353/// - master of mother, if kSCBTakeMotherAsMaster bit is set;
1354/// If non of the above is true, *this* is returned.
1355
1357{
1359
1360 REveProjected* proj = dynamic_cast<REveProjected*>(this);
1361 if (proj)
1362 {
1363 return dynamic_cast<REveElement*>(proj->GetProjectable())->GetSelectionMaster();
1364 }
1365 if (fCompound)
1366 {
1367 return fCompound->GetSelectionMaster();
1368 }
1370 {
1371 return fMother->GetSelectionMaster();
1372 }
1373 return this;
1374}
1375
1376////////////////////////////////////////////////////////////////////////////////
1377/// Populate set impSelSet with derived / dependant elements.
1378///
1379/// If this is a REveProjectable, the projected replicas are added
1380/// to the set. Thus it does not have to be reimplemented for each
1381/// sub-class of REveProjected.
1382///
1383/// Note that this also takes care of projections of REveCompound
1384/// class, which is also a projectable.
1385
1387{
1388 REveProjectable* p = dynamic_cast<REveProjectable*>(this);
1389 if (p)
1390 p->AddProjectedsToSet(impSelSet);
1391}
1392
1393////////////////////////////////////////////////////////////////////////////////
1394/// Call this if it is possible that implied-selection or highlight
1395/// has changed for this element or for implied-selection this
1396/// element is member of and you want to maintain consistent
1397/// selection state.
1398/// This can happen if you add elements into compounds in response
1399/// to user-interaction.
1400
1402{
1403 // XXXX MT 2019-01 --- RecheckImpliedSelections
1404 //
1405 // With removal of selection state from this class there might be some
1406 // corner cases requiring checking of implied-selected state in
1407 // selection/highlight objects.
1408 //
1409 // This could be done as part of begin / end changes on the EveManager level.
1410 //
1411 // See also those functions in TEveSelection.
1412
1413 // if (fSelected || fImpliedSelected)
1414 // REX::gEve->GetSelection()->RecheckImpliedSetForElement(this);
1415
1416 // if (fHighlighted || fImpliedHighlighted)
1417 // REX::gEve->GetHighlight()->RecheckImpliedSetForElement(this);
1418}
1419
1420////////////////////////////////////////////////////////////////////////////////
1421/// Add (bitwise or) given stamps to fChangeBits.
1422/// Register this element to REX::gEve as stamped.
1423/// This method is virtual so that sub-classes can add additional
1424/// actions. The base-class method should still be called (or replicated).
1425
1427{
1429 {
1430 if (gDebug > 0)
1431 ::Info(Form("%s::AddStamp", GetCName()), "%d + (%d) -> %d", fChangeBits, bits, fChangeBits | bits);
1432
1433 if (fChangeBits == 0)
1434 {
1436 }
1437
1438 fChangeBits |= bits;
1439 }
1440}
1441
1442////////////////////////////////////////////////////////////////////////////////
1443/// Write transformation Matrix to render data
1444////////////////////////////////////////////////////////////////////////////////
1445
1447{
1448 if (fMainTrans.get())
1449 {
1450 fRenderData->SetMatrix(fMainTrans->Array());
1451 }
1452}
1453
1454////////////////////////////////////////////////////////////////////////////////
1455/// Convert Bool_t to string - kTRUE or kFALSE.
1456/// Needed in WriteVizParams().
1457
1458const std::string& REveElement::ToString(Bool_t b)
1459{
1460 static const std::string true_str ("kTRUE");
1461 static const std::string false_str("kFALSE");
1462
1463 return b ? true_str : false_str;
1464}
1465
1466////////////////////////////////////////////////////////////////////////////////
1467/// Write core json. If rnr_offset is negative, render data shall not be
1468/// written.
1469/// Returns number of bytes written into binary render data.
1470
1471Int_t REveElement::WriteCoreJson(nlohmann::json &j, Int_t rnr_offset)
1472{
1473 j["_typename"] = IsA()->GetName();
1474 j["fName"] = fName;
1475 j["fTitle"] = fTitle;
1476 j["fElementId"] = GetElementId();
1477 j["fMotherId"] = get_mother_id();
1478 j["fSceneId"] = get_scene_id();
1479 j["fMasterId"] = GetSelectionMaster()->GetElementId();
1480
1481 j["fRnrSelf"] = GetRnrSelf();
1482 j["fRnrChildren"] = GetRnrChildren();
1483
1484 j["fMainColor"] = GetMainColor();
1485 j["fMainTransparency"] = GetMainTransparency();
1486 j["fPickable"] = fPickable;
1487
1488 Int_t ret = 0;
1489
1490 if (rnr_offset >= 0) {
1492
1493 if (fRenderData) {
1494 nlohmann::json rd = {};
1495
1496 rd["rnr_offset"] = rnr_offset;
1497 rd["rnr_func"] = fRenderData->GetRnrFunc();
1498 rd["vert_size"] = fRenderData->SizeV();
1499 rd["norm_size"] = fRenderData->SizeN();
1500 rd["index_size"] = fRenderData->SizeI();
1501 rd["trans_size"] = fRenderData->SizeT();
1502
1503 j["render_data"] = rd;
1504
1505 ret = fRenderData->GetBinarySize();
1506 }
1507 }
1508
1509 return ret;
1510}
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
ROOT::R::TRInterface & r
Definition Object.C:4
#define d(i)
Definition RSha256.hxx:102
#define b(i)
Definition RSha256.hxx:100
#define c(i)
Definition RSha256.hxx:101
#define g(i)
Definition RSha256.hxx:105
#define e(i)
Definition RSha256.hxx:103
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
unsigned char UChar_t
Definition RtypesCore.h:38
char Char_t
Definition RtypesCore.h:37
const Bool_t kFALSE
Definition RtypesCore.h:92
unsigned long ULong_t
Definition RtypesCore.h:55
short Color_t
Definition RtypesCore.h:83
const Bool_t kTRUE
Definition RtypesCore.h:91
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
Definition TError.cxx:220
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:187
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:231
char name[80]
Definition TGX11.cxx:110
Int_t gDebug
Definition TROOT.cxx:590
#define gROOT
Definition TROOT.h:406
char * Form(const char *fmt,...)
virtual REveElement * CloneElement() const
Clone the element via copy constructor.
Bool_t ApplyVizTag(const TString &tag, const TString &fallback_tag="")
Set the VizTag, find model-element from the VizDB and copy visualization-parameters from it.
void DecDenyDestroy()
Decreases the deny-destroy count of the element.
virtual void DestroyOrWarn()
Destroy this element. Prints a warning if deny-destroy is in force.
virtual void FillImpliedSelectedSet(Set_t &impSelSet)
Populate set impSelSet with derived / dependant elements.
const std::string & GetName() const
void SetNameTitle(const std::string &name, const std::string &title)
Set name and title of an element.
virtual void RemoveAunt(REveAunt *au)
Remove el from the list of aunts.
TString fVizTag
Element used as model from VizDB.
void SaveVizParams(std::ostream &out, const TString &tag, const TString &var)
Save visualization parameters for this element with given tag.
Int_t FindChildren(List_t &matches, const TString &name, const TClass *cls=nullptr)
Find all children with given name and append them to matches list.
REveElement * FindChild(const TString &name, const TClass *cls=nullptr)
Find the first child with given name.
TClass * IsA() const
Return class for this element.
virtual void Destroy()
Destroy this element.
virtual void PropagateVizParamsToChildren(REveElement *el=nullptr)
Propagate visualization parameters from element el (defaulting to this) to all children.
REveElement * LastChild() const
Returns the last child element or 0 if the list is empty.
virtual REveElement * GetSelectionMaster()
Returns the master element - that is:
virtual void RemoveElementsLocal()
Perform additional local removal of all elements.
virtual void AnnihilateElements()
Annihilate elements.
virtual REveTrans & RefMainTrans()
Return reference to main transformation.
void SetMainColorRGB(UChar_t r, UChar_t g, UChar_t b)
Convert RGB values to Color_t and call SetMainColor.
virtual std::string GetHighlightTooltip(const std::set< int > &) const
virtual void SetMainTransparency(Char_t t)
Set main-transparency.
virtual Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset)
Write core json.
void SetVizTag(const TString &tag)
virtual void SetTransMatrix(Double_t *carr)
Set transformation matrix from column-major array.
virtual void CopyVizParamsFromDB()
Copy visualization parameters from the model-element fVizModel.
void SetDestroyOnZeroRefCnt(Bool_t d)
Sets the state of flag determining if the element will be destroyed when reference count reaches zero...
void SetMainAlpha(Float_t alpha)
Set main-transparency via float alpha variable.
virtual void Annihilate()
Optimized destruction without check of reference-count.
virtual void PropagateMainColorToProjecteds(Color_t color, Color_t old_color)
Propagate color to projected elements.
void VizDB_Apply(const std::string &tag)
Set visual parameters for this object for given tag.
void SetupDefaultColorAndTransparency(Color_t col, Bool_t can_edit_color, Bool_t can_edit_transparency)
Set up element to use built-in main color and set flags allowing editing of main color and transparen...
const char * GetCName() const
virtual void AddElement(REveElement *el)
Add el to the list of children.
virtual void WriteVizParams(std::ostream &out, const TString &var)
Write-out visual parameters for this object.
virtual void RemoveElementLocal(REveElement *el)
Perform additional local removal of el.
void DisableListElements(Bool_t rnr_self=kFALSE, Bool_t rnr_children=kFALSE)
Disable rendering of children and their list contents.
virtual Bool_t GetRnrSelf() const
virtual void ExportToCINT(const char *var_name)
Export render-element to CINT with variable name var_name.
virtual void DestroyMainTrans()
Destroy the main transformation matrix, it will always be taken as identity.
virtual Bool_t SetRnrChildren(Bool_t rnr)
Set render state of this element's children, i.e.
void SetTitle(const std::string &title)
Set title of an element.
virtual void AnnihilateRecursively()
Protected member function called from REveElement::Annihilate().
void SetMainColorPixel(Pixel_t pixel)
Convert pixel to Color_t and call SetMainColor().
Bool_t SetVizModelByTag()
Find model element in VizDB that corresponds to previously assigned fVizTag and set fVizModel accordi...
virtual void RemoveElementsInternal()
Remove all elements.
virtual void InitMainTrans(Bool_t can_edit=kTRUE)
Initialize the main transformation to identity matrix.
Bool_t fDestroyOnZeroRefCnt
Deny-destroy count.
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 ~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:40
const char * what() const noexcept override
Definition REveTypes.hxx:48
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.
void Redraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
Bool_t InsertVizDBEntry(const TString &tag, REveElement *model, Bool_t replace, Bool_t update)
Insert a new visualization-parameter database entry.
virtual void AddProjectedsToSet(std::set< REveElement * > &set)
Add the projected elements to the set, dyn-casting them to REveElement.
virtual void PropagateVizParams(REveElement *el=nullptr)
Set visualization parameters of projecteds.
virtual void PropagateMainColor(Color_t color, Color_t old_color)
Set main color of projecteds if their color is the same as old_color.
virtual void AnnihilateProjecteds()
Optimized destroy of projected elements with condition there is only one parent for projected element...
virtual void PropagateRenderState(Bool_t rnr_self, Bool_t rnr_children)
Set render state of projecteds.
virtual void PropagateMainTransparency(Char_t t, Char_t old_t)
Set main transparency of projecteds if their transparency is the same as the old one.
REveProjectable * GetProjectable() const
REveProjectionManager Manager class for steering of projections and managing projected objects.
virtual Int_t SubImportChildren(REveElement *el, REveElement *proj_parent)
Recursively import children elements of el and apply projection to the newly imported objects.
Bool_t IsAcceptingChanges() const
Definition REveScene.hxx:97
void SceneElementRemoved(ElementId_t id)
void SceneElementChanged(REveElement *element)
void SetFrom(Double_t *carr)
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:80
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
Definition TClass.cxx:4955
Bool_t InheritsFrom(const char *cl) const
Return kTRUE if this class inherits from a class with name "classname".
Definition TClass.cxx:4851
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:2957
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:1769
Geometrical transformation package.
Definition TGeoMatrix.h:41
virtual const char * GetName() const
Returns name of object.
Definition TNamed.h:47
Bool_t MatchB(const TString &s, const TString &mods="", Int_t start=0, Int_t nMaxMatch=10)
Definition TPRegexp.h:78
Basic string class.
Definition TString.h:136
Ssiz_t Length() const
Definition TString.h:410
const char * Data() const
Definition TString.h:369
Bool_t IsNull() const
Definition TString.h:407
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2331
R__EXTERN REveManager * gEve
#define dest(otri, vertexptr)
Definition triangle.c:1040