CMS 3D CMS Logo

CmsShowMainBase.h
Go to the documentation of this file.
1 #ifndef Fireworks_Core_CmsShowMainBase_h
2 #define Fireworks_Core_CmsShowMainBase_h
3 
6 
8 
9 #include <memory>
10 #include <string>
11 #include <cassert>
12 #include "sigc++/signal.h"
13 
14 #include "TTimer.h"
15 
17 class FWGUIManager;
19 class FWNavigatorBase;
20 
21 // replace forfard declaration with include to avoid compilation warnigs
22 /*
23 class FWModelChangeManager;
24 class FWSelectionManager;
25 class FWViewManagerManager;
26 class CmsShowTaskExecutor;
27 class FWChangeManager;
28 class FWColorManager;
29 class FWConfigurationManager;
30 */
38 
39 namespace fireworks {
40  class Context;
41 }
42 
50 public:
52  virtual ~CmsShowMainBase() noexcept(false);
53 
62  assert(m_guiManager.get() && "Call CmsShowMainBase::setup first!");
63  return m_guiManager.get();
64  }
65 
67 
69 
70  void setupActions();
71  void setupViewManagers();
72 
73  // Configuration handling.
75  const char *configFilename() const { return m_configFileName.c_str(); };
76 
83  void setupConfiguration();
84 
85  void registerPhysicsObject(const FWPhysicsObjectDesc &iItem);
86  void draw();
87 
88  // Geometry handling
89  void loadGeometry();
92  FWGeometry &getGeom() { return m_geom; }
93 
94  void setSimGeometryFilename(const std::string &filename, const std::string &geoname) {
96  m_TGeoName = geoname;
97  }
98 
99  // Event navigation.
100  void doFirstEvent();
101  void doPreviousEvent();
102  void doNextEvent();
103  void doLastEvent();
105  virtual void checkPosition() = 0;
106  bool forward() const { return m_forward; }
107  bool loop() const { return m_loop; }
108  virtual void quit() = 0;
109 
110  void setupAutoLoad(float x);
111  void startAutoLoadTimer();
112  void stopAutoLoadTimer();
113  void setupDebugSupport();
114 
115  void setPlayDelay(Float_t val);
116  void playForward();
117  void playBackward();
118  bool isPlaying() const { return m_isPlaying; }
119 
121  virtual void stopPlaying();
122  virtual void autoLoadNewEvent() = 0;
123 
124  void setPlayLoop();
125  void unsetPlayLoop();
126 
129 
130  class SignalTimer : public TTimer {
131  public:
132  Bool_t Notify() override {
133  timeout_();
134  return true;
135  }
136  sigc::signal<void()> timeout_;
137  };
138 
139 protected:
140  void eventChangedSlot();
141  virtual void eventChangedImp();
142  void sendVersionInfo();
144 
145 private:
146  // The base class is responsible for the destruction of fwlite / FF
147  // agnostic managers.
148  std::unique_ptr<FWModelChangeManager> m_changeManager;
149  std::unique_ptr<FWColorManager> m_colorManager;
150  std::unique_ptr<FWConfigurationManager> m_configurationManager;
151  std::unique_ptr<FWEventItemsManager> m_eiManager;
152  std::unique_ptr<FWGUIManager> m_guiManager;
153  std::unique_ptr<FWSelectionManager> m_selectionManager;
154  std::unique_ptr<CmsShowTaskExecutor> m_startupTasks;
155  std::unique_ptr<FWViewManagerManager> m_viewManager;
156 
157  std::unique_ptr<SignalTimer> m_autoLoadTimer;
158 
159  // These are actually set by the concrete implementation via the setup
160  // method.
164 
165  void setPlayLoopImp();
166  void unsetPlayLoopImp();
167 
171  bool m_forward;
173  bool m_loop;
174  Float_t m_playDelay;
180 };
181 
182 #endif
void partialWriteToConfigFile(const std::string &config)
FWSelectionManager * selectionManager()
FWModelChangeManager * modelChangeManager()
std::string m_geometryFilename
FWGUIManager * guiManager()
FWColorManager * colorManager()
void writeToConfigFile(const std::string &config)
std::unique_ptr< FWModelChangeManager > m_changeManager
void setAutoSaveAllViewsHeight(int x)
std::unique_ptr< FWGUIManager > m_guiManager
std::unique_ptr< FWSelectionManager > m_selectionManager
FWEventItemsManager * eiManager()
unsigned long long EventNumber_t
std::unique_ptr< FWEventItemsManager > m_eiManager
void partialLoadConfiguration(const std::string &config)
std::unique_ptr< SignalTimer > m_autoLoadTimer
Definition: config.py:1
void setup(FWNavigatorBase *navigator, fireworks::Context *context, FWJobMetadataManager *metadataManager)
assert(be >=bs)
unsigned int LuminosityBlockNumber_t
void writePartialToConfigFile()
virtual void checkPosition()=0
FWModelChangeManager * changeManager()
virtual ~CmsShowMainBase() noexcept(false)
const char * configFilename() const
void setupAutoLoad(float x)
std::unique_ptr< FWColorManager > m_colorManager
bool loop() const
FWNavigatorBase * m_navigatorPtr
void setGeometryFilename(const std::string &filename)
void reloadConfiguration(const std::string &config)
virtual void stopPlaying()
CmsShowTaskExecutor * startupTasks()
void setPlayDelay(Float_t val)
virtual void eventChangedImp()
virtual void quit()=0
std::unique_ptr< CmsShowTaskExecutor > m_startupTasks
virtual void checkKeyBindingsOnPLayEventsStateChanged()
FWJobMetadataManager * m_metadataManagerPtr
fireworks::Context * context()
void setSimGeometryFilename(const std::string &filename, const std::string &geoname)
double f[11][100]
std::string m_TGeoName
FWViewManagerManager * viewManager()
virtual void autoLoadNewEvent()=0
std::string m_simGeometryFilename
void setAutoSaveAllViewsFormat(const std::string &fmt)
fireworks::Context * m_contextPtr
std::unique_ptr< FWConfigurationManager > m_configurationManager
std::unique_ptr< FWViewManagerManager > m_viewManager
FWGeometry & getGeom()
FWConfigurationManager * configurationManager()
void writeToCurrentConfigFile()
std::string m_autoSaveAllViewsFormat
void registerPhysicsObject(const FWPhysicsObjectDesc &iItem)
unsigned int RunNumber_t
bool isPlaying() const
const std::string & geometryFilename(void)
void goToRunEvent(edm::RunNumber_t, edm::LuminosityBlockNumber_t, edm::EventNumber_t)
bool forward() const
void setConfigFilename(const std::string &f)
sigc::signal< void()> timeout_
std::string m_configFileName