| 127 | } |
| 128 | |
| 129 | base::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 | |
| 153 | void BuildingPartsCollector::Finish() |
| 154 | { |
nothing calls this directly
no test coverage detected