[search] Remove direction calculating for intermediate results.

This commit is contained in:
vng 2012-02-03 16:55:10 +03:00 committed by Alex Zolotarev
parent 77057f2605
commit 5573803fe3
5 changed files with 11 additions and 22 deletions

View file

@ -78,6 +78,7 @@ namespace
return item;
}
/*
QIcon draw_direction(double a)
{
int const dim = 64;
@ -109,6 +110,7 @@ namespace
return pm;
}
*/
}
void SearchPanel::OnSearchResult(ResultsT * res, int queryId)
@ -142,10 +144,12 @@ void SearchPanel::OnSearchResult(ResultsT * res, int queryId)
if (drawDir)
{
/*
QTableWidgetItem * item =
new QTableWidgetItem(draw_direction(e.GetDirectionFromCenter()), QString());
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
m_pTable->setItem(rowCount, 4, item);
*/
}
}

View file

@ -67,13 +67,9 @@ void IntermediateResult::CalcCommonParams(m2::RectD const & viewportRect, m2::Po
ASSERT ( my::between_s(-180.0, 180.0, pos.y), (pos.y) );
m_distance = ResultDistance(pos, center);
m_direction = ResultDirection(pos, center);
}
else
{
m_distance = -1.0;
m_direction = -1.0;
}
m_viewportDistance = ViewportDistance(viewportRect, center);
}
@ -81,7 +77,7 @@ void IntermediateResult::CalcCommonParams(m2::RectD const & viewportRect, m2::Po
IntermediateResult::IntermediateResult(string const & name, int penalty)
: m_str(name), m_completionString(name + " "),
// Categories should always be first
m_distance(0), m_direction(0), m_viewportDistance(0),
m_distance(0), m_viewportDistance(0),
m_resultType(RESULT_CATEGORY),
m_searchRank(0)
{
@ -146,11 +142,11 @@ Result IntermediateResult::GenerateFinalResult(
#endif
,
GetBestType(), feature::GetFeatureViewport(m_types, m_rect),
m_distance, m_direction);
m_distance);
case RESULT_LATLON:
return Result(m_str, info.m_name, info.m_flag, GetFeatureType(pCat),
0, m_rect, m_distance, m_direction);
0, m_rect, m_distance);
default:
ASSERT_EQUAL ( m_resultType, RESULT_CATEGORY, () );
@ -193,7 +189,7 @@ bool IntermediateResult::StrictEqualF::operator()(IntermediateResult const & r)
{
if (m_r.m_str == r.m_str && m_r.GetBestType() == r.GetBestType())
{
/// @todo Tune this constant.
// 100.0m - distance between equal features
return fabs(m_r.m_distance - r.m_distance) < 100.0;
}
}

View file

@ -127,7 +127,6 @@ private:
m2::RectD m_rect;
double m_distance;
double m_direction;
int m_viewportDistance;
ResultType m_resultType;

View file

@ -7,10 +7,10 @@ namespace search
Result::Result(string const & str, string const & region,
string const & flag, string const & type,
uint32_t featureType, m2::RectD const & featureRect,
double distanceFromCenter, double directionFromCenter)
double distanceFromCenter)
: m_str(str), m_region(region), m_flag(flag), m_type(type),
m_featureRect(featureRect), m_featureType(featureType),
m_distanceFromCenter(distanceFromCenter), m_directionFromCenter(directionFromCenter)
m_distanceFromCenter(distanceFromCenter)
{
// Features with empty names can be found after suggestion.
if (m_str.empty())
@ -47,12 +47,6 @@ double Result::GetDistanceFromCenter() const
return m_distanceFromCenter;
}
double Result::GetDirectionFromCenter() const
{
ASSERT_EQUAL(GetResultType(), RESULT_FEATURE, ());
return m_directionFromCenter;
}
char const * Result::GetSuggestionString() const
{
ASSERT_EQUAL(GetResultType(), RESULT_SUGGESTION, ());

View file

@ -19,7 +19,7 @@ public:
Result(string const & str, string const & region,
string const & flag, string const & type,
uint32_t featureType, m2::RectD const & featureRect,
double distanceFromCenter, double directionFromCenter);
double distanceFromCenter);
Result(string const & str, string const & suggestionStr);
// String that is displayed in the GUI.
@ -40,9 +40,6 @@ public:
// Distance from the center of the screen, if GetResultType() == RESULT_FEATURE.
double GetDistanceFromCenter() const;
// Direction from thethe center of the screen in radians, if GetResultType() == RESULT_FEATURE.
double GetDirectionFromCenter() const;
// String to write in the search box.
char const * GetSuggestionString() const;
@ -51,7 +48,6 @@ private:
m2::RectD m_featureRect;
uint32_t m_featureType;
double m_distanceFromCenter;
double m_directionFromCenter;
string m_suggestionStr;
};