4 #include <Reve/RGTopFrame.h>
9 #include <TGeoVolume.h>
11 #include <TGeoManager.h>
15 //______________________________________________________________________
19 ClassImp(GeoNodeRnrEl)
21 GeoNodeRnrEl::GeoNodeRnrEl(TGeoNode* node) :
22 RenderElementListBase(),
25 // Hack!! Should use cint to retrieve TAttLine::fLineColor offset.
26 char* l = (char*) dynamic_cast<TAttLine*>(node->GetVolume());
27 SetMainColorPtr((Color_t*)(l + sizeof(void*)));
29 fRnrElement = fNode->TGeoAtt::IsVisible();
32 const Text_t* GeoNodeRnrEl::GetName() const { return fNode->GetName(); }
33 const Text_t* GeoNodeRnrEl::GetTitle() const { return fNode->GetTitle(); }
35 /**************************************************************************/
37 Int_t GeoNodeRnrEl::ExpandIntoListTree(TGListTree* ltree,
38 TGListTreeItem* parent)
40 // Checks if child-nodes have been imported ... imports them if not.
41 // Then calls RenderElementListBase::ExpandIntoListTree.
43 if(fList.empty() && fNode->GetVolume()->GetNdaughters() > 0) {
44 TIter next(fNode->GetVolume()->GetNodes());
46 while((dnode = (TGeoNode*) next()) != 0) {
47 GeoNodeRnrEl* node_re = new GeoNodeRnrEl(dnode);
51 return RenderElementListBase::ExpandIntoListTree(ltree, parent);
54 /**************************************************************************/
56 void GeoNodeRnrEl::FullUpdate()
58 fRnrElement = fNode->TGeoAtt::IsVisible();
59 RenderElementListBase::FullUpdate();
62 /**************************************************************************/
64 void GeoNodeRnrEl::SetRnrElement(Bool_t rnr)
66 fNode->SetVisibility(rnr);
70 /**************************************************************************/
72 void GeoNodeRnrEl::SetMainColor(Color_t color)
74 fNode->GetVolume()->SetLineColor(color);
78 void GeoNodeRnrEl::SetMainColor(Pixel_t pixel)
80 // This one needed for proper calling via CINT (signals).
82 SetMainColor(Color_t(TColor::GetColor(pixel)));
85 /**************************************************************************/
87 void GeoNodeRnrEl::UpdateNode(TGeoNode* node)
89 // Updates all reve-browsers having the node in their contents.
90 // All 3D-pads updated if any change found.
92 // Should (could?) be optimized with some assumptions about
93 // volume/node structure (search for parent, know the same node can not
94 // reoccur on lower level once found).
96 static const Exc_t eH("GeoNodeRnrEl::UpdateNode ");
98 // printf("%s node %s %p\n", eH.Data(), node->GetName(), node);
103 for(lpRE_i i=fList.begin(); i!=fList.end(); ++i) {
104 ((GeoNodeRnrEl*)(*i))->UpdateNode(node);
109 void GeoNodeRnrEl::UpdateVolume(TGeoVolume* volume)
111 // Updates all reve-browsers having the volume in their contents.
112 // All 3D-pads updated if any change found.
114 // Should (could?) be optimized with some assumptions about
115 // volume/node structure (search for parent, know the same node can not
116 // reoccur on lower level once found).
118 static const Exc_t eH("GeoNodeRnrEl::UpdateVolume ");
120 // printf("%s volume %s %p\n", eH.Data(), volume->GetName(), volume);
122 if(fNode->GetVolume() == volume)
125 for(lpRE_i i=fList.begin(); i!=fList.end(); ++i) {
126 ((GeoNodeRnrEl*)(*i))->UpdateVolume(volume);
130 /**************************************************************************/
132 void GeoNodeRnrEl::Draw(Option_t* option)
136 fNode->GetVolume()->Draw(opt);
139 /**************************************************************************/
140 //______________________________________________________________________
143 /**************************************************************************/
145 ClassImp(GeoTopNodeRnrEl)
147 GeoTopNodeRnrEl::GeoTopNodeRnrEl(TGeoManager* manager, TGeoNode* node,
148 Int_t visopt, Int_t vislvl) :
151 fVisOption(visopt), fVisLevel(vislvl)
156 /**************************************************************************/
158 void GeoTopNodeRnrEl::SetVisOption(Int_t visopt)
164 void GeoTopNodeRnrEl::SetVisLevel(Int_t vislvl)
170 /**************************************************************************/
172 void GeoTopNodeRnrEl::FullUpdate()
174 RenderElementListBase::FullUpdate();
177 /**************************************************************************/
179 void GeoTopNodeRnrEl::SetRnrElement(Bool_t rnr)
181 // Revert from GeoNode to back to standard behaviour.
182 RenderElementListBase::SetRnrElement(rnr);
185 /**************************************************************************/
187 void GeoTopNodeRnrEl::Draw(Option_t* option)
192 void GeoTopNodeRnrEl::Paint(Option_t* option)
195 gGeoManager = fManager;
196 TVirtualPad* pad = gPad;
198 TGeoVolume* top_volume = fManager->GetTopVolume();
199 fManager->SetVisOption(fVisOption);
200 fManager->SetVisLevel(fVisLevel);
201 fManager->SetTopVolume(fNode->GetVolume());
203 fNode->Paint(option);
204 fManager->SetTopVolume(top_volume);
208 /**************************************************************************/
210 void GeoTopNodeRnrEl::VolumeVisChanged(TGeoVolume* volume)
212 static const Exc_t eH("GeoTopNodeRnrEl::VolumeVisChanged ");
213 printf("%s volume %s %p\n", eH.Data(), volume->GetName(), (void*)volume);
214 UpdateVolume(volume);
217 void GeoTopNodeRnrEl::VolumeColChanged(TGeoVolume* volume)
219 static const Exc_t eH("GeoTopNodeRnrEl::VolumeColChanged ");
220 printf("%s volume %s %p\n", eH.Data(), volume->GetName(), (void*)volume);
221 UpdateVolume(volume);
224 void GeoTopNodeRnrEl::NodeVisChanged(TGeoNode* node)
226 static const Exc_t eH("GeoTopNodeRnrEl::NodeVisChanged ");
227 printf("%s node %s %p\n", eH.Data(), node->GetName(), (void*)node);