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

search_params.hpp « search - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5d21d9b3ec2e55d806f1240089861905ee2450d5 (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
#pragma once

#include "search/hotels_filter.hpp"
#include "search/mode.hpp"

#include "geometry/latlon.hpp"
#include "geometry/point2d.hpp"
#include "geometry/rect2d.hpp"

#include "std/function.hpp"
#include "std/string.hpp"

namespace search
{
class Results;

class SearchParams
{
public:
  using TOnStarted = function<void()>;
  using TOnResults = function<void(Results const &)>;

  void SetPosition(double lat, double lon);
  m2::PointD GetPositionMercator() const;
  ms::LatLon GetPositionLatLon() const;

  inline bool IsValidPosition() const { return m_validPos; }
  bool IsEqualCommon(SearchParams const & rhs) const;
  inline void Clear() { m_query.clear(); }

  TOnStarted m_onStarted;
  TOnResults m_onResults;

  string m_query;
  string m_inputLocale;

  // A minimum distance between search results in meters, needed for
  // pre-ranking of viewport search results.
  double m_minDistanceOnMapBetweenResults = 0.0;

  Mode m_mode = Mode::Everywhere;
  bool m_forceSearch = false;
  bool m_suggestsEnabled = true;

  shared_ptr<hotels_filter::Rule> m_hotelsFilter;

  friend string DebugPrint(SearchParams const & params);

private:
  double m_lat = 0.0;
  double m_lon = 0.0;

  bool m_validPos = false;
};
}  // namespace search