diff --git a/search/intermediate_result.cpp b/search/intermediate_result.cpp index 42daaac369..f3965f8050 100644 --- a/search/intermediate_result.cpp +++ b/search/intermediate_result.cpp @@ -11,12 +11,9 @@ namespace impl { IntermediateResult::IntermediateResult(m2::RectD const & viewportRect, - FeatureType const & feature, - string const & displayName, - int matchPenalty, - int minVisibleScale) - : m_str(displayName), m_rect(feature::GetFeatureViewport(feature)), m_matchPenalty(matchPenalty), - m_minVisibleScale(minVisibleScale), m_resultType(RESULT_FEATURE) + FeatureType const & feature) + : m_str(feature.GetPreferredDrawableName()), m_rect(feature::GetFeatureViewport(feature)), + m_resultType(RESULT_FEATURE) { FeatureType::GetTypesFn types; feature.ForEachTypeRef(types); @@ -31,7 +28,7 @@ IntermediateResult::IntermediateResult(m2::RectD const & viewportRect, : m_str("(" + strings::to_string(lat) + ", " + strings::to_string(lon) + ")"), m_rect(MercatorBounds::LonToX(lon - precision), MercatorBounds::LatToY(lat - precision), MercatorBounds::LonToX(lon + precision), MercatorBounds::LatToY(lat + precision)), - m_type(0), m_matchPenalty(0), m_minVisibleScale(0), m_resultType(RESULT_LATLON) + m_type(0), m_resultType(RESULT_LATLON) { m_distance = ResultDistance(viewportRect.Center(), m_rect.Center()); m_direction = ResultDirection(viewportRect.Center(), m_rect.Center()); @@ -39,7 +36,7 @@ IntermediateResult::IntermediateResult(m2::RectD const & viewportRect, IntermediateResult::IntermediateResult(string name, string completionString, int penalty) : m_str(name), m_completionString(completionString), - m_matchPenalty(0), m_minVisibleScale(penalty), m_distance(0), m_direction(0), + m_distance(0), m_direction(0), m_resultType(RESULT_CATEGORY) { } @@ -48,27 +45,17 @@ bool IntermediateResult::operator < (IntermediateResult const & o) const { if (m_resultType != o.m_resultType) return m_resultType < o.m_resultType; - if (m_matchPenalty != o.m_matchPenalty) - return m_matchPenalty < o.m_matchPenalty; - if (m_minVisibleScale != o.m_minVisibleScale) - return m_minVisibleScale < o.m_minVisibleScale; + if (m_distance != o.m_distance) + return m_distance < o.m_distance; return false; } Result IntermediateResult::GenerateFinalResult() const { -//#ifdef DEBUG -// return Result(m_str -// + ' ' + strings::to_string(m_distance * 0.001) -// + ' ' + strings::to_string(m_direction / math::pi * 180.0) -// + ' ' + strings::to_string(m_matchPenalty) -// + ' ' + strings::to_string(m_minVisibleScale), -//#else switch (m_resultType) { case RESULT_FEATURE: - return Result(m_str + ' ' + strings::to_string(m_matchPenalty), m_type, m_rect, - m_distance, m_direction); + return Result(m_str, m_type, m_rect, m_distance, m_direction); case RESULT_LATLON: return Result(m_str, 0, m_rect, m_distance, m_direction); case RESULT_CATEGORY: diff --git a/search/intermediate_result.hpp b/search/intermediate_result.hpp index af2fee2f32..4a3991cdf6 100644 --- a/search/intermediate_result.hpp +++ b/search/intermediate_result.hpp @@ -19,10 +19,7 @@ public: // For RESULT_FEATURE. IntermediateResult(m2::RectD const & viewportRect, - FeatureType const & feature, - string const & displayName, - int matchPenalty, - int minVisibleScale); + FeatureType const & feature); // For RESULT_LATLON. IntermediateResult(m2::RectD const & viewportRect, double lat, double lon, double precision); @@ -44,8 +41,6 @@ private: string m_completionString; m2::RectD m_rect; uint32_t m_type; - int m_matchPenalty; - int m_minVisibleScale; double m_distance; double m_direction; ResultType m_resultType; diff --git a/search/search_query.cpp b/search/search_query.cpp index 4417b04278..8482b7b546 100644 --- a/search/search_query.cpp +++ b/search/search_query.cpp @@ -95,8 +95,7 @@ struct FeatureLoader ++m_count; FeatureType feature; m_featuresVector.Get(offset, feature); - m_query.AddResult(impl::IntermediateResult(m_query.m_viewport, feature, - feature.GetPreferredDrawableName(), 0, 0)); + m_query.AddResult(impl::IntermediateResult(m_query.m_viewport, feature)); } };