| 104 | } |
| 105 | |
| 106 | void 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 | { |
no test coverage detected