CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

FWGeoTopNode Class Reference

#include <Fireworks/Core/interface/FWGeoTopNode.h>

List of all members.

Public Member Functions

 FWGeoTopNode (FWGeometryTableView *)
virtual void Paint (Option_t *option="")
virtual ~FWGeoTopNode ()

Private Member Functions

 FWGeoTopNode (const FWGeoTopNode &)
const FWGeoTopNodeoperator= (const FWGeoTopNode &)
void paintChildNodesRecurse (FWGeometryTableManager::Entries_i pIt, const TGeoHMatrix &mtx)
void paintShape (FWGeometryTableManager::NodeInfo &nodeInfo, const TGeoHMatrix &nm)
void setupBuffMtx (TBuffer3D &buff, const TGeoHMatrix &mat)

Private Attributes

FWGeometryTableViewm_browser
FWGeometryTableManager::Entries_vm_entries
bool m_filterOff
int m_maxLevel

Detailed Description

Description: [one line class summary]

Usage: <usage>

Definition at line 33 of file FWGeoTopNode.h.


Constructor & Destructor Documentation

FWGeoTopNode::FWGeoTopNode ( FWGeometryTableView t)
FWGeoTopNode::~FWGeoTopNode ( ) [virtual]

Definition at line 52 of file FWGeoTopNode.cc.

{
}
FWGeoTopNode::FWGeoTopNode ( const FWGeoTopNode ) [private]

Member Function Documentation

const FWGeoTopNode& FWGeoTopNode::operator= ( const FWGeoTopNode ) [private]
void FWGeoTopNode::Paint ( Option_t *  option = "") [virtual]
void FWGeoTopNode::paintChildNodesRecurse ( FWGeometryTableManager::Entries_i  pIt,
const TGeoHMatrix &  mtx 
) [private]

Definition at line 104 of file FWGeoTopNode.cc.

References FWGeometryTableManager::assertNodeFilterCache(), FWGeometryTableView::getIgnoreVisLevelWhenFilter(), FWGeometryTableManager::getNNodesTotal(), FWGeometryTableView::getTableManager(), FWGeometryTableManager::getVisibility(), FWGeometryTableManager::getVisibilityChld(), m_browser, m_filterOff, m_maxLevel, n, and paintShape().

Referenced by Paint().

{ 
   TGeoNode* parentNode =  pIt->m_node;
   int nD = parentNode->GetNdaughters();

   int dOff=0;
   pIt++;

   FWGeometryTableManager::Entries_i it;
   for (int n = 0; n != nD; ++n)
   {
      it =  pIt;
      std::advance(it,n + dOff);

      TGeoHMatrix nm = parentMtx;
      nm.Multiply(it->m_node->GetMatrix());

  
      if (m_filterOff)
      {
         if ( m_browser->getTableManager()->getVisibility(*it))
            paintShape(*it, nm);

         if  ( m_browser->getTableManager()->getVisibilityChld(*it) && it->m_level < m_maxLevel )
            paintChildNodesRecurse(it, nm);

      }
      else
      {
         m_browser->getTableManager()->assertNodeFilterCache(*it);
         if ( m_browser->getTableManager()->getVisibility(*it))
            paintShape(*it, nm);

         if ( m_browser->getTableManager()->getVisibilityChld(*it) && ( it->m_level < m_maxLevel || m_browser->getIgnoreVisLevelWhenFilter() ))
            paintChildNodesRecurse(it, nm);
      }


      FWGeometryTableManager::getNNodesTotal(parentNode->GetDaughter(n), dOff);  
   }
}
void FWGeoTopNode::paintShape ( FWGeometryTableManager::NodeInfo nodeInfo,
const TGeoHMatrix &  nm 
) [private]

Definition at line 147 of file FWGeoTopNode.cc.

References GetTransform(), FWGeometryTableView::getVolumeMode(), WDecay::kNone, m_browser, FWGeometryTableManager::NodeInfo::m_color, FWGeometryTableManager::NodeInfo::m_node, and setupBuffMtx().

Referenced by Paint(), and paintChildNodesRecurse().

