forked from schulmar/Templar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
graphhandler.h
68 lines (48 loc) · 1.35 KB
/
graphhandler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef GRAPHHANDLER_H
#define GRAPHHANDLER_H
#include <utility>
#include <vector>
#include <QMap>
#include <QString>
#include <QColor>
#include <QSharedPointer>
#include <QHash>
#include <QColor>
#include <graphviz/gvc.h>
#include "templateeventhandler.h"
#include "graphvizbuilder.h"
class QGraph;
namespace Templar {
class GraphHandler : public TemplateEventHandler
{
public:
typedef GraphvizBuilder::NodeId NodeId;
typedef GraphvizBuilder::NodeIdToGraph NodeIdToGraph;
GraphHandler(QGraph *qGraph) : theGraph(qGraph) {}
virtual ~GraphHandler() {}
void handleEvent(const TraceEntry &entry);
void undoEvent();
void reset();
void inspect(const TraceEntry &entry);
void forward(const std::vector<TraceEntry> & entryVec);
void rewind(unsigned int count);
void setGvc(QSharedPointer<GVC_t> gvc) {
this->gvc = gvc;
}
void setNodeGraphMap(const NodeIdToGraph& nodeToGr) {
nodeToGraph = nodeToGr;
}
private:
QColor colorOfNode(const NodeId& nodeName);
graph_t* changeGraph(const NodeId& nodeName);
void colorize();
private:
QGraph *theGraph;
QSharedPointer<GVC_t> gvc;
NodeIdToGraph nodeToGraph;
QHash<NodeId, QColor> nodeColor;
typedef std::pair<NodeId, QColor> UndoInfo;
std::vector<UndoInfo> undoStack;
};
} // namespace Templar
#endif // GRAPHHANDLER_H