-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathmap.cpp
55 lines (45 loc) · 1.14 KB
/
map.cpp
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
#include "map.h"
Map::Map()
{
}
void Map::LoadMap(QTextStream *textStream){
QString line1 = textStream->readLine();
QString line2 = textStream->readLine();
QString line3 = textStream->readLine();
double l,t,r,b,c;
l=line1.split(',')[0].toDouble();
this->left=l;
t=line1.split(',')[1].toDouble();
this->top=t;
r=line2.split(',')[0].toDouble();
this->right=r;
b=line2.split(',')[1].toDouble();
this->bottom=b;
c=line3.toDouble();
this->layerCount=c;
for(int i=0;i<layerCount;i++){
Layer layer;
layer.LoadLayer(textStream);
LAYER=layer;
LAYERS.push_back(LAYER);
}
}
void Map::LoadStyle(QTextStream *textStream){
QString line=textStream->readLine() ;
if(this->layerCount!= line.toInt()){
return;
}
for(int i=0;i<layerCount;i++){
QString name=textStream->readLine() ;
int index=0;
for(int i=0;i<layerCount;i++){
if(name==LAYERS[i].layer_name){
index=i;
break;
}
}
Style style;
style.LoadStyle(textStream);
LAYERS[index].layer_style=style;
}
}