Welcome to mirror list, hosted at ThFree Co, Russian Federation.

srtm_parser.hpp « generator - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e0e6096e45237aaae55e7bb8f28ce786f0a0e323 (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 "std/cstdint.hpp"
#include "std/string.hpp"
#include "std/unordered_map.hpp"

namespace generator
{
class SrtmTile
{
public:
  SrtmTile();
  SrtmTile(SrtmTile && rhs);

  void Init(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 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();

  string m_data;
  bool m_valid;

  DISALLOW_COPY(SrtmTile);
};

class SrtmTileManager
{
public:
  SrtmTileManager(string const & dir);

  feature::TAltitude GetHeight(ms::LatLon const & coord);

private:
  string m_dir;
  unordered_map<string, SrtmTile> m_tiles;

  DISALLOW_COPY(SrtmTileManager);
};
}  // namespace generator