forked from organicmaps/organicmaps
?edits command shows all edited features, ?eclear deletes them all.
This commit is contained in:
parent
48b285b28b
commit
6275a0003e
2 changed files with 46 additions and 1 deletions
|
@ -978,6 +978,8 @@ bool Framework::Search(search::SearchParams const & params)
|
|||
#endif
|
||||
|
||||
ParseSetGpsTrackMinAccuracyCommand(params.m_query);
|
||||
if (ParseEditorDebugCommand(params))
|
||||
return true;
|
||||
|
||||
m2::RectD const viewport = GetCurrentViewport();
|
||||
|
||||
|
@ -2297,3 +2299,45 @@ void Framework::Load3dMode(bool & allow3d, bool & allow3dBuildings)
|
|||
if (!Settings::Get(kAllow3dBuildingsKey, allow3dBuildings))
|
||||
allow3dBuildings = true;
|
||||
}
|
||||
|
||||
namespace feature
|
||||
{
|
||||
string GetPrintableTypes(FeatureType const & ft)
|
||||
{
|
||||
return feature::TypesHolder(ft).DebugPrint();
|
||||
}
|
||||
uint32_t GetBestType(FeatureType const & ft)
|
||||
{
|
||||
return feature::TypesHolder(ft).GetBestType();
|
||||
}
|
||||
}
|
||||
|
||||
bool Framework::ParseEditorDebugCommand(search::SearchParams const & params)
|
||||
{
|
||||
if (params.m_query == "?edits")
|
||||
{
|
||||
osm::Editor::Stats const stats = osm::Editor::Instance().GetStats();
|
||||
search::Results results;
|
||||
results.AddResultNoChecks(search::Result("Uploaded: " + strings::to_string(stats.m_uploadedCount), "?edits"));
|
||||
for (auto const & edit : stats.m_edits)
|
||||
{
|
||||
FeatureID const & fid = edit.first;
|
||||
auto const feature = GetFeatureByID(fid);
|
||||
string name;
|
||||
feature->GetReadableName(name);
|
||||
feature::TypesHolder const types(*feature);
|
||||
search::Result::Metadata smd;
|
||||
results.AddResultNoChecks(search::Result(fid, feature::GetCenter(*feature), name, edit.second,
|
||||
types.DebugPrint(), types.GetBestType(), smd));
|
||||
}
|
||||
params.m_callback(results);
|
||||
params.m_callback(search::Results::GetEndMarker(false));
|
||||
return true;
|
||||
}
|
||||
else if (params.m_query == "?eclear")
|
||||
{
|
||||
osm::Editor::Instance().ClearAllLocalEdits();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -469,7 +469,8 @@ public:
|
|||
private:
|
||||
// TODO(vng): Uncomment when needed.
|
||||
//void GetLocality(m2::PointD const & pt, search::AddressInfo & info) const;
|
||||
|
||||
/// @returns true if command was handled by editor.
|
||||
bool ParseEditorDebugCommand(search::SearchParams const & params);
|
||||
public:
|
||||
/// @returns address of nearby building with house number in approx 1km distance.
|
||||
search::AddressInfo GetMercatorAddressInfo(m2::PointD const & mercator) const;
|
||||
|
|
Loading…
Add table
Reference in a new issue