| 171 | } |
| 172 | |
| 173 | void EncodePolylinePrev3(InPointsT const & points, m2::PointU const & basePoint, m2::PointU const & maxPoint, |
| 174 | OutDeltasT & deltas) |
| 175 | { |
| 176 | ASSERT_LESS_OR_EQUAL(basePoint.x, maxPoint.x, (basePoint, maxPoint)); |
| 177 | ASSERT_LESS_OR_EQUAL(basePoint.y, maxPoint.y, (basePoint, maxPoint)); |
| 178 | |
| 179 | size_t const count = points.size(); |
| 180 | if (count > 0) |
| 181 | { |
| 182 | deltas.push_back(EncodePointDeltaAsUint(points[0], basePoint)); |
| 183 | if (count > 1) |
| 184 | { |
| 185 | deltas.push_back(EncodePointDeltaAsUint(points[1], points[0])); |
| 186 | if (count > 2) |
| 187 | { |
| 188 | m2::PointD const maxPointD(maxPoint); |
| 189 | m2::PointU const prediction = PredictPointInPolyline(maxPointD, points[1], points[0]); |
| 190 | deltas.push_back(EncodePointDeltaAsUint(points[2], prediction)); |
| 191 | for (size_t i = 3; i < count; ++i) |
| 192 | { |
| 193 | m2::PointU const prediction = PredictPointInPolyline(maxPointD, points[i - 1], points[i - 2], points[i - 3]); |
| 194 | deltas.push_back(EncodePointDeltaAsUint(points[i], prediction)); |
| 195 | } |
| 196 | } |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | ASSERT(TestDecoding(points, basePoint, maxPoint, deltas, &DecodePolylinePrev3), ()); |
| 201 | } |
| 202 | |
| 203 | void DecodePolylinePrev3(InDeltasT const & deltas, m2::PointU const & basePoint, m2::PointU const & maxPoint, |
| 204 | OutPointsT & points) |
nothing calls this directly
no test coverage detected