library: libGraf3d #include "TNode.h"

# TNode

class description - source file - inheritance tree (.pdf)

## class TNode : public TNamed, public TAttLine, public TAttFill, public TAtt3D

| Inheritance Chart:
`TObject`
| <- | `TNamed`
`TAttLine`
`TAttFill`
`TAtt3D`
| <- | `TNode` |
<- |
`TNodeDiv` |

        public:

                              TNode()
                              TNode(const char* name, const char* title, const char* shapename, Double_t x = 0, Double_t y = 0, Double_t z = 0, const char* matrixname = "", Option_t* option = "")
                              TNode(const char* name, const char* title, TShape* shape, Double_t x = 0, Double_t y = 0, Double_t z = 0, TRotMatrix* matrix = 0, Option_t* option = "")
                              TNode(const TNode&)
                      virtual ~TNode()
                 virtual void Browse(TBrowser* b)
                 virtual void BuildListOfNodes()
                 virtual void cd(const char* path = "0")
               static TClass* Class()
                virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
                 virtual void Draw(Option_t* option = "")
                 virtual void DrawOnly(Option_t* option = "")
                 virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
                       TList* GetListOfNodes() const
          virtual TRotMatrix* GetMatrix() const
               virtual TNode* GetNode(const char* name) const
                virtual char* GetObjectInfo(Int_t px, Int_t py) const
            virtual Option_t* GetOption() const
               virtual TNode* GetParent() const
                      TShape* GetShape() const
                        Int_t GetVisibility() const
             virtual Double_t GetX() const
             virtual Double_t GetY() const
             virtual Double_t GetZ() const
                 virtual void ImportShapeAttributes()
              virtual TClass* IsA() const
               virtual Bool_t IsFolder() const
                 virtual void Local2Master(const Double_t* local, Double_t* master)
                 virtual void Local2Master(const Float_t* local, Float_t* master)
                 virtual void ls(Option_t* option = "2") const
                 virtual void Master2Local(const Double_t* master, Double_t* local)
                 virtual void Master2Local(const Float_t* master, Float_t* local)
                       TNode& operator=(const TNode&)
                 virtual void Paint(Option_t* option = "")
                 virtual void RecursiveRemove(TObject* obj)
                 virtual void SetMatrix(TRotMatrix* matrix = 0)
                 virtual void SetName(const char* name)
                 virtual void SetNameTitle(const char* name, const char* title)
                 virtual void SetParent(TNode* parent)
                 virtual void SetPosition(Double_t x = 0, Double_t y = 0, Double_t z = 0)
                 virtual void SetVisibility(Int_t vis = 1)
                 virtual void ShowMembers(TMemberInspector& insp, char* parent)
                 virtual void Sizeof3D() const
                 virtual void Streamer(TBuffer& b)
                         void StreamerNVirtual(TBuffer& b)
                 virtual void UpdateMatrix()
                 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)

### Data Members

        protected:

             Double_t fX           X offset with respect to parent object
             Double_t fY           Y offset with respect to parent object
             Double_t fZ           Z offset with respect to parent object
          TRotMatrix* fMatrix      Pointer to rotation matrix
              TShape* fShape       Pointer to shape definition
               TNode* fParent      Pointer to parent positioned volume
               TList* fNodes       List of son nodes (if any)
              TString fOption      List of options if any
                Int_t fVisibility  Visibility flag

        public:

          static const enum TNode:: kSonsInvisible

## Class Description

    *-*-*-*-*-*-*-*-*-*-*-* T N O D E  description *-*-*-*-*-*-*-*-*-*-*-*-*
    *-*                    =======================
    *-*
    *-*    A TNode object is used to build the geometry hierarchy (see TGeometry).
    *-*    A node may contain other nodes.
    *-*
    *-*    A geometry node has attributes:
    *-*      - name and title
    *-*      - pointer to the referenced shape (see TShape).
    *-*      - x,y,z offset with respect to the mother node.
    *-*      - pointer to the rotation matrix (see TRotMatrix).
    *-*
    *-*    A node can be drawn.
    *-*
    *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

TNode()

    *-*-*-*-*-*-*-*-*-*-*Node default constructor*-*-*-*-*-*-*-*-*-*-*-*-*
    *-*                  ========================

