MCPcopy Create free account
hub / github.com/comaps/comaps / IsOneCountryForLimitRect

Function IsOneCountryForLimitRect

generator/affiliation.cpp:115–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113}
114
115std::optional<std::string> IsOneCountryForLimitRect(m2::RectD const & limitRect, IndexSharedPtr const & index)
116{
117 borders::CountryPolygons const * country = nullptr;
118 std::vector<CountriesFilesIndexAffiliation::Value> values;
119 auto const bbox = MakeBox(limitRect);
120 boost::geometry::index::query(*index, boost::geometry::index::covers(bbox), std::back_inserter(values));
121 for (auto const & v : values)
122 {
123 for (borders::CountryPolygons const & c : v.second)
124 if (!country)
125 country = &c;
126 else if (country != &c)
127 return {};
128 }
129 return country ? country->GetName() : std::optional<std::string>{};
130}
131
132template <typename T>
133std::vector<std::string> GetHonestAffiliations(T && t, IndexSharedPtr const & index)

Callers 1

GetAffiliationsFunction · 0.85

Calls 2

MakeBoxFunction · 0.85
GetNameMethod · 0.45

Tested by

no test coverage detected