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

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Gorshenin <y@maps.me>2016-09-23 14:29:53 +0300
committerYuri Gorshenin <y@maps.me>2016-09-23 14:29:53 +0300
commitfc0f736e1af20e80f8c844f29469ddb9a17a72c4 (patch)
tree566e874c814d454dc8b4c63dd551064861e4130d /search/search_params.hpp
parent461f9737065175f266e067b435ff97409348db05 (diff)
Review fixes and SearchParams refactoring.
Diffstat (limited to 'search/search_params.hpp')
-rw-r--r--search/search_params.hpp41
1 files changed, 14 insertions, 27 deletions
diff --git a/search/search_params.hpp b/search/search_params.hpp
index 7685d3cbdd..e454d017de 100644
--- a/search/search_params.hpp
+++ b/search/search_params.hpp
@@ -2,6 +2,7 @@
#include "search/mode.hpp"
+#include "geometry/latlon.hpp"
#include "geometry/point2d.hpp"
#include "geometry/rect2d.hpp"
@@ -18,48 +19,34 @@ public:
using TOnStarted = function<void()>;
using TOnResults = function<void(Results const &)>;
- SearchParams();
-
- /// @name Force run search without comparing with previous search params.
- //@{
- void SetForceSearch(bool b) { m_forceSearch = b; }
- bool IsForceSearch() const { return m_forceSearch; }
- //@}
-
- inline void SetMode(Mode mode) { m_mode = mode; }
- inline Mode GetMode() const { return m_mode; }
void SetPosition(double lat, double lon);
- inline bool IsValidPosition() const { return m_validPos; }
- inline bool IsSearchAroundPosition() const { return (m_searchRadiusM > 0 && IsValidPosition()); }
- inline void SetSearchRadiusMeters(double radiusM) { m_searchRadiusM = radiusM; }
- bool GetSearchRect(m2::RectD & rect) const;
+ m2::PointD GetPositionMercator() const;
+ ms::LatLon GetPositionLatLon() const;
- /// @param[in] locale can be "fr", "en-US", "ru_RU" etc.
- inline void SetInputLocale(string const & locale) { m_inputLocale = locale; }
- inline void SetSuggestsEnabled(bool enabled) { m_suggestsEnabled = enabled; }
- inline bool GetSuggestsEnabled() const { return m_suggestsEnabled; }
+ 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;
- double m_lat, m_lon;
-
// A minimum distance between search results in meters, needed for
// pre-ranking of viewport search results.
- double m_minDistanceOnMapBetweenResults;
+ double m_minDistanceOnMapBetweenResults = 0.0;
+
+ Mode m_mode = Mode::Everywhere;
+ bool m_forceSearch = false;
+ bool m_suggestsEnabled = true;
friend string DebugPrint(SearchParams const & params);
private:
- double m_searchRadiusM;
- Mode m_mode;
- bool m_forceSearch;
- bool m_validPos;
- bool m_suggestsEnabled;
+ double m_lat = 0.0;
+ double m_lon = 0.0;
+
+ bool m_validPos = false;
};
} // namespace search