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

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

#include "geometry/mercator.hpp"

#include "coding/multilang_utf8_string.hpp"

#include "base/assert.hpp"

namespace search
{
void SearchParams::SetPosition(double lat, double lon)
{
  m_lat = lat;
  m_lon = lon;
  m_validPos = true;
}

m2::PointD SearchParams::GetPositionMercator() const
{
  ASSERT(IsValidPosition(), ());
  return MercatorBounds::FromLatLon(m_lat, m_lon);
}

ms::LatLon SearchParams::GetPositionLatLon() const
{
  ASSERT(IsValidPosition(), ());
  return ms::LatLon(m_lat, m_lon);
}

bool SearchParams::IsEqualCommon(SearchParams const & rhs) const
{
  return m_query == rhs.m_query && m_inputLocale == rhs.m_inputLocale &&
         m_validPos == rhs.m_validPos && m_mode == rhs.m_mode;
}

string DebugPrint(SearchParams const & params)
{
  ostringstream ss;
  ss << "{ SearchParams: Query = " << params.m_query << ", Locale = " << params.m_inputLocale
     << ", Mode = " << DebugPrint(params.m_mode) << " }";
  return ss.str();
}
}  // namespace search