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
//
12
13
#include <boost/bind.hpp>
14
#include "TEveScene.h"
15
#include "TEveManager.h"
16
#include "TEveCompound.h"
17
18
#include "
Fireworks/Core/interface/FWViewGeometryList.h
"
19
#include "
Fireworks/Core/interface/FWGeometry.h
"
20
#include "
Fireworks/Core/interface/Context.h
"
21
22
FWViewGeometryList::FWViewGeometryList
(
const
fireworks::Context
& context,
bool
projected):
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
));
32
m_colorComp
[
i
]->SetMainColor(
m_context
.
colorManager
()->
geomColor
(
FWGeomColorIndex
(
i
)));
33
m_colorComp
[
i
]->SetMainTransparency(
m_context
.
colorManager
()->
geomTransparency
(
m_projected
));
34
m_colorComp
[
i
]->CSCApplyMainColorToAllChildren();
35
m_colorComp
[
i
]->CSCApplyMainTransparencyToMatchingChildren();
36
}
37
m_colorConnection
= context.
colorManager
()->
geomColorsHaveChanged_
.connect(boost::bind(&
FWViewGeometryList::updateColors
,
this
));
38
m_transpConnection
= context.
colorManager
()->
geomTransparencyHaveChanged_
.connect(boost::bind(&
FWViewGeometryList::updateTransparency
,
this
, _1));
39
}
40
41
FWViewGeometryList::~FWViewGeometryList
()
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
63
FWViewGeometryList::updateColors
()
64
{
65
// printf("%p FWViewGeometryList::updateColors projected %d %s \n", this, m_projected, GetElementName());
66
for
(
int
i
= 0;
i
<
kFWGeomColorSize
; ++
i
)
67
{
68
m_colorComp
[
i
]->SetMainColor(
m_context
.
colorManager
()->
geomColor
(
FWGeomColorIndex
(
i
)));
69
m_colorComp
[
i
]->SetMainTransparency(
m_context
.
colorManager
()->
geomTransparency
(
m_projected
));
70
m_colorComp
[
i
]->ElementChanged();
71
}
72
}
73
74
void
75
FWViewGeometryList::updateTransparency
(
bool
projectedType)
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
}
FWColorManager::geomColorsHaveChanged_
sigc::signal< void > geomColorsHaveChanged_
Definition:
FWColorManager.h:95
i
int i
Definition:
DBlmapReader.cc:9
FWViewGeometryList::m_projected
bool m_projected
Definition:
FWViewGeometryList.h:59
FWGeometry.h
FWColorManager::geomTransparency
Color_t geomTransparency(bool projected) const
Definition:
FWColorManager.h:92
FWViewGeometryList::m_colorComp
TEveCompound * m_colorComp[kFWGeomColorSize]
Definition:
FWViewGeometryList.h:47
fireworks::Context::getGeom
const FWGeometry * getGeom() const
Definition:
Context.h:83
fireworks::Context::colorManager
FWColorManager * colorManager() const
Definition:
Context.h:65
FWGeomColorIndex
FWGeomColorIndex
Definition:
FWColorManager.h:32
Context.h
FWViewGeometryList::FWViewGeometryList
FWViewGeometryList(const fireworks::Context &context, bool projected=true)
Definition:
FWViewGeometryList.cc:22
FWColorManager::geomTransparencyHaveChanged_
sigc::signal< void, bool > geomTransparencyHaveChanged_
Definition:
FWColorManager.h:96
FWViewGeometryList::updateTransparency
void updateTransparency(bool projectedType)
Definition:
FWViewGeometryList.cc:75
FWViewGeometryList::addToCompound
void addToCompound(TEveElement *el, FWGeomColorIndex idx, bool applyTransp=true) const
Definition:
FWViewGeometryList.cc:52
FWViewGeometryList.h
fireworks::Context
Definition:
Context.h:41
FWViewGeometryList::m_geom
const FWGeometry * m_geom
Definition:
FWViewGeometryList.h:45
FWViewGeometryList::~FWViewGeometryList
virtual ~FWViewGeometryList()
Definition:
FWViewGeometryList.cc:41
FWViewGeometryList::updateColors
void updateColors()
Definition:
FWViewGeometryList.cc:63
FWViewGeometryList::m_transpConnection
sigc::connection m_transpConnection
Definition:
FWViewGeometryList.h:57
FWViewGeometryList::m_colorConnection
sigc::connection m_colorConnection
Definition:
FWViewGeometryList.h:58
FWColorManager::geomColor
Color_t geomColor(FWGeomColorIndex) const
Definition:
FWColorManager.cc:367
FWViewGeometryList::m_context
const fireworks::Context & m_context
Definition:
FWViewGeometryList.h:44
kFWGeomColorSize
Definition:
FWColorManager.h:40
Generated for CMSSW Reference Manual by
1.8.5