| 135 | } |
| 136 | |
| 137 | std::vector<std::vector<FeaturePlace const *>> FindClusters(std::vector<FeaturePlace> const & places) |
| 138 | { |
| 139 | auto const & localityChecker = ftypes::IsLocalityChecker::Instance(); |
| 140 | |
| 141 | auto getRaduis = [&localityChecker](FeaturePlace const & fp) |
| 142 | { return GetRadiusM(localityChecker.GetType(fp.GetPlaceType())); }; |
| 143 | |
| 144 | auto isSamePlace = [&localityChecker](FeaturePlace const & lFP, FeaturePlace const & rFP) |
| 145 | { |
| 146 | if (lFP.m_rect.IsIntersect(rFP.m_rect)) |
| 147 | return true; |
| 148 | |
| 149 | // If we have "true" boundaries and they are not intersecting - return false. |
| 150 | // IsEmptyInterior() == true for Point FB. |
| 151 | if (!lFP.m_rect.IsEmptyInterior() && !rFP.m_rect.IsEmptyInterior()) |
| 152 | return false; |
| 153 | |
| 154 | /// @todo Small hack here. Need to check enclosing/parent region. |
| 155 | /// @see https://github.com/organicmaps/organicmaps/issues/2035 for more details. |
| 156 | // Do not merge places with different ranks (population). See https://www.openstreetmap.org/#map=15/33.0145/-92.7249 |
| 157 | // Junction City in Arkansas and Louisiana. |
| 158 | if (lFP.GetRank() > 0 && rFP.GetRank() > 0 && lFP.GetRank() != rFP.GetRank()) |
| 159 | return false; |
| 160 | |
| 161 | // Assume that equal-type localities within some fixed radius (GetRadiusM) are the same. |
| 162 | return localityChecker.GetType(lFP.GetPlaceType()) == localityChecker.GetType(lFP.GetPlaceType()); |
| 163 | }; |
| 164 | |
| 165 | return GetClusters(places, std::move(getRaduis), std::move(isSamePlace)); |
| 166 | } |
| 167 | |
| 168 | PlaceProcessor::PlaceProcessor(std::string const & filename) : m_logTag("PlaceProcessor") |
| 169 | { |
no test coverage detected