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 <boost/bind.hpp>
14 #include "TEveScene.h"
15 #include "TEveManager.h"
16 #include "TEveCompound.h"
17 
21 
23  m_context(context),
24  m_geom(0),
25  m_projected(projected)
26 {
27  m_geom = context.getGeom();
28 
29  for (int i = 0; i < kFWGeomColorSize; ++i)
30  {
31  m_colorComp[i] = new TEveCompound(Form("3D view color compund [%d]", i));
34  m_colorComp[i]->CSCApplyMainColorToAllChildren();
35  m_colorComp[i]->CSCApplyMainTransparencyToMatchingChildren();
36  }
39 }
40 
42 {
43  m_transpConnection.disconnect();
44  m_colorConnection.disconnect();
45  for (int i = 0; i < kFWGeomColorSize; ++i)
46  {
47  if (m_colorComp[i]) m_colorComp[i]->Destroy();
48  }
49 }
50 
51 void
52 FWViewGeometryList::addToCompound(TEveElement* el, FWGeomColorIndex colIdx , bool applyTransp) const
53 {
54  el->SetMainColor( m_colorComp[colIdx]->GetMainColor());
55  if (applyTransp)
56  el->SetMainTransparency( m_colorComp[colIdx]->GetMainTransparency());
57 
58  el->SetPickable(true);
59  m_colorComp[colIdx]->AddElement(el);
60 }
61 
62 void
64 {
65  // printf("%p FWViewGeometryList::updateColors projected %d %s \n", this, m_projected, GetElementName());
66  for (int i = 0; i < kFWGeomColorSize; ++i)
67  {
70  m_colorComp[i]->ElementChanged();
71  }
72 }
73 
74 void
76 {
77  // printf("%p transp [%d]\n", this, iTransp);
78 
79  if (projectedType == m_projected)
80  {
81  for (int i = 0; i < kFWGeomColorSize; ++i)
82  {
83  m_colorComp[i]->SetMainTransparency(m_context.colorManager()->geomTransparency(projectedType));
84  m_colorComp[i]->ElementChanged();
85  }
86  }
87 }
sigc::signal< void > geomColorsHaveChanged_
Color_t geomTransparency(bool projected) const
TEveCompound * m_colorComp[kFWGeomColorSize]
const FWGeometry * getGeom() const
Definition: Context.h:83
FWColorManager * colorManager() const
Definition: Context.h:65
FWGeomColorIndex
FWViewGeometryList(const fireworks::Context &context, bool projected=true)
sigc::signal< void, bool > geomTransparencyHaveChanged_
void updateTransparency(bool projectedType)
void addToCompound(TEveElement *el, FWGeomColorIndex idx, bool applyTransp=true) const
const FWGeometry * m_geom
sigc::connection m_transpConnection
sigc::connection m_colorConnection
Color_t geomColor(FWGeomColorIndex) const
const fireworks::Context & m_context