TNode(const char *name, const char *title, const char *shapename, Double_t x, Double_t y, Double_t z, const char *matrixname, Option_t *option) :TNamed(name,title),TAttLine(), TAttFill()

    *-*-*-*-*-*-*-*-*-*-*Node normal constructor*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
    *-*                  ======================
    *-*
    *-*    name    is the name of the node
    *-*    title   is title
    *-*    shapename is the name of the referenced shape
    *-*    x,y,z   are the offsets of the volume with respect to his mother
    *-*    matrixname  is the name of the rotation matrix
    *-*
    *-*    This new node is added into the list of sons of the current node
    *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

TNode(const char *name, const char *title, TShape *shape, Double_t x, Double_t y, Double_t z, TRotMatrix *matrix, Option_t *option) :TNamed(name,title),TAttLine(),TAttFill()

    *-*-*-*-*-*-*-*-*-*-*Node normal constructor*-*-*-*-*-*-*-*-*-*-*
    *-*                  ================================
    *-*
    *-*    name    is the name of the node
    *-*    title   is title
    *-*    shape   is the pointer to the shape definition
    *-*    x,y,z   are the offsets of the volume with respect to his mother
    *-*    matrix  is the pointer to the rotation matrix
    *-*
    *-*    This new node is added into the list of sons of the current node
    *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
    *-* The color "1" - default produces a very bad 3D image with OpenGL

~TNode()

    *-*-*-*-*-*-*-*-*-*-*Node default destructor*-*-*-*-*-*-*-*-*-*-*-*-*-*
    *-*                  ======================

void Browse(TBrowser *b)

void BuildListOfNodes()

    *-*-*-*-*-*Create the list to support sons of this node*-*-*-*-*-*-*-*-*-*-*
    *-*        ============================================

void cd(const char *)

    *-*-*-*-*-*Change Current Reference node to this*-*-*-*-*-*-*-*-*-*-*-*-*
    *-*        =====================================

Int_t DistancetoPrimitive(Int_t px, Int_t py)

    *-*-*-*-*-*-*-*-*-*-*Compute distance from point px,py to a Node*-*-*-*-*-*
    *-*                  ===========================================
    *-*  Compute the closest distance of approach from point px,py to this node.
    *-*  The distance is computed in pixels units.
    *-*
    *-*
    *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

void Draw(Option_t *option)

    *-*-*-*-*-*-*-*-*-*-*-*Draw Referenced node with current parameters*-*-*-*
    *-*                   =============================================

void DrawOnly(Option_t *option)

    *-*-*-*-*-*-*-*-*-*Draw only Sons of this node*-*-*-*-*-*-*-*-*-*-*-*-*
    *-*                ===========================

void ExecuteEvent(Int_t, Int_t, Int_t)

    *-*-*-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-*
    *-*                  =========================================
    *-*  This member function must be implemented to realize the action
    *-*  corresponding to the mouse click on the object in the window
    *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

TNode* GetNode(const char *name) const

    *-*-*-*-*-*-*Return pointer to node with name in the node tree*-*-*-*-*
    *-*          =================================================

char* GetObjectInfo(Int_t, Int_t) const

void ImportShapeAttributes()

    *-*-*-*-*-*-*Copy shape attributes as node attributes*-*-*-*-*--*-*-*-*-*-*
    *-*          ========================================

Bool_t IsFolder() const

    *-*-*-*-*Return TRUE if node contains nodes, FALSE otherwise*-*
    *-*      ======================================================

void Local2Master(const Double_t *local, Double_t *master)

    *-*-*-*-*Convert one point from local system to master reference system*-*-*
    *-*      ==============================================================

      Note that before invoking this function, the global rotation matrix
      and translation vector for this node must have been computed.
      This is automatically done by the Paint functions.
      Otherwise TNode::UpdateMatrix should be called before.

void Local2Master(const Float_t *local, Float_t *master)

    *-*-*-*-*Convert one point from local system to master reference system*-*-*
    *-*      ==============================================================

      Note that before invoking this function, the global rotation matrix
      and translation vector for this node must have been computed.
      This is automatically done by the Paint functions.
      Otherwise TNode::UpdateMatrix should be called before.

