Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RGeoPainter.cxx
Go to the documentation of this file.
1// Author: Sergey Linev, 27.02.2020
2
3/*************************************************************************
4 * Copyright (C) 1995-2023, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11#include <ROOT/RGeoPainter.hxx>
12
13#include "TGeoVolume.h"
14#include "TGeoManager.h"
15#include "TVirtualPad.h"
16
17using namespace ROOT;
18
20{
22 fGeoManager = manager;
23}
24
26
28{
29 fTopVisible = on ? 1 : 0;
30}
31
33{
34 if (fViewer && (fGeoManager != mgr))
35 fViewer->SetGeometry(fGeoManager);
36
37 fGeoManager = mgr;
38}
39
41{
42 if (gPad) {
43 auto g = vol->GetGeoManager();
44
45 // append volume or geomanager itself to the pad, web canvas also support geometry drawing now
46 if (g && (g->GetTopVolume() == vol))
47 g->AppendPad(opt);
48 else
49 vol->AppendPad(opt);
50
51 return;
52 }
53
54 if (!fViewer)
55 fViewer = std::make_shared<RGeomViewer>(fGeoManager);
56
57 // select volume to draw
58 fViewer->SetGeometry(fGeoManager, vol->GetName());
59
60 std::string drawopt = "";
61 if (opt && strstr(opt, "s"))
62 drawopt = "wire";
63
64 // specify JSROOT draw options - here clipping on X,Y,Z axes
65 fViewer->SetDrawOptions(drawopt);
66
67 if (fTopVisible >= 0)
68 fViewer->SetTopVisible(fTopVisible > 0);
69
70 // set default limits for number of visible nodes and faces
71 // when viewer created, initial values exported from TGeoManager
72 // viewer->SetLimits();
73
74 // start browser
75 fViewer->Show();
76}
#define g(i)
Definition RSha256.hxx:105
const char Option_t
Definition RtypesCore.h:66
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
#define gPad
void DrawVolume(TGeoVolume *, Option_t *="") override
std::shared_ptr< RGeomViewer > fViewer
void SetTopVisible(Bool_t on=kTRUE) override
Int_t fTopVisible
! is s
~RGeoPainter() override
void SetGeoManager(TGeoManager *) override
RGeoPainter(TGeoManager *manager)
TGeoManager * fGeoManager
The manager class for any TGeo geometry.
Definition TGeoManager.h:44
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition TGeoVolume.h:43
TGeoManager * GetGeoManager() const
Definition TGeoVolume.h:173
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
Definition TObject.cxx:184
Abstract class for geometry painters.
static void SetPainter(const TVirtualGeoPainter *painter)
Static function to set an alternative histogram painter.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...