| 101 | } |
| 102 | |
| 103 | std::vector<m2::PointD> MergePoints(ankerl::unordered_dense::map<FeatureID, std::vector<m2::PointD>> && points, |
| 104 | std::vector<FeatureID> const & featuresOrder) |
| 105 | { |
| 106 | if (points.size() == 1) |
| 107 | return std::move(points.begin()->second); |
| 108 | |
| 109 | size_t sz = 0; |
| 110 | for (auto const & p : points) |
| 111 | sz += p.second.size(); |
| 112 | |
| 113 | std::vector<m2::PointD> result; |
| 114 | result.reserve(sz); |
| 115 | for (auto const & f : featuresOrder) |
| 116 | { |
| 117 | auto const it = points.find(f); |
| 118 | ASSERT(it != points.cend(), ()); |
| 119 | |
| 120 | if (!result.empty()) |
| 121 | { |
| 122 | auto iBeg = it->second.begin(); |
| 123 | if (result.back().EqualDxDy(*iBeg, kMwmPointAccuracy)) |
| 124 | ++iBeg; |
| 125 | result.insert(result.end(), iBeg, it->second.end()); |
| 126 | } |
| 127 | else |
| 128 | result = std::move(it->second); |
| 129 | } |
| 130 | |
| 131 | return result; |
| 132 | } |
| 133 | } // namespace |
| 134 | |
| 135 | namespace df |