MCPcopy Create free account
hub / github.com/comaps/comaps / IsEqualFeature

Method IsEqualFeature

libs/search/result.cpp:145–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145bool Result::IsEqualFeature(Result const & r) const
146{
147 /// @todo Compare TruncValue(m_matchedType) ?
148 if (m_resultType != r.m_resultType || m_matchedType != r.m_matchedType)
149 return false;
150
151 ASSERT_EQUAL(m_resultType, Result::Type::Feature, ());
152 ASSERT(m_id.IsValid() && r.m_id.IsValid(), ());
153
154 /// @todo Investigate why it is happens here?
155 if (m_id == r.m_id)
156 return true;
157
158 if (m_str != r.m_str)
159 return false;
160
161 if (m_id.IsWorld() != r.m_id.IsWorld())
162 {
163 // Filter logically duplicating results from World.mwm and Country.mwm (like cities).
164 return PointDistance(m_center, r.m_center) < 500.0;
165 }
166
167 // Filter stops (bus/tram), see BA_LasHeras test.
168 if (ftypes::IsPublicTransportStopChecker::Instance()(m_matchedType))
169 return PointDistance(m_center, r.m_center) < 150.0;
170
171 /// @todo Keep this check until RemoveDuplicatingLinear will be fixed.
172 // Filter same streets (with 'same logical street distance' threshold).
173 if (ftypes::IsWayChecker::Instance().GetSearchRank(m_matchedType) != ftypes::IsWayChecker::Default)
174 return PointDistance(m_center, r.m_center) < 2000.0;
175
176 // Filter real duplicates when say area park is present in 2 MWMs, or OSM data duplicates.
177 return m_address == r.m_address && PointDistance(m_center, r.m_center) < 10.0;
178}
179
180void Result::AddHighlightRange(pair<uint16_t, uint16_t> const & range)
181{

Callers 1

AddResultMethod · 0.80

Calls 5

ASSERTFunction · 0.85
PointDistanceFunction · 0.85
GetSearchRankMethod · 0.80
IsValidMethod · 0.45
IsWorldMethod · 0.45

Tested by

no test coverage detected