]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Added option to render GeoTopNodeRnrEl at a given global position (requires ROOT...
authormtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 27 Jun 2006 17:53:19 +0000 (17:53 +0000)
committermtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 27 Jun 2006 17:53:19 +0000 (17:53 +0000)
EVE/Reve/GeoNode.cxx
EVE/Reve/GeoNode.h

index a9c4e57fd961ce0b02fd451a743c38ff22c13a04..cdea130e8787321d32f9be02fa1e501e6c34b848 100644 (file)
@@ -9,6 +9,7 @@
 #include <TGeoVolume.h>
 #include <TGeoNode.h>
 #include <TGeoManager.h>
+#include <TVirtualGeoPainter.h>
 
 using namespace Reve;
 
@@ -140,6 +141,8 @@ void GeoNodeRnrEl::Draw(Option_t* option)
 //______________________________________________________________________
 // GeoTopNodeRnrEl
 //
+// A wrapper over a TGeoNode, possibly displaced with a global
+// trasformation fGlobalTrans (the matrix is owned by this class).
 /**************************************************************************/
 
 ClassImp(GeoTopNodeRnrEl)
@@ -148,11 +151,31 @@ GeoTopNodeRnrEl::GeoTopNodeRnrEl(TGeoManager* manager, TGeoNode* node,
                                 Int_t visopt, Int_t vislvl) :
   GeoNodeRnrEl(node),
   fManager(manager),
+  fGlobalTrans(0),
+  fUseNodeTrans(kFALSE),
   fVisOption(visopt), fVisLevel(vislvl)
 {
   fRnrElement = true;
 }
 
+GeoTopNodeRnrEl::~GeoTopNodeRnrEl()
+{
+  delete fGlobalTrans;
+}
+
+/**************************************************************************/
+
+void GeoTopNodeRnrEl::SetGlobalTrans(TGeoHMatrix* m)
+{
+  delete fGlobalTrans;
+  fGlobalTrans = m;
+}
+
+void GeoTopNodeRnrEl::SetUseNodeTrans(Bool_t u)
+{
+  fUseNodeTrans = u;
+}
+
 /**************************************************************************/
 
 void GeoTopNodeRnrEl::SetVisOption(Int_t visopt)
@@ -200,7 +223,14 @@ void GeoTopNodeRnrEl::Paint(Option_t* option)
     fManager->SetVisLevel(fVisLevel);
     fManager->SetTopVolume(fNode->GetVolume());
     gPad = pad;
-    fNode->Paint(option);
+    TVirtualGeoPainter* vgp = fManager->GetGeomPainter();
+    if(vgp != 0) {
+#if ROOT_VERSION_CODE > ROOT_VERSION(5,11,7)
+      vgp->PaintNode(fNode, option, fUseNodeTrans ? fNode->GetMatrix() : fGlobalTrans);
+#else
+      vgp->PaintNode(fNode, option);
+#endif
+    }
     fManager->SetTopVolume(top_volume);
   }
 }
index 7a2e73525f3709062a9ef31dbba96b1846c2d42f..a3864b9faa58be812d575ecf1981b455cb1fc031 100644 (file)
@@ -7,6 +7,7 @@
 
 class TGeoVolume;
 class TGeoNode;
+class TGeoHMatrix;
 class TGeoManager;
 
 namespace Reve {
@@ -16,7 +17,7 @@ class GeoNodeRnrEl : public TObject, public RenderElementListBase
   friend class GeoNodeRnrElEditor;
 
 protected:
-  TGeoNodefNode;
+  TGeoNode *fNode;
 
 public:
   GeoNodeRnrEl(TGeoNode* node);
@@ -51,11 +52,19 @@ class GeoTopNodeRnrEl : public GeoNodeRnrEl
 {
 protected:
   TGeoManager* fManager;
+  TGeoHMatrix* fGlobalTrans;
+  Bool_t       fUseNodeTrans;
   Int_t        fVisOption;
   Int_t        fVisLevel;  
 
 public:
   GeoTopNodeRnrEl(TGeoManager* manager, TGeoNode* node, Int_t visopt=1, Int_t vislvl=3);
+  virtual ~GeoTopNodeRnrEl();
+
+  TGeoHMatrix *GetGlobalTrans()  const { return fGlobalTrans; }
+  void         SetGlobalTrans(TGeoHMatrix* m);
+  Bool_t       GetUseNodeTrans() const { return fUseNodeTrans; }
+  void         SetUseNodeTrans(Bool_t u=kTRUE);
 
   Int_t GetVisOption() const { return fVisOption; }
   void  SetVisOption(Int_t visopt);