-
Notifications
You must be signed in to change notification settings - Fork 1
/
point.h
64 lines (54 loc) · 1.73 KB
/
point.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
#ifndef POINT_H
#define POINT_H
#include <QString>
#include <tinyxml/tinyxml.h>
struct Point{
int x;
int y;
double f;
double g;
int k;
QString pathfound;
int pathfoundint;
QString label;
bool labelnormal;
int parent_x;
int parent_y;
Point():x(-1),y(-1){}
Point(TiXmlElement *p)
{
if(p->Attribute("x"))
x=QString(p->Attribute("x")).toInt();
if(p->Attribute("y"))
y=QString(p->Attribute("y")).toInt();
if(p->Attribute("F"))
f=QString(p->Attribute("F")).toDouble();
if(p->Attribute("g"))
g=QString(p->Attribute("g")).toDouble();
if(p->Attribute("pathFound"))
pathfound=QString(p->Attribute("pathFound"));
if(pathfound.compare("noAttempt")==0)
pathfoundint=0;
else if(pathfound.compare("true")==0)
pathfoundint=1;
else
pathfoundint=-1;
label=QString(p->Attribute("label")?p->Attribute("label"):"");
if(p->Attribute("k"))
k=QString(p->Attribute("k")).toInt();
else
k=-1;
labelnormal=(k!=1);
if(p->Attribute("parent_x"))
parent_x=QString(p->Attribute("parent_x")).toInt();
else
parent_x=-1;
if(p->Attribute("parent_y"))
parent_y=QString(p->Attribute("parent_y")).toInt();
else
parent_y=-1;
}
Point(int x,int y, double f, double g, int k, QString pathfound, QString label=QString(),int parent_x=-1, int parent_y=-1):
x(x),y(y),f(f),g(g),k(k),pathfound(pathfound),label(label),parent_x(parent_x),parent_y(parent_y){}
};
#endif // POINT_H