graph_analysis
Player.hpp
Go to the documentation of this file.
1 #ifndef GRAPH_ANALYSIS_GUI_PLAYER_HPP
2 #define GRAPH_ANALYSIS_GUI_PLAYER_HPP
3 
4 #include "../algorithms/BFSVisitor.hpp"
5 #include "EdgeItemBase.hpp"
6 #include "VertexItemBase.hpp"
7 
9 #include <QObject>
10 #include <QThread>
11 
12 namespace graph_analysis {
13 namespace gui {
14 
15 class GraphWidget;
16 
17 class PlayerThread : public QThread
18 {
19  Q_OBJECT
20 
21 public:
22  PlayerThread(const std::vector<GraphElement::Ptr>& playlist, uint32_t graphId, const PlayerConfiguration& configuration);
23  void run();
24 
25  void setVisibility(const std::vector<GraphElement::Ptr>& elements,
26  bool showItem,
27  size_t delayInMs);
28 
29 
30 signals:
31  void setEdgeVisible(int,bool);
32  void setVertexVisible(int,bool);
33 
34 private:
35  std::vector<GraphElement::Ptr> mPlaylist;
36  uint32_t mGraphId;
37  PlayerConfiguration mConfiguration;
38 };
39 
45 {
46  Q_OBJECT
47 
48 public:
49  Player(GraphWidget* graphWidget);
50  virtual ~Player();
51 
52  void start(PlayerConfiguration configuration = PlayerConfiguration());
53 
54  void identifyPlaylist();
55 
56  void discoverVertex(Vertex::Ptr& vertex);
57 
58 private:
59  GraphWidget* mpGraphWidget;
60 
61  // Collects the vertices and edges in the order of
62  // discovery
63  // this might contain duplicate entries
64  std::vector<GraphElement::Ptr> mPlayList;
65  // Set of root vertices
66  Vertex::PtrList mRootVertices;
67  // Set of identified vertices to allow
68  // handling of cycles, etc
69  Vertex::PtrSet mIdentifiedVertices;
70 
71  PlayerThread* mPlayerThread;
72 
76  void appendUnique(std::vector<GraphElement::Ptr>& list, const GraphElement::Ptr& ge);
77 
78 };
79 
80 } // end namespace gui
81 } // end namespace graph_analysis
82 #endif // GRAPH_ANALYSIS_GUI_PLAYER_HPP
PlayerThread(const std::vector< GraphElement::Ptr > &playlist, uint32_t graphId, const PlayerConfiguration &configuration)
Definition: Player.cpp:13
Definition: PlayerConfiguration.hpp:9
Definition: Player.hpp:17
void run()
Definition: Player.cpp:20
Special visitor for the BFS implementing the default functions.
Definition: BFSVisitor.hpp:14
std::set< Ptr > PtrSet
Definition: Vertex.hpp:25
void setVisibility(const std::vector< GraphElement::Ptr > &elements, bool showItem, size_t delayInMs)
Definition: Player.cpp:37
Base-class for visual representations of a "Graph" in this framework.
Definition: GraphWidget.hpp:26
std::vector< Ptr > PtrList
Definition: Vertex.hpp:24
Main namespace of the graph analysis library.
Definition: BFS.cpp:3
Definition: Player.hpp:44
shared_ptr< Vertex > Ptr
Definition: Vertex.hpp:22
shared_ptr< GraphElement > Ptr
Definition: GraphElement.hpp:46