Skip to content

Commit

Permalink
[map] Remove the old debug command that showed features.
Browse files Browse the repository at this point in the history
1. It was less predictable than the new one in search/
   in the case where several mwms had a feature with
   the queried index.
2. It was implemented directly in Framework.
  • Loading branch information
mpimenov authored and tatiana-yan committed Feb 16, 2021
1 parent 3a2ca5e commit 5532046
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 60 deletions.
57 changes: 0 additions & 57 deletions map/framework.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3372,36 +3372,6 @@ bool Framework::ParseEditorDebugCommand(search::SearchParams const & params)
return true;
}

static std::string const kFindFeatureDebugKey = "?fid ";
if (params.m_query.find(kFindFeatureDebugKey) == 0)
{
// Format: ?fid<space>index<space>.
auto fidStr = params.m_query.substr(kFindFeatureDebugKey.size());
bool const canSearch = !fidStr.empty() && fidStr.back() == ' ';
strings::Trim(fidStr);
uint32_t index = 0;
if (canSearch && strings::to_uint(fidStr, index))
{
bool isShown = false;
auto const features = FindFeaturesByIndex(index);
for (auto const & fid : features)
{
if (!fid.IsValid())
continue;

// Show the first feature on the map.
if (!isShown)
{
ShowFeature(fid);
isShown = true;
}

// Log found features.
LOG(LINFO, ("Feature found:", fid));
}
}
return true;
}
return false;
}

Expand Down Expand Up @@ -4094,33 +4064,6 @@ MwmSet::MwmId Framework::GetMwmIdByName(string const & name) const
return m_featuresFetcher.GetDataSource().GetMwmIdByCountryFile(platform::CountryFile(name));
}

vector<FeatureID> Framework::FindFeaturesByIndex(uint32_t featureIndex) const
{
vector<FeatureID> result;
auto mwms = GetMwmsByRect(m_currentModelView.ClipRect(), false /* rough */);
set<MwmSet::MwmId> s(mwms.begin(), mwms.end());

vector<shared_ptr<LocalCountryFile>> maps;
m_storage.GetLocalMaps(maps);
for (auto const & localFile : maps)
{
auto mwmId = GetMwmIdByName(localFile->GetCountryName());
if (s.find(mwmId) != s.end())
continue;

if (mwmId.IsAlive())
mwms.push_back(move(mwmId));
}

for (auto const & mwmId : mwms)
{
FeaturesLoaderGuard const guard(m_featuresFetcher.GetDataSource(), mwmId);
if (featureIndex < guard.GetNumFeatures() && guard.GetFeatureByIndex(featureIndex))
result.emplace_back(mwmId, featureIndex);
}
return result;
}

void Framework::ReadFeatures(function<void(FeatureType &)> const & reader,
vector<FeatureID> const & features)
{
Expand Down
3 changes: 0 additions & 3 deletions map/framework.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,9 +434,6 @@ class Framework : public PositionProvider,
std::vector<MwmSet::MwmId> GetMwmsByRect(m2::RectD const & rect, bool rough) const;
MwmSet::MwmId GetMwmIdByName(std::string const & name) const;

// Use only for debug purposes!
std::vector<FeatureID> FindFeaturesByIndex(uint32_t featureIndex) const;

void ReadFeatures(std::function<void(FeatureType &)> const & reader,
std::vector<FeatureID> const & features);

Expand Down

0 comments on commit 5532046

Please sign in to comment.