Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
REveGeoShapeExtract.cxx
Go to the documentation of this file.
1 // @(#)root/eve7:$Id$
2 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
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 
13 #include <ROOT/REveGeoShape.hxx>
14 
15 #include "TList.h"
16 #include "TGeoManager.h"
17 #include "TGeoShape.h"
18 
19 using namespace ROOT::Experimental;
20 namespace REX = ROOT::Experimental;
21 
22 /** \class REveGeoShapeExtract
23 \ingroup REve
24 Globally positioned TGeoShape with rendering attributes and an
25 optional list of daughter shape-extracts.
26 
27 Vessel to carry hand-picked geometry from gled to reve.
28 This class exists in both frameworks.
29 */
30 
31 ////////////////////////////////////////////////////////////////////////////////
32 /// Constructor.
33 
34 REveGeoShapeExtract::REveGeoShapeExtract(const char* n, const char* t) :
35  TNamed (n,t),
36  fRnrSelf (kTRUE),
37  fRnrElements (kTRUE),
38  fRnrFrame (kTRUE),
39  fMiniFrame (kTRUE),
40  fShape (nullptr),
41  fElements (nullptr)
42 {
43  memset(fTrans, 0, sizeof(fTrans));
44  fTrans[0] = fTrans[5] = fTrans[10] = fTrans[15] = 1;
45  fRGBA [0] = fRGBA [1] = fRGBA [2] = fRGBA [3] = 1;
46  fRGBALine[0] = fRGBALine[1] = fRGBALine[2] = 0; fRGBALine[3] = 1;
47 }
48 
49 ////////////////////////////////////////////////////////////////////////////////
50 /// Destructor. Delete shape and elements.
51 
52 REveGeoShapeExtract::~REveGeoShapeExtract()
53 {
54  delete fShape;
55  delete fElements;
56 }
57 
58 ////////////////////////////////////////////////////////////////////////////////
59 /// True if has at least one element.
60 
61 Bool_t REveGeoShapeExtract::HasElements()
62 {
63  return fElements && (fElements->GetSize() > 0);
64 }
65 
66 ////////////////////////////////////////////////////////////////////////////////
67 /// Add a child element.
68 
69 void REveGeoShapeExtract::AddElement(REveGeoShapeExtract* gse)
70 {
71  if (!fElements)
72  fElements = new TList;
73 
74  fElements->Add(gse);
75 }
76 
77 ////////////////////////////////////////////////////////////////////////////////
78 /// Set transformation matrix.
79 
80 void REveGeoShapeExtract::SetTrans(const Double_t arr[16])
81 {
82  for(Int_t i=0; i<16; ++i)
83  fTrans[i] = arr[i];
84 }
85 
86 ////////////////////////////////////////////////////////////////////////////////
87 /// Set RGBA color.
88 
89 void REveGeoShapeExtract::SetRGBA(const Float_t arr[4])
90 {
91  for(Int_t i=0; i<4; ++i)
92  fRGBA[i] = arr[i];
93 }
94 
95 ////////////////////////////////////////////////////////////////////////////////
96 /// Set RGBA color for line.
97 
98 void REveGeoShapeExtract::SetRGBALine(const Float_t arr[4])
99 {
100  for(Int_t i=0; i<4; ++i)
101  fRGBALine[i] = arr[i];
102 }