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   	#ifndef ROOT_TShape
25   	#include "TShape.h"
26   	#endif
27   	#ifndef ROOT_TAttLine
28   	#include "TAttLine.h"
29   	#endif
30   	#ifndef ROOT_TAttFill
31   	#include "TAttFill.h"
32   	#endif
33   	#ifndef ROOT_TAtt3D
34   	#include "TAtt3D.h"
35   	#endif
36   	
37   	#ifndef ROOT_TRotMatrix
38   	#include "TRotMatrix.h"
39   	#endif
40   	
41   	class TBrowser;
42   	
43   	class TNode : public TNamed , public TAttLine, public TAttFill, public TAtt3D {
44   	
45   	protected:
46   	   enum { kSonsInvisible = BIT(17) };
47   	
48   	   Double_t        fX;          //X offset with respect to parent object
49   	   Double_t        fY;          //Y offset with respect to parent object
50   	   Double_t        fZ;          //Z offset with respect to parent object
51   	   TRotMatrix     *fMatrix;     //Pointer to rotation matrix
52   	   TShape         *fShape;      //Pointer to shape definition
53   	   TNode          *fParent;     //Pointer to parent positioned volume
54   	   TList          *fNodes;      //List of son nodes (if any)
55   	   TString         fOption;     //List of options if any
56   	   Int_t           fVisibility; //Visibility flag
57   	
58   	   TNode(const TNode&);
59   	   TNode& operator=(const TNode&);
60   	
61   	public:
62   	   TNode();
63   	   TNode(const char *name, const char *title, const char *shapename, Double_t x=0, Double_t y=0, Double_t z=0,
64   	         const char *matrixname="", Option_t *option="");
65   	   TNode(const char *name, const char *title, TShape *shape, Double_t x=0, Double_t y=0, Double_t z=0,
66   	         TRotMatrix *matrix=0, Option_t *option="");
67   	   virtual ~TNode();
68   	   virtual void        Browse(TBrowser *b);
69   	   virtual void        BuildListOfNodes();
70   	   virtual void        cd(const char *path=0); // *MENU*
71   	   virtual Int_t       DistancetoPrimitive(Int_t px, Int_t py);
72   	   virtual void        Draw(Option_t *option=""); // *MENU*
73   	   virtual void        DrawOnly(Option_t *option="");
74   	   virtual void        ExecuteEvent(Int_t event, Int_t px, Int_t py);
75   	   TList              *GetListOfNodes() const {return fNodes;}
76   	   virtual TRotMatrix *GetMatrix() const {return fMatrix;}
77   	   virtual TNode      *GetNode(const char *name) const;
78   	   virtual char       *GetObjectInfo(Int_t px, Int_t py) const;
79   	   const   Option_t   *GetOption() const { return fOption.Data();}
80   	   virtual TNode      *GetParent() const {return fParent;}
81   	   TShape             *GetShape() const {return fShape;}
82   	   Int_t               GetVisibility() const {return fVisibility;}
83   	   virtual Double_t    GetX() const {return fX;}
84   	   virtual Double_t    GetY() const {return fY;}
85   	   virtual Double_t    GetZ() const {return fZ;}
86   	   virtual void        ImportShapeAttributes();
87   	   Bool_t              IsFolder() const;
88   	   virtual void        Local2Master(const Double_t *local, Double_t *master);
89   	   virtual void        Local2Master(const Float_t *local, Float_t *master);
90   	   virtual void        ls(Option_t *option="2") const; // *MENU*
91   	   virtual void        Master2Local(const Double_t *master, Double_t *local);
92   	   virtual void        Master2Local(const Float_t *master, Float_t *local);
93   	   virtual void        Paint(Option_t *option="");
94   	   virtual void        RecursiveRemove(TObject *obj);
95   	   virtual void        SetMatrix(TRotMatrix *matrix=0) {fMatrix = matrix;}
96   	   virtual void        SetName(const char *name);
97   	   virtual void        SetParent(TNode *parent);
98   	   virtual void        SetNameTitle(const char *name, const char *title);
99   	   virtual void        SetPosition( Double_t x=0, Double_t y=0, Double_t z=0) {fX=x; fY=y; fZ=z;}
100  	   virtual void        SetVisibility(Int_t vis=1); // *MENU*
101  	   virtual void        Sizeof3D() const;
102  	   virtual void        UpdateMatrix();
103  	   virtual void        UpdateTempMatrix(const Double_t *dx1,const Double_t *rmat1,
104  	                              Double_t x, Double_t y, Double_t z, Double_t *matrix,
105  	                              Double_t *dxnew, Double_t *rmatnew);
106  	
107  	   ClassDef(TNode,3)  //Description of parameters to position a 3-D geometry object
108  	};
109  	
110  	#endif
111