Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RGeoPainter.cxx
Go to the documentation of this file.
1// @(#)root/eve7:$Id$
2// Author: Sergey Linev, 27.02.2020
3
4/*************************************************************************
5 * Copyright (C) 1995-2020, 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/RGeoPainter.hxx>
13
14#include "TGeoVolume.h"
15#include "TGeoManager.h"
16#include "TVirtualPad.h"
17
18using namespace ROOT::Experimental;
19
21{
23 fGeoManager = manager;
24}
25
27{
28}
29
31{
32 fTopVisible = on ? 1 : 0;
33}
34
35
37{
38 if (fViewer && (fGeoManager != mgr))
39 fViewer->SetGeometry(fGeoManager);
40
41 fGeoManager = mgr;
42}
43
45{
46 if (gPad) {
47 auto g = vol->GetGeoManager();
48
49 // append volume or geomanager itself to the pad, web canvas also support geometry drawing now
50 if (g && (g->GetTopVolume() == vol))
51 g->AppendPad(opt);
52 else
53 vol->AppendPad(opt);
54
55 return;
56 }
57
58
59 if (!fViewer)
60 fViewer = std::make_shared<RGeomViewer>(fGeoManager);
61
62 // select volume to draw
63 fViewer->SetGeometry(fGeoManager, vol->GetName());
64
65 std::string drawopt = "";
66 if (opt && strstr(opt,"s"))
67 drawopt = "wire";
68
69 // specify JSROOT draw options - here clipping on X,Y,Z axes
70 fViewer->SetDrawOptions(drawopt);
71
72 if (fTopVisible >= 0)
73 fViewer->SetTopVisible(fTopVisible > 0);
74
75
76 // set default limits for number of visible nodes and faces
77 // when viewer created, initial values exported from TGeoManager
78 // viewer->SetLimits();
79
80 // start browser
81 fViewer->Show();
82}
#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
void SetTopVisible(Bool_t on=kTRUE) override
void SetGeoManager(TGeoManager *) override
RGeoPainter(TGeoManager *manager)
std::shared_ptr< RGeomViewer > fViewer
The manager class for any TGeo geometry.
Definition TGeoManager.h:45
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition TGeoVolume.h:49
TGeoManager * GetGeoManager() const
Definition TGeoVolume.h:172
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.