]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Move implementation of NLTProjectable class for geometry into GeoNode
authoralja <alja@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 23 Oct 2007 14:42:56 +0000 (14:42 +0000)
committeralja <alja@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 23 Oct 2007 14:42:56 +0000 (14:42 +0000)
files.

EVE/Reve/GeoNode.cxx
EVE/Reve/GeoNode.h
EVE/Reve/LinkDef.h
EVE/Reve/NLTBases.cxx
EVE/Reve/NLTBases.h

index 90deafd823571251d497ef0e41f472299c24cd66..8fdd46bce58da4d1b2e490a81bdce8a67eeec6c0 100644 (file)
@@ -2,7 +2,7 @@
 
 #include "GeoNode.h"
 #include <Reve/ReveManager.h>
-#include <Reve/NLTBases.h>
+#include <Reve/NLTPolygonSet.h>
 
 #include "TGeoShapeExtract.h"
 
 #include <TVirtualGeoPainter.h>
 
 using namespace Reve;
+//______________________________________________________________________
+// GeoNodeRnrEl
+//
+
+ClassImp(GeoRnrEl)
+
+TClass* GeoRnrEl::ProjectedClass() const
+{
+   return NLTPolygonSet::Class();
+}
 
 //______________________________________________________________________
 // GeoNodeRnrEl
@@ -27,7 +37,7 @@ using namespace Reve;
 ClassImp(GeoNodeRnrEl)
 
 GeoNodeRnrEl::GeoNodeRnrEl(TGeoNode* node) :
-  RenderElement(),
+  GeoRnrEl(),
   TObject(),
   fNode(node)
 {
@@ -150,6 +160,33 @@ void GeoNodeRnrEl::Draw(Option_t* option)
   fNode->GetVolume()->Draw(opt);
 }
 
+/**************************************************************************/
+
+TBuffer3D* GeoNodeRnrEl::MakeBuffer3D()
+{
+  TGeoShape* shape = fNode->GetVolume()->GetShape();
+  if(shape == 0) return 0;
+
+  if(dynamic_cast<TGeoShapeAssembly*>(shape)){
+    // !!!! TGeoShapeAssembly makes a bad TBuffer3D
+    return 0;
+  }
+
+  printf("eoNodeRnrEl::MakeBuffer3D() \n");
+  TBuffer3D* buff  = shape->MakeBuffer3D();
+  TGeoMatrix* mx = fNode->GetMatrix();
+  Int_t N = buff->NbPnts();
+  Double_t* pnts = buff->fPnts;
+  Double_t  master[4];
+  for(Int_t i = 0; i<N; i++)
+  {
+    mx->LocalToMaster(&pnts[3*i], master);
+    pnts[3*i] =   master[0];
+    pnts[3*i+1] = master[1];
+    pnts[3*i+2] = master[2];
+  }
+  return buff;
+}
 /**************************************************************************/
 //______________________________________________________________________
 // GeoTopNodeRnrEl
@@ -197,7 +234,7 @@ void GeoTopNodeRnrEl::SetVisOption(Int_t visopt)
 void GeoTopNodeRnrEl::SetVisLevel(Int_t vislvl)
 {
   fVisLevel = vislvl;
-  gReve->Redraw3D(); 
+  gReve->Redraw3D();
 }
 
 /**************************************************************************/
@@ -271,13 +308,15 @@ void GeoTopNodeRnrEl::NodeVisChanged(TGeoNode* node)
 ClassImp(GeoShapeRnrEl)
 
 GeoShapeRnrEl::GeoShapeRnrEl(const Text_t* name, const Text_t* title) :
-  RenderElement (fColor),
+  GeoRnrEl(),
   TNamed        (name, title),
   fHMTrans      (),
   fColor        (0),
   fTransparency (0),
   fShape        (0)
