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

Function AddInnerIfNeeded

libs/editor/feature_matcher.cpp:36–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34double constexpr kPointDiffEps = 1e-5;
35
36void 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
59void MakeOuterRing(MultiLinestring & outerLines, Polygon & dest)
60{

Callers 1

GetRelationsGeometryFunction · 0.85

Calls 10

ASSERTFunction · 0.85
backMethod · 0.80
GetMercatorCenterMethod · 0.80
emptyMethod · 0.45
valueMethod · 0.45
dataMethod · 0.45
xMethod · 0.45
yMethod · 0.45
EqualDxDyMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected