CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
FWInteractionList Class Reference

#include <Fireworks/Core/interface/FWInteractionList.h>

Public Member Functions

void added (TEveElement *, unsigned int)
 
bool empty () const
 
 FWInteractionList (const FWEventItem *item)
 
 FWInteractionList (const FWInteractionList &)=delete
 
const FWEventItemitem () const
 
void itemChanged ()
 
void modelChanges (const std::set< FWModelId > &)
 
const FWInteractionListoperator= (const FWInteractionList &)=delete
 
virtual ~FWInteractionList ()
 

Private Attributes

std::vector< TEveCompound * > m_compounds
 
const FWEventItemm_item
 

Detailed Description

Description: [one line class summary]

Usage: <usage>

Definition at line 33 of file FWInteractionList.h.

Constructor & Destructor Documentation

FWInteractionList::FWInteractionList ( const FWEventItem item)

Definition at line 35 of file FWInteractionList.cc.

35 : m_item(item) {}
const FWEventItem * m_item
FWInteractionList::~FWInteractionList ( )
virtual

Definition at line 42 of file FWInteractionList.cc.

References mps_fire::i, and m_compounds.

42  {
43  for (std::vector<TEveCompound*>::iterator i = m_compounds.begin(); i != m_compounds.end(); ++i) {
44  // Interaction are created only in the standard use case, where user data is FWFromEveSelectorBase.
45  // This is defined with return value of virtual function FWPRoxyBuilderBase::willHandleInteraction().
46 
47  if ((*i)->GetUserData())
48  delete reinterpret_cast<FWFromEveSelectorBase*>((*i)->GetUserData());
49 
50  (*i)->RemoveElements();
51  (*i)->DecDenyDestroy();
52  }
53 }
std::vector< TEveCompound * > m_compounds
FWInteractionList::FWInteractionList ( const FWInteractionList )
delete

Member Function Documentation

void FWInteractionList::added ( TEveElement *  el,
unsigned int  idx 
)

This function is called from FWProxyBuilderBase::build() function (e.g. on next event). The PB build function creates TEveElement for each element of collection and calls this function to add the element to "master" element, which is a TEveCompound.

Definition at line 63 of file FWInteractionList.cc.

References c, FWDisplayProperties::color(), FWEventItem::defaultDisplayProperties(), FWEventItem::haveInterestingValue(), FWDisplayProperties::isVisible(), m_compounds, m_item, FWEventItem::modelInterestingValueAsString(), FWEventItem::modelName(), mergeVDriftHistosByStation::name, AlCaHLTBitMon_QueryRunRegistry::string, and FWDisplayProperties::transparency().

Referenced by FWProxyBuilderBase::build().

63  {
64  // In the case a compound for the given index already exists, just add
65  // the TEveElement to it, otherwise create a new one.
66  if (idx < m_compounds.size()) {
67  m_compounds[idx]->AddElement(el);
68  return;
69  }
70 
71  // Prepare name for the tooltip on mouseover in GL viewer.Value of
72  // tooltip is TEveElement::fTitle
76 
77  TEveCompound* c = new TEveCompound(name.c_str(), name.c_str());
78  c->EnableListElements(m_item->defaultDisplayProperties().isVisible());
79  c->SetMainColor(m_item->defaultDisplayProperties().color());
80  c->SetMainTransparency(m_item->defaultDisplayProperties().transparency());
81 
82  // Set flags to propagat attributes.
83  c->CSCImplySelectAllChildren();
84  c->CSCApplyMainColorToAllChildren();
85  c->CSCApplyMainTransparencyToAllChildren();
86 
87  // TEveElement is auto-destroyed if is is not added to any parent. Alternative could
88  // be to use increase/decrease reference count.
89  c->IncDenyDestroy();
90  // FWModelIdFromEveSelector is needed for interaction from Eve to Fireworks.
91  // FWEveViewManager gets ROOT signals with selected objects (TEveCompound)
92  // then cals doSelect() on the compound's user data.
93  c->SetUserData(new FWModelIdFromEveSelector(FWModelId(m_item, idx)));
94  // Order does not matter. What is added to TEveCompound is not concern of interaction list.
95  // Interaction list operates ony with the compound.
96  m_compounds.push_back(c);
97  m_compounds.back()->AddElement(el);
98  // printf("%s[%d] FWInteractionList::added has childern %d\n",m_item->name().c_str(), idx, m_compounds[idx]->NumChildren());
99 }
const FWDisplayProperties & defaultDisplayProperties() const
Definition: FWEventItem.cc:403
const edm::EventSetup & c
std::string modelName(int iIndex) const
Definition: FWEventItem.cc:471
bool haveInterestingValue() const
Definition: FWEventItem.cc:482
Color_t color() const
const FWEventItem * m_item
Char_t transparency() const
const std::string & modelInterestingValueAsString(int iIndex) const
Definition: FWEventItem.cc:486
std::vector< TEveCompound * > m_compounds
bool FWInteractionList::empty ( void  ) const
inline

Definition at line 41 of file FWInteractionList.h.

References m_compounds.

