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

Function GetRelationsGeometry

libs/editor/feature_matcher.cpp:140–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140Polygon GetRelationsGeometry(pugi::xml_document const & osmResponse, pugi::xml_node const & relation)
141{
142 Polygon result;
143 MultiLinestring outerLines;
144
145 auto const fn = [&osmResponse, &result, &outerLines](pugi::xml_node const & way, std::string const & role)
146 {
147 if (role == "outer")
148 {
149 outerLines.emplace_back();
150 AppendWay(osmResponse, way, outerLines.back());
151 }
152 else if (role == "inner")
153 {
154 if (result.inners().empty())
155 result.inners().emplace_back();
156
157 // Support several inner rings.
158 AddInnerIfNeeded(osmResponse, way, result);
159 AppendWay(osmResponse, way, result.inners().back());
160 }
161 };
162
163 ForEachWayInRelation(osmResponse, relation, fn);
164
165 MakeOuterRing(outerLines, result);
166 bg::correct(result);
167
168 return result;
169}
170
171Polygon GetWaysOrRelationsGeometry(pugi::xml_document const & osmResponse, pugi::xml_node const & wayOrRelation)
172{

Callers 1

Calls 7

AppendWayFunction · 0.85
AddInnerIfNeededFunction · 0.85
ForEachWayInRelationFunction · 0.85
MakeOuterRingFunction · 0.85
backMethod · 0.80
emplace_backMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected