MCPcopy Create free account
hub / github.com/comaps/comaps / SrtmTile

Class SrtmTile

generator/srtm_parser.hpp:20–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18namespace generator
19{
20class SrtmTile
21{
22public:
23 SrtmTile() : m_valid(false) {}
24 SrtmTile(SrtmTile && rhs);
25
26 void Init(std::string const & dir, ms::LatLon const & coord);
27
28 inline bool IsValid() const { return m_valid; }
29 /// @return Height in meters at |coord| or kInvalidAltitude.
30 /// @{
31 /// Nearest serialized height.
32 geometry::Altitude GetHeight(ms::LatLon const & coord) const;
33 /// Triangle interpolation.
34 double GetTriangleHeight(ms::LatLon const & coord) const;
35 /// Bilinear interpolation.
36 double GetBilinearHeight(ms::LatLon const & coord) const;
37
38 geometry::Altitude GetAltitude(ms::LatLon const & coord) const
39 {
40 return static_cast<geometry::Altitude>(std::round(GetBilinearHeight(coord)));
41 }
42 /// @}
43
44 using LatLonKey = std::pair<int32_t, int32_t>;
45 static LatLonKey GetKey(ms::LatLon const & coord);
46
47 static std::string GetBase(ms::LatLon const & coord);
48 static std::string GetPath(std::string const & dir, std::string const & base);
49
50 /// Used in unit tests only to prepare mock tile.
51 geometry::Altitude * DataForTests(size_t & sz);
52
53private:
54 static ms::LatLon GetCoordInSeconds(ms::LatLon const & coord);
55 geometry::Altitude GetHeightRC(size_t row, size_t col) const;
56
57 inline geometry::Altitude const * Data() const { return reinterpret_cast<geometry::Altitude const *>(m_data.data()); }
58
59 inline size_t Size() const { return m_data.size() / sizeof(geometry::Altitude); }
60 void Invalidate();
61
62 std::vector<uint8_t> m_data;
63 bool m_valid;
64
65 DISALLOW_COPY(SrtmTile);
66};
67
68class SrtmTileManager
69{

Callers 1

srtm_parser.cppFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected