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

Method ParseEditorDebugCommand

libs/map/framework.cpp:2753–2792  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2751}
2752
2753bool Framework::ParseEditorDebugCommand(search::SearchParams const & params)
2754{
2755 if (params.m_query == "?edits")
2756 {
2757 osm::Editor::Stats stats = osm::Editor::Instance().GetStats();
2758 search::Results results;
2759 results.AddResultNoChecks(search::Result("Uploaded: " + strings::to_string(stats.m_uploadedCount), "?edits"));
2760 for (auto & edit : stats.m_edits)
2761 {
2762 FeatureID const & fid = edit.first;
2763
2764 FeaturesLoaderGuard guard(m_featuresFetcher.GetDataSource(), fid.m_mwmId);
2765 auto ft = guard.GetFeatureByIndex(fid.m_index);
2766 if (!ft)
2767 {
2768 LOG(LERROR, ("Feature can't be loaded:", fid));
2769 return true;
2770 }
2771
2772 search::Result res(feature::GetCenter(*ft), ft->GetTranslatedName().m_primary.has_value() ? ft->GetTranslatedName().m_primary.value() : "");
2773 res.SetAddress(std::move(edit.second));
2774 res.FromFeature(fid, feature::TypesHolder(*ft).GetBestType(), 0, {});
2775
2776 results.AddResultNoChecks(std::move(res));
2777 }
2778
2779 params.m_onResults(results);
2780
2781 results.SetEndMarker(false /* isCancelled */);
2782 params.m_onResults(results);
2783 return true;
2784 }
2785 else if (params.m_query == "?eclear")
2786 {
2787 osm::Editor::Instance().ClearAllLocalEdits();
2788 return true;
2789 }
2790
2791 return false;
2792}
2793
2794bool Framework::ParseRoutingDebugCommand(search::SearchParams const & params)
2795{

Callers

nothing calls this directly

Calls 15

to_stringFunction · 0.85
GetCenterFunction · 0.85
GetStatsMethod · 0.80
GetDataSourceMethod · 0.80
has_valueMethod · 0.80
GetTranslatedNameMethod · 0.80
SetEndMarkerMethod · 0.80
ClearAllLocalEditsMethod · 0.80
TypesHolderClass · 0.70
ResultClass · 0.50
AddResultNoChecksMethod · 0.45
GetFeatureByIndexMethod · 0.45

Tested by

no test coverage detected