Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TEveManager.cxx
Go to the documentation of this file.
1// @(#)root/eve:$Id$
2// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2007, 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 "TEveManager.h"
13
14#include "TEveSelection.h"
15#include "TEveViewer.h"
16#include "TEveScene.h"
17#include "TEveEventManager.h"
18#include "TEveWindowManager.h"
19
20#include "TEveBrowser.h"
21#include "TEveGedEditor.h"
22
23#include "TGStatusBar.h"
24
25#include "TGLSAViewer.h"
26
27#include "TGeoManager.h"
28#include "TGeoMatrix.h"
29#include "TObjString.h"
30#include "TROOT.h"
31#include "TFile.h"
32#include "TMap.h"
33#include "TExMap.h"
34#include "TMacro.h"
35#include "TFolder.h"
36#include "TCanvas.h"
37#include "TSystem.h"
38#include "TApplication.h"
39#include "TColor.h"
40#include "TPluginManager.h"
41#include "TPRegexp.h"
42#include "TClass.h"
43
44#include <iostream>
45#include <fstream>
46
47TEveManager *gEve = nullptr;
48
49/** \class TEveManager
50\ingroup TEve
51Central application manager for Eve.
52Manages elements, GUI, GL scenes and GL viewers.
53*/
54
56
57////////////////////////////////////////////////////////////////////////////////
58
60 fExcHandler (nullptr),
62 fGeometries (nullptr),
63 fGeometryAliases (nullptr),
64 fBrowser (nullptr),
65
66 fMacroFolder (nullptr),
67
68 fWindowManager (nullptr),
69 fViewers (nullptr),
70 fScenes (nullptr),
71 fGlobalScene (nullptr),
72 fEventScene (nullptr),
73 fCurrentEvent (nullptr),
74
80 fRedrawTimer (),
81
82 fStampedElements(nullptr),
83 fSelection (nullptr),
84 fHighlight (nullptr),
85
86 fOrphanage (nullptr),
88{
89 // Constructor.
90 // If map_window is true, the TEveBrowser window is mapped.
91 //
92 // Option string is first parsed for the following characters:
93 // V - spawn a default GL viewer.
94 //
95 // The consumed characters are removed from the options and they
96 // are passed to TEveBrowser for creation of additional plugins.
97 //
98 // Default options: "FIV" - file-browser, command-line, GL-viewer.
99
100
101 static const TEveException eh("TEveManager::TEveManager ");
102
103 if (gEve != nullptr)
104 throw(eh + "There can be only one!");
105
106 gEve = this;
107
109
110 fGeometries = new TMap; fGeometries->SetOwnerKeyValue();
111 fGeometryAliases = new TMap; fGeometryAliases->SetOwnerKeyValue();
112 fVizDB = new TMap; fVizDB->SetOwnerKeyValue();
113
115
116 fSelection = new TEveSelection("Global Selection");
117 fSelection->IncDenyDestroy();
118 fHighlight = new TEveSelection("Global Highlight");
119 fHighlight->SetHighlightMode();
120 fHighlight->IncDenyDestroy();
121
122 fOrphanage = new TEveElementList("Global Orphanage");
123 fOrphanage->IncDenyDestroy();
124
125 fRedrawTimer.Connect("Timeout()", "TEveManager", this, "DoRedraw3D()");
126 fMacroFolder = new TFolder("EVE", "Visualization macros");
127 gROOT->GetListOfBrowsables()->Add(fMacroFolder);
128
129
130 fWindowManager = new TEveWindowManager("WindowManager", "Manager of EVE windows");
131
132 // Build GUI
133 fBrowser = new TEveBrowser(w, h);
134
135 // ListTreeEditor
136 fBrowser->StartEmbedding(0);
138 fBrowser->StopEmbedding("Eve");
139 fLTEFrame->ConnectSignals();
140
141 // See how many GL viewers are requested, remove from options.
142 TString str_opt(opt);
143 TPMERegexp viewer_re("V", "g");
144 Int_t viewer_count = viewer_re.Substitute(str_opt, "", kFALSE);
145
146 // Create the main window / browse.
147 fBrowser->InitPlugins(str_opt);
148 if (map_window)
149 fBrowser->MapWindow();
150
151 // --------------------------------
152
153 fWindowManager->IncDenyDestroy();
155
156 fViewers = new TEveViewerList("Viewers");
157 fViewers->IncDenyDestroy();
159
160 fScenes = new TEveSceneList ("Scenes");
161 fScenes->IncDenyDestroy();
163
164 fGlobalScene = new TEveScene("Geometry scene");
165 fGlobalScene->IncDenyDestroy();
166 fScenes->AddElement(fGlobalScene);
167
168 fEventScene = new TEveScene("Event scene");
169 fEventScene->IncDenyDestroy();
170 fScenes->AddElement(fEventScene);
171
172 for (Int_t vc = 0; vc < viewer_count; ++vc)
173 {
174 TEveViewer* v = SpawnNewViewer(Form("Viewer %d", vc+1));
175 v->AddScene(fGlobalScene);
176 v->AddScene(fEventScene);
177 }
178
179 if (GetDefaultViewer())
180 {
182 }
183
184 gSystem->ProcessEvents();
185}
186
187////////////////////////////////////////////////////////////////////////////////
188/// Destructor.
189
191{
192 // Stop timer and deny further redraw requests.
193 fRedrawTimer.Stop();
195
196 delete fCurrentEvent;
197 fCurrentEvent = nullptr;
198
199 fGlobalScene->DecDenyDestroy();
200 fEventScene->DecDenyDestroy();
201 fScenes->DestroyScenes();
202 fScenes->DecDenyDestroy();
203 fScenes->Destroy();
204 fScenes = nullptr;
205
206 fViewers->DestroyElements();
207 fViewers->DecDenyDestroy();
208 fViewers->Destroy();
209 fViewers = nullptr;
210
211 fWindowManager->DestroyWindows();
212 fWindowManager->DecDenyDestroy();
213 fWindowManager->Destroy();
214 fWindowManager = nullptr;
215
216 fOrphanage->DecDenyDestroy();
217 fHighlight->DecDenyDestroy();
218 fSelection->DecDenyDestroy();
219
220 gROOT->GetListOfBrowsables()->Remove(fMacroFolder);
221 delete fMacroFolder;
222
223 delete fGeometryAliases;
224 delete fGeometries;
225 delete fVizDB;
226 delete fExcHandler;
227 delete fStampedElements;
228
229 fLTEFrame->DeleteWindow();
230
231 fBrowser->DontCallClose();
232 fBrowser->TRootBrowser::CloseWindow();
233}
234
235////////////////////////////////////////////////////////////////////////////////
236/// Clear the orphanage.
237
239{
240 Bool_t old_state = fUseOrphanage;
242 fOrphanage->DestroyElements();
243 fUseOrphanage = old_state;
244}
245
246////////////////////////////////////////////////////////////////////////////////
247/// Get the main window, i.e. EVE-browser.
248
250{
251 return fBrowser;
252}
253
254////////////////////////////////////////////////////////////////////////////////
255/// Returns the default viewer - the first one in the fViewers list.
256
258{
259 return dynamic_cast<TEveViewer*>(fViewers->FirstChild());
260}
261
262////////////////////////////////////////////////////////////////////////////////
263/// Get TGLViewer of the default TEveViewer.
264
266{
268 return ev ? ev->GetGLViewer() : nullptr;
269}
270
271////////////////////////////////////////////////////////////////////////////////
272/// Returns main object editor.
273
275{
276 return fLTEFrame->GetEditor();
277}
278
279////////////////////////////////////////////////////////////////////////////////
280/// Returns main window status bar.
281
283{
284 return fBrowser->GetStatusBar();
285}
286
287////////////////////////////////////////////////////////////////////////////////
288/// Add a new canvas tab.
289
291{
292 fBrowser->StartEmbedding(1, -1);
293 TCanvas* c = new TCanvas;
294 fBrowser->StopEmbedding(name);
295
296 return c;
297}
298
299////////////////////////////////////////////////////////////////////////////////
300/// Create a new GL viewer.
301
302TEveViewer* TEveManager::SpawnNewViewer(const char* name, const char* title,
303 Bool_t embed)
304{
305 TEveWindowSlot* slot = nullptr;
306 if (embed)
307 {
308 slot = fWindowManager->GetCurrentWindowAsSlot();
309 if (slot == nullptr)
310 {
311 // In principle should have some default/current container
312 // in TEveWindowManager.
313 // Also to store closed windows.
314 slot = TEveWindow::CreateWindowInTab(fBrowser->GetTabRight());
315 fBrowser->SanitizeTabCounts();
316 }
317 }
318 else
319 {
321 }
322
323 TEveViewer* v = new TEveViewer(name, title);
324 v->SpawnGLViewer(embed ? GetEditor() : nullptr);
325
326 slot->ReplaceWindow(v);
327
328 fViewers->AddElement(v);
329
330 return v;
331}
332
333////////////////////////////////////////////////////////////////////////////////
334/// Create a new scene.
335
336TEveScene* TEveManager::SpawnNewScene(const char* name, const char* title)
337{
338 TEveScene* s = new TEveScene(name, title);
340 return s;
341}
342
343////////////////////////////////////////////////////////////////////////////////
344/// Find macro in fMacroFolder by name.
345
347{
348 return dynamic_cast<TMacro*>(fMacroFolder->FindObject(name));
349}
350
351////////////////////////////////////////////////////////////////////////////////
352/// Show element in default editor.
353
355{
356 static const TEveException eh("TEveManager::EditElement ");
357
358 GetEditor()->DisplayElement(element);
359}
360
361////////////////////////////////////////////////////////////////////////////////
362/// Register a request for 3D redraw.
363
369
370////////////////////////////////////////////////////////////////////////////////
371/// Perform 3D redraw of scenes and viewers whose contents has
372/// changed.
373
375{
376 static const TEveException eh("TEveManager::DoRedraw3D ");
377
378 // printf("TEveManager::DoRedraw3D redraw triggered\n");
379
380 // Process element visibility changes, mark relevant scenes as changed.
381 {
382 TEveElement::List_t scenes;
383 Long64_t key, value;
384 TExMapIter stamped_elements(fStampedElements);
385 while (stamped_elements.Next(key, value))
386 {
387 TEveElement *el = reinterpret_cast<TEveElement*>(key);
389 {
390 el->CollectSceneParents(scenes);
391 }
392 }
393 ScenesChanged(scenes);
394 }
395
396 // Process changes in scenes.
397 fScenes ->ProcessSceneChanges(fDropLogicals, fStampedElements);
398 fViewers->RepaintChangedViewers(fResetCameras, fDropLogicals);
399
400 // Process changed elements again, update GUI (just editor so far,
401 // but more can come).
402 {
403 Long64_t key, value;
404 TExMapIter stamped_elements(fStampedElements);
405 while (stamped_elements.Next(key, value))
406 {
407 TEveElement *el = reinterpret_cast<TEveElement*>(key);
408 if (GetEditor()->GetModel() == el->GetEditorObject(eh))
409 EditElement(el);
411
412 el->ClearStamps();
413 }
414 }
415 fStampedElements->Delete();
416 GetListTree()->ClearViewPort(); // Fix this when several list-trees can be added.
417
420
422}
423
424////////////////////////////////////////////////////////////////////////////////
425/// Perform 3D redraw of all scenes and viewers.
426
427void TEveManager::FullRedraw3D(Bool_t resetCameras, Bool_t dropLogicals)
428{
429 fScenes ->RepaintAllScenes (dropLogicals);
430 fViewers->RepaintAllViewers(resetCameras, dropLogicals);
431}
432
433////////////////////////////////////////////////////////////////////////////////
434/// Element was changed, perform framework side action.
435/// Called from TEveElement::ElementChanged().
436
437void TEveManager::ElementChanged(TEveElement* element, Bool_t update_scenes, Bool_t redraw)
438{
439 static const TEveException eh("TEveElement::ElementChanged ");
440
441 if (GetEditor()->GetModel() == element->GetEditorObject(eh))
442 EditElement(element);
444
445 if (update_scenes) {
446 TEveElement::List_t scenes;
447 element->CollectSceneParents(scenes);
448 ScenesChanged(scenes);
449 }
450
451 if (redraw)
452 Redraw3D();
453}
454
455////////////////////////////////////////////////////////////////////////////////
456/// Mark all scenes from the given list as changed.
457
459{
460 for (TEveElement::List_i s=scenes.begin(); s!=scenes.end(); ++s)
461 ((TEveScene*)*s)->Changed();
462}
463
464////////////////////////////////////////////////////////////////////////////////
465/// Mark element as changed -- it will be processed on next redraw.
466
468{
469 UInt_t slot;
470 if (fStampedElements->GetValue((ULong64_t) element, (Long64_t) element, slot) == 0)
471 {
472 fStampedElements->AddAt(slot, (ULong64_t) element, (Long64_t) element, 1);
473 }
474}
475
476////////////////////////////////////////////////////////////////////////////////
477/// Get default list-tree widget.
478
480{
481 return fLTEFrame->fListTree;
482}
483
486{
487 // Add element as a top-level to a list-tree.
488 // Only add a single copy of a render-element as a top level.
489
490 if (lt == nullptr) lt = GetListTree();
491 TGListTreeItem* lti = re->AddIntoListTree(lt, (TGListTreeItem*)nullptr);
492 if (open) lt->OpenItem(lti);
493 return lti;
494}
495
496////////////////////////////////////////////////////////////////////////////////
497/// Remove top-level element from list-tree with specified tree-item.
498
500 TGListTree* lt, TGListTreeItem* lti)
501{
502 static const TEveException eh("TEveManager::RemoveFromListTree ");
503
504 if (lti->GetParent())
505 throw(eh + "not a top-level item.");
506
507 element->RemoveFromListTree(lt, nullptr);
508}
509
510////////////////////////////////////////////////////////////////////////////////
511/// Add a new event and make it the current event.
512/// It is added into the event-scene and as a top-level list-tree
513/// item.
514
516{
517 fCurrentEvent = event;
518 fCurrentEvent->IncDenyDestroy();
520 return AddToListTree(event, kTRUE);
521}
522
523////////////////////////////////////////////////////////////////////////////////
524/// Add an element. If parent is not specified it is added into
525/// current event (which is created if does not exist).
526
528{
529 if (parent == nullptr) {
530 if (fCurrentEvent == nullptr)
531 AddEvent(new TEveEventManager("Event", "Auto-created event directory"));
532 parent = fCurrentEvent;
533 }
534
535 parent->AddElement(element);
536}
537
538////////////////////////////////////////////////////////////////////////////////
539/// Add a global element, i.e. one that does not change on each
540/// event, like geometry or projection manager.
541/// If parent is not specified it is added to a global scene.
542
544{
545 if (parent == nullptr)
546 parent = fGlobalScene;
547
548 parent->AddElement(element);
549}
550
551////////////////////////////////////////////////////////////////////////////////
552/// Remove element from parent.
553
555 TEveElement* parent)
556{
557 parent->RemoveElement(element);
558}
559
560////////////////////////////////////////////////////////////////////////////////
561/// Called from TEveElement prior to its destruction so the
562/// framework components (like object editor) can unreference it.
563
565{
566 if (GetEditor()->GetEveElement() == element)
567 EditElement(nullptr);
569
570 if (fScenes)
571 fScenes->DestroyElementRenderers(element);
572
573 if (fStampedElements->GetValue((ULong64_t) element, (Long64_t) element) != 0)
574 fStampedElements->Remove((ULong64_t) element, (Long64_t) element);
575
576 if (element->fImpliedSelected > 0)
577 fSelection->RemoveImpliedSelected(element);
578 if (element->fImpliedHighlighted > 0)
579 fHighlight->RemoveImpliedSelected(element);
580}
581
582////////////////////////////////////////////////////////////////////////////////
583/// Select an element.
584/// Now it only calls EditElement() - should also update selection state.
585
587{
588 if (element != nullptr)
589 EditElement(element);
590}
591
592////////////////////////////////////////////////////////////////////////////////
593/// Paste has been called.
594
596{
597 // The object to paste is taken from the editor (this is not
598 // exactly right) and handed to 'element' for pasting.
599
601 if (src)
602 return element->HandleElementPaste(src);
603 return kFALSE;
604}
605
606////////////////////////////////////////////////////////////////////////////////
607/// Insert a new visualization-parameter database entry. Returns
608/// true if the element is inserted successfully.
609/// If entry with the same key already exists the behaviour depends on the
610/// 'replace' flag:
611/// - true - The old model is deleted and new one is inserted (default).
612/// Clients of the old model are transferred to the new one and
613/// if 'update' flag is true (default), the new model's parameters
614/// are assigned to all clients.
615/// - false - The old model is kept, false is returned.
616///
617/// If insert is successful, the ownership of the model-element is
618/// transferred to the manager.
619
621 Bool_t replace, Bool_t update)
622{
623 TPair* pair = (TPair*) fVizDB->FindObject(tag);
624 if (pair)
625 {
626 if (replace)
627 {
628 model->IncDenyDestroy();
629 model->SetRnrChildren(kFALSE);
630
631 TEveElement* old_model = dynamic_cast<TEveElement*>(pair->Value());
632 if (old_model)
633 {
634 while (old_model->HasChildren())
635 {
636 TEveElement *el = old_model->FirstChild();
637 el->SetVizModel(model);
638 if (update)
639 {
640 el->CopyVizParams(model);
642 }
643 }
644 old_model->DecDenyDestroy();
645 }
646 pair->SetValue(dynamic_cast<TObject*>(model));
647 return kTRUE;
648 }
649 else
650 {
651 return kFALSE;
652 }
653 }
654 else
655 {
656 model->IncDenyDestroy();
657 model->SetRnrChildren(kFALSE);
658 fVizDB->Add(new TObjString(tag), dynamic_cast<TObject*>(model));
659 return kTRUE;
660 }
661}
662
663////////////////////////////////////////////////////////////////////////////////
664/// Insert a new visualization-parameter database entry with the default
665/// parameters for replace and update, as specified by members
666/// fVizDBReplace(default=kTRUE) and fVizDBUpdate(default=kTRUE).
667/// See docs of the above function.
668
673
674////////////////////////////////////////////////////////////////////////////////
675/// Find a visualization-parameter database entry corresponding to tag.
676/// If the entry is not found 0 is returned.
677
679{
680 return dynamic_cast<TEveElement*>(fVizDB->GetValue(tag));
681}
682
683////////////////////////////////////////////////////////////////////////////////
684/// Load visualization-parameter database from file filename. The
685/// replace, update arguments replace the values of fVizDBReplace
686/// and fVizDBUpdate members for the duration of the macro
687/// execution.
688
690{
691 Bool_t ex_replace = fVizDBReplace;
692 Bool_t ex_update = fVizDBUpdate;
693 fVizDBReplace = replace;
695
697
698 fVizDBReplace = ex_replace;
699 fVizDBUpdate = ex_update;
700}
701
702////////////////////////////////////////////////////////////////////////////////
703/// Load visualization-parameter database from file filename.
704/// State of data-members fVizDBReplace and fVizDBUpdate determine
705/// how the registered entries are handled.
706
712
713////////////////////////////////////////////////////////////////////////////////
714/// Save visualization-parameter database to file filename.
715
717{
718 TPMERegexp re("(.+)\\.\\w+");
719 if (re.Match(filename) != 2) {
720 Error("SaveVizDB", "filename does not match required format '(.+)\\.\\w+'.");
721 return;
722 }
723
724 TString exp_filename(filename);
725 gSystem->ExpandPathName(exp_filename);
726
727 std::ofstream out(exp_filename, std::ios::out | std::ios::trunc);
728 out << "void " << re[1] << "()\n";
729 out << "{\n";
730 out << " TEveManager::Create();\n";
731
733
734 Int_t var_id = 0;
735 TString var_name;
736 TIter next(fVizDB);
737 TObjString *key;
738 while ((key = (TObjString*)next()))
739 {
740 TEveElement* mdl = dynamic_cast<TEveElement*>(fVizDB->GetValue(key));
741 if (mdl)
742 {
743 var_name.Form("x%03d", var_id++);
744 mdl->SaveVizParams(out, key->String(), var_name);
745 }
746 else
747 {
748 Warning("SaveVizDB", "Saving failed for key '%s'.", key->String().Data());
749 }
750 }
751
752 out << "}\n";
753 out.close();
754}
755
756////////////////////////////////////////////////////////////////////////////////
757/// Get geometry with given filename.
758/// This is cached internally so the second time this function is
759/// called with the same argument the same geo-manager is returned.
760/// gGeoManager is set to the return value.
761
763{
764 static const TEveException eh("TEveManager::GetGeometry ");
765
766 TString exp_filename = filename;
767 gSystem->ExpandPathName(exp_filename);
768 printf("%s loading: '%s' -> '%s'.\n", eh.Data(),
769 filename.Data(), exp_filename.Data());
770
772 if (gGeoManager)
773 {
774 gGeoIdentity = (TGeoIdentity*) gGeoManager->GetListOfMatrices()->At(0);
775 }
776 else
777 {
778 Bool_t locked = TGeoManager::IsLocked();
779 if (locked) {
780 Warning(eh, "TGeoManager is locked ... unlocking it.");
782 }
783 if (TGeoManager::Import(filename) == nullptr) {
784 throw(eh + "TGeoManager::Import() failed for '" + exp_filename + "'.");
785 }
786 if (locked) {
788 }
789
790 gGeoManager->GetTopVolume()->VisibleDaughters(true);
791
792 // Import colors exported by Gled, if they exist.
793 {
794 TFile f(exp_filename, "READ");
795 TObjArray* collist = (TObjArray*) f.Get("ColorList");
796 f.Close();
797 if (collist != nullptr) {
798 TIter next(gGeoManager->GetListOfVolumes());
799 TGeoVolume* vol;
800 while ((vol = (TGeoVolume*) next()) != nullptr)
801 {
802 Int_t oldID = vol->GetLineColor();
803 TColor* col = (TColor*)collist->At(oldID);
804 Float_t r, g, b;
805 col->GetRGB(r, g, b);
806 Int_t newID = TColor::GetColor(r,g,b);
807 vol->SetLineColor(newID);
808 }
809 }
810 }
811
813 }
814 return gGeoManager;
815}
816
817////////////////////////////////////////////////////////////////////////////////
818/// Get geometry with given alias.
819/// The alias must be registered via RegisterGeometryAlias().
820
822{
823 static const TEveException eh("TEveManager::GetGeometry ");
824
825 TObjString* full_name = (TObjString*) fGeometryAliases->GetValue(alias);
826 if (!full_name)
827 throw(eh + "geometry alias '" + alias + "' not registered.");
828 return GetGeometry(full_name->String());
829}
830
831////////////////////////////////////////////////////////////////////////////////
832/// Get the default geometry.
833/// It should be registered via RegisterGeometryName("Default", `<URL>`).
834
839
840////////////////////////////////////////////////////////////////////////////////
841/// Register 'name' as an alias for geometry file 'filename'.
842/// The old aliases are silently overwritten.
843/// After that the geometry can be retrieved also by calling:
844/// gEve->GetGeometryByName(name);
845
847{
848 fGeometryAliases->Add(new TObjString(alias), new TObjString(filename));
849}
850
851////////////////////////////////////////////////////////////////////////////////
852/// Set the text in the right side of browser's status bar.
853
855{
856 fBrowser->SetStatusText(text, 1);
857}
858
859////////////////////////////////////////////////////////////////////////////////
860/// Work-around uber ugly hack used in SavePrimitive and co.
861
863{
864 gROOT->ResetClassSaved();
865}
866
867////////////////////////////////////////////////////////////////////////////////
868/// Close button has been clicked on EVE main window (browser).
869/// Cleanup and terminate application.
870
872{
874 TEveBrowser *eb = dynamic_cast<TEveBrowser*>(mf);
875 if (eb == fBrowser)
876 {
877 mf->DontCallClose();
878 Terminate();
879 gApplication->Terminate();
880 }
881}
882
883////////////////////////////////////////////////////////////////////////////////
884/// If global TEveManager* gEve is not set initialize it.
885/// Returns gEve.
886
888{
889 static const TEveException eh("TEveManager::Create ");
890
891 if (gEve == nullptr)
892 {
893 // Make sure that the GUI system is initialized.
894 if (gROOT->IsBatch())
895 {
896 throw eh + "ROOT is running in batch mode.";
897 }
899 gApplication->InitializeGraphics();
900 if (gROOT->IsBatch() || gClient == nullptr || gClient->IsZombie())
901 {
902 throw eh + "window system not initialized.";
903 }
904
905 Int_t w = 1024;
906 Int_t h = 768;
907
910 gEve = new TEveManager(w, h, map_window, opt);
911 }
912 return gEve;
913}
914
915////////////////////////////////////////////////////////////////////////////////
916/// Properly terminate global TEveManager.
917
919{
920 if (!gEve) return;
921
923
924 delete gEve;
925 gEve = nullptr;
926}
927
928/** \class TEveManager::TExceptionHandler
929\ingroup TEve
930Exception handler for Eve exceptions.
931*/
932
934
935////////////////////////////////////////////////////////////////////////////////
936/// Handle exceptions deriving from TEveException.
937
940{
941 TEveException* ex = dynamic_cast<TEveException*>(&exc);
942 if (ex) {
943 Info("Handle", "%s", ex->Data());
944 gEve->SetStatusLine(ex->Data());
945 gSystem->Beep();
946 return kSEHandled;
947 } else {
948 return kSEProceed;
949 }
950}
#define b(i)
Definition RSha256.hxx:100
#define f(i)
Definition RSha256.hxx:104
#define c(i)
Definition RSha256.hxx:101
#define g(i)
Definition RSha256.hxx:105
#define h(i)
Definition RSha256.hxx:106
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
unsigned int UInt_t
Definition RtypesCore.h:46
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
long long Long64_t
Definition RtypesCore.h:80
unsigned long long ULong64_t
Definition RtypesCore.h:81
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:377
R__EXTERN TApplication * gApplication
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
R__EXTERN TEveManager * gEve
#define gClient
Definition TGClient.h:156
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 ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void w
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 value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
Option_t Option_t TPoint TPoint const char text
char name[80]
Definition TGX11.cxx:110
R__EXTERN TGeoManager * gGeoManager
R__EXTERN TGeoIdentity * gGeoIdentity
Definition TGeoMatrix.h:537
R__EXTERN void * gTQSender
Definition TQObject.h:46
#define gROOT
Definition TROOT.h:414
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2489
R__EXTERN TSystem * gSystem
Definition TSystem.h:566
static void NeedGraphicsLibs()
Static method.
virtual Color_t GetLineColor() const
Return the line color.
Definition TAttLine.h:33
The Canvas class.
Definition TCanvas.h:23
The color creation and management class.
Definition TColor.h:21
virtual void GetRGB(Float_t &r, Float_t &g, Float_t &b) const
Definition TColor.h:54
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
Specialization of TRootBrowser for Eve.
A list of TEveElements.
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition TEveElement.h:36
void SaveVizParams(std::ostream &out, const TString &tag, const TString &var)
Save visualization parameters for this element with given tag.
virtual void AddElement(TEveElement *el)
Add el to the list of children.
virtual TObject * GetEditorObject(const TEveException &eh) const
TEveElement * FirstChild() const
Returns the first child element or 0 if the list is empty.
void DecDenyDestroy()
Decreases the deny-destroy count of the element.
Bool_t HasChildren() const
Short_t fImpliedHighlighted
virtual void PropagateVizParamsToProjecteds()
Propagate visualization parameters to dependent elements.
virtual void CollectSceneParents(List_t &scenes)
Collect all parents of class TEveScene.
std::list< TEveElement * > List_t
Definition TEveElement.h:71
void IncDenyDestroy()
Increases the deny-destroy count of the element.
virtual Bool_t SetRnrChildren(Bool_t rnr)
Set render state of this element's children, i.e.
Short_t fImpliedSelected
virtual TGListTreeItem * AddIntoListTree(TGListTree *ltree, TGListTreeItem *parent_lti)
Add this element into ltree to an already existing item parent_lti.
void SetVizModel(TEveElement *model)
Set visualization-parameter model element.
virtual void RemoveElement(TEveElement *el)
Remove el from the list of children.
virtual Bool_t HandleElementPaste(TEveElement *el)
React to element being pasted or dnd-ed.
virtual void CopyVizParams(const TEveElement *el)
Copy visualization parameters from element el.
virtual void ClearStamps()
List_t::iterator List_i
Definition TEveElement.h:72
virtual Bool_t RemoveFromListTree(TGListTree *ltree, TGListTreeItem *parent_lti)
Remove element from list-tree 'ltree' where its parent item is 'parent_lti'.
UChar_t GetChangeBits() const
Base class for event management and navigation.
Exception class thrown by TEve classes and macros.
Definition TEveUtil.h:102
Composite GUI frame for parallel display of a TGListTree and TEveGedEditor.
Definition TEveBrowser.h:83
Specialization of TGedEditor for proper update propagation to TEveManager.
TEveElement * GetEveElement() const
Return eve-element if it is the model object.
static void ElementDeleted(TEveElement *el)
Element is being deleted. Close editors showing it.
void DisplayElement(TEveElement *re)
Show a TEveElement in editor.
static void DestroyEditors()
Destroys all editors. Called from EVE termination.
static void ElementChanged(TEveElement *el)
Element was changed. Update editors showing it.
Exception handler for Eve exceptions.
Definition TEveManager.h:72
EStatus Handle(std::exception &exc) override
Handle exceptions deriving from TEveException.
Central application manager for Eve.
Definition TEveManager.h:50
TMap * fVizDB
Definition TEveManager.h:85
void AddElement(TEveElement *element, TEveElement *parent=nullptr)
Add an element.
TEveWindowManager * fWindowManager
Definition TEveManager.h:97
Int_t fRedrawDisabled
void AddGlobalElement(TEveElement *element, TEveElement *parent=nullptr)
Add a global element, i.e.
void DoRedraw3D()
Perform 3D redraw of scenes and viewers whose contents has changed.
void ClearOrphanage()
Clear the orphanage.
void SetStatusLine(const char *text)
Set the text in the right side of browser's status bar.
TGStatusBar * GetStatusBar() const
Returns main window status bar.
TEveViewerList * fViewers
Definition TEveManager.h:98
TGListTree * GetListTree() const
Get default list-tree widget.
TEveElementList * fOrphanage
TGeoManager * GetDefaultGeometry()
Get the default geometry.
TTimer fRedrawTimer
void RegisterRedraw3D()
Register a request for 3D redraw.
TEveSelection * fSelection
Bool_t fDropLogicals
Bool_t fTimerActive
static void Terminate()
Properly terminate global TEveManager.
void CloseEveWindow()
Close button has been clicked on EVE main window (browser).
void ClearROOTClassSaved()
Work-around uber ugly hack used in SavePrimitive and co.
void PreDeleteElement(TEveElement *element)
Called from TEveElement prior to its destruction so the framework components (like object editor) can...
TEveGListTreeEditorFrame * fLTEFrame
Definition TEveManager.h:93
Bool_t fVizDBUpdate
Definition TEveManager.h:87
TGeoManager * GetGeometryByAlias(const TString &alias)
Get geometry with given alias.
void ScenesChanged(TEveElement::List_t &scenes)
Mark all scenes from the given list as changed.
TGLViewer * GetDefaultGLViewer() const
Get TGLViewer of the default TEveViewer.
TEveViewer * GetDefaultViewer() const
Returns the default viewer - the first one in the fViewers list.
TCanvas * AddCanvasTab(const char *name)
Add a new canvas tab.
TExceptionHandler * fExcHandler
Definition TEveManager.h:83
Bool_t fKeepEmptyCont
TEveScene * fGlobalScene
Bool_t ElementPaste(TEveElement *element)
Paste has been called.
void ElementChanged(TEveElement *element, Bool_t update_scenes=kTRUE, Bool_t redraw=kFALSE)
Element was changed, perform framework side action.
void ElementSelect(TEveElement *element)
Select an element.
virtual ~TEveManager()
Destructor.
void EditElement(TEveElement *element)
Show element in default editor.
TEveBrowser * fBrowser
Definition TEveManager.h:92
Bool_t InsertVizDBEntry(const TString &tag, TEveElement *model, Bool_t replace, Bool_t update)
Insert a new visualization-parameter database entry.
void RemoveElement(TEveElement *element, TEveElement *parent)
Remove element from parent.
TEveManager(const TEveManager &)
void RegisterGeometryAlias(const TString &alias, const TString &filename)
Register 'name' as an alias for geometry file 'filename'.
TEveSelection * fHighlight
TEveGedEditor * GetEditor() const
Returns main object editor.
TEveScene * fEventScene
void SaveVizDB(const TString &filename)
Save visualization-parameter database to file filename.
TEveViewer * SpawnNewViewer(const char *name, const char *title="", Bool_t embed=kTRUE)
Create a new GL viewer.
TEveElement * FindVizDBEntry(const TString &tag)
Find a visualization-parameter database entry corresponding to tag.
static TEveManager * Create(Bool_t map_window=kTRUE, Option_t *opt="FIV")
If global TEveManager* gEve is not set initialize it.
TGListTreeItem * AddToListTree(TEveElement *re, Bool_t open, TGListTree *lt=nullptr)
TMacro * GetMacro(const char *name) const
Find macro in fMacroFolder by name.
void FullRedraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
Perform 3D redraw of all scenes and viewers.
TGListTreeItem * AddEvent(TEveEventManager *event)
Add a new event and make it the current event.
void Redraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
Bool_t fVizDBReplace
Definition TEveManager.h:86
TFolder * fMacroFolder
Definition TEveManager.h:95
TEveSceneList * fScenes
Definition TEveManager.h:99
TExMap * fStampedElements
Bool_t fResetCameras
void RemoveFromListTree(TEveElement *element, TGListTree *lt, TGListTreeItem *lti)
Remove top-level element from list-tree with specified tree-item.
TGWindow * GetMainWindow() const
Get the main window, i.e. EVE-browser.
void LoadVizDB(const TString &filename, Bool_t replace, Bool_t update)
Load visualization-parameter database from file filename.
TMap * fGeometryAliases
Definition TEveManager.h:90
TGeoManager * GetGeometry(const TString &filename)
Get geometry with given filename.
TEveScene * SpawnNewScene(const char *name, const char *title="")
Create a new scene.
TMap * fGeometries
Definition TEveManager.h:89
Bool_t fUseOrphanage
void ElementStamped(TEveElement *element)
Mark element as changed – it will be processed on next redraw.
TEveEventManager * fCurrentEvent
List of Scenes providing common operations on TEveScene collections.
Definition TEveScene.h:80
Eve representation of TGLScene.
Definition TEveScene.h:27
Make sure there is a SINGLE running TEveSelection for each selection type (select/highlight).
static void Macro(const char *mac)
Execute macro 'mac'. Do not reload the macro.
Definition TEveUtil.cxx:164
static void SetupGUI()
Setup icon pictures and mime-types.
Definition TEveUtil.cxx:93
static void SetupEnvironment()
Setup Include and Macro paths.
Definition TEveUtil.cxx:50
List of Viewers providing common operations on TEveViewer collections.
Definition TEveViewer.h:80
Eve representation of TGLViewer.
Definition TEveViewer.h:31
TGLViewer * GetGLViewer() const
Definition TEveViewer.h:51
Manager for EVE windows.
Description of TEveWindowSlot.
Definition TEveWindow.h:302
static TEveWindowSlot * CreateWindowMainFrame(TEveWindow *eve_parent=nullptr)
Create a new main-frame and populate it with a default window-slot.
void ReplaceWindow(TEveWindow *w)
Replace this window with the passed one.
static TEveWindowSlot * CreateWindowInTab(TGTab *tab, TEveWindow *eve_parent=nullptr)
Create a new tab in a given tab-widget and populate it with a default window-slot.
Bool_t Next(ULong64_t &hash, Long64_t &key, Long64_t &value)
Get next entry from TExMap. Returns kFALSE at end of map.
Definition TExMap.cxx:412
This class stores a (key,value) pair using an external hash.
Definition TExMap.h:33
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
Definition TFile.h:53
<div class="legacybox"><h2>Legacy Code</h2> TFolder is a legacy interface: there will be no bug fixes...
Definition TFolder.h:30
virtual void ClearViewPort()
Clear view port and redraw full content.
Definition TGCanvas.cxx:891
Base GL viewer object - used by both standalone and embedded (in pad) GL.
Definition TGLViewer.h:55
TGListTreeItem * GetParent() const
Definition TGListTree.h:58
A list tree is a widget that can contain a number of items arranged in a tree structure.
Definition TGListTree.h:195
void OpenItem(TGListTreeItem *item)
Open item in list tree (i.e. show child items).
Defines top level windows that interact with the system Window Manager.
Definition TGFrame.h:397
void DontCallClose()
Typically call this method in the slot connected to the CloseWindow() signal to prevent the calling o...
Definition TGFrame.cxx:1780
Provides a StatusBar widget.
Definition TGStatusBar.h:21
ROOT GUI Window base class.
Definition TGWindow.h:23
An identity transformation.
Definition TGeoMatrix.h:406
The manager class for any TGeo geometry.
Definition TGeoManager.h:44
static void UnlockGeometry()
Unlock current geometry.
static Bool_t IsLocked()
Check lock state.
static TGeoManager * Import(const char *filename, const char *name="", Option_t *option="")
static function Import a geometry from a gdml or ROOT file
static void LockGeometry()
Lock current geometry so that no other geometry can be imported.
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition TGeoVolume.h:43
void SetLineColor(Color_t lcolor) override
Set the line color.
Class supporting a collection of lines with C++ code.
Definition TMacro.h:31
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition TMap.h:40
An array of TObjects.
Definition TObjArray.h:31
TObject * At(Int_t idx) const override
Definition TObjArray.h:164
Collectable string class.
Definition TObjString.h:28
TString & String()
Definition TObjString.h:48
Mother of all ROOT objects.
Definition TObject.h:41
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition TObject.cxx:961
Wrapper for PCRE library (Perl Compatible Regular Expressions).
Definition TPRegexp.h:97
Int_t Substitute(TString &s, const TString &r, Bool_t doDollarSubst=kTRUE)
Substitute matching part of s with r, dollar back-ref substitution is performed if doDollarSubst is t...
Definition TPRegexp.cxx:963
Int_t Match(const TString &s, UInt_t start=0)
Runs a match on s against the regex 'this' was created with.
Definition TPRegexp.cxx:797
Class used by TMap to store (key,value) pairs.
Definition TMap.h:102
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:376
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition TString.cxx:2356
STL class.
Double_t ex[n]
Definition legend1.C:17