CMS 3D CMS Logo

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

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

Classes

struct  ViewFrame
 

Public Member Functions

void colorsChanged ()
 
std::vector< std::string > detailViewsFor (const FWModelId &) const
 
void eveWindowDestroyed (TEveWindow *)
 
 FWDetailViewManager (FWColorManager *)
 
void newEventCallback ()
 
void openDetailViewFor (const FWModelId &, const std::string &)
 
virtual ~FWDetailViewManager ()
 

Protected Attributes

FWColorManagerm_colorManager
 

Private Types

typedef vViews_t::iterator vViews_i
 
typedef std::vector< ViewFramevViews_t
 

Private Member Functions

std::vector< std::string > findViewersFor (const std::string &) const
 
 FWDetailViewManager (const FWDetailViewManager &)
 
const FWDetailViewManageroperator= (const FWDetailViewManager &)
 

Private Attributes

std::map< std::string,
std::vector< std::string > > 
m_typeToViewers
 
vViews_t m_views
 

Detailed Description

Description: <one line="" class="" summary>="">

Usage: <usage>

Definition at line 29 of file FWDetailViewManager.h.

Member Typedef Documentation

typedef vViews_t::iterator FWDetailViewManager::vViews_i
private

Definition at line 63 of file FWDetailViewManager.h.

typedef std::vector<ViewFrame> FWDetailViewManager::vViews_t
private

Definition at line 62 of file FWDetailViewManager.h.

Constructor & Destructor Documentation

FWDetailViewManager::FWDetailViewManager ( FWColorManager colMng)

Definition at line 48 of file FWDetailViewManager.cc.

References colorsChanged(), FWColorManager::colorsHaveChanged_, and m_colorManager.

48  :
49  m_colorManager(colMng)
50 {
51  // force white background for all embedded canvases
52  gROOT->SetStyle("Plain");
53 
55  gEve->GetWindowManager()->Connect( "WindowDeleted(TEveWindow*)", "FWDetailViewManager", this, "eveWindowDestroyed(TEveWindow*)");
56 }
FWColorManager * m_colorManager
sigc::signal< void > colorsHaveChanged_
FWDetailViewManager::~FWDetailViewManager ( )
virtual

Definition at line 58 of file FWDetailViewManager.cc.

References newEventCallback().

59 {
61  gEve->GetWindowManager()->Disconnect("WindowDeleted(TEveWindow*)", this, "eveWindowDestroyed(TEveWindow*)" );
62 }
FWDetailViewManager::FWDetailViewManager ( const FWDetailViewManager )
private

Member Function Documentation

void FWDetailViewManager::colorsChanged ( )

Definition at line 157 of file FWDetailViewManager.cc.

References FWColorManager::background(), i, m_colorManager, and m_views.

Referenced by FWDetailViewManager().

158 {
159  for (vViews_i i = m_views.begin(); i != m_views.end(); ++i)
160  (*i).m_detailView->setBackgroundColor(m_colorManager->background());
161 }
int i
Definition: DBlmapReader.cc:9
Color_t background() const
vViews_t::iterator vViews_i
FWColorManager * m_colorManager
std::vector< std::string > FWDetailViewManager::detailViewsFor ( const FWModelId iId) const

Definition at line 107 of file FWDetailViewManager.cc.

References findViewersFor(), FWModelId::item(), FWEventItem::modelType(), edm::TypeWithDict::name(), AlCaHLTBitMon_QueryRunRegistry::string, create_public_lumi_plots::transform, and viewNameFrom().

Referenced by FWModelContextMenuHandler::chosenItem(), CmsShowModelPopup::clicked(), CmsShowModelPopup::fillModelPopup(), CmsShowModelPopup::openDetailedView(), and FWModelContextMenuHandler::showSelectedModelContext().

108 {
109  std::string typeName = edm::TypeWithDict(*(iId.item()->modelType()->GetTypeInfo())).name();
110  std::vector<std::string> fullNames = findViewersFor(typeName);
111  std::vector<std::string> justViewNames;
112  justViewNames.reserve(fullNames.size());
113  std::transform(fullNames.begin(),fullNames.end(),std::back_inserter(justViewNames),&viewNameFrom);
114  return justViewNames;
115 }
static std::string viewNameFrom(const std::string &iFull)
std::vector< std::string > findViewersFor(const std::string &) const
std::string name() const
const TClass * modelType() const
Definition: FWEventItem.cc:561
const FWEventItem * item() const
Definition: FWModelId.h:44
void FWDetailViewManager::eveWindowDestroyed ( TEveWindow *  ew)

Definition at line 174 of file FWDetailViewManager.cc.

References i, and m_views.

175 {
176  for (vViews_i i = m_views.begin(); i != m_views.end(); ++i)
177  {
178  if (ew == i->m_eveWindow)
179  {
180  // printf("========================== delete %s \n", ew->GetElementName());
181  delete i->m_detailView;
182  m_views.erase(i);
183  break;
184  }
185  }
186 }
int i
Definition: DBlmapReader.cc:9
vViews_t::iterator vViews_i
std::vector< std::string > FWDetailViewManager::findViewersFor ( const std::string &  iType) const
private

Definition at line 118 of file FWDetailViewManager.cc.

References first, reco::get(), info(), FWSimpleRepresentationChecker::infoFor(), m_typeToViewers, edmplugin::PluginInfo::name_, FWRepresentationInfo::proximity(), AlCaHLTBitMon_QueryRunRegistry::string, create_public_lumi_plots::transform, and viewNameFrom().

Referenced by detailViewsFor(), and openDetailViewFor().

