| 34 | double constexpr kPointDiffEps = 1e-5; |
| 35 | |
| 36 | void AddInnerIfNeeded(pugi::xml_document const & osmResponse, pugi::xml_node const & way, Polygon & dest) |
| 37 | { |
| 38 | if (dest.inners().empty() || dest.inners().back().empty()) |
| 39 | return; |
| 40 | |
| 41 | auto const refs = way.select_nodes("nd/@ref"); |
| 42 | if (refs.empty()) |
| 43 | return; |
| 44 | |
| 45 | std::string const nodeRef = refs[0].attribute().value(); |
| 46 | auto const node = osmResponse.select_node(("osm/node[@id='" + nodeRef + "']").data()).node(); |
| 47 | ASSERT(node, ("OSM response have ref", nodeRef, "but have no node with such id.", osmResponse)); |
| 48 | XMLFeature xmlFt(node); |
| 49 | |
| 50 | auto const & pt = dest.inners().back().back(); |
| 51 | m2::PointD lastPoint(pt.x(), pt.y()); |
| 52 | |
| 53 | if (lastPoint.EqualDxDy(xmlFt.GetMercatorCenter(), kPointDiffEps)) |
| 54 | return; |
| 55 | |
| 56 | dest.inners().emplace_back(); |
| 57 | } |
| 58 | |
| 59 | void MakeOuterRing(MultiLinestring & outerLines, Polygon & dest) |
| 60 | { |
no test coverage detected