void ls(Option_t *option) const

    *-*-*-*-*-*-*-*-*-*-*-*List Referenced object with current parameters*-*-*-*
    *-*                   ===============================================

void Master2Local(const Double_t *master, Double_t *local)

    *-*-*-*-*Convert one point from master system to local reference system*-*-*
    *-*      ==============================================================

      Note that before invoking this function, the global rotation matrix
      and translation vector for this node must have been computed.
      This is automatically done by the Paint functions.
      Otherwise TNode::UpdateMatrix should be called before.

void Master2Local(const Float_t *master, Float_t *local)

    *-*-*-*-*Convert one point from master system to local reference system*-*-*
    *-*      ==============================================================

      Note that before invoking this function, the global rotation matrix
      and translation vector for this node must have been computed.
      This is automatically done by the Paint functions.
      Otherwise TNode::UpdateMatrix should be called before.

void Paint(Option_t *option)

    *-*-*-*-*-*-*-*-*-*-*-*Paint Referenced node with current parameters*-*-*-*
    *-*                   ==============================================
    *-*
    *-*  vis = 1  (default) shape is drawn
    *-*  vis = 0  shape is not drawn but its sons may be not drawn
    *-*  vis = -1 shape is not drawn. Its sons are not drawn
    *-*  vis = -2 shape is drawn. Its sons are not drawn
    *-*
    *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

void RecursiveRemove(TObject *obj)

    *-*-*-*-*Recursively remove object from the list of nodes of this node*-*-*-*
    *-*      =============================================================

void SetName(const char *name)

     Change the name of this Node

void SetNameTitle(const char *name, const char *title)

     Change the name and title of this Node

void SetParent(TNode *parent)

     set the pointer to the parent, keep parents informed about who they have

void SetVisibility(Int_t vis)

    *-*-*-*-*-*-*Set visibility for this node and its sons*-*-*-*-*--*-*-*-*-*-*
    *-*          =========================================
    *-*  vis = 3  node is drawn and its sons are drawn
    *-*  vis = 2  node is not drawn but its sons are drawn
    *-*  vis = 1  (default) node is drawn
    *-*  vis = 0  node is not drawn
    *-*  vis = -1 node is not drawn. Its sons are not drawn
    *-*  vis = -2 node is drawn. Its sons are not drawn
    *-*  vis = -3 Only node leaves are drawn
    *-*  vis = -4 Node is not drawn. Its immediate sons are drawn
    *-*
    *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

void Sizeof3D() const

    *-*-*-*-*-*-*Return total size of this 3-D Node with its attributes*-*-*
    *-*          ==========================================================

void Streamer(TBuffer &b)

    *-*-*-*-*-*-*-*-*Stream a class object*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
    *-*              =========================================

void UpdateMatrix()

        Update global rotation matrix/translation vector for this node
       this function must be called before invoking Local2Master

void UpdateTempMatrix(const Double_t *dx,const Double_t *rmat , 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*-*-*-*-*-*-*-*
    *-*          ================================================
    *-*
    *-*  dx      old translation vector
    *-*  rmat    old global matrix
    *-*  x,y,z   offset of new local system with respect to mother
    *-*  dxnew   new translation vector
    *-*  rmatnew new global rotation matrix
    *-*
    *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-

### Inline Functions

                 TList* GetListOfNodes() const
            TRotMatrix* GetMatrix() const
              Option_t* GetOption() const
                 TNode* GetParent() const
                TShape* GetShape() const
                  Int_t GetVisibility() const
               Double_t GetX() const
               Double_t GetY() const
               Double_t GetZ() const
                   void SetMatrix(TRotMatrix* matrix = 0)
                   void SetPosition(Double_t x = 0, Double_t y = 0, Double_t z = 0)
                TClass* Class()
                TClass* IsA() const
                   void ShowMembers(TMemberInspector& insp, char* parent)
                   void StreamerNVirtual(TBuffer& b)
                  TNode TNode(const TNode&)
                 TNode& operator=(const TNode&)

Author: Rene Brun 14/09/95
Last update: root/g3d:$Name: $:$Id: TNode.cxx,v 1.26 2005/05/25 14:25:16 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *