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

feature_source.cpp « indexer - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 83e52f59b20739f270c862e011c3adec007c90a5 (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
#include "indexer/feature_source.hpp"

using namespace std;

string ToString(FeatureStatus fs)
{
  switch (fs)
  {
  case FeatureStatus::Untouched: return "Untouched";
  case FeatureStatus::Deleted: return "Deleted";
  case FeatureStatus::Obsolete: return "Obsolete";
  case FeatureStatus::Modified: return "Modified";
  case FeatureStatus::Created: return "Created";
  };
  return "Undefined";
}

FeatureSource::FeatureSource(MwmSet::MwmHandle const & handle) : m_handle(handle)
{
  if (!m_handle.IsAlive())
    return;

  auto const & value = *m_handle.GetValue<MwmValue>();
  m_vector = make_unique<FeaturesVector>(value.m_cont, value.GetHeader(), value.m_table.get());
}

size_t FeatureSource::GetNumFeatures() const
{
  if (!m_handle.IsAlive())
    return 0;

  ASSERT(m_vector.get(), ());
  return m_vector->GetNumFeatures();
}

unique_ptr<FeatureType> FeatureSource::GetOriginalFeature(uint32_t index) const
{
  ASSERT(m_handle.IsAlive(), ());
  ASSERT(m_vector != nullptr, ());
  auto ft = m_vector->GetByIndex(index);
  ft->SetID(FeatureID(m_handle.GetId(), index));
  return ft;
}

FeatureStatus FeatureSource::GetFeatureStatus(uint32_t index) const
{
  return FeatureStatus::Untouched;
}

unique_ptr<FeatureType> FeatureSource::GetModifiedFeature(uint32_t index) const { return {}; }

void FeatureSource::ForEachAdditionalFeature(m2::RectD const & rect, int scale,
                                             function<void(uint32_t)> const & fn) const
{
}