41 { return m_compounds.empty(); }
std::vector< TEveCompound * > m_compounds
const FWEventItem* FWInteractionList::item ( ) const
inline

Definition at line 40 of file FWInteractionList.h.

References m_item.

40 { return m_item; }
const FWEventItem * m_item
void FWInteractionList::itemChanged ( )

This method is called from FWEveViewManager::itemChanged(), which is a callback of signal FWEventItem::itemChanged_.

Definition at line 130 of file FWInteractionList.cc.

References FWDisplayProperties::color(), AlCaHLTBitMon_QueryRunRegistry::comp, FWEventItem::ModelInfo::displayProperties(), alignCSCRings::e, FWEventItem::haveInterestingValue(), mps_fire::i, info(), FWDisplayProperties::isVisible(), m_compounds, m_item, FWEventItem::modelInfo(), FWEventItem::modelInterestingValueAsString(), FWEventItem::modelName(), mergeVDriftHistosByStation::name, AlCaHLTBitMon_ParallelJobs::p, FWEventItem::size(), AlCaHLTBitMon_QueryRunRegistry::string, and FWDisplayProperties::transparency().

130  {
131  for (size_t i = 0, e = m_item->size(); i < e; ++i) {
132  // Assert for sizes is not necessary, becuse it is already in a
133  // proxy builder.
134  TEveElement* comp = m_compounds[i];
135 
139 
140  comp->SetElementTitle(name.c_str());
141 
143  const FWDisplayProperties& p = info.displayProperties();
144 
145  if (p.isVisible() != comp->GetRnrSelf())
146  comp->EnableListElements(p.isVisible(), p.isVisible());
147 
148  if (p.color() != comp->GetMainColor())
149  comp->SetMainColor(p.color());
150 
151  if (p.transparency() != comp->GetMainTransparency())
152  comp->SetMainTransparency(p.transparency());
153  }
154 }
static const TGPicture * info(bool iBackgroundIsBlack)
const FWDisplayProperties & displayProperties() const
Definition: FWEventItem.h:64
std::string modelName(int iIndex) const
Definition: FWEventItem.cc:471
bool haveInterestingValue() const
Definition: FWEventItem.cc:482
Color_t color() const
const FWEventItem * m_item
Char_t transparency() const
const std::string & modelInterestingValueAsString(int iIndex) const
Definition: FWEventItem.cc:486
size_t size() const
Definition: FWEventItem.cc:457
std::vector< TEveCompound * > m_compounds
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:446
void FWInteractionList::modelChanges ( const std::set< FWModelId > &  iIds)

This method is called from FWEveViewManager::modelChanges(), which has modelChanges callback same as all other view maangers.

Definition at line 104 of file FWInteractionList.cc.

References cms::cuda::assert(), FWDisplayProperties::color(), AlCaHLTBitMon_QueryRunRegistry::comp, FWEventItem::ModelInfo::displayProperties(), info(), FWEventItem::ModelInfo::isSelected(), FWDisplayProperties::isVisible(), m_compounds, m_item, FWEventItem::modelInfo(), AlCaHLTBitMon_ParallelJobs::p, FWEventItem::size(), and FWDisplayProperties::transparency().

104  {
105  assert(m_compounds.size() >= m_item->size());
106 
107  for (std::set<FWModelId>::const_iterator it = iIds.begin(); it != iIds.end(); ++it) {
108  const FWEventItem::ModelInfo& info = m_item->modelInfo(it->index());
109  // std::cout <<" FWInteractionList::modelChanges color "<< info.displayProperties().color() << "(*it).index() " <<(*it).index() << " " << m_item->name() <<std::endl;
110  const FWDisplayProperties& p = info.displayProperties();
111  TEveElement* comp = m_compounds[it->index()];
112  comp->EnableListElements(p.isVisible(), p.isVisible());
113  comp->SetMainColor(p.color());
114  comp->SetMainTransparency(p.transparency());
115 
116  if (info.isSelected()) {
117  if (comp->GetSelectedLevel() != 1)
118  gEve->GetSelection()->AddElement(comp);
119  } else {
120  if (comp->GetSelectedLevel() == 1)
121  gEve->GetSelection()->RemoveElement(comp);
122  }
123  }
124 }
static const TGPicture * info(bool iBackgroundIsBlack)
const FWDisplayProperties & displayProperties() const
Definition: FWEventItem.h:64
bool isSelected() const
Definition: FWEventItem.h:65
assert(be >=bs)
Color_t color() const
const FWEventItem * m_item
Char_t transparency() const
size_t size() const
Definition: FWEventItem.cc:457
std::vector< TEveCompound * > m_compounds
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:446
const FWInteractionList& FWInteractionList::operator= ( const FWInteractionList )
delete

Member Data Documentation

std::vector<TEveCompound*> FWInteractionList::m_compounds
private

Definition at line 59 of file FWInteractionList.h.

Referenced by added(), empty(), itemChanged(), modelChanges(), and ~FWInteractionList().

const FWEventItem* FWInteractionList::m_item
private

Definition at line 60 of file FWInteractionList.h.

Referenced by added(), item(), itemChanged(), and modelChanges().