CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWViewManagerManager.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Core
4 // Class : FWViewManagerManager
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Tue Jan 15 10:27:12 EST 2008
11 // $Id: FWViewManagerManager.cc,v 1.18 2010/06/18 10:17:16 yana Exp $
12 //
13 
14 // system include files
15 #include <iostream>
16 #include <boost/bind.hpp>
17 
18 #include "TEveManager.h"
19 
20 // user include files
26 
27 //
28 // constants, enums and typedefs
29 //
30 
31 //
32 // static data member definitions
33 //
34 
35 //
36 // constructors and destructor
37 //
39  FWColorManager* iColorM) :
40  m_changeManager(iCM),
41  m_colorManager(iColorM)
42 {
43 }
44 
45 // FWViewManagerManager::FWViewManagerManager(const FWViewManagerManager& rhs)
46 // {
47 // // do actual copying here;
48 // }
49 
51 {
52 }
53 
54 //
55 // assignment operators
56 //
57 // const FWViewManagerManager& FWViewManagerManager::operator=(const FWViewManagerManager& rhs)
58 // {
59 // //An exception safe implementation is
60 // FWViewManagerManager temp(rhs);
61 // swap(rhs);
62 //
63 // return *this;
64 // }
65 
66 //
67 // member functions
68 //
69 void
70 FWViewManagerManager::add( boost::shared_ptr<FWViewManagerBase> iManager)
71 {
72  m_viewManagers.push_back(iManager);
73  iManager->setChangeManager(m_changeManager);
74  iManager->setColorManager(m_colorManager);
75 
76  for(std::map<std::string,const FWEventItem*>::iterator it=m_typeToItems.begin(), itEnd=m_typeToItems.end();
77  it != itEnd;
78  ++it) {
79  iManager->newItem(it->second);
80  }
81 }
82 
83 void
85 {
86  if ( m_typeToItems.find(iItem->name()) != m_typeToItems.end() ) {
87  fwLog(fwlog::kWarning) << "WARNING: item "<< iItem->name() <<" was already registered. Request ignored.\n";
88  return;
89  }
90  m_typeToItems[iItem->name()]=iItem;
91  iItem->goingToBeDestroyed_.connect(boost::bind(&FWViewManagerManager::removeEventItem,this,_1));
92 
93  //std::map<std::string, std::vector<std::string> >::iterator itFind = m_typeToBuilders.find(iItem->name());
94  for(std::vector<boost::shared_ptr<FWViewManagerBase> >::iterator itVM = m_viewManagers.begin();
95  itVM != m_viewManagers.end();
96  ++itVM) {
97  (*itVM)->newItem(iItem);
98  }
99 }
100 
101 void
103 {
104  std::map<std::string, const FWEventItem*>::iterator itr =
105  m_typeToItems.find(iItem->name());
106  if ( itr != m_typeToItems.end() ) m_typeToItems.erase( itr );
107 }
108 
109 
110 //
111 // const member functions
112 //
115 {
116  FWTypeToRepresentations returnValue;
117  for(std::vector<boost::shared_ptr<FWViewManagerBase> >::const_iterator itVM = m_viewManagers.begin();
118  itVM != m_viewManagers.end();
119  ++itVM) {
120  FWTypeToRepresentations v = (*itVM)->supportedTypesAndRepresentations();
121  returnValue.insert(v);
122  }
123  return returnValue;
124 }
125 
126 void
128 {
129  gEve->DisableRedraw();
130  for ( std::vector<boost::shared_ptr<FWViewManagerBase> >::iterator i = m_viewManagers.begin();
131  i != m_viewManagers.end(); ++i )
132  (*i)->eventBegin();
133 }
134 
135 void
137 {
138  for ( std::vector<boost::shared_ptr<FWViewManagerBase> >::iterator i = m_viewManagers.begin();
139  i != m_viewManagers.end(); ++i )
140  (*i)->eventEnd();
141  gEve->EnableRedraw();
142 }
143 
144 //
145 // static member functions
146 //
int i
Definition: DBlmapReader.cc:9
void registerEventItem(const FWEventItem *iItem)
void removeEventItem(const FWEventItem *iItem)
const std::string & name() const
Definition: FWEventItem.cc:501
FWItemChangeSignal goingToBeDestroyed_
Definition: FWEventItem.h:215
void insert(const FWTypeToRepresentations &)
FWTypeToRepresentations supportedTypesAndRepresentations() const
FWModelChangeManager * m_changeManager
FWViewManagerManager(FWModelChangeManager *, FWColorManager *)
std::map< std::string, const FWEventItem * > m_typeToItems
void add(boost::shared_ptr< FWViewManagerBase >)
#define fwLog(_level_)
Definition: fwLog.h:51
FWColorManager * m_colorManager
std::vector< boost::shared_ptr< FWViewManagerBase > > m_viewManagers