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

Method ProcessRoundabouts

generator/final_processor_country.cpp:99–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97*/
98
99void CountryFinalProcessor::ProcessRoundabouts()
100{
101 auto const roundabouts = ReadMiniRoundabouts(m_miniRoundaboutsFilename);
102
103 AddressesHolder addresses;
104 addresses.Deserialize(m_addrInterpolFilename);
105
106 ForEachMwmTmp(m_temporaryMwmPath, [&](auto const & name, auto const & path)
107 {
108 if (!IsCountry(name))
109 return;
110
111 MiniRoundaboutTransformer transformer(roundabouts.GetData(), *m_affiliations);
112
113 RegionData data;
114 if (ReadRegionData(name, data))
115 transformer.SetLeftHandTraffic(data.Get(RegionData::Type::RD_DRIVING) == "l");
116
117 FeatureBuilderWriter<serialization_policy::MaxAccuracy> writer(path, true /* mangleName */);
118 ForEachFeatureRawFormat<serialization_policy::MaxAccuracy>(path, [&](FeatureBuilder && fb, uint64_t)
119 {
120 if (roundabouts.IsRoadExists(fb))
121 transformer.AddRoad(std::move(fb));
122 else
123 {
124 auto const & checker = ftypes::IsAddressInterpolChecker::Instance();
125 // Check HasOsmIds() because we have non-OSM addr:interpolation FBs (Tiger).
126 if (fb.IsLine() && fb.HasOsmIds() && checker(fb.GetTypes()))
127 {
128 if (!addresses.Update(fb))
129 {
130 // Not only invalid interpolation ways, but fancy buildings with interpolation type like here:
131 // https://www.openstreetmap.org/#map=18/39.45672/-77.97516
132 if (fb.RemoveTypesIf(checker))
133 return;
134 }
135 }
136
137 writer.Write(fb);
138 }
139 });
140
141 // Adds new way features generated from mini-roundabout nodes with those nodes ids.
142 // Transforms points on roads to connect them with these new roundabout junctions.
143 transformer.ProcessRoundabouts([&writer](FeatureBuilder const & fb) { writer.Write(fb); });
144 }, m_threadsCount);
145}
146
147bool DoesBuildingConsistOfParts(FeatureBuilder const & fbBuilding, m4::Tree<m2::RegionI> const & buildingPartsKDTree)
148{

Callers

nothing calls this directly

Calls 15

ReadMiniRoundaboutsFunction · 0.85
ForEachMwmTmpFunction · 0.85
ReadRegionDataFunction · 0.85
SetLeftHandTrafficMethod · 0.80
IsRoadExistsMethod · 0.80
IsLineMethod · 0.80
HasOsmIdsMethod · 0.80
RemoveTypesIfMethod · 0.80
DeserializeMethod · 0.45
GetDataMethod · 0.45
GetMethod · 0.45
AddRoadMethod · 0.45

Tested by

no test coverage detected