blob: 9397f567c327ecebbea49fdeb894a341660f0fd9 (
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
|
#pragma once
#include "map/booking_filter_params.hpp"
#include "search/hotels_classifier.hpp"
#include "search/result.hpp"
#include "search/search_params.hpp"
#include "geometry/rect2d.hpp"
#include <functional>
namespace search
{
// An on-results-callback that should be used for interactive search.
//
// *NOTE* the class is NOT thread safe.
class ViewportSearchCallback
{
public:
class Delegate
{
public:
virtual ~Delegate() = default;
virtual void RunUITask(std::function<void()> fn) = 0;
virtual void SetHotelDisplacementMode() = 0;
virtual bool IsViewportSearchActive() const = 0;
virtual void ShowViewportSearchResults(Results::ConstIter begin, Results::ConstIter end,
bool clear) = 0;
virtual void ShowViewportSearchResults(Results::ConstIter begin, Results::ConstIter end,
bool clear, booking::filter::Types types) = 0;
virtual void FilterResultsForHotelsQuery(booking::filter::Tasks const & filterTasks,
search::Results const & results, bool inViewport) = 0;
virtual void FilterAllHotelsInViewport(m2::RectD const & viewport,
booking::filter::Tasks const & filterTasks) = 0;
};
using OnResults = SearchParams::OnResults;
ViewportSearchCallback(m2::RectD const & viewport, Delegate & delegate,
booking::filter::Tasks const & bookingFilterTasks,
OnResults const & onResults);
void operator()(Results const & results);
private:
m2::RectD m_viewport;
Delegate & m_delegate;
OnResults m_onResults;
bool m_firstCall;
size_t m_lastResultsSize;
booking::filter::Tasks m_bookingFilterTasks;
};
} // namespace search
|