Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
src
Fireworks
Core
src
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
19
#include "
Fireworks/Core/interface/FWViewGeometryList.h
"
20
#include "
Fireworks/Core/interface/FWGeometry.h
"
21
#include "
Fireworks/Core/interface/Context.h
"
22
23
FWViewGeometryList::FWViewGeometryList
(
const
fireworks::Context
& context,
bool
projected):
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
));
33
m_colorComp
[
i
]->SetMainColor(
m_context
.
colorManager
()->
geomColor
(
FWGeomColorIndex
(
i
)));
34
m_colorComp
[
i
]->SetMainTransparency(
m_context
.
colorManager
()->
geomTransparency
(
m_projected
));
35
m_colorComp
[
i
]->CSCApplyMainColorToAllChildren();
36
m_colorComp
[
i
]->CSCApplyMainTransparencyToMatchingChildren();
37
}
38
m_colorConnection
= context.
colorManager
()->
geomColorsHaveChanged_
.connect(boost::bind(&
FWViewGeometryList::updateColors
,
this
));
39
m_transpConnection
= context.
colorManager
()->
geomTransparencyHaveChanged_
.connect(boost::bind(&
FWViewGeometryList::updateTransparency
,
this
, _1));
40
}
41
42
FWViewGeometryList::~FWViewGeometryList
()
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
64
FWViewGeometryList::updateColors
()
65
{
66
// printf("%p FWViewGeometryList::updateColors projected %d %s \n", this, m_projected, GetElementName());
67
for
(
int
i
= 0;
i
<
kFWGeomColorSize
; ++
i
)
68
{
69
m_colorComp
[
i
]->SetMainColor(
m_context
.
colorManager
()->
geomColor
(
FWGeomColorIndex
(
i
)));
70
m_colorComp
[
i
]->SetMainTransparency(
m_context
.
colorManager
()->
geomTransparency
(
m_projected
));
71
m_colorComp
[
i
]->ElementChanged();
72
}
73
}
74
75
void
76
FWViewGeometryList::updateTransparency
(
bool
projectedType)
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
}
FWColorManager::geomColorsHaveChanged_
sigc::signal< void > geomColorsHaveChanged_
Definition:
FWColorManager.h:96
i
int i
Definition:
DBlmapReader.cc:9
FWViewGeometryList::m_projected
bool m_projected
Definition:
FWViewGeometryList.h:60
FWGeometry.h
FWColorManager::geomTransparency
Color_t geomTransparency(bool projected) const
Definition:
FWColorManager.h:93
FWViewGeometryList::m_colorComp
TEveCompound * m_colorComp[kFWGeomColorSize]
Definition:
FWViewGeometryList.h:48
fireworks::Context::getGeom
const FWGeometry * getGeom() const
Definition:
Context.h:84
fireworks::Context::colorManager
FWColorManager * colorManager() const
Definition:
Context.h:66
FWGeomColorIndex
FWGeomColorIndex
Definition:
FWColorManager.h:33
Context.h
FWViewGeometryList::FWViewGeometryList
FWViewGeometryList(const fireworks::Context &context, bool projected=true)
Definition:
FWViewGeometryList.cc:23
FWColorManager::geomTransparencyHaveChanged_
sigc::signal< void, bool > geomTransparencyHaveChanged_
Definition:
FWColorManager.h:97
FWViewGeometryList::updateTransparency
void updateTransparency(bool projectedType)
Definition:
FWViewGeometryList.cc:76
FWViewGeometryList::addToCompound
void addToCompound(TEveElement *el, FWGeomColorIndex idx, bool applyTransp=true) const
Definition:
FWViewGeometryList.cc:53
FWViewGeometryList.h
fireworks::Context
Definition:
Context.h:42
FWViewGeometryList::m_geom
const FWGeometry * m_geom
Definition:
FWViewGeometryList.h:46
FWViewGeometryList::~FWViewGeometryList
virtual ~FWViewGeometryList()
Definition:
FWViewGeometryList.cc:42
FWViewGeometryList::updateColors
void updateColors()
Definition:
FWViewGeometryList.cc:64
FWViewGeometryList::m_transpConnection
sigc::connection m_transpConnection
Definition:
FWViewGeometryList.h:58
FWViewGeometryList::m_colorConnection
sigc::connection m_colorConnection
Definition:
FWViewGeometryList.h:59
FWColorManager::geomColor
Color_t geomColor(FWGeomColorIndex) const
Definition:
FWColorManager.cc:368
FWViewGeometryList::m_context
const fireworks::Context & m_context
Definition:
FWViewGeometryList.h:45
kFWGeomColorSize
Definition:
FWColorManager.h:41
Generated for CMSSW Reference Manual by
1.8.5