-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodel.h
79 lines (63 loc) · 2 KB
/
model.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
69
70
71
72
73
74
75
76
77
78
79
#pragma once
#include <vector>
#include <unordered_map>
#include <string>
#include <cstddef>
class Model
{
public:
struct Node {
double x = 0.f;
double y = 0.f;
};
struct Way {
std::vector<int> nodes;
};
struct Road {
enum Type { Invalid, Unclassified, Service, Residential,
Tertiary, Secondary, Primary, Trunk, Motorway, Footway };
int way;
Type type;
};
struct Railway {
int way;
};
struct Multipolygon {
std::vector<int> outer;
std::vector<int> inner;
};
struct Building : Multipolygon {};
struct Leisure : Multipolygon {};
struct Water : Multipolygon {};
struct Landuse : Multipolygon {
enum Type { Invalid, Commercial, Construction, Grass, Forest, Industrial, Railway, Residential };
Type type;
};
Model( const std::vector<std::byte> &xml );
auto MetricScale() const noexcept { return m_MetricScale; }
auto &Nodes() const noexcept { return m_Nodes; }
auto &Ways() const noexcept { return m_Ways; }
auto &Roads() const noexcept { return m_Roads; }
auto &Buildings() const noexcept { return m_Buildings; }
auto &Leisures() const noexcept { return m_Leisures; }
auto &Waters() const noexcept { return m_Waters; }
auto &Landuses() const noexcept { return m_Landuses; }
auto &Railways() const noexcept { return m_Railways; }
private:
void AdjustCoordinates();
void BuildRings( Multipolygon &mp );
void LoadData(const std::vector<std::byte> &xml);
std::vector<Node> m_Nodes;
std::vector<Way> m_Ways;
std::vector<Road> m_Roads;
std::vector<Railway> m_Railways;
std::vector<Building> m_Buildings;
std::vector<Leisure> m_Leisures;
std::vector<Water> m_Waters;
std::vector<Landuse> m_Landuses;
double m_MinLat = 0.;
double m_MaxLat = 0.;
double m_MinLon = 0.;
double m_MaxLon = 0.;
double m_MetricScale = 1.f;
};