From 553204622def0d7f3d454047ff55bd5ff1b92b5f Mon Sep 17 00:00:00 2001 From: Maxim Pimenov Date: Wed, 15 Jul 2020 03:50:25 +0300 Subject: [PATCH] [map] Remove the old debug command that showed features. 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. --- map/framework.cpp | 57 ----------------------------------------------- map/framework.hpp | 3 --- 2 files changed, 60 deletions(-) diff --git a/map/framework.cpp b/map/framework.cpp index 15d05ad6c89..9b2773ea821 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -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: ?fidindex. - 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; } @@ -4094,33 +4064,6 @@ MwmSet::MwmId Framework::GetMwmIdByName(string const & name) const return m_featuresFetcher.GetDataSource().GetMwmIdByCountryFile(platform::CountryFile(name)); } -vector Framework::FindFeaturesByIndex(uint32_t featureIndex) const -{ - vector result; - auto mwms = GetMwmsByRect(m_currentModelView.ClipRect(), false /* rough */); - set s(mwms.begin(), mwms.end()); - - vector> 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 const & reader, vector const & features) { diff --git a/map/framework.hpp b/map/framework.hpp index 7254133d4c6..d3d84686d0d 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -434,9 +434,6 @@ class Framework : public PositionProvider, std::vector GetMwmsByRect(m2::RectD const & rect, bool rough) const; MwmSet::MwmId GetMwmIdByName(std::string const & name) const; - // Use only for debug purposes! - std::vector FindFeaturesByIndex(uint32_t featureIndex) const; - void ReadFeatures(std::function const & reader, std::vector const & features);