{ 
   static const TEveException eh("FWGeoTopNode::paintShape ");
  

   TGeoShape* shape = data.m_node->GetVolume()->GetShape();
   TGeoCompositeShape* compositeShape = dynamic_cast<TGeoCompositeShape*>(shape);
   if (compositeShape)
   {
      // printf("!!!!!!!!!!!!!!!!!!!! composite shape\n");
      Double_t halfLengths[3] = { compositeShape->GetDX(), compositeShape->GetDY(), compositeShape->GetDZ() };

      TBuffer3D buff(TBuffer3DTypes::kComposite);
      buff.fID           = data.m_node->GetVolume();
      //   buff.fColor        = data.m_color;
      buff.fColor        =  m_browser->getVolumeMode() ? data.m_node->GetVolume()->GetLineColor(): data.m_color;
      buff.fTransparency = data.m_node->GetVolume()->GetTransparency(); 

      nm.GetHomogenousMatrix(buff.fLocalMaster);        
      // RefMainTrans().SetBuffer3D(buff);
      buff.fLocalFrame   = kTRUE; // Always enforce local frame (no geo manager).
      buff.SetAABoundingBox(compositeShape->GetOrigin(), halfLengths);
      buff.SetSectionsValid(TBuffer3D::kCore|TBuffer3D::kBoundingBox);

      Bool_t paintComponents = kTRUE;

      // Start a composite shape, identified by this buffer
      if (TBuffer3D::GetCSLevel() == 0)
         paintComponents = gPad->GetViewer3D()->OpenComposite(buff);

      TBuffer3D::IncCSLevel();

      // Paint the boolean node - will add more buffers to viewer
      TGeoHMatrix xxx;
      TGeoMatrix *gst = TGeoShape::GetTransform();
      TGeoShape::SetTransform(&xxx);
      if (paintComponents) compositeShape->GetBoolNode()->Paint("");
      TGeoShape::SetTransform(gst);
      // Close the composite shape
      if (TBuffer3D::DecCSLevel() == 0)
      gPad->GetViewer3D()->CloseComposite();

   }
   else
   {
      TBuffer3D& buff = (TBuffer3D&) shape->GetBuffer3D (TBuffer3D::kCore, kFALSE);
      setupBuffMtx(buff, nm);
      buff.fID           = data.m_node->GetVolume();
      buff.fColor        =  m_browser->getVolumeMode() ? data.m_node->GetVolume()->GetLineColor(): data.m_color;
      buff.fTransparency =  data.m_node->GetVolume()->GetTransparency();

      nm.GetHomogenousMatrix(buff.fLocalMaster);
      buff.fLocalFrame   = kTRUE; // Always enforce local frame (no geo manager).

      Int_t sections = TBuffer3D::kBoundingBox | TBuffer3D::kShapeSpecific;
      shape->GetBuffer3D(sections, kTRUE);

           
      Int_t reqSec = gPad->GetViewer3D()->AddObject(buff);

      if (reqSec != TBuffer3D::kNone) {
         // This shouldn't happen, but I suspect it does sometimes.
         if (reqSec & TBuffer3D::kCore)
            Warning(eh, "Core section required again for shape='%s'. This shouldn't happen.", GetName());
         shape->GetBuffer3D(reqSec, kTRUE);
         reqSec = gPad->GetViewer3D()->AddObject(buff);
      }

      if (reqSec != TBuffer3D::kNone)  
         Warning(eh, "Extra section required: reqSec=%d, shape=%s.", reqSec, GetName());
   }
}
void FWGeoTopNode::setupBuffMtx ( TBuffer3D &  buff,
const TGeoHMatrix &  mat 
) [private]

Definition at line 58 of file FWGeoTopNode.cc.

References m, csvReporter::r, asciidump::s, and matplotRender::t.

Referenced by paintShape().

{
   const Double_t *r = mat.GetRotationMatrix();
   const Double_t *t = mat.GetTranslation();
   const Double_t *s = mat.GetScale();
   Double_t       *m = buff.fLocalMaster;
   m[0]  = r[0]*s[0]; m[1]  = r[1]*s[1]; m[2]  = r[2]*s[2]; m[3]  = 0;
   m[4]  = r[3]*s[0]; m[5]  = r[4]*s[1]; m[6]  = r[5]*s[2]; m[7]  = 0;
   m[8]  = r[6]*s[0]; m[9]  = r[7]*s[1]; m[10] = r[8]*s[2]; m[11] = 0;
   m[12] = t[0];      m[13] = t[1];      m[15] = t[2];      m[15] = 1;

   buff.fLocalFrame = kTRUE;
}

Member Data Documentation

Definition at line 49 of file FWGeoTopNode.h.

Referenced by FWGeoTopNode(), Paint(), paintChildNodesRecurse(), and paintShape().

Definition at line 52 of file FWGeoTopNode.h.

Referenced by FWGeoTopNode(), and Paint().

bool FWGeoTopNode::m_filterOff [private]

Definition at line 54 of file FWGeoTopNode.h.

Referenced by Paint(), and paintChildNodesRecurse().

int FWGeoTopNode::m_maxLevel [private]

Definition at line 53 of file FWGeoTopNode.h.

Referenced by Paint(), and paintChildNodesRecurse().