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

Method ProcessRawEntries

generator/address_enricher.cpp:106–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104}
105
106void AddressEnricher::ProcessRawEntries(std::string const & path, TFBCollectFn const & fn)
107{
108 FileReader reader(path);
109 ReaderSource src(reader);
110 while (src.Size())
111 {
112 Entry e;
113 e.Load(src);
114
115 std::vector<int64_t> iPoints;
116 rw::Read(src, iPoints);
117
118 e.m_points.reserve(iPoints.size());
119 for (auto const i : iPoints)
120 e.m_points.push_back(Int64ToPointObsolete(i, kPointCoordBits));
121
122 auto const res = Match(e);
123 if (!res.street)
124 {
125 ++m_stats.m_noStreet;
126 LOG(LDEBUG, ("No street found:", e.m_street, mercator::ToLatLon(e.m_points.front())));
127 continue;
128 }
129 if (res.interpol)
130 {
131 ++m_stats.m_existInterpol;
132 continue;
133 }
134
135 auto const addNode = [&](m2::PointD const & p, std::string hn)
136 {
137 feature::FeatureBuilder fb;
138 fb.SetCenter(p);
139 fb.SetType(m_addrType);
140
141 auto & params = fb.GetParams();
142 params.SetStreet(e.m_street);
143 params.SetPostcode(e.m_postcode);
144
145 CHECK(!hn.empty(), ());
146 params.SetHouseNumberAndHouseName(std::move(hn), {});
147 params.SetGeomTypePointEx();
148
149 fn(std::move(fb));
150 };
151
152 if (e.m_points.size() == 1)
153 {
154 if (!res.from && !res.to && res.addrsInside == 0)
155 {
156 ++m_stats.m_addedSingle;
157 addNode(e.m_points.front(), e.m_from + " - " + e.m_to);
158 }
159 else
160 ++m_stats.m_existSingle;
161 }
162 else
163 {

Callers 1

AddAddressesMethod · 0.80

Calls 15

Int64ToPointObsoleteFunction · 0.85
MatchEnum · 0.85
frontMethod · 0.80
GetParamsMethod · 0.80
SetGeomTypePointExMethod · 0.80
backMethod · 0.80
SetLinearMethod · 0.80
ToLatLonFunction · 0.70
ReadFunction · 0.50
DistanceOnEarthFunction · 0.50
SizeMethod · 0.45

Tested by

no test coverage detected