blob: 75785cfd6cb7c4a6efc94308e326099ca5ef2b81 (
plain)
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
|
#pragma once
#include "geometry/latlon.hpp"
#include "indexer/feature_altitude.hpp"
#include "base/macros.hpp"
#include <cstdint>
#include <string>
#include <unordered_map>
namespace generator
{
class SrtmTile
{
public:
SrtmTile();
SrtmTile(SrtmTile && rhs);
void Init(std::string const & dir, ms::LatLon const & coord);
inline bool IsValid() const { return m_valid; }
// Returns height in meters at |coord| or kInvalidAltitude.
feature::TAltitude GetHeight(ms::LatLon const & coord);
static std::string GetBase(ms::LatLon coord);
private:
inline feature::TAltitude const * Data() const
{
return reinterpret_cast<feature::TAltitude const *>(m_data.data());
};
inline size_t Size() const { return m_data.size() / sizeof(feature::TAltitude); }
void Invalidate();
std::string m_data;
bool m_valid;
DISALLOW_COPY(SrtmTile);
};
class SrtmTileManager
{
public:
SrtmTileManager(std::string const & dir);
feature::TAltitude GetHeight(ms::LatLon const & coord);
private:
std::string m_dir;
std::unordered_map<std::string, SrtmTile> m_tiles;
DISALLOW_COPY(SrtmTileManager);
};
} // namespace generator
|