CMS 3D CMS Logo

FWEveDetectorGeo.cc
Go to the documentation of this file.
7 
8 #include "TGeoMatrix.h"
9 
10 //==============================================================================
11 //==============================================================================
12 //==============================================================================
13 FWEveDetectorGeo::FWEveDetectorGeo(FWGeometryTableView* v) : m_browser(v), m_maxLevel(0), m_filterOff(false) {}
14 
16 
18 //______________________________________________________________________________
19 
20 void FWEveDetectorGeo::Paint(Option_t* opt) {
22 
23  // printf("PAINPAINTPAINTPAINTPAINTPAINTPAINTPAINTPAINTPAINTT %d/%d \n", m_browser->getTopNodeIdx(), (int)m_browser->getTableManager()->refEntries().size());
24  if (m_browser->getTableManager()->refEntries().empty())
25  return;
26 
27  TEveGeoManagerHolder gmgr(FWGeometryTableViewManager::getGeoMangeur());
28 
30 
31  m_filterOff = m_browser->getFilter().empty();
32 
33  Int_t topIdx = m_browser->getTopNodeIdx();
35 
36  TGeoHMatrix mtx;
37  if (topIdx >= 0) {
38  std::advance(sit, topIdx);
40  }
41 
42  bool drawsChildren = false;
43 
44  if (((FWGeometryTableManager*)tableManager())->getVisibilityChld(*sit))
45  drawsChildren = paintChildNodesRecurse(sit, topIdx, mtx);
46 
47  if (sit->testBit(FWGeometryTableManagerBase::kVisNodeSelf) &&
48  ((FWGeometryTableManager*)tableManager())->getVisibility(*sit))
49  paintShape(topIdx, mtx, m_browser->getVolumeMode(), drawsChildren);
50 
51  fflush(stdout);
52 }
53 
54 // ______________________________________________________________________
56  Int_t cnt,
57  const TGeoHMatrix& parentMtx) {
58  TGeoNode* parentNode = pIt->m_node;
59  int nD = parentNode->GetNdaughters();
60 
61  int dOff = 0;
62 
63  pIt++;
64  int pcnt = cnt + 1;
65 
66  bool drawsChildNodes = false;
67 
69  for (int n = 0; n != nD; ++n) {
70  it = pIt;
71  std::advance(it, n + dOff);
72  cnt = pcnt + n + dOff;
73 
74  TGeoHMatrix nm = parentMtx;
75  nm.Multiply(it->m_node->GetMatrix());
76 
77  bool drawsChildNodesSecondGen = false;
79  if (((FWGeometryTableManager*)tableManager())->getVisibilityChld(*it) && (it->m_level < m_maxLevel)) {
80  drawsChildNodesSecondGen = paintChildNodesRecurse(it, cnt, nm);
81  }
82 
83  if (((FWGeometryTableManager*)tableManager())->getVisibility(*it)) {
84  paintShape(cnt, nm, m_browser->getVolumeMode(), drawsChildNodesSecondGen);
85  drawsChildNodes = true;
86  }
87 
88  } else {
89  if (((FWGeometryTableManager*)tableManager())->getVisibilityChld(*it) &&
90  (it->m_level < m_maxLevel || m_browser->getIgnoreVisLevelWhenFilter())) {
91  drawsChildNodesSecondGen = paintChildNodesRecurse(it, cnt, nm);
92  }
93 
94  ((FWGeometryTableManager*)tableManager())->assertNodeFilterCache(*it);
95  if (((FWGeometryTableManager*)tableManager())->getVisibility(*it)) {
96  paintShape(cnt, nm, m_browser->getVolumeMode(), drawsChildNodesSecondGen);
97  drawsChildNodes = true;
98  }
99  }
100 
101  drawsChildNodes |= drawsChildNodesSecondGen;
102  FWGeometryTableManagerBase::getNNodesTotal(parentNode->GetDaughter(n), dOff);
103  }
104 
105  return drawsChildNodes;
106 }
107 
108 //______________________________________________________________________________
109 
111  std::set<TGLPhysicalShape*>::iterator it = fHted.begin();
112  int idx = tableIdx(*it);
113  if (idx > 0) {
115  return data.name();
116  }
117  return "error";
118 }
119 
120 //_____________________________________________________________________________
121 
122 void FWEveDetectorGeo::popupMenu(int x, int y, TGLViewer* v) {
123  FWPopupMenu* nodePopup = FWGeoTopNode::setPopupMenu(x, y, v, false);
124 
125  if (nodePopup)
126  nodePopup->Connect("Activated(Int_t)", "FWGeometryTableView", m_browser, "chosenItem(Int_t)");
127 }
void Paint(Option_t *option="") override
bool paintChildNodesRecurse(FWGeometryTableManagerBase::Entries_i pIt, Int_t idx, const TGeoHMatrix &mtx)
bool getIgnoreVisLevelWhenFilter() const
FWEveDetectorGeo(FWGeometryTableView *v)
void popupMenu(int x, int y, TGLViewer *) override
FWGeometryTableViewBase * browser() override
TString GetHighlightTooltip() override
std::string getFilter() const
static void getNNodesTotal(TGeoNode *geoNode, int &off)
FWPopupMenu * setPopupMenu(int iX, int iY, TGLViewer *v, bool)
FWGeometryTableManagerBase * tableManager() override
FWGeometryTableManagerBase * getTableManager() override
std::set< TGLPhysicalShape * > fHted
Definition: FWGeoTopNode.h:71
void paintShape(Int_t idx, const TGeoHMatrix &nm, bool volumeColor, bool parentNode)
FWGeometryTableView * m_browser
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
void Paint(Option_t *option="") override
void getNodeMatrix(const NodeInfo &nodeInfo, TGeoHMatrix &mat) const
float x
static int tableIdx(TGLPhysicalShape *ps)
Definition: FWGeoTopNode.cc:55
bool isSelectedByRegion() const