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

Method FindTopRelation

generator/collector_building_parts.cpp:129–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127}
128
129base::GeoObjectId BuildingPartsCollector::FindTopRelation(base::GeoObjectId elId)
130{
131 IdRelationVec elements;
132 RelationFetcher fetcher(elements);
133 cache::IntermediateDataReaderInterface::ForEachRelationFn wrapper =
134 base::ControlFlowWrapper<RelationFetcher>(fetcher);
135 IdRelationVec::const_iterator it;
136 auto const serialId = elId.GetSerialId();
137 if (elId.GetType() == base::GeoObjectId::Type::ObsoleteOsmWay)
138 {
139 m_cache->ForEachRelationByWayCached(serialId, wrapper);
140 it = base::FindIf(elements,
141 [&](auto const & idRelation) { return idRelation.second.GetWayRole(serialId) == "outline"; });
142 }
143 else if (elId.GetType() == base::GeoObjectId::Type::ObsoleteOsmRelation)
144 {
145 m_cache->ForEachRelationByRelationCached(serialId, wrapper);
146 it = base::FindIf(
147 elements, [&](auto const & idRelation) { return idRelation.second.GetRelationRole(serialId) == "outline"; });
148 }
149
150 return it != std::end(elements) ? base::MakeOsmRelation(it->first) : base::GeoObjectId();
151}
152
153void BuildingPartsCollector::Finish()
154{

Callers

nothing calls this directly

Calls 10

MakeOsmRelationFunction · 0.85
GetSerialIdMethod · 0.80
GetWayRoleMethod · 0.80
GetRelationRoleMethod · 0.80
GeoObjectIdClass · 0.70
FindIfFunction · 0.50
endFunction · 0.50
GetTypeMethod · 0.45

Tested by

no test coverage detected