{"action":"created","comment":{"url":"https://api.github.com/repos/mapsme/omim/pulls/comments/47342955","id":47342955,"diff_hunk":"@@ -0,0 +1,145 @@\n+#include \"osm_editor.hpp\"\n+\n+#include \"indexer/classificator.hpp\"\n+#include \"indexer/feature_decl.hpp\"\n+#include \"indexer/index.hpp\"\n+\n+#include \"platform/platform.hpp\"\n+\n+#include \"base/logging.hpp\"\n+\n+#include \"std/map.hpp\"\n+#include \"std/set.hpp\"\n+\n+#include \"3party/pugixml/src/pugixml.hpp\"\n+\n+using namespace pugi;\n+using feature::EGeomType;\n+using feature::Metadata;\n+\n+static char constexpr const * kEditorXMLFileName = \"edits.xml\";\n+\n+namespace osm\n+{\n+\n+// TODO(AlexZ): Normalize osm multivalue strings for correct merging\n+// (e.g. insert/remove spaces after ';' delimeter);\n+\n+namespace\n+{\n+string GetEditorFilePath() { return GetPlatform().WritablePathForFile(kEditorXMLFileName); }\n+} // namespace\n+\n+Editor::Editor()\n+{\n+  // Load all previous edits from persistent storage.\n+  Load(GetEditorFilePath());\n+}\n+\n+Editor & Editor::Instance()\n+{\n+  static Editor instance;\n+  return instance;\n+}\n+\n+void Editor::Load(string const & fullFilePath)\n+{\n+  pugi::xml_document xml;\n+  xml_parse_result res = xml.load_file(fullFilePath.c_str());\n+  // Note: status_file_not_found is ok if user has never made any edits.\n+  if (res != status_ok && res != status_file_not_found)\n+  {\n+    LOG(LERROR, (\"Can't load XML Edits from disk:\", fullFilePath));\n+  }\n+  // TODO(mgsergio): Implement XML deserialization into m_[deleted|edited|created]Features.\n+}\n+\n+void Editor::Save(string const & /*fullFilePath*/) const\n+{\n+  // Do not save empty xml file if no any edits were made.\n+  if (m_deletedFeatures.empty() && m_editedFeatures.empty() && m_createdFeatures.empty())\n+    return;\n+  // TODO(mgsergio): Implement XML serialization from m_[deleted|edited|created]Features.\n+}\n+\n+bool Editor::IsFeatureDeleted(FeatureID const & fid) const\n+{\n+  // Most popular case optimization.\n+  if (m_deletedFeatures.empty())\n+    return false;\n+\n+  return m_deletedFeatures.find(fid) != m_deletedFeatures.end();\n+}\n+\n+void Editor::DeleteFeature(FeatureType const & feature)\n+{\n+  m_deletedFeatures.insert(feature.GetID());\n+\n+  Save(GetEditorFilePath());","path":"indexer/osm_editor.cpp","position":78,"original_position":78,"commit_id":"bec3111a9128b076995005c09aa96d79c6b2dbc2","original_commit_id":"7b4100d6f57b316931a8b23c05b07d4c4cad7fef","user":{"login":"ygorshenin","id":454567,"avatar_url":"https://avatars.githubusercontent.com/u/454567?v=3","gravatar_id":"","url":"https://api.github.com/users/ygorshenin","html_url":"https://github.com/ygorshenin","followers_url":"https://api.github.com/users/ygorshenin/followers","following_url":"https://api.github.com/users/ygorshenin/following{/other_user}","gists_url":"https://api.github.com/users/ygorshenin/gists{/gist_id}","starred_url":"https://api.github.com/users/ygorshenin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ygorshenin/subscriptions","organizations_url":"https://api.github.com/users/ygorshenin/orgs","repos_url":"https://api.github.com/users/ygorshenin/repos","events_url":"https://api.github.com/users/ygorshenin/events{/privacy}","received_events_url":"https://api.github.com/users/ygorshenin/received_events","type":"User","site_admin":false},"body":"Добавьте ThreadChecker (через DECLARE_THREAD_CHECKER и ASSERT_THREAD_CHECKER) - пусть будет как документация.","created_at":"2015-12-11T10:49:43Z","updated_at":"2015-12-11T10:49:43Z","html_url":"https://github.com/mapsme/omim/pull/927#discussion_r47342955","pull_request_url":"https://api.github.com/repos/mapsme/omim/pulls/927","_links":{"self":{"href":"https://api.github.com/repos/mapsme/omim/pulls/comments/47342955"},"html":{"href":"https://github.com/mapsme/omim/pull/927#discussion_r47342955"},"pull_request":{"href":"https://api.github.com/repos/mapsme/omim/pulls/927"}}},"pull_request":{"url":"https://api.github.com/repos/mapsme/omim/pulls/927","id":53291763,"html_url":"https://github.com/mapsme/omim/pull/927","diff_url":"https://github.com/mapsme/omim/pull/927.diff","patch_url":"https://github.com/mapsme/omim/pull/927.patch","issue_url":"https://api.github.com/repos/mapsme/omim/issues/927","number":927,"state":"open","locked":false,"title":"Editor core v3.","user":{"login":"deathbaba","id":170263,"avatar_url":"https://avatars.githubusercontent.com/u/170263?v=3","gravatar_id":"","url":"https://api.github.com/users/deathbaba","html_url":"https://github.com/deathbaba","followers_url":"https://api.github.com/users/deathbaba/followers","following_url":"https://api.github.com/users/deathbaba/following{/other_user}","gists_url":"https://api.github.com/users/deathbaba/gists{/gist_id}","starred_url":"https://api.github.com/users/deathbaba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deathbaba/subscriptions","organizations_url":"https://api.github.com/users/deathbaba/orgs","repos_url":"https://api.github.com/users/deathbaba/repos","events_url":"https://api.github.com/users/deathbaba/events{/privacy}","received_events_url":"https://api.github.com/users/deathbaba/received_events","type":"User","site_admin":false},"body":"Код ядра редактора с UI в QtCreator (можно кликать левой мышкой в POI и редактировать поля).\r\nОсобенности:\r\n- В QT сейчас редактируются все name поля и одно поле метаинформации - opening hours.\r\n- Там же можно удалять фичи.\r\n- Пока нет создания фич, только заглушки.\r\n- Фича с подредактированным именем не находится в поиске. Это TODO @vng и @ygorshenin в search_query.cpp\r\n- Пока нет сериализации фич (TODO @mgsergio ) и отправки их на сервер.","created_at":"2015-12-10T17:42:20Z","updated_at":"2015-12-11T10:49:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e96e5b5875dcc1b4dccff80b2be36202ac05e0cc","assignee":{"login":"vng","id":175612,"avatar_url":"https://avatars.githubusercontent.com/u/175612?v=3","gravatar_id":"","url":"https://api.github.com/users/vng","html_url":"https://github.com/vng","followers_url":"https://api.github.com/users/vng/followers","following_url":"https://api.github.com/users/vng/following{/other_user}","gists_url":"https://api.github.com/users/vng/gists{/gist_id}","starred_url":"https://api.github.com/users/vng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vng/subscriptions","organizations_url":"https://api.github.com/users/vng/orgs","repos_url":"https://api.github.com/users/vng/repos","events_url":"https://api.github.com/users/vng/events{/privacy}","received_events_url":"https://api.github.com/users/vng/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/mapsme/omim/pulls/927/commits","review_comments_url":"https://api.github.com/repos/mapsme/omim/pulls/927/comments","review_comment_url":"https://api.github.com/repos/mapsme/omim/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mapsme/omim/issues/927/comments","statuses_url":"https://api.github.com/repos/mapsme/omim/statuses/bec3111a9128b076995005c09aa96d79c6b2dbc2","head":{"label":"deathbaba:editor-core","ref":"editor-core","sha":"bec3111a9128b076995005c09aa96d79c6b2dbc2","user":{"login":"deathbaba","id":170263,"avatar_url":"https://avatars.githubusercontent.com/u/170263?v=3","gravatar_id":"","url":"https://api.github.com/users/deathbaba","html_url":"https://github.com/deathbaba","followers_url":"https://api.github.com/users/deathbaba/followers","following_url":"https://api.github.com/users/deathbaba/following{/other_user}","gists_url":"https://api.github.com/users/deathbaba/gists{/gist_id}","starred_url":"https://api.github.com/users/deathbaba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deathbaba/subscriptions","organizations_url":"https://api.github.com/users/deathbaba/orgs","repos_url":"https://api.github.com/users/deathbaba/repos","events_url":"https://api.github.com/users/deathbaba/events{/privacy}","received_events_url":"https://api.github.com/users/deathbaba/received_events","type":"User","site_admin":false},"repo":{"id":43427531,"name":"omim","full_name":"deathbaba/omim","owner":{"login":"deathbaba","id":170263,"avatar_url":"https://avatars.githubusercontent.com/u/170263?v=3","gravatar_id":"","url":"https://api.github.com/users/deathbaba","html_url":"https://github.com/deathbaba","followers_url":"https://api.github.com/users/deathbaba/followers","following_url":"https://api.github.com/users/deathbaba/following{/other_user}","gists_url":"https://api.github.com/users/deathbaba/gists{/gist_id}","starred_url":"https://api.github.com/users/deathbaba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deathbaba/subscriptions","organizations_url":"https://api.github.com/users/deathbaba/orgs","repos_url":"https://api.github.com/users/deathbaba/repos","events_url":"https://api.github.com/users/deathbaba/events{/privacy}","received_events_url":"https://api.github.com/users/deathbaba/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/deathbaba/omim","description":"MAPS.ME - Offline OpenStreetMap maps for iOS/Android/Mac/Linux/Windows","fork":true,"url":"https://api.github.com/repos/deathbaba/omim","forks_url":"https://api.github.com/repos/deathbaba/omim/forks","keys_url":"https://api.github.com/repos/deathbaba/omim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/deathbaba/omim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/deathbaba/omim/teams","hooks_url":"https://api.github.com/repos/deathbaba/omim/hooks","issue_events_url":"https://api.github.com/repos/deathbaba/omim/issues/events{/number}","events_url":"https://api.github.com/repos/deathbaba/omim/events","assignees_url":"https://api.github.com/repos/deathbaba/omim/assignees{/user}","branches_url":"https://api.github.com/repos/deathbaba/omim/branches{/branch}","tags_url":"https://api.github.com/repos/deathbaba/omim/tags","blobs_url":"https://api.github.com/repos/deathbaba/omim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/deathbaba/omim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/deathbaba/omim/git/refs{/sha}","trees_url":"https://api.github.com/repos/deathbaba/omim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/deathbaba/omim/statuses/{sha}","languages_url":"https://api.github.com/repos/deathbaba/omim/languages","stargazers_url":"https://api.github.com/repos/deathbaba/omim/stargazers","contributors_url":"https://api.github.com/repos/deathbaba/omim/contributors","subscribers_url":"https://api.github.com/repos/deathbaba/omim/subscribers","subscription_url":"https://api.github.com/repos/deathbaba/omim/subscription","commits_url":"https://api.github.com/repos/deathbaba/omim/commits{/sha}","git_commits_url":"https://api.github.com/repos/deathbaba/omim/git/commits{/sha}","comments_url":"https://api.github.com/repos/deathbaba/omim/comments{/number}","issue_comment_url":"https://api.github.com/repos/deathbaba/omim/issues/comments{/number}","contents_url":"https://api.github.com/repos/deathbaba/omim/contents/{+path}","compare_url":"https://api.github.com/repos/deathbaba/omim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/deathbaba/omim/merges","archive_url":"https://api.github.com/repos/deathbaba/omim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/deathbaba/omim/downloads","issues_url":"https://api.github.com/repos/deathbaba/omim/issues{/number}","pulls_url":"https://api.github.com/repos/deathbaba/omim/pulls{/number}","milestones_url":"https://api.github.com/repos/deathbaba/omim/milestones{/number}","notifications_url":"https://api.github.com/repos/deathbaba/omim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/deathbaba/omim/labels{/name}","releases_url":"https://api.github.com/repos/deathbaba/omim/releases{/id}","created_at":"2015-09-30T10:45:37Z","updated_at":"2015-09-30T10:48:10Z","pushed_at":"2015-12-11T10:15:41Z","git_url":"git://github.com/deathbaba/omim.git","ssh_url":"git@github.com:deathbaba/omim.git","clone_url":"https://github.com/deathbaba/omim.git","svn_url":"https://github.com/deathbaba/omim","homepage":null,"size":1905554,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mapsme:osm-editor","ref":"osm-editor","sha":"e0132864ea2f7a726f2f894d678809d9981dfd49","user":{"login":"mapsme","id":14185141,"avatar_url":"https://avatars.githubusercontent.com/u/14185141?v=3","gravatar_id":"","url":"https://api.github.com/users/mapsme","html_url":"https://github.com/mapsme","followers_url":"https://api.github.com/users/mapsme/followers","following_url":"https://api.github.com/users/mapsme/following{/other_user}","gists_url":"https://api.github.com/users/mapsme/gists{/gist_id}","starred_url":"https://api.github.com/users/mapsme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapsme/subscriptions","organizations_url":"https://api.github.com/users/mapsme/orgs","repos_url":"https://api.github.com/users/mapsme/repos","events_url":"https://api.github.com/users/mapsme/events{/privacy}","received_events_url":"https://api.github.com/users/mapsme/received_events","type":"Organization","site_admin":false},"repo":{"id":42798033,"name":"omim","full_name":"mapsme/omim","owner":{"login":"mapsme","id":14185141,"avatar_url":"https://avatars.githubusercontent.com/u/14185141?v=3","gravatar_id":"","url":"https://api.github.com/users/mapsme","html_url":"https://github.com/mapsme","followers_url":"https://api.github.com/users/mapsme/followers","following_url":"https://api.github.com/users/mapsme/following{/other_user}","gists_url":"https://api.github.com/users/mapsme/gists{/gist_id}","starred_url":"https://api.github.com/users/mapsme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapsme/subscriptions","organizations_url":"https://api.github.com/users/mapsme/orgs","repos_url":"https://api.github.com/users/mapsme/repos","events_url":"https://api.github.com/users/mapsme/events{/privacy}","received_events_url":"https://api.github.com/users/mapsme/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mapsme/omim","description":"MAPS.ME - Offline OpenStreetMap maps for iOS/Android/Mac/Linux/Windows","fork":false,"url":"https://api.github.com/repos/mapsme/omim","forks_url":"https://api.github.com/repos/mapsme/omim/forks","keys_url":"https://api.github.com/repos/mapsme/omim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mapsme/omim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mapsme/omim/teams","hooks_url":"https://api.github.com/repos/mapsme/omim/hooks","issue_events_url":"https://api.github.com/repos/mapsme/omim/issues/events{/number}","events_url":"https://api.github.com/repos/mapsme/omim/events","assignees_url":"https://api.github.com/repos/mapsme/omim/assignees{/user}","branches_url":"https://api.github.com/repos/mapsme/omim/branches{/branch}","tags_url":"https://api.github.com/repos/mapsme/omim/tags","blobs_url":"https://api.github.com/repos/mapsme/omim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mapsme/omim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mapsme/omim/git/refs{/sha}","trees_url":"https://api.github.com/repos/mapsme/omim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mapsme/omim/statuses/{sha}","languages_url":"https://api.github.com/repos/mapsme/omim/languages","stargazers_url":"https://api.github.com/repos/mapsme/omim/stargazers","contributors_url":"https://api.github.com/repos/mapsme/omim/contributors","subscribers_url":"https://api.github.com/repos/mapsme/omim/subscribers","subscription_url":"https://api.github.com/repos/mapsme/omim/subscription","commits_url":"https://api.github.com/repos/mapsme/omim/commits{/sha}","git_commits_url":"https://api.github.com/repos/mapsme/omim/git/commits{/sha}","comments_url":"https://api.github.com/repos/mapsme/omim/comments{/number}","issue_comment_url":"https://api.github.com/repos/mapsme/omim/issues/comments{/number}","contents_url":"https://api.github.com/repos/mapsme/omim/contents/{+path}","compare_url":"https://api.github.com/repos/mapsme/omim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mapsme/omim/merges","archive_url":"https://api.github.com/repos/mapsme/omim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mapsme/omim/downloads","issues_url":"https://api.github.com/repos/mapsme/omim/issues{/number}","pulls_url":"https://api.github.com/repos/mapsme/omim/pulls{/number}","milestones_url":"https://api.github.com/repos/mapsme/omim/milestones{/number}","notifications_url":"https://api.github.com/repos/mapsme/omim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mapsme/omim/labels{/name}","releases_url":"https://api.github.com/repos/mapsme/omim/releases{/id}","created_at":"2015-09-20T02:57:13Z","updated_at":"2015-12-11T08:26:49Z","pushed_at":"2015-12-11T10:47:52Z","git_url":"git://github.com/mapsme/omim.git","ssh_url":"git@github.com:mapsme/omim.git","clone_url":"https://github.com/mapsme/omim.git","svn_url":"https://github.com/mapsme/omim","homepage":null,"size":1943306,"stargazers_count":1523,"watchers_count":1523,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":188,"mirror_url":null,"open_issues_count":73,"forks":188,"open_issues":73,"watchers":1523,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mapsme/omim/pulls/927"},"html":{"href":"https://github.com/mapsme/omim/pull/927"},"issue":{"href":"https://api.github.com/repos/mapsme/omim/issues/927"},"comments":{"href":"https://api.github.com/repos/mapsme/omim/issues/927/comments"},"review_comments":{"href":"https://api.github.com/repos/mapsme/omim/pulls/927/comments"},"review_comment":{"href":"https://api.github.com/repos/mapsme/omim/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mapsme/omim/pulls/927/commits"},"statuses":{"href":"https://api.github.com/repos/mapsme/omim/statuses/bec3111a9128b076995005c09aa96d79c6b2dbc2"}}}}