graph_analysis
EdgeItemTypeManager.hpp
Go to the documentation of this file.
1 #ifndef GRAPH_ANALYSIS_EDGE_ITEM_TYPE_MANAGER_HPP
2 #define GRAPH_ANALYSIS_EDGE_ITEM_TYPE_MANAGER_HPP
3 
4 #include <base-logging/Singleton.hpp>
5 #include "../Edge.hpp"
6 #include <QStringList>
7 #include <map>
8 
9 class QGraphicsItem;
10 
11 namespace graph_analysis {
12 namespace gui {
13 
14 namespace edge {
15  typedef std::string Type;
16 }
17 
18 class VertexItemBase;
19 class EdgeItemBase;
20 class GraphWidget;
21 
27 class EdgeItemTypeManager : public base::Singleton<EdgeItemTypeManager>
28 {
29 public:
30  typedef std::map<edge::Type, EdgeItemBase*> ClassVisualizationMap;
31 
32 private:
34  ClassVisualizationMap mClassVisualizationMap;
36  EdgeItemBase* graphicsItemByType(const edge::Type& type);
37 
38 protected:
41  friend class base::Singleton<EdgeItemTypeManager>;
42 public:
43 
44  // Register visualization class
45  // takes ownership of graphicsItem
46  void registerVisualization(const edge::Type& type, EdgeItemBase* graphicsItem);
47 
56  EdgeItemBase* createItem(GraphWidget* graphWidget,
57  const graph_analysis::Edge::Ptr& edge,
58  QGraphicsItem* parent,
59  const std::string& type = std::string());
60 
61  QStringList getSupportedTypes() const;
62 };
63 
64 } // end namespace gui
65 } // end namespace graph_analysis
66 #endif // GRAPH_ANALYSIS_EDGE_ITEM_TYPE_MANAGER_HPP
factory for EdgeItem-s: clones different types of EdgeItem instances (i.e. graphical edges) ...
Definition: EdgeItemTypeManager.hpp:27
shared_ptr< Edge > Ptr
Definition: Edge.hpp:21
std::string Type
Definition: EdgeItemTypeManager.hpp:15
std::map< edge::Type, EdgeItemBase * > ClassVisualizationMap
Definition: EdgeItemTypeManager.hpp:30
Base-class for visual representations of a "Graph" in this framework.
Definition: GraphWidget.hpp:26
Main namespace of the graph analysis library.
Definition: BFS.cpp:3
standard implementation of graphical nodes for an Edge
Definition: EdgeItemBase.hpp:28
graphical node representation interface
Definition: VertexItemBase.hpp:26