diff --git a/storage/storage_helpers.cpp b/storage/storage_helpers.cpp new file mode 100644 index 0000000000..fbcc4ff526 --- /dev/null +++ b/storage/storage_helpers.cpp @@ -0,0 +1,16 @@ +#include "storage/storage_helpers.hpp" + +#include "storage/country_info_getter.hpp" +#include "storage/storage.hpp" + +namespace storage +{ + +bool IsPointCoveredByDownloadedMaps(m2::PointD const & position, + Storage const & storage, + CountryInfoGetter const & countryInfoGetter) +{ + return storage.IsNodeDownloaded(countryInfoGetter.GetRegionCountryId(position)); +} + +} // namespace storage diff --git a/storage/storage_helpers.hpp b/storage/storage_helpers.hpp new file mode 100644 index 0000000000..9fa04fd5c2 --- /dev/null +++ b/storage/storage_helpers.hpp @@ -0,0 +1,17 @@ +#pragma once + +#include "geometry/point2d.hpp" + +namespace storage +{ +class CountryInfoGetter; +class Storage; + +/// \returns true if |position| is covered by a downloaded mwms and false otherwise. +/// \note |position| has coordinates in mercator. +/// \note This method takes into acount only maps enumerated in countries.txt. +bool IsPointCoveredByDownloadedMaps(m2::PointD const & position, + Storage const & storage, + CountryInfoGetter const & countryInfoGetter); + +} // namespace storage