diff --git a/indexer/osm_editor.cpp b/indexer/osm_editor.cpp index 3de6497b13..5fa071628c 100644 --- a/indexer/osm_editor.cpp +++ b/indexer/osm_editor.cpp @@ -131,6 +131,13 @@ bool IsObsolete(editor::XMLFeature const & xml, FeatureID const & fid) return uploadTime != my::INVALID_TIME_STAMP && my::TimeTToSecondsSinceEpoch(uploadTime) < GetMwmCreationTimeByMwmId(fid.m_mwmId); } + +m2::PointD GetSomeFeaturePoint(editor::XMLFeature const & xml) +{ + if (xml.GetType() == XMLFeature::Type::Node) + return xml.GetMercatorCenter(); + return xml.GetGeometry().front(); +} } // namespace namespace osm @@ -197,6 +204,14 @@ void Editor::LoadMapEdits() { XMLFeature const xml(nodeOrWay.node()); + // TODO(mgsergio): A map could be renamed, we'll treat it as deleted. + // The right thing to do is to try to migrate all changes anyway. + if (!mwmId.IsAlive()) + { + LOG(LINFO, ("Mwm", mapName, "was deleted")); + goto SECTION_END; + } + // TODO(mgsergio): Deleted features are not properly handled yet. auto const fid = needMigrateEdits ? editor::MigrateFeatureIndex( @@ -251,6 +266,8 @@ void Editor::LoadMapEdits() } } // for nodes } // for sections + SECTION_END: + ; } // for mwms // Save edits with new indexes and mwm version to avoid another migration on next startup. diff --git a/storage/country_info_getter.hpp b/storage/country_info_getter.hpp index e1108aa1c1..3acda1a2d8 100644 --- a/storage/country_info_getter.hpp +++ b/storage/country_info_getter.hpp @@ -32,7 +32,7 @@ public: virtual ~CountryInfoGetter() = default; // Returns country file name without an extension for a country |pt| - // belongs to. If there are no such country, returns an empty + // belongs to. If there is no such country, returns an empty // string. TCountryId GetRegionCountryId(m2::PointD const & pt) const; @@ -72,7 +72,7 @@ public: // Returns true if there're at least one region with id equals to // |countryId|. bool IsBelongToRegions(TCountryId const & countryId, TRegionIdSet const & regions) const; - + void RegionIdsToCountryIds(TRegionIdSet const & regions, TCountriesVec & countries) const; // Clears regions cache. diff --git a/storage/storage.hpp b/storage/storage.hpp index 4201552ee6..45ca9545d8 100644 --- a/storage/storage.hpp +++ b/storage/storage.hpp @@ -187,6 +187,7 @@ private: DownloadingPolicy m_defaultDownloadingPolicy; DownloadingPolicy * m_downloadingPolicy = &m_defaultDownloadingPolicy; + /// @name Communicate with GUI //@{ @@ -288,7 +289,7 @@ public: unique_ptr mapDownloaderForTesting); void Init(TUpdateCallback const & didDownload, TDeleteCallback const & willDelete); - + inline void SetDownloadingPolicy(DownloadingPolicy * policy) { m_downloadingPolicy = policy; } /// @name Interface with clients (Android/iOS). @@ -355,7 +356,7 @@ public: /// \param groupNode is start of path, can't be a leaf node. /// \param path is resulting array of TCountryId. void GetGroupNodePathToRoot(TCountryId const & groupNode, TCountriesVec & path) const; - + /// \brief Fills |nodes| with CountryIds of topmost nodes for this |countryId|. /// For disputed territories all possible owners will be added. void GetTopmostNodesFor(TCountryId const & countryId, TCountriesVec & nodes) const; @@ -364,7 +365,7 @@ public: inline int64_t GetCurrentDataVersion() const { return m_currentVersion; } /// \brief Returns true if the node with countryId has been downloaded and false othewise. - /// If countryId is a expandable returns true if all mwms which belongs to it have downloaded. + /// If countryId is expandable returns true if all mwms which belongs to it have downloaded. /// Returns false if countryId is an unknown string. /// \note The method return false for custom maps generated by user /// and World.mwm and WorldCoasts.mwm. @@ -473,7 +474,7 @@ public: /// Returns information about selected counties downloading progress. /// |countries| - watched CountryId, ONLY leaf expected. MapFilesDownloader::TProgress GetOverallProgress(TCountriesVec const &countries) const; - + Country const & CountryLeafByCountryId(TCountryId const & countryId) const; Country const & CountryByCountryId(TCountryId const & countryId) const;