-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcloud.cpp
29 lines (25 loc) · 835 Bytes
/
cloud.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
#include "cloud.h"
#include "algo.h"
void Cloud(int height, int width, vector<string>& raw_cloud,
string**& cloud_map, string**& cloud_converted, int**& cloud_original) {
vector <string> v;
string s, value;
vector <string> coordinate;
int x,y;
//Extract data
for (int i=0; i<raw_cloud.size(); i++) {
v = ProcessString(raw_cloud[i], "-");
s = ProcessCoordinate(v[0]);
coordinate = ProcessString(s, " ");
x = ConvertStringToInteger(coordinate[0]);
y = ConvertStringToInteger(coordinate[1]);
//Assign value
if((x < width) && (y < height)) {
cloud_map[height - y - 1][x] = ConvertToIndex(v[1]);
cloud_original[height - y - 1][x] = ConvertStringToInteger(v[1]);
}
if((x < width) && (y < height)) {
cloud_converted[height - y - 1][x] = ConvertToLMH(ConvertStringToInteger(v[1]));
}
}
}