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

feature_vec_model.cpp « map - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 616ce07958529862a7550282e1d9b7bca981c8cf (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include "../base/SRC_FIRST.hpp"

#include "feature_vec_model.hpp"

#include "../platform/platform.hpp"

#include "../indexer/cell_coverer.hpp"
#include "../indexer/scales.hpp"
#include "../indexer/classificator_loader.hpp"

#include "../base/logging.hpp"

#include "../std/bind.hpp"

#include "../base/start_mem_debug.hpp"

namespace model
{

void FeaturesFetcher::InitClassificator()
{
  Platform & p = GetPlatform();

  try
  {
    classificator::Read(p.GetReader("drawing_rules.bin"),
                        p.GetReader("classificator.txt"),
                        p.GetReader("visibility.txt"));
  }
  catch (FileAbsentException const & e)
  {
      LOG(LERROR, ("Classificator not found ", e.what()));
  }
}

void FeaturesFetcher::AddMap(ReaderT const & file)
{
  try
  {
    m_multiIndex.Add(file);
  }
  catch (Reader::OpenException const & e)
  {
    LOG(LERROR, ("Data file not found: ", e.what()));
  }
  catch (Reader::Exception const & e)
  {
    LOG(LCRITICAL, ("Unknown error while reading file: ", e.what()));
  }
}

void FeaturesFetcher::RemoveMap(string const & fName)
{
  m_multiIndex.Remove(fName);
}

void FeaturesFetcher::Clean()
{
  m_rect.MakeEmpty();
  m_multiIndex.Clean();
}

void FeaturesFetcher::ClearCaches()
{
  m_multiIndex.ClearCaches();
}

m2::RectD FeaturesFetcher::GetWorldRect() const
{
  if (m_rect == m2::RectD())
  {
    // rect is empty when now countries are loaded
    // return max global rect
    return m2::RectD(MercatorBounds::minX,
                     MercatorBounds::minY,
                     MercatorBounds::maxX,
                     MercatorBounds::maxY);
  }
  return m_rect;
}

}