CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 // $Id: FWViewGeometryList.cc,v 1.6 2011/09/27 04:27:08 amraktad Exp $
12 //
13 
14 #include <boost/bind.hpp>
15 #include "TEveScene.h"
16 #include "TEveManager.h"
17 #include "TEveCompound.h"
18 
22 
24  m_context(context),
25  m_geom(0),
26  m_projected(projected)
27 {
28  m_geom = context.getGeom();
29 
30  for (int i = 0; i < kFWGeomColorSize; ++i)
31  {
32  m_colorComp[i] = new TEveCompound(Form("3D view color compund [%d]", i));
35  m_colorComp[i]->CSCApplyMainColorToAllChildren();
36  m_colorComp[i]->CSCApplyMainTransparencyToMatchingChildren();
37  }
40 }
41 
43 {
44  m_transpConnection.disconnect();
45  m_colorConnection.disconnect();
46  for (int i = 0; i < kFWGeomColorSize; ++i)
47  {
48  if (m_colorComp[i]) m_colorComp[i]->Destroy();
49  }
50 }
51 
52 void
53 FWViewGeometryList::addToCompound(TEveElement* el, FWGeomColorIndex colIdx , bool applyTransp) const
54 {
55  el->SetMainColor( m_colorComp[colIdx]->GetMainColor());
56  if (applyTransp)
57  el->SetMainTransparency( m_colorComp[colIdx]->GetMainTransparency());
58 
59  el->SetPickable(true);
60  m_colorComp[colIdx]->AddElement(el);
61 }
62 
63 void
65 {
66  // printf("%p FWViewGeometryList::updateColors projected %d %s \n", this, m_projected, GetElementName());
67  for (int i = 0; i < kFWGeomColorSize; ++i)
68  {
71  m_colorComp[i]->ElementChanged();
72  }
73 }
74 
75 void
77 {
78  // printf("%p transp [%d]\n", this, iTransp);
79 
80  if (projectedType == m_projected)
81  {
82  for (int i = 0; i < kFWGeomColorSize; ++i)
83  {
84  m_colorComp[i]->SetMainTransparency(m_context.colorManager()->geomTransparency(projectedType));
85  m_colorComp[i]->ElementChanged();
86  }
87  }
88 }
sigc::signal< void > geomColorsHaveChanged_
int i
Definition: DBlmapReader.cc:9
Color_t geomTransparency(bool projected) const
TEveCompound * m_colorComp[kFWGeomColorSize]
const FWGeometry * getGeom() const
Definition: Context.h:84
FWColorManager * colorManager() const
Definition: Context.h:66
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