CMS 3D CMS Logo

FWViewGeometryList.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Core
4 // Class : FWViewGeometryList
5 //
6 // Implementation:
7 // [Notes on implementation]
8 //
9 // Original Author: Alja Mrak-Tadel
10 // Created: Tue Sep 14 13:28:13 CEST 2010
11 //
12 
13 #include <functional>
14 #include "TEveScene.h"
15 #include "TEveManager.h"
16 #include "TEveCompound.h"
17 #include "TEveGeoShape.h"
21 
23  : m_context(context), m_geom(nullptr), m_projected(projected) {
24  m_geom = context.getGeom();
25 
26  for (int i = 0; i < kFWGeomColorSize; ++i) {
27  m_colorComp[i] = new TEveCompound(Form("3D view color compund [%d]", i));
30  m_colorComp[i]->CSCApplyMainColorToAllChildren();
31  m_colorComp[i]->CSCApplyMainTransparencyToMatchingChildren();
32  }
34  context.colorManager()->geomColorsHaveChanged_.connect(std::bind(&FWViewGeometryList::updateColors, this));
35  m_transpConnection = context.colorManager()->geomTransparencyHaveChanged_.connect(
36  std::bind(&FWViewGeometryList::updateTransparency, this, std::placeholders::_1));
37 }
38 
40  m_transpConnection.disconnect();
41  m_colorConnection.disconnect();
42  for (int i = 0; i < kFWGeomColorSize; ++i) {
43  if (m_colorComp[i])
44  m_colorComp[i]->Destroy();
45  }
46 }
47 
48 void FWViewGeometryList::addToCompound(TEveElement* el, FWGeomColorIndex colIdx, bool applyTransp) const {
49  el->SetMainColor(m_colorComp[colIdx]->GetMainColor());
50  if (applyTransp)
51  el->SetMainTransparency(m_colorComp[colIdx]->GetMainTransparency());
52 
53  el->SetPickable(true);
54  m_colorComp[colIdx]->AddElement(el);
55 }
56 
58  // printf("%p FWViewGeometryList::updateColors projected %d %s \n", this, m_projected, GetElementName());
59  for (int i = 0; i < kFWGeomColorSize; ++i) {
62  m_colorComp[i]->ElementChanged();
63  }
64 }
65 
66 void FWViewGeometryList::updateTransparency(bool projectedType) {
67  // printf("%p transp [%d]\n", this, iTransp);
68 
69  if (projectedType == m_projected) {
70  for (int i = 0; i < kFWGeomColorSize; ++i) {
71  m_colorComp[i]->SetMainTransparency(m_context.colorManager()->geomTransparency(projectedType));
72  m_colorComp[i]->ElementChanged();
73  }
74  }
75 }
FWViewGeometryList::m_geom
const FWGeometry * m_geom
Definition: FWViewGeometryList.h:44
mps_fire.i
i
Definition: mps_fire.py:428
fireworks::Context
Definition: Context.h:41
fireworks::Context::colorManager
FWColorManager * colorManager() const
Definition: Context.h:58
FWViewGeometryList::m_context
const fireworks::Context & m_context
Definition: FWViewGeometryList.h:43
FWColorManager::geomTransparency
Color_t geomTransparency(bool projected) const
Definition: FWColorManager.h:97
FWColorManager::geomColor
Color_t geomColor(FWGeomColorIndex) const
Definition: FWColorManager.cc:271
FWViewGeometryList::m_colorConnection
sigc::connection m_colorConnection
Definition: FWViewGeometryList.h:57
visDQMUpload.context
context
Definition: visDQMUpload.py:37
FWViewGeometryList::FWViewGeometryList
FWViewGeometryList(const fireworks::Context &context, bool projected=true)
Definition: FWViewGeometryList.cc:22
FWGeometry.h
FWViewGeometryList::m_projected
bool m_projected
Definition: FWViewGeometryList.h:58
FWViewGeometryList::m_transpConnection
sigc::connection m_transpConnection
Definition: FWViewGeometryList.h:56
FWViewGeometryList::updateColors
void updateColors()
Definition: FWViewGeometryList.cc:57
FWViewGeometryList.h
FWViewGeometryList::updateTransparency
void updateTransparency(bool projectedType)
Definition: FWViewGeometryList.cc:66
kFWGeomColorSize
Definition: FWColorManager.h:42
FWGeomColorIndex
FWGeomColorIndex
Definition: FWColorManager.h:32
FWViewGeometryList::~FWViewGeometryList
~FWViewGeometryList() override
Definition: FWViewGeometryList.cc:39
FWViewGeometryList::m_colorComp
TEveCompound * m_colorComp[kFWGeomColorSize]
Definition: FWViewGeometryList.h:46
Context.h
FWViewGeometryList::addToCompound
void addToCompound(TEveElement *el, FWGeomColorIndex idx, bool applyTransp=true) const
Definition: FWViewGeometryList.cc:48