-{}
+{
+  fMainColorPtr = &fColor;
+}
 
 GeoShapeRnrEl::~GeoShapeRnrEl()
 {
@@ -373,8 +412,8 @@ TBuffer3D* GeoShapeRnrEl::MakeBuffer3D()
   {
     Reve::ZTrans& mx = RefHMTrans();
     Int_t N = buff->NbPnts();
-    Double_t* pnts = buff->fPnts;   
-    for(Int_t k=0; k<N; k++) 
+    Double_t* pnts = buff->fPnts;
+    for(Int_t k=0; k<N; k++)
     {
       mx.MultiplyIP(&pnts[3*k]);
     }
index 93b83c8b791faf5d05f48e165821402d82d36889..a97249f61b9bd00843be0d8f8b8aea533b6196e9 100644 (file)
@@ -17,7 +17,26 @@ class TGeoShapeExtract;
 
 namespace Reve {
 
-class GeoNodeRnrEl : public RenderElement,
+class GeoRnrEl : public RenderElement,
+                 public NLTProjectable
+{
+ private:
+  GeoRnrEl(const GeoRnrEl&);            // Not implemented
+  GeoRnrEl& operator=(const GeoRnrEl&); // Not implemented
+
+ public:
+  GeoRnrEl(){};
+  virtual ~GeoRnrEl() {};
+
+  virtual TBuffer3D*     MakeBuffer3D() = 0;
+  virtual TClass*        ProjectedClass() const;
+
+  ClassDef(GeoRnrEl, 1);
+};
+
+/**************************************************************************/
+/**************************************************************************/
+class GeoNodeRnrEl : public GeoRnrEl,
                      public TObject
 {
   friend class GeoNodeRnrElEditor;
@@ -50,6 +69,9 @@ public:
   void UpdateNode(TGeoNode* node);
   void UpdateVolume(TGeoVolume* volume);
 
+  // NLTGeoProjectable
+  virtual TBuffer3D*           MakeBuffer3D();
+
   virtual void Draw(Option_t* option="");
 
   ClassDef(GeoNodeRnrEl, 1);
@@ -66,7 +88,7 @@ protected:
   TGeoManager* fManager;
   ZTrans       fGlobalTrans;
   Int_t        fVisOption;
-  Int_t        fVisLevel;  
+  Int_t        fVisLevel;
 
 public:
   GeoTopNodeRnrEl(TGeoManager* manager, TGeoNode* node, Int_t visopt=1, Int_t vislvl=3);
@@ -104,9 +126,8 @@ public:
 //----------------------------------------------------------------
 //----------------------------------------------------------------
 
-class GeoShapeRnrEl : public RenderElement,
-                     public TNamed,
-                      public NLTGeoProjectable
+class GeoShapeRnrEl : public GeoRnrEl,
+                     public TNamed
 {
   GeoShapeRnrEl(const GeoShapeRnrEl&);            // Not implemented
   GeoShapeRnrEl& operator=(const GeoShapeRnrEl&); // Not implemented
@@ -127,7 +148,7 @@ public:
 
   virtual Bool_t  CanEditMainTransparency()      { return kTRUE; }
   virtual UChar_t GetMainTransparency() const    { return fTransparency; }
-  virtual void    SetMainTransparency(UChar_t t) { fTransparency = t; }  
+  virtual void    SetMainTransparency(UChar_t t) { fTransparency = t; }
 
   virtual Bool_t  CanEditMainHMTrans() { return  kTRUE; }
   virtual ZTrans* PtrMainHMTrans()     { return &fHMTrans; }
@@ -142,7 +163,7 @@ public:
   virtual void Paint(Option_t* option="");
 
   static GeoShapeRnrEl* ImportShapeExtract(TGeoShapeExtract* gse, RenderElement* parent);
-  
+
   // NLTGeoProjectable
   virtual TBuffer3D*           MakeBuffer3D();
 
index 3e43f0d97c977442a677b7e4f1467820683b1103..f74e675f8f4a470d207c4eb29836e28e276f5dd1 100644 (file)
 
 // Non-linear transformations
 #pragma link C++ class Reve::NLTProjectable+;
-#pragma link C++ class Reve::NLTGeoProjectable+;
 #pragma link C++ class Reve::NLTProjected+;
 #pragma link C++ class Reve::NLTProjection+;
-//#pragma link C++ class Reve::PhiZ+;
 #pragma link C++ class Reve::RhoZ+;
 #pragma link C++ class Reve::CircularFishEye+;
 
 #pragma link C++ class Reve::BoxSetGL+;
 
 // GeoNode
+#pragma link C++ class Reve::GeoRnrEl+;
 #pragma link C++ class Reve::GeoNodeRnrEl+;
 #pragma link C++ class Reve::GeoTopNodeRnrEl+;
 #pragma link C++ class Reve::GeoNodeRnrElEditor+;
index a2f318e6d786c4d00c4bc62719e7c24b57c18bcf..2b561704ebf1ad380efb42d2eb675788e5ea38a5 100644 (file)
@@ -22,20 +22,6 @@ NLTProjectable::~NLTProjectable()
   }
 }
 
-//______________________________________________________________________
-// NLTGeoProjectable
-//
-
-ClassImp(NLTGeoProjectable)
-
-NLTGeoProjectable::NLTGeoProjectable()
-{}
-
-TClass* NLTGeoProjectable::ProjectedClass() const
-{
-   return NLTPolygonSet::Class();
-} 
-
 //______________________________________________________________________
 // NLTProjected
 //
@@ -74,5 +60,5 @@ void NLTProjected::UnRefProjectable(NLTProjectable* assumed_parent)
   if (fProjectable) {
     fProjectable->RemoveProjected(this);
     fProjectable = 0;
-  } 
+  }
 }
index 1020b97e2b1ec97d47deb55d8c0230e81ab66dd1..97a9ba1cab76db936528654891b10a136cf7a232 100644 (file)
@@ -36,23 +36,6 @@ public:
   ClassDef(NLTProjectable, 0);
 }; // endclass NLTProjectable
 
-
-class NLTGeoProjectable : public NLTProjectable
-{
-private:
-  NLTGeoProjectable(const NLTGeoProjectable&);            // Not implemented
-  NLTGeoProjectable& operator=(const NLTGeoProjectable&); // Not implemented
-
-public:
-  NLTGeoProjectable();
-  virtual ~NLTGeoProjectable() {}
-
-  virtual TBuffer3D*     MakeBuffer3D() = 0;
-  virtual TClass*        ProjectedClass() const;
-
-  ClassDef(NLTGeoProjectable, 0);
-};
-
 /**************************************************************************/
 
 class NLTProjected