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
graph_analysis::gui::EdgeItemTypeManager::ClassVisualizationMap
std::map< edge::Type, EdgeItemBase * > ClassVisualizationMap
Definition: EdgeItemTypeManager.hpp:30
graph_analysis::gui::EdgeItemTypeManager
factory for EdgeItem-s: clones different types of EdgeItem instances (i.e. graphical edges)
Definition: EdgeItemTypeManager.hpp:27
graph_analysis::gui::EdgeItemBase
standard implementation of graphical nodes for an Edge
Definition: EdgeItemBase.hpp:28
graph_analysis::gui::EdgeItemTypeManager::EdgeItemTypeManager
EdgeItemTypeManager()
constructor
Definition: EdgeItemTypeManager.cpp:10
graph_analysis
Main namespace of the graph analysis library.
Definition: BFS.cpp:3
graph_analysis::Edge::Ptr
shared_ptr< Edge > Ptr
Definition: Edge.hpp:21
graph_analysis::gui::EdgeItemTypeManager::createItem
EdgeItemBase * createItem(GraphWidget *graphWidget, const graph_analysis::Edge::Ptr &edge, QGraphicsItem *parent, const std::string &type=std::string())
clones a new graphical edge of a specified type
Definition: EdgeItemTypeManager.cpp:37
graph_analysis::gui::EdgeItemTypeManager::registerVisualization
void registerVisualization(const edge::Type &type, EdgeItemBase *graphicsItem)
Definition: EdgeItemTypeManager.cpp:15
graph_analysis::gui::edge::Type
std::string Type
Definition: EdgeItemTypeManager.hpp:15
graph_analysis::gui::EdgeItemTypeManager::getSupportedTypes
QStringList getSupportedTypes() const
Definition: EdgeItemTypeManager.cpp:48
graph_analysis::gui::GraphWidget
Base-class for visual representations of a "Graph" in this framework.
Definition: GraphWidget.hpp:26
graph_analysis::gui::VertexItemBase
graphical node representation interface
Definition: VertexItemBase.hpp:26