]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/Reve/GeoNode.h
9fc1ee750b7e2adcb4efab4a57798086fcde4fb2
[u/mrichter/AliRoot.git] / EVE / Reve / GeoNode.h
1 // $Header$
2
3 #ifndef REVE_ReveGeom_H
4 #define REVE_ReveGeom_H
5
6 #include <Reve/RenderElement.h>
7 #include <Reve/ZTrans.h>
8 #include <Reve/NLTBases.h>
9
10 class TGeoVolume;
11 class TGeoNode;
12 class TGeoHMatrix;
13 class TGeoManager;
14
15 class TGeoShape;
16 class TGeoShapeExtract;
17
18 namespace Reve {
19
20 class GeoNodeRnrEl : public RenderElement,
21                      public TObject
22 {
23   friend class GeoNodeRnrElEditor;
24
25   GeoNodeRnrEl(const GeoNodeRnrEl&);            // Not implemented
26   GeoNodeRnrEl& operator=(const GeoNodeRnrEl&); // Not implemented
27
28 protected:
29   TGeoNode *fNode;
30   TGeoShapeExtract* DumpShapeTree(GeoNodeRnrEl* geon, TGeoShapeExtract* parent = 0, Int_t level = 0);
31 public:
32   GeoNodeRnrEl(TGeoNode* node);
33
34   virtual const Text_t* GetName()  const;
35   virtual const Text_t* GetTitle() const;
36
37   TGeoNode* GetNode() const { return fNode; }
38
39   virtual Int_t ExpandIntoListTree(TGListTree* ltree, TGListTreeItem* parent);
40
41   virtual Bool_t CanEditRnrElement() { return false; }
42   virtual void SetRnrSelf(Bool_t rnr);
43   virtual void SetRnrChildren(Bool_t rnr);
44   virtual void SetRnrState(Bool_t rnr);
45
46   virtual Bool_t CanEditMainColor()  { return true; }
47   virtual void   SetMainColor(Color_t color);
48   virtual void   SetMainColor(Pixel_t pixel);
49
50   void UpdateNode(TGeoNode* node);
51   void UpdateVolume(TGeoVolume* volume);
52
53   void Save(const char* file, const char* name="Extract");  
54
55   virtual void Draw(Option_t* option="");
56
57   ClassDef(GeoNodeRnrEl, 1);
58 }; // endclass GeoNodeRnrEl
59
60 //----------------------------------------------------------------
61
62 class GeoTopNodeRnrEl : public GeoNodeRnrEl
63 {
64   GeoTopNodeRnrEl(const GeoTopNodeRnrEl&);            // Not implemented
65   GeoTopNodeRnrEl& operator=(const GeoTopNodeRnrEl&); // Not implemented
66
67 protected:
68   TGeoManager* fManager;
69   ZTrans       fGlobalTrans;
70   Int_t        fVisOption;
71   Int_t        fVisLevel;
72
73 public:
74   GeoTopNodeRnrEl(TGeoManager* manager, TGeoNode* node, Int_t visopt=1, Int_t vislvl=3);
75   virtual ~GeoTopNodeRnrEl();
76
77   virtual Bool_t  CanEditMainHMTrans() { return  kTRUE; }
78   virtual ZTrans* PtrMainHMTrans()     { return &fGlobalTrans; }
79
80   ZTrans&      RefGlobalTrans() { return fGlobalTrans; }
81   void         SetGlobalTrans(const TGeoHMatrix* m);
82   void         UseNodeTrans();
83
84   Int_t GetVisOption() const { return fVisOption; }
85   void  SetVisOption(Int_t visopt);
86   Int_t GetVisLevel()  const { return fVisLevel; }
87   void  SetVisLevel(Int_t vislvl);
88
89   virtual Bool_t CanEditRnrElement() { return true; }
90   virtual void SetRnrSelf(Bool_t rnr);
91
92   virtual void Draw(Option_t* option="");
93   virtual void Paint(Option_t* option="");
94
95   // Signals from GeoManager.
96   // These are not available any more ... colors in list-tree not refreshed
97   // properly.
98   void VolumeVisChanged(TGeoVolume* volume);
99   void VolumeColChanged(TGeoVolume* volume);
100   void NodeVisChanged(TGeoNode* node);
101
102   ClassDef(GeoTopNodeRnrEl, 1);
103 }; // endclass GeoTopNodeRnrEl
104
105
106 //----------------------------------------------------------------
107 //----------------------------------------------------------------
108
109 class GeoShapeRnrEl : public RenderElement,
110                       public TNamed,
111                       public NLTProjectable
112 {
113   GeoShapeRnrEl(const GeoShapeRnrEl&);            // Not implemented
114   GeoShapeRnrEl& operator=(const GeoShapeRnrEl&); // Not implemented
115
116 protected:
117   ZTrans            fHMTrans;
118   Color_t           fColor;
119   UChar_t           fTransparency;
120   TGeoShape*        fShape;
121
122   static GeoShapeRnrEl* SubImportShapeExtract(TGeoShapeExtract* gse, RenderElement* parent);
123   TGeoShapeExtract*     DumpShapeTree(GeoShapeRnrEl* geon, TGeoShapeExtract* parent = 0);
124
125 public:
126   GeoShapeRnrEl(const Text_t* name="GeoShapeRnrEl", const Text_t* title=0);
127   virtual ~GeoShapeRnrEl();
128
129   virtual Bool_t CanEditMainColor() { return kTRUE; }
130
131   virtual Bool_t  CanEditMainTransparency()      { return kTRUE; }
132   virtual UChar_t GetMainTransparency() const    { return fTransparency; }
133   virtual void    SetMainTransparency(UChar_t t) { fTransparency = t; }
134
135   virtual Bool_t  CanEditMainHMTrans() { return  kTRUE; }
136   virtual ZTrans* PtrMainHMTrans()     { return &fHMTrans; }
137
138   ZTrans& RefHMTrans() { return fHMTrans; }
139   void SetTransMatrix(Double_t* carr)        { fHMTrans.SetFrom(carr); }
140   void SetTransMatrix(const TGeoMatrix& mat) { fHMTrans.SetFrom(mat);  }
141
142   Color_t     GetColor()        { return fColor; }
143   TGeoShape*  GetShape()        { return fShape; }
144
145   virtual void Paint(Option_t* option="");
146
147   void Save(const char* file, const char* name="Extract");  
148   static GeoShapeRnrEl*        ImportShapeExtract(TGeoShapeExtract* gse, RenderElement* parent);
149
150   // NLTGeoProjectable
151   virtual TBuffer3D*           MakeBuffer3D();
152   virtual TClass*              ProjectedClass() const;
153
154   ClassDef(GeoShapeRnrEl, 1);
155 };
156
157 }
158
159 #endif