CMS 3D CMS Logo

List of all members | Public Member Functions | Private 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)
 
const FWEventItemitem () const
 
void itemChanged ()
 
void modelChanges (const std::set< FWModelId > &)
 
virtual ~FWInteractionList ()
 

Private Member Functions

 FWInteractionList (const FWInteractionList &)
 
const FWInteractionListoperator= (const FWInteractionList &)
 

Private Attributes

std::vector< TEveCompound * > m_compounds
 
const FWEventItemm_item
 

Detailed Description

Description: [one line class summary]

Usage: <usage>

Definition at line 32 of file FWInteractionList.h.

Constructor & Destructor Documentation

FWInteractionList::FWInteractionList ( const FWEventItem item)

Definition at line 37 of file FWInteractionList.cc.

Referenced by empty().

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

Definition at line 46 of file FWInteractionList.cc.

References mps_fire::i, and m_compounds.

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

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 71 of file FWInteractionList.cc.

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

Referenced by FWProxyBuilderBase::build(), and empty().

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

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

Definition at line 149 of file FWInteractionList.cc.

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

Referenced by empty().

150 { for (size_t i = 0, e = m_item->size(); i < e; ++i)
151  {
152  // Assert for sizes is not necessary, becuse it is already in a
153  // proxy builder.
154  TEveElement* comp = m_compounds[i];
155 
159 
160  comp->SetElementTitle(name.c_str());
161 
163  const FWDisplayProperties &p = info.displayProperties();
164 
165  if (p.isVisible() != comp->GetRnrSelf())
166  comp->EnableListElements(p.isVisible(), p.isVisible());
167 
168  if (p.color() != comp->GetMainColor())
169  comp->SetMainColor(p.color());
170 
171  if (p.transparency() != comp->GetMainTransparency())
172  comp->SetMainTransparency(p.transparency());
173 
174  }
175 }
static const TGPicture * info(bool iBackgroundIsBlack)
const FWDisplayProperties & displayProperties() const
Definition: FWEventItem.h:68
std::string modelName(int iIndex) const
Definition: FWEventItem.cc:576
bool haveInterestingValue() const
Definition: FWEventItem.cc:589
Color_t color() const
const FWEventItem * m_item
Char_t transparency() const
const std::string & modelInterestingValueAsString(int iIndex) const
Definition: FWEventItem.cc:596
size_t size() const
Definition: FWEventItem.cc:550
std::vector< TEveCompound * > m_compounds
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:537
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 117 of file FWInteractionList.cc.

References 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().

Referenced by empty().

118 {
119  assert (m_compounds.size() >= m_item->size());
120 
121  for (std::set<FWModelId>::const_iterator it = iIds.begin(); it != iIds.end(); ++it)
122  {
123  const FWEventItem::ModelInfo& info = m_item->modelInfo(it->index());
124  // std::cout <<" FWInteractionList::modelChanges color "<< info.displayProperties().color() << "(*it).index() " <<(*it).index() << " " << m_item->name() <<std::endl;
125  const FWDisplayProperties &p = info.displayProperties();
126  TEveElement* comp = m_compounds[it->index()];
127  comp->EnableListElements(p.isVisible(), p.isVisible());
128  comp->SetMainColor(p.color());
129  comp->SetMainTransparency(p.transparency());
130 
131  if (info.isSelected())
132  {
133  if (comp->GetSelectedLevel() != 1)
134  gEve->GetSelection()->AddElement(comp);
135  }
136  else
137  {
138  if (comp->GetSelectedLevel() == 1)
139  gEve->GetSelection()->RemoveElement(comp);
140  }
141  }
142 }
static const TGPicture * info(bool iBackgroundIsBlack)
const FWDisplayProperties & displayProperties() const
Definition: FWEventItem.h:68
bool isSelected() const
Definition: FWEventItem.h:71
Color_t color() const
const FWEventItem * m_item
Char_t transparency() const
size_t size() const
Definition: FWEventItem.cc:550
std::vector< TEveCompound * > m_compounds
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:537
const FWInteractionList& FWInteractionList::operator= ( const FWInteractionList )
private

Referenced by empty().

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().