119 {
120  std::vector<std::string> returnValue;
121 
122  std::map<std::string,std::vector<std::string> >::const_iterator itFind = m_typeToViewers.find(iType);
123  if(itFind != m_typeToViewers.end()) {
124  return itFind->second;
125  }
126  //create a list of the available ViewManager's
127  std::set<std::string> detailViews;
128 
129  std::vector<edmplugin::PluginInfo> available = FWDetailViewFactory::get()->available();
130  std::transform(available.begin(),
131  available.end(),
132  std::inserter(detailViews,detailViews.begin()),
133  boost::bind(&edmplugin::PluginInfo::name_,_1));
134  unsigned int closestMatch= 0xFFFFFFFF;
135  for(std::set<std::string>::iterator it = detailViews.begin(), itEnd=detailViews.end();
136  it!=itEnd;
137  ++it) {
138  std::string::size_type first = it->find_first_of('@');
139  std::string type = it->substr(0,first);
140 
141  if(type == iType) {
142  returnValue.push_back(viewNameFrom(*it));
143  }
144  //see if we match via inheritance
145  FWSimpleRepresentationChecker checker(type,"",0,false);
146  FWRepresentationInfo info = checker.infoFor(iType);
147  if(closestMatch > info.proximity()) {
148  //closestMatch = info.proximity();
149  returnValue.push_back(*it);
150  }
151  }
152  m_typeToViewers[iType]=returnValue;
153  return returnValue;
154 }
type
Definition: HCALResponse.h:21
static const TGPicture * info(bool iBackgroundIsBlack)
uint16_t size_type
static std::string viewNameFrom(const std::string &iFull)
unsigned int proximity() const
measures how &#39;close&#39; this representation is to the type in question, the large the number the farther...
std::map< std::string, std::vector< std::string > > m_typeToViewers
bool first
Definition: L1TdeRCT.cc:75
std::string name_
Definition: PluginInfo.h:29
T get(const Candidate &c)
Definition: component.h:55
void FWDetailViewManager::newEventCallback ( )

Definition at line 165 of file FWDetailViewManager.cc.

References m_views.

Referenced by FWGUIManager::eventChangedCallback(), and ~FWDetailViewManager().

166 {
167  while (!m_views.empty())
168  {
169  m_views.front().m_eveWindow->DestroyWindowAndSlot();
170  }
171 }
void FWDetailViewManager::openDetailViewFor ( const FWModelId id,
const std::string &  iViewName 
)

Definition at line 65 of file FWDetailViewManager.cc.

References FWColorManager::background(), findViewersFor(), fwLog, reco::get(), cmsHarvester::index, fwlog::kError, m_colorManager, m_views, match(), edm::TypeWithDict::name(), mergeVDriftHistosByStation::name, AlCaHLTBitMon_QueryRunRegistry::string, edmStreamStallGrapher::t, and viewNameFrom().

Referenced by FWModelContextMenuHandler::chosenItem(), CmsShowModelPopup::clicked(), and CmsShowModelPopup::openDetailedView().

66 {
67  TEveWindowSlot* slot = TEveWindow::CreateWindowMainFrame();
68  TEveCompositeFrameInMainFrame* eveFrame = (TEveCompositeFrameInMainFrame*)slot->GetEveFrame();
69 
70  // find the right viewer for this item
71  std::string typeName = edm::TypeWithDict(*(id.item()->modelType()->GetTypeInfo())).name();
72  std::vector<std::string> viewerNames = findViewersFor(typeName);
73  if(0==viewerNames.size()) {
74  fwLog(fwlog::kError) << "FWDetailViewManager: don't know what detailed view to "
75  "use for object " << id.item()->name() << std::endl;
76  assert(0!=viewerNames.size());
77  }
78 
79  //see if one of the names matches iViewName
81  for(std::vector<std::string>::iterator it = viewerNames.begin(), itEnd = viewerNames.end(); it != itEnd; ++it) {
82  std::string t = viewNameFrom(*it);
83  //std::cout <<"'"<<iViewName<< "' '"<<t<<"'"<<std::endl;
84  if(t == iViewName) {
85  match = *it;
86  break;
87  }
88  }
89  assert(match.size() != 0);
90  FWDetailViewBase* detailView = FWDetailViewFactory::get()->create(match);
91  assert(0!=detailView);
92 
93  TEveWindowSlot* ws = (TEveWindowSlot*)(eveFrame->GetEveWindow());
94  detailView->init(ws);
95  detailView->build(id);
96  detailView->setBackgroundColor(m_colorManager->background());
97 
98  TGMainFrame* mf = (TGMainFrame*)(eveFrame->GetParent());
99  mf->SetWindowName(Form("%s Detail View [%d]", id.item()->name().c_str(), id.index()));
100 
101  m_views.push_back(ViewFrame(eveFrame, detailView, eveFrame->GetEveWindow()));
102 
103  mf->MapRaised();
104 }
Color_t background() const
static std::string viewNameFrom(const std::string &iFull)
std::vector< std::string > findViewersFor(const std::string &) const
std::string name() const
FWColorManager * m_colorManager
#define fwLog(_level_)
Definition: fwLog.h:50
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
T get(const Candidate &c)
Definition: component.h:55
const FWDetailViewManager& FWDetailViewManager::operator= ( const FWDetailViewManager )
private

Member Data Documentation

FWColorManager* FWDetailViewManager::m_colorManager
protected

Definition at line 53 of file FWDetailViewManager.h.

Referenced by colorsChanged(), FWDetailViewManager(), and openDetailViewFor().

std::map<std::string, std::vector<std::string> > FWDetailViewManager::m_typeToViewers
mutableprivate

Definition at line 66 of file FWDetailViewManager.h.

Referenced by findViewersFor().

vViews_t FWDetailViewManager::m_views
private