Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TNode.h
Go to the documentation of this file.
1// @(#)root/g3d:$Id$
2// Author: Rene Brun 14/09/95
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, 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
13//////////////////////////////////////////////////////////////////////////
14// //
15// TNode //
16// //
17// Description of parameters to position a 3-D geometry object //
18// //
19//////////////////////////////////////////////////////////////////////////
20
21#ifndef ROOT_TNode
22#define ROOT_TNode
23
24#include "TShape.h"
25#include "TAttLine.h"
26#include "TAttFill.h"
27#include "TAtt3D.h"
28
29#include "TRotMatrix.h"
30
31class TBrowser;
32
33class TNode : public TNamed , public TAttLine, public TAttFill, public TAtt3D {
34
35protected:
36 enum { kSonsInvisible = BIT(17) };
37
38 Double_t fX; //X offset with respect to parent object
39 Double_t fY; //Y offset with respect to parent object
40 Double_t fZ; //Z offset with respect to parent object
41 TRotMatrix *fMatrix; //Pointer to rotation matrix
42 TShape *fShape; //Pointer to shape definition
43 TNode *fParent; //Pointer to parent positioned volume
44 TList *fNodes; //List of son nodes (if any)
45 TString fOption; //List of options if any
46 Int_t fVisibility; //Visibility flag
47
48 TNode(const TNode&);
49 TNode& operator=(const TNode&);
50
51public:
52 TNode();
53 TNode(const char *name, const char *title, const char *shapename, Double_t x=0, Double_t y=0, Double_t z=0,
54 const char *matrixname="", Option_t *option="");
55 TNode(const char *name, const char *title, TShape *shape, Double_t x=0, Double_t y=0, Double_t z=0,
56 TRotMatrix *matrix=nullptr, Option_t *option="");
57 ~TNode() override;
58 void Browse(TBrowser *b) override;
59 virtual void BuildListOfNodes();
60 virtual void cd(const char *path=nullptr); // *MENU*
61 Int_t DistancetoPrimitive(Int_t px, Int_t py) override;
62 void Draw(Option_t *option="") override; // *MENU*
63 virtual void DrawOnly(Option_t *option="");
64 void ExecuteEvent(Int_t event, Int_t px, Int_t py) override;
65 TList *GetListOfNodes() const {return fNodes;}
66 virtual TRotMatrix *GetMatrix() const {return fMatrix;}
67 virtual TNode *GetNode(const char *name) const;
68 char *GetObjectInfo(Int_t px, Int_t py) const override;
69 const Option_t *GetOption() const override { return fOption.Data();}
70 virtual TNode *GetParent() const {return fParent;}
71 TShape *GetShape() const {return fShape;}
73 virtual Double_t GetX() const {return fX;}
74 virtual Double_t GetY() const {return fY;}
75 virtual Double_t GetZ() const {return fZ;}
76 virtual void ImportShapeAttributes();
77 Bool_t IsFolder() const override;
78 virtual void Local2Master(const Double_t *local, Double_t *master);
79 virtual void Local2Master(const Float_t *local, Float_t *master);
80 void ls(Option_t *option="2") const override; // *MENU*
81 virtual void Master2Local(const Double_t *master, Double_t *local);
82 virtual void Master2Local(const Float_t *master, Float_t *local);
83 void Paint(Option_t *option="") override;
84 void RecursiveRemove(TObject *obj) override;
85 virtual void SetMatrix(TRotMatrix *matrix=nullptr) {fMatrix = matrix;}
86 void SetName(const char *name) override;
87 virtual void SetParent(TNode *parent);
88 void SetNameTitle(const char *name, const char *title) override;
89 virtual void SetPosition( Double_t x=0, Double_t y=0, Double_t z=0) {fX=x; fY=y; fZ=z;}
90 virtual void SetVisibility(Int_t vis=1); // *MENU*
91 void Sizeof3D() const override;
92 virtual void UpdateMatrix();
93 virtual void UpdateTempMatrix(const Double_t *dx1,const Double_t *rmat1,
94 Double_t x, Double_t y, Double_t z, Double_t *matrix,
95 Double_t *dxnew, Double_t *rmatnew);
96
97 ClassDefOverride(TNode,3) //Description of parameters to position a 3-D geometry object
98};
99
100#endif
#define b(i)
Definition RSha256.hxx:100
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
float Float_t
Definition RtypesCore.h:57
double Double_t
Definition RtypesCore.h:59
const char Option_t
Definition RtypesCore.h:66
#define BIT(n)
Definition Rtypes.h:85
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t option
char name[80]
Definition TGX11.cxx:110
Use this attribute class when an object should have 3D capabilities.
Definition TAtt3D.h:19
Fill Area Attributes class.
Definition TAttFill.h:19
Line Attributes class.
Definition TAttLine.h:18
Using a TBrowser one can browse all ROOT objects.
Definition TBrowser.h:37
A doubly linked list.
Definition TList.h:38
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
TNode description.
Definition TNode.h:33
virtual void SetMatrix(TRotMatrix *matrix=nullptr)
Definition TNode.h:85
virtual void Master2Local(const Double_t *master, Double_t *local)
Convert one point from master system to local reference system.
Definition TNode.cxx:567
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute distance from point px,py to a Node.
Definition TNode.cxx:260
virtual void UpdateTempMatrix(const Double_t *dx1, const Double_t *rmat1, Double_t x, Double_t y, Double_t z, Double_t *matrix, Double_t *dxnew, Double_t *rmatnew)
Compute new translation vector and global matrix.
Definition TNode.cxx:888
virtual void SetPosition(Double_t x=0, Double_t y=0, Double_t z=0)
Definition TNode.h:89
virtual void UpdateMatrix()
Update global rotation matrix/translation vector for this node this function must be called before in...
Definition TNode.cxx:853
virtual TNode * GetParent() const
Definition TNode.h:70
void SetName(const char *name) override
Change the name of this Node.
Definition TNode.cxx:693
@ kSonsInvisible
Definition TNode.h:36
virtual Double_t GetY() const
Definition TNode.h:74
TNode * fParent
Definition TNode.h:43
void Sizeof3D() const override
Return total size of this 3-D Node with its attributes.
Definition TNode.cxx:798
TRotMatrix * fMatrix
Definition TNode.h:41
Double_t fX
Definition TNode.h:38
virtual Double_t GetX() const
Definition TNode.h:73
virtual TRotMatrix * GetMatrix() const
Definition TNode.h:66
void SetNameTitle(const char *name, const char *title) override
Change the name and title of this Node.
Definition TNode.cxx:707
virtual void BuildListOfNodes()
Create the list to support sons of this node.
Definition TNode.cxx:241
TNode()
Node default constructor.
Definition TNode.cxx:61
void Paint(Option_t *option="") override
Paint Referenced node with current parameters.
Definition TNode.cxx:621
virtual void DrawOnly(Option_t *option="")
Draw only Sons of this node.
Definition TNode.cxx:356
char * GetObjectInfo(Int_t px, Int_t py) const override
Get object info.
Definition TNode.cxx:397
TShape * GetShape() const
Definition TNode.h:71
virtual Double_t GetZ() const
Definition TNode.h:75
TNode & operator=(const TNode &)
assignment operator
Definition TNode.cxx:192
virtual void Local2Master(const Double_t *local, Double_t *master)
Convert one point from local system to master reference system.
Definition TNode.cxx:445
void RecursiveRemove(TObject *obj) override
Recursively remove object from the list of nodes of this node.
Definition TNode.cxx:685
virtual void cd(const char *path=nullptr)
Change Current Reference node to this.
Definition TNode.cxx:249
TShape * fShape
Definition TNode.h:42
Bool_t IsFolder() const override
Return TRUE if node contains nodes, FALSE otherwise.
Definition TNode.cxx:431
virtual void SetParent(TNode *parent)
Set the pointer to the parent, keep parents informed about who they have.
Definition TNode.cxx:722
Int_t GetVisibility() const
Definition TNode.h:72
TString fOption
Definition TNode.h:45
~TNode() override
Node default destructor.
Definition TNode.cxx:215
void Browse(TBrowser *b) override
Browse.
Definition TNode.cxx:228
virtual void ImportShapeAttributes()
Copy shape attributes as node attributes.
Definition TNode.cxx:409
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to one event.
Definition TNode.cxx:368
Int_t fVisibility
Definition TNode.h:46
Double_t fZ
Definition TNode.h:40
virtual void SetVisibility(Int_t vis=1)
Set visibility for this node and its sons.
Definition TNode.cxx:758
void ls(Option_t *option="2") const override
List Referenced object with current parameters.
Definition TNode.cxx:508
TList * fNodes
Definition TNode.h:44
const Option_t * GetOption() const override
Definition TNode.h:69
TList * GetListOfNodes() const
Definition TNode.h:65
Double_t fY
Definition TNode.h:39
virtual TNode * GetNode(const char *name) const
Return pointer to node with name in the node tree.
Definition TNode.cxx:377
Mother of all ROOT objects.
Definition TObject.h:41
Manages a detector rotation matrix.
Definition TRotMatrix.h:28
This is the base class for all geometry shapes.
Definition TShape.h:35
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:376
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
th1 Draw()