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

altitude_loader.hpp « indexer - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: dee9285e34e9ba8286e2c4cfa402c70c18b42cef (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
#pragma once
#include "indexer/feature_altitude.hpp"
#include "indexer/mwm_set.hpp"

#include "coding/memory_region.hpp"

#include "geometry/point_with_altitude.hpp"

#include <memory>
#include <string>
#include <vector>

#include "3party/succinct/rs_bit_vector.hpp"

class DataSource;

namespace feature
{
// @TODO(bykoianko) |m_altitudeAvailability| and |m_featureTable| are saved without
// taking into account endianness. It should be fixed. The plan is
// * to use one bit form AltitudeHeader::m_version for keeping information about endianness. (Zero
//   should be used for big endian.)
// * to check the endianness of the reader and the bit while reading and to use an appropriate
//   methods for reading.
class AltitudeLoader
{
public:
  AltitudeLoader(DataSource const & dataSource, MwmSet::MwmId const & mwmId);

  /// \returns altitude of feature with |featureId|. All items of the returned vector are valid
  /// or the returned vector is empty.
  geometry::Altitudes const & GetAltitudes(uint32_t featureId, size_t pointCount);

  bool HasAltitudes() const;

  void ClearCache() { m_cache.clear(); }

private:
  std::unique_ptr<CopiedMemoryRegion> m_altitudeAvailabilityRegion;
  std::unique_ptr<CopiedMemoryRegion> m_featureTableRegion;

  succinct::rs_bit_vector m_altitudeAvailability;
  succinct::elias_fano m_featureTable;

  std::unique_ptr<FilesContainerR::TReader> m_reader;
  std::map<uint32_t, geometry::Altitudes> m_cache;
  AltitudeHeader m_header;
  std::string m_countryFileName;
  MwmSet::MwmHandle m_handle;
};
}  // namespace feature