-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathengine.cpp
More file actions
52 lines (41 loc) · 855 Bytes
/
engine.cpp
File metadata and controls
52 lines (41 loc) · 855 Bytes
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
#include "engine.h"
Engine::Engine(QObject *parent) : QObject(parent)
{
myGraph=NULL;
}
Graph * Engine::getGraph(){
return myGraph;
}
void Engine::removeGraph(){
if(myGraph){
delete myGraph;
}
}
void Engine::setGraph(Graph * graph){
path.clear();
removeGraph();
myGraph=graph;
emit updateGraph();
}
void Engine::changeGraphSize(int newSize){
path.clear();
removeGraph();
myGraph=new Graph(newSize);
emit updateGraph();
}
Engine * Engine::engine=NULL;
Engine::Engine(const Engine &en){}
Engine * Engine::getInstance(){
if(engine==NULL){
engine=new Engine();
}
return engine;
}
void Engine::updateGraph(QObject * sender){
path.clear();
emit changedGraph(sender);
}
void Engine::setPath(std::vector<int> path){
this->path=path;
emit changedGraph(this);
}