Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TEveGeoNode.h
Go to the documentation of this file.
1 // @(#)root/eve:$Id$
2 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, 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 #ifndef ROOT_TEveGeoNode
13 #define ROOT_TEveGeoNode
14 
15 #include "TEveElement.h"
16 
17 class TGeoVolume;
18 class TGeoNode;
19 class TGeoHMatrix;
20 class TGeoManager;
21 
22 // Added here to ease transition - forward declaration should be used.
23 // This include will be removed for 5.24.
24 #include <TEveGeoShape.h>
25 // class TGeoShape;
26 
27 class TEveGeoShapeExtract;
28 
29 //----------------------------------------------------------------
30 
31 class TEveGeoNode : public TEveElement,
32  public TObject
33 {
34  friend class TEveGeoNodeEditor;
35 
36  TEveGeoNode(const TEveGeoNode&); // Not implemented
37  TEveGeoNode& operator=(const TEveGeoNode&); // Not implemented
38 
39 protected:
40  TGeoNode *fNode;
41  TEveGeoShapeExtract* DumpShapeTree(TEveGeoNode* geon, TEveGeoShapeExtract* parent=0, Bool_t leafs_only=kFALSE);
42 
43  static Int_t fgCSGExportNSeg; //!
44  static std::list<TGeoShape*> fgTemporaryStore; //!
45 
46 public:
47  TEveGeoNode(TGeoNode* node);
48 
49  virtual TObject* GetObject(const TEveException&) const
50  { const TObject* obj = this; return const_cast<TObject*>(obj); }
51 
52  virtual const char* GetName() const;
53  virtual const char* GetTitle() const;
54  virtual const char* GetElementName() const;
55  virtual const char* GetElementTitle() const;
56 
57  TGeoNode* GetNode() const { return fNode; }
58 
59  virtual void ExpandIntoListTree(TGListTree* ltree, TGListTreeItem* parent);
60 
61  virtual void ExpandIntoListTrees();
62  virtual void ExpandIntoListTreesRecursively();
63 
64  virtual Bool_t CanEditElement() const { return kFALSE; }
65 
66  virtual void AddStamp(UChar_t bits);
67 
68  virtual Bool_t CanEditMainColor() const;
69  virtual void SetMainColor(Color_t color);
70 
71  virtual Bool_t CanEditMainTransparency() const;
72  virtual Char_t GetMainTransparency() const;
73  virtual void SetMainTransparency(Char_t t);
74 
75  void UpdateNode(TGeoNode* node);
76  void UpdateVolume(TGeoVolume* volume);
77 
78  void Save(const char* file, const char* name="Extract", Bool_t leafs_only=kFALSE);
79  void SaveExtract(const char* file, const char* name, Bool_t leafs_only);
80  void WriteExtract(const char* name, Bool_t leafs_only);
81 
82  virtual void Draw(Option_t* option="");
83 
84  static Int_t GetCSGExportNSeg();
85  static void SetCSGExportNSeg(Int_t nseg);
86 
87  ClassDef(TEveGeoNode, 0); // Wrapper for TGeoNode that allows it to be shown in GUI and controlled as a TEveElement.
88 };
89 
90 //----------------------------------------------------------------
91 
92 class TEveGeoTopNode : public TEveGeoNode
93 {
94  TEveGeoTopNode(const TEveGeoTopNode&); // Not implemented
95  TEveGeoTopNode& operator=(const TEveGeoTopNode&); // Not implemented
96 
97 protected:
98  TGeoManager* fManager;
99  Int_t fVisOption;
100  Int_t fVisLevel;
101  Int_t fMaxVisNodes;
102 
103 public:
104  TEveGeoTopNode(TGeoManager* manager, TGeoNode* node, Int_t visopt=1,
105  Int_t vislvl=3, Int_t maxvisnds=10000);
106  virtual ~TEveGeoTopNode() {}
107 
108  void UseNodeTrans();
109 
110  TGeoManager* GetGeoManager() const { return fManager; }
111 
112  Int_t GetVisOption() const { return fVisOption; }
113  void SetVisOption(Int_t vo) { fVisOption = vo; }
114  Int_t GetVisLevel() const { return fVisLevel; }
115  void SetVisLevel(Int_t vl) { fVisLevel = vl; }
116  Int_t GetMaxVisNodes() const { return fMaxVisNodes; }
117  void SetMaxVisNodes(Int_t mvn) { fMaxVisNodes = mvn; }
118 
119  virtual Bool_t CanEditElement() const { return kTRUE; }
120  virtual Bool_t SingleRnrState() const { return kTRUE; }
121 
122  virtual void AddStamp(UChar_t bits);
123 
124  virtual void Draw(Option_t* option="");
125  virtual void Paint(Option_t* option="");
126 
127  // Signals from GeoManager.
128  // These are not available any more ... colors in list-tree not refreshed
129  // properly.
130  void VolumeVisChanged(TGeoVolume* volume);
131  void VolumeColChanged(TGeoVolume* volume);
132  void NodeVisChanged(TGeoNode* node);
133 
134  ClassDef(TEveGeoTopNode, 0); // Top-level TEveGeoNode with a pointer to TGeoManager and controls for steering of TGeoPainter.
135 };
136 
137 #endif