graph_analysis
Feature.hpp
Go to the documentation of this file.
1 #ifndef GRAPH_ANALYSIS_GUI_ITEMS_FEATURE_HPP
2 #define GRAPH_ANALYSIS_GUI_ITEMS_FEATURE_HPP
3 
4 #include <iostream>
5 #include <QGraphicsSceneDragDropEvent>
6 #include <QGraphicsTextItem>
7 #include <QTextCursor>
8 #include <QMouseEvent>
9 #include <QMimeData>
10 #include <QDrag>
11 
12 #include "../../Vertex.hpp"
13 #include "../../Edge.hpp"
14 
15 #include "../GraphicsItemTypes.hpp"
16 
17 namespace graph_analysis {
18 namespace gui {
19 
20 class GraphWidget;
21 
22 namespace items {
23 
30 class Feature : public QGraphicsTextItem
31 {
32 private:
33  // managing graph widget
34  GraphWidget* mpGraphWidget;
35  // Associated grapelement
36  GraphElement::Ptr mpGraphElement;
37 
38 public:
45  Feature(GraphElement::Ptr element, GraphWidget *graphWidget, QGraphicsItem* parent);
46 
48  GraphElement::Ptr getGraphElement() const { return mpGraphElement; }
49 
50  Edge::Ptr getEdge() const;
51  Vertex::Ptr getVertex() const;
52 
53  int type() const { return FeatureItemType; }
54 
55  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
56 
57 protected:
58 
59  void mousePressEvent(QGraphicsSceneMouseEvent *event);
60 
61 };
62 
63 } // end namespace items
64 } // end namespace gui
65 } // end namespace graph_analysis
66 #endif // GRAPH_ANALYSIS_GUI_ITEMS_LABEL_HPP
A feature directly maps to a vertex in a graph.
Definition: Feature.hpp:30
Edge::Ptr getEdge() const
Definition: Feature.cpp:24
void mousePressEvent(QGraphicsSceneMouseEvent *event)
Definition: Feature.cpp:44
shared_ptr< Edge > Ptr
Definition: Edge.hpp:21
Base-class for visual representations of a "Graph" in this framework.
Definition: GraphWidget.hpp:26
Definition: GraphicsItemTypes.hpp:12
Main namespace of the graph analysis library.
Definition: BFS.cpp:3
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
Definition: Feature.cpp:49
shared_ptr< Vertex > Ptr
Definition: Vertex.hpp:22
shared_ptr< GraphElement > Ptr
Definition: GraphElement.hpp:46
int type() const
Definition: Feature.hpp:53
Vertex::Ptr getVertex() const
Definition: Feature.cpp:34
Feature(GraphElement::Ptr element, GraphWidget *graphWidget, QGraphicsItem *parent)
constructor
Definition: Feature.cpp:14
GraphElement::Ptr getGraphElement() const
getter method: retrieves the assigned ID
Definition: Feature.hpp:48