diff options
author | vng <viktor.govako@gmail.com> | 2014-02-12 19:13:08 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:13:30 +0300 |
commit | 36ea18fcbae5f2e4a7ecf964ac12c415fe702414 (patch) | |
tree | deae2c9be084ee08a2ded61c48b86e43e051e71e /search/house_detector.hpp | |
parent | 8dc4ce809aa3dc527f02784f153ac69709dee775 (diff) |
[search] Better pivot choosing strategy.
Diffstat (limited to 'search/house_detector.hpp')
-rw-r--r-- | search/house_detector.hpp | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/search/house_detector.hpp b/search/house_detector.hpp index ddaae8f19a..6ab82436a4 100644 --- a/search/house_detector.hpp +++ b/search/house_detector.hpp @@ -89,6 +89,16 @@ struct HouseProjection double m_streetDistance; /// false - to the left, true - to the right from projection segment bool m_projectionSign; + + inline bool IsOdd() const { return (m_house->GetIntNumber() % 2 == 1); } + + struct LessDistance + { + bool operator() (HouseProjection const * p1, HouseProjection const * p2) const + { + return p1->m_distance < p2->m_distance; + } + }; }; // many features combines to street @@ -134,26 +144,20 @@ public: bool IsHousesReaded() const; void FinishReadingHouses(); + HouseProjection const * GetHousePivot(bool & isOdd, bool & sign) const; + /// @name Temporary //@{ inline size_t size() const { return m_cont.size(); } inline Street const * operator[] (size_t i) const { return m_cont[i]; } //@} -private: +public: struct Index { size_t s, h; Index() : s(0), h(0) {} }; - inline void Next(Index & i) const - { - while (i.s < m_cont.size() && i.h == m_cont[i.s]->m_houses.size()) - { - i.h = 0; - ++i.s; - } - } inline Index Begin() const { @@ -175,7 +179,10 @@ private: ASSERT(!IsEnd(i), ()); return m_cont[i.s]->m_houses[i.h]; } + +private: void Erase(Index & i); + void Next(Index & i) const; }; class HouseDetector @@ -202,7 +209,7 @@ private: void SetMetres2Mercator(double factor); - //double GetApprLengthMeters(int index) const; + double GetApprLengthMeters(int index) const; public: typedef map<FeatureID, Street *>::iterator IterM; |