From b45d339674db25dfd2123d7ddd5cbfa95d1637bf Mon Sep 17 00:00:00 2001 From: Vladimir Byko-Ianko Date: Wed, 3 Feb 2016 11:45:34 +0300 Subject: [PATCH] [new downloader] Adding storage_helpers. --- storage/storage_helpers.cpp | 16 ++++++++++++++++ storage/storage_helpers.hpp | 17 +++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 storage/storage_helpers.cpp create mode 100644 storage/storage_helpers.hpp 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