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
graph_analysis::gui::items::Feature
A feature directly maps to a vertex in a graph.
Definition: Feature.hpp:30
graph_analysis::gui::items::Feature::getGraphElement
GraphElement::Ptr getGraphElement() const
getter method: retrieves the assigned ID
Definition: Feature.hpp:48
graph_analysis::gui::items::Feature::Feature
Feature(GraphElement::Ptr element, GraphWidget *graphWidget, QGraphicsItem *parent)
constructor
Definition: Feature.cpp:14
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::FeatureItemType
@ FeatureItemType
Definition: GraphicsItemTypes.hpp:12
graph_analysis::GraphElement::Ptr
shared_ptr< GraphElement > Ptr
Definition: GraphElement.hpp:46
graph_analysis::Vertex::Ptr
shared_ptr< Vertex > Ptr
Definition: Vertex.hpp:22
graph_analysis::gui::items::Feature::getVertex
Vertex::Ptr getVertex() const
Definition: Feature.cpp:34
graph_analysis::gui::items::Feature::paint
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
Definition: Feature.cpp:49
graph_analysis::gui::items::Feature::type
int type() const
Definition: Feature.hpp:53
graph_analysis::gui::GraphWidget
Base-class for visual representations of a "Graph" in this framework.
Definition: GraphWidget.hpp:26
graph_analysis::gui::items::Feature::getEdge
Edge::Ptr getEdge() const
Definition: Feature.cpp:24
graph_analysis::gui::items::Feature::mousePressEvent
void mousePressEvent(QGraphicsSceneMouseEvent *event)
Definition: Feature.cpp:44