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

osm_decl.cpp « generator - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: de1e71eb13369e89e97143bc37ac544cfc3288e2 (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
58
59
60
61
#include "osm_decl.hpp"

#include "../indexer/classificator.hpp"

#include "../base/macros.hpp"

#include "../std/target_os.hpp"


void progress_policy::Begin(string const & /*name*/, size_t factor)
{
  m_count = 0;
  m_factor = factor;
//#ifndef OMIM_OS_BADA
//  cout << "Progress of " << name << " started" << endl;
//#endif
}

void progress_policy::Inc(size_t i /* = 1 */)
{
  m_count += i;
//#ifndef OMIM_OS_BADA
//  if (m_count % m_factor == 0)
//    cout << '.';
//#endif
}

void progress_policy::End()
{
}

string RelationElement::GetType() const
{
  map<string, string>::const_iterator i = tags.find("type");
  return ((i != tags.end()) ? i->second : string());
}

namespace
{
  bool FindRoleImpl(vector<pair<uint64_t, string> > const & cnt,
                    uint64_t id, string & role)
  {
    for (size_t i = 0; i < cnt.size(); ++i)
      if (cnt[i].first == id)
      {
        role = cnt[i].second;
        return true;
      }
    return false;
  }
}

bool RelationElement::FindWay(uint64_t id, string & role) const
{
  return FindRoleImpl(ways, id, role);
}

bool RelationElement::FindNode(uint64_t id, string & role) const
{
  return FindRoleImpl(nodes, id, role);
}