CEDRIC  Revision_backup-2009-02
PhastScene.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * Copyright (C) 2008 Boris Iven, Max Hermann
4  *
5  * This file is part of the "CEDRIC Event Display" application.
6  *
7  *****************************************************************************/
8 
9 #ifndef PHASTSCENE_H
10 #define PHASTSCENE_H
11 
12 #include <QObject>
13 #include <osg/ref_ptr>
14 #include <osg/Node>
15 #include <osg/Group>
16 #include <osg/BoundingBox>
17 #include <map>
18 #include "PhastNode.h"
19 #include "Phast.h"
20 
32 class PhastScene : public QObject, public osg::Group
33 {
34  Q_OBJECT
35 
36 public:
37  enum Flags { SETUP=1, EVENT=2 };
38 
39 signals:
40  void changed( int flags );
41 
42 public slots:
43  void update( int flags=SETUP|EVENT );
44 
45 public:
46  PhastScene();
47 
48  void clearSetup() { m_detectorMap.clear(); }
49 
50  PhastNode* eventNode() { return _eventNode.get(); }
51  PhastNode* setupNode() { return _setupNode.get(); }
52 
53  void setSetupNode( PhastNode* setup );
54  void setEventNode( PhastNode* event );
55 
56  void PhastScene::registerDetector( std::string name, PhastNode* node );
57  PhastNode* getDetector( std::string name );
58 
59  PhastNode* getTrack( int id );
60  void createTracks( const PaEvent& event );
61 
62  osg::BoundingBox getBoundingBox() const { return _bbox; }
63 
64 private:
65  osg::ref_ptr<PhastNode> _setupNode;
66  osg::ref_ptr<PhastNode> _eventNode;
67  osg::BoundingBox _bbox;
68 
69  typedef std::map<std::string,osg::ref_ptr<PhastNode> > DetectorMap;
70  typedef std::map< int,osg::ref_ptr<PhastNode> > TrackMap;
71 
72  DetectorMap m_detectorMap;
73  TrackMap m_trackMap;
74 };
75 
76 #endif
void createTracks(const PaEvent &event)
Definition: PhastScene.cpp:80
PhastNode * getTrack(int id)
Definition: PhastScene.cpp:72
PhastNode * getDetector(std::string name)
Definition: PhastScene.cpp:64
PhastScene()
Definition: PhastScene.cpp:23
void clearSetup()
Definition: PhastScene.h:48
Definition: PhastScene.h:37
Definition: PhastScene.h:37
void update(int flags=SETUP|EVENT)
Definition: PhastScene.cpp:51
Graphical representation of Phast objects (e.g. PaDetector, PaTrack, ...) as OpenSceneGraph node...
Definition: PhastNode.h:32
void setEventNode(PhastNode *event)
Definition: PhastScene.cpp:41
void changed(int flags)
Flags
Definition: PhastScene.h:37
PhastNode * setupNode()
Definition: PhastScene.h:51
PhastNode * eventNode()
Definition: PhastScene.h:50
Scenegraph holding static and dynamic Phast geometry.
Definition: PhastScene.h:32
void registerDetector(std::string name, PhastNode *node)
Definition: PhastScene.cpp:58
void setSetupNode(PhastNode *setup)
Definition: PhastScene.cpp:30
osg::BoundingBox getBoundingBox() const
Definition: PhastScene.h:62