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

Function GetHonestAffiliations

generator/affiliation.cpp:133–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131
132template <typename T>
133std::vector<std::string> GetHonestAffiliations(T && t, IndexSharedPtr const & index)
134{
135 std::vector<std::string> affiliations;
136 ankerl::unordered_dense::set<borders::CountryPolygons const *> countires;
137 ForEachPoint(t, [&](auto const & point)
138 {
139 std::vector<CountriesFilesIndexAffiliation::Value> values;
140 boost::geometry::index::query(*index, boost::geometry::index::covers(point), std::back_inserter(values));
141 for (auto const & v : values)
142 {
143 if (v.second.size() == 1)
144 {
145 borders::CountryPolygons const & cp = v.second.front();
146 if (countires.insert(&cp).second)
147 affiliations.emplace_back(cp.GetName());
148 }
149 else
150 {
151 for (borders::CountryPolygons const & cp : v.second)
152 if (cp.Contains(point) && countires.insert(&cp).second)
153 affiliations.emplace_back(cp.GetName());
154 }
155 }
156 });
157
158 return affiliations;
159}
160
161template <typename T>
162std::vector<std::string> GetAffiliations(T && t, IndexSharedPtr const & index)

Callers 1

GetAffiliationsFunction · 0.85

Calls 7

ForEachPointFunction · 0.85
frontMethod · 0.80
sizeMethod · 0.45
insertMethod · 0.45
emplace_backMethod · 0.45
GetNameMethod · 0.45
ContainsMethod · 0.45

Tested by

no test coverage detected