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 //
12 
13 // system include files
14 #include <iostream>
15 #include <boost/bind.hpp>
16 
17 #include "TEveManager.h"
18 
19 // user include files
25 
26 //
27 // constants, enums and typedefs
28 //
29 
30 //
31 // static data member definitions
32 //
33 
34 //
35 // constructors and destructor
36 //
38  FWColorManager* iColorM) :
39  m_changeManager(iCM),
40  m_colorManager(iColorM)
41 {
42 }
43 
44 // FWViewManagerManager::FWViewManagerManager(const FWViewManagerManager& rhs)
45 // {
46 // // do actual copying here;
47 // }
48 
50 {
51 }
52 
53 //
54 // assignment operators
55 //
56 // const FWViewManagerManager& FWViewManagerManager::operator=(const FWViewManagerManager& rhs)
57 // {
58 // //An exception safe implementation is
59 // FWViewManagerManager temp(rhs);
60 // swap(rhs);
61 //
62 // return *this;
63 // }
64 
65 //
66 // member functions
67 //
68 void
69 FWViewManagerManager::add( boost::shared_ptr<FWViewManagerBase> iManager)
70 {
71  m_viewManagers.push_back(iManager);
72  iManager->setChangeManager(m_changeManager);
73  iManager->setColorManager(m_colorManager);
74 
75  for(std::map<std::string,const FWEventItem*>::iterator it=m_typeToItems.begin(), itEnd=m_typeToItems.end();
76  it != itEnd;
77  ++it) {
78  iManager->newItem(it->second);
79  }
80 }
81 
82 void
84 {
85  if ( m_typeToItems.find(iItem->name()) != m_typeToItems.end() ) {
86  fwLog(fwlog::kWarning) << "WARNING: item "<< iItem->name() <<" was already registered. Request ignored.\n";
87  return;
88  }
89  m_typeToItems[iItem->name()]=iItem;
90  iItem->goingToBeDestroyed_.connect(boost::bind(&FWViewManagerManager::removeEventItem,this,_1));
91 
92  //std::map<std::string, std::vector<std::string> >::iterator itFind = m_typeToBuilders.find(iItem->name());
93  for(std::vector<boost::shared_ptr<FWViewManagerBase> >::iterator itVM = m_viewManagers.begin();
94  itVM != m_viewManagers.end();
95  ++itVM) {
96  (*itVM)->newItem(iItem);
97  }
98 }
99 
100 void
102 {
103  std::map<std::string, const FWEventItem*>::iterator itr =
104  m_typeToItems.find(iItem->name());
105  if ( itr != m_typeToItems.end() ) m_typeToItems.erase( itr );
106 }
107 
108 
109 //
110 // const member functions
111 //
114 {
115  FWTypeToRepresentations returnValue;
116  for(std::vector<boost::shared_ptr<FWViewManagerBase> >::const_iterator itVM = m_viewManagers.begin();
117  itVM != m_viewManagers.end();
118  ++itVM) {
119  FWTypeToRepresentations v = (*itVM)->supportedTypesAndRepresentations();
120  returnValue.insert(v);
121  }
122  return returnValue;
123 }
124 
125 void
127 {
128  gEve->DisableRedraw();
129  for ( std::vector<boost::shared_ptr<FWViewManagerBase> >::iterator i = m_viewManagers.begin();
130  i != m_viewManagers.end(); ++i )
131  (*i)->eventBegin();
132 }
133 
134 void
136 {
137  for ( std::vector<boost::shared_ptr<FWViewManagerBase> >::iterator i = m_viewManagers.begin();
138  i != m_viewManagers.end(); ++i )
139  (*i)->eventEnd();
140  gEve->EnableRedraw();
141 }
142 
143 //
144 // static member functions
145 //
int i
Definition: DBlmapReader.cc:9
void registerEventItem(const FWEventItem *iItem)
void removeEventItem(const FWEventItem *iItem)
const std::string & name() const
Definition: FWEventItem.cc:500
FWItemChangeSignal goingToBeDestroyed_
Definition: FWEventItem.h:214
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:50
FWColorManager * m_colorManager
std::vector< boost::shared_ptr< FWViewManagerBase > > m